/* Fonts for the Aesthetic look (Settings → Style), all SIL Open Font License (fonts/OFL-*.txt). A font is only downloaded once something uses it. */
@font-face { font-family: "Great Vibes"; src: url(fonts/great-vibes-latin.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Fraunces"; src: url(fonts/fraunces-latin.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(fonts/nunito-latin.woff2) format("woff2"); font-weight: 400 800; font-display: swap; }
:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #eaefec;
  --ink: #15211d;
  --ink-2: #4d5a55;
  --muted: #76827d;
  --line: #dce3df;
  --accent: #0f6b5c;
  --accent-soft: #d9ece7;
  --on-accent: #ffffff;
  --good: #1d7f45;
  --warn: #a8670b;
  --danger: #c2412d;
  --danger-soft: #f8e1dc;
  --warn-soft: #f6ead3;
  --side: #12302a;
  --side-ink: #cfe3dc;
  --side-ink-strong: #ffffff;
  --side-hover: #1b4038;
  --grid: #e4e9e6;
  --shadow: 0 1px 2px rgba(21, 33, 29, .06), 0 8px 24px rgba(21, 33, 29, .06);
  --raised: #ffffff;          /* the theme switch's sliding pill */
  --toast-action: #7fe0c8;    /* "Undo" on the toast (toast is dark in light mode) */
  --side-accent: #5fd3b8;     /* the marker on the chosen page in the menu */
  --num: "Bahnschrift", "DIN Alternate", "Segoe UI", sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1412; --surface: #161f1c; --surface-2: #1e2925; --ink: #e8f0ec; --ink-2: #a8b5b0;
    --muted: #7b8883; --line: #2a3632; --accent: #3fb59c; --accent-soft: #173a33; --on-accent: #06201a;
    --good: #4cc27e; --warn: #e0a84a; --danger: #ec7a64; --danger-soft: #3a1f1a; --warn-soft: #362a14;
    --side: #0a1916; --side-ink: #a9c2b9; --side-hover: #12302a; --grid: #24302c;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    --raised: #2d3b36; --toast-action: #0f6b5c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1412; --surface: #161f1c; --surface-2: #1e2925; --ink: #e8f0ec; --ink-2: #a8b5b0;
  --muted: #7b8883; --line: #2a3632; --accent: #3fb59c; --accent-soft: #173a33; --on-accent: #06201a;
  --good: #4cc27e; --warn: #e0a84a; --danger: #ec7a64; --danger-soft: #3a1f1a; --warn-soft: #362a14;
  --side: #0a1916; --side-ink: #a9c2b9; --side-hover: #12302a; --grid: #24302c;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
  --raised: #2d3b36; --toast-action: #0f6b5c;
}

/* ---------- colour themes (Settings → Colour theme). Forest, the original, is the colours above. ----------
   Each theme sets every colour twice: light first, then dark. The dark rules have one more part in
   their selector, so in dark mode they always win over the light ones. */
:root[data-palette="onyx"] {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #ececee;
  --ink: #18181b;
  --ink-2: #52525b;
  --muted: #71717a;
  --line: #e4e4e7;
  --accent: #1c1c1f;
  --accent-soft: #e9e9eb;
  --on-accent: #ffffff;
  --side: #111113;
  --side-ink: #c9c9cf;
  --side-hover: #232327;
  --side-accent: #ffffff;
  --grid: #ececee;
  --raised: #ffffff;
  --toast-action: #d4d4d8;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="onyx"]:not([data-theme="light"]) {
    --bg: #09090b;
    --surface: #131316;
    --surface-2: #232328;
    --ink: #f4f4f5;
    --ink-2: #a1a1aa;
    --muted: #71717a;
    --line: #313137;
    --accent: #f4f4f5;
    --accent-soft: #26262b;
    --on-accent: #09090b;
    --side: #111114;
    --side-ink: #b4b4bc;
    --side-hover: #26262b;
    --side-accent: #ffffff;
    --grid: #26262b;
    --raised: #2a2a2f;
    --toast-action: #18181b;
  }
}
:root[data-palette="onyx"][data-theme="dark"] {
  --bg: #09090b;
  --surface: #131316;
  --surface-2: #232328;
  --ink: #f4f4f5;
  --ink-2: #a1a1aa;
  --muted: #71717a;
  --line: #313137;
  --accent: #f4f4f5;
  --accent-soft: #26262b;
  --on-accent: #09090b;
  --side: #111114;
  --side-ink: #b4b4bc;
  --side-hover: #26262b;
  --side-accent: #ffffff;
  --grid: #26262b;
  --raised: #2a2a2f;
  --toast-action: #18181b;
}
:root[data-palette="navy"] {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #e9eef6;
  --ink: #121a2b;
  --ink-2: #4a5568;
  --muted: #718096;
  --line: #dde3ee;
  --accent: #24448f;
  --accent-soft: #e1e8f7;
  --on-accent: #ffffff;
  --side: #0f1b33;
  --side-ink: #c3cde0;
  --side-hover: #1b2b4d;
  --side-accent: #7da2ff;
  --grid: #e4e9f2;
  --raised: #ffffff;
  --toast-action: #9db8ff;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="navy"]:not([data-theme="light"]) {
    --bg: #0a101c;
    --surface: #111a2b;
    --surface-2: #182338;
    --ink: #e8edf7;
    --ink-2: #a6b1c6;
    --muted: #77839a;
    --line: #22304a;
    --accent: #7da2ff;
    --accent-soft: #18284a;
    --on-accent: #0a1430;
    --side: #070c16;
    --side-ink: #a6b4cf;
    --side-hover: #15213a;
    --side-accent: #7da2ff;
    --grid: #1c2840;
    --raised: #24324d;
    --toast-action: #24448f;
  }
}
:root[data-palette="navy"][data-theme="dark"] {
  --bg: #0a101c;
  --surface: #111a2b;
  --surface-2: #182338;
  --ink: #e8edf7;
  --ink-2: #a6b1c6;
  --muted: #77839a;
  --line: #22304a;
  --accent: #7da2ff;
  --accent-soft: #18284a;
  --on-accent: #0a1430;
  --side: #070c16;
  --side-ink: #a6b4cf;
  --side-hover: #15213a;
  --side-accent: #7da2ff;
  --grid: #1c2840;
  --raised: #24324d;
  --toast-action: #24448f;
}
:root[data-palette="mocha"] {
  --bg: #f6f3ee;
  --surface: #fffdfa;
  --surface-2: #efe9e0;
  --ink: #1f1a14;
  --ink-2: #5a5046;
  --muted: #857a6e;
  --line: #e6ded2;
  --accent: #8a5a2b;
  --accent-soft: #f1e6d6;
  --on-accent: #ffffff;
  --side: #2a1f16;
  --side-ink: #dccdb9;
  --side-hover: #3a2c20;
  --side-accent: #d9a95f;
  --grid: #ece5da;
  --raised: #fffdfa;
  --toast-action: #e2b878;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="mocha"]:not([data-theme="light"]) {
    --bg: #12100d;
    --surface: #1b1814;
    --surface-2: #24201b;
    --ink: #f2ece4;
    --ink-2: #b8ab9b;
    --muted: #8a7f72;
    --line: #2f2a23;
    --accent: #d9a95f;
    --accent-soft: #3a2e1e;
    --on-accent: #1f1608;
    --side: #0d0b09;
    --side-ink: #c4b6a4;
    --side-hover: #2a241d;
    --side-accent: #d9a95f;
    --grid: #29241e;
    --raised: #352e26;
    --toast-action: #8a5a2b;
  }
}
:root[data-palette="mocha"][data-theme="dark"] {
  --bg: #12100d;
  --surface: #1b1814;
  --surface-2: #24201b;
  --ink: #f2ece4;
  --ink-2: #b8ab9b;
  --muted: #8a7f72;
  --line: #2f2a23;
  --accent: #d9a95f;
  --accent-soft: #3a2e1e;
  --on-accent: #1f1608;
  --side: #0d0b09;
  --side-ink: #c4b6a4;
  --side-hover: #2a241d;
  --side-accent: #d9a95f;
  --grid: #29241e;
  --raised: #352e26;
  --toast-action: #8a5a2b;
}

/* Pearl: warm white with charcoal and soft pastels; the Aesthetic look's own theme (any look can use it). */
:root[data-palette="pearl"] {
  --bg: #f7f4f0;
  --surface: #ffffff;
  --surface-2: #f0eff3;
  --ink: #1c1b22;
  --ink-2: #4a4852;
  --muted: #67656f;
  --line: #e7e6ec;
  --accent: #24232c;
  --accent-soft: #efeef6;
  --on-accent: #ffffff;
  --good: #2e7d52;
  --danger: #c2412d;
  --side: #24232c;
  --side-ink: #c9c7d3;
  --side-hover: #34323f;
  --side-accent: #9be3bc;
  --grid: #ecebf0;
  --raised: #ffffff;
  --toast-action: #9be3bc;
  --hero: linear-gradient(135deg, #24232c 0%, #3a3846 100%);
  --wash-1: #f8d9c7;
  --wash-2: #dcd9f6;
  --wash-3: #d5efe1;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="pearl"]:not([data-theme="light"]) {
    --bg: #131218;
    --surface: #1c1b22;
    --surface-2: #26252d;
    --ink: #f2f1f6;
    --ink-2: #c9c7d3;
    --muted: #9896a1;
    --line: #32313a;
    --accent: #f2f1f6;
    --accent-soft: #34323f;
    --on-accent: #1c1b22;
    --good: #7fd3a2;
    --danger: #f08a78;
    --side: #0e0d12;
    --side-ink: #bdbbc6;
    --side-hover: #26252d;
    --side-accent: #9be3bc;
    --grid: #2a2931;
    --raised: #34323f;
    --toast-action: #24232c;
    --hero: linear-gradient(135deg, #2e2d39 0%, #43404f 100%);
    --wash-1: #33232b;
    --wash-2: #22223a;
    --wash-3: #1a2a24;
  }
}
:root[data-palette="pearl"][data-theme="dark"] {
  --bg: #131218;
  --surface: #1c1b22;
  --surface-2: #26252d;
  --ink: #f2f1f6;
  --ink-2: #c9c7d3;
  --muted: #9896a1;
  --line: #32313a;
  --accent: #f2f1f6;
  --accent-soft: #34323f;
  --on-accent: #1c1b22;
  --good: #7fd3a2;
  --danger: #f08a78;
  --side: #0e0d12;
  --side-ink: #bdbbc6;
  --side-hover: #26252d;
  --side-accent: #9be3bc;
  --grid: #2a2931;
  --raised: #34323f;
  --toast-action: #24232c;
  --hero: linear-gradient(135deg, #2e2d39 0%, #43404f 100%);
  --wash-1: #33232b;
  --wash-2: #22223a;
  --wash-3: #1a2a24;
}

/* the colour picker in Settings: a small two-tone circle per theme */
.palettes { display: flex; gap: 8px; flex-wrap: wrap; }
.pal { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); cursor: pointer; font-size: 13.5px; }
.pal i { width: 22px; height: 22px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .35); }
.pal[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); font-weight: 600; }
:root[data-palette="onyx"] .link-btn { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.pal-forest i { background: linear-gradient(135deg, #12302a 50%, #5fd3b8 50%); }
.pal-onyx i { background: linear-gradient(135deg, #09090b 50%, #f4f4f5 50%); }
.pal-navy i { background: linear-gradient(135deg, #0f1b33 50%, #7da2ff 50%); }
.pal-mocha i { background: linear-gradient(135deg, #2a1f16 50%, #d9a95f 50%); }
.pal-pearl i { background: linear-gradient(135deg, #24232c 50%, #f6e4da 50%); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; touch-action: pan-x pan-y; }
/* touch-action: allow scrolling only, so no pinch-zoom and no double-tap zoom */
.phone-only { display: none; } /* stop the whole app rubber-banding on iPhone; content still scrolls */
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
/* Phones and tablets (the PWA and the Android app): a long press on a tab or button selected its text like a web page.
   Turn that off for the app (the page with #root), but keep typing, selecting and pasting in the boxes. */
@media (pointer: coarse) {
  body:has(> #root) { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
  body:has(> #root) :is(input, textarea, select, [contenteditable]) { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- shell ---------- */
/* One row that takes the full height. Without it, the hidden phone + button got its own row, and on short pages
   the leftover height was shared with that row, so the sidebar stopped short of the bottom. */
.app { display: grid; grid-template-columns: 224px 1fr; grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; } /* dvh = visible height on phones */
.side {
  background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; padding: 22px 14px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; color: var(--side-ink-strong); }
.brand-mark { width: 30px; height: 30px; }
.brand-name { font-family: var(--num); font-size: 19px; letter-spacing: .01em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: 0; background: none; color: inherit; cursor: pointer;
  padding: 9px 12px; border-radius: 8px; text-align: left; font-size: 14px;
}
.nav button svg { width: 18px; height: 18px; flex: none; opacity: .8; }
/* Hover looks only with a real mouse: on phones a tap leaves the hover look stuck ("sticky hover"),
   so the tab tapped before stayed lit next to the current one. */
@media (hover: hover) { .nav button:hover { background: var(--side-hover); color: var(--side-ink-strong); } }
.nav button.on { background: var(--side-hover); color: var(--side-ink-strong); box-shadow: inset 3px 0 0 var(--side-accent); }
/* Phone-only controls: hidden on desktop, shown by the phone layout below. */
.nav .more-btn, .fab, .fab-item, .fab-dim { display: none; }
.more-list button { color: var(--ink); }
.more-list button.on { background: var(--surface-2); color: var(--ink); box-shadow: none; }
@media (hover: hover) { .more-list button:hover { background: var(--surface-2); color: var(--ink); box-shadow: none; } }
.side-foot { margin-top: auto; padding: 0 10px; font-size: 12px; line-height: 1.4; }
.side-foot strong { display: block; color: var(--side-ink-strong); font-family: var(--num); font-size: 21px; font-weight: 600; }

.main { overflow-y: auto; }
.page { max-width: 1180px; margin: 0 auto; padding: 28px 36px 60px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head h1 { font-family: var(--num); font-weight: 400; font-size: 30px; line-height: 1.1; margin: 0; }
.head p { margin: 4px 0 0; color: var(--ink-2); }
.head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
@media (hover: hover) { .btn:hover { border-color: var(--muted); } }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
@media (hover: hover) { .btn.primary:hover { filter: brightness(1.08); } }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: none; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 6px; display: inline-grid; place-items: center; }
@media (hover: hover) { .icon-btn:hover { background: var(--surface-2); color: var(--ink); } }
.icon-btn svg { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 8px 10px; min-height: 38px;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.input.amount { font-family: var(--num); font-size: 26px; padding: 6px 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.form-error { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--danger); }
.form-error.ok { color: var(--good); }

/* ---------- sign-in forms: red fields, show/hide password, password rules ---------- */
.field > .field-label { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.input[aria-invalid="true"]:focus { outline-color: var(--danger); }
.field-error { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--danger); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-eye { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); }
.pw-eye svg { width: 18px; height: 18px; }
input::-ms-reveal, input::-ms-clear { display: none; } /* Edge's own eye button: we have ours */
.pw-rules { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.pw-rules li { display: flex; align-items: center; gap: 4px; transition: color .15s; }
.pw-rules svg { width: 14px; height: 14px; opacity: .3; }
.pw-rules li.ok { color: var(--good); }
.pw-rules li.ok svg { opacity: 1; }
.pw-rules li.bad { color: var(--danger); }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { opacity: .6; cursor: default; }
.forgot { align-self: flex-end; font-size: 12.5px; }
/* account card in Settings, and the Sign in / Account button on the home page */
.acct { display: flex; gap: 12px; align-items: center; }
.acct > svg { width: 28px; height: 28px; color: var(--good); flex: none; }
.acct span { display: block; font-size: 12.5px; color: var(--muted); }
.verify { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 10px; }
.head-tools { display: flex; gap: 8px; align-items: center; }
.cloud-btn { border-radius: 999px; }
/* Home: a round Settings button beside the cloud, so Settings is one tap away */
.btn.set-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; flex: none; }
.tools-row { display: flex; gap: 8px; align-items: center; }
.greet-name { display: block; } /* the name on its own line under "Good evening," */
.btn.set-btn svg { width: 19px; height: 19px; }
.cloud-btn.on svg { color: var(--good); }
.cloud-btn.on.warn svg { color: var(--warn); }
.sync-line { font-size: 13px; color: var(--ink-2); }
.have-account { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--ink-2); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: -4px 0 18px; }
.have-account > svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
/* Create a free account (a button) on the left, "Have an account? Sign in" on the right, so they don't look alike */
.have-account { align-items: flex-start; }
.have-account > span { flex: 1; min-width: 0; } /* the words and both links beside the cloud */
.have-account > svg { margin-top: 2px; }
.have-account-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 10px; width: 100%; }
.have-account-links .muted { font-size: 13px; }
.sync-line.ok { color: var(--good); }
.sync-line.bad { color: var(--danger); }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 7px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.seg.type button.on[data-v="expense"] { color: var(--danger); }
.seg.type button.on[data-v="income"] { color: var(--good); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; }
.panel h2 { font-size: 15px; margin: 0 0 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.panel h2 small { font-weight: 400; color: var(--muted); font-size: 13px; }
.cols { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; margin-top: 18px; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.pos { color: var(--good); }
.neg { color: var(--danger); }
.muted { color: var(--muted); }

/* ---------- highlighted amounts (moneyHtml in app.js) ----------
   Digits are the hero: the symbol and cents are smaller and softer.
   Big displays set --minor smaller still. */
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.money .cur, .money .dec { font-size: var(--minor, .8em); opacity: .72; }
.money .cur { margin-right: .2em; font-weight: 500; }
.runway-lead .big, .stat .v, .card .big { --minor: .55em; }
.side-foot strong, .head-total { --minor: .7em; }
.head-total { font-family: var(--num); font-size: 18px; font-weight: 600; color: var(--ink); }
.table td.amt-cell { font-family: var(--num); font-size: 15.5px; font-weight: 600; white-space: nowrap; }

/* ---------- theme switch: Light / Auto / Dark ---------- */
.theme-toggle {
  position: relative; display: inline-grid; grid-template-columns: repeat(3, 38px);
  padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
}
.theme-toggle .thumb {           /* the pill that slides under the chosen button */
  position: absolute; top: 3px; left: 3px; width: 38px; height: calc(100% - 6px);
  border-radius: 999px; background: var(--raised); box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  transform: translateX(calc(var(--i, 1) * 100%)); transition: transform .28s cubic-bezier(.3, .7, .2, 1);
}
.theme-toggle button {
  position: relative; height: 32px; border: 0; background: none; border-radius: 999px;
  color: var(--muted); cursor: pointer; display: grid; place-items: center; transition: color .2s;
}
@media (hover: hover) { .theme-toggle button:hover { color: var(--ink); } }
.theme-toggle button[aria-checked="true"] { color: var(--accent); }
.theme-toggle svg { width: 17px; height: 17px; }
.home-head .head-title { flex: 1 1 auto; min-width: 0; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; }

/* ---------- week runway (dashboard hero) ---------- */
.runway {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 24px 26px 22px; display: grid; grid-template-columns: 300px 1fr; gap: 30px;
}
.runway-lead .label { color: var(--ink-2); font-size: 14px; }
.runway-lead .big { font-family: var(--num); font-size: 60px; font-weight: 600; line-height: 1.05; margin: 6px 0 4px; letter-spacing: -.02em; color: var(--accent); }
.runway-lead .big.over { color: var(--danger); }
.runway-lead .big.zero { color: var(--ink); } /* Rs 0 left today: plain, the red badge tells the rest */
.runway-lead .big-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.over-badge { display: inline-flex; align-items: center; padding: 6px 13px; border-radius: 999px; font-size: 15px; font-weight: 700; font-family: var(--num); white-space: nowrap;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.runway-lead .reset-note { font-size: 12.5px; color: var(--muted); margin: -2px 0 8px; }
.runway-lead .big.plain { color: var(--ink); } /* the week total: white in dark mode, dark in light mode */
/* two smaller numbers under the big one: e.g. "Income today" and "This week" */
.today-pair { display: flex; gap: 10px; margin: 12px 0 14px; }
.mini { flex: 1 1 0; min-width: 0; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.mini > span { display: block; font-size: 12.5px; color: var(--muted); }
.mini b { display: block; font-family: var(--num); font-size: 20px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini b.pos { color: var(--good); }   /* income: green */
.mini b.neg { color: var(--danger); } /* expenses: red */
.runway-lead .link-btn { font-size: 13px; text-align: left; }

.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: end; } /* minmax(0,..): never wider than the card */
.day { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: default; }
.day .col { position: relative; width: 100%; max-width: 64px; height: 150px; border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.day .col .fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); border-radius: 4px 4px 0 0; }
.day .col .fill.over { background: var(--danger); }
.day .col .fill.planned { opacity: .45; } /* expenses already dated on a future day */
/* Onyx: the bars are black or white, the same as a grey line would fade into. Dashes in two colours
   (text colour, then card colour) stay visible on the empty track and on a filled bar. */
/* The day's share: short soft dashes with clear gaps, one colour in every theme. The faint halo keeps it visible on a
   filled bar of a similar colour (Onyx's black bars), without hard black-and-white blocks (the old Onyx line). */
.day .col .allow {
  position: absolute; left: 6px; right: 6px; height: 2px; border-radius: 2px;
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--ink) 62%, transparent) 0 6px, transparent 6px 10px);
  filter: drop-shadow(0 0 1px color-mix(in srgb, var(--surface) 85%, transparent));
}
.day.future .col { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, transparent 6px 10px); outline: 1px solid var(--line); outline-offset: -1px; }
.day.today .col { outline: 2px solid var(--accent); outline-offset: 2px; }
.day .amt { font-family: var(--num); font-size: 14px; font-weight: 600; white-space: nowrap; }
.day .dn { font-size: 12px; color: var(--muted); }
.day.today .dn { color: var(--accent); font-weight: 700; }
.day .share { margin-top: -4px; font-family: var(--num); font-size: 11.5px; color: var(--muted); white-space: nowrap; --minor: .85em; } /* the day's share: what could be spent */
/* the week in one row of small chips */
.runway-note { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }
.chip { background: var(--surface-2); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.chip b { color: var(--ink); font-family: var(--num); font-weight: 600; font-size: 13.5px; }
.chip.neg, .chip.neg b { color: var(--danger); }
.chip.pos, .chip.pos b { color: var(--good); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; container-type: inline-size; }
.stat .k { color: var(--ink-2); font-size: 13px; }
.stat .v { font-family: var(--num); font-size: 30px; font-size: clamp(19px, 18cqi, 30px); font-weight: 600; line-height: 1.25; margin: 2px 0 1px; } /* cqi = % of the card width, so big numbers always fit */
.stat .d { font-size: 12.5px; color: var(--muted); }
/* ---------- Settings: grouped cards with one row per setting (label left, control right), like phone settings ---------- */
.settings { max-width: 760px; }
.set-group { margin-top: 22px; }
.set-group:first-child { margin-top: 4px; }
.set-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 4px 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.set-title .btn { text-transform: none; letter-spacing: 0; }
.set-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.set-card.set-pad { padding: 16px 18px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; min-height: 54px; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row.set-col { flex-direction: column; align-items: stretch; gap: 10px; }
.set-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-label b { font-weight: 500; font-size: 14px; }
.set-label .hint { font-size: 12.5px; }
.set-row > .input, .set-row > select.input { width: min(240px, 55%); flex: none; }
.set-row > .input.set-short { width: 90px; text-align: center; }
.set-ctrl { display: flex; align-items: center; gap: 10px; flex: none; }
.notify-time { width: auto; flex: none; padding: 6px 8px; }
.set-seg { flex: none; }
.set-seg button { padding: 6px 12px; }
.set-foot { margin: 8px 4px 0 !important; }
.set-list { padding: 4px 16px; }
/* Buttons that look like rows: icon, label, chevron */
.set-action { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.set-action:last-child { border-bottom: 0; }
.set-action > span { flex: 1; }
.set-action svg { width: 18px; height: 18px; flex: none; color: var(--ink-2); }
.set-action svg:last-child { width: 16px; height: 16px; color: var(--muted); }
.set-action.danger, .set-action.danger svg { color: var(--danger); }
@media (hover: hover) { .set-action:hover { background: var(--surface-2); } }
/* On/off switch (a styled checkbox: still a real checkbox for keyboards and screen readers) */
input.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 44px; height: 26px; margin: 0; border-radius: 999px; background: var(--line); cursor: pointer; transition: background .18s; }
input.switch::before { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .18s; }
input.switch:checked { background: var(--accent); }
input.switch:checked::before { transform: translateX(18px); }
:root[data-palette="onyx"] input.switch:checked::before { background: var(--on-accent); } /* Onyx dark: white accent, so the knob turns dark */
input.switch:disabled { opacity: .5; cursor: default; }
/* Home page accounts strip (under the number cards). Tiles wrap on wide screens; on phones they scroll sideways. */
.acc-strip { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px 16px; margin-top: 18px; }
.acc-strip h2 { font-size: 15px; margin: 0 0 10px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.acc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.acc-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 12px; padding: 10px 14px; color: var(--ink); }
.acc-name { display: flex; align-items: center; gap: 8px; max-width: 100%; font-size: 13px; color: var(--ink-2); }
.acc-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-bal { font-family: var(--num); font-size: 20px; font-weight: 600; line-height: 1.25; white-space: nowrap; --minor: .6em; }
@media (hover: hover) { .acc-tile:hover { border-color: var(--line); } }

/* ---------- lists ---------- */
.tx-list { display: flex; flex-direction: column; }
.tx-day { font-size: 12.5px; color: var(--muted); padding: 12px 0 4px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
/* Upcoming (dated after today): a soft box above the list, so it reads as "planned", not "done" */
.tx-upcoming { margin: 12px 0 6px; padding: 4px 12px 6px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); }
.tx-up-head { display: flex; align-items: center; gap: 8px; padding: 8px 0 2px; font-size: 13px; }
.tx-up-head svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.tx-up-head .muted { font-size: 12px; }
.tx-up-head .num { margin-left: auto; color: var(--ink-2); font-size: 12.5px; }
.tx-upcoming .tx-day { padding-top: 8px; }
.tx-upcoming .tx:last-child { border-bottom: 0; }
.tx { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.tx:last-child { border-bottom: 0; }
.tx .glyph { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-family: var(--num); font-size: 15px; color: #fff; }
.tx .t1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .t2 { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .amt { font-family: var(--num); font-size: 17px; font-weight: 600; text-align: right; }
.tx .row-actions { display: flex; opacity: 0; transition: opacity .15s; }
.tx-tap { cursor: pointer; border-radius: 8px; transition: background .12s; margin: 0 -8px; padding-left: 8px; padding-right: 8px; } /* a little room so the highlight is not cut at the text */
.tx-tap:active { background: var(--surface-2); }
@media (hover: hover) { .tx-tap:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); } }
.tx:hover .row-actions, .tx:focus-within .row-actions { opacity: 1; }
.tag { display: inline-block; font-size: 11.5px; padding: 0 7px; border-radius: 5px; background: var(--surface-2); color: var(--ink-2); margin-left: 6px; font-weight: 400; vertical-align: 1px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters .input { width: auto; min-width: 140px; }
.filters .search { flex: 1; min-width: 200px; }
/* Desktop: the filters sit in the row as before; the Filters button is only for phones. */
.filter-more { display: contents; }
.filter-toggle { display: none; }
.filter-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; }
.filter-reset { font-size: 13px; }
/* Income · Expenses · Net: three equal columns, small label over the number. The count sits just above the list. */
.summary-bar { display: grid; grid-template-columns: repeat(3, minmax(0, max-content)); gap: 8px 36px; padding: 12px 0 4px; font-size: 12.5px; color: var(--ink-2); }
.summary-bar > span { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; min-width: 0; }
.summary-bar b { font-family: var(--num); font-weight: 600; font-size: 19px; color: var(--ink); white-space: nowrap; }
.tx-count { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.summary-bar b.pos { color: var(--good); } .summary-bar b.neg { color: var(--danger); }

/* ---------- meters ---------- */
.meter { padding: 12px 0; border-bottom: 1px solid var(--line); }
.meter:last-child { border-bottom: 0; }
/* One row: the name shrinks with "…" if needed; the amounts and icons never wrap onto their own line. */
.meter-top { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.meter-top .name { font-weight: 600; display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.meter-top .name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.meter-top .name .tag { flex: none; }
.meter-top .vals { font-family: var(--num); font-size: 15px; font-weight: 600; color: var(--ink); white-space: nowrap; flex: none; }
.meter-actions { display: flex; flex: none; margin: -6px -6px -6px 0; }
.meter-tap { cursor: pointer; border-radius: 8px; margin: 0 -8px; padding-left: 8px; padding-right: 8px; transition: background .12s; }
.meter-tap:active { background: var(--surface-2); }
@media (hover: hover) { .meter-tap:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); } }
.bar { height: 8px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.bar.warn i { background: var(--warn); }
.bar.over i { background: var(--danger); }
.meter-foot { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; }
.status.ok { color: var(--good); } .status.warn { color: var(--warn); } .status.over { color: var(--danger); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* category bars (horizontal) */
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 104px; gap: 10px; align-items: center; font-size: 13.5px; }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.hbar .lbl-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hbar .lbl-txt small { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.hbar .track { height: 14px; }
.hbar .track i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .v { font-family: var(--num); font-size: 14.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.hbar .v small { color: var(--muted); font-size: 11.5px; font-weight: 400; margin-left: 4px; }

/* svg charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--body); }
.chart .baseline { stroke: var(--line); stroke-width: 1; }
.chart .m-in { fill: var(--good); }
.chart .m-out { fill: var(--danger); }
.chart .m-acc { fill: var(--accent); }
.chart .hit { fill: transparent; }
.chart g.grp:hover path { filter: brightness(1.15); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

#tip {
  position: fixed; pointer-events: none; z-index: 100; background: var(--ink); color: var(--bg);
  padding: 7px 10px; border-radius: 8px; font-size: 12.5px; line-height: 1.4; max-width: 240px;
  opacity: 0; transform: translateY(4px); transition: opacity .1s, transform .1s;
}
#tip.show { opacity: 1; transform: none; }
#tip b { font-family: var(--num); font-weight: 400; font-size: 14px; }

/* ---------- cards: goals / accounts ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card h3 { margin: 0; font-size: 15.5px; }
.card .big { font-family: var(--num); font-size: 32px; font-weight: 600; line-height: 1.1; }
.card .meta { font-size: 12.5px; color: var(--muted); }
.card .foot { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.ring { width: 64px; height: 64px; flex: none; }
.ring circle { fill: none; stroke-width: 7; }
.ring .bg { stroke: var(--surface-2); }
.ring .fg { stroke: var(--accent); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring text { font-family: var(--num); font-size: 15px; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12.5px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.r, .table th.r { text-align: right; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 34px 20px; color: var(--ink-2); }
.empty > svg { width: 46px; height: 46px; color: var(--muted); margin-bottom: 8px; } /* only the big picture, not the icon inside its button */
.empty h3 { margin: 0 0 4px; color: var(--ink); font-size: 16px; }
.empty p { margin: 0 0 14px; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8, 16, 13, .45); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .12s; }
.modal { background: var(--surface); border-radius: 16px; width: min(520px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: rise .16s; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 0; }
.modal-head h2 { margin: 0; font-size: 18px; font-family: var(--num); font-weight: 400; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; }
.modal-foot .left { margin-right: auto; }
.check-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check-row input { margin-top: 3px; flex: none; }
.check-row > span { display: flex; flex-direction: column; gap: 2px; }
.neg-warn { margin-bottom: 14px; }
.neg-warn .alert-actions { margin: 8px 0 6px; }
/* "You're signed in" screen after signing in or creating an account */
.done-panel { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 6px 0 2px; }
.done-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.done-icon svg { width: 28px; height: 28px; stroke-width: 2.5; }
.done-panel h3 { margin: 0; font-size: 18px; }
.done-email { margin: 0; color: var(--ink-2); font-weight: 600; word-break: break-all; }
.done-sync { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); text-align: left; font-size: 13px; }
.done-sync svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 18px; padding: 4px 11px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
/* Chips under the weekly chart: the form-chip rule above centres its parts, which put the bold number and the
   words at different heights. Line them up on the text baseline instead. */
.runway-note .chip { align-items: baseline; gap: 5px; cursor: default; }

.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; animation: rise .16s; }
.toast button { background: none; border: 0; color: var(--toast-action); font-weight: 700; cursor: pointer; padding: 0; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-top: 18px; }
.alert.over { background: var(--danger-soft); color: var(--danger); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert b { color: inherit; }
.alert.backup { background: var(--accent-soft); color: var(--ink); align-items: center; flex-wrap: wrap; }
.alert.backup > svg { color: var(--accent); }
.alert.backup > div:first-of-type { flex: 1; min-width: 220px; }
.alert-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* onboarding */
.welcome { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 30px; background: var(--side); }
.welcome .modal { animation: none; width: min(560px, 100%); }
.welcome h1 { font-family: var(--num); font-weight: 400; font-size: 30px; margin: 0 0 4px; }
.free-badge { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 18px; padding: 10px 14px; border-radius: 12px;
  background: var(--accent-soft); color: var(--ink-2); font-size: 13px; }
.free-badge svg { width: 18px; height: 18px; color: var(--accent); stroke-width: 2.6; flex: none; }
.free-badge b { color: var(--accent); font-family: var(--num); font-size: 16px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.welcome .brand-mark { width: 44px; height: 44px; flex: none; }
.welcome-inner { width: min(560px, 100%); }
.welcome .welcome-inner .modal { width: 100%; }
.welcome-credit { text-align: center; color: var(--side-ink); opacity: .7; font-size: 12.5px; margin: 14px 0 0; }

/* credit + about */
.side-foot .credit { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 11.5px; opacity: .65; }
.about {
  margin-top: 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 22px; border-radius: 14px; background: var(--side); color: var(--side-ink);
}
.about .brand-mark { width: 44px; height: 44px; flex: none; }
.about-text { display: flex; flex-direction: column; line-height: 1.3; }
.about-text strong { font-family: var(--num); font-weight: 400; font-size: 19px; color: var(--side-ink-strong); }
.about-text span, .about-credit span { font-size: 12.5px; opacity: .75; }
.about-credit { margin-left: auto; text-align: right; display: flex; flex-direction: column; line-height: 1.45; }
.about-credit b { color: var(--side-ink-strong); font-weight: 600; }

.list-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--ink); }

@media (max-width: 1100px) {
  .runway { grid-template-columns: minmax(0, 1fr); }
  .cols, .stats { grid-template-columns: 1fr 1fr; }
  .cols3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 64px 1fr; }
  .brand-name, .nav span, .side-foot { display: none; }
  .page { padding: 20px 16px 50px; }
  .cols, .stats, .grid2 { grid-template-columns: 1fr; }
}

/* Phones turned sideways (wide but short, e.g. 844 x 390): a slim icon rail instead of the sidebar, a compact
   header, and the "left to spend" number beside the week's bars, so the main things fit without scrolling.
   Space is kept for the notch / camera cut-out on the left or right (safe-area). */
@media (max-height: 500px) and (orientation: landscape) and (min-width: 641px) {
  .app { grid-template-columns: calc(60px + env(safe-area-inset-left)) 1fr; }
  .side { padding: 10px 8px 10px calc(8px + env(safe-area-inset-left)); overflow-y: auto; scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .brand { padding: 0 0 8px; justify-content: center; }
  .brand-mark { width: 26px; height: 26px; }
  .brand-name, .nav span, .side-foot { display: none; }
  .nav button { justify-content: center; padding: 8px 0; }
  .page { padding: 14px calc(20px + env(safe-area-inset-right)) 40px 20px; }
  .head { margin-bottom: 12px; gap: 10px; }
  .head h1 { font-size: 22px; }
  .head p { font-size: 13px; margin-top: 2px; }
  .cloud-btn { width: 40px; height: 40px; padding: 0; justify-content: center; } /* icon only, as in portrait */
  .cloud-btn span { display: none; }
  .runway { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 20px; padding: 16px 18px 14px; }
  .runway-lead .big { font-size: 42px; }
  .today-pair { gap: 8px; }
  .day .col { height: 92px; }
  .runway-note { padding-top: 10px; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
  .stat { padding: 12px 14px; }
  .cols { grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
  .acc-strip { margin-top: 12px; }
  .modal { max-height: calc(100vh - 16px); }
  .overlay { padding: 8px; }
}

/* Splash: brand screen while the app starts. Always the dark brand green, in light and dark mode. */
.splash {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) 24px calc(env(safe-area-inset-bottom) + 28px);
  background: #12302a; color: #cfe3dc; text-align: center;
  transition: opacity .4s ease, visibility .4s;
}
.splash.hide { opacity: 0; visibility: hidden; }
.splash-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.splash-logo { width: 84px; height: 84px; animation: splash-in .6s cubic-bezier(.2, .8, .2, 1) both; }
.splash h1 { font-family: var(--num); font-weight: 400; font-size: 34px; color: #fff; margin: 18px 0 4px; animation: splash-in .6s .08s cubic-bezier(.2, .8, .2, 1) both; }
.splash p { margin: 0; font-size: 15px; opacity: .75; animation: splash-in .6s .16s cubic-bezier(.2, .8, .2, 1) both; }
.splash-credit { font-size: 13px; line-height: 1.6; opacity: .8; display: flex; flex-direction: column; animation: splash-in .6s .3s both; }
.splash-credit b { color: #fff; font-weight: 600; }
.splash-credit span { font-size: 11.5px; opacity: .7; }
@keyframes splash-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }

.more-credit { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); text-align: center; font-size: 12px; color: var(--muted); }

/* "Update available" card: top centre, clear of the tab bar, + button and toasts.
   Built from the theme's colours so the text and the Update button stand out in every theme. */
.update-banner {
  position: fixed; z-index: 110; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  display: flex; align-items: center; gap: 12px;
  width: min(440px, calc(100% - 32px));
  padding: 12px 10px 12px 12px; border-radius: 14px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .08); animation: drop .2s;
}
.update-icon { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.update-icon svg { width: 18px; height: 18px; }
.update-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.update-text strong { font-size: 14px; font-weight: 600; }
.update-text span { font-size: 12.5px; color: var(--muted); }
.update-banner .btn.primary { flex: none; padding: 7px 14px; }
.update-banner .icon-btn { flex: none; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -10px); } }

/* ================= Phone layout (written by you in Phase 1) ================= */
@media (max-width: 640px) {
  /* Gap under the tab bar: sits inside the iPhone home-indicator zone (34px) but
     12px clear of the indicator itself, like native iOS tab bars. 16px on phones without one (Android). */
  :root { --bar-gap: max(16px, calc(env(safe-area-inset-bottom) - 12px)); }
  /* Android: env(...) is the whole navigation-button area, so sit fully above it, plus 12px. */
  html.android { --bar-gap: calc(env(safe-area-inset-bottom, 0px) + 12px); }

  /* 1. Two-row grid: content on top, nav bar at the bottom */
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }

  /* 2. Sidebar becomes a bottom tab bar.
        env(safe-area-inset-bottom) = height of the iPhone home-bar area */
  /* Floating bar: lifted off the bottom edge and inset from the sides, so the
     rounded corners of phones like the iPhone 13 Pro never clip the end tabs.
     max(...) = at least 10px, or the home-indicator height if that is bigger. */
  .side {
    grid-row: 2; flex-direction: row;
    margin: 0 12px var(--bar-gap);
    padding: 4px; border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, .14);   /* an edge, so the bar stands out on dark pages */
    box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
  }
  .brand, .side-foot { display: none; }
  .nav .phone-hide { display: none; }   /* (0,2,0) beats ".nav button" (0,1,1) */
  .nav { flex-direction: row; width: 100%; gap: 0; }
  .nav button {
    flex: 1;                            /* every tab gets equal width */
    flex-direction: column; gap: 3px;
    padding: 7px 2px 6px; border-radius: 18px;
    font-size: 11px; justify-content: center;
  }
  .nav span { display: block; }         /* the 820px rule hid labels; bring them back */
  .nav button.on { box-shadow: none; background: var(--side-hover); color: var(--side-accent); }  /* filled pill for the active tab */
  .nav .more-btn { display: flex; }     /* same specificity as the hide rule, comes later, so it wins */
  /* The "More" sheet also uses .nav, so put its items back into a normal vertical list */
  .nav.more-list { flex-direction: column; gap: 2px; }
  .nav.more-list button {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 12px; border-radius: 8px; font-size: 15px; box-shadow: none;
  }
  .nav.more-list button.on { background: var(--surface-2); color: var(--ink); }

  /* 3. Floating "+" button above the tab bar, where the thumb rests */
  .fab {
    display: grid; place-items: center;
    position: fixed; right: 16px;
    bottom: calc(var(--bar-gap) + 78px);  /* sits just above the floating bar */
    width: 58px; height: 58px; border-radius: 50%; border: 0;
    background: var(--accent); color: var(--on-accent);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .25); z-index: 42;
  }
  .fab svg { width: 26px; height: 26px; transition: transform .2s; }
  /* Slides away while scrolling down so it doesn't cover amounts; back on scrolling up (see app.js). */
  .fab { transition: transform .2s, opacity .2s; }
  .fab-wrap.fab-hide .fab { transform: translateY(24px) scale(.6); opacity: 0; pointer-events: none; }
  .fab-wrap.open .fab svg { transform: rotate(45deg); }   /* + turns into × */

  /* The actions that fan out of the + (positions --x/--y are worked out in app.js) */
  .fab-dim { display: block; position: fixed; inset: 0; z-index: 41; background: rgba(8, 16, 13, .5); opacity: 0; pointer-events: none; transition: opacity .18s; }
  .fab-wrap.open .fab-dim { opacity: 1; pointer-events: auto; }
  .fab-item {
    position: fixed; z-index: 42; right: 19px; bottom: calc(var(--bar-gap) + 81px);  /* centred on the + */
    width: 52px; height: 52px; padding: 0; border: 0; background: none; color: var(--ink);
    display: grid; place-items: center;
    opacity: 0; pointer-events: none; transform: translate(0, 0) scale(.3);
    transition: transform .22s cubic-bezier(.3, 1.4, .5, 1), opacity .15s;
  }
  .fab-wrap.open .fab-item { opacity: 1; pointer-events: auto; transform: translate(var(--x), var(--y)) scale(1); transition-delay: calc(var(--i) * 30ms); }
  .fab-ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
    background: var(--raised); color: var(--ink); box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
    border: 1.5px solid var(--line);
    border-color: color-mix(in srgb, currentColor 55%, transparent); }  /* a ring in the button's own colour */
  .fab-ic svg { width: 22px; height: 22px; }
  .fab-item.expense .fab-ic { color: var(--danger); }
  .fab-item.income .fab-ic { color: var(--good); }
  .fab-item:active .fab-ic { transform: scale(.94); }
  .fab-label { position: absolute; top: 100%; margin-top: 4px; left: 50%; transform: translateX(-50%); white-space: nowrap;
    font-size: 11.5px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }

  /* 4. Tighter spacing; extra bottom padding so the + never covers content */
  .page { padding: max(40px, calc(env(safe-area-inset-top) + 16px)) 16px 100px; } /* room below the status bar / notch */
  /* A strip in the page colour behind the phone's status bar (time, battery), so content scrolls
     under it instead of under the icons. Its height is 0 where there is no status bar over the app. */
  body::before {
    content: ''; position: fixed; top: 0; left: 0; right: 0; z-index: 45; pointer-events: none;
    height: env(safe-area-inset-top, 0px); background: var(--bg);
  }
  body:has(.welcome)::before { background: var(--side); } /* the welcome screen has a green background */
  .head h1 { font-size: 24px; }
  .runway { padding: 18px; gap: 18px; }
  .runway-lead .big { font-size: 50px; }
  .days { gap: 6px; }
  .day .amt { font-size: 12.5px; }
  .day .amt .cur, .day .share .cur { display: none; } /* seven columns are too narrow for "Rs 3,067"; the tooltip keeps it */
  .day .col { height: 100px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  /* Transactions totals: 2 x 2 grid, small label above each big number */
  /* Columns as wide as their numbers (a short "Rs 0.00" leaves room for a long Net), spread across the row. */
  .summary-bar { grid-template-columns: repeat(3, auto); justify-content: space-between; gap: 8px; }
  .summary-bar b { font-size: 16px; }
  .stat .v { font-size: 22px; font-size: clamp(19px, 18cqi, 26px); }
  .acc-strip { margin-top: 10px; padding: 12px 14px 14px; }
  /* Two columns; a 3rd, 4th... account goes on the next row, so all can be read without scrolling sideways. */
  .acc-list { grid-template-columns: 1fr 1fr; gap: 8px; }
  .acc-tile { padding: 9px 12px; }
  .acc-bal { font-size: 17px; }
  .home-head .head-title { flex-basis: 0; }            /* share the first row with the switch... */
  .home-head .head-tools { align-self: flex-start; }    /* ...which sits top-right, beside the greeting */
  .cloud-btn { width: 40px; height: 40px; padding: 0; justify-content: center; } /* icon only on phones, as tall as the theme switch */
  /* Home: the round buttons in a row, the light/dark switch under them, so the greeting keeps its room */
  .home-head .head-tools { flex-direction: column; align-items: flex-end; gap: 8px; }
  .cloud-btn span { display: none; }
  /* Toasts sit above the + button instead of covering (and blocking taps on) the tab bar */
  .toast-wrap { bottom: calc(var(--bar-gap) + 146px); width: max-content; max-width: calc(100% - 32px); }
  /* Name and amount on one line, the bar full width under them: long names ("Entertainment") are no longer cut. */
  .hbar { grid-template-columns: 1fr auto; grid-template-areas: "lbl v" "track track"; gap: 4px 10px; }
  .hbar .lbl { grid-area: lbl; }
  .hbar .v { grid-area: v; }
  .hbar .track { grid-area: track; height: 10px; }
  /* One row: search + Filters button. The filters open under it, in two columns. */
  .filters .search { flex: 1 1 0; min-width: 0; }
  .filter-toggle { display: inline-flex; flex: none; }
  .filter-toggle.on { border-color: var(--accent); }
  .filter-more { display: none; }
  .filter-more.open { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 1 1 100%; }
  .filter-more .input { width: 100%; min-width: 0; }
  .filter-more .filter-reset { grid-column: 1 / -1; justify-self: start; }
  /* Narrow screens: tap the row to edit (Delete is in the edit window), so the note gets the full width. */
  .tx .row-actions { display: none; }
  .tx { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .meter-actions { display: none; } /* phones: tap the budget to edit or delete it */
  .panel { overflow-x: auto; }          /* wide tables scroll inside their box, not the page */

  /* 5. Modals become "bottom sheets" that slide up from the bottom like native apps */
  .overlay { place-items: end center; padding: 0; }
  .modal {
    width: 100%; max-height: 92vh;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Exercise 2: 16px stops iPhone zooming into text boxes */
  .input { font-size: 16px; }

  .about-credit { margin-left: 0; text-align: left; flex-basis: 100%; }

  /* Reports period picker: 6 options in a 3 x 2 grid instead of one row wider than the screen */
  .head .seg { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .head .seg button { padding: 7px 4px; }

  /* Scheduled table: drop the Category and Repeats columns; "repeats" moves under the name */
  .rec-table th:nth-child(2), .rec-table td:nth-child(2),
  .rec-table th:nth-child(3), .rec-table td:nth-child(3) { display: none; }
  .phone-only { display: inline; }
  .rec-table th, .rec-table td { padding: 10px 3px; white-space: nowrap; }
  .rec-table td:first-child { white-space: normal; width: 100%; }  /* the name takes the spare width */
  .rec-table .icon-btn { padding: 5px; }
}

/* Exercise 1: touch screens can't hover, so always show edit/delete */
@media (hover: none) {
  /* Phones: tap the row to edit (Delete is in the edit window), so the note gets the full width. */
  .tx .row-actions { display: none; }
  .tx { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .meter-actions { display: none; } /* phones: tap the budget to edit or delete it */
  .shortcuts-hint { display: none; } /* keyboard shortcuts mean nothing without a keyboard */
}

/* ---------- calculator ---------- */
.calc-wrap { position: relative; display: block; }
.calc-wrap > .input { padding-right: 44px; }
.calc-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 8px;
  background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.calc-btn:focus-visible { background: var(--surface-2); color: var(--accent); }
@media (hover: hover) { .calc-btn:hover { background: var(--surface-2); color: var(--accent); } }
.calc-btn svg { width: 18px; height: 18px; }
.calc-ov { position: fixed; inset: 0; z-index: 60; background: rgba(8, 16, 13, .45); display: grid; place-items: center; padding: 16px; animation: fade .12s; }
.calc-pad { width: min(340px, 100%); background: var(--surface); border-radius: 18px; padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: rise .16s; }
.calc-screen { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; text-align: right; margin-bottom: 12px; min-height: 76px; }
.calc-expr { font-family: var(--num); font-size: 28px; line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.calc-res { font-family: var(--num); font-size: 15px; color: var(--accent); min-height: 20px; margin-top: 4px; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-keys button { height: 52px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  font-family: var(--num); font-size: 20px; cursor: pointer; touch-action: manipulation; }
@media (hover: hover) { .calc-keys button:hover { background: var(--surface-2); } }
.calc-keys button:active { transform: scale(.96); }
.calc-keys button.op { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.calc-keys button.eq { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.calc-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.calc-foot .btn { flex: 1; justify-content: center; }
.head p svg { width: 15px; height: 15px; vertical-align: -2px; }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.tool-fields { display: grid; gap: 12px; }
.tool-kind { align-self: start; width: max-content; max-width: 100%; }
.tool-kind + .hint { margin-top: 2px; }
.tool-out { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.tool-out .btn { justify-self: start; margin-top: 4px; }
.tool-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--ink-2); }
.tool-row b { font-family: var(--num); font-weight: 400; color: var(--ink); font-size: 17px; }
.tool-row.strong b { font-size: 24px; color: var(--accent); }
@media (max-width: 640px) {
  .calc-ov { place-items: end center; padding: 0; }
  .calc-pad { width: 100%; border-radius: 18px 18px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .tools { grid-template-columns: 1fr; }
}
.btn.calc-open { padding-left: 11px; padding-right: 11px; }
.btn.calc-open svg { width: 18px; height: 18px; }

/* Calendar page: the month on the left; the picked day and "Coming up" on the right (under it on phones) */
.cal-page { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cal-side { display: grid; gap: 16px; }
@media (max-width: 960px) { .cal-page { grid-template-columns: minmax(0, 1fr); } }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-prev svg { transform: rotate(180deg); }
/* The month and year on one line, in the app's number font: "November 2026" */
.panel .cal-title { margin: 0; display: flex; align-items: baseline; justify-content: center; gap: 8px; line-height: 1.2; }
.cal-mname { font-family: var(--num); font-weight: 600; font-size: 22px; color: var(--ink); }
.cal-year { font-family: var(--num); font-weight: 400; font-size: 22px; color: var(--muted); }
.cal-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.cal-sum-box { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; min-width: 0; }
.cal-sum-box span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.cal-sum-box b { font-family: var(--num); font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-names, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-names { margin: 18px 0 6px; text-align: center; font-family: var(--num); font-size: 14px; font-weight: 700; color: var(--ink); }
.cal-day { display: grid; justify-items: center; align-content: start; gap: 1px; padding: 6px 0 4px; min-height: 58px; border: 1px solid transparent; border-radius: 10px;
  background: none; color: var(--ink); font: inherit; cursor: pointer; min-width: 0; }
.cal-day:hover { background: var(--surface-2); }
.cal-day b { font-family: var(--num); font-weight: 400; font-size: 16px; }
.cal-day small { font-size: 10.5px; color: var(--danger); font-family: var(--num); white-space: nowrap; line-height: 14px; }
.cal-day.none small { color: var(--good); }
.cal-day.future { color: var(--muted); }
.cal-day.under { background: color-mix(in srgb, var(--good) 13%, transparent); }
.cal-day.over { background: color-mix(in srgb, var(--danger) 15%, transparent); }
.cal-day.today { border-color: var(--accent); }
.cal-day.today b { color: var(--accent); }
.cal-day.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.cal-day.on b, .cal-day.on small { color: var(--on-accent); }
.cal-marks { display: flex; gap: 3px; height: 6px; }
/* Marks: bills orange, income green, goal dates the theme colour */
.mk { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex: none; }
.mk.bill { background: var(--warn); }
.mk.income { background: var(--good); }
.mk.goal { background: var(--accent); border-radius: 1px; transform: rotate(45deg) scale(.9); }
.mk.remind { background: none; box-shadow: inset 0 0 0 1.6px var(--ink-2); } /* a ring: the person's own reminders */
.cal-day.on .mk { box-shadow: 0 0 0 1.5px var(--on-accent); }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.cal-key { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; background: none; color: var(--ink-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.cal-key.off { opacity: .45; text-decoration: line-through; }
.cal-key-note { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw.under { background: color-mix(in srgb, var(--good) 30%, transparent); }
.sw.over { background: color-mix(in srgb, var(--danger) 32%, transparent); margin-left: 4px; }
/* A planned item (scheduled payment, goal date) on the picked day or in "Coming up" */
.cal-ev { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.cal-ev:last-of-type { border-bottom: 0; }
.cal-ev-date { flex: none; min-width: 70px; white-space: nowrap; font-size: 12.5px; color: var(--muted); }
.cal-ev-name { flex: 1; min-width: 0; display: grid; overflow: hidden; }
.cal-ev-name small { font-size: 12px; color: var(--muted); }
.cal-ev-amt { flex: none; font-family: var(--num); white-space: nowrap; }
.cal-ev-amt.pos { color: var(--good); }
.cal-none { margin: 4px 0 12px; }
/* A future day the expected balance is below zero: red number and a red line under it */
.cal-day.short b { color: var(--danger); }
.cal-day.short::after { content: ""; width: 16px; height: 2px; border-radius: 2px; background: var(--danger); }
.cal-day.short.on b { color: var(--on-accent); }
/* Above the month: days to payday, and a warning if money may run short */
.cal-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cal-pay, .cal-warn { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; font: inherit; text-align: left; cursor: pointer; }
.cal-pay { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.cal-pay-n { flex: none; display: grid; justify-items: center; min-width: 54px; padding: 6px 8px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.cal-pay-n b { font-family: var(--num); font-size: 26px; font-weight: 600; line-height: 1.05; }
.cal-pay-text, .cal-warn span { display: grid; gap: 3px; min-width: 0; }
.cal-pay-text small, .cal-warn small { font-size: 12.5px; color: var(--ink-2); }
.cal-warn { border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-soft); color: var(--ink); }
.cal-warn svg { flex: none; width: 22px; height: 22px; color: var(--danger); }
/* The picked day's expected balance */
.cal-fc { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px; padding: 10px 12px; margin-bottom: 8px; border-radius: 10px; background: var(--surface-2); }
.cal-fc > span { font-size: 13px; color: var(--ink-2); }
.cal-fc > b { font-family: var(--num); font-weight: 500; font-size: 18px; }
.cal-fc .hint { grid-column: 1 / -1; margin: 2px 0 0; }
.cal-adds { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
@media (max-width: 640px) {
  .cal-main { padding: 14px 10px; }
  .cal-head, .cal-sum, .cal-legend { margin-left: 4px; margin-right: 4px; }
  .cal-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-names, .cal-grid { gap: 2px; }
  .cal-day { min-height: 54px; }
}

/* ================= Aesthetic look (Settings → Style) =================
   The same app, softer: handwritten page titles (Great Vibes), serif amounts (Fraunces), a rounded font (Nunito),
   round cards and pill buttons, a faint wash behind everything, a dark "spend today" card, quick-action tiles,
   the week as dots, and Reports without charts. Colours still come from the colour theme (Pearl by default),
   so light/dark and every theme keep working. */
:root[data-style="aesthetic"] {
  --num: "Fraunces", Georgia, "Noto Serif", serif;
  --body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --script: "Great Vibes", "Segoe Script", cursive;
}
/* The wash sits on the page area (.main), which doesn't move while its content scrolls, so nothing is repainted
   on scroll. (A "fixed" body background made Android's WebView repaint the whole screen on every frame.) */
:root[data-style="aesthetic"] .main {
  background:
    radial-gradient(circle at 100% 0%, var(--wash-1, color-mix(in srgb, var(--accent-soft) 80%, transparent)) 0%, transparent 46%),
    radial-gradient(circle at 0% 38%, var(--wash-2, color-mix(in srgb, var(--accent-soft) 60%, transparent)) 0%, transparent 50%),
    radial-gradient(circle at 15% 100%, var(--wash-3, transparent) 0%, transparent 45%),
    var(--bg);
}
[data-style="aesthetic"] .head h1 { font-family: var(--script); font-weight: 400; font-size: 46px; line-height: 1.1; letter-spacing: 0; }
[data-style="aesthetic"] .panel h2, [data-style="aesthetic"] .card h3 { font-family: var(--num); font-weight: 600; font-size: 17px; }
[data-style="aesthetic"] :is(.panel, .stat, .runway, .set-card, .card, .modal, .acc-strip, .alert) { border-radius: 24px; }
[data-style="aesthetic"] :is(.btn, .seg, .seg button, .chip) { border-radius: 999px; }
[data-style="aesthetic"] .btn { padding-left: 16px; padding-right: 16px; }
[data-style="aesthetic"] .btn.primary { font-weight: 700; }
[data-style="aesthetic"] .input:not(textarea) { border-radius: 999px; padding-left: 16px; padding-right: 16px; }
[data-style="aesthetic"] .mini { border-radius: 16px; }

/* ---- The Aesthetic screens (app.js: viewHomeAes, and the Aesthetic parts of Reports, Goals, Settings, the add form) ---- */
.nav .nav-add { display: none; } /* only the phone bar has the + (".nav button" would show it in the computer sidebar) */
/* Aesthetic on a computer: one centred column, like a planner page, instead of a narrow strip on the left */
[data-style="aesthetic"] .page { max-width: 860px; }
.home-aes, .goals-aes { display: grid; gap: 16px; }
[data-style="aesthetic"] .page > :is(.hero, .aes-card, .kept) { margin-bottom: 16px; }
.aes-card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 18px; }
.aes-h { margin: 0 0 12px; font-family: var(--num); font-size: 18px; font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.aes-h .link-btn { font-family: var(--body); font-size: 14px; font-weight: 700; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.round-btn svg { width: 20px; height: 20px; }

/* The dark card: Home "You can spend today", Spending "You spent" */
/* Home: deep blue. Spending (.page > .hero, below): teal to violet */
.hero { display: grid; gap: 4px; padding: 22px 22px 18px; border-radius: 28px; background: linear-gradient(135deg, #12245e 0%, #1f3f9a 55%, #3f62d4 100%); color: #ffffff; box-shadow: 0 14px 30px rgba(31, 63, 154, .3); }
.page > .hero { background: linear-gradient(135deg, #1d5d73 0%, #3d4b9a 55%, #7a4a9e 100%); box-shadow: 0 14px 30px rgba(45, 75, 140, .26); } /* Spending: its own colours */
.hero-k { font-size: 15px; font-weight: 600; color: rgba(255, 255, 255, .78); }
.hero-v { font-family: var(--num); font-size: 50px; font-weight: 600; line-height: 1.05; letter-spacing: -.01em; --minor: .5em; }
.hero-s { font-size: 14px; color: rgba(255, 255, 255, .75); }
.hero-over { color: #ffd3cb; }
.hero-bar { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .14); margin-top: 12px; overflow: hidden; }
.hero-bar i { display: block; height: 100%; border-radius: 99px; background: #9be3bc; }
.hero-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: rgba(255, 255, 255, .75); margin-top: 4px; }
.hero .link-btn { color: #9be3bc; font-weight: 700; text-align: left; }
.hero-p { margin: 6px 0 0; font-size: 15px; line-height: 1.55; color: rgba(255, 255, 255, .82); }
.hero-p b { color: #ffffff; }

/* Home: Expense · Income · Move money */
.qa { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.qa-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px 12px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 700; cursor: pointer; }
.qa-ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; --q: var(--ink); background: color-mix(in srgb, var(--q) 16%, var(--surface)); color: var(--q); }
.qa-tile[data-fab="expense"] { --q: #e0607a; }
.qa-tile[data-fab="income"] { --q: #2e9d6c; }
.qa-tile[data-fab="transfer"] { --q: #7b61d9; }
.qa-tile .qa-ic { --q: inherit; }
.qa-ic svg { width: 20px; height: 20px; stroke-width: 2.4; }

/* Category icons: Professional shows the letter, Aesthetic the icon on a soft tint of the category's colour */
.cat-ic { display: none; }
[data-style="aesthetic"] .glyph { background: color-mix(in srgb, var(--c) 16%, var(--surface)) !important; color: var(--c); border-radius: 50%; }
[data-style="aesthetic"] .glyph .g-l { display: none; }
[data-style="aesthetic"] .glyph .cat-ic { display: block; width: 18px; height: 18px; }

/* The add form: a handwritten title, a big centred amount, round category icons */
[data-style="aesthetic"] .modal-head h2 { font-family: var(--script); font-size: 38px; font-weight: 400; line-height: 1.1; }
[data-style="aesthetic"] .seg.type { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
[data-style="aesthetic"] .field:has(#fAmount) > span { text-align: center; }
[data-style="aesthetic"] #fAmount {
  text-align: center; font-family: var(--num); font-size: 40px; font-weight: 600; height: auto; padding: 6px 44px;
  border: 0; border-bottom: 2px solid var(--line); border-radius: 0; background: transparent; box-shadow: none;
}
/* The add form keeps the same height when switching Expense / Income / Transfer, so it doesn't jump up and down */
[data-style="aesthetic"] .modal:has(#typeSeg) { min-height: min(760px, calc(100vh - 40px)); }
[data-style="aesthetic"] #fCats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 6px; }
[data-style="aesthetic"] #fCats .chip {
  flex-direction: column; justify-content: flex-start; gap: 6px; padding: 0; border: 0; border-radius: 0; background: none;
  font-size: 12px; line-height: 1.2; text-align: center; white-space: normal; min-height: 89px; /* icon + two lines, so rows never change height */
}
[data-style="aesthetic"] #fCats .chip .dot {
  width: 54px; height: 54px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 16%, var(--surface)) !important; color: var(--c); box-shadow: inset 0 0 0 3px transparent;
}
[data-style="aesthetic"] #fCats .chip .dot .cat-ic { display: block; width: 22px; height: 22px; }
[data-style="aesthetic"] #fCats .chip.on { background: none; color: var(--ink); } /* not bold: a wider name could take a new line and make the form jump */
[data-style="aesthetic"] #fCats .chip.on .dot { box-shadow: inset 0 0 0 3px var(--ink); }

/* Spending: period pills and the "You kept" card */
.pills { display: flex; gap: 8px; overflow-x: auto; margin: -6px 0 16px; padding-bottom: 2px; scrollbar-width: none; }
.pills button { flex: none; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; cursor: pointer; }
.pills button.on { background: var(--ink); border-color: var(--ink); color: var(--surface); font-weight: 700; }
.kept { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 24px; background: color-mix(in srgb, var(--good) 16%, var(--surface)); color: var(--ink); }
.kept.neg { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
.kept-ic { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--surface); color: var(--good); display: grid; place-items: center; }
.kept-ic svg { width: 20px; height: 20px; }
.kept.neg .kept-ic { color: var(--danger); }
.kept > span:last-child { display: grid; gap: 2px; }
.kept small { font-size: 13.5px; color: var(--ink-2); }

/* Goals: big cards */
.goal-card { display: grid; gap: 12px; padding: 20px; border-radius: 28px; background: var(--surface); border: 1px solid var(--line); }
.goal-top { display: flex; align-items: center; gap: 12px; }
.goal-ic { width: 46px; height: 46px; flex: none; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--ink); }
.goal-ic svg { width: 20px; height: 20px; }
.goal-name { flex: 1; display: grid; min-width: 0; }
.goal-name b { font-size: 17px; }
.goal-name small { font-size: 13px; color: var(--muted); }
.goal-pct { font-family: var(--num); font-size: 24px; font-weight: 600; }
.goal-bar { height: 14px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.goal-bar i { display: block; height: 100%; border-radius: 99px; background: #7d86e8; }
.goal-card.done .goal-bar i { background: var(--good); }
.goal-amts { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.goal-amts b { font-family: var(--num); font-size: 16px; color: var(--ink); }
.goal-tip { margin: 0; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.goal-tip b { color: var(--ink); }
.goal-btns { display: flex; gap: 8px; align-items: center; }
.goal-btns .btn { height: 46px; }
.goal-btns .btn.primary { flex: 1; }
.goal-new { height: 64px; border-radius: 24px; border: 2px dashed var(--line); background: none; color: var(--ink); font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.goal-new svg { width: 20px; height: 20px; }

/* Settings: Style as two big rows, colour themes as circles */
.look-rows { display: grid; gap: 6px; }
.look-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; border: 0; background: none; color: var(--ink); text-align: left; cursor: pointer; }
.look-row.on { background: var(--accent-soft); }
.look-aa { width: 44px; height: 44px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 17px; font-weight: 700; }
.look-professional .look-aa { background: #eef3f0; color: #0f6b5c; font-family: "Segoe UI", system-ui, sans-serif; }
.look-aesthetic .look-aa { background: #f6e4da; color: #24232c; font-family: "Great Vibes", cursive; font-size: 26px; font-weight: 400; }
.look-txt { flex: 1; display: grid; }
.look-txt small { font-size: 13px; color: var(--muted); }
.look-radio { width: 22px; height: 22px; flex: none; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--line); }
.look-row.on .look-radio { border: 7px solid var(--ink); }
/* "Recommended" next to Professional, on the welcome screen and in Settings */
.rec-badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); font-family: var(--body); font-size: 11px; font-weight: 700; letter-spacing: .02em; vertical-align: 2px; white-space: nowrap; }
.style-card b .rec-badge { margin-left: 0; margin-top: 4px; }
.style-card b { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
[data-style="aesthetic"] .palettes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
[data-style="aesthetic"] .pal { flex-direction: column; gap: 6px; padding: 4px 0; border: 0; background: none; box-shadow: none; font-size: 12.5px; }
[data-style="aesthetic"] .pal i { width: 40px; height: 40px; }
[data-style="aesthetic"] .pal[aria-checked="true"] { box-shadow: none; }
[data-style="aesthetic"] .pal[aria-checked="true"] i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4.5px var(--ink); }

/* Home: the week as dots */
.wdots-wrap { display: flex; flex-direction: column; gap: 12px; align-self: center; min-width: 0; }
.wdots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wdot { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.wdot-c {
  width: 42px; height: 42px; max-width: 100%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2); font-family: var(--num); font-size: 12px; font-weight: 600;
}
.wdot-c svg { width: 18px; height: 18px; }
.wdot.ok .wdot-c { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.wdot.over .wdot-c { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.wdot.today .wdot-c { background: var(--surface); box-shadow: inset 0 0 0 2.5px var(--ink); color: var(--ink); }
.wdot.future .wdot-c, .wdot.off .wdot-c { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.wdot .dn { font-size: 12px; color: var(--muted); }
.wdot.today .dn { color: var(--ink); font-weight: 700; }
.wdots-note { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }

/* Calendar: the month in handwriting, the year small under its end */
[data-style="aesthetic"] .panel .cal-title { display: grid; justify-items: center; gap: 0; line-height: 1; }
[data-style="aesthetic"] .cal-mname { font-family: var(--script); font-weight: 400; font-size: 52px; line-height: 1.05; padding: 0 6px; }
[data-style="aesthetic"] .cal-year { justify-self: end; margin: -8px 4px 0 0; font-size: 14px; letter-spacing: .18em; }

/* Welcome: the two style cards */
.style-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.style-card {
  display: flex; flex-direction: column; gap: 4px; padding: 8px 8px 12px; border: 2px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--ink); text-align: left; cursor: pointer;
}
.style-card.on { border-color: var(--ink); box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.style-card b { font-size: 15px; padding: 0 4px; }
.style-card small { font-size: 12.5px; color: var(--muted); padding: 0 4px; line-height: 1.35; }
.style-prev { display: flex; flex-direction: column; gap: 4px; padding: 12px; margin-bottom: 6px; border-radius: 12px; }
.style-professional .style-prev { background: #eef3f0; color: #16231f; font-family: "Segoe UI", system-ui, sans-serif; }
.style-professional .sp-hi { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: #4d5a55; }
.style-professional .sp-num { font-size: 20px; font-weight: 700; }
.style-professional .sp-row i { width: 9px; height: 18px; border-radius: 3px; background: #0f6b5c; }
.style-aesthetic .style-prev { background: linear-gradient(135deg, #24232c, #3a3846); color: #ffffff; }
.style-aesthetic .sp-hi { font-family: "Great Vibes", cursive; font-size: 22px; line-height: 1; color: #f6e4da; }
.style-aesthetic .sp-num { font-family: "Fraunces", Georgia, serif; font-size: 20px; font-weight: 600; }
.style-aesthetic .sp-row i { width: 12px; height: 12px; border-radius: 50%; background: #9be3bc; }
.sp-row { display: flex; gap: 4px; align-items: flex-end; }

@media (max-width: 640px) {
  [data-style="aesthetic"] .head h1 { font-size: 38px; }
  [data-style="aesthetic"] .home-head .head-tools { align-self: flex-start; }
  /* The bar's order: Home · Calendar · (+) · Spending · Goals; More's pages open from the menu button on Home */
  [data-style="aesthetic"] .nav .more-btn { display: none; }
  [data-style="aesthetic"] .nav [data-nav="dashboard"] { order: 1; }
  [data-style="aesthetic"] .nav [data-nav="calendar"] { order: 2; }
  [data-style="aesthetic"] .nav .nav-add { order: 3; }
  [data-style="aesthetic"] .nav [data-nav="reports"] { order: 4; }
  [data-style="aesthetic"] .nav [data-nav="goals"] { order: 5; }
  .hero-v { font-size: 44px; }
  /* The tab bar: a floating white pill; the page you're on is a dark circle */
  [data-style="aesthetic"] .side { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px; box-shadow: 0 12px 30px rgba(20, 18, 28, .14); }
  [data-style="aesthetic"] .nav button { color: var(--muted); border-radius: 999px; }
  [data-style="aesthetic"] .nav button.on { background: none; color: var(--ink); }
  [data-style="aesthetic"] .nav button.on span { display: none; } /* the dark circle says "you are here" */
  [data-style="aesthetic"] .nav button.on svg { width: 22px; height: 22px; padding: 13px; margin: -6px 0; box-sizing: content-box; border-radius: 50%; background: linear-gradient(135deg, #12245e 0%, #1f3f9a 55%, #3f62d4 100%); color: #ffffff; }
  [data-style="aesthetic"] .nav-add {
    display: grid; place-items: center; flex: 0 0 52px; width: 52px; height: 52px; align-self: center; margin: 0 2px;
    border: 0; border-radius: 50%; background: var(--accent-soft); color: var(--ink); cursor: pointer;
  }
  [data-style="aesthetic"] .nav-add svg { width: 24px; height: 24px; transition: transform .2s; }
  [data-style="aesthetic"] .nav-add.open svg { transform: rotate(45deg); }
  [data-style="aesthetic"] .side { position: relative; z-index: 43; } /* above the dimmed page, so the + still closes the fan */
  [data-style="aesthetic"] .fab { display: none; }                       /* the + lives in the bar */
  [data-style="aesthetic"] .fab-item { right: auto; left: calc(50% - 26px); bottom: calc(var(--bar-gap) + 9px); }
  [data-style="aesthetic"] .fab-wrap::after {
    content: ''; position: fixed; left: 16px; right: 16px; bottom: calc(var(--bar-gap) + 82px); height: 108px; z-index: 41;
    border-radius: 28px; background: var(--surface); box-shadow: 0 16px 40px rgba(20, 18, 28, .22);
    opacity: 0; transform: translateY(12px) scale(.98); pointer-events: none; transition: opacity .18s, transform .18s;
  }
  [data-style="aesthetic"] .fab-wrap.open::after { opacity: 1; transform: none; }
  [data-style="aesthetic"] .fab-ic { --q: var(--ink); border: 0; box-shadow: none; background: color-mix(in srgb, var(--q) 16%, var(--surface)); color: var(--q); }
  [data-style="aesthetic"] .fab-item.expense .fab-ic { --q: #e0607a; }
  [data-style="aesthetic"] .fab-item.income .fab-ic { --q: #2e9d6c; }
  [data-style="aesthetic"] .fab-item.transfer .fab-ic { --q: #7b61d9; }
  [data-style="aesthetic"] .fab-item.calc .fab-ic { --q: #c98a14; }
  [data-style="aesthetic"] .fab-label { color: var(--ink); text-shadow: none; font-weight: 700; }
  [data-style="aesthetic"] .wdot-c { width: 38px; height: 38px; }
  [data-style="aesthetic"] .modal:has(#typeSeg) { height: 92vh; min-height: 0; } /* the add form always as tall as a sheet can be: its top never moves */
}

/* Reports in the Aesthetic look: spending by category as a colourful ring, the total in the middle */
.donut-wrap { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: center; }
.donut { position: relative; width: 200px; max-width: 100%; aspect-ratio: 1; margin: 0 auto; }
.donut svg { width: 100%; height: 100%; display: block; }
.donut-mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 2px; }
.donut-mid span { font-size: 13px; color: var(--muted); }
.donut-mid b { font-family: var(--num); font-size: 22px; font-weight: 600; }
.donut-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dl { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: var(--surface-2); min-width: 0; }
.dl i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dl span { flex: 1; min-width: 0; display: grid; font-size: 13px; color: var(--ink-2); overflow: hidden; }
.dl span b { font-family: var(--num); font-size: 15px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.dl small { font-size: 12px; font-weight: 700; color: var(--muted); }
@media (max-width: 640px) {
  .donut-wrap { grid-template-columns: 1fr; }
  .donut-legend { grid-template-columns: 1fr; gap: 6px; }
  .dl span { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
  .dl small { min-width: 34px; text-align: right; }
}
