/* ══════════════════════════════════════════════════════════════
   DesignSystem.css — WLC fintech UI system
   Clean fintech: light, soft-gray, white cards, orange accent.
   Tablet-first (375 / 768 / 1024 / 1440). No DevExpress dependency.
   Pure CSS — class-based so it layers over native HTML and
   DevExpress-rendered markup alike during migration.
   ══════════════════════════════════════════════════════════════ */

/* ── Design tokens ── */
:root {
    /* Brand / accent */
    --c-accent:        #F97316;  /* orange-500 — cashflow / primary */
    --c-accent-700:    #C2410C;
    --c-accent-600:    #EA580C;
    --c-accent-tint:   #FFEDD5;  /* orange-100 */
    --c-income:        #4F46E5;  /* indigo-600 — income series */
    --c-income-tint:   #E0E7FF;

    /* Surfaces */
    --c-bg:            #F4F6F8;
    --c-surface:       #FFFFFF;
    --c-surface-2:     #F8FAFC;
    --c-border:        #E5E9EE;
    --c-border-strong: #CBD5E1;

    /* Text */
    --c-text:          #0F172A;
    --c-text-2:        #64748B;
    --c-text-3:        #94A3B8;
    --c-on-accent:     #FFFFFF;

    /* Semantic */
    --c-success:       #16A34A;
    --c-success-tint:  #DCFCE7;
    --c-danger:        #DC2626;
    --c-danger-tint:   #FEE2E2;
    --c-warning:       #D97706;
    --c-warning-tint:  #FEF3C7;

    /* Radius */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-pill: 999px;

    /* Shadow */
    --sh-1: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.10);
    --sh-2: 0 4px 8px rgba(16,24,40,.08), 0 2px 4px rgba(16,24,40,.06);
    --sh-3: 0 12px 24px rgba(16,24,40,.12);

    /* Spacing (4/8 scale) */
    --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
    --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

    /* Type */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Layout */
    --container: 1280px;
    --header-h: 60px;
}

/* ── Reset / base ── */
.ds, .ds * { box-sizing: border-box; }
.ds {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
.ds h1, .ds h2, .ds h3, .ds h4 { margin: 0; font-weight: 600; line-height: 1.25; color: var(--c-text); }
.ds h1 { font-size: 28px; }
.ds h2 { font-size: 22px; }
.ds h3 { font-size: 18px; }
.ds p  { margin: 0; }
.ds a  { color: var(--c-accent-700); text-decoration: none; }
.ds a:hover { text-decoration: underline; }

/* Tabular figures for money/data — prevents column jitter */
.num, .money, .ds td.amt, .ds .tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ── App shell ── */
.app-shell { min-height: 100dvh; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    height: var(--header-h);
    display: flex; align-items: center; gap: var(--s-4);
    padding: 0 var(--s-4);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    position: sticky; top: 0; z-index: 100;
}
.topbar .brand { display: flex; align-items: center; gap: var(--s-2); font-weight: 700; font-size: 17px; color: var(--c-text); white-space: nowrap; }
.topbar .brand .logo { width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--c-accent); display: grid; place-items: center; color: #fff; font-weight: 700; }
.topbar .spacer { flex: 1; }

/* Primary nav — horizontal on desktop/tablet, collapses to drawer on phone */
.nav { display: flex; align-items: center; gap: var(--s-1); }
.nav a, .nav .nav-item {
    display: inline-flex; align-items: center; gap: var(--s-2);
    min-height: 44px; padding: 0 var(--s-3);
    border-radius: var(--r-sm);
    color: var(--c-text-2); font-weight: 500; font-size: 15px;
    cursor: pointer; white-space: nowrap;
    transition: background .15s ease, color .15s ease;
}
.nav a:hover, .nav .nav-item:hover { background: var(--c-surface-2); color: var(--c-text); text-decoration: none; }
.nav a.active, .nav .nav-item.active { background: var(--c-accent-tint); color: var(--c-accent-700); }
.nav .nav-icon { width: 20px; height: 20px; flex: none; }

/* User chip */
.user-chip { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; padding: 0 var(--s-2) 0 var(--s-3); border-radius: var(--r-pill); cursor: pointer; }
.user-chip:hover { background: var(--c-surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--c-income-tint); color: var(--c-income); display: grid; place-items: center; font-weight: 600; font-size: 14px; }

/* Nav dropdown (native <details>) */
.nav-dd { position: relative; }
.nav-dd > summary { list-style: none; }
.nav-dd > summary::-webkit-details-marker { display: none; }
.nav-dd > summary::after { content: ""; width: 8px; height: 8px; margin-left: 4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.nav-dd[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.nav-dd-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--sh-2); padding: var(--s-2); z-index: 200; }
.nav-dd-menu a { display: block; min-height: 44px; line-height: 44px; padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--c-text-2); font-size: 14px; }
.nav-dd-menu a:hover { background: var(--c-surface-2); color: var(--c-text); text-decoration: none; }

/* User menu (native <details>) */
.user-dd { position: relative; }
.user-dd > summary { list-style: none; cursor: pointer; }
.user-dd > summary::-webkit-details-marker { display: none; }
.user-dd-menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 240px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--sh-2); padding: var(--s-2); z-index: 200; }
.user-dd-menu .who { padding: var(--s-3); border-bottom: 1px solid var(--c-border); margin-bottom: var(--s-2); }
.user-dd-menu .who .nm { font-weight: 600; font-size: 14px; }
.user-dd-menu .who .em { color: var(--c-text-2); font-size: 13px; word-break: break-all; }
.user-dd-menu a, .user-dd-menu .menu-link { display: flex; align-items: center; gap: var(--s-2); min-height: 44px; padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--c-text); font-size: 14px; cursor: pointer; }
.user-dd-menu a:hover, .user-dd-menu .menu-link:hover { background: var(--c-surface-2); text-decoration: none; }

/* Mobile menu toggle (hidden on tablet+) */
.nav-toggle { display: none; width: 44px; height: 44px; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer; align-items: center; justify-content: center; }
.nav-toggle:hover { background: var(--c-surface-2); }

/* ── Page container ── */
.page { width: 100%; max-width: var(--container); margin: 0 auto; padding: var(--s-5) var(--s-4); flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-5); flex-wrap: wrap; }
.page-head .subtitle { color: var(--c-text-2); font-size: 14px; margin-top: var(--s-1); }

/* ── Grid helpers ── */
.grid { display: grid; gap: var(--s-4); }
.grid-kpi   { grid-template-columns: repeat(2, 1fr); }       /* tablet default */
.grid-2     { grid-template-columns: 1fr; }
.grid-charts{ grid-template-columns: 1fr; }

/* ── Card ── */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-1);
    padding: var(--s-5);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.card-head h3 { font-size: 16px; }
.card-pad-0 { padding: 0; }

/* ── KPI tile ── */
.kpi { display: flex; flex-direction: column; gap: var(--s-2); }
.kpi .kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi .kpi-label { color: var(--c-text-2); font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.kpi .kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.01em; }
.kpi .kpi-value .cur { font-size: 16px; font-weight: 600; color: var(--c-text-2); margin-right: 2px; }
.kpi .kpi-icon { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none; }
.kpi .kpi-icon svg { width: 22px; height: 22px; }
.kpi .i-accent { background: var(--c-accent-tint); color: var(--c-accent-700); }
.kpi .i-income { background: var(--c-income-tint); color: var(--c-income); }
.kpi .i-warn   { background: var(--c-warning-tint); color: var(--c-warning); }
.kpi .i-danger { background: var(--c-danger-tint); color: var(--c-danger); }

/* Delta / trend pill */
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); }
.delta.up   { color: var(--c-success); background: var(--c-success-tint); }
.delta.down { color: var(--c-danger);  background: var(--c-danger-tint); }
.delta svg { width: 14px; height: 14px; }

/* ── Chart wrap (reserve space → no CLS) ── */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap.h-280 { height: 280px; }
.chart-wrap.h-220 { height: 220px; }
.chart-legend { display: flex; gap: var(--s-4); margin-top: var(--s-3); flex-wrap: wrap; }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--c-text-2); }
.chart-legend .dot { width: 10px; height: 10px; border-radius: 3px; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
    min-height: 44px; padding: 0 var(--s-4);
    border-radius: var(--r-sm);
    font-family: inherit; font-size: 15px; font-weight: 600;
    border: 1px solid transparent; cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .05s ease;
    white-space: nowrap; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn-primary   { background: var(--c-accent); color: var(--c-on-accent); }
.btn-primary:hover { background: var(--c-accent-700); text-decoration: none; }
.btn-secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border-strong); }
.btn-secondary:hover { background: var(--c-surface-2); text-decoration: none; }
.btn-ghost     { background: transparent; color: var(--c-text-2); }
.btn-ghost:hover { background: var(--c-surface-2); color: var(--c-text); }
.btn-danger    { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 var(--s-3); font-size: 14px; }

/* LinkButtons render as <a>; the `.ds a` color rule is more specific than
   `.btn-*` and would override button text color. Restore it for anchors. */
.ds a.btn-primary, .ds a.btn-primary:hover { color: var(--c-on-accent); text-decoration: none; }
.ds a.btn-secondary, .ds a.btn-secondary:hover { color: var(--c-text); text-decoration: none; }
.ds a.btn-ghost, .ds a.btn-ghost:hover { color: var(--c-text-2); text-decoration: none; }
.ds a.btn-ghost.text-danger, .ds a.btn-ghost.text-danger:hover { color: var(--c-danger); text-decoration: none; }
.ds a.btn-danger, .ds a.btn-danger:hover { color: #fff; text-decoration: none; }

/* ── Forms ── */
.field { margin-bottom: var(--s-4); }
.field label, .label { display: block; font-size: 14px; font-weight: 600; color: var(--c-text); margin-bottom: 6px; }
.label .req { color: var(--c-danger); margin-left: 2px; }
.input, .select, .textarea {
    display: block;
    box-sizing: border-box;
    width: 100%; min-height: 44px;
    min-width: 0;
    max-width: 100%;
    padding: 10px var(--s-3);
    font-family: inherit; font-size: 16px; /* 16px = no iOS zoom */
    color: var(--c-text);
    background: var(--c-surface);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--r-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input[type="date"] {
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-tint);
}
.input::placeholder { color: var(--c-text-3); }
.input[aria-invalid="true"], .input.is-error { border-color: var(--c-danger); }
.help { font-size: 13px; color: var(--c-text-2); margin-top: 6px; }
.error-text { font-size: 13px; color: var(--c-danger); margin-top: 6px; }

/* Token multi-select */
.token-select-source { display: none !important; }
.token-select {
    position: relative;
    min-height: 44px;
    padding: 6px;
    background: var(--c-surface);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--r-sm);
}
.token-select:focus-within {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-tint);
}
.token-select-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.token-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    max-width: 100%;
    padding: 3px 8px;
    border-radius: var(--r-pill);
    background: var(--c-accent-tint);
    color: var(--c-accent-700);
    font-size: 13px;
    font-weight: 600;
}
.token-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.token-chip button {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    line-height: 1;
    padding: 0 2px;
}
.token-input {
    flex: 1 1 120px;
    min-width: 90px;
    border: 0;
    outline: 0;
    padding: 6px;
    font: inherit;
    font-size: 16px;
    color: var(--c-text);
}
.token-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 250;
    max-height: 240px;
    overflow-y: auto;
    display: none;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    box-shadow: var(--sh-2);
    padding: 4px;
}
.token-select.open .token-menu { display: block; }
.token-option {
    padding: 10px 12px;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 14px;
}
.token-option:hover { background: var(--c-surface-2); }
.token-option.selected { background: var(--c-accent-tint); color: var(--c-accent-700); font-weight: 600; }
.token-empty { padding: 10px 12px; color: var(--c-text-2); font-size: 14px; }

/* Filter bar (replaces DevExpress filter rows) */
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end; padding: var(--s-4); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); margin-bottom: var(--s-5); }
.filter-bar .field { flex: 1 1 200px; margin-bottom: 0; min-width: 180px; }
.filter-bar .actions { display: flex; gap: var(--s-2); flex: 0 0 auto; }

/* ── Table ── */
.table-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--sh-1); overflow: hidden; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.dtable thead th {
    text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
    color: var(--c-text-2); background: var(--c-surface-2);
    padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--c-border); white-space: nowrap;
}
.dtable thead th.right, .dtable td.right { text-align: right; }
.dtable tbody td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--c-border); color: var(--c-text); vertical-align: middle; }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tbody tr:hover { background: var(--c-surface-2); }
.dtable td.amt { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.dtable tfoot td { padding: var(--s-3) var(--s-4); font-weight: 700; border-top: 2px solid var(--c-border); background: var(--c-surface-2); }

/* Pager (client-side pagination) */
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-3) var(--s-4); border-top: 1px solid var(--c-border); background: var(--c-surface); }
.pager-info { font-size: 13px; color: var(--c-text-2); }
.pager-btns { display: flex; align-items: center; gap: var(--s-1); flex-wrap: wrap; }
.pager-btn, .pager-num { min-height: 36px; min-width: 36px; padding: 0 var(--s-3); border: 1px solid var(--c-border-strong); background: var(--c-surface); color: var(--c-text); border-radius: var(--r-sm); font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.pager-btn:hover, .pager-num:hover { background: var(--c-surface-2); }
.pager-num.active { background: var(--c-accent); color: var(--c-on-accent); border-color: var(--c-accent); }
.pager-btn[disabled] { opacity: .45; cursor: not-allowed; }
.pager-gap { padding: 0 4px; color: var(--c-text-3); }

/* Status badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--r-pill); }
.badge.paid    { background: var(--c-success-tint); color: var(--c-success); }
.badge.pending { background: var(--c-warning-tint); color: var(--c-warning); }
.badge.overdue { background: var(--c-danger-tint);  color: var(--c-danger); }

/* ── Modal / sheet ── */
.modal-scrim { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: none; z-index: 1000; }
.modal-scrim.open { display: block; }
.modal {
    position: fixed; z-index: 1001; left: 50%; top: 50%; transform: translate(-50%,-50%);
    width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); max-height: calc(100vh - 48px);
    background: var(--c-surface); border-radius: var(--r-lg); box-shadow: var(--sh-3);
    display: none; flex-direction: column; overflow: hidden;
}
.modal.open { display: flex; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--c-border); }
.modal-body { padding: var(--s-5); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--c-border); }
.modal-close { width: 40px; height: 40px; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer; font-size: 22px; color: var(--c-text-2); }
.modal-close:hover { background: var(--c-surface-2); }

/* Full-page action guard */
.page-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15,23,42,.55);
    cursor: wait;
}
.page-loading-overlay.open { display: flex; }
.page-loading-box {
    width: min(320px, calc(100vw - 48px));
    padding: var(--s-5);
    border-radius: var(--r-md);
    background: var(--c-surface);
    box-shadow: var(--sh-3);
    text-align: center;
}
.page-loading-spinner {
    width: 34px;
    height: 34px;
    margin: 0 auto var(--s-3);
    border: 4px solid var(--c-border);
    border-top-color: var(--c-accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
.page-loading-title { font-weight: 700; color: var(--c-text); }
.page-loading-subtitle { margin-top: 4px; color: var(--c-text-2); font-size: 13px; }
.is-page-loading .app-shell { pointer-events: none; user-select: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ── */
.empty { text-align: center; padding: var(--s-7) var(--s-4); color: var(--c-text-2); }
.empty svg { width: 48px; height: 48px; color: var(--c-text-3); margin-bottom: var(--s-3); }

/* ── Skeleton (loading) ── */
.skel { background: linear-gradient(90deg, #eef1f4 25%, #f6f8fa 37%, #eef1f4 63%); background-size: 400% 100%; animation: skel 1.4s ease infinite; border-radius: var(--r-sm); }
@keyframes skel { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ── Utilities ── */
.muted { color: var(--c-text-2); }
.text-success { color: var(--c-success); }
.text-danger  { color: var(--c-danger); }
.mt-2 { margin-top: var(--s-2); } .mt-4 { margin-top: var(--s-4); } .mt-5 { margin-top: var(--s-5); }
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); }
.hide-mobile { display: none; }

/* ══════════════════════════════════════════════════════════════
   Responsive — tablet-first.
   Base styles above target tablet (≥768). Below = phone overrides;
   above = desktop enhancements.
   ══════════════════════════════════════════════════════════════ */

/* Phone (< 768) */
@media (max-width: 767px) {
    .nav { display: none; position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--c-surface); border-bottom: 1px solid var(--c-border); padding: var(--s-2); box-shadow: var(--sh-2); }
    .nav.open { display: flex; }
    .nav a, .nav .nav-item { min-height: 48px; }
    .nav-toggle { display: inline-flex; }
    .grid-kpi { grid-template-columns: 1fr; }     /* single column on phone */
    .filter-bar { box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0; padding: var(--s-3); }
    .filter-bar .field { flex: 1 1 100%; width: 100%; min-width: 0; max-width: 100%; }
    .filter-bar .actions { width: 100%; min-width: 0; flex-wrap: wrap; }
    .filter-bar .actions .btn { flex: 1; }
    .filter-bar .input, .filter-bar .select, .filter-bar .textarea, .filter-bar .token-select { width: 100%; max-width: 100%; min-width: 0; }
    .modal {
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        top: 50% !important;
        transform: translate(-50%,-50%) !important;
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100dvh - 24px) !important;
        border-radius: var(--r-lg);
    }
    .modal-body { padding: var(--s-4); }
    .modal-foot { flex-direction: column-reverse; }
    .modal-foot .btn, .modal-foot input[type="submit"], .modal-foot button { width: 100%; }
    .page { padding: var(--s-4) var(--s-3); }
    .kpi .kpi-value { font-size: 26px; }
}

/* Desktop (≥ 1024) */
@media (min-width: 1024px) {
    .grid-kpi    { grid-template-columns: repeat(4, 1fr); }
    .grid-charts { grid-template-columns: 3fr 2fr; }   /* cashflow wide, income narrow */
    .grid-2      { grid-template-columns: 2fr 1fr; }
    .hide-mobile { display: block; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ds *, .btn, .nav a { transition: none !important; animation: none !important; }
    .skel { animation: none; }
}
