* {
    box-sizing: border-box;
}

:root {
    --bg: #f3f6fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #687386;
    --line: #e4e9f2;
    --primary: #1f5eff;
    --primary-dark: #1646bf;
    --nav: #0f172a;
    --nav-soft: #1e293b;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --info-bg: #dbeafe;
    --info-text: #1e40af;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 275px;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #fff;
    padding: 22px;
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 800;
    background: #2563eb;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .35);
}

.brand h2 {
    margin: 0;
    font-size: 19px;
    letter-spacing: -.02em;
}

.brand p {
    margin: 3px 0 0;
    font-size: 12px;
    color: #cbd5e1;
}

.nav {
    margin-top: 22px;
    display: grid;
    gap: 6px;
}

.nav a {
    color: #dbeafe;
    padding: 11px 12px;
    border-radius: 11px;
    font-weight: 600;
    font-size: 14px;
}

.nav a:hover {
    background: rgba(255,255,255,.10);
    color: #fff;
    text-decoration: none;
}

.sidebar-footer {
    margin-top: auto;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    color: #cbd5e1;
    font-size: 13px;
}

.sidebar-footer strong {
    color: #fff;
}

.main {
    margin-left: 275px;
    width: calc(100% - 275px);
    padding: 28px 34px 60px;
}

.topbar {
    background: linear-gradient(135deg, #ffffff 0%, #eef4ff 100%);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 22px 24px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
}

.eyebrow {
    display: block;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.topbar-title {
    margin: 5px 0 0;
    font-size: 26px;
    letter-spacing: -.04em;
}

.topbar-actions {
    display: flex;
    gap: 10px;
}

.quick-link,
.btn,
button {
    background: var(--nav-soft);
    color: white !important;
    padding: 10px 15px;
    border-radius: 11px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: inline-block;
    text-decoration: none !important;
    box-shadow: 0 8px 16px rgba(15, 23, 42, .12);
}

.quick-link.primary,
.btn {
    background: var(--primary);
}

.btn.secondary {
    background: #334155;
    margin-left: 8px;
}

button:hover,
.btn:hover,
.quick-link:hover {
    filter: brightness(.96);
    text-decoration: none;
}

h1 {
    font-size: 28px;
    letter-spacing: -.04em;
    margin: 0 0 18px;
}

h2 {
    margin: 26px 0 12px;
    font-size: 19px;
    letter-spacing: -.02em;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4px 0 18px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(175px, 1fr));
    gap: 16px;
    margin: 16px 0 24px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.card::after {
    content: "";
    position: absolute;
    right: -25px;
    top: -25px;
    width: 80px;
    height: 80px;
    background: rgba(31, 94, 255, .08);
    border-radius: 50%;
}

.card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.card strong {
    display: block;
    font-size: 28px;
    margin-top: 10px;
    letter-spacing: -.04em;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}

.searchbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px;
    margin: 15px 0 18px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.searchbar input,
.searchbar select {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
    min-height: 40px;
}

.searchbar input {
    width: 330px;
}

.small-input {
    width: 95px !important;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

th {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 13px;
    border-bottom: 1px solid var(--line);
}

td {
    padding: 13px;
    border-bottom: 1px solid var(--line);
    color: #243044;
    vertical-align: middle;
}

tr:hover td {
    background: #f8fbff;
}

.status {
    display: inline-block;
    background: var(--info-bg);
    color: var(--info-text);
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.progress-wrap {
    width: 110px;
    height: 10px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
}

.form-grid p {
    display: grid;
    grid-template-columns: 220px minmax(260px, 560px);
    gap: 12px;
    align-items: center;
}

.form-grid label {
    font-weight: 700;
    color: #334155;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    padding: 10px 12px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
}

.form-actions {
    margin-top: 22px;
}

@media (max-width: 1050px) {
    .sidebar {
        width: 220px;
    }

    .main {
        margin-left: 220px;
        width: calc(100% - 220px);
        padding: 18px;
    }

    .cards {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }

    .topbar {
        display: block;
    }

    .topbar-actions {
        margin-top: 14px;
    }
}

@media (max-width: 650px) {
    .sidebar {
        position: static;
        width: 100%;
    }

    .app-shell {
        display: block;
    }

    .main {
        margin-left: 0;
        width: 100%;
        padding: 18px;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .form-grid p {
        display: block;
    }

    .searchbar input {
        width: 100%;
    }
}

.muted { color: var(--muted); margin-top: -8px; }

.export-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* V15.1 navigation fix */
.sidebar {
    overflow-y: auto;
}

.grouped-nav {
    gap: 3px;
}

.nav-group-label {
    color: #93a4bd;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    padding: 14px 8px 4px;
}

.nav-main {
    background: rgba(37, 99, 235, .25);
    color: #fff !important;
}

.grouped-nav a {
    padding: 8px 10px;
    font-size: 13px;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.quick-tile {
    display: block;
    padding: 14px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: #0f172a;
}

.quick-tile strong {
    display: block;
    font-size: 14px;
}

.quick-tile span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}

.notice-card {
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
}

/* BK Accounting professional brand identity */
.brand-logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
    flex: 0 0 58px;
    border-radius: 14px;
    filter: drop-shadow(0 8px 16px rgba(0, 82, 255, .28));
}

@media (max-width: 1050px) {
    .brand-logo {
        width: 50px;
        height: 50px;
        flex-basis: 50px;
    }
}

@media (max-width: 650px) {
    .brand-logo {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
    }
}

/* ============================================================
   BK Accounting expandable sidebar groups
   ============================================================ */

.nav-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    margin: 15px 0 5px;
    padding: 8px 10px;

    border: 0;
    border-radius: 8px;

    background: transparent;
    color: #93a2bb;

    font: inherit;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;

    cursor: pointer;

    transition:
        background-color 0.18s ease,
        color 0.18s ease;
}

.nav-group-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.nav-group-toggle:focus-visible {
    outline: 2px solid #2f6cff;
    outline-offset: 2px;
}

.nav-group-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 20px;
    height: 20px;

    color: #93a2bb;

    font-size: 21px;
    line-height: 1;

    transform: rotate(0deg);

    transition:
        transform 0.18s ease,
        color 0.18s ease;
}

.nav-group-toggle.is-open
.nav-group-chevron {
    transform: rotate(90deg);
    color: #ffffff;
}

.nav-group-toggle.is-open {
    color: #ffffff;
}

.nav-group-links[hidden] {
    display: none !important;
}

.nav-group-links {
    display: block;
    animation: bkSidebarOpen 0.16s ease;
}

@keyframes bkSidebarOpen {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   BK Accounting sidebar vertical group refinement
   ============================================================ */

.nav-group-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0 8px 0;
}

.nav-group-links[hidden] {
    display: none !important;
}

.nav-group-links > a {
    display: block;
    width: 100%;
    box-sizing: border-box;

    padding: 8px 10px;
    margin: 0;

    border-radius: 7px;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    font-size: 13px;
    line-height: 1.25;
}

.nav-group-links > a:hover {
    background: rgba(255, 255, 255, 0.06);
}

.nav-group-toggle {
    margin-top: 12px;
    margin-bottom: 4px;
    padding: 9px 10px;
}

.nav-group-toggle + .nav-group-links {
    margin-top: 2px;
}

.nav-group-toggle.is-open {
    background: rgba(255, 255, 255, 0.035);
}

.nav-group-toggle.is-open + .nav-group-links {
    border-left: 2px solid rgba(47, 108, 255, 0.45);
    padding-left: 6px;
}