/* ==========================================================================
   Masroufi design system — mobile first, RTL-safe (logical properties only)
   ========================================================================== */

/* ---------- Fonts (self-hosted) ---------- */
@font-face { font-family: "Plex Arabic"; src: url("../fonts/plex-arabic-arabic-400.woff2") format("woff2"); font-weight: 400; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/plex-arabic-arabic-500.woff2") format("woff2"); font-weight: 500; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/plex-arabic-arabic-700.woff2") format("woff2"); font-weight: 700; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/plex-arabic-latin-400.woff2") format("woff2"); font-weight: 400; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/plex-arabic-latin-500.woff2") format("woff2"); font-weight: 500; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/plex-arabic-latin-700.woff2") format("woff2"); font-weight: 700; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2212; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --font: "Plex Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-num: "Inter", "Plex Arabic", system-ui, sans-serif;

  --brand: #0F766E;
  --brand-strong: #115E59;
  --brand-soft: #D5F5EF;
  --brand-ink: #FFFFFF;
  --accent: #F59E0B;
  --hero-1: #0F766E;
  --hero-2: #0B4F4A;

  --income: #15803D;
  --income-soft: #DCFCE7;
  --expense: #B92D35;
  --expense-vis: #EF5A60;
  --expense-soft: #FFE4E6;
  --warn: #B45309;
  --warn-vis: #F59E0B;
  --warn-soft: #FEF3C7;
  --info: #2563EB;

  --bg: #F3F6F5;
  --bg-soft: #E8EEEC;
  --surface: #FFFFFF;
  --surface-2: #F7FAF9;
  --border: #E1E8E6;
  --ink: #0B1A17;
  --ink-2: #3D4D49;
  --muted: #5E6E6A;
  --overlay: rgba(6, 20, 17, .45);

  --shadow-1: 0 1px 2px rgba(12, 30, 26, .06), 0 1px 1px rgba(12, 30, 26, .04);
  --shadow-2: 0 10px 28px -10px rgba(12, 30, 26, .18), 0 2px 6px rgba(12, 30, 26, .05);
  --shadow-3: 0 28px 60px -16px rgba(12, 30, 26, .35);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px;
  --r-sm: 12px; --r: 16px; --r-lg: 24px; --r-full: 999px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 150ms; --t: 250ms; --t-slow: 400ms;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --content-max: 1120px;
}

/* Dark palette: deep green-black surfaces, lifted accents (not an inversion). */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --brand: #2DD4BF; --brand-strong: #5EEAD4; --brand-soft: rgba(45, 212, 191, .14); --brand-ink: #032521;
    --accent: #FBBF24; --hero-1: #0F5C55; --hero-2: #0A2F2B;
    --income: #4ADE80; --income-soft: rgba(74, 222, 128, .13);
    --expense: #FF8589; --expense-vis: #FF6B70; --expense-soft: rgba(255, 107, 112, .14);
    --warn: #FBBF24; --warn-vis: #FBBF24; --warn-soft: rgba(251, 191, 36, .14); --info: #60A5FA;
    --bg: #0A1110; --bg-soft: #101A18; --surface: #121C1A; --surface-2: #17231F; --border: #22312D;
    --ink: #E9F1EF; --ink-2: #BCCAC6; --muted: #8FA29D; --overlay: rgba(0, 0, 0, .6);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, .7); --shadow-3: 0 28px 60px -16px rgba(0, 0, 0, .8);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #2DD4BF; --brand-strong: #5EEAD4; --brand-soft: rgba(45, 212, 191, .14); --brand-ink: #032521;
  --accent: #FBBF24; --hero-1: #0F5C55; --hero-2: #0A2F2B;
  --income: #4ADE80; --income-soft: rgba(74, 222, 128, .13);
  --expense: #FF8589; --expense-vis: #FF6B70; --expense-soft: rgba(255, 107, 112, .14);
  --warn: #FBBF24; --warn-vis: #FBBF24; --warn-soft: rgba(251, 191, 36, .14); --info: #60A5FA;
  --bg: #0A1110; --bg-soft: #101A18; --surface: #121C1A; --surface-2: #17231F; --border: #22312D;
  --ink: #E9F1EF; --ink-2: #BCCAC6; --muted: #8FA29D; --overlay: rgba(0, 0, 0, .6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, .7); --shadow-3: 0 28px 60px -16px rgba(0, 0, 0, .8);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-block-start: 16px; }
body {
  margin: 0; min-block-size: 100dvh; overflow-x: hidden;
  font-family: var(--font); font-size: 1rem; line-height: 1.55; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.75rem); font-weight: 700; line-height: 1.25; }
h2 { font-size: 1.125rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-inline-size: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 8px; inset-block-start: -60px; z-index: 100; padding: 8px 16px; background: var(--brand); color: var(--brand-ink); border-radius: var(--r-sm); }
.skip-link:focus { inset-block-start: 8px; }

.icon { inline-size: 1.25em; block-size: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.tiny { inline-size: .9em; block-size: .9em; display: inline-block; vertical-align: -1px; }
[dir="ltr"] .mirror-ltr { transform: scaleX(-1); }

.money, .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; white-space: nowrap; unicode-bidi: isolate; direction: ltr; }
.money .cur { font-family: var(--font); font-size: .78em; font-weight: 500; opacity: .75; }
.muted { color: var(--muted); }
.income { color: var(--income); }
.expense { color: var(--expense); }
.transfer { color: var(--ink-2); }
.link { color: var(--brand); font-weight: 500; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s2); }
.row { display: flex; align-items: center; gap: var(--s3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.hint { font-size: .85rem; color: var(--muted); }

/* ---------- App shell ---------- */
.app { min-block-size: 100dvh; }
.main {
  inline-size: 100%; max-inline-size: var(--content-max); margin-inline: auto;
  padding: calc(var(--safe-t) + var(--s4)) var(--s4) calc(var(--nav-h) + var(--safe-b) + var(--s7));
  animation: page-in var(--t-slow) var(--ease);
}
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

.page-head { display: flex; align-items: center; gap: var(--s2); min-block-size: 48px; margin-block-end: var(--s4); }
.page-head h1 { flex: 1; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-actions { display: flex; gap: var(--s2); }

.section { margin-block-start: var(--s6); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-block-end: var(--s3); }
.section-title { font-size: 1rem; font-weight: 700; color: var(--ink); }
.section-head a { font-size: .9rem; font-weight: 500; }

/* Sidebar (desktop only) */
.sidebar { display: none; }
.brand { display: flex; align-items: center; gap: var(--s3); font-weight: 700; font-size: 1.2rem; color: var(--ink); padding: var(--s2) var(--s3); }
.brand img { inline-size: 36px; block-size: 36px; border-radius: 10px; }

@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: 264px minmax(0, 1fr); }
  .sidebar {
    display: flex; flex-direction: column; gap: var(--s2); position: sticky; inset-block-start: 0; block-size: 100dvh;
    padding: var(--s5) var(--s4); background: var(--surface); border-inline-end: 1px solid var(--border); overflow-y: auto;
  }
  .side-nav { display: flex; flex-direction: column; gap: 2px; margin-block-start: var(--s4); }
  .side-nav a {
    display: flex; align-items: center; gap: var(--s3); min-block-size: 44px; padding-inline: var(--s3);
    border-radius: var(--r-sm); color: var(--ink-2); font-weight: 500; text-decoration: none;
    transition: background var(--t-fast), color var(--t-fast);
  }
  .side-nav a:hover { background: var(--bg); color: var(--ink); }
  .side-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); }
  :root[data-theme="dark"] .side-nav a[aria-current="page"] { color: var(--brand); }
  .side-add { margin-block-start: var(--s3); }
  .side-foot { margin-block-start: auto; display: flex; flex-direction: column; gap: var(--s2); }
  .main { padding: var(--s7) var(--s7) var(--s8); }
  .bottom-nav { display: none !important; }
  .hide-desktop { display: none !important; }
}
@media (min-width: 1024px) and (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .side-nav a[aria-current="page"] { color: var(--brand); }
}
@media (max-width: 1023.98px) { .hide-mobile { display: none !important; } }

/* Bottom navigation (mobile) */
.bottom-nav {
  position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  block-size: calc(var(--nav-h) + var(--safe-b)); padding-block-end: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-block-start: 1px solid var(--border);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  block-size: var(--nav-h); color: var(--muted); font-size: .72rem; font-weight: 500; text-decoration: none;
  transition: color var(--t-fast);
}
.bottom-nav a .icon { inline-size: 24px; block-size: 24px; transition: transform var(--t) var(--ease); }
.bottom-nav a[aria-current="page"] { color: var(--brand); }
.bottom-nav a[aria-current="page"] .icon { transform: translateY(-2px); }
.nav-fab-slot { display: flex; justify-content: center; block-size: var(--nav-h); }

.fab {
  display: grid; place-items: center; inline-size: 58px; block-size: 58px; border: 0; border-radius: 20px;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong)); color: var(--brand-ink);
  box-shadow: 0 10px 24px -6px color-mix(in srgb, var(--brand) 60%, transparent), var(--shadow-1);
  transform: translateY(-14px); transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast);
}
.fab .icon { inline-size: 28px; block-size: 28px; stroke-width: 2.4; }
.fab:active { transform: translateY(-14px) scale(.92); }
.fab-desktop { display: none; }
@media (min-width: 1024px) {
  .fab-desktop { display: grid; position: fixed; inset-inline-end: 32px; inset-block-end: 32px; z-index: 40; transform: none; }
  .fab-desktop:active { transform: scale(.92); }
}

/* Sync pill */
.sync-pill {
  position: fixed; inset-block-start: calc(var(--safe-t) + 8px); inset-inline-start: 50%; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--r-full);
  background: var(--warn-soft); color: var(--warn); font-size: .8rem; font-weight: 600; box-shadow: var(--shadow-2);
}
[dir="rtl"] .sync-pill { transform: translateX(50%); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-block-size: 48px; padding-inline: var(--s5); border: 1px solid transparent; border-radius: var(--r-sm);
  font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; user-select: none;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--brand) 80%, transparent); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-soft { background: var(--brand-soft); color: var(--brand-strong); }
:root[data-theme="dark"] .btn-soft { color: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--expense-soft); color: var(--expense); }
.btn-sm { min-block-size: 40px; padding-inline: var(--s3); font-size: .9rem; border-radius: 10px; }
.btn-block { inline-size: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; inline-size: 44px; block-size: 44px; flex: none;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-2);
  transition: background var(--t-fast), transform var(--t-fast);
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.filled { background: var(--surface); box-shadow: var(--shadow-1); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--shadow-1); border: 1px solid var(--border); }
.card-tight { padding: var(--s4); }
.card + .card { margin-block-start: var(--s3); }
.card-link { display: block; color: inherit; text-decoration: none; transition: transform var(--t-fast) var(--ease), box-shadow var(--t); }
.card-link:hover { text-decoration: none; box-shadow: var(--shadow-2); }
.card-link:active { transform: scale(.985); }

.hero {
  position: relative; overflow: hidden; border-radius: var(--r-lg); padding: var(--s6) var(--s5); color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, .16), transparent 55%), linear-gradient(150deg, var(--hero-1), var(--hero-2));
  box-shadow: var(--shadow-2);
}
.hero::after { content: ""; position: absolute; inset-inline-end: -40px; inset-block-end: -60px; inline-size: 180px; block-size: 180px; border-radius: 50%; background: rgba(255, 255, 255, .06); }
.hero-label { font-size: .9rem; opacity: .85; }
.hero-amount { font-size: clamp(2rem, 1.5rem + 3vw, 2.75rem); font-weight: 700; line-height: 1.15; margin-block: var(--s1) var(--s4); letter-spacing: -.02em; }
.hero-amount .cur { opacity: .8; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); position: relative; z-index: 1; }
.hero-stat { background: rgba(255, 255, 255, .12); border-radius: var(--r-sm); padding: var(--s2) var(--s3); min-inline-size: 0; container-type: inline-size; }
.hero-stat > span { display: block; font-size: .75rem; opacity: .85; }
.hero-stat strong { display: block; font-size: clamp(.8rem, 14cqi, 1rem); overflow: hidden; text-overflow: ellipsis; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s4); box-shadow: var(--shadow-1); min-inline-size: 0; container-type: inline-size; }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); }
.kpi-value { display: block; margin-block-start: var(--s1); font-size: clamp(.9rem, 11.5cqi, 1.25rem); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: .8rem; color: var(--muted); }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.safe-card { display: flex; align-items: center; gap: var(--s4); }
.safe-card .badge-icon { --c: var(--brand); }
.safe-amount { font-size: 1.5rem; font-weight: 700; }

/* Dashboard grid */
.dash-grid { display: grid; gap: var(--s4); margin-block-start: var(--s4); }
@media (min-width: 1024px) {
  .dash-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
  .dash-grid > .span-2 { grid-column: 1 / -1; }
}

/* ---------- Badges, chips, pills ---------- */
.badge-icon {
  display: grid; place-items: center; flex: none; inline-size: 42px; block-size: 42px; border-radius: 14px;
  color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent);
}
.badge-icon.lg { inline-size: 52px; block-size: 52px; border-radius: 16px; }
.badge-icon.lg .icon { inline-size: 26px; block-size: 26px; }
.badge-icon.sm { inline-size: 32px; block-size: 32px; border-radius: 10px; }
.badge-icon.sm .icon { inline-size: 18px; block-size: 18px; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--r-full); font-size: .78rem; font-weight: 600; background: var(--bg-soft); color: var(--ink-2); }
.pill.ok { background: var(--income-soft); color: var(--income); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.over { background: var(--expense-soft); color: var(--expense); }

.chips { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; padding-block: 2px; margin-inline: calc(var(--s4) * -1); padding-inline: var(--s4); scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-block-size: 40px; padding-inline: 14px;
  border: 1px solid var(--border); border-radius: var(--r-full); background: var(--surface); color: var(--ink-2);
  font-size: .9rem; font-weight: 500; white-space: nowrap; scroll-snap-align: start; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"], .chip.active, .chip:has(input:checked) { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip .dot { inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--c); }

/* Segmented control */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: var(--r-sm); background: var(--bg-soft); }
.seg button, .seg label, .seg a {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-block-size: 40px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font-weight: 600; font-size: .92rem; cursor: pointer; transition: background var(--t), color var(--t), box-shadow var(--t);
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg a:hover { text-decoration: none; }
.seg [aria-pressed="true"], .seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg [data-type="expense"][aria-pressed="true"] { color: var(--expense); }
.seg [data-type="income"][aria-pressed="true"] { color: var(--income); }

/* ---------- Progress ---------- */
.progress { block-size: 8px; border-radius: var(--r-full); background: var(--bg-soft); overflow: hidden; }
.progress > span { display: block; block-size: 100%; border-radius: inherit; background: var(--income); transition: inline-size var(--t-slow) var(--ease); }
.progress.warn > span { background: var(--warn-vis); }
.progress.over > span { background: var(--expense-vis); }
.progress.brand > span { background: var(--brand); }

.ring { position: relative; inline-size: var(--size, 64px); block-size: var(--size, 64px); flex: none; }
.ring svg { inline-size: 100%; block-size: 100%; transform: rotate(-90deg); }
[dir="rtl"] .ring svg { transform: rotate(-90deg) scaleY(-1); }
.ring circle { fill: none; stroke-width: 3.4; }
.ring-track { stroke: var(--bg-soft); }
.ring-value { stroke: var(--c); stroke-linecap: round; transition: stroke-dasharray var(--t-slow) var(--ease); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-num); font-weight: 700; font-size: calc(var(--size, 64px) * .24); }

.budget-row { display: grid; gap: 8px; padding-block: var(--s3); }
.budget-row + .budget-row { border-block-start: 1px solid var(--border); }
.budget-row .row-between { font-size: .92rem; }
.budget-meta { display: flex; justify-content: space-between; gap: var(--s2); font-size: .8rem; color: var(--muted); }

.goal-mini { display: flex; align-items: center; gap: var(--s3); padding-block: var(--s2); color: inherit; text-decoration: none; }
.goal-mini:hover { text-decoration: none; }
.goal-mini + .goal-mini { border-block-start: 1px solid var(--border); }
.goal-mini .grow { flex: 1; min-inline-size: 0; }
.goal-mini strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Insights ---------- */
.insights { display: grid; gap: var(--s2); }
.insight { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); font-size: .93rem; }
.insight .icon { color: var(--brand); margin-block-start: 3px; }
.insight.warn .icon { color: var(--warn); }
.insight.good .icon { color: var(--income); }

/* ---------- Transactions ---------- */
.day + .day { margin-block-start: var(--s4); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding-inline: var(--s1); margin-block-end: var(--s2); }
.day-head h3 { font-size: .85rem; color: var(--muted); font-weight: 600; }
.day-total { font-size: .85rem; font-weight: 600; }
.tx-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--border); box-shadow: var(--shadow-1); overflow: hidden; }
.tx-item { position: relative; }
.tx-item + .tx-item { border-block-start: 1px solid var(--border); }
.tx-swipe-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; padding-inline: var(--s6); background: var(--expense-vis); color: #fff; }
.tx {
  position: relative; display: flex; align-items: center; gap: var(--s3); min-block-size: 64px; padding: var(--s3) var(--s4);
  background: var(--surface); cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  transition: background var(--t-fast), transform var(--t) var(--ease);
}
.tx:hover { background: var(--surface-2); }
.tx.dragging { transition: none; }
.tx.pressing { background: var(--bg-soft); }
.tx-main { flex: 1; min-inline-size: 0; display: flex; flex-direction: column; }
.tx-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-sub { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-amount { font-weight: 700; font-size: .98rem; }
.tx-amount.transfer { color: var(--ink-2); }
.tx-item.removing { animation: row-out var(--t) var(--ease) forwards; }
@keyframes row-out { to { opacity: 0; transform: translateX(-30%); } }
.tx-item.new { animation: row-in var(--t-slow) var(--ease); }
@keyframes row-in { from { background: var(--brand-soft); } }

.toolbar { display: flex; gap: var(--s2); align-items: center; margin-block-end: var(--s3); }
.search { position: relative; flex: 1; }
.search .icon { position: absolute; inset-inline-start: 14px; inset-block-start: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.toolbar .search input { padding-inline-start: 44px; }
.filter-panel { margin-block-end: var(--s4); }
.list-status { text-align: center; padding: var(--s5); color: var(--muted); font-size: .9rem; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-inline-size: 0; }
.field > span { font-size: .88rem; font-weight: 600; color: var(--ink-2); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="datetime-local"],
input[type="search"], input[type="file"], select, textarea {
  inline-size: 100%; min-block-size: 48px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); transition: border-color var(--t-fast), box-shadow var(--t-fast); appearance: none; -webkit-appearance: none;
}
input[type="file"] { padding-block: 10px; }
textarea { min-block-size: 88px; resize: vertical; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7a76' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 14px center; padding-inline-end: 40px;
}
[dir="ltr"] select { background-position: right 14px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
input[dir="ltr"] { text-align: start; }
[dir="rtl"] input[dir="ltr"] { text-align: end; }
.check { display: flex; align-items: center; gap: var(--s3); min-block-size: 44px; cursor: pointer; }
.check input { inline-size: 22px; block-size: 22px; accent-color: var(--brand); flex: none; }
fieldset { border: 0; margin: 0; padding: 0; min-inline-size: 0; }
legend { padding: 0; margin-block-end: var(--s2); font-size: .88rem; font-weight: 600; color: var(--ink-2); }

.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.pick { position: relative; display: grid; place-items: center; block-size: 44px; border-radius: 12px; cursor: pointer; }
.pick input { position: absolute; opacity: 0; }
.pick span { display: grid; place-items: center; inline-size: 100%; block-size: 100%; border-radius: 12px; border: 2px solid transparent; background: var(--surface-2); color: var(--ink-2); transition: border-color var(--t-fast), background var(--t-fast); }
.pick input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.pick input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); }
.swatch span { background: var(--c); }
.swatch input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 3px var(--surface); background: var(--c); }
.icon-picker .picker-grid { max-block-size: 150px; overflow-y: auto; padding: 2px; }

/* ---------- Alerts & toasts ---------- */
.alert { padding: var(--s3) var(--s4); border-radius: var(--r-sm); font-size: .93rem; font-weight: 500; }
.alert-success { background: var(--income-soft); color: var(--income); }
.alert-danger { background: var(--expense-soft); color: var(--expense); }
.alert-warning { background: var(--warn-soft); color: var(--warn); }
.flashes { display: grid; gap: var(--s2); margin-block-end: var(--s4); }

.toasts {
  position: fixed; inset-inline: var(--s4); inset-block-end: calc(var(--nav-h) + var(--safe-b) + var(--s3)); z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: var(--s2); pointer-events: none;
}
@media (min-width: 1024px) { .toasts { inset-block-end: var(--s6); } }
.toast {
  display: flex; align-items: center; gap: var(--s3); max-inline-size: 440px; inline-size: 100%; padding: 10px 10px 10px 16px;
  padding-inline: 16px 10px; border-radius: var(--r); background: var(--ink); color: var(--surface); box-shadow: var(--shadow-3);
  font-size: .92rem; font-weight: 500; pointer-events: auto; animation: toast-in var(--t) var(--ease);
}
.toast.warn { background: var(--warn-vis); color: #1f1300; }
.toast.over { background: var(--expense-vis); color: #fff; }
.toast .grow { flex: 1; min-block-size: 24px; display: flex; align-items: center; }
.toast button { border: 0; background: rgba(255, 255, 255, .14); color: inherit; font-weight: 700; min-block-size: 36px; padding-inline: 14px; border-radius: 10px; }
.toast.leaving { animation: toast-out var(--t) var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px) scale(.96); } }

/* ---------- Bottom sheet (quick add) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 70; background: var(--overlay); opacity: 0; transition: opacity var(--t) var(--ease); }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 80; display: flex; flex-direction: column;
  max-block-size: min(94dvh, 860px); background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-3);
  padding-block-end: var(--safe-b); transform: translateY(105%); transition: transform var(--t-slow) var(--ease); visibility: hidden;
}
.sheet.open { transform: none; visibility: visible; }
@media (min-width: 768px) {
  .sheet { inset-inline: 50% auto; inset-block-end: 24px; inline-size: 460px; border-radius: var(--r-lg); transform: translate(50%, 110%); }
  [dir="ltr"] .sheet { inset-inline: auto; inset-inline-start: 50%; transform: translate(-50%, 110%); }
  .sheet.open { transform: translate(50%, 0); }
  [dir="ltr"] .sheet.open { transform: translate(-50%, 0); }
}
.sheet-grab { inline-size: 40px; block-size: 5px; border-radius: 3px; background: var(--border); margin: 10px auto 2px; flex: none; }
.sheet-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s4); }
.sheet-head .seg { flex: 1; }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--s4) var(--s3); display: flex; flex-direction: column; gap: var(--s3); }
.sheet-foot { padding: var(--s2) var(--s4) var(--s3); border-block-start: 1px solid var(--border); background: var(--surface); }

.amount-display { text-align: center; padding-block: var(--s2); }
.amount-display .expr { min-block-size: 1.3em; font-size: .9rem; color: var(--muted); font-family: var(--font-num); direction: ltr; }
.amount-display .value { font-size: clamp(2.2rem, 8vw, 2.8rem); font-weight: 700; line-height: 1.1; letter-spacing: -.02em; transition: color var(--t); }
.amount-display .value.expense { color: var(--expense); }
.amount-display .value.income { color: var(--income); }
.amount-display.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.sheet-label { font-size: .8rem; font-weight: 600; color: var(--muted); margin-block-end: 6px; }
.cat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 400px) { .cat-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.cat-chip {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; min-block-size: 72px;
  border: 2px solid transparent; border-radius: var(--r); background: transparent; color: var(--ink-2); font-size: .74rem; font-weight: 500;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.cat-chip span:last-child { max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-chip:active { transform: scale(.94); }
.cat-chip[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); color: var(--ink); }
.cat-chip .badge-icon { inline-size: 40px; block-size: 40px; }
.cat-grid.collapsed .cat-chip:nth-child(n + 11) { display: none; }
.more-cats { grid-column: 1 / -1; }

.tpl-chip { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
:root[data-theme="dark"] .tpl-chip { color: var(--brand); }
.tpl-chip .money { font-weight: 700; }

.keypad { direction: ltr; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.key {
  display: grid; place-items: center; block-size: 52px; border: 0; border-radius: 14px; background: var(--surface-2);
  font-family: var(--font-num); font-size: 1.35rem; font-weight: 600; color: var(--ink); user-select: none;
  transition: background var(--t-fast), transform 80ms;
}
.key:active, .key.hit { transform: scale(.94); background: var(--bg-soft); }
.key.op { color: var(--brand); background: var(--brand-soft); }
.key .icon { inline-size: 24px; block-size: 24px; }
.sheet-save { display: flex; gap: var(--s2); }
.sheet-save .btn-primary { flex: 1; min-block-size: 54px; font-size: 1.05rem; border-radius: var(--r); }
.sheet-save .btn-danger { min-block-size: 54px; border-radius: var(--r); }

.sheet-extra { display: grid; gap: var(--s2); }
.sheet-extra input { min-block-size: 44px; }
.date-chips { display: flex; gap: 6px; align-items: center; }
.date-chips input[type="date"] { inline-size: auto; min-block-size: 40px; padding-block: 6px; border-radius: var(--r-full); flex: 1; }
.link-btn { border: 0; background: none; color: var(--brand); font-weight: 600; padding: 6px 0; min-block-size: 44px; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Modal (native dialog) ---------- */
.modal { padding: 0; border: 0; background: transparent; color: var(--ink); inline-size: 100%; max-inline-size: 520px; max-block-size: 100dvh; margin: auto auto 0; }
.modal::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.modal[open] { animation: sheet-up var(--t-slow) var(--ease); }
.modal-card { background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: var(--s4) var(--s5) calc(var(--s5) + var(--safe-b)); max-block-size: 92dvh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-block-end: var(--s3); }
.modal .actions { display: flex; gap: var(--s2); margin-block-start: var(--s2); }
.modal .actions .btn-primary { flex: 1; }
@media (min-width: 768px) {
  .modal { margin: auto; }
  .modal-card { border-radius: var(--r-lg); }
  .modal[open] { animation: pop-in var(--t) var(--ease); }
}
@keyframes sheet-up { from { transform: translateY(40%); opacity: 0; } }
@keyframes pop-in { from { transform: scale(.96); opacity: 0; } }

/* ---------- Lists (settings-like) ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.list > li:first-child, .list > li:first-child > .list-row { border-start-start-radius: var(--r-lg); border-start-end-radius: var(--r-lg); }
.list > li:last-child, .list > li:last-child > .list-row { border-end-start-radius: var(--r-lg); border-end-end-radius: var(--r-lg); }
.row-menu { position: relative; }
.row-menu > summary { list-style: none; display: grid; place-items: center; inline-size: 44px; block-size: 44px; border-radius: var(--r-sm); color: var(--ink-2); cursor: pointer; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu > summary:hover, .row-menu[open] > summary { background: var(--bg-soft); }
.row-menu .menu {
  position: absolute; inset-inline-end: 0; inset-block-start: calc(100% + 4px); z-index: 30; min-inline-size: 200px; padding: 6px;
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-3);
  animation: pop-in var(--t-fast) var(--ease);
}
.menu-item { display: flex; align-items: center; gap: 10px; inline-size: 100%; min-block-size: 44px; padding-inline: 12px; border: 0; border-radius: 10px; background: none; color: var(--ink); font-weight: 500; text-align: start; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--expense); }
.list > li + li { border-block-start: 1px solid var(--border); }
.list-row { display: flex; align-items: center; gap: var(--s3); min-block-size: 60px; padding: var(--s3) var(--s4); color: inherit; text-decoration: none; }
a.list-row:hover { background: var(--surface-2); text-decoration: none; }
.list-row .grow { flex: 1; min-inline-size: 0; }
.list-row .grow strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.list-row .grow small { display: block; color: var(--muted); font-size: .82rem; }
.list-row .end { display: flex; align-items: center; gap: 2px; flex: none; }
.list-row.archived { opacity: .6; }
.list-row.sub { padding-inline-start: calc(var(--s4) + 28px); }

.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.more-tile { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); text-decoration: none; transition: transform var(--t-fast); }
.more-tile:hover { text-decoration: none; box-shadow: var(--shadow-2); }
.more-tile:active { transform: scale(.97); }

/* ---------- Goals ---------- */
.goal-grid { display: grid; gap: var(--s3); }
@media (min-width: 720px) { .goal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .goal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.goal-card { display: flex; flex-direction: column; gap: var(--s3); }
.goal-card-top { display: flex; align-items: center; gap: var(--s3); }
.goal-card-top .grow { flex: 1; min-inline-size: 0; }
.goal-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.goal-stats div { background: var(--surface-2); border-radius: var(--r-sm); padding: var(--s2) var(--s3); min-inline-size: 0; }
.goal-stats div > span { display: block; font-size: .76rem; color: var(--muted); }
.goal-stats strong { display: block; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; }
.goal-hero { display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap; }
.goal-hero .ring { --size: 140px; }

/* ---------- Stats ---------- */
.period-bar { margin-block-end: var(--s4); }
.custom-range { display: flex; gap: var(--s2); margin-block-start: var(--s2); }
.chart-card { position: relative; }
.chart-box { position: relative; block-size: 260px; }
.chart-box.donut { block-size: 240px; max-inline-size: 320px; margin-inline: auto; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center strong { font-size: 1.1rem; }
.legend-list button[disabled] { cursor: default; color: inherit; }
.stats-grid { display: grid; gap: var(--s4); }
@media (min-width: 1024px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stats-grid .span-2 { grid-column: 1 / -1; } }
.legend-list { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; gap: 2px; }
.legend-list button { display: flex; align-items: center; gap: var(--s3); inline-size: 100%; min-block-size: 48px; padding: 6px var(--s2); border: 0; border-radius: var(--r-sm); background: none; text-align: start; }
.legend-list button:hover { background: var(--surface-2); }
.legend-list .grow { flex: 1; min-inline-size: 0; display: flex; flex-direction: column; gap: 4px; }
.legend-list .name { font-weight: 600; font-size: .92rem; }
.legend-list .pct { font-size: .8rem; color: var(--muted); }
.legend-bar { block-size: 5px; border-radius: 3px; background: var(--bg-soft); overflow: hidden; }
.legend-bar span { display: block; block-size: 100%; background: var(--c); border-radius: inherit; }

.rank { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.rank li { display: flex; align-items: center; gap: var(--s3); padding-block: 10px; counter-increment: rank; }
.rank li + li { border-block-start: 1px solid var(--border); }
.rank li::before { content: counter(rank); display: grid; place-items: center; inline-size: 26px; block-size: 26px; border-radius: 8px; background: var(--bg-soft); font-size: .8rem; font-weight: 700; color: var(--muted); font-family: var(--font-num); flex: none; }
.rank .grow { flex: 1; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.heatmap { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.heatmap .hd { font-size: .7rem; color: var(--muted); text-align: center; }
.heat { aspect-ratio: 1; border-radius: 6px; background: var(--bg-soft); display: grid; place-items: center; font-size: .68rem; font-family: var(--font-num); color: var(--ink-2); max-block-size: 48px; }
.heat.l1 { background: color-mix(in srgb, var(--expense-vis) 18%, var(--bg-soft)); }
.heat.l2 { background: color-mix(in srgb, var(--expense-vis) 38%, var(--bg-soft)); }
.heat.l3 { background: color-mix(in srgb, var(--expense-vis) 62%, var(--bg-soft)); color: #fff; }
.heat.l4 { background: var(--expense-vis); color: #fff; }
.heat.out { visibility: hidden; }
.heat.today { outline: 2px solid var(--brand); outline-offset: 1px; }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-block-start: var(--s3); font-size: .75rem; color: var(--muted); }
.heat-legend .heat { inline-size: 14px; block-size: 14px; border-radius: 4px; }

/* ---------- Skeletons ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--bg-soft); border-radius: var(--r-sm); min-block-size: 16px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-chart { block-size: 220px; border-radius: var(--r); }
.sk-line { block-size: 14px; margin-block: 8px; }

/* ---------- Empty states ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s2); padding: var(--s7) var(--s4); }
.empty-art { margin-block-end: var(--s2); }
.empty h3 { font-size: 1.05rem; }
.empty p { color: var(--muted); max-inline-size: 320px; font-size: .92rem; }
.empty .btn { margin-block-start: var(--s3); }
.fill-bg-soft { fill: var(--bg-soft); }
.fill-soft { fill: var(--border); }
.fill-brand { fill: var(--brand); }
.fill-brand-soft { fill: color-mix(in srgb, var(--brand) 35%, var(--surface)); }
.fill-accent { fill: var(--accent); }
.fill-surface { fill: var(--surface); }
.stroke-ink { stroke: var(--ink-2); stroke-width: 4; stroke-linecap: round; fill: none; }
.stroke-surface { stroke: var(--surface); stroke-width: 3; stroke-linecap: round; }

/* ---------- Auth & install ---------- */
.auth-body { display: grid; place-items: center; min-block-size: 100dvh; padding: var(--s4); background:
  radial-gradient(80% 60% at 50% 0%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 70%), var(--bg); }
.auth-card { inline-size: 100%; max-inline-size: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s7) var(--s5); box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: var(--s4); }
.auth-card-wide { max-inline-size: 620px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s2); }
.auth-brand img { border-radius: 16px; box-shadow: var(--shadow-2); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .92rem; }
.checklist .ok span { color: var(--income); font-weight: 700; }
.checklist .fail { color: var(--expense); }
.password-wrap { position: relative; }
.password-wrap input { padding-inline-end: 52px; }
.password-wrap .icon-btn { position: absolute; inset-inline-end: 2px; inset-block-start: 2px; }
.error-page { display: grid; place-items: center; gap: var(--s4); min-block-size: 80dvh; text-align: center; padding: var(--s5); }

/* ---------- Install banner ---------- */
.install-banner { display: flex; align-items: center; gap: var(--s3); }
.install-banner .grow { flex: 1; min-inline-size: 0; }
.install-banner p { font-size: .85rem; color: var(--muted); }

/* ---------- Confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti i { position: absolute; inset-block-start: -12px; inline-size: 9px; block-size: 14px; border-radius: 2px; opacity: .95; animation: confetti-fall var(--d, 2.4s) cubic-bezier(.25, .6, .4, 1) forwards; }
@keyframes confetti-fall { to { transform: translate3d(var(--x, 0), 105vh, 0) rotate(var(--r, 540deg)); opacity: .9; } }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .confetti { display: none; }
}

/* ---------- CSV import preview ---------- */
.preview-table { border-collapse: collapse; font-size: .8rem; inline-size: 100%; }
.preview-table th, .preview-table td { padding: 6px 8px; border: 1px solid var(--border); text-align: start; white-space: nowrap; }
.preview-table th { background: var(--surface-2); }
