:root {
    color-scheme: dark;
    --bg: #06101d;
    --bg-2: #091827;
    --panel: rgba(13, 25, 43, .86);
    --panel-strong: rgba(16, 31, 53, .96);
    --panel-soft: rgba(255, 255, 255, .045);
    --text: #f2f6ff;
    --text-strong: #ffffff;
    --muted: #94a3b8;
    --muted-2: #64748b;
    --line: rgba(148, 163, 184, .16);
    --line-strong: rgba(148, 163, 184, .28);
    --primary: #f6c65b;
    --primary-2: #e6a93d;
    --primary-soft: rgba(246, 198, 91, .14);
    --blue: #5aa7ff;
    --blue-soft: rgba(90, 167, 255, .13);
    --green: #35d399;
    --green-soft: rgba(53, 211, 153, .13);
    --red: #ff6b7a;
    --red-soft: rgba(255, 107, 122, .13);
    --orange: #ffb86b;
    --orange-soft: rgba(255, 184, 107, .14);
    --shadow: 0 24px 70px rgba(0, 0, 0, .30);
    --shadow-soft: 0 14px 35px rgba(0, 0, 0, .18);
    --radius: 18px;
    --radius-sm: 12px;
    --sidebar: 268px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 20% -10%, rgba(246, 198, 91, .16), transparent 30%),
        radial-gradient(circle at 90% 0%, rgba(90, 167, 255, .16), transparent 32%),
        linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 52%, #050b14 100%);
    color: var(--text);
    line-height: 1.45;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.42), transparent 70%);
    z-index: -1;
}

body.is-compact {
    --radius: 14px;
    --radius-sm: 10px;
}

body.is-compact .content { padding: 18px 20px; }
body.is-compact .panel,
body.is-compact .card,
body.is-compact .focus-card,
body.is-compact .kpi { padding: 14px; }
body.is-compact th,
body.is-compact td { padding: 8px 9px; }
body.is-compact input,
body.is-compact select,
body.is-compact textarea { padding: 9px 10px; }

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 18px 14px;
    background: rgba(5, 12, 23, .84);
    border-right: 1px solid var(--line);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 30;
}

.brand-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 6px 12px;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
    text-decoration: none;
    min-width: 0;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--primary), #8ad9ff);
    color: #101827;
    font-weight: 950;
    letter-spacing: -.05em;
    box-shadow: 0 12px 28px rgba(246, 198, 91, .22);
}

.brand strong,
.user-copy strong { display: block; font-size: 14px; line-height: 1.1; }
.brand small,
.user-copy small,
.nav small { display: block; color: var(--muted); font-size: 11px; line-height: 1.25; }

.sidebar-close,
.menu-toggle,
.density-toggle {
    border: 1px solid var(--line);
    background: var(--panel-soft);
    color: var(--text);
    cursor: pointer;
}

.sidebar-close {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    font-size: 22px;
    line-height: 1;
}

.nav {
    display: grid;
    gap: 6px;
    padding: 4px 0;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 10px;
    min-height: 52px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: #dce7f7;
    text-decoration: none;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.nav a:hover {
    transform: translateX(2px);
    background: rgba(255,255,255,.055);
    border-color: var(--line);
}

.nav a.active {
    background: linear-gradient(135deg, rgba(246, 198, 91, .17), rgba(90, 167, 255, .10));
    border-color: rgba(246, 198, 91, .34);
    box-shadow: inset 3px 0 0 var(--primary);
}

.nav-index {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.06);
    color: var(--primary);
    font-size: 11px;
    font-weight: 900;
}

.nav-copy strong { display: block; font-size: 13px; }

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 10px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.045);
}

.avatar {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(246, 198, 91, .18);
    color: var(--primary);
    font-weight: 950;
    font-size: 12px;
}

.user-copy { min-width: 0; }
.user-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }

.logout-link {
    color: var(--muted);
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
}
.logout-link:hover { color: var(--text); background: rgba(255,255,255,.055); }

.mobile-backdrop { display: none; }

.content {
    width: min(100%, 1480px);
    margin: 0 auto;
    padding: 24px 26px 34px;
    overflow-x: hidden;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0 18px;
    margin-bottom: 4px;
    backdrop-filter: blur(16px);
}

.title-block {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    text-transform: uppercase;
    font-weight: 900;
    font-size: 11px;
    letter-spacing: .12em;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; color: var(--text-strong); font-size: clamp(24px, 3vw, 34px); letter-spacing: -.045em; line-height: 1.06; }
h2 { margin-bottom: 12px; color: var(--text-strong); font-size: 18px; letter-spacing: -.025em; }
h3 { margin-bottom: 9px; color: var(--text-strong); font-size: 15px; letter-spacing: -.015em; }
.title-block p { margin: 4px 0 0; color: var(--muted); }

.menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    padding: 10px;
}
.menu-toggle span { display: block; height: 2px; background: var(--text); border-radius: 999px; margin: 5px 0; }

.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.quick-action,
.density-toggle,
.today-pill {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.quick-action {
    color: #101827;
    background: linear-gradient(135deg, var(--primary), #8ad9ff);
    text-decoration: none;
    box-shadow: 0 14px 32px rgba(246, 198, 91, .18);
}
.quick-action.alt { color: var(--text); background: rgba(255,255,255,.07); border: 1px solid var(--line); box-shadow: none; }
.quick-action:hover { filter: brightness(1.05); }
.today-pill { color: var(--muted); background: rgba(255,255,255,.055); border: 1px solid var(--line); }
.density-toggle { border-radius: 12px; }

.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.positive-text { color: var(--green) !important; }
.negative-text { color: var(--red) !important; }
.warning-text { color: var(--orange) !important; }
.amount { font-weight: 950; white-space: nowrap; color: var(--text-strong); }

.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.kpi-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card,
.panel,
.kpi,
.focus-card,
.control-panel,
.auth-card {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.035));
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.card,
.panel,
.focus-card,
.control-panel,
.auth-card { padding: 18px; }
.card.metric,
.kpi { padding: 14px; }

.card:hover,
.panel:hover,
.kpi:hover,
.focus-card:hover { border-color: rgba(246, 198, 91, .22); }

.metric small,
.kpi small {
    display: block;
    color: var(--muted);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 10px;
}
.metric strong,
.kpi strong {
    display: block;
    margin-top: 7px;
    color: var(--text-strong);
    font-size: clamp(18px, 2vw, 24px);
    line-height: 1.05;
    letter-spacing: -.045em;
}
.metric span,
.kpi span { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; }

.focus-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, .9fr); gap: 12px; margin: 8px 0 14px; }
.focus-card { position: relative; overflow: hidden; min-height: 208px; }
.focus-card::after {
    content: "";
    position: absolute;
    right: -90px;
    top: -90px;
    width: 240px;
    height: 240px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(246,198,91,.22), transparent 66%);
}
.focus-card > * { position: relative; z-index: 1; }
.focus-card h2 { font-size: clamp(26px, 4vw, 48px); line-height: .98; max-width: 720px; margin-bottom: 14px; }
.focus-card p { max-width: 720px; color: var(--muted); margin-bottom: 16px; }
.focus-metrics { display: flex; flex-wrap: wrap; gap: 9px; }
.focus-chip {
    display: grid;
    gap: 3px;
    min-width: 142px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(0,0,0,.14);
}
.focus-chip small { color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.focus-chip strong { color: var(--text-strong); font-size: 15px; }

.score-card { display: grid; gap: 14px; }
.score-ring {
    --score: 0;
    width: 136px;
    height: 136px;
    margin: 4px auto 0;
    border-radius: 50%;
    background: conic-gradient(var(--primary) calc(var(--score) * 1%), rgba(255,255,255,.08) 0);
    display: grid;
    place-items: center;
    position: relative;
}
.score-ring::before {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: #0b1626;
    border: 1px solid var(--line);
}
.score-ring strong { position: relative; z-index: 1; font-size: 34px; letter-spacing: -.05em; }
.score-meta { text-align: center; }
.score-meta strong { display: block; font-size: 17px; }
.score-meta small { color: var(--muted); }

.control-panel { margin: 8px 0 14px; padding: 12px; }
.control-panel form { margin: 0; }

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.panel-head h2,
.panel-head h3 { margin-bottom: 3px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 12px; }

.analytics-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; }
.span-12 { grid-column: 1 / -1; }

.chart-bars { display: grid; grid-template-columns: repeat(6, minmax(54px, 1fr)); gap: 9px; align-items: end; min-height: 220px; }
.bar-set { display: grid; gap: 7px; align-content: end; height: 100%; }
.bar-stack { display: grid; grid-template-rows: 1fr 1fr; gap: 5px; height: 158px; align-items: end; }
.bar-cell { height: 100%; display: flex; align-items: end; }
.bar {
    width: 100%;
    min-height: 3px;
    border-radius: 10px 10px 4px 4px;
    background: linear-gradient(180deg, var(--green), rgba(53, 211, 153, .42));
}
.bar.expense { background: linear-gradient(180deg, var(--red), rgba(255, 107, 122, .42)); }
.bar-label { color: var(--muted); font-size: 11px; text-align: center; }
.bar-value { color: var(--text); font-size: 11px; text-align: center; font-weight: 800; }

.category-list,
.timeline,
.card-stack,
.mini-list { display: grid; gap: 8px; }
.category-row,
.timeline-item,
.mini-item {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.035);
}
.category-row header,
.mini-item header,
.timeline-item header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.category-row strong,
.mini-item strong,
.timeline-item strong { color: var(--text-strong); font-size: 13px; }
.category-row small,
.mini-item small,
.timeline-item small { color: var(--muted); }

.progress {
    height: 7px;
    min-width: 105px;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.04);
}
.progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #8ad9ff); }
.progress.positive span { background: linear-gradient(90deg, var(--green), #8ad9ff); }
.progress.negative span { background: linear-gradient(90deg, var(--red), var(--orange)); }
.progress.warning span { background: linear-gradient(90deg, var(--orange), var(--primary)); }

.credit-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.credit-card-tile {
    position: relative;
    min-height: 178px;
    display: grid;
    align-content: space-between;
    overflow: hidden;
    padding: 16px;
    border: 1px solid rgba(246, 198, 91, .26);
    border-radius: 20px;
    background:
        radial-gradient(circle at 100% 0%, rgba(246, 198, 91, .20), transparent 38%),
        linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.035));
    box-shadow: var(--shadow-soft);
}
.credit-card-tile::before {
    content: "";
    position: absolute;
    inset: auto -60px -80px auto;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: rgba(90,167,255,.12);
}
.credit-card-tile header,
.credit-card-tile footer { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 10px; }
.credit-card-tile h3 { margin: 0 0 4px; }
.card-number { color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.card-limit { text-align: right; }
.card-limit small { color: var(--muted); display: block; font-size: 10px; text-transform: uppercase; font-weight: 900; letter-spacing: .08em; }
.card-limit strong { font-size: 16px; }
.credit-card-tile .card-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }

.workspace-grid { display: grid; grid-template-columns: minmax(290px, 390px) minmax(0, 1fr); gap: 12px; align-items: start; margin-top: 12px; }
.workspace-grid .form-panel { position: sticky; top: 92px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: grid; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
label { color: #c7d2e5; font-weight: 850; font-size: 12px; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    background: rgba(3, 9, 19, .44);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 11px;
    font: inherit;
    outline: none;
    min-height: 40px;
}
input::placeholder, textarea::placeholder { color: #66758c; }
textarea { min-height: 86px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    border-color: rgba(246, 198, 91, .7);
    box-shadow: 0 0 0 4px rgba(246, 198, 91, .11);
}
select option { background: #0c1828; color: var(--text); }
.checkbox-line { display: flex; align-items: center; gap: 8px; }
.checkbox-line input { width: auto; min-height: auto; }

.btn {
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #101827;
    padding: 10px 14px;
    min-height: 40px;
    font-weight: 950;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 12px 28px rgba(246, 198, 91, .14);
    white-space: nowrap;
}
.btn:hover { filter: brightness(1.04); transform: translateY(-1px); }
.btn.secondary { background: rgba(90,167,255,.13); color: #b9dcff; border: 1px solid rgba(90,167,255,.26); box-shadow: none; }
.btn.danger { background: var(--red-soft); color: #ffc1c8; border: 1px solid rgba(255,107,122,.32); box-shadow: none; }
.btn.success { background: var(--green-soft); color: #bdf7df; border: 1px solid rgba(53,211,153,.30); box-shadow: none; }
.btn.ghost { background: rgba(255,255,255,.055); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.small { padding: 7px 9px; min-height: 31px; border-radius: 10px; font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 2px 0; vertical-align: middle; }
.inline-form input { width: 112px; min-height: 31px; padding: 7px 8px; border-radius: 10px; font-size: 12px; }

.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th {
    color: var(--muted);
    background: rgba(255,255,255,.035);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 950;
    position: sticky;
    top: 0;
    z-index: 1;
}
td { color: #d8e2f0; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.028); }

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 4px 8px;
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 950;
    white-space: nowrap;
}
.badge.positive { background: var(--green-soft); color: #bdf7df; border-color: rgba(53,211,153,.30); }
.badge.negative,
.badge.danger-soft { background: var(--red-soft); color: #ffc1c8; border-color: rgba(255,107,122,.30); }
.badge.neutral { background: rgba(255,255,255,.065); color: #cdd7e7; border-color: var(--line); }
.badge.warning { background: var(--orange-soft); color: #ffd5ab; border-color: rgba(255,184,107,.32); }
.badge.info { background: var(--blue-soft); color: #b9dcff; border-color: rgba(90,167,255,.26); }

.alert {
    margin: 0 0 12px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.055);
    color: var(--text);
    font-weight: 750;
}
.alert.success { border-color: rgba(53,211,153,.32); background: var(--green-soft); color: #bdf7df; }
.alert.error { border-color: rgba(255,107,122,.32); background: var(--red-soft); color: #ffc1c8; }
.alert.info { border-color: rgba(90,167,255,.32); background: var(--blue-soft); color: #b9dcff; }

.empty {
    color: var(--muted);
    padding: 16px;
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    background: rgba(255,255,255,.026);
}
.stack { display: grid; gap: 12px; }

.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
    background:
        radial-gradient(circle at top left, rgba(246,198,91,.20), transparent 34%),
        radial-gradient(circle at bottom right, rgba(90,167,255,.18), transparent 34%),
        linear-gradient(135deg, #06101d, #0a1728);
}
.auth-card { width: min(440px, 100%); }
.auth-card h1 { margin-bottom: 6px; font-size: 32px; }
.auth-card p { color: var(--muted); margin-bottom: 18px; }
.auth-brand {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--primary), #8ad9ff);
    color: #101827;
    font-weight: 950;
    margin-bottom: 14px;
}

@media (max-width: 1240px) {
    .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .focus-grid { grid-template-columns: 1fr; }
    .analytics-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-9 { grid-column: span 6; }
    .credit-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(86vw, 310px);
        transform: translateX(-105%);
        transition: transform .22s ease;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-close,
    .menu-toggle { display: inline-grid; place-items: center; }
    .mobile-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.48);
        backdrop-filter: blur(4px);
        opacity: 0;
        pointer-events: none;
        transition: opacity .22s ease;
        z-index: 25;
    }
    body.sidebar-open .mobile-backdrop { opacity: 1; pointer-events: auto; }
    .content { width: 100%; padding: 18px 16px 28px; }
    .topbar { align-items: flex-start; }
    .workspace-grid { grid-template-columns: 1fr; }
    .workspace-grid .form-panel { position: static; }
}

@media (max-width: 720px) {
    .topbar { flex-direction: column; }
    .top-actions { width: 100%; justify-content: flex-start; }
    .kpi-grid,
    .kpi-grid.three,
    .kpi-grid.four,
    .grid.two,
    .grid.three,
    .grid.four,
    .credit-card-grid { grid-template-columns: 1fr; }
    .form-grid,
    .form-grid.three,
    .form-grid.four { grid-template-columns: 1fr; }
    .analytics-grid { grid-template-columns: 1fr; }
    .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-9, .span-12 { grid-column: 1 / -1; }
    .chart-bars { grid-template-columns: repeat(3, minmax(60px, 1fr)); min-height: auto; }
    .bar-stack { height: 130px; }
    .inline-form { display: grid; grid-template-columns: 1fr auto; width: 100%; }
    .inline-form input { width: 100%; }
}

.card > h2,
.panel > h2 { margin-bottom: 10px; }
.card > p,
.panel > p { margin-top: 0; color: var(--muted); }

/* 2026 add-ons */
.nav { overflow-y: auto; scrollbar-width: thin; }
.year-chart { grid-template-columns: repeat(12, minmax(42px, 1fr)); }
@media (max-width: 980px) { .year-chart { grid-template-columns: repeat(6, minmax(54px, 1fr)); } }
@media (max-width: 720px) { .year-chart { grid-template-columns: repeat(3, minmax(60px, 1fr)); } }

/* 2026 compatibility layer for compact modules */
html[data-theme="light"] {
    --bg: #f4f7fb;
    --bg-2: #edf3fb;
    --panel: rgba(255,255,255,.90);
    --panel-strong: rgba(255,255,255,.98);
    --panel-soft: rgba(15,23,42,.045);
    --text: #172033;
    --text-strong: #0f172a;
    --muted: #5b6b82;
    --muted-2: #7b8797;
    --line: rgba(15,23,42,.11);
    --line-strong: rgba(15,23,42,.20);
    --shadow: 0 24px 70px rgba(30,41,59,.13);
    --shadow-soft: 0 14px 35px rgba(30,41,59,.10);
}
html[data-theme="light"] body { background: linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%); }
html[data-theme="light"] .sidebar { background: rgba(255,255,255,.88); }
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea { background: rgba(255,255,255,.78); color: var(--text); }

.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.metric-tile { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.035)); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 14px; backdrop-filter: blur(18px); }
.metric-tile small { display:block; color:var(--muted); font-weight:900; text-transform:uppercase; letter-spacing:.08em; font-size:10px; }
.metric-tile strong { display:block; margin-top:7px; color:var(--text-strong); font-size:clamp(18px,2vw,24px); line-height:1.05; letter-spacing:-.045em; }
.metric-tile span { display:block; margin-top:7px; color:var(--muted); font-size:12px; }
.split-layout { display:grid; grid-template-columns:minmax(290px,390px) minmax(0,1fr); gap:12px; align-items:start; margin-top:12px; }
.split-layout .compact-form-panel { position:sticky; top:92px; }
.panel-body { padding:0; }
.panel-body.tight { padding:0; }
.chart-box { height:260px; position:relative; }
.chart-box.mini-chart, .mini-chart { height:170px; }
.chart-box canvas { width:100%; height:100%; display:block; }
.density-list { display:grid; gap:8px; }
.density-item { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:center; padding:10px; border:1px solid var(--line); border-radius:14px; background:rgba(255,255,255,.035); }
.density-item strong { display:block; font-size:13px; color:var(--text-strong); }
.density-item small { display:block; color:var(--muted); margin-top:3px; }
.density-item .amount { text-align:right; }
.badge-green { background: var(--green-soft); color:#bdf7df; border-color:rgba(53,211,153,.30); }
.badge-red { background: var(--red-soft); color:#ffc1c8; border-color:rgba(255,107,122,.30); }
.badge-blue { background: var(--blue-soft); color:#b9dcff; border-color:rgba(90,167,255,.26); }
.badge-amber { background: var(--orange-soft); color:#ffd5ab; border-color:rgba(255,184,107,.32); }
.badge-purple { background: rgba(153,128,255,.14); color:#d8ccff; border-color:rgba(153,128,255,.28); }
.blue { color: var(--blue) !important; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.amber { color: var(--orange) !important; }
.nowrap { white-space: nowrap; }

@media (max-width: 1240px) { .metric-strip { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 980px) { .split-layout { grid-template-columns:1fr; } .split-layout .compact-form-panel { position:static; } }
@media (max-width: 720px) { .metric-strip { grid-template-columns:1fr; } }
