:root {
    --ffs-accent: #0f766e;
    --ffs-accent-muted: #14b8a6;
    --ffs-bg: #f0fdfa;
    --ffs-surface: #ffffff;
    --ffs-sidebar: #0f172a;
    --ffs-sidebar-hover: #1e293b;
    --ffs-text: #134e4a;
    --ffs-text-muted: #5b7c78;
    --ffs-highlight: #0891b2;
    --ffs-success: #16a34a;
    --ffs-danger: #dc2626;
    --ffs-border: #cce8e3;
    --ffs-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    --ffs-radius: 16px;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "DM Sans", system-ui, sans-serif;
    background: linear-gradient(160deg, #f0fdfa 0%, #e8f4f8 45%, #f8fafc 100%);
    color: var(--ffs-text);
    min-height: 100%;
}

h1, h2, .display {
    font-family: "DM Sans", system-ui, sans-serif;
    font-weight: 650;
    letter-spacing: -0.03em;
    color: #0f172a;
}

h1:focus, h1:focus-visible,
h2:focus, h2:focus-visible {
    outline: none;
}

a { color: var(--ffs-accent); }

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

.sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #132337 100%);
    color: #e2e8f0;
    padding: 1.5rem 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    padding: 0.35rem 0.5rem;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
    background: transparent;
}

.inline-brand {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    vertical-align: -3px;
    margin-right: 0.25rem;
}

.brand-name {
    font-family: "DM Sans", system-ui, sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
}

.brand-sub {
    font-size: 0.7rem;
    color: #94a3b8;
    letter-spacing: 0.02em;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: var(--ffs-sidebar-hover);
    color: #fff;
}

.nav-link.active {
    background: #14b8a6;
    color: #042f2e;
}

.nav-link.nav-button {
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.nav-link.nav-disabled {
    opacity: 0.42;
    pointer-events: none;
}

.nav-sub {
    display: block;
    font-size: 0.7rem;
    color: #34d399;
    font-weight: 500;
}

.nav-link.nav-disabled .nav-sub {
    color: inherit;
}

.nav-spacer {
    height: 1rem;
}

.drawer-quote {
    margin: 0 0.5rem 0.25rem;
    font-size: 0.78rem;
    font-style: italic;
    color: rgba(226, 232, 240, 0.7);
    line-height: 1.35;
}

.drawer-fox-note {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    padding: 0.75rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.78rem;
    line-height: 1.35;
    margin-bottom: 0.65rem;
}

.drawer-fox-note img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
}

.sidebar-footer {
    padding: 0.75rem 0.5rem 0;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.tagline {
    margin: 0.75rem 0 0.5rem;
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.4;
}

.proto-badge {
    margin: 0;
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 1.35rem 2rem 0.85rem;
    gap: 1rem;
}

.eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ffs-text-muted);
    font-weight: 600;
}

.topbar-title {
    font-size: 0.95rem;
    color: var(--ffs-text);
    font-weight: 500;
}

.topbar-meta {
    font-size: 0.8rem;
    color: var(--ffs-text-muted);
    background: rgba(255,255,255,0.7);
    border: 1px solid var(--ffs-border);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
}

.content {
    padding: 1.5rem 2rem 2.5rem;
}

.page-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-hero h1 {
    margin: 0.15rem 0 0.35rem;
    font-size: 1.7rem;
}

.page-hero p {
    margin: 0;
    color: var(--ffs-text-muted);
    max-width: 42rem;
}

.page-hero.dashboard-hero {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem 3rem;
    width: 100%;
}

.page-hero.dashboard-hero h1 {
    margin: 0;
    flex: 0 1 42%;
    max-width: 42%;
}

.page-hero.dashboard-hero p,
.page-hero.dashboard-hero .dashboard-hero-desc {
    margin: 0;
    flex: 1 1 55%;
    max-width: none;
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--ffs-text-muted);
}

@media (max-width: 900px) {
    .page-hero.dashboard-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-hero.dashboard-hero h1,
    .page-hero.dashboard-hero p,
    .page-hero.dashboard-hero .dashboard-hero-desc {
        max-width: none;
        flex: 1 1 auto;
    }
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.kpi-card, .card {
    background: var(--ffs-surface);
    border: 1px solid var(--ffs-border);
    border-radius: var(--ffs-radius);
    box-shadow: var(--ffs-shadow);
    padding: 1.15rem 1.25rem;
}

.kpi-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ffs-text-muted);
    font-weight: 600;
}

.kpi-value, .stat-val {
    font-family: "DM Sans", system-ui, sans-serif;
    font-size: 1.65rem;
    font-weight: 700;
    margin-top: 0.35rem;
    color: #0f172a;
}

.kpi-value.positive { color: var(--ffs-success); }
.kpi-value.negative { color: var(--ffs-danger); }

.grid-2 {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.card h3 {
    margin: 0 0 0.85rem;
    font-size: 1.05rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.card-header h3 { margin: 0; }

.muted { color: var(--ffs-text-muted); }
.small { font-size: 0.95rem; }

/* ApexCharts — larger axis / legend / tooltip text for readability */
.apexcharts-text tspan,
.apexcharts-xaxis-label,
.apexcharts-yaxis-label,
.apexcharts-legend-text {
    font-size: 14px !important;
}

.apexcharts-tooltip {
    font-size: 14px !important;
}

.apexcharts-tooltip-title {
    font-size: 14px !important;
    font-weight: 600;
}

html[data-theme="dark"] .apexcharts-tooltip.apexcharts-theme-light,
.app-shell.theme-dark .apexcharts-tooltip.apexcharts-theme-light {
    background: #1e293b !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .apexcharts-tooltip.apexcharts-theme-light .apexcharts-tooltip-title,
.app-shell.theme-dark .apexcharts-tooltip.apexcharts-theme-light .apexcharts-tooltip-title {
    background: #0f172a !important;
    color: #f8fafc !important;
}


.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

table.data th {
    text-align: left;
    font-size: 0.92rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ffs-text-muted);
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--ffs-border);
    cursor: pointer;
    user-select: none;
}

table.data td {
    padding: 0.7rem 0.4rem;
    border-bottom: 1px solid #e8f2ef;
    vertical-align: middle;
}

table.data tr:hover td {
    background: rgba(15, 118, 110, 0.04);
}

table.data tr.clickable { cursor: pointer; }

.amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.amount.in { color: var(--ffs-success); }
.amount.out { color: var(--ffs-danger); }
.amount.transfer { color: var(--ffs-highlight); }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #ecfeff;
    color: #0e7490;
}

.badge.ignored { background: #f1f5f9; color: #64748b; }
.badge.moneyin { background: #dcfce7; color: #166534; }
.badge.moneyout { background: #fee2e2; color: #991b1b; }
.badge.transfer { background: #e0f2fe; color: #075985; }

.filters {
    display: grid;
    grid-template-columns: 1.4fr repeat(5, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.filters label, .field label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ffs-text-muted);
    margin-bottom: 0.3rem;
    font-weight: 600;
}

input, select, button, textarea {
    font: inherit;
}

input[type="text"], input[type="date"], input[type="number"], select, textarea {
    width: 100%;
    border: 1px solid var(--ffs-border);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    background: #fff;
    color: #0f172a;
}

button, .btn {
    border: none;
    border-radius: 10px;
    padding: 0.55rem 1rem;
    background: var(--ffs-accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

button.secondary, .btn.secondary {
    background: #fff;
    color: var(--ffs-accent);
    border: 1px solid var(--ffs-border);
}

button:hover { filter: brightness(1.05); }

.preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.preset-row button {
    background: #fff;
    color: var(--ffs-text);
    border: 1px solid var(--ffs-border);
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.preset-row button.active {
    background: var(--ffs-accent);
    color: #fff;
    border-color: var(--ffs-accent);
}

.progress {
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin: 0.55rem 0;
}

.progress > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--ffs-accent), var(--ffs-accent-muted));
    border-radius: 999px;
}

.goal-card {
    margin-bottom: 1rem;
}

.goal-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9rem;
}

.notice {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 40;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(420px, 100%);
    height: 100vh;
    background: #fff;
    z-index: 50;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.15);
    padding: 1.5rem;
    overflow-y: auto;
}

.drawer h2 { margin-top: 0; }

.field { margin-bottom: 0.85rem; }

.stack { display: flex; flex-direction: column; gap: 0.75rem; }

.list-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid #eef5f3;
}

.clickable, .list-row.clickable, table.data tr.clickable {
    cursor: pointer;
}

.clickable:hover, .list-row.clickable:hover {
    color: var(--ffs-accent);
}

.clickable-card {
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.clickable-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.1);
}

.theme-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.25);
    margin-bottom: 0.75rem;
    justify-content: flex-start;
}

.theme-toggle:hover {
    background: rgba(20, 184, 166, 0.18);
}

.col-group-btn {
    padding: 0.1rem 0.35rem;
    margin-left: 0.25rem;
    background: transparent;
    color: var(--ffs-text-muted);
    border: 1px solid var(--ffs-border);
    border-radius: 6px;
    font-size: 0.75rem;
}

.col-group-btn:hover {
    color: var(--ffs-accent);
    border-color: var(--ffs-accent);
}

.group-block {
    border: 1px solid var(--ffs-border);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.group-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0.9rem;
    background: rgba(15, 118, 110, 0.06);
    cursor: pointer;
    align-items: center;
}

html, body {
    background: var(--ffs-page-bg, linear-gradient(160deg, #f0fdfa 0%, #e8f4f8 45%, #f8fafc 100%));
}

:root {
    --ffs-page-bg: linear-gradient(160deg, #f0fdfa 0%, #e8f4f8 45%, #f8fafc 100%);
}

/* Dark theme */
html[data-theme="dark"],
.app-shell.theme-dark {
    --ffs-accent: #2dd4bf;
    --ffs-accent-muted: #5eead4;
    --ffs-bg: #0f172a;
    --ffs-surface: #132337;
    --ffs-text: #f1f5f9;
    --ffs-text-muted: #94a3b8;
    --ffs-highlight: #38bdf8;
    --ffs-success: #34d399;
    --ffs-danger: #fb7185;
    --ffs-border: #1e293b;
    --ffs-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --ffs-page-bg: #0f172a;
    color: var(--ffs-text);
}

html[data-theme="dark"] body,
.app-shell.theme-dark {
    background: var(--ffs-page-bg);
    color: var(--ffs-text);
    scrollbar-color: #334155 #0f172a;
}

html[data-theme="dark"] ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

html[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #0f172a;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 99px;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] .display,
.app-shell.theme-dark h1,
.app-shell.theme-dark h2 {
    color: #f8fafc;
}

html[data-theme="dark"] .kpi-value,
.app-shell.theme-dark .kpi-value {
    color: #f8fafc;
}

html[data-theme="dark"] .kpi-value.positive,
.app-shell.theme-dark .kpi-value.positive,
html[data-theme="dark"] .amount.in,
.app-shell.theme-dark .amount.in {
    color: #4ade80;
}

html[data-theme="dark"] .kpi-value.negative,
.app-shell.theme-dark .kpi-value.negative,
html[data-theme="dark"] .amount.out,
.app-shell.theme-dark .amount.out {
    color: #fca5a5;
}

html[data-theme="dark"] .amount.transfer,
.app-shell.theme-dark .amount.transfer {
    color: #7dd3fc;
}

html[data-theme="dark"] .muted,
html[data-theme="dark"] .small,
html[data-theme="dark"] .kpi-label,
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .topbar-title,
.app-shell.theme-dark .muted,
.app-shell.theme-dark .small,
.app-shell.theme-dark .kpi-label,
.app-shell.theme-dark .eyebrow,
.app-shell.theme-dark .topbar-title {
    color: #cbd5e1;
}

html[data-theme="dark"] .page-hero p,
.app-shell.theme-dark .page-hero p {
    color: #e2e8f0;
}

html[data-theme="dark"] table.data th,
.app-shell.theme-dark table.data th {
    color: #e2e8f0;
    border-bottom-color: #475569;
}

html[data-theme="dark"] table.data td,
.app-shell.theme-dark table.data td {
    color: #f1f5f9;
    border-bottom-color: #334155;
}

html[data-theme="dark"] .list-row,
.app-shell.theme-dark .list-row {
    border-bottom-color: #334155;
    color: #f1f5f9;
}

html[data-theme="dark"] .badge,
.app-shell.theme-dark .badge {
    background: #1e293b;
    color: #e2e8f0;
}

html[data-theme="dark"] .badge.moneyin,
.app-shell.theme-dark .badge.moneyin {
    background: #14532d;
    color: #86efac;
}

html[data-theme="dark"] .badge.moneyout,
.app-shell.theme-dark .badge.moneyout {
    background: #7f1d1d;
    color: #fecaca;
}

html[data-theme="dark"] .badge.transfer,
.app-shell.theme-dark .badge.transfer {
    background: #0c4a6e;
    color: #bae6fd;
}

html[data-theme="dark"] .badge.ignored,
.app-shell.theme-dark .badge.ignored {
    background: #334155;
    color: #cbd5e1;
}

html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] .card,
html[data-theme="dark"] .drawer,
.app-shell.theme-dark .kpi-card,
.app-shell.theme-dark .card,
.app-shell.theme-dark .drawer {
    background: var(--ffs-surface);
    border-color: var(--ffs-border);
}

html[data-theme="dark"] .topbar-meta,
.app-shell.theme-dark .topbar-meta {
    background: rgba(17, 24, 39, 0.85);
    color: #e2e8f0;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
.app-shell.theme-dark input,
.app-shell.theme-dark select,
.app-shell.theme-dark textarea {
    background: #0b1220;
    color: #f8fafc;
    border-color: #475569;
}

html[data-theme="dark"] .preset-row button,
.app-shell.theme-dark .preset-row button {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #475569;
}

html[data-theme="dark"] button.secondary,
html[data-theme="dark"] .btn.secondary,
html[data-theme="dark"] a.btn.secondary,
.app-shell.theme-dark button.secondary,
.app-shell.theme-dark .btn.secondary,
.app-shell.theme-dark a.btn.secondary {
    background: #1e293b;
    color: #5eead4;
    border: 1px solid #475569;
}

html[data-theme="dark"] .group-header,
.app-shell.theme-dark .group-header {
    background: rgba(45, 212, 191, 0.12);
    color: #f1f5f9;
}

html[data-theme="dark"] .notice,
.app-shell.theme-dark .notice {
    background: #422006;
    border-color: #9a3412;
    color: #fdba74;
}

html[data-theme="dark"] .apexcharts-text,
html[data-theme="dark"] .apexcharts-legend-text,
html[data-theme="dark"] .apexcharts-xaxis-label,
html[data-theme="dark"] .apexcharts-yaxis-label,
html[data-theme="dark"] .apexcharts-datalabel,
.app-shell.theme-dark .apexcharts-text tspan,
.app-shell.theme-dark .apexcharts-legend-text,
.app-shell.theme-dark .apexcharts-tooltip {
    fill: #e2e8f0 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .apexcharts-legend-text,
.app-shell.theme-dark .apexcharts-legend-text {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .apexcharts-gridline,
.app-shell.theme-dark .apexcharts-gridline {
    stroke: #334155;
}

.group-by-row {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}

.group-by-row select {
    flex: 1;
}

.clear-group-btn {
    white-space: nowrap;
    padding: 0.55rem 0.7rem;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    color: var(--ffs-accent);
}

.sort-idle {
    opacity: 0.35;
    font-size: 0.75em;
}

.sort-active {
    color: var(--ffs-accent);
    font-weight: 700;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media (max-width: 1100px) {
    .kpi-grid, .grid-2, .grid-3, .filters {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 820px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: relative;
        height: auto;
    }
    .nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .content, .topbar {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .kpi-grid, .grid-2, .grid-3, .filters {
        grid-template-columns: 1fr;
    }
}

/* Splash / first-load bootstrap (aligned with FFS Mobile) */
/* Hide any splash chrome when this tab already saw the intro (set before Blazor boots). */
html.ffs-skip-splash .splash-screen {
    display: none !important;
}

.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    background: linear-gradient(165deg, #0b1220 0%, #0f172a 45%, #132337 100%);
    color: #f8fafc;
    overflow: hidden;
}

.splash-glow {
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.22) 0%, transparent 70%);
    filter: blur(8px);
    animation: splash-pulse 2.8s ease-in-out infinite;
}

.splash-center {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    animation: splash-enter 0.9s ease-out both;
}

.splash-icon-wrap {
    width: 112px;
    height: 112px;
    margin: 0 auto 1.5rem;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 0 28px rgba(20, 184, 166, 0.28);
}

.splash-icon {
    width: 112px;
    height: 112px;
    display: block;
    object-fit: cover;
}

.splash-brand {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 0.55rem;
}

.splash-tagline {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(248, 250, 252, 0.72);
    line-height: 1.4;
}

.splash-trend {
    margin: 1.25rem auto 1.5rem;
    opacity: 0.9;
}

.splash-trend-line {
    stroke: #14b8a6;
    stroke-dasharray: 180;
    stroke-dashoffset: 180;
    animation: splash-draw 1.4s ease-out 0.35s forwards, splash-pulse-stroke 1.6s ease-in-out 1.6s infinite;
}

.splash-status {
    margin: 0 0 0.85rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(248, 250, 252, 0.85);
    min-height: 1.25rem;
    transition: opacity 0.25s ease;
}

.splash-progress {
    width: 180px;
    height: 3px;
    margin: 0 auto;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.splash-progress-bar {
    height: 100%;
    background: #14b8a6;
    border-radius: 99px;
    transition: width 0.35s ease;
}

.splash-footer {
    position: absolute;
    bottom: 1.25rem;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.72rem;
    color: rgba(248, 250, 252, 0.4);
}

@keyframes splash-enter {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes splash-pulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.08); opacity: 1; }
}

@keyframes splash-draw {
    to { stroke-dashoffset: 0; }
}

@keyframes splash-pulse-stroke {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.page-appear {
    animation: page-in 0.28s ease-out;
}

@keyframes page-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.chip-row,
.segmented {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.chip-row.inset,
.segmented.inset,
.filter-chips {
    padding-inline: 0.25rem;
}

.chip-row.under-title {
    margin: 0.65rem 0 0.85rem;
}

.chip,
.segmented button {
    border: 1px solid var(--ffs-border);
    background: var(--ffs-surface);
    color: var(--ffs-text);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    cursor: pointer;
}

.chip.active,
.segmented button.active {
    background: var(--ffs-accent);
    border-color: var(--ffs-accent);
    color: #fff;
}

.range-note { margin: -0.4rem 0 1rem; }

.kpi-top {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.35rem;
}

.kpi-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(20, 184, 166, 0.12);
    color: var(--ffs-accent);
}

.kpi-icon.success { background: rgba(22, 163, 74, 0.12); color: var(--ffs-success); }
.kpi-icon.error { background: rgba(220, 38, 38, 0.12); color: var(--ffs-danger); }
.kpi-icon.accent { background: rgba(20, 184, 166, 0.12); color: var(--ffs-accent); }

.kpi-value.success { color: var(--ffs-success); }
.kpi-value.error { color: var(--ffs-danger); }
.kpi-value.accent { color: var(--ffs-accent); }

.insight-card {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 1rem 1.1rem;
    border-radius: var(--ffs-radius);
    background: var(--ffs-surface);
    border: 1px solid var(--ffs-border);
    margin-bottom: 1rem;
}

.insight-card.ok i { color: var(--ffs-accent); }
.insight-card.warn i { color: var(--ffs-danger); }
.insight-card p { margin: 0.25rem 0 0; }

.budget-teaser { margin: 0; }

.txn-row {
    display: grid;
    grid-template-columns: 40px 1fr auto auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.7rem 0.2rem;
    border-bottom: 1px solid var(--ffs-border);
}

.txn-row:last-child { border-bottom: 0; }

.cat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(20, 184, 166, 0.1);
    color: var(--ffs-accent);
}

.txn-title { font-weight: 600; }
.txn-date { min-width: 5.5rem; text-align: right; }

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.85rem 0.15rem 0.35rem;
    margin-top: 0.35rem;
}

.goal-compact { margin-bottom: 0.85rem; }

.settings-group { margin-bottom: 1.25rem; }
.settings-group h3 { font-size: 0.95rem; margin: 0 0 0.5rem; }
.settings-card {
    background: var(--ffs-surface);
    border: 1px solid var(--ffs-border);
    border-radius: var(--ffs-radius);
    overflow: hidden;
}

.settings-row {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--ffs-border);
}

.settings-row:last-child { border-bottom: 0; }
.settings-row.disabled { opacity: 0.55; }
.settings-row.buttonish {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--ffs-border);
    background: transparent;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.settings-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.settings-icon.accent { background: rgba(20, 184, 166, 0.14); color: var(--ffs-accent); }
.settings-icon.success { background: rgba(22, 163, 74, 0.14); color: var(--ffs-success); }
.settings-icon.muted-icon { background: rgba(100, 116, 139, 0.14); color: var(--ffs-text-muted); }

.version-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(20, 184, 166, 0.12);
    color: var(--ffs-accent);
    font-weight: 600;
}

.page-hero-actions { align-self: flex-start; }

.about-dialog {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 40;
    background: var(--ffs-surface);
    padding: 1.5rem;
    border-radius: 16px;
    width: min(360px, 92vw);
    box-shadow: var(--ffs-shadow);
}

.compact-filters {
    grid-template-columns: 1.6fr 1fr 1fr auto;
}

.empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--ffs-text-muted);
}

.app-shell.theme-dark .chip,
.app-shell.theme-dark .segmented button {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.app-shell.theme-dark .chip.active,
.app-shell.theme-dark .segmented button.active {
    background: #14b8a6;
    border-color: #14b8a6;
    color: #042f2e;
}

.app-shell.theme-dark .insight-card,
.app-shell.theme-dark .settings-card,
.app-shell.theme-dark .about-dialog {
    background: #132337;
    border-color: #334155;
}

.app-shell.theme-dark .settings-row,
.app-shell.theme-dark .txn-row {
    border-color: #243044;
}

@media (max-width: 900px) {
    .compact-filters { grid-template-columns: 1fr 1fr; }
    .txn-row { grid-template-columns: 40px 1fr auto; }
    .txn-date { display: none; }
}

.stat-tile {
    background: var(--ffs-surface);
    border: 1px solid var(--ffs-border);
    border-radius: 18px;
    padding: 1rem 1.1rem 1.05rem;
}

.stat-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.stat-lbl {
    font-size: 0.82rem;
    color: var(--ffs-text-muted);
    font-weight: 600;
}

.stat-ico {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(45, 212, 191, 0.12);
    color: var(--ffs-accent);
    font-size: 0.85rem;
}

.stat-ico.success { background: rgba(52, 211, 153, 0.14); color: var(--ffs-success); }
.stat-ico.error { background: rgba(251, 113, 133, 0.14); color: var(--ffs-danger); }
.stat-ico.accent { background: rgba(45, 212, 191, 0.14); color: var(--ffs-accent); }

.stat-delta {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 700;
}

.stat-delta.up { color: var(--ffs-success); }
.stat-delta.down { color: var(--ffs-danger); }
.stat-val.success { color: var(--ffs-success); }
.stat-val.error { color: var(--ffs-danger); }
.stat-val.accent { color: #0f172a; }
.stat-cap { color: var(--ffs-text-muted); font-size: 0.8rem; margin-top: 0.25rem; }

.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--ffs-border);
    background: var(--ffs-surface);
    color: var(--ffs-text-muted);
    font-size: 0.8rem;
}

.pill.quiet { opacity: 0.85; }
.hero-meta { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.text-link { font-size: 0.85rem; font-weight: 600; text-decoration: none; }

.donut-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    align-items: center;
}

.legend-list, .legend-row {
    min-width: 0;
}

.legend-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 0.65rem;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.88rem;
}

.legend-row .avatar { grid-column: auto; }

.snap-row {
    display: grid;
    gap: 0.25rem;
    margin-bottom: 0.85rem;
}

.progress.slim { height: 6px; }

.dir {
    font-size: 0.78rem;
    font-weight: 600;
}

.dir.moneyin { color: var(--ffs-success); }
.dir.moneyout { color: var(--ffs-danger); }
.dir.transfer { color: var(--ffs-text-muted); }

table.data.dense {
    table-layout: fixed;
    width: 100%;
}

table.data.dense td, table.data.dense th { padding: 0.55rem 0.45rem; }
table.data .day-row td {
    font-weight: 700;
    background: rgba(148, 163, 184, 0.06);
    padding-top: 0.75rem;
}

.merchant { display: flex; align-items: center; gap: 0.5rem; }
.avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.72rem;
    font-weight: 700;
}

.filters.toolbar {
    grid-template-columns: 1.7fr repeat(5, minmax(0, 1fr));
    margin-bottom: 1rem;
    padding: 0.95rem 1rem;
    background: var(--ffs-surface);
    border: 1px solid var(--ffs-border);
    border-radius: 16px;
}

.filters.toolbar .filter-row-2 {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
}

.filters.toolbar .filter-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.15rem;
}

.kpi-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.reports-bottom { grid-template-columns: 1.1fr 1fr 1fr; }

.ring-card { text-align: left; }
.ring-head { display: flex; gap: 0.7rem; align-items: flex-start; margin-bottom: 0.75rem; }
.ring-head h3 { margin: 0; }
.ring {
    --p: 0;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    margin: 0.4rem auto 0.9rem;
    background: conic-gradient(var(--ffs-accent) calc(var(--p) * 1%), #1e293b 0);
    display: grid;
    place-items: center;
    font-weight: 700;
}
.ring.success { background: conic-gradient(var(--ffs-success) calc(var(--p) * 1%), #1e293b 0); }
.ring.error { background: conic-gradient(var(--ffs-danger) calc(var(--p) * 1%), #1e293b 0); }
.ring::after {
    content: "";
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--ffs-surface);
    position: absolute;
}
.ring { position: relative; }
.ring span { position: relative; z-index: 1; }

.goal-stack { display: grid; gap: 0.75rem; }
.goal-row {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 1rem;
    align-items: center;
}
.goal-ico {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(45, 212, 191, 0.12);
    color: var(--ffs-accent);
}
.goal-side { text-align: right; }

.app-shell.theme-dark .stat-tile,
.app-shell.theme-dark .kpi-card,
.app-shell.theme-dark .card {
    background: #132337;
    border-color: #1e293b;
}

@media (max-width: 1100px) {
    .kpi-4, .kpi-5, .reports-bottom, .donut-split { grid-template-columns: 1fr 1fr; }
    .filters.toolbar { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 700px) {
    .kpi-grid, .kpi-4, .kpi-5, .grid-2, .grid-3, .reports-bottom, .donut-split { grid-template-columns: 1fr; }
    .filters.toolbar { grid-template-columns: 1fr; }
}

/* —— Mockup skin: flat dark console —— */
:root {
    --sidebar-width: 232px;
    --ffs-radius: 14px;
}

.app-shell.theme-dark,
html[data-theme="dark"] {
    --ffs-bg: #0f172a;
    --ffs-surface: #132337;
    --ffs-border: #1e293b;
    --ffs-text: #f1f5f9;
    --ffs-text-muted: #94a3b8;
    --ffs-page-bg: #0f172a;
}

.app-shell.theme-dark .sidebar,
html[data-theme="dark"] .sidebar {
    background: #0f172a;
    border-right: 1px solid #1e293b;
}

.app-shell.theme-dark .drawer-quote {
    font-style: normal;
    color: #7d8da3;
}

.app-shell.theme-dark .nav-link {
    color: #b7c3d4;
}

.app-shell.theme-dark .nav-link.active {
    background: #14b8a6;
    color: #042f2e;
    font-weight: 650;
}

.app-shell.theme-dark .nav-link:hover:not(.active):not(.nav-disabled) {
    background: #121a26;
    color: #fff;
}

.app-shell.theme-dark .theme-toggle {
    width: 100%;
    justify-content: flex-start;
    background: transparent;
    border: 0;
    color: #b7c3d4;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    margin-bottom: 0.55rem;
}

.app-shell.theme-dark .theme-toggle:hover {
    background: #121a26;
}

.app-shell.theme-dark .sidebar-footer {
    border-top: 0;
    padding: 0.35rem 0.15rem 0;
}

.app-shell.theme-dark .content {
    padding: 1.35rem 1.75rem 2.5rem;
}

.app-shell.theme-dark .page-hero {
    margin-bottom: 1.15rem;
    align-items: flex-start;
}

.app-shell.theme-dark .page-hero h1 {
    font-size: 1.85rem;
    letter-spacing: -0.035em;
}

.app-shell.theme-dark .page-hero p {
    color: #9aabc0;
    font-size: 0.95rem;
}

.app-shell.theme-dark .eyebrow {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    color: #6e7f94;
}

.app-shell.theme-dark .stat-tile,
.app-shell.theme-dark .kpi-card,
.app-shell.theme-dark .card {
    background: #132337;
    border: 1px solid #1e293b;
    box-shadow: none;
    border-radius: 16px;
}

.app-shell.theme-dark .stat-tile {
    border-top: 3px solid #243044;
    padding: 0.95rem 1.05rem 1rem;
}

.app-shell.theme-dark .stat-tile.tone-success { border-top-color: #2dd4bf; }
.app-shell.theme-dark .stat-tile.tone-error { border-top-color: #fb7185; }
.app-shell.theme-dark .stat-tile.tone-accent { border-top-color: #38bdf8; }
.app-shell.theme-dark .stat-tile.tone-neutral { border-top-color: #64748b; }

.app-shell.theme-dark .stat-val {
    font-size: 1.55rem;
    letter-spacing: -0.03em;
    color: #f8fafc;
    margin-top: 0.45rem;
}

.app-shell.theme-dark .stat-val.success { color: #2dd4bf; }
.app-shell.theme-dark .stat-val.error { color: #fb7185; }
.app-shell.theme-dark .stat-val.accent { color: #e2e8f0; }

.app-shell.theme-dark .stat-lbl {
    font-size: 0.8rem;
    font-weight: 600;
    color: #9aabc0;
    text-transform: none;
    letter-spacing: 0;
}

.app-shell.theme-dark .card-header h3,
.app-shell.theme-dark .card h3 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.98rem;
}

.app-shell.theme-dark .card-header h3 i,
.app-shell.theme-dark .card h3 i {
    color: #14b8a6;
    font-size: 0.95rem;
}

.app-shell.theme-dark .pill {
    background: #132337;
    border-color: #334155;
    color: #94a3b8;
    font-size: 0.78rem;
}

.app-shell.theme-dark .filters.toolbar {
    padding: 0.95rem 1rem;
    background: #132337;
    border: 1px solid #1e293b;
    border-radius: 16px;
}

.swatch {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: #64748b;
}

.swatch.s-0 { background: #2dd4bf; }
.swatch.s-1 { background: #60a5fa; }
.swatch.s-2 { background: #fbbf24; }
.swatch.s-3 { background: #a78bfa; }
.swatch.s-4 { background: #fb7185; }
.swatch.s-5 { background: #94a3b8; }

.ring-body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
}

.ring-stats .list-row { padding: 0.35rem 0; }

.app-shell.theme-dark .ring {
    width: 88px;
    height: 88px;
    margin: 0;
}

.app-shell.theme-dark .ring::after {
    width: 64px;
    height: 64px;
    background: #132337;
}

.progress-cell {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 9rem;
}

.progress-cell .progress { flex: 1; margin: 0; }

.inline-search, .inline-select {
    width: auto;
    min-width: 10rem;
}

.goals-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 1rem;
    align-items: start;
}

.goal-insights { display: grid; gap: 0.75rem; }
.goal-insights .quote { margin: 0.25rem 0.35rem 0; font-style: italic; }

.goal-card-wide {
    display: grid;
    grid-template-columns: 48px 1fr 160px;
    gap: 1rem;
    align-items: center;
}

.goal-ico.tone-success { background: rgba(45, 212, 191, 0.14); color: #2dd4bf; }
.goal-ico.tone-error { background: rgba(251, 113, 133, 0.14); color: #fb7185; }
.goal-ico.tone-accent { background: rgba(56, 189, 248, 0.14); color: #38bdf8; }

.app-shell.theme-dark .progress > span.success { background: #2dd4bf; }
.app-shell.theme-dark .progress > span.error { background: #fb7185; }
.app-shell.theme-dark .progress > span.accent { background: #38bdf8; }

.app-shell.theme-dark table.data.dense th {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: #7d8da3;
}

.app-shell.theme-dark table.data .day-row td {
    background: #0f172a;
    border-bottom-color: #1a2433;
}

.app-shell.theme-dark .table-card {
    padding: 0.35rem 0.65rem 0.65rem;
}

.app-shell.theme-dark .notice {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
}

@media (max-width: 1100px) {
    .goals-split { grid-template-columns: 1fr; }
    .app-shell.theme-dark .filters.toolbar { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 700px) {
    .goal-card-wide, .ring-body { grid-template-columns: 1fr; }
    .app-shell.theme-dark .filters.toolbar { grid-template-columns: 1fr; }
}
