/* Daftar — an editorial household ledger.
   Paper and ink, one persimmon accent, hairline rules instead of boxes. */

@font-face { font-family: "Instrument Serif"; src: url(/fonts/instrument-serif.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url(/fonts/instrument-serif-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url(/fonts/instrument-sans.woff2) format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url(/fonts/plex-mono.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url(/fonts/plex-mono-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url(/fonts/vazirmatn.woff2) format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }

/* ============================================================ tokens */
:root {
  color-scheme: light;
  --bg: #f3f0e8;            /* paper */
  --surface-1: #fbfaf6;     /* a fresh sheet: dialogs, focused fields */
  --surface-2: #ece8de;     /* pressed paper: fields, hovers */
  --surface-3: #e5e0d4;
  --line: #ddd7c9;          /* hairline */
  --line-strong: #c9c1b0;
  --grid: #e6e1d5;
  --text-primary: #191815;  /* ink */
  --text-secondary: #4f4b43;
  --text-muted: #8b8579;
  --accent: #d9542b;        /* persimmon */
  --accent-hover: #c2471f;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
  --accent-ink: #fff8f2;
  --good: #3f7a58;
  --good-ink: #2f6a49;
  --good-soft: color-mix(in srgb, var(--good) 12%, transparent);
  --warning: #b7862a;
  --warn-ink: #8f6614;
  --warn-soft: color-mix(in srgb, var(--warning) 14%, transparent);
  --critical: #c23b22;
  --crit-ink: #b0341c;
  --crit-soft: color-mix(in srgb, var(--critical) 11%, transparent);
  --tooltip-bg: #191815;
  --tooltip-ink: #f3f0e8;
  --series-1: #2f4c80;
  --series-2: #d0683b;
  --series-3: #4f8a6d;
  --series-4: #c69a35;
  --series-5: #b25478;
  --series-6: #378892;
  --series-7: #7563a6;
  --series-8: #a3483c;
  --series-9: #6e8a3c;
  --series-10: #8a6a4d;
  --series-11: #647589;
  --series-12: #a77db5;
  --other: #aaa395;
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 8px;
  --shadow: none;
  --shadow-lg: 0 30px 80px -24px rgb(40 30 10 / 30%), 0 2px 8px rgb(40 30 10 / 6%);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.34, 1.36, .64, 1);
  --nav-h: 64px;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font: "Instrument Sans", Vazirmatn, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-fa: Vazirmatn, Tahoma, sans-serif;
  --mono: "Plex Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-family: var(--font);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #13120f;
    --surface-1: #1b1a16;
    --surface-2: #211f1b;
    --surface-3: #2a2722;
    --line: #2c2924;
    --line-strong: #3d3932;
    --grid: #25231f;
    --text-primary: #efeadf;
    --text-secondary: #c0b9aa;
    --text-muted: #8a8477;
    --accent: #f06d43;
    --accent-hover: #f5845e;
    --accent-ink: #1a0d07;
    --good: #6fb48b;
    --good-ink: #82c49c;
    --warning: #ddb057;
    --warn-ink: #e3bd6d;
    --critical: #ef6a4f;
    --crit-ink: #f28468;
    --tooltip-bg: #efeadf;
    --tooltip-ink: #13120f;
    --series-1: #7d9bd6;
    --series-2: #e98a5f;
    --series-3: #78b596;
    --series-4: #dcb65a;
    --series-5: #d57d9e;
    --series-6: #64b3bd;
    --series-7: #a08fd0;
    --series-8: #d0766a;
    --series-9: #9cb768;
    --series-10: #b8957a;
    --series-11: #93a3b8;
    --series-12: #c7a2d4;
    --other: #6f6a60;
    --shadow-lg: 0 30px 80px -24px rgb(0 0 0 / 70%), 0 0 0 1px var(--line);
  }
}

/* ============================================================ base */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text-primary); }
body { min-height: 100dvh; font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent; text-rendering: optimizeLegibility; font-feature-settings: "ss01"; }
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: none; box-shadow: var(--ring); }
h1, h2, h3 { margin: 0; font-weight: 400; }
.num { font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.serif { font-family: var(--serif); font-weight: 400; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.center { text-align: center; }
.spacer { flex: 1; }
.good-text { color: var(--good-ink); }
.bad-text, .neg { color: var(--crit-ink); }
.fa, .fa-inline { font-family: var(--font-fa); unicode-bidi: isolate; }
bdi { unicode-bidi: isolate; }
code { font-family: var(--mono); font-size: 12px; }
.ico { display: inline-grid; place-items: center; flex: none; line-height: 0; }
.err { color: var(--crit-ink); font-size: 13px; }
.err:empty { display: none; }
.eyebrow, .cap { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }

.link { border: 0; background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0 1px; color: var(--text-primary); font-weight: 500; font-size: 13.5px; padding: 1px 0; transition: background-size .35s var(--ease), color .2s; }
.link:hover { background-size: 100% 1px; }

/* ============================================================ shell */
.shell { min-height: 100dvh; }
.content { min-width: 0; }
.sidebar { display: none; }
.only-wide { display: none !important; }
.main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 8px 18px calc(var(--nav-h) + 36px + env(safe-area-inset-bottom)); display: grid; gap: 34px; min-width: 0; }

.topbar { position: sticky; top: 0; z-index: 10; display: grid; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 18px 12px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); }
.tb-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-title { flex: 1; min-width: 0; }
.tb-title h1 { font-family: var(--serif); font-size: 36px; line-height: 1; letter-spacing: -.015em; }
.tb-title p { margin: 6px 0 0; font-size: 13px; color: var(--text-muted); }
.tb-icons { display: flex; gap: 2px; }
.tb-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tb-tools .month-nav { flex: 1; }
.dot-badge { position: absolute; top: 4px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: 500 10px/16px var(--mono); text-align: center; }

.icon-btn { position: relative; border: 0; background: transparent; width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--text-secondary); flex: none; transition: background .2s, color .2s, transform .2s var(--ease); }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text-primary); }
.icon-btn:active:not(:disabled) { transform: scale(.92); }
.icon-btn:disabled { opacity: .3; }
.icon-btn.sm { width: 30px; height: 30px; }

.month-nav { display: inline-flex; align-items: center; gap: 4px; }
.month-nav .icon-btn { width: 34px; height: 34px; border: 1px solid var(--line); }
.month-nav .icon-btn:hover { border-color: var(--line-strong); }
.mn-label { min-width: 150px; text-align: center; font-family: var(--serif); font-size: 22px; line-height: 1; padding: 0 6px; white-space: nowrap; }
.mn-label i { font-style: italic; color: var(--text-muted); }
.mn-today { border: 0; background: none; font: 500 10.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); padding: 6px 4px; }

.bottom-nav { position: fixed; inset: auto 0 0 0; z-index: 20; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); border-top: 1px solid var(--line); }
.bottom-nav button { position: relative; border: 0; background: none; height: 100%; display: grid; place-items: center; align-content: center; gap: 4px; font: 500 9.5px var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); transition: color .2s; }
.bottom-nav button[aria-current="page"] { color: var(--text-primary); }
.bottom-nav .bn-add { width: 50px; height: 50px; justify-self: center; border-radius: 50%; background: var(--text-primary); color: var(--bg); transition: transform .3s var(--spring); }
.bottom-nav .bn-add:active { transform: scale(.9) rotate(90deg); }
.nav-mark { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); pointer-events: none; }
.nav-mark.anim { transition: transform .55s var(--spring); }
.bottom-nav .nav-mark { top: 6px; left: 50%; margin-left: -2.5px; }

@media (min-width: 980px) {
  body { font-size: 14.5px; }
  .shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); }
  .sidebar { display: flex; flex-direction: column; gap: 30px; position: sticky; top: 0; height: 100dvh; padding: 30px 22px 22px 26px; border-right: 1px solid var(--line); }
  .only-mobile, .bottom-nav { display: none !important; }
  .only-wide { display: revert !important; }
  .topbar { position: static; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; max-width: 1240px; margin: 0 auto; padding: 44px 48px 30px; }
  .tb-title h1 { font-size: 52px; }
  .tb-tools { flex-wrap: nowrap; }
  .tb-tools .month-nav { flex: none; }
  .main { padding: 0 48px 72px; gap: 44px; }
}

.brand { display: grid; gap: 4px; padding: 0 2px; }
.brand b { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 34px; line-height: .9; letter-spacing: -.01em; }
.brand small { font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.add-btn { justify-content: flex-start !important; gap: 10px !important; padding: 0 14px !important; height: 42px; }
.add-btn kbd { margin-left: auto; font: 500 10.5px var(--mono); padding: 1px 6px; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--bg) 35%, transparent); opacity: .75; }
.side-nav { position: relative; display: grid; gap: 2px; }
.side-nav button { display: flex; align-items: baseline; gap: 12px; border: 0; background: none; padding: 8px 4px 8px 16px; font-size: 15px; color: var(--text-muted); text-align: left; transition: color .25s; }
.side-nav button .ico { display: none; }
.side-nav button .nav-i { font: 500 10px var(--mono); letter-spacing: .06em; color: var(--text-muted); opacity: .7; width: 16px; }
.side-nav button:hover { color: var(--text-primary); }
.side-nav button[aria-current="page"] { color: var(--text-primary); }
.side-nav button[aria-current="page"] .nav-i { color: var(--accent); opacity: 1; }
.side-nav button { position: relative; }
.side-nav .nav-mark { top: 50%; left: 2px; margin-top: -2.5px; }
.side-nav .count { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font: 500 10.5px/18px var(--mono); text-align: center; align-self: center; }
.side-foot { margin-top: auto; display: grid; gap: 14px; }
.enc-note { display: flex; gap: 8px; align-items: flex-start; font: 400 10.5px/1.5 var(--mono); letter-spacing: .02em; color: var(--text-muted); }
.enc-note .ico { margin-top: 1px; }
.side-lock { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 6px 0; color: var(--text-secondary); font-size: 14px; }
.side-lock:hover { color: var(--text-primary); }

/* ============================================================ sections & primitives */
.card { position: relative; min-width: 0; padding-top: 16px; border-top: 1px solid var(--text-primary); }
.card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; min-height: 28px; flex-wrap: wrap; }
.card-head h3 { font-family: var(--serif); font-size: 26px; line-height: 1.05; letter-spacing: -.01em; }
.card-head .sub { font: 500 10.5px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
.ch-ico { display: none; }
.card-total { font-family: var(--serif); font-size: 24px; line-height: 1; }

.btn { border: 1px solid var(--line-strong); background: transparent; color: var(--text-primary); height: 40px; padding: 0 18px; border-radius: 999px; font-weight: 500; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; transition: background .2s, border-color .2s, color .2s, transform .25s var(--ease); }
.btn:hover:not(:disabled) { border-color: var(--text-primary); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--text-primary); border-color: var(--text-primary); color: var(--bg); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--text-primary) 84%, var(--accent)); border-color: transparent; }
.btn.ghost { border-color: transparent; color: var(--text-secondary); padding: 0 12px; }
.btn.ghost:hover:not(:disabled) { color: var(--text-primary); background: var(--surface-2); border-color: transparent; }
.btn.danger { color: var(--crit-ink); }
.btn.danger.ghost:hover:not(:disabled) { background: var(--crit-soft); color: var(--crit-ink); }
.btn.sm { height: 32px; padding: 0 13px; font-size: 13px; }
.btn.lg { height: 48px; padding: 0 24px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row.center { justify-content: center; }

.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; }
.pill.empty { color: var(--warn-ink); font-style: italic; }
.sw { width: 7px; height: 7px; border-radius: 2px; display: inline-block; flex: none; }
.sw.lg { width: 12px; height: 12px; border-radius: 3px; }
.sw.dash { height: 2px; width: 14px; border-radius: 1px; }
.bar { height: 2px; background: var(--line); overflow: hidden; }
.bar.thin { height: 2px; }
.bar > i { display: block; height: 100%; transform-origin: left center; transition: width .5s var(--ease); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font: 400 11px var(--mono); letter-spacing: .03em; color: var(--text-secondary); margin: -6px 0 14px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-box { position: relative; height: 240px; min-width: 0; }
.chart-box > canvas { max-width: 100%; }
.chart-box.tall { height: 290px; }
.chart-box.sm { height: 200px; }

.empty { text-align: center; padding: 34px 12px; display: grid; gap: 8px; justify-items: center; }
.empty-t { font-family: var(--serif); font-style: italic; font-size: 24px; line-height: 1.15; }
.empty p { margin: 0 0 8px; color: var(--text-muted); max-width: 420px; }
.note { font-size: 13.5px; color: var(--text-secondary); border-left: 2px solid var(--accent); padding: 4px 0 4px 14px; }
.skeleton { color: var(--text-muted); }
.ok-chip, .bad-chip { display: inline-flex; align-items: center; gap: 5px; font: 500 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.ok-chip { color: var(--good-ink); }
.bad-chip { color: var(--crit-ink); }

/* forms */
.field { display: grid; gap: 7px; min-width: 0; }
.field > span:first-child { font: 500 10.5px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
.share-note { font-size: 12.5px; line-height: 1.5; max-width: 56ch; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid transparent; background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; font-size: 15px; outline: none; transition: border-color .2s, background .2s, box-shadow .2s; }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: .75; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--text-primary); background: var(--surface-1); box-shadow: none; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--text-primary); padding: 0; }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
input[type="search"] { -webkit-appearance: none; appearance: none; }
textarea { resize: vertical; font-size: 14px; line-height: 1.55; }
select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8579' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.form { display: grid; gap: 16px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid.c4 { grid-template-columns: 1fr 1fr; }
@media (min-width: 640px) { .form-grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 980px) { input, select, textarea { font-size: 14.5px; } }

.seg { display: inline-flex; gap: 18px; border-bottom: 1px solid var(--line); }
.seg button { position: relative; border: 0; background: none; padding: 8px 0 10px; font-size: 14px; color: var(--text-muted); white-space: nowrap; transition: color .2s; }
.seg button::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1.5px; background: var(--text-primary); transform: scaleX(0); transition: transform .45s var(--ease); }
.seg button[aria-selected="true"] { color: var(--text-primary); }
.seg button[aria-selected="true"]::after { transform: scaleX(1); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 1px 18px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 13px; font-size: 13px; color: var(--text-secondary); transition: border-color .2s, background .2s, color .2s; }
.chip:hover { border-color: var(--line-strong); }
.chip[aria-pressed="true"], .chip.on { background: var(--text-primary); color: var(--bg); border-color: var(--text-primary); }
@media (min-width: 980px) { .chips { margin: 0; padding: 1px; flex-wrap: wrap; } }

/* dialogs */
.dlg-bg { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 55%, rgb(20 16 10 / 45%)); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: grid; align-items: end; justify-items: center; animation: fade .3s ease both; }
.dlg { width: 100%; max-height: 94dvh; display: flex; flex-direction: column; background: var(--surface-1); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); animation: sheet-up .55s var(--ease) both; }
.dlg-bg.closing { animation: fade-out .22s ease both; }
.dlg-bg.closing .dlg { animation: sheet-down .22s ease-in both; }
.dlg-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 20px 4px; }
.dlg-head > div { flex: 1; min-width: 0; }
.dlg-head h2 { font-family: var(--serif); font-size: 30px; line-height: 1.05; letter-spacing: -.01em; }
.dlg-head p { margin: 6px 0 0; font: 400 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.dlg-body { padding: 14px 20px calc(20px + env(safe-area-inset-bottom)); overflow: auto; display: grid; gap: 16px; }
.dlg-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 6px; }
@media (min-width: 700px) {
  .dlg-bg { align-items: center; padding: 24px; }
  .dlg { width: min(580px, 100%); border-radius: 18px; max-height: 90dvh; animation: sheet-in .5s var(--ease) both; }
  .dlg-bg.closing .dlg { animation: sheet-out .2s ease-in both; }
  .dlg.wide { width: min(1040px, 100%); }
  .dlg-head { padding: 28px 30px 4px; }
  .dlg-body { padding: 16px 30px 28px; }
}

#toast { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); max-width: min(440px, calc(100% - 32px)); background: var(--tooltip-bg); color: var(--tooltip-ink); padding: 12px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg); animation: toast-in .5s var(--spring) both; }
@media (min-width: 980px) { #toast { bottom: 32px; left: calc(50% + 118px); } }

/* ============================================================ layout helpers */
.cols { display: grid; gap: 34px; min-width: 0; }
.cols > .col { display: contents; }
.o-1 { order: 1; } .o-2 { order: 2; } .o-3 { order: 3; } .o-4 { order: 4; } .o-5 { order: 5; }
.grid3 { display: grid; gap: 34px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid3 > .card, .row-side > .card { display: flex; flex-direction: column; }
.grid3 > .card > .chart-box.sm, .row-side > .card > .chart-box.sm { flex: 1; min-height: 200px; height: auto; }
.grid2 { display: grid; gap: 34px; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); align-items: start; }
.row-side { display: grid; gap: 34px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1180px) {
  .cols { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; gap: 56px; }
  .cols > .col { display: grid; gap: 44px; min-width: 0; }
  .grid3, .grid2 { gap: 40px; }
  .row-side { grid-template-columns: minmax(0, 1fr) 360px; gap: 56px; }
}

/* ============================================================ overview */
.hero { display: grid; gap: 26px; }
.hero-main { display: grid; gap: 8px; align-content: end; }
.hero-num { font-family: var(--serif); font-size: clamp(64px, 17vw, 128px); line-height: .86; letter-spacing: -.035em; white-space: nowrap; }
.hero-num .cents { font-size: .42em; letter-spacing: -.01em; vertical-align: .95em; margin-left: .04em; color: var(--text-secondary); }
.hero-line { font-size: 15px; color: var(--text-secondary); max-width: 520px; }
.hero-line b { font-weight: 500; color: var(--text-primary); }
.hero-line .up { color: var(--crit-ink); }
.hero-line .down { color: var(--good-ink); }
.hero-side { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.hs { display: grid; gap: 6px; align-content: start; padding: 14px 12px 0 0; min-width: 0; }
.hs + .hs { padding-left: 14px; border-left: 1px solid var(--line); }
.hs .v { font-family: var(--serif); font-size: 28px; line-height: 1; letter-spacing: -.01em; white-space: nowrap; }
.hs .f { font-size: 12.5px; color: var(--text-muted); line-height: 1.35; }
.hs .f .bad-text, .hs .f .good-text { font-weight: 500; }
@media (max-width: 520px) {
  .hero-side { grid-template-columns: 1fr; border-top: 0; }
  .hs, .hs + .hs { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l v" "f v"; padding: 12px 0; border-left: 0; border-top: 1px solid var(--line); gap: 2px 12px; align-items: center; }
  .hs .eyebrow { grid-area: l; } .hs .v { grid-area: v; font-size: 26px; } .hs .f { grid-area: f; }
}
@media (min-width: 1180px) {
  .hero { grid-template-columns: minmax(0, 1fr) 560px; gap: 56px; align-items: end; }
  .hero-side { border-top: 0; }
  .hs { padding-top: 0; }
  .hs + .hs { padding-left: 20px; }
  .hs .v { font-size: 32px; }
}

.bmini-list { display: grid; gap: 20px 40px; }
@media (min-width: 700px) and (max-width: 1179.98px) { .bmini-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bmini { display: grid; gap: 6px; align-content: start; }
.bm-top { display: flex; align-items: baseline; gap: 9px; font-size: 14.5px; }
.bm-top .sw { align-self: center; }
.bm-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-left { font-size: 14px; font-variant-numeric: tabular-nums; }
.bm-left.ok { color: var(--text-primary); }
.bm-left.near { color: var(--warn-ink); }
.bm-left.over { color: var(--crit-ink); }
.bm-left.extra { color: var(--text-muted); font-style: italic; }
.bm-sub { font-size: 12px; color: var(--text-muted); }
.bm-sub .link { font-size: 12px; color: var(--accent); }

.insights { display: grid; margin: 0; padding: 0; list-style: none; counter-reset: ins; }
.insights li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 6px; font-size: 14px; line-height: 1.5; padding: 12px 0; border-top: 1px solid var(--line); color: var(--text-secondary); }
.insights li:first-child { border-top: 0; padding-top: 2px; }
.insights li::before { counter-increment: ins; content: counter(ins, decimal-leading-zero); font: 500 10.5px/2.1 var(--mono); color: var(--text-muted); }
.insights li.t-bad::before { color: var(--crit-ink); }
.insights li.t-warn::before { color: var(--warn-ink); }
.insights li.t-good::before { color: var(--good-ink); }
.ins-ico { display: none; }

.ranked { display: grid; }
.ranked .r { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 6px 12px; padding: 9px 0 10px; font-size: 14px; position: relative; }
.ranked .r-name { grid-column: 1; grid-row: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranked .r-val { grid-column: 2; grid-row: 1; font-variant-numeric: tabular-nums; }
.ranked .meta { font: 400 10.5px var(--mono); color: var(--text-muted); margin-left: 6px; }
.ranked .fa-inline { color: var(--text-muted); font-size: 12.5px; margin-left: 7px; }
.ranked .bar { grid-column: 1 / -1; grid-row: 2; height: 2px; background: var(--line); }
.ranked .bar > i { opacity: .9; }

.sm-input { width: 190px; height: 34px; padding: 6px 12px; font-size: 13.5px; border-radius: 999px; }
.price-wrap { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.price-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 0; align-content: start; border-top: 1px solid var(--line); }
.ps { padding: 10px 0; display: grid; gap: 2px; border-bottom: 1px solid var(--line); }
.ps > span { font: 500 10px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
.ps b { font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
@media (min-width: 900px) { .price-wrap { grid-template-columns: minmax(0, 1fr) 200px; gap: 28px; } .price-stats { grid-template-columns: 1fr; border-top: 0; } .ps:first-child { padding-top: 0; } }

/* ============================================================ purchases */
.act-toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.search { flex: 1 1 280px; position: relative; display: flex; align-items: center; }
.search .ico { position: absolute; left: 0; color: var(--text-muted); pointer-events: none; }
.search input { padding: 10px 0 10px 28px; height: 44px; background: transparent; border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0; font-size: 16px; }
.search input:focus { border-color: var(--text-primary); background: transparent; }
.act-grid { display: grid; gap: 40px; align-items: start; min-width: 0; }
.act-main { display: grid; gap: 26px; min-width: 0; }
.act-side { display: none; }
.act-summary { font: 400 11px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
@media (min-width: 1180px) {
  .act-grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 56px; }
  .act-side { display: grid; gap: 40px; position: sticky; top: 24px; }
  .only-narrow { display: none !important; }
}
.side-total { display: flex; align-items: baseline; justify-content: space-between; margin: -6px 0 16px; }
.side-total .num { font-family: var(--serif); font-size: 40px; line-height: 1; letter-spacing: -.02em; }
.side-total > span:last-child { font: 400 10.5px var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.cat-filter { display: grid; }
.cf-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 5px 10px; align-items: center; border: 0; background: none; padding: 8px 0; text-align: left; font-size: 14px; color: var(--text-secondary); border-top: 1px solid var(--line); transition: color .2s; }
.cf-row:first-child { border-top: 0; }
.cf-row:hover { color: var(--text-primary); }
.cf-row[aria-pressed="true"] { color: var(--text-primary); }
.cf-row[aria-pressed="true"] .cf-name { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.cf-row .cf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-row:not(:has(.sw)) { grid-template-columns: minmax(0, 1fr) auto; }
.cf-row .bar { grid-column: 2 / -1; height: 2px; }

.day { display: grid; gap: 4px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 0 6px; border-bottom: 1px solid var(--text-primary); }
.day-head > :first-child { font-family: var(--serif); font-size: 22px; line-height: 1.1; color: var(--text-primary); }
.day-head > :last-child { font-family: var(--serif); font-size: 18px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.day-items { display: grid; }
.item { position: relative; width: calc(100% + 20px); margin: 0 -10px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "dot main amt" "dot main cat"; gap: 2px 12px; align-items: center; padding: 11px 10px; border: 0; background: none; text-align: left; border-radius: 6px; transition: background .2s; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 10px; right: 10px; border-top: 1px solid var(--line); transition: opacity .2s; }
.item:hover { background: var(--surface-2); }
.item:hover::before, .item:hover + .item::before { opacity: 0; }
.item-dot { grid-area: dot; width: 7px; height: 7px; border-radius: 2px; align-self: start; margin-top: 8px; }
.it-main { grid-area: main; min-width: 0; }
.it-name { display: flex; align-items: baseline; gap: 8px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it-name .qty { font: 500 10.5px var(--mono); color: var(--text-muted); }
.it-sub { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.3em; }
.it-sub .fa { font-size: 13px; }
.it-sub .de { font-style: italic; }
.it-sub .st { color: var(--text-secondary); }
.dotsep { margin: 0 7px; opacity: .6; }
.it-amt { grid-area: amt; justify-self: end; align-self: end; font-size: 15px; font-variant-numeric: tabular-nums; }
.it-amt.neg { color: var(--good-ink); }
.it-cat { grid-area: cat; justify-self: end; align-self: start; font: 400 10.5px var(--mono); letter-spacing: .05em; color: var(--text-muted); }
.it-nocat { color: var(--warn-ink); font-style: italic; }
.rc-tag { color: var(--text-muted); display: inline-flex; align-self: center; }

.rc-list { display: grid; }
.rc-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 16px 0; transition: padding .35s var(--ease); }
.rc-row:first-child { border-top: 1px solid var(--text-primary); }
.rc-row:hover { padding-left: 8px; }
.rc-ico { width: 44px; text-align: left; font: 500 10.5px/1.3 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.rc-ico .ico { display: none; }
.rc-store { font-family: var(--serif); font-size: 22px; line-height: 1.1; }
.rc-meta { font-size: 12.5px; color: var(--text-muted); }
.rc-types { display: none; }
.rc-amt { text-align: right; font-family: var(--serif); font-size: 22px; font-variant-numeric: tabular-nums; }
@media (min-width: 700px) { .rc-row { grid-template-columns: auto minmax(0, 1fr) auto 120px; } .rc-types { display: flex; gap: 10px; } }

/* item dialog extras */
.linked-rc { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: none; padding: 12px 0; text-align: left; font-size: 14px; color: var(--text-secondary); transition: color .2s; }
.linked-rc:hover { color: var(--text-primary); }
.linked-rc > span:nth-child(2) { flex: 1; }
.src-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-muted); }
.src-line code { padding: 2px 0; color: var(--text-secondary); }

/* receipt lines editor */
.lines { container-type: inline-size; display: grid; gap: 10px; }
.lines-body { display: grid; gap: 0; border-top: 1px solid var(--text-primary); }
.line { display: grid; gap: 6px; grid-template-columns: 62px minmax(0, 1fr) minmax(0, 1fr) 30px; grid-template-areas: "name name name x" "fa fa de de" "qty amt type type"; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line > :nth-child(1) { grid-area: name; }
.line > :nth-child(2) { grid-area: fa; }
.line > :nth-child(3) { grid-area: de; }
.line > :nth-child(4) { grid-area: qty; }
.line > :nth-child(5) { grid-area: amt; }
.line > :nth-child(6) { grid-area: type; }
.line > :nth-child(7) { grid-area: x; }
.line .line-src { grid-column: 1 / -1; }
.line input, .line select { padding: 7px 9px; font-size: 14px; border-radius: 6px; }
.line-head { display: none; }
.line-src { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-muted); min-width: 0; }
.line-src code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.learned { display: inline-flex; align-items: center; gap: 4px; font: 500 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--good-ink); flex: none; }
.add-line { justify-self: start; }
@container (min-width: 760px) {
  .line { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.3fr) 58px 88px 126px 30px; grid-template-areas: "name fa de qty amt type x"; padding: 6px 0; align-items: center; }
  .line .line-src { padding: 0 2px 2px; }
  .line-head { display: grid; border: 0; padding: 0 0 6px; font: 500 10px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
  .line-head > span { grid-area: auto !important; }
}
.rc-check { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--text-secondary); }

/* ============================================================ budget */
.plan-start { text-align: center; display: grid; gap: 14px; justify-items: center; padding: 48px 24px; max-width: 720px; justify-self: center; width: 100%; }
.plan-start h2 { font-family: var(--serif); font-size: 40px; line-height: 1.05; }
.plan-start > p { margin: 0; color: var(--text-secondary); max-width: 520px; }
.ps-ico { color: var(--accent); }
.ps-carry { display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 460px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ps-carry > div { padding: 12px 8px; display: grid; gap: 2px; text-align: left; }
.ps-carry > div + div { border-left: 1px solid var(--line); padding-left: 16px; }
.ps-carry span { font: 500 10px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
.ps-carry b { font-family: var(--serif); font-weight: 400; font-size: 26px; font-variant-numeric: tabular-nums; }
.plan-start .note { text-align: left; max-width: 560px; }

.budget-top { display: grid; gap: 26px; }
.to-assign { display: grid; gap: 8px; align-content: end; }
.ta-label { font: 500 10.5px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
.to-assign.pos .ta-label { color: var(--accent); }
.to-assign.neg .ta-label, .to-assign.neg .ta-value { color: var(--crit-ink); }
.to-assign.zero .ta-label { color: var(--good-ink); }
.ta-value { font-family: var(--serif); font-size: clamp(58px, 14vw, 104px); line-height: .88; letter-spacing: -.035em; white-space: nowrap; }
.ta-sub { font-size: 13.5px; color: var(--text-muted); max-width: 440px; }
.ta-sub b { font-weight: 500; color: var(--text-secondary); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.stat { padding: 14px 12px 12px 0; display: grid; gap: 6px; border-top: 0; container-type: inline-size; }
.stat:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--line); }
.stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
.stat .label { font: 500 10.5px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
.stat .value { font-family: var(--serif); font-size: 28px; line-height: 1; white-space: nowrap; }
@container (max-width: 130px) { .stat .value { font-size: 22px; } }
@media (min-width: 1180px) {
  .budget-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 56px; align-items: end; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 0; }
  .stat, .stat:nth-child(even) { padding: 0 12px 0 16px; border-left: 1px solid var(--line); border-top: 0 !important; }
  .stat .value { font-size: 30px; }
}

.btable { container-type: inline-size; }
.brow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "name name left" "carry assign spent"; gap: 8px 10px; padding: 14px 0; border-top: 1px solid var(--line); align-items: center; }
.brow .b-name { grid-area: name; min-width: 0; display: grid; gap: 9px; }
.brow .b-carry { grid-area: carry; }
.brow .b-assign { grid-area: assign; }
.brow .b-avail { display: none; }
.brow .b-spent { grid-area: spent; }
.brow .b-left { grid-area: left; justify-self: end; }
.brow:not(.bgroup) .b-left .cap { display: none; }
.b-cell { display: grid; gap: 3px; font-size: 14px; font-variant-numeric: tabular-nums; min-width: 0; }
.bn-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bn-name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow.bhead { display: none; }
.brow.bgroup { grid-template-areas: "name name left"; padding: 30px 0 10px; border-top: 0; }
.brow.bgroup + .brow { border-top: 1px solid var(--text-primary); }
.brow.bgroup .b-carry, .brow.bgroup .b-assign, .brow.bgroup .b-spent { display: none; }
.brow.bgroup .b-left { font-family: var(--serif); font-size: 20px; color: var(--text-primary); }
.bg-title { font-family: var(--serif); font-size: 26px; line-height: 1.05; }
.bg-hint { font: 400 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin-top: 2px; }
.money-in { text-align: right; padding: 5px 2px; font-size: 15px; border: 0; border-bottom: 1px dashed var(--line-strong); border-radius: 0; height: 32px; background: transparent; font-variant-numeric: tabular-nums; }
.money-in:hover { border-bottom-color: var(--text-muted); background: transparent; }
.money-in:focus { border-bottom: 1px solid var(--accent); background: transparent; }
.money-in.invalid { border-bottom-color: var(--critical); }
.left-pill { display: inline-block; font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }
.left-pill.ok { color: var(--text-primary); }
.left-pill.near { color: var(--warn-ink); }
.left-pill.over { color: var(--crit-ink); }
.left-pill.zero { color: var(--text-muted); }
@container (min-width: 560px) {
  .brow { grid-template-columns: minmax(120px, 1.4fr) repeat(5, minmax(72px, 1fr)); grid-template-areas: none; gap: 12px; padding: 12px 0; }
  .brow > * { grid-area: auto !important; }
  .brow .b-avail { display: grid; }
  .b-cell { justify-items: end; text-align: right; }
  .b-cell .cap { display: none; }
  .brow .b-left { justify-self: stretch; }
  .brow.bhead { display: grid; padding: 0 0 2px; border-top: 0; font: 500 10px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
  .brow.bgroup { padding: 34px 0 10px; }
  .brow.bgroup .b-cell { display: grid; color: var(--text-secondary); }
  .brow.bgroup .b-name { gap: 2px; }
  .money-in { max-width: 110px; justify-self: end; }
}
.elist { display: grid; gap: 4px; container-type: inline-size; }
.erow { display: grid; gap: 10px; align-items: center; padding: 2px 0; }
.erow.c2 { grid-template-columns: minmax(0, 1fr) 110px 28px; }
.erow.c3 { grid-template-columns: minmax(0, 1fr) 92px 92px 28px; }
.erow.ehead { font: 500 10px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.erow.ehead > span:not(:first-child) { text-align: right; padding-right: 2px; }
.erow.c3:has(input[type="checkbox"]) { grid-template-columns: 20px minmax(0, 1fr) 100px 28px; }
.erow input:not([type="checkbox"]) { padding: 6px 2px; font-size: 14.5px; height: 34px; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.erow input:not([type="checkbox"]):hover { border-bottom-color: var(--line-strong); }
.erow input:not([type="checkbox"]):focus { border-bottom-color: var(--accent); }
.erow .money-in { border-bottom-style: dashed; }
@container (max-width: 380px) {
  .erow.c3:not(:has(input[type="checkbox"])) { grid-template-columns: minmax(0, 1fr) 78px 78px 24px; gap: 8px; }
  .erow.c2 { grid-template-columns: minmax(0, 1fr) 100px 24px; gap: 8px; }
}
.elist > .btn { justify-self: start; margin-top: 8px; }
.diff { display: grid; gap: 6px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.diff-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--text-secondary); }
.diff-row b { color: var(--text-primary); font-weight: 400; font-variant-numeric: tabular-nums; }
.diff-row.big { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--text-primary); font-size: 14.5px; }
.diff-row.big b { font-family: var(--serif); font-size: 26px; line-height: 1; }
.diff-row.big.ok, .diff-row.big.ok b { color: var(--good-ink); }
.diff-row.big.ok b { display: inline-flex; align-items: center; gap: 4px; }
.diff-row.big.off, .diff-row.big.off b { color: var(--warn-ink); }
.plan-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.plan-foot .muted { display: inline-flex; align-items: center; gap: 6px; }
@media (min-width: 1180px) and (max-width: 1399.98px) {
  .budget-cols { grid-template-columns: minmax(0, 1fr); }
  .budget-cols > .col:last-child { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto 1fr; align-items: start; gap: 44px 56px; }
  .budget-cols > .col:last-child > :nth-child(1) { grid-column: 1; grid-row: 1; }
  .budget-cols > .col:last-child > :nth-child(2) { grid-column: 2; grid-row: 1 / span 2; }
  .budget-cols > .col:last-child > :nth-child(3) { grid-column: 1; grid-row: 2; }
}
@media (min-width: 1400px) { .budget-cols { grid-template-columns: minmax(0, 1fr) 380px; } }

/* ============================================================ inbox */
.inbox-list { display: grid; gap: 44px; }
.inbox-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-secondary); }
.pending { display: grid; gap: 16px; }
.pending .card-head { margin-bottom: 0; }
.pending-total { font-family: var(--serif); font-size: 30px; line-height: 1; }

/* ============================================================ settings */
.settings-grid { display: grid; gap: 52px; align-items: start; }
@media (min-width: 1100px) {
  .settings-grid { display: block; columns: 2; column-gap: 56px; }
  .settings-grid > .card { break-inside: avoid; margin-bottom: 56px; }
  .settings-grid > .wide { column-span: all; }
}
.settings-grid .card { display: grid; gap: 16px; align-content: start; }
.settings-grid .card > p { margin: 0; color: var(--text-secondary); }
.settings-grid .card-head { margin-bottom: 0; }
.cat-edit { container-type: inline-size; display: grid; gap: 0; }
.ce-row { display: grid; grid-template-columns: 16px minmax(0, 1fr) 104px; grid-template-areas: "sw name btns" ". kind budget" ". desc desc"; gap: 6px 10px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.ce-row > :nth-child(1) { grid-area: sw; }
.ce-row > :nth-child(2) { grid-area: name; }
.ce-row > :nth-child(3) { grid-area: kind; }
.ce-row > :nth-child(4) { grid-area: budget; }
.ce-row > :nth-child(5) { grid-area: desc; }
.ce-row > :nth-child(6) { grid-area: btns; }
.ce-row input, .ce-row select { padding: 7px 10px; font-size: 14px; height: 36px; }
.ce-head { display: none; }
.ce-btns { display: flex; gap: 0; justify-content: flex-end; }
@container (min-width: 760px) {
  .ce-row { grid-template-columns: 16px minmax(110px, 1fr) 180px 110px minmax(160px, 2fr) auto; grid-template-areas: none; padding: 6px 0; }
  .ce-row > * { grid-area: auto !important; }
  .ce-head { display: grid; border-top: 0; font: 500 10px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); padding-bottom: 4px; }
}
.claude-grid { display: grid; gap: 26px; }
.claude-grid > div { display: grid; gap: 14px; align-content: start; }
.claude-grid p { margin: 0; }
@media (min-width: 900px) { .claude-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 40px; } }
.tok-list { display: grid; }
.tok { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.tok:first-child { border-top: 0; }
.tok-ico { color: var(--accent); }
.tok-main { flex: 1; display: grid; min-width: 0; }
.code-row { display: flex; gap: 8px; align-items: center; }
.code-row code { flex: 1; min-width: 0; word-break: break-all; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.notes { display: grid; gap: 8px; }
.note-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.note-row textarea { min-height: 0; font-size: 14px; }
.inline-form { display: flex; gap: 8px; }
.mem { display: grid; max-height: 400px; overflow: auto; }
.mem-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "code x" "names pill"; gap: 3px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.mem-row:first-child { border-top: 0; }
.mem-row code { grid-area: code; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-arrow { display: none; }
.mem-names { grid-area: names; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; min-width: 0; }
.mem-names .de { font-style: italic; color: var(--text-muted); }
.mem-row > .pill, .mem-row > span:empty { grid-area: pill; justify-self: end; }
.mem-row > .icon-btn { grid-area: x; justify-self: end; }
.file-drop { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px; border: 1px dashed var(--line-strong); border-radius: var(--r-md); color: var(--text-secondary); cursor: pointer; transition: border-color .2s, color .2s, background .2s; }
.file-drop:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.file-in { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.kv:first-child { border-top: 0; }
.kv span { color: var(--text-secondary); }
.kv b { font-weight: 500; }
.priv { list-style: none; margin: 0; padding: 0; display: grid; }
.priv li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; font-size: 14px; color: var(--text-secondary); padding: 10px 0; border-top: 1px solid var(--line); }
.priv li:first-child { border-top: 0; }
.priv li .ico { margin-top: 2px; color: var(--accent); }

/* ============================================================ lock screen — a ruled notebook page */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.auth::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, transparent 0 35px, color-mix(in srgb, var(--series-1) 16%, transparent) 35px 36px); mask-image: linear-gradient(to right, #000, #000); -webkit-mask-image: linear-gradient(#000, #000); animation: rules 1.4s var(--ease) both; transform-origin: left; }
.auth::after { content: ""; position: absolute; top: 0; bottom: 0; left: max(28px, calc(50% - 250px)); width: 1px; background: color-mix(in srgb, var(--accent) 55%, transparent); animation: margin-line 1.2s .3s var(--ease) both; transform-origin: top; }
.auth-card { position: relative; z-index: 1; width: min(400px, 100%); display: grid; gap: 6px; }
.auth-logo { display: none; }
.auth h1 { font-family: var(--serif); font-style: italic; font-size: clamp(76px, 22vw, 112px); line-height: .9; letter-spacing: -.03em; display: flex; }
.auth h1 span { display: inline-block; animation: letter .9s var(--ease) both; animation-delay: calc(var(--i) * 70ms + 250ms); }
.auth-t { margin-top: 14px; font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); animation: rise .8s .6s var(--ease) both; }
.auth p { margin: 8px 0 28px; color: var(--text-secondary); font-size: 15px; animation: rise .8s .7s var(--ease) both; }
.auth form { display: grid; gap: 14px; animation: rise .8s .85s var(--ease) both; }
.auth input { padding: 12px 0; font-size: 18px; background: transparent; border: 0; border-bottom: 1px solid var(--text-primary); border-radius: 0; }
.auth input:focus { border-bottom-color: var(--accent); background: transparent; }
.auth .btn.primary { justify-self: start; height: 46px; padding: 0 26px; }
.auth-foot { display: flex; align-items: center; gap: 8px; margin-top: 30px; font: 400 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); animation: rise .8s 1s var(--ease) both; }

/* ============================================================ motion */
@keyframes rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } }
@keyframes rise-next { from { opacity: 0; transform: translateX(32px); filter: blur(4px); } }
@keyframes rise-prev { from { opacity: 0; transform: translateX(-32px); filter: blur(4px); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(26px) scale(.98); } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(12px) scale(.985); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 24px) scale(.96); } }
@keyframes letter { from { opacity: 0; transform: translateY(.45em) rotate(4deg); filter: blur(8px); } }
@keyframes rules { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes margin-line { from { transform: scaleY(0); } }

.enter .rv { animation: rise .85s var(--ease) both; animation-delay: calc(var(--i, 0) * 65ms); }
.enter.dir-next .rv { animation-name: rise-next; }
.enter.dir-prev .rv { animation-name: rise-prev; }
.enter .rv .bar > i { animation: grow 1.2s var(--ease) both; animation-delay: calc(var(--i, 0) * 65ms + 250ms); }
.topbar.enter .tb-title h1 { animation: rise .8s var(--ease) both; }
.mn-label.flip-next { animation: rise-next .55s var(--ease) both; }
.mn-label.flip-prev { animation: rise-prev .55s var(--ease) both; }
.hero-num { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* import dialog */
.check { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 12px; align-items: start; font-size: 14px; line-height: 1.45; color: var(--text-secondary); padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.check input { margin-top: 2px; }
.dlg-body > .stats { margin-bottom: 14px; }

@media (min-width: 1700px) {
  .main, .topbar { max-width: 1400px; }
}

/* ============================================================ recurring */
.warn-text { color: var(--warn-ink); }
.link.accent { color: var(--accent); }
.rec-list { display: grid; container-type: inline-size; }
.rec-row { position: relative; width: calc(100% + 20px); margin: 0 -10px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "dot main amt" "dot main state"; gap: 3px 14px; align-items: center; padding: 12px 10px; border: 0; background: none; text-align: left; border-radius: 6px; transition: background .2s; }
.rec-row + .rec-row::before { content: ""; position: absolute; top: 0; left: 10px; right: 10px; border-top: 1px solid var(--line); transition: opacity .2s; }
.rec-row:hover { background: var(--surface-2); }
.rec-row:hover::before, .rec-row:hover + .rec-row::before { opacity: 0; }
.rec-row > .sw { grid-area: dot; align-self: start; margin-top: 8px; }
.rec-main { grid-area: main; min-width: 0; display: grid; gap: 2px; }
.rec-name { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-name .de { color: var(--text-muted); font-style: italic; margin-left: 8px; }
.rec-sub { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12.5px; color: var(--text-muted); }
.rec-sub .up { color: var(--crit-ink); }
.rec-sub .down { color: var(--good-ink); }
.rec-amt { grid-area: amt; justify-self: end; display: grid; justify-items: end; font-size: 15px; }
.rec-amt small { font: 400 11px var(--mono); color: var(--text-muted); }
.rec-state { grid-area: state; justify-self: end; font: 500 10px var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
.rec-state.ok { color: var(--good-ink); }
.rec-state.warn { color: var(--warn-ink); }
.rec-state.bad { color: var(--crit-ink); }
.rec-row.ended { opacity: .62; }
.rec-row.ended .rec-name { text-decoration: line-through; text-decoration-color: var(--line-strong); }
.rec-list + .btn-row { margin-top: 14px; }
@container (min-width: 560px) {
  .rec-row { grid-template-columns: auto minmax(0, 1fr) 132px 96px; grid-template-areas: "dot main state amt"; }
  .rec-state { justify-self: start; }
}

.attn li { grid-template-columns: 30px minmax(0, 1fr); align-items: baseline; }
.attn li > .link, .attn li > .acts { grid-column: 2; justify-self: start; }
.attn .acts { display: inline-flex; gap: 16px; }
.attn li.t-info::before { color: var(--accent); }
.attn b { font-weight: 500; color: var(--text-primary); }
@media (min-width: 900px) {
  .attn li { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 6px 24px; }
  .attn li > .link, .attn li > .acts { grid-column: 3; justify-self: end; }
}

.aside-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--text-primary); }
.aside-foot > div { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.aside-foot b { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1; }
.aside-foot .good-text { display: inline-flex; align-items: center; gap: 4px; }
.aside-foot + .btn-row, .rec-list + .aside-foot + .btn-row { margin-top: 14px; }

.ranked.rises .r { grid-template-columns: minmax(0, 1fr) auto; }
.ranked .r-foot { grid-column: 1 / -1; grid-row: 2; font: 400 11px var(--mono); color: var(--text-muted); }
.ranked.rises .r + .r { border-top: 1px solid var(--line); }

.rec-hist { display: grid; gap: 8px; padding: 12px 0 4px; border-top: 1px solid var(--line); }
.rec-periods { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.rec-periods li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; font-size: 13.5px; }
.rec-periods li b { font-weight: 500; text-align: right; }
.goal-preview { color: var(--text-secondary); }
.imp-list { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 4px; color: var(--text-secondary); }

/* goals on budget rows */
.goal-line { display: grid; gap: 5px; width: 100%; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.goal-bar { height: 3px; }
.goal-t { display: flex; flex-wrap: wrap; gap: 1px 12px; font: 400 11px var(--mono); letter-spacing: .02em; color: var(--text-muted); }
.brow .b-name { position: relative; }
.goal-line.empty { position: absolute; top: 0; right: 0; width: auto; height: 20px; align-content: center; }
.goal-add { font: 400 11px var(--mono); color: var(--text-muted); opacity: .0; transition: opacity .2s, color .2s; }
.brow:hover .goal-add, .goal-line:focus-visible .goal-add { opacity: 1; }
.goal-line:hover .goal-add { color: var(--accent); }
@media (hover: none) { .goal-add { opacity: .8; } }
.aside-line { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-muted); }
.aside-line .link { font-size: 12px; color: var(--text-muted); }
.aside-line .link.accent { color: var(--accent); }
.aside-line .good-text { display: inline-flex; align-items: center; gap: 3px; }

/* net worth (overview) */
.nw-top { display: grid; gap: 6px; margin-bottom: 16px; }
.nw-num { font-family: var(--serif); font-size: 48px; line-height: .9; letter-spacing: -.02em; white-space: nowrap; }
.nw-num .cents { font-size: .45em; vertical-align: .85em; color: var(--text-secondary); }
.nw-line { font-size: 13.5px; color: var(--text-muted); }
.nw-line b { font-weight: 500; }
.ins-go { font-size: 13px; color: var(--accent); }
.icon-btn.on { color: var(--text-primary); }
