/* =========================================================================
   Nebula Expense — design system
   ========================================================================= */

:root {
    --bg-0: #04060d;
    --bg-1: #070b16;
    --panel: rgba(16, 24, 43, .74);
    --panel-2: rgba(10, 16, 30, .86);
    --panel-solid: #0d1424;
    --line: rgba(125, 160, 255, .13);
    --line-strong: rgba(125, 160, 255, .26);
    --text: #e9f0ff;
    --muted: #8ea3c6;
    --dim: #64789c;
    --cyan: #22d3ee;
    --violet: #8b5cf6;
    --mint: #34d399;
    --amber: #fbbf24;
    --rose: #fb7185;
    --blue: #60a5fa;
    --pink: #f472b6;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 34px 70px -40px rgba(0, 0, 0, .95);
    --ease: cubic-bezier(.22, .61, .36, 1);
    --sidebar-w: 264px;
    --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-0);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.modal-open { overflow: hidden; }

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
::selection { background: rgba(34, 211, 238, .35); color: #fff; }

/* ---------- Background FX ---------- */

.bg-fx { position: fixed; inset: 0; z-index: -2; overflow: hidden; background:
    radial-gradient(1100px 700px at 8% -12%, rgba(34, 211, 238, .13), transparent 58%),
    radial-gradient(900px 680px at 102% -6%, rgba(139, 92, 246, .17), transparent 56%),
    radial-gradient(900px 700px at 50% 118%, rgba(52, 211, 153, .09), transparent 62%),
    linear-gradient(175deg, #05070f 0%, #070c19 45%, #04060d 100%);
}

.bg-fx::after {
    content: "";
    position: absolute;
    inset: -10%;
    background-image:
        linear-gradient(rgba(125, 165, 255, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(125, 165, 255, .05) 1px, transparent 1px);
    background-size: 58px 58px;
    -webkit-mask-image: radial-gradient(circle at 50% 24%, #000 0%, transparent 72%);
    mask-image: radial-gradient(circle at 50% 24%, #000 0%, transparent 72%);
    animation: gridDrift 42s linear infinite;
}

@keyframes gridDrift {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(58px, 58px, 0); }
}

.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; animation: float 18s ease-in-out infinite; }
.orb-a { width: 420px; height: 420px; background: radial-gradient(circle, rgba(34, 211, 238, .55), transparent 68%); top: -120px; left: -80px; }
.orb-b { width: 520px; height: 520px; background: radial-gradient(circle, rgba(139, 92, 246, .5), transparent 68%); top: 6%; right: -160px; animation-delay: -6s; }
.orb-c { width: 460px; height: 460px; background: radial-gradient(circle, rgba(52, 211, 153, .38), transparent 68%); bottom: -180px; left: 34%; animation-delay: -11s; }

@keyframes float {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50%      { transform: translate3d(24px, -30px, 0) scale(1.07); }
}

/* ---------- Type & utilities ---------- */

.grad-text {
    background: linear-gradient(100deg, #67e8f9 0%, #a78bfa 55%, #f0abfc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

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

.pulse {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 0 0 rgba(52, 211, 153, .6);
    animation: pulse 2.4s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); }
    70%  { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.hide-sm { display: inline; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.opt { color: var(--dim); font-weight: 400; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.ico { width: 18px; height: 18px; flex: none; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Buttons ---------- */

.btn {
    --btn-bg: rgba(255, 255, 255, .05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 11px;
    border: 1px solid var(--line-strong);
    background: var(--btn-bg);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: .01em;
    white-space: nowrap;
    transition: transform .16s var(--ease), box-shadow .2s, background .2s, border-color .2s;
}
.btn:hover { background: rgba(255, 255, 255, .09); border-color: rgba(140, 175, 255, .42); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(34, 211, 238, .3); }
.btn .ico { width: 16px; height: 16px; }

.btn--primary {
    border-color: transparent;
    background: linear-gradient(120deg, #22d3ee, #6366f1 68%, #8b5cf6);
    color: #04121a;
    font-weight: 700;
    box-shadow: 0 12px 30px -12px rgba(34, 211, 238, .65), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn--primary:hover { background: linear-gradient(120deg, #4be3fa, #7c7cf7 68%, #a78bfa); color: #03101a; }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn--ghost:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.btn--danger { border-color: rgba(251, 113, 133, .4); color: #fecdd3; background: rgba(251, 113, 133, .1); }
.btn--danger:hover { background: rgba(251, 113, 133, .18); }
.btn--sm { padding: 7px 11px; font-size: 12.5px; border-radius: 9px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.icon-btn {
    width: 36px; height: 36px;
    display: inline-grid; place-items: center;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .03);
    color: var(--muted);
    transition: .18s var(--ease);
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, .08); border-color: var(--line-strong); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(34, 211, 238, .3); }
.icon-btn--ghost { border-color: transparent; background: transparent; width: 32px; height: 32px; }
.icon-btn--danger:hover { color: #fecdd3; background: rgba(251, 113, 133, .14); border-color: rgba(251, 113, 133, .3); }

/* ---------- Sidebar ---------- */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px 18px;
    background: linear-gradient(180deg, rgba(10, 16, 30, .92), rgba(7, 11, 22, .82));
    border-right: 1px solid var(--line);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    z-index: 60;
    overflow-y: auto;
    transition: transform .28s var(--ease);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px; }
.brand__mark { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 0 12px rgba(34, 211, 238, .45)); }
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text strong { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.brand__text small { font-size: 10.5px; color: var(--dim); letter-spacing: .12em; text-transform: uppercase; }
.brand--lg .brand__mark { width: 46px; height: 46px; }
.brand--lg .brand__text strong { font-size: 17px; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav__label { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); padding: 0 12px 8px; }
.nav__item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 12px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 550;
    border: 1px solid transparent;
    transition: .18s var(--ease);
}
.nav__item:hover { color: var(--text); background: rgba(255, 255, 255, .045); }
.nav__item.is-active {
    color: #eaf6ff;
    background: linear-gradient(100deg, rgba(34, 211, 238, .16), rgba(139, 92, 246, .14));
    border-color: rgba(34, 211, 238, .28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 10px 26px -18px rgba(34, 211, 238, .8);
}
.nav__item.is-active .nav__icon { color: var(--cyan); }
.nav__icon { width: 19px; height: 19px; color: var(--dim); transition: color .18s; }
.nav__dot { position: absolute; right: 12px; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }

.sidebar__foot { display: flex; flex-direction: column; gap: 12px; }

.mini-stats {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    background: linear-gradient(160deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .012));
}
.mini-stats__row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 3px 0; }
.mini-stats__row strong { margin-left: auto; font-size: 12.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.mini-stats__hint { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin-top: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot--cyan { background: var(--cyan); box-shadow: 0 0 8px rgba(34, 211, 238, .8); }
.dot--violet { background: var(--violet); box-shadow: 0 0 8px rgba(139, 92, 246, .8); }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .025);
}
.user-chip__meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-chip__meta strong { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip__meta small { font-size: 10.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
    width: 36px; height: 36px; flex: none;
    display: grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(34, 211, 238, .9), rgba(139, 92, 246, .9));
    color: #04121a;
    font-weight: 800;
    font-size: 12.5px;
    letter-spacing: .02em;
    box-shadow: 0 0 0 2px rgba(6, 9, 17, .9), 0 0 18px -4px rgba(34, 211, 238, .8);
}

/* ---------- Shell & topbar ---------- */

.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 28px;
    background: rgba(6, 10, 20, .72);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.topbar__menu { display: none; }
.topbar__title { min-width: 0; }
.topbar__title h1 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.topbar__title p { font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.topbar__tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.search {
    position: relative;
    display: flex;
    align-items: center;
    width: 260px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .035);
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.search:focus-within { border-color: rgba(34, 211, 238, .45); box-shadow: 0 0 0 3px rgba(34, 211, 238, .12); background: rgba(255, 255, 255, .05); }
.search__icon { width: 16px; height: 16px; color: var(--dim); }
.search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 9px 8px;
    font-size: 13px;
    outline: none;
}
.search input::placeholder { color: var(--dim); }
.search kbd {
    font-family: var(--font);
    font-size: 10px;
    color: var(--dim);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 1px 5px;
    background: rgba(255, 255, 255, .04);
}

.page { padding: 24px 28px 40px; max-width: 1560px; width: 100%; flex: 1; }

.site-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px 22px;
    font-size: 11px;
    color: var(--dim);
    letter-spacing: .04em;
}
.site-foot__sep { opacity: .5; }

/* ---------- Page head ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { font-size: 24px; font-weight: 700; letter-spacing: -.025em; }
.page-head p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.page-head__actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ---------- Cards ---------- */

.card {
    position: relative;
    background: linear-gradient(165deg, rgba(23, 33, 58, .72), rgba(10, 16, 30, .78));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .055);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, .35), rgba(139, 92, 246, .32), transparent);
    opacity: .7;
    border-radius: var(--radius) var(--radius) 0 0;
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.card__head h3 { font-size: 14.5px; font-weight: 650; letter-spacing: -.005em; }
.card__head p { font-size: 12px; color: var(--dim); margin-top: 2px; }
.card__body { padding: 18px 20px 20px; }
.card--flush .card__body { padding: 14px 0 0; }

.grid { display: grid; gap: 16px; }
.grid--stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--dash { grid-template-columns: minmax(0, 2.05fr) minmax(0, 1fr); align-items: stretch; }
.grid--dash-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2.05fr); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- KPI ---------- */

.kpi { padding: 18px 18px 12px; overflow: hidden; }
.kpi__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi__label { font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.kpi__icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    display: grid; place-items: center;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, .04);
}
.kpi__icon .ico { width: 17px; height: 17px; }
.kpi--cyan .kpi__icon { color: var(--cyan); border-color: rgba(34, 211, 238, .3); background: rgba(34, 211, 238, .09); box-shadow: 0 0 22px -8px rgba(34, 211, 238, .55); }
.kpi--violet .kpi__icon { color: #c4b5fd; border-color: rgba(139, 92, 246, .34); background: rgba(139, 92, 246, .12); box-shadow: 0 0 22px -8px rgba(139, 92, 246, .55); }
.kpi--mint .kpi__icon { color: #6ee7b7; border-color: rgba(52, 211, 153, .3); background: rgba(52, 211, 153, .09); box-shadow: 0 0 22px -8px rgba(52, 211, 153, .5); }
.kpi--amber .kpi__icon { color: #fcd34d; border-color: rgba(251, 191, 36, .3); background: rgba(251, 191, 36, .09); }

.kpi__value { font-size: 29px; font-weight: 680; letter-spacing: -.03em; margin-top: 14px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi__value small { font-size: 13px; color: var(--dim); font-weight: 500; letter-spacing: 0; }
.kpi__meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.kpi__sub { font-size: 12px; color: var(--dim); }

.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; padding: 2px 7px; border-radius: 999px; }
.delta .ico { width: 12px; height: 12px; }
.delta--good { color: #6ee7b7; background: rgba(52, 211, 153, .12); }
.delta--bad { color: #fda4af; background: rgba(251, 113, 133, .12); }
.delta--flat { color: var(--muted); background: rgba(255, 255, 255, .06); }

.spark { height: 46px; margin-top: 10px; }
.spark svg { width: 100%; height: 46px; overflow: visible; }

/* ---------- Charts ---------- */

.chart { width: 100%; position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart--trend { height: 268px; }
.chart--trend svg { height: 100%; }
.chart--donut { display: grid; place-items: center; }
.chart__legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.legend-item i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-item strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.donut-wrap { position: relative; width: 100%; max-width: 230px; margin: 6px auto 0; }
.donut-wrap svg { width: 100%; height: auto; transform: rotate(-90deg); }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center strong { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.donut-center span { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }

.chart-legend-grid { display: grid; gap: 8px; margin-top: 16px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.legend-row i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.legend-row span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-row strong { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

.chart-tip {
    position: absolute; z-index: 5; pointer-events: none;
    padding: 7px 10px; border-radius: 9px;
    background: rgba(6, 11, 22, .96);
    border: 1px solid var(--line-strong);
    font-size: 11.5px; color: var(--text);
    box-shadow: 0 16px 30px -18px #000;
    transform: translate(-50%, -112%);
    white-space: nowrap;
    opacity: 0; transition: opacity .12s;
}
.chart-tip.is-on { opacity: 1; }
.chart-tip b { color: var(--cyan); }

.chart-toggle { display: inline-flex; padding: 3px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); gap: 2px; }
.chart-toggle button {
    border: 0; background: transparent; color: var(--dim);
    font-size: 11.5px; font-weight: 600; padding: 5px 10px; border-radius: 7px;
    transition: .18s;
}
.chart-toggle button.is-active { color: #04121a; background: linear-gradient(120deg, #22d3ee, #8b5cf6); }
.chart-toggle button:hover { color: var(--text); }
.chart-toggle button.is-active:hover { color: #04121a; }

/* ---------- Budgets ---------- */

.budget { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; }
.budget + .budget { border-top: 1px dashed var(--line); }
.budget__top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.budget__name { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; }
.budget__nums { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.budget__nums strong { color: var(--text); }
.progress { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; position: relative; }
.progress__bar { height: 100%; border-radius: 99px; transition: width .8s var(--ease); position: relative; }
.progress__bar::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .28)); }
.progress--cyan .progress__bar { background: linear-gradient(90deg, #0891b2, #22d3ee); box-shadow: 0 0 14px rgba(34, 211, 238, .5); }
.progress--violet .progress__bar { background: linear-gradient(90deg, #6d28d9, #a78bfa); box-shadow: 0 0 14px rgba(139, 92, 246, .5); }
.progress--warn .progress__bar { background: linear-gradient(90deg, #d97706, #fbbf24); box-shadow: 0 0 14px rgba(251, 191, 36, .5); }
.progress--over .progress__bar { background: linear-gradient(90deg, #be123c, #fb7185); box-shadow: 0 0 14px rgba(251, 113, 133, .55); }
.budget__hint { font-size: 11px; color: var(--dim); }

/* ---------- Tables ---------- */

.table-wrap { width: 100%; overflow-x: auto; }
.table { font-size: 13px; }
.table thead th {
    text-align: left;
    font-size: 10.5px;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--dim);
    font-weight: 650;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    background: rgba(255, 255, 255, .015);
}
.table tbody td { padding: 12px 16px; border-bottom: 1px solid rgba(125, 160, 255, .07); vertical-align: middle; }
.table tbody tr { transition: background .16s; }
.table tbody tr:hover { background: rgba(255, 255, 255, .028); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .t-right { text-align: right; }
.table .t-amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 620; white-space: nowrap; }
.table .t-date { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .t-actions { text-align: right; white-space: nowrap; }
.table .t-actions .icon-btn { width: 30px; height: 30px; }
.table .t-actions .icon-btn .ico { width: 15px; height: 15px; }

.cell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-main__text { min-width: 0; }
.cell-main__text strong { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.cell-main__text small { display: block; color: var(--dim); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }

.cat-swatch {
    width: 30px; height: 30px; flex: none;
    border-radius: 9px;
    display: grid; place-items: center;
    border: 1px solid rgba(255, 255, 255, .1);
}
.cat-swatch .ico { width: 15px; height: 15px; }

/* ---------- Badges ---------- */

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 650; letter-spacing: .03em;
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge__dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge--personal { color: #7dd3fc; background: rgba(56, 189, 248, .12); border-color: rgba(56, 189, 248, .28); }
.badge--business { color: #c4b5fd; background: rgba(139, 92, 246, .14); border-color: rgba(139, 92, 246, .3); }
.badge--muted { color: var(--muted); background: rgba(255, 255, 255, .05); border-color: var(--line); }
.badge--mint { color: #6ee7b7; background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .25); }
.badge--warn { color: #fcd34d; background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .25); }
.badge--danger { color: #fda4af; background: rgba(251, 113, 133, .1); border-color: rgba(251, 113, 133, .25); }

/* ---------- Forms ---------- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field__label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="search"], input[type="file"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .035);
    color: var(--text);
    font-size: 13.5px;
    outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
    -webkit-appearance: none;
    appearance: none;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus {
    border-color: rgba(34, 211, 238, .5);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, .12);
    background: rgba(255, 255, 255, .05);
}
input[type="date"] { color-scheme: dark; }
input[type="file"] { padding: 8px; font-size: 12px; color: var(--muted); }
input[type="file"]::file-selector-button {
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    border-radius: 7px;
    padding: 5px 10px;
    margin-right: 10px;
    font-size: 12px;
    cursor: pointer;
}

.select-wrap { position: relative; }
.select-wrap select { padding-right: 34px; cursor: pointer; }
.select-wrap__ico { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--dim); pointer-events: none; }
select option { background: #0d1424; color: var(--text); }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); margin-bottom: 14px; }
.segmented__opt { position: relative; }
.segmented__opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented__opt span {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 8px 10px; border-radius: 9px;
    font-size: 12.5px; font-weight: 600; color: var(--muted);
    transition: .18s var(--ease);
}
.segmented__opt .ico { width: 15px; height: 15px; }
.segmented__opt input:checked + span {
    color: #eaf6ff;
    background: linear-gradient(100deg, rgba(34, 211, 238, .2), rgba(139, 92, 246, .2));
    box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .32);
}
.segmented__opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(34, 211, 238, .25); }

.amount-field { position: relative; margin-bottom: 14px; }
.amount-field__symbol { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--dim); font-weight: 600; }
.amount-field__input {
    padding: 14px 16px 14px 44px !important;
    font-size: 26px !important;
    font-weight: 700;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    background: rgba(34, 211, 238, .045) !important;
    border-color: rgba(34, 211, 238, .22) !important;
}
.amount-field__input:focus { border-color: rgba(34, 211, 238, .55) !important; }

.dropzone {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 13px; margin-top: 4px;
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    background: rgba(255, 255, 255, .02);
    cursor: pointer;
    transition: .18s;
}
.dropzone:hover { border-color: rgba(34, 211, 238, .45); background: rgba(34, 211, 238, .04); }
.dropzone .ico { color: var(--cyan); width: 20px; height: 20px; }
.dropzone span { display: flex; flex-direction: column; line-height: 1.3; }
.dropzone strong { font-size: 12.5px; font-weight: 600; }
.dropzone small { font-size: 11px; color: var(--dim); }
.dropzone input { display: none; }
.dropzone.has-file { border-color: rgba(52, 211, 153, .5); background: rgba(52, 211, 153, .06); }

.form-error { margin: 12px 0 0; font-size: 12.5px; color: #fda4af; display: flex; align-items: center; gap: 7px; }
.field-error { font-size: 11.5px; color: #fda4af; margin-top: -3px; }
input.is-invalid, select.is-invalid, textarea.is-invalid { border-color: rgba(251, 113, 133, .55); box-shadow: 0 0 0 3px rgba(251, 113, 133, .1); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field { margin: 0; min-width: 130px; flex: 1 1 130px; }
.filters .field--grow { flex: 2 1 220px; }

/* ---------- Modal ---------- */

.modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__scrim { position: absolute; inset: 0; background: rgba(2, 4, 10, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .2s var(--ease); }
.modal__panel {
    position: relative;
    width: min(560px, 100%);
    max-height: min(90vh, 900px);
    overflow-y: auto;
    padding: 22px;
    border-radius: 20px;
    border: 1px solid var(--line-strong);
    background: linear-gradient(170deg, rgba(20, 30, 54, .98), rgba(9, 14, 27, .99));
    box-shadow: 0 50px 100px -40px #000, 0 0 0 1px rgba(34, 211, 238, .06), inset 0 1px 0 rgba(255, 255, 255, .07);
    animation: pop .24s var(--ease);
    scrollbar-width: thin;
}
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal__head h2 { font-size: 21px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Toasts / flash ---------- */

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 9px; max-width: min(360px, calc(100vw - 40px)); }
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: rgba(11, 18, 33, .97);
    box-shadow: 0 22px 44px -24px #000;
    font-size: 13px;
    animation: toastIn .26s var(--ease);
}
.toast.is-out { animation: toastOut .22s var(--ease) forwards; }
.toast .ico { width: 17px; height: 17px; flex: none; }
.toast--success .ico { color: var(--mint); }
.toast--error .ico { color: var(--rose); }
.toast--info .ico { color: var(--cyan); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }

.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash { display: flex; align-items: center; gap: 9px; padding: 10px 13px; border-radius: 11px; font-size: 13px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); }
.flash .ico { width: 16px; height: 16px; flex: none; }
.flash--success { border-color: rgba(52, 211, 153, .28); background: rgba(52, 211, 153, .08); }
.flash--success .ico { color: var(--mint); }
.flash--error { border-color: rgba(251, 113, 133, .3); background: rgba(251, 113, 133, .08); }
.flash--error .ico { color: var(--rose); }
.flash--info { border-color: rgba(34, 211, 238, .28); background: rgba(34, 211, 238, .07); }
.flash--info .ico { color: var(--cyan); }

/* ---------- Empty / misc ---------- */

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 44px 20px; }
.empty__ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; border: 1px solid var(--line); background: rgba(255, 255, 255, .035); color: var(--dim); }
.empty__ico .ico { width: 24px; height: 24px; }
.empty h3 { font-size: 15px; font-weight: 650; }
.empty p { font-size: 12.5px; color: var(--dim); max-width: 320px; }

.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 32px; height: 32px; display: grid; place-items: center;
    padding: 0 8px; border-radius: 8px; font-size: 12.5px;
    border: 1px solid var(--line); color: var(--muted);
}
.pagination a:hover { border-color: var(--line-strong); color: var(--text); }
.pagination .is-active { background: linear-gradient(120deg, rgba(34, 211, 238, .2), rgba(139, 92, 246, .2)); border-color: rgba(34, 211, 238, .35); color: #eaf6ff; font-weight: 650; }
.pagination .is-disabled { opacity: .4; pointer-events: none; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 11px; border-radius: 999px;
    font-size: 12px; font-weight: 550;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .035);
    color: var(--muted);
    transition: .18s;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.is-active { color: #eaf6ff; border-color: rgba(34, 211, 238, .4); background: rgba(34, 211, 238, .11); }
.chip i { width: 7px; height: 7px; border-radius: 50%; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar__left, .toolbar__right { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.result-count { font-size: 12px; color: var(--dim); }

.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 13px; border-bottom: 1px dashed rgba(125, 160, 255, .09); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv strong { font-weight: 600; font-variant-numeric: tabular-nums; }

.section-title { display: flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin: 24px 0 12px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Categories page ---------- */

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.cat-card { display: flex; align-items: center; gap: 12px; padding: 13px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .025); transition: .2s var(--ease); }
.cat-card:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .045); transform: translateY(-1px); }
.cat-card__meta { min-width: 0; flex: 1; }
.cat-card__meta strong { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-card__meta small { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.cat-card__actions { display: flex; gap: 4px; }

.color-dots { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dots label { position: relative; cursor: pointer; }
.color-dots input { position: absolute; opacity: 0; inset: 0; }
.color-dots span { display: block; width: 26px; height: 26px; border-radius: 8px; border: 2px solid transparent; transition: .16s; }
.color-dots input:checked + span { border-color: #fff; box-shadow: 0 0 0 3px rgba(34, 211, 238, .25); }

/* ---------- Auth ---------- */

.auth-grid { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.auth-hero { display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 44px 48px; }
.auth-hero__copy { max-width: 520px; }
.auth-hero__copy h1 { font-size: clamp(34px, 4.4vw, 56px); line-height: 1.06; letter-spacing: -.035em; font-weight: 700; margin: 18px 0 16px; }
.auth-hero__copy > p { color: var(--muted); font-size: 14.5px; line-height: 1.65; max-width: 440px; }
.hero-list { display: flex; flex-direction: column; gap: 12px; margin-top: 26px; }
.hero-list li { display: flex; align-items: center; gap: 11px; font-size: 13.5px; color: #c9d6ee; }
.hero-list .ico { width: 17px; height: 17px; color: var(--cyan); flex: none; }
.auth-hero__foot { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }

.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 40px 28px; }
.auth-card { width: min(430px, 100%); padding: 28px; }
.auth-card h2 { font-size: 23px; font-weight: 700; letter-spacing: -.025em; }
.auth-card > p { color: var(--muted); font-size: 13px; margin-top: 5px; }
.auth-form { margin-top: 20px; }
.auth-alt { font-size: 12.5px; color: var(--dim); text-align: center; }
.auth-alt a { color: var(--cyan); }
.auth-alt a:hover { text-decoration: underline; }
.auth-note { display: flex; gap: 8px; align-items: flex-start; font-size: 11.5px; color: var(--dim); margin-top: 14px; line-height: 1.5; }
.auth-note .ico { width: 14px; height: 14px; margin-top: 2px; color: var(--mint); flex: none; }

/* ---------- Drawer & bottom nav ---------- */

.drawer-scrim { position: fixed; inset: 0; background: rgba(2, 4, 10, .65); backdrop-filter: blur(3px); z-index: 55; }
.drawer-scrim[hidden] { display: none; }

.bottom-nav { display: none; }

/* ---------- Responsive ---------- */

@media (max-width: 1280px) {
    .grid--stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid--dash, .grid--dash-2 { grid-template-columns: minmax(0, 1fr); }
    .search { width: 210px; }
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-104%); box-shadow: 40px 0 90px -50px #000; }
    body.drawer-open .sidebar { transform: translateX(0); }
    .shell { margin-left: 0; }
    .topbar__menu { display: inline-grid; }
    .topbar { padding: 12px 18px; }
    .page { padding: 18px 18px 40px; }
    .site-foot { padding: 12px 18px 20px; }
    .auth-grid { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .auth-panel { min-height: 100vh; padding: 28px 18px; }
    .auth-card { padding: 24px; }
}

@media (max-width: 760px) {
    body.app { padding-bottom: 76px; }
    .topbar { gap: 10px; padding: 10px 14px; }
    .topbar__title h1 { font-size: 16.5px; }
    .topbar__title p { display: none; }
    .topbar__tools .search { display: none; }
    .topbar__tools .btn--primary span { display: none; }
    .topbar__tools .btn--primary { padding: 10px 12px; }
    .page { padding: 14px 14px 26px; }
    .page-head { margin-bottom: 14px; }
    .page-head h2 { font-size: 20px; }
    .grid { gap: 12px; }
    .grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); }
    .kpi { padding: 15px 15px 10px; }
    .kpi__value { font-size: 24px; }
    .card__head { padding: 15px 16px 0; }
    .card__body { padding: 15px 16px 16px; }
    .chart--trend { height: 220px; }
    .form-grid, .form-grid--3 { grid-template-columns: minmax(0, 1fr); }
    .modal { padding: 0; align-items: flex-end; }
    .modal__panel { width: 100%; max-height: 94vh; border-radius: 20px 20px 0 0; padding: 18px; animation: sheetUp .28s var(--ease); }
    @keyframes sheetUp { from { transform: translateY(40px); opacity: .6; } }
    .toasts { right: 12px; left: 12px; bottom: 88px; max-width: none; }

    .bottom-nav {
        position: fixed; bottom: 0; left: 0; right: 0; z-index: 70;
        display: grid; grid-template-columns: repeat(5, 1fr);
        align-items: center;
        height: 66px;
        padding-bottom: env(safe-area-inset-bottom);
        background: rgba(7, 12, 23, .93);
        border-top: 1px solid var(--line);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; color: var(--dim); font-weight: 600; letter-spacing: .02em; }
    .bottom-nav a .ico { width: 19px; height: 19px; }
    .bottom-nav a.is-active { color: var(--cyan); }
    .bottom-nav__add {
        justify-self: center;
        width: 52px; height: 52px; margin-top: -26px;
        border-radius: 50%;
        border: 1px solid rgba(255, 255, 255, .25);
        background: linear-gradient(135deg, #22d3ee, #8b5cf6);
        color: #04121a;
        display: grid; place-items: center;
        box-shadow: 0 14px 30px -10px rgba(34, 211, 238, .8), 0 0 0 5px rgba(6, 9, 17, .9);
    }
    .bottom-nav__add .ico { width: 24px; height: 24px; }

    /* card-style tables on phones */
    .table--cards thead { display: none; }
    .table--cards tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 4px 10px;
        padding: 12px 14px;
        border-bottom: 1px solid rgba(125, 160, 255, .08);
    }
    .table--cards tbody td { display: block; padding: 0; border: 0; }
    .table--cards tbody td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 9.5px;
        letter-spacing: .12em;
        text-transform: uppercase;
        color: var(--dim);
        margin-bottom: 2px;
    }
    .table--cards .t-date { grid-column: 1; grid-row: 2; }
    .table--cards .t-desc { grid-column: 1 / -1; grid-row: 1; }
    .table--cards .t-desc::before, .table--cards .t-actions::before, .table--cards .t-cat::before, .table--cards .t-kind::before, .table--cards .t-method::before { display: none; }
    .table--cards .t-cat, .table--cards .t-kind, .table--cards .t-method { display: none; }
    .table--cards .t-amount { grid-column: 2; grid-row: 2; align-self: center; font-size: 14px; }
    .table--cards .t-actions { grid-column: 2; grid-row: 1; }
    .table--cards .cell-main__text strong { max-width: 210px; }
}

@media (max-width: 520px) {
    .grid--stats { grid-template-columns: minmax(0, 1fr); }
    .kpi__value { font-size: 26px; }
    .page-head__actions { width: 100%; }
    .filters .field { flex: 1 1 100%; }
    .auth-card { padding: 20px; }
    .hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
    html { scroll-behavior: auto; }
}

/* =========================================================================
   Receipt capture — reusable component
   Markup: .receipt-capture
             └─ .receipt-capture__dropzone  (label/div, .has-file when chosen)
             └─ .receipt-capture__actions   (buttons row, wraps on small screens)
             └─ .receipt-capture__preview   ([hidden] until a file is chosen)
             └─ .receipt-capture__status    ([hidden] helper/progress text)
   A .receipt-capture__scan button gets .is-loading while OCR is running.
   ========================================================================= */

.receipt-capture {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.receipt-capture__dropzone {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    margin-top: 4px;
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    background: rgba(255, 255, 255, .02);
    cursor: pointer;
    transition: border-color .18s, background .18s, box-shadow .18s;
}
.receipt-capture__dropzone:hover { border-color: rgba(34, 211, 238, .45); background: rgba(34, 211, 238, .04); }
.receipt-capture__dropzone .ico { width: 20px; height: 20px; color: var(--cyan); flex: none; }
.receipt-capture__dropzone span { display: flex; flex-direction: column; line-height: 1.3; }
.receipt-capture__dropzone strong { font-size: 12.5px; font-weight: 600; }
.receipt-capture__dropzone small { font-size: 11px; color: var(--dim); }
.receipt-capture__dropzone input { display: none; }
.receipt-capture__dropzone.has-file { border-color: rgba(52, 211, 153, .5); background: rgba(52, 211, 153, .06); }

.receipt-capture__actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.receipt-capture__preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .03);
}
.receipt-capture__preview[hidden] { display: none; }
.receipt-capture__preview img {
    width: 56px;
    height: 56px;
    flex: none;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .04);
}

.receipt-capture__status {
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--muted);
}
.receipt-capture__status[hidden] { display: none; }

.receipt-capture__scan.is-loading { opacity: .78; pointer-events: none; }
.receipt-capture__scan.is-loading::before {
    content: "";
    width: 13px;
    height: 13px;
    flex: none;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: receiptSpin .7s linear infinite;
}
@keyframes receiptSpin { to { transform: rotate(360deg); } }

/* =========================================================================
   LIGHT THEME
   The resolved theme is applied by JS as data-theme="light" on <html>.
   Wrapped in @media screen so the print rules at the end of this file always
   force white paper (screen-only specificity cannot leak into print).
   ========================================================================= */

@media screen {
    html[data-theme="light"] {
        color-scheme: light;
        --bg-0: #eef3fb;
        --bg-1: #ffffff;
        --panel: rgba(255, 255, 255, .88);
        --panel-2: rgba(255, 255, 255, .95);
        --panel-solid: #ffffff;
        --line: rgba(21, 45, 90, .12);
        --line-strong: rgba(21, 45, 90, .22);
        --text: #0b1730;
        --muted: #40537a;
        --dim: #5a6d92;
        --cyan: #0e7490;
        --violet: #6d28d9;
        --mint: #047857;
        --amber: #b45309;
        --rose: #be123c;
        --blue: #1d4ed8;
        --pink: #be185d;
        --radius: 18px;
        --radius-sm: 12px;
        --shadow: 0 24px 50px -30px rgba(16, 32, 74, .35);
        --ease: cubic-bezier(.22, .61, .36, 1);
        --sidebar-w: 264px;
        --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    }

    /* Selection & type */
    html[data-theme="light"] ::selection { background: rgba(14, 116, 144, .22); color: #06283a; }
    html[data-theme="light"] .grad-text {
        background: linear-gradient(100deg, #0e7490 0%, #6d28d9 55%, #be185d 100%);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }

    /* Background FX */
    html[data-theme="light"] .bg-fx {
        background:
            radial-gradient(1100px 700px at 8% -12%, rgba(14, 116, 144, .12), transparent 58%),
            radial-gradient(900px 680px at 102% -6%, rgba(109, 40, 217, .10), transparent 56%),
            radial-gradient(900px 700px at 50% 118%, rgba(4, 120, 87, .10), transparent 62%),
            linear-gradient(175deg, #f7faff 0%, #eef3fc 45%, #e9f0fa 100%);
    }
    html[data-theme="light"] .bg-fx::after {
        background-image:
            linear-gradient(rgba(30, 64, 120, .06) 1px, transparent 1px),
            linear-gradient(90deg, rgba(30, 64, 120, .06) 1px, transparent 1px);
    }
    html[data-theme="light"] .orb { opacity: .16; }

    /* Buttons */
    html[data-theme="light"] .btn { --btn-bg: rgba(21, 45, 90, .04); }
    html[data-theme="light"] .btn:hover { background: rgba(21, 45, 90, .07); border-color: rgba(14, 116, 144, .35); }
    html[data-theme="light"] .btn:focus-visible { box-shadow: 0 0 0 3px rgba(14, 116, 144, .28); }
    html[data-theme="light"] .btn--primary {
        background: linear-gradient(120deg, #0891b2, #4f46e5 68%, #7c3aed);
        color: #ffffff;
        box-shadow: 0 12px 26px -12px rgba(79, 70, 229, .55), inset 0 1px 0 rgba(255, 255, 255, .28);
    }
    html[data-theme="light"] .btn--primary:hover {
        background: linear-gradient(120deg, #0e7490, #4338ca 68%, #6d28d9);
        color: #ffffff;
    }
    html[data-theme="light"] .btn--ghost { color: var(--muted); }
    html[data-theme="light"] .btn--ghost:hover { color: var(--text); background: rgba(21, 45, 90, .05); }
    html[data-theme="light"] .btn--danger { border-color: rgba(190, 18, 60, .32); color: #be123c; background: rgba(190, 18, 60, .08); }
    html[data-theme="light"] .btn--danger:hover { background: rgba(190, 18, 60, .14); }
    html[data-theme="light"] .icon-btn { background: rgba(21, 45, 90, .03); }
    html[data-theme="light"] .icon-btn:hover { background: rgba(21, 45, 90, .07); }
    html[data-theme="light"] .icon-btn:focus-visible { box-shadow: 0 0 0 3px rgba(14, 116, 144, .28); }
    html[data-theme="light"] .icon-btn--danger:hover { color: #be123c; background: rgba(190, 18, 60, .1); border-color: rgba(190, 18, 60, .3); }

    /* Sidebar */
    html[data-theme="light"] .sidebar { background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(244, 248, 253, .9)); }
    html[data-theme="light"] .brand__mark { filter: drop-shadow(0 0 8px rgba(14, 116, 144, .25)); }
    html[data-theme="light"] .nav__item:hover { color: var(--text); background: rgba(21, 45, 90, .05); }
    html[data-theme="light"] .nav__item.is-active {
        color: #0b2a3a;
        background: linear-gradient(100deg, rgba(14, 116, 144, .14), rgba(109, 40, 217, .12));
        border-color: rgba(14, 116, 144, .3);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 10px 22px -18px rgba(14, 116, 144, .7);
    }
    html[data-theme="light"] .mini-stats { background: linear-gradient(160deg, rgba(255, 255, 255, .9), rgba(238, 244, 252, .8)); }
    html[data-theme="light"] .user-chip { background: rgba(255, 255, 255, .7); }
    html[data-theme="light"] .avatar { box-shadow: 0 0 0 2px #ffffff, 0 0 16px -4px rgba(14, 116, 144, .6); }

    /* Topbar & search */
    html[data-theme="light"] .topbar { background: rgba(255, 255, 255, .84); }
    html[data-theme="light"] .search { background: rgba(21, 45, 90, .04); }
    html[data-theme="light"] .search:focus-within {
        border-color: rgba(14, 116, 144, .5);
        box-shadow: 0 0 0 3px rgba(14, 116, 144, .14);
        background: rgba(255, 255, 255, .9);
    }
    html[data-theme="light"] .search kbd { background: rgba(21, 45, 90, .05); }

    /* Cards */
    html[data-theme="light"] .card {
        background: linear-gradient(165deg, rgba(255, 255, 255, .96), rgba(244, 248, 253, .92));
        box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .95);
    }
    html[data-theme="light"] .card::before { background: linear-gradient(90deg, transparent, rgba(14, 116, 144, .4), rgba(109, 40, 217, .35), transparent); }

    /* KPI & deltas */
    html[data-theme="light"] .kpi__icon { background: rgba(21, 45, 90, .04); }
    html[data-theme="light"] .kpi--cyan .kpi__icon { color: var(--cyan); border-color: rgba(14, 116, 144, .3); background: rgba(14, 116, 144, .09); box-shadow: 0 0 18px -8px rgba(14, 116, 144, .5); }
    html[data-theme="light"] .kpi--violet .kpi__icon { color: var(--violet); border-color: rgba(109, 40, 217, .3); background: rgba(109, 40, 217, .09); box-shadow: 0 0 18px -8px rgba(109, 40, 217, .45); }
    html[data-theme="light"] .kpi--mint .kpi__icon { color: var(--mint); border-color: rgba(4, 120, 87, .3); background: rgba(4, 120, 87, .09); box-shadow: 0 0 18px -8px rgba(4, 120, 87, .45); }
    html[data-theme="light"] .kpi--amber .kpi__icon { color: var(--amber); border-color: rgba(180, 83, 9, .3); background: rgba(180, 83, 9, .09); }
    html[data-theme="light"] .delta--good { color: #047857; background: rgba(4, 120, 87, .1); }
    html[data-theme="light"] .delta--bad { color: #be123c; background: rgba(190, 18, 60, .1); }
    html[data-theme="light"] .delta--flat { background: rgba(21, 45, 90, .06); }

    /* Charts */
    html[data-theme="light"] .chart-tip {
        background: rgba(255, 255, 255, .98);
        color: var(--text);
        box-shadow: 0 16px 30px -18px rgba(16, 32, 74, .45);
    }
    html[data-theme="light"] .chart-toggle { background: rgba(21, 45, 90, .04); }
    html[data-theme="light"] .chart-toggle button.is-active { color: #ffffff; background: linear-gradient(120deg, #0891b2, #6d28d9); }
    html[data-theme="light"] .chart-toggle button.is-active:hover { color: #ffffff; }

    /* Budgets & progress */
    html[data-theme="light"] .progress { background: rgba(21, 45, 90, .1); }
    html[data-theme="light"] .progress__bar::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35)); }

    /* Tables */
    html[data-theme="light"] .table thead th { background: rgba(21, 45, 90, .03); }
    html[data-theme="light"] .table tbody td { border-bottom-color: rgba(21, 45, 90, .09); }
    html[data-theme="light"] .table tbody tr:hover { background: rgba(21, 45, 90, .035); }
    html[data-theme="light"] .cat-swatch { border-color: rgba(21, 45, 90, .14); }
    html[data-theme="light"] .table--cards tbody tr { border-bottom-color: rgba(21, 45, 90, .1); }

    /* Badges */
    html[data-theme="light"] .badge--personal { color: #0369a1; background: rgba(3, 105, 161, .1); border-color: rgba(3, 105, 161, .25); }
    html[data-theme="light"] .badge--business { color: #6d28d9; background: rgba(109, 40, 217, .1); border-color: rgba(109, 40, 217, .25); }
    html[data-theme="light"] .badge--muted { background: rgba(21, 45, 90, .05); }
    html[data-theme="light"] .badge--mint { color: #047857; background: rgba(4, 120, 87, .1); border-color: rgba(4, 120, 87, .25); }
    html[data-theme="light"] .badge--warn { color: #b45309; background: rgba(180, 83, 9, .1); border-color: rgba(180, 83, 9, .25); }
    html[data-theme="light"] .badge--danger { color: #be123c; background: rgba(190, 18, 60, .1); border-color: rgba(190, 18, 60, .25); }

    /* Form controls */
    html[data-theme="light"] input[type="text"],
    html[data-theme="light"] input[type="email"],
    html[data-theme="light"] input[type="password"],
    html[data-theme="light"] input[type="date"],
    html[data-theme="light"] input[type="number"],
    html[data-theme="light"] input[type="search"],
    html[data-theme="light"] input[type="file"],
    html[data-theme="light"] select,
    html[data-theme="light"] textarea { background: rgba(255, 255, 255, .9); }
    html[data-theme="light"] input:focus,
    html[data-theme="light"] select:focus,
    html[data-theme="light"] textarea:focus {
        border-color: rgba(14, 116, 144, .55);
        box-shadow: 0 0 0 3px rgba(14, 116, 144, .14);
        background: #ffffff;
    }
    html[data-theme="light"] input[type="date"] { color-scheme: light; }
    html[data-theme="light"] input[type="file"]::file-selector-button {
        border-color: var(--line-strong);
        background: rgba(21, 45, 90, .06);
        color: var(--text);
    }
    html[data-theme="light"] select option { background: #ffffff; color: var(--text); }
    html[data-theme="light"] .segmented { background: rgba(21, 45, 90, .045); }
    html[data-theme="light"] .segmented__opt input:checked + span {
        color: #0b2a3a;
        background: linear-gradient(100deg, rgba(14, 116, 144, .18), rgba(109, 40, 217, .16));
        box-shadow: inset 0 0 0 1px rgba(14, 116, 144, .35);
    }
    html[data-theme="light"] .segmented__opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(14, 116, 144, .28); }
    html[data-theme="light"] .amount-field__input {
        background: rgba(14, 116, 144, .06) !important;
        border-color: rgba(14, 116, 144, .3) !important;
    }
    html[data-theme="light"] .amount-field__input:focus { border-color: rgba(14, 116, 144, .6) !important; }
    html[data-theme="light"] .dropzone { background: rgba(255, 255, 255, .7); }
    html[data-theme="light"] .dropzone:hover { border-color: rgba(14, 116, 144, .45); background: rgba(14, 116, 144, .05); }
    html[data-theme="light"] .dropzone.has-file { border-color: rgba(4, 120, 87, .5); background: rgba(4, 120, 87, .07); }
    html[data-theme="light"] .form-error,
    html[data-theme="light"] .field-error { color: #be123c; }
    html[data-theme="light"] input.is-invalid,
    html[data-theme="light"] select.is-invalid,
    html[data-theme="light"] textarea.is-invalid { border-color: rgba(190, 18, 60, .5); box-shadow: 0 0 0 3px rgba(190, 18, 60, .12); }

    /* Modal */
    html[data-theme="light"] .modal__scrim { background: rgba(11, 23, 48, .45); }
    html[data-theme="light"] .modal__panel {
        background: linear-gradient(170deg, #ffffff, #f7faff);
        box-shadow: 0 40px 80px -40px rgba(16, 32, 74, .5), 0 0 0 1px rgba(14, 116, 144, .08), inset 0 1px 0 #ffffff;
    }

    /* Toasts & flash */
    html[data-theme="light"] .toast { background: rgba(255, 255, 255, .98); box-shadow: 0 20px 40px -22px rgba(16, 32, 74, .45); }
    html[data-theme="light"] .flash { background: rgba(255, 255, 255, .8); }
    html[data-theme="light"] .flash--success { background: rgba(4, 120, 87, .08); }
    html[data-theme="light"] .flash--error { background: rgba(190, 18, 60, .08); }
    html[data-theme="light"] .flash--info { background: rgba(14, 116, 144, .07); }

    /* Empty states, pagination, chips & misc */
    html[data-theme="light"] .empty__ico { background: rgba(255, 255, 255, .8); }
    html[data-theme="light"] .pagination .is-active {
        color: #0b2a3a;
        background: linear-gradient(120deg, rgba(14, 116, 144, .18), rgba(109, 40, 217, .16));
        border-color: rgba(14, 116, 144, .4);
    }
    html[data-theme="light"] .chip { background: rgba(255, 255, 255, .75); }
    html[data-theme="light"] .chip.is-active { color: #0b2a3a; background: rgba(14, 116, 144, .12); }
    html[data-theme="light"] .kv { border-bottom-color: rgba(21, 45, 90, .1); }

    /* Categories */
    html[data-theme="light"] .cat-card { background: rgba(255, 255, 255, .8); }
    html[data-theme="light"] .cat-card:hover { background: #ffffff; }
    html[data-theme="light"] .color-dots input:checked + span { border-color: #0b1730; box-shadow: 0 0 0 3px rgba(14, 116, 144, .25); }

    /* Auth */
    html[data-theme="light"] .auth-hero { background: linear-gradient(160deg, rgba(255, 255, 255, .6), rgba(233, 240, 250, .5)); }
    html[data-theme="light"] .hero-list li { color: var(--muted); }
    html[data-theme="light"] .auth-card { background: #ffffff; }

    /* Drawer & bottom nav */
    html[data-theme="light"] .drawer-scrim { background: rgba(11, 23, 48, .4); }
    html[data-theme="light"] .bottom-nav { background: rgba(255, 255, 255, .94); }
    html[data-theme="light"] .bottom-nav__add {
        border-color: rgba(255, 255, 255, .9);
        box-shadow: 0 14px 28px -10px rgba(14, 116, 144, .6), 0 0 0 5px rgba(255, 255, 255, .95);
    }

    /* Receipt capture */
    html[data-theme="light"] .receipt-capture__dropzone { background: rgba(255, 255, 255, .7); }
    html[data-theme="light"] .receipt-capture__dropzone:hover { border-color: rgba(14, 116, 144, .45); background: rgba(14, 116, 144, .05); }
    html[data-theme="light"] .receipt-capture__dropzone.has-file { border-color: rgba(4, 120, 87, .5); background: rgba(4, 120, 87, .07); }
    html[data-theme="light"] .receipt-capture__preview { background: rgba(255, 255, 255, .8); }
    html[data-theme="light"] .receipt-capture__preview img { background: rgba(21, 45, 90, .05); }
}

/* ---------- Print ---------- */

@media print {
    .sidebar, .topbar, .bottom-nav, .site-foot, .bg-fx, .no-print, .toasts { display: none !important; }
    .shell { margin: 0; }
    body { background: #fff; color: #111; }
    .card { background: #fff; border-color: #ddd; box-shadow: none; backdrop-filter: none; }
    .card::before { display: none; }
    .page { padding: 0; max-width: none; }
}
