:root {
    --navy-950: #091629;
    --navy-900: #0d213d;
    --navy-800: #153253;
    --navy-700: #20486f;
    --gold: #c6a15b;
    --gold-soft: #f5eddd;
    --ink: #172033;
    --muted: #6b7689;
    --line: #e3e8ef;
    --surface: #f5f7fa;
    --sidebar-width: 260px;
}

body { background: var(--surface); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--navy-700); }
.app-shell { min-height: 100vh; }
.sidebar { width: var(--sidebar-width) !important; background: var(--navy-950); color: #fff; border: 0 !important; }
.sidebar-brand { min-height: 82px; padding: 1.25rem 1.35rem; display: flex; align-items: center; gap: .8rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--gold); color: var(--navy-950); font-size: 1.25rem; }
.brand-title { color: #fff; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.brand-subtitle { color: #91a1b8; font-size: .72rem; text-transform: uppercase; letter-spacing: .11em; }
.sidebar-nav { padding: 1rem .85rem; }
.nav-section { color: #71839b; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; padding: 1.15rem .75rem .45rem; }
.sidebar .nav-link { color: #aebbd0; border-radius: 9px; padding: .7rem .8rem; display: flex; gap: .75rem; align-items: center; font-weight: 500; margin-bottom: .2rem; }
.sidebar .nav-link i { font-size: 1.05rem; }
.sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar .nav-link.active { color: #fff; background: var(--navy-800); box-shadow: inset 3px 0 var(--gold); }
.sidebar-subnav { margin: .25rem 0 .6rem 2.85rem; padding-left: .75rem; border-left: 1px solid rgba(255,255,255,.14); display: grid; gap: .15rem; }
.sidebar-subnav a { color: #8798af; font-size: .75rem; text-decoration: none; padding: .3rem .2rem; }
.sidebar-subnav a:hover, .sidebar-subnav a.active { color: #fff; }
.sidebar-subnav a.active { font-weight: 650; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); padding: 1rem 1.25rem; color: #8fa0b8; font-size: .75rem; }
.app-main { min-width: 0; }
.topbar { min-height: 72px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: .75rem 1.5rem; position: sticky; top: 0; z-index: 1020; }
.topbar-title { font-weight: 700; color: var(--navy-900); letter-spacing: -.015em; }
.topbar-subtitle { color: var(--muted); font-size: .78rem; }
.user-chip { display: flex; align-items: center; gap: .65rem; padding-left: 1rem; border-left: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); color: #866728; font-weight: 700; }
.content { padding: 1.5rem; }
.page-kicker { color: #9a7735; font-size: .72rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.page-title { color: var(--navy-900); font-size: 1.65rem; font-weight: 750; letter-spacing: -.025em; }
.page-description { color: var(--muted); margin-bottom: 0; }
.card { border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 4px 18px rgba(15,33,61,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--line); padding: 1rem 1.2rem; }
.metric-card { overflow: hidden; position: relative; }
.metric-card::after { content: ""; position: absolute; inset: 0 0 0 auto; width: 4px; background: var(--gold); }
.metric-label { color: var(--muted); font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .055em; }
.metric-value { font-size: 1.75rem; color: var(--navy-900); font-weight: 750; letter-spacing: -.04em; }
.metric-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: #edf2f7; color: var(--navy-700); }
.btn { border-radius: 8px; font-weight: 600; }
.btn-primary { background: var(--navy-800); border-color: var(--navy-800); }
.btn-primary:hover { background: var(--navy-900); border-color: var(--navy-900); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy-950); }
.btn-gold:hover { background: #b6904b; border-color: #b6904b; color: var(--navy-950); }
.form-control, .form-select { border-color: #d8dee8; border-radius: 8px; padding: .62rem .75rem; }
.form-control:focus, .form-select:focus { border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(198,161,91,.16); }
.form-label { color: #3b4658; font-size: .82rem; font-weight: 650; }
.filter-bar { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.table { --bs-table-hover-bg: #f8fafc; }
.table thead th { background: #f7f9fb; color: #637086; font-size: .71rem; text-transform: uppercase; letter-spacing: .055em; border-bottom-width: 1px; padding: .8rem 1rem; white-space: nowrap; }
.table tbody td { padding: .9rem 1rem; border-color: #edf0f4; }
.table-title { color: var(--navy-900); font-weight: 700; }
.table-subtitle { color: var(--muted); font-size: .78rem; }
.badge { font-weight: 650; padding: .4rem .58rem; border-radius: 6px; }
.badge-soft-success { background: #e7f4ec; color: #297047; }
.badge-soft-warning { background: #fbf1dc; color: #8b681f; }
.badge-soft-info { background: #e7f0f8; color: #2e628a; }
.badge-soft-secondary { background: #edf0f4; color: #5d6777; }
.badge-soft-danger { background: #f9e8e8; color: #9a4141; }
.empty-state { text-align: center; padding: 3.5rem 1.5rem; color: var(--muted); }
.empty-icon { width: 56px; height: 56px; display: grid; place-items: center; margin: 0 auto 1rem; border-radius: 16px; background: var(--gold-soft); color: #97722e; font-size: 1.4rem; }
.section-title { color: var(--navy-900); font-size: 1rem; font-weight: 700; }
.section-note { color: var(--muted); font-size: .82rem; }
.progress { height: 7px; background: #e8ecf1; }
.progress-bar { background: var(--gold); }
.chart-wrap { position: relative; min-height: 290px; }
.footer-note { color: #8a94a4; font-size: .76rem; padding: 0 1.5rem 1.25rem; }
.login-page { min-height: 100vh; background: #eef1f5; }
.login-shell { width: min(1040px, calc(100% - 2rem)); min-height: 620px; background: #fff; border-radius: 20px; overflow: hidden; box-shadow: 0 25px 70px rgba(13,33,61,.16); }
.login-visual { background: linear-gradient(145deg, rgba(9,22,41,.95), rgba(21,50,83,.96)); color: #fff; padding: 3.5rem; position: relative; overflow: hidden; }
.login-visual::after { content: ""; width: 360px; height: 360px; border: 1px solid rgba(198,161,91,.35); border-radius: 50%; position: absolute; right: -155px; bottom: -135px; box-shadow: 0 0 0 45px rgba(198,161,91,.04), 0 0 0 90px rgba(198,161,91,.025); }
.login-panel { padding: 3.5rem; }
.login-feature { display: flex; gap: .8rem; margin-top: 1.25rem; color: #c4cedc; }
.login-feature i { color: var(--gold); }
.theme-toggle { white-space: nowrap; }
.login-theme-toggle { position: fixed; top: 1rem; right: 1rem; z-index: 10; }
.customer-section-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; }
.customer-section-button { min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: .75rem; padding: .9rem; color: var(--ink); text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 4px 14px rgba(15,33,61,.035); transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.customer-section-button:hover { color: var(--navy-900); border-color: #c6a15b; box-shadow: 0 8px 22px rgba(15,33,61,.09); transform: translateY(-2px); }
.customer-section-button.active { color: #fff; background: linear-gradient(135deg, var(--navy-800), var(--navy-700)); border-color: var(--navy-800); box-shadow: 0 8px 22px rgba(21,50,83,.2); }
.customer-section-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: var(--gold-soft); color: #8a692b; font-size: 1.1rem; }
.customer-section-button.active .customer-section-icon { background: rgba(255,255,255,.14); color: var(--gold); }
.customer-section-button strong, .customer-section-button small { display: block; overflow: hidden; text-overflow: ellipsis; }
.customer-section-button strong { font-size: .86rem; line-height: 1.25; }
.customer-section-button small { color: var(--muted); font-size: .69rem; margin-top: .18rem; white-space: nowrap; }
.customer-section-button.active small { color: rgba(255,255,255,.68); }
.customer-section-arrow { color: var(--muted); font-size: .75rem; }
.customer-section-button.active .customer-section-arrow { color: var(--gold); }

[data-bs-theme="light"] {
    --ink: #172033;
    --muted: #5f6b7d;
    --line: #dfe5ed;
    --surface: #f5f7fa;
    --navy-900: #0d213d;
    --navy-800: #153253;
    --navy-700: #20486f;
    --gold-soft: #f5eddd;
    --bs-body-color: #172033;
    --bs-body-bg: #f5f7fa;
    --bs-border-color: #dfe5ed;
    --bs-secondary-color: #5f6b7d;
    color-scheme: light;
}
[data-bs-theme="light"] .topbar,
[data-bs-theme="light"] .card,
[data-bs-theme="light"] .card-header,
[data-bs-theme="light"] .filter-bar,
[data-bs-theme="light"] .login-shell,
[data-bs-theme="light"] .dropdown-menu { background-color: #fff; color: var(--ink); }
[data-bs-theme="light"] .text-secondary,
[data-bs-theme="light"] .text-muted,
[data-bs-theme="light"] .form-text { color: var(--muted) !important; }
[data-bs-theme="light"] .form-label { color: #344054; }
[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select,
[data-bs-theme="light"] .input-group-text { background-color: #fff; border-color: #cfd7e3; color: var(--ink); }
[data-bs-theme="light"] .form-control::placeholder { color: #7b8798; opacity: 1; }
[data-bs-theme="light"] .form-control:disabled,
[data-bs-theme="light"] .form-control[readonly],
[data-bs-theme="light"] .form-select:disabled,
[data-bs-theme="light"] .bg-light,
[data-bs-theme="light"] .bg-light-subtle { background-color: #f1f4f8 !important; color: var(--ink) !important; }
[data-bs-theme="light"] .btn-light { --bs-btn-color:#172033; --bs-btn-bg:#fff; --bs-btn-border-color:#cfd7e3; --bs-btn-hover-color:#0d213d; --bs-btn-hover-bg:#eef2f6; --bs-btn-hover-border-color:#b9c4d2; }
[data-bs-theme="light"] .table { --bs-table-color:#172033; --bs-table-bg:#fff; --bs-table-border-color:#e3e8ef; --bs-table-hover-color:#0d213d; --bs-table-hover-bg:#f6f8fb; }
[data-bs-theme="light"] .table thead th { background: #f3f6f9; color: #526075; }
[data-bs-theme="light"] .dropdown-item { color: var(--ink); }
[data-bs-theme="light"] .dropdown-item:hover,
[data-bs-theme="light"] .dropdown-item:focus { background-color: #eef2f6; color: var(--navy-900); }

[data-bs-theme="dark"] {
    --ink: #e7edf5;
    --muted: #a3afc0;
    --line: #2a3a50;
    --surface: #0b1422;
    --navy-900: #e7edf5;
    --navy-800: #315f8d;
    --navy-700: #78a9d4;
    --gold-soft: #3a3020;
    --bs-body-color: #e7edf5;
    --bs-body-bg: #0b1422;
    --bs-border-color: #2a3a50;
    --bs-secondary-color: #a3afc0;
    color-scheme: dark;
}
[data-bs-theme="dark"] .sidebar { background: #07101d; }
[data-bs-theme="dark"] .sidebar .nav-link.active { background: #173653; }
[data-bs-theme="dark"] .topbar,
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .filter-bar,
[data-bs-theme="dark"] .login-shell { background-color: #121e2d; color: var(--ink); }
[data-bs-theme="dark"] .metric-icon { background: #1d3045; }
[data-bs-theme="dark"] .form-label { color: #c5d0de; }
[data-bs-theme="dark"] .form-text,
[data-bs-theme="dark"] .text-muted { color: #95a4b7 !important; }
[data-bs-theme="dark"] .btn-primary:hover { background: #3a6f9f; border-color: #3a6f9f; }
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text { background-color: #0e1927 !important; border-color: #34465d; color: #e7edf5; }
[data-bs-theme="dark"] .form-control::placeholder { color: #718097; }
[data-bs-theme="dark"] .form-control:disabled,
[data-bs-theme="dark"] .form-control[readonly],
[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-light-subtle { background-color: #182638 !important; color: #cbd5e1 !important; }
[data-bs-theme="dark"] .bg-white { background-color: #0e1927 !important; }
[data-bs-theme="dark"] .text-dark { color: #e7edf5 !important; }
[data-bs-theme="dark"] .text-secondary { color: #a3afc0 !important; }
[data-bs-theme="dark"] .page-kicker { color: #dab96f; }
[data-bs-theme="dark"] .avatar { color: #e1bd6f; }
[data-bs-theme="dark"] .btn-light { --bs-btn-color:#dbe5f0; --bs-btn-bg:#182638; --bs-btn-border-color:#34465d; --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#22344a; --bs-btn-hover-border-color:#455c77; }
[data-bs-theme="dark"] .table { --bs-table-color:#dbe5f0; --bs-table-bg:#121e2d; --bs-table-border-color:#28394e; --bs-table-hover-color:#fff; --bs-table-hover-bg:#18283b; }
[data-bs-theme="dark"] .table thead th { background: #172638; color: #aebbd0; }
[data-bs-theme="dark"] .table tbody td { border-color: #28394e; }
[data-bs-theme="dark"] .progress { background: #243449; }
[data-bs-theme="dark"] .alert-light { background: #182638; color: #dbe5f0; }
[data-bs-theme="dark"] .badge-soft-success { background: #173a2a; color: #8bd5aa; }
[data-bs-theme="dark"] .badge-soft-warning { background: #3c3018; color: #e7c271; }
[data-bs-theme="dark"] .badge-soft-info { background: #16364b; color: #8ec8ed; }
[data-bs-theme="dark"] .badge-soft-secondary { background: #273446; color: #c2ccda; }
[data-bs-theme="dark"] .badge-soft-danger { background: #442326; color: #f1a5aa; }
[data-bs-theme="dark"] img[style*="#d8dee8"] { border-color: #455a72 !important; }
[data-bs-theme="dark"] input[type="date"] { color-scheme: dark; }
[data-bs-theme="dark"] code { color: #e1b86b; }
[data-bs-theme="dark"] .login-page { background: #080f1a; }
[data-bs-theme="dark"] .login-panel { background: #121e2d; }
[data-bs-theme="dark"] .customer-section-button { background: #121e2d; }
[data-bs-theme="dark"] .customer-section-button:hover { border-color: var(--gold); box-shadow: 0 8px 22px rgba(0,0,0,.24); }
[data-bs-theme="dark"] .customer-section-button.active { background: linear-gradient(135deg, #214a70, #2c638f); }

@media (min-width: 992px) {
    .sidebar { position: fixed; inset: 0 auto 0 0; transform: none !important; visibility: visible !important; }
    .app-main { margin-left: var(--sidebar-width); min-height: 100vh; }
}
@media (max-width: 991.98px) {
    .content { padding: 1.1rem; }
    .topbar { padding: .7rem 1rem; }
    .user-copy { display: none; }
    .customer-section-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575.98px) {
    .page-title { font-size: 1.4rem; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; }
    .login-panel { padding: 2rem 1.5rem; }
    .table tbody td, .table thead th { padding-left: .75rem; padding-right: .75rem; }
    .customer-section-grid { grid-template-columns: 1fr; gap: .6rem; }
    .customer-section-button { padding: .75rem .85rem; }
}
