/* Monurus: white panels with clear borders on a cool grey page, deep teal (#0f766e) for actions; in the dark theme
   teal-black panels with bright mint (#5eead4). Montserrat throughout, sized for easy reading. Chart series (categories)
   and the bank accounts' 10 colours are checked for colour-blind and normal-vision separation, chosen separately for
   light and dark. The design system is written up in DESIGN.md. */
@font-face {
  font-family: "Montserrat"; src: url("/fonts/montserrat.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  color-scheme: light;
  --page: #f0f4f4;            /* cool grey with a breath of teal */
  --surface: #ffffff;
  --surface-2: #f3f7f7;       /* hover, fills, table heads */
  --surface-3: #e5eded;
  --text: #142221;
  --text-2: #3e504e;
  --muted: #5b6d6b;
  --grid: #e6eded;
  --axis: #c4d0cf;
  --border: #dbe4e3;          /* every panel and section has one */
  --border-strong: #c3d0cf;
  --brand: #0f766e;           /* deep teal: primary buttons, your chat messages */
  --brand-hover: #0d655e;
  --on-brand: #ffffff;
  --accent: #0f766e;          /* where you are, progress, focus */
  --accent-ink: #0b625b;      /* links and selected text */
  --accent-soft: #d3ebe7;
  --accent-wash: rgba(15, 118, 110, 0.09);
  --mint: #5eead4;            /* the bright teal: the chat bubble's ring, highlights on the teal panel */
  --heat: #0f766e;            /* the calendar: how much was spent each day, in 5 shades of it */
  --tile-1: #dcf1ee; --tile-1-ink: #0f6e66;   /* icon tiles: teal, terracotta, slate, sand */
  --tile-2: #f8e5dc; --tile-2-ink: #9c4b26;
  --tile-3: #e0e9f4; --tile-3-ink: #2f5684;
  --tile-4: #f3ebd7; --tile-4-ink: #87620c;
  --series-1: #3b6aa8; --series-2: #c2603a; --series-3: #5a55a0; --series-4: #6f8a26;
  --series-5: #8c4a86; --series-6: #b5850f; --series-7: #008a7e; --series-8: #b03a3a;
  /* bank accounts' own colours, picked in Settings (teal, amber, sky, red, blue, orange, violet, lime, pink, green),
     in the order checked with the data-viz validator: neighbours pass the colour-blind and normal-vision checks */
  --acct-1: #008c78; --acct-2: #a58108; --acct-3: #0593bf; --acct-4: #bd3933; --acct-5: #285cc2;
  --acct-6: #d3721e; --acct-7: #8856c6; --acct-8: #608a05; --acct-9: #c65b93; --acct-10: #05773b;
  --other: #94a09f;
  --good: #2f8a4f; --warning: #e0a106; --serious: #d0723e; --critical: #c0392b;
  --good-text: #23683b;
  --critical-text: #b42318;
  --warning-text: #7a5400;
  --good-wash: rgba(47, 138, 79, 0.11);
  --warning-wash: rgba(224, 161, 6, 0.16);
  --critical-wash: rgba(192, 57, 43, 0.09);
  --shadow: 0 1px 2px rgba(16, 42, 40, 0.05), 0 2px 6px -2px rgba(16, 42, 40, 0.07);
  --shadow-lg: 0 4px 10px rgba(16, 42, 40, 0.06), 0 24px 48px -18px rgba(16, 42, 40, 0.24);
  /* Home's page tiles (step 17i): a soft shadow; on the dark page a hairline instead, as a shadow doesn't show there */
  --tile-shadow: 0 1px 2px rgba(16, 42, 40, 0.06), 0 6px 14px -6px rgba(16, 42, 40, 0.16); --tile-edge: transparent;
  /* the deep teal panel beside the login form, with its own light text */
  --panel: #0c3a36; --panel-ink: #eaf6f4; --panel-muted: #a9c9c5; --panel-rule: rgba(234, 246, 244, 0.14);
  --stripe: color-mix(in srgb, var(--text) 4%, var(--surface));  /* every other row of a list or table */
  --radius: 14px;             /* panels */
  --radius-sm: 9px;           /* controls */
  --radius-xs: 6px;           /* chips and badges */
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --tabbar-h: 64px;
  --rail-w: 264px;
  --header-h: 64px;
  /* safe areas (notch, status bar, gesture bar): the Android app (Capacitor) sets --safe-area-inset-*, browsers have env() */
  --sat: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --sab: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}

/* dark: teal-black, with bright mint for actions */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #091312; --surface: #101c1f; --surface-2: #152428; --surface-3: #1c2e33;
    --text: #edf5f4; --text-2: #bccbc9; --muted: #8ea19f; --grid: #1b2b2f; --axis: #33474b;
    --border: #213538; --border-strong: #31494d;
    --brand: #5eead4; --brand-hover: #86efdd; --on-brand: #062420;
    --accent: #5eead4; --accent-ink: #86efdd; --accent-soft: #143a37; --accent-wash: rgba(94, 234, 212, 0.12);
    --tile-1: #113533; --tile-1-ink: #7fe3d3; --tile-2: #3a2620; --tile-2-ink: #eda07c;
    --tile-3: #1b2b3d; --tile-3-ink: #9dbfe8; --tile-4: #332e1d; --tile-4-ink: #e2c068;
    --series-1: #5a8fd0; --series-2: #d9764a; --series-3: #8682cf; --series-4: #7f9f30;
    --series-5: #b16fab; --series-6: #b88b1e; --series-7: #1fa196; --series-8: #d05a5a;
    --acct-1: #25a596; --acct-2: #b38c15; --acct-3: #24a0cc; --acct-4: #d9544b; --acct-5: #3f75dd;
    --acct-6: #d6752a; --acct-7: #a06ee1; --acct-8: #719c27; --acct-9: #d4679f; --acct-10: #26894c;
    --other: #6c807e;
    --good: #4cb36f; --warning: #f0b429; --critical: #e5675a;
    --good-text: #79cf95; --critical-text: #f2958a; --warning-text: #f3c969;
    --good-wash: rgba(76, 179, 111, 0.16); --warning-wash: rgba(240, 180, 41, 0.15); --critical-wash: rgba(229, 103, 90, 0.17);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.45), 0 24px 48px -18px rgba(0, 0, 0, 0.75);
    --tile-shadow: none; --tile-edge: var(--border);
    --panel: #0c2826; --heat: #2a9d90;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #091312; --surface: #101c1f; --surface-2: #152428; --surface-3: #1c2e33;
  --text: #edf5f4; --text-2: #bccbc9; --muted: #8ea19f; --grid: #1b2b2f; --axis: #33474b;
  --border: #213538; --border-strong: #31494d;
  --brand: #5eead4; --brand-hover: #86efdd; --on-brand: #062420;
  --accent: #5eead4; --accent-ink: #86efdd; --accent-soft: #143a37; --accent-wash: rgba(94, 234, 212, 0.12);
  --tile-1: #113533; --tile-1-ink: #7fe3d3; --tile-2: #3a2620; --tile-2-ink: #eda07c;
  --tile-3: #1b2b3d; --tile-3-ink: #9dbfe8; --tile-4: #332e1d; --tile-4-ink: #e2c068;
  --series-1: #5a8fd0; --series-2: #d9764a; --series-3: #8682cf; --series-4: #7f9f30;
  --series-5: #b16fab; --series-6: #b88b1e; --series-7: #1fa196; --series-8: #d05a5a;
  --acct-1: #25a596; --acct-2: #b38c15; --acct-3: #24a0cc; --acct-4: #d9544b; --acct-5: #3f75dd;
  --acct-6: #d6752a; --acct-7: #a06ee1; --acct-8: #719c27; --acct-9: #d4679f; --acct-10: #26894c;
  --other: #6c807e;
  --good: #4cb36f; --warning: #f0b429; --critical: #e5675a;
  --good-text: #79cf95; --critical-text: #f2958a; --warning-text: #f3c969;
  --good-wash: rgba(76, 179, 111, 0.16); --warning-wash: rgba(240, 180, 41, 0.15); --critical-wash: rgba(229, 103, 90, 0.17);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.45), 0 24px 48px -18px rgba(0, 0, 0, 0.75);
  --tile-shadow: none; --tile-edge: var(--border);
  --panel: #0c2826; --heat: #2a9d90;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--text);
  font: 13px/1.5 var(--font);
  font-variant-numeric: tabular-nums;   /* amounts line up everywhere */
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
::selection { background: var(--accent-soft); color: var(--text); }
input, textarea { caret-color: var(--accent); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 21px; }
h2 { font-size: 14px; }
h3 { font-size: 13px; }
p { margin: 0; text-wrap: pretty; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.secondary { color: var(--text-2); }
.small { font-size: 12px; }
.num, .fig { font-variant-numeric: tabular-nums; font-weight: 600; }
.mono { font-family: var(--mono); font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { height: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }

/* ----- shell: the menu on the left, a header bar over the page ----- */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.shell > div { min-width: 0; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 1px; padding: calc(14px + var(--sat)) 12px 12px;
  background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 14px; min-width: 0; color: var(--text); text-decoration: none; border-radius: var(--radius-sm); }
.brand img { width: 32px; height: 32px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-word { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.brand-tag { font-size: 11px; font-weight: 500; color: var(--muted); }
.nav-section { margin: 12px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
/* the drawer (phones and tablets): each group's title folds it open and shut */
.nav-fold { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin: 6px 0 0;
  padding: 10px 10px; border: 0; border-radius: var(--radius-sm); background: none; font: inherit; font-size: 12.5px; font-weight: 700;
  letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-2); cursor: pointer; }
.nav-fold:active { background: var(--surface-2); }
.nav-fold .icon-svg { transition: transform 200ms var(--ease-out); }
.nav-fold[aria-expanded="false"] .icon-svg { transform: rotate(-90deg); }
.nav-group { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 220ms var(--ease-out); }
.nav-group.open { grid-template-rows: 1fr; }
.nav-group > div { overflow: hidden; display: flex; flex-direction: column; gap: 1px; }
@media (prefers-reduced-motion: reduce) { .nav-group, .nav-fold .icon-svg { transition: none; } }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 13px; transition: background-color 140ms, color 140ms;
}
@media (hover: hover) and (pointer: fine) { .nav-link:hover { background: var(--surface-2); color: var(--text); } }
.nav-link:active { background: var(--surface-2); }
/* the current page: a teal wash and a teal bar along its left edge */
.nav-link.active { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--text); font-weight: 650; }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 6px; bottom: 6px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.nav-link.active .icon { color: var(--accent); }
.nav-link .icon { display: inline-flex; width: 20px; justify-content: center; }
.nav-link .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.sidebar .btn.install { margin: 8px 0 2px; }
.sidebar a.small { padding: 4px 10px; }
/* your account: email, and your plan under it */
.account-card { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 2px 9px;
  margin-top: 8px; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--page); }
.avatar { grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--on-brand);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; text-transform: uppercase; }
.account-email { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.account-plan { grid-column: 2 / 4; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 11.5px; color: var(--text-2); min-width: 0; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { a.account-plan:hover { color: var(--text); } }
.account-card .btn { grid-column: 3; grid-row: 1; }
/* profiles (profiles.js): the switcher under the logo, and on phones in the top bar in place of the word Monurus */
.profile-switch { position: relative; min-width: 0; }
.sidebar .profile-switch { margin: -4px 0 10px; }
.profile-button { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; padding: 6px 10px 6px 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--page); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 650; text-align: left; cursor: pointer; touch-action: manipulation; }
@media (hover: hover) and (pointer: fine) { .profile-button:hover { background: var(--surface-2); } }
.profile-button:focus-visible, .profile-item:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.profile-icon { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--border); }
.profile-icon.plain { background: none; border-color: transparent; color: var(--text-2); }
.profile-label { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.profile-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-label .profile-owner { font-size: 11px; }
.profile-chevron { display: inline-flex; color: var(--muted); transition: transform 160ms ease-out; }
.profile-button[aria-expanded="true"] .profile-chevron { transform: rotate(180deg); }
.profile-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; gap: 1px;
  padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 14px 36px rgba(0, 0, 0, 0.2); }
.profile-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px 6px 6px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 500; text-align: left; cursor: pointer; touch-action: manipulation; }
.profile-item.on { color: var(--text); font-weight: 650; }
.profile-item.on > .icon-svg { color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .profile-item:hover { background: var(--surface-2); color: var(--text); } }
.profile-item:active { background: var(--surface-2); }
.profile-sep { height: 1px; margin: 4px 2px; background: var(--border); }
.profile-group { margin: 8px 8px 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.profile-item-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.profile-owner { font-size: 11.5px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* sharing (step 15): who a profile is shared with, and each time they looked */
.share-row { flex-wrap: wrap; }
.share-views summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--accent-ink); margin-top: 4px; }
.share-views ul { margin: 4px 0 0; padding-left: 18px; color: var(--text-2); }
.share-form .input { min-width: 200px; }
/* splitting bills (step 16, views/splits.js) */
.split-editor { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--page); }
.split-amount .input { width: 110px; text-align: right; }
.split-off { color: var(--critical-text); font-weight: 600; }
.split-balance .num, .split-row .num { font-weight: 650; }
.app-header .profile-switch { display: none; }
.app-header .profile-button { border-color: transparent; background: none; padding: 4px 6px 4px 2px; gap: 7px; font-size: 15px; font-weight: 700; }
.app-header .profile-menu { right: auto; width: min(280px, calc(100vw - 24px)); }
.profile-row .icon-bubble { font-size: 17px; }
.profile-actions { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 860px) {
  .app-header .profile-switch { display: block; }
  .app-header.has-profiles .brand .brand-text { display: none; }
  .app-header .profile-label { max-width: 46vw; }
  .app-header .profile-button { font-size: 14px; }
  .profile-row { flex-wrap: wrap; row-gap: 4px; }
  .profile-row > .grow { flex-basis: calc(100% - 52px); }
  .profile-row .profile-actions { flex-basis: 100%; justify-content: flex-start; padding-left: 42px; }  /* under the name */
}
.main { min-width: 0; max-width: 1440px; padding: 22px 30px 100px; }  /* bottom room for the chat bubble */
/* the header bar: where you are on the left, language, theme and Import on the right */
.app-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; min-height: var(--header-h);
  padding: var(--sat) 30px 0; background: color-mix(in srgb, var(--surface) 92%, transparent); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.2) blur(10px); backdrop-filter: saturate(1.2) blur(10px); }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.crumbs strong { color: var(--text); font-weight: 650; }
.crumbs .icon-svg { color: var(--muted); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.app-header .brand { display: none; padding: 0; gap: 9px; }
.app-header .brand img { width: 30px; height: 30px; }
.app-header .brand-word { font-size: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.page-head p { color: var(--text-2); margin-top: 4px; font-size: 13px; }

/* ----- panels & grids ----- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.card-head h2 { display: flex; align-items: center; gap: 10px; }
.card-head > .row { flex-wrap: wrap; min-width: 0; }  /* two switches (Spending / Income, Chart / Table) wrap when narrow */
.card-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; font-weight: 500; overflow-wrap: anywhere; }  /* e.g. a long folder path */
.card-body { padding: 14px 18px 16px; }
/* a card that folds on phones (the dashboard's): its title is the button, the chevron turns when it's open */
.fold-head { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.fold-head .card-title { flex: 1; min-width: 0; }
.fold-head:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.fold-chevron { display: inline-flex; color: var(--muted); transition: transform 200ms var(--ease-out); }
.fold-head[aria-expanded="true"] .fold-chevron { transform: rotate(180deg); }
.card.folded > .card-head { border-bottom: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-wide { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.section { margin-top: 16px; }
/* a small square holding an icon, in front of a card's title or a figure */
.icon-tile { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--tile-1); color: var(--tile-1-ink); }
.icon-tile.t2 { background: var(--tile-2); color: var(--tile-2-ink); }
.icon-tile.t3 { background: var(--tile-3); color: var(--tile-3-ink); }
.icon-tile.t4 { background: var(--tile-4); color: var(--tile-4-ink); }
.icon-tile.plain { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

/* ----- figures: tiles on other pages, joined into one bordered strip ----- */
.tile { padding: 14px 16px; }
.tile .label { color: var(--text-2); font-size: 12px; font-weight: 500; }
.tile .value { font-size: 18px; font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; }
.tile .delta { font-size: 12px; margin-top: 4px; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.delta.good { color: var(--good-text); }
.delta.bad { color: var(--critical-text); }
.grid:has(> .card.tile) { gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.grid > .card.tile { border: 0; border-radius: 0; box-shadow: none; background: var(--surface); }

/* ----- the dashboard's figures: four cards, each with its icon (as in a finance dashboard) ----- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi .icon-tile { width: 34px; height: 34px; border-radius: 10px; }
.kpi-value { font-size: clamp(17px, 1.35vw, 21px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; white-space: nowrap; }
.kpi-label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 11.5px; }
.kpi-foot .muted { font-weight: 500; }
/* the dashboard: the period on the left, its picker on the right; then its cards in one column with even gaps */
.dash-head { align-items: center; }
.dash-head > p { margin: 0; color: var(--text-2); font-size: 13px; font-weight: 500; }
.delta-short { display: none; }  /* a figure's change in one bar on phones: the arrow and the number */
/* the four figures as one bar (phones, and Home's category card): four across, amounts without the sen from RM 1,000 */
.kpis.bar { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); }
.kpis.bar > .card.kpi { border: 0; border-radius: 0; background: none; box-shadow: none; padding: 9px 4px 8px; gap: 3px;
  align-items: center; text-align: center; min-width: 0; }
.kpis.bar > .card.kpi + .kpi { border-left: 1px solid var(--border); }
.kpis.bar .icon-tile { display: none; }
.kpis.bar .kpi-top { justify-content: center; }
.kpis.bar .kpi-label { font-size: 10.5px; line-height: 1.25; }
.kpis.bar .kpi-value { font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.kpis.bar .kpi-foot { padding-top: 0; border-top: 0; justify-content: center; font-size: 10.5px; }
.kpis.bar .money-full, .kpis.bar .delta-long { display: none; }
.kpis.bar .money-short, .kpis.bar .delta-short { display: inline; }
.dash { display: flex; flex-direction: column; gap: 16px; }
.dash > *, .dash .dash-row { margin-top: 0; }
.dash-note { margin-top: 8px; }
/* the category card's three figures */
.ring-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 6px; padding: 8px 10px;
  border-radius: var(--radius-sm); background: var(--surface-2); text-align: center; }
.ring-figures span { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ring-figures strong { font-size: 14px; font-weight: 700; white-space: nowrap; }
.money-bad { color: var(--critical-text); font-weight: 650; }
.cat-cell { font-weight: 550; }
.dash-row { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; align-items: start; margin-top: 16px; }
.dash-row > .stack { gap: 16px; }
.dash-row.solo { grid-template-columns: minmax(0, 1fr); }  /* nothing due soon: the charts take the width */
/* spending by category: a ring with the total in the middle, and the list under it */
.ring-wrap { position: relative; width: min(220px, 100%); margin: 4px auto 2px; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.ring-center strong { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.ring-center span { font-size: 12px; color: var(--muted); }
.cat-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; }
.cat-list li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; align-items: center; gap: 4px 10px; padding: 6px 10px;
  border-radius: var(--radius-xs); cursor: pointer; transition: background-color 140ms; }
.cat-list li:nth-child(even) { background: var(--stripe); }
@media (hover: hover) and (pointer: fine) { .cat-list li:hover { background: var(--surface-2); } }
.cat-list li:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.cat-list .swatch { width: 12px; height: 12px; border-radius: 3px; }
.cat-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.cat-list .amt { font-weight: 650; }
.cat-list .share { font-size: 12.5px; color: var(--muted); font-weight: 600; }
/* a chart that grows to the height of the card beside it (the bars next to the ring), never under its min-height */
.card.fill { display: flex; flex-direction: column; }
.card.fill > .card-body { flex: 1; display: flex; flex-direction: column; }
.chart-box.fill { flex: 1 1 0; }
.chart-box.fill > canvas { position: absolute; inset: 0; }

/* ----- buttons & inputs ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 33px; padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; font-weight: 600; font-size: 12.5px; white-space: nowrap; text-decoration: none; color: var(--text);
  transition: transform 120ms var(--ease-out), background-color 140ms, border-color 140ms, color 140ms;
}
@media (hover: hover) and (pointer: fine) { .btn:hover { background: var(--surface-2); } }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
@media (hover: hover) and (pointer: fine) { .btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); } }
.btn.danger { color: var(--critical-text); }
.btn.ghost { border-color: transparent; background: transparent; }
@media (hover: hover) and (pointer: fine) { .btn.ghost:hover { background: var(--surface-2); } }
.btn.ghost.on { background: var(--surface-2); }
.btn.small { min-height: 28px; padding: 3px 9px; font-size: 12px; gap: 5px; }
.btn.icon-only { padding: 6px 8px; }
.btn.icon-round { width: 34px; height: 34px; padding: 0; border-radius: 50%; }
.btn .icon-svg { margin: -2px 0; }
.input, .select, textarea.input {
  min-height: 34px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); min-width: 0; transition: border-color 140ms, box-shadow 140ms;
}
@media (hover: hover) and (pointer: fine) { .input:hover, .select:hover { border-color: var(--muted); } }
.input:focus, .select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.btn:focus-visible, .chip:focus-visible, button.link:focus-visible, .tab:focus-visible, a:focus-visible, .nav-link:focus-visible {
  outline: 2.5px solid var(--accent); outline-offset: 2px;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); width: 16px; height: 16px; }
.select { padding-right: 30px; }
/* The open list takes the select's background; a transparent select (.cat-select) would get a white list with theme-colored text */
select option, select optgroup { background-color: var(--surface); color: var(--text); }
label.field, div.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); }
.field > span:not(.field-hint) { font-weight: 600; color: var(--text); }
.field-hint { font-size: 11.5px; color: var(--muted); }
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.segmented { display: inline-flex; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--text-2); font-size: 12px; font-weight: 600; transition: background-color 140ms, color 140ms; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 42, 40, 0.12); }
.lang-switch button { flex: 1; white-space: nowrap; }
/* the language as a dropdown with a globe (header bar and login) */
.lang-select { position: relative; display: inline-flex; align-items: center; }
.lang-select .icon-svg { position: absolute; left: 11px; pointer-events: none; color: var(--text-2); }
.lang-select select { padding-left: 34px; }
/* the bell: how many are new, on its corner */
.bell { position: relative; }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  display: grid; place-items: center; background: var(--critical); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 1;
  border: 2px solid var(--surface); }
.notice { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.notice > .grow { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
@media (hover: hover) and (pointer: fine) { .list > .notice:hover { background: var(--surface-2); } }
.notice.new .txn-main { font-weight: 700; }
.notice-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.lang-toggle { display: none; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }  /* phones only, below */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }

/* ----- chips & badges ----- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 600; border: 1px solid var(--border-strong);
  cursor: default; white-space: nowrap;
}
button.chip { cursor: pointer; transition: border-color 140ms, background-color 140ms; }
@media (hover: hover) and (pointer: fine) { button.chip:hover { background: var(--surface-2); } }
.chip.on { background: var(--accent-wash); color: var(--accent-ink); border-color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-xs); font-size: 12px; font-weight: 650; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.warn { background: var(--warning-wash); color: var(--warning-text); }
.badge.good { background: var(--good-wash); color: var(--good-text); }
.badge.bad { background: var(--critical-wash); color: var(--critical-text); }
.badge.accent { background: var(--accent-wash); color: var(--accent-ink); }
.badge.pro { background: var(--brand); color: var(--on-brand); }

/* ----- tags: the person's own labels (tags.js) ----- */
.tag-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: 1px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; max-width: 220px;
  font: inherit; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--accent-wash); color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.tag > .icon-svg { flex: none; }
.txn-main .tag-chips { display: flex; margin: 3px 0 2px; }  /* on a transaction, under its name */
button.tag { cursor: pointer; }
@media (hover: hover) and (pointer: fine) { button.tag:hover { border-color: var(--accent); } }
.tag > button { display: inline-flex; padding: 3px; margin: -2px -5px -2px 0; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .tag > button:hover { background: var(--accent-soft); } }
.tag-input {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 34px; padding: 4px 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color 140ms, box-shadow 140ms;
}
.tag-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.tag-entry { flex: 1; min-width: 120px; padding: 4px 2px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; }
.input.small, .select.small { min-height: 30px; padding: 4px 9px; }
.select.small { padding-right: 28px; }
.bulk-bar { flex-wrap: wrap; gap: 8px 10px; }
.bulk-bar > strong { white-space: nowrap; }
.bulk-tag { gap: 6px; flex-wrap: nowrap; }
.bulk-tag .input { width: 150px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status.ok .dot { background: var(--good); }
.status.warning .dot { background: var(--warning); }
.status.over .dot { background: var(--critical); }

/* ----- tables: a tinted head, then every other row striped (no lines between rows) ----- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 650; color: var(--text-2); padding: 8px 10px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 8px 10px; vertical-align: middle; }
.table tbody tr:nth-child(even) > td { background: var(--stripe); }
.table tbody tr.clickable { cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .table tbody tr.clickable:hover td { background: var(--surface-2); } }
.table tbody tr.selected td { background: var(--accent-wash); }
.table td.amount, .table th.amount { text-align: right; white-space: nowrap; }
.table td.amount { font-weight: 600; }
.table td.date { color: var(--text-2); white-space: nowrap; font-weight: 500; }
.card > .table-wrap > .table th:first-child, .card > .table-wrap > .table td:first-child { padding-left: 18px; }
.card > .table-wrap > .table th:last-child, .card > .table-wrap > .table td:last-child { padding-right: 18px; }
.money-in { color: var(--good-text); font-weight: 650; }
.txn-main { font-weight: 600; }
.txn-sub { font-size: 12px; color: var(--muted); max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-select { max-width: 230px; min-height: 32px; padding: 4px 28px 4px 9px; font-size: 13px; border-color: var(--border); background-color: transparent; }
@media (hover: hover) and (pointer: fine) { .cat-select:hover { border-color: var(--border-strong); } }
.cat-select.uncat { color: var(--critical-text); border-color: var(--critical-wash); }  /* not "empty": that is the empty-state panel */
.table td.amount .acct-tag, .table td.amount .small { font-weight: 500; }

/* ----- account cards: thin, two lines each (step 8a); since 12 Oct the header is in the account's colour (see the end of this file) ----- */
.acct-strip { margin-bottom: 14px; }
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 8px; align-items: start; }
.acct-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 9px; }
.acct-card.off { opacity: 0.62; box-shadow: none; }
.acct-card.colored { border-left: 4px solid var(--acct-color); }
.acct-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.acct-label { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
label.acct-label { cursor: pointer; }
.acct-label .icon-svg { color: var(--text-2); flex: none; }
.acct-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-value { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.acct-value.muted { font-size: 12px; font-weight: 550; letter-spacing: 0; }
.acct-value .suffix { font-size: 11px; font-weight: 550; color: var(--text-2); margin-left: 4px; letter-spacing: 0; }
.acct-row > .btn.icon-only { margin: -5px -7px -5px -2px; }
.acct-details { display: flex; flex-wrap: wrap; align-items: center; gap: 0 5px; font-size: 11.5px; color: var(--muted); }
.acct-details .sep { color: var(--border-strong); }
.acct-details .status { font-size: inherit; font-weight: 600; gap: 4px; }
.acct-details .row-inline { display: inline-flex; align-items: center; gap: 3px; }
/* a card's limit use: a slim bar along its bottom edge */
.acct-usage { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent-soft); }
.acct-usage i { display: block; height: 100%; background: var(--accent); }
.acct-usage.high i { background: var(--warning); }
.acct-tag { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.acct-totals { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 8px; padding: 6px 12px; font-size: 12px; color: var(--text-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.acct-totals strong { color: var(--text); font-weight: 700; }
.money-input { display: flex; align-items: center; gap: 8px; }
.money-input .input { width: 200px; }
button.link { border: 0; background: none; padding: 0; color: var(--accent-ink); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 3px; }
/* import history: a striped list; on phones the account picker goes under the file name */
.import-history .list-item { flex-wrap: wrap; row-gap: 6px; }
.import-history-file { min-width: 0; }
.import-history-file .txn-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-history-account .select { min-height: 30px; max-width: 220px; padding: 3px 28px 3px 9px; font-size: 12.5px; }
@media (max-width: 640px) {
  .import-history .list-item > .grow { flex-basis: calc(100% - 42px); }
  .import-history-account { flex: 1 1 0; min-width: 0; margin-left: 42px; }
  .import-history-account .select { width: 100%; max-width: none; }
}
/* import: one row per file */
.import-files .select { min-height: 34px; padding: 4px 28px 4px 9px; font-size: 14px; max-width: 200px; }
.import-files .input.pw { width: 160px; min-height: 34px; padding: 4px 9px; font-size: 14px; }
.import-files tr.detail > td { padding: 4px 12px 16px 36px; }
.column-picker th, .column-picker td { min-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.column-picker .select { width: 100%; padding: 4px 24px 4px 6px; font-size: 13px; }
.file-problem { display: block; max-width: 440px; white-space: normal; line-height: 1.45; }
details.ocr-text summary { cursor: pointer; }
details.ocr-text pre { margin: 8px 0 0; padding: 10px 12px; max-height: 220px; overflow: auto; background: var(--surface-2); border-radius: var(--radius-sm); font: 12.5px/1.6 var(--mono); white-space: pre-wrap; color: var(--text-2); }
.conflict-sides { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.conflict-side { padding: 9px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }

/* ----- charts ----- */
.chart-box { position: relative; width: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; font-size: 12.5px; color: var(--text-2); }
.legend-key { display: inline-flex; align-items: center; gap: 7px; }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.bar-list { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.bar-track { grid-column: 1 / -1; height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--accent); }
.bar-track.split { display: flex; }
.bar-track.split .bar-fill { flex: none; }
.bar-track.split .bar-fill + .bar-fill { border-left: 2px solid var(--surface); }
.meter { height: 8px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; }
.meter > div { height: 100%; border-radius: 4px; background: var(--accent); }
.meter.warning > div { background: var(--warning); }
.meter.over > div { background: var(--critical); }
.spark { display: block; }

/* ----- toasts, modals, drawer ----- */
.toasts { position: fixed; right: 22px; bottom: 96px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: min(460px, calc(100vw - 32px)); }
.toast { padding: 14px 16px; display: flex; gap: 11px; align-items: flex-start; box-shadow: var(--shadow-lg);
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out); }
@starting-style { .toast { opacity: 0; transform: translateY(8px); } }
.toast .msg { flex: 1; }
.toast > .icon-svg { margin-top: 1px; color: var(--good-text); }
.toast.error { border-color: var(--critical); }
.toast.error > .icon-svg { color: var(--critical-text); }
.toast .actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.backdrop { position: fixed; inset: 0; background: rgba(6, 20, 19, 0.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px;
  transition: opacity 200ms var(--ease-out); }
@starting-style { .backdrop { opacity: 0; } }
.modal { width: min(580px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; box-shadow: var(--shadow-lg);
  transition: transform 220ms var(--ease-out); }
@starting-style { .modal { transform: translateY(10px) scale(0.98); } }
.modal.wide { width: min(840px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(6, 20, 19, 0.35); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100vw); z-index: 45; overflow-y: auto; overscroll-behavior: contain;
  padding-top: var(--sat); padding-bottom: var(--sab);
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; transition: transform 260ms var(--ease-drawer);
}
@starting-style { .drawer { transform: translateX(24px); } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 16px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* ----- notices, empty states, progress ----- */
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid var(--border); background: var(--surface); }
.banner > .icon-svg { flex: none; }
.banner.warn { background: var(--warning-wash); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.banner.warn > .icon-svg { color: var(--warning-text); }
.banner.info { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.banner.info > .icon-svg { color: var(--accent-ink); }
.banner.stack { align-items: stretch; }
.empty { text-align: center; padding: 52px 24px; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty .big { width: 58px; height: 58px; border-radius: 16px; background: var(--tile-1); color: var(--tile-1-ink); display: grid; place-items: center; margin-bottom: 12px; font-size: 30px; }
.empty h2 { margin-bottom: 4px; color: var(--text); font-size: 16.5px; }
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 44px 20px; text-align: center;
  background: var(--surface); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dropzone .icon-svg { margin: 0 auto 10px; color: var(--accent); }
.dropzone.over { border-color: var(--accent); background: var(--accent-wash); }
@media (hover: hover) and (pointer: fine) { .dropzone:hover { border-color: var(--accent); background: var(--accent-wash); } }
.progress { height: 7px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width 0.3s; }
.progress.indeterminate > div { width: 35%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { margin-left: -35%; } to { margin-left: 100%; } }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 0.7s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-frame { opacity: 0.55; transition: opacity 0.2s; pointer-events: none; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius-xs); }
.list > .list-item:nth-child(even) { background: var(--stripe); }
.rec-amount { min-width: 96px; text-align: right; }
/* when a recurring payment is next due: small, after "since …" (step 17a) */
.rec-when { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.rec-when.soon { color: var(--accent-ink); font-weight: 650; }
.rec-when.warn { color: var(--warning-text); font-weight: 650; }
/* phones: a recurring item is the name and amount, then its buttons (never wider than the screen, which would push
   the tab bar off it) */
@media (max-width: 640px) {
  .rec-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 12px;
    grid-template-areas: "icon main amount" "icon actions actions"; }
  .rec-item > .icon-bubble { grid-area: icon; align-self: start; }
  .rec-item > .grow { grid-area: main; min-width: 0; }
  .rec-item > .rec-amount { grid-area: amount; align-self: start; min-width: 0; }
  .rec-item > .rec-actions { grid-area: actions; flex-wrap: wrap; gap: 6px; }
  /* a category: its name and description beside the icon, the buttons under them */
  .cat-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; }
  .cat-item > .icon-bubble { grid-row: span 2; align-self: start; }
  .cat-item > .cat-actions { grid-column: 2; flex-wrap: wrap; gap: 4px; margin-left: -10px; }
  .tag-item { flex-wrap: wrap; row-gap: 4px; }
  .tag-item > .cat-actions { width: 100%; flex-wrap: wrap; gap: 4px; margin-left: -10px; }
}
.icon-bubble { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.headline { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }

/* ----- chat (z-index 44: above the page, below the transaction drawer, modals and toasts) ----- */
/* the bubble: a teal circle (mint in the dark theme) with a soft mint ring */
.chat-bubble {
  position: fixed; right: 22px; bottom: 22px; z-index: 44; width: 60px; height: 60px; border-radius: 50%;
  padding: 0; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
  background: var(--brand); color: var(--on-brand);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--mint) 35%, transparent), 0 10px 24px -8px rgba(6, 40, 38, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
@media (hover: hover) and (pointer: fine) { .chat-bubble:hover { transform: translateY(-2px); box-shadow: 0 0 0 6px color-mix(in srgb, var(--mint) 45%, transparent), 0 14px 28px -8px rgba(6, 40, 38, 0.55); } }
.chat-bubble:active { transform: scale(0.96); }
.chat-bubble:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 7px; }
.chat-bubble .spinner { width: 22px; height: 22px; border-color: rgba(255, 255, 255, 0.3); border-top-color: var(--on-brand); }
.chat-glyph { display: block; }
@media (prefers-reduced-motion: reduce) { .chat-bubble:hover, .chat-bubble:active { transform: none; } }
.chat-dot { position: absolute; top: -2px; right: -2px; width: 16px; height: 16px; border-radius: 50%; background: var(--critical); border: 2.5px solid var(--page); }
/* --chat-w / --chat-h / --chat-side-w are set when you drag an edge; the max-* rules keep it inside the window */
.chat-popup {
  position: fixed; right: 22px; bottom: 22px; z-index: 44; width: var(--chat-w, 420px); height: var(--chat-h, 640px);
  max-width: calc(100vw - 40px); max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  transform-origin: bottom right; transition: transform 200ms var(--ease-out), opacity 200ms var(--ease-out);
}
@starting-style { .chat-popup { opacity: 0; transform: scale(0.96) translateY(6px); } }
.chat-popup.expanded {
  top: 0; right: 0; bottom: 0; height: auto; max-height: none; width: var(--chat-side-w, 580px); max-width: 100vw;
  border-radius: 0; border-width: 0 0 0 1px;
}
.chat-resize { position: absolute; z-index: 2; touch-action: none; }
.chat-scrim, .sheet-handle { display: none; }  /* phones only: the dimmed page behind the chat sheet, and its handle */
.chat-resize.left { left: 0; top: 0; bottom: 0; width: 6px; cursor: ew-resize; }
.chat-resize.top { left: 0; right: 0; top: 0; height: 6px; cursor: ns-resize; }
.chat-resize.corner { left: 0; top: 0; width: 16px; height: 16px; cursor: nwse-resize; z-index: 3; }
@media (hover: hover) and (pointer: fine) { .chat-resize.left:hover { box-shadow: inset 2px 0 var(--accent); } }
@media (hover: hover) and (pointer: fine) { .chat-resize.top:hover { box-shadow: inset 0 2px var(--accent); } }
@media (hover: hover) and (pointer: fine) { .chat-resize.corner:hover { box-shadow: inset 2px 2px var(--accent); } }
body.chat-resizing { user-select: none; }
body.chat-resizing iframe, body.chat-resizing canvas { pointer-events: none; }
.chat-popup-head { display: flex; align-items: center; gap: 2px; padding: 9px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.chat-popup-title { flex: 1; min-width: 0; padding: 0 6px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.chat-empty { text-align: center; padding: 12px 4px; }
.chat-empty .big { width: 50px; height: 50px; margin: 0 auto 10px; border-radius: 14px; background: var(--tile-1); color: var(--tile-1-ink); display: grid; place-items: center; }
.chat-empty .suggestions { flex-direction: column; align-items: stretch; }
.chat-empty .chip { white-space: normal; text-align: left; justify-content: flex-start; padding: 9px 12px; border-radius: var(--radius-sm); font-weight: 550; }
.msg { max-width: 100%; min-width: 0; }
.msg-user-wrap { align-self: flex-end; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 88%; }
.msg.user { background: var(--brand); color: var(--on-brand); padding: 10px 14px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-attach { font-size: 12.5px; color: var(--text-2); background: var(--surface-2); padding: 3px 10px; border-radius: 999px; }
.msg.assistant { align-self: flex-start; }
.chat-popup .md table { display: block; overflow-x: auto; }
.chat-attach { display: flex; align-items: center; gap: 8px; margin: 0 12px; padding: 5px 5px 5px 11px; border-radius: var(--radius-sm); background: var(--accent-wash); font-size: 13px; }
.chat-history { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-history-head { display: flex; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.chat-history-list { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.chat-item { display: flex; align-items: center; gap: 4px; padding-right: 4px; border-radius: var(--radius-sm); }
.chat-item.on { background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) { .chat-item:hover { background: var(--surface-2); } }
.chat-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.chat-item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-match { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.chat-open .toasts { right: var(--chat-space, 20px); }
.msg .steps { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; font-size: 12.5px; color: var(--muted); }
.msg .steps span { display: inline-flex; align-items: center; gap: 6px; }
.md p { margin: 0 0 8px; }
.md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 4px 0 8px; padding-left: 20px; }
.md table { border-collapse: collapse; margin: 6px 0 10px; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--border); padding: 5px 9px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 650; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.chat-input { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input textarea { flex: 1; resize: none; min-height: 44px; overflow-y: hidden; }  /* height set by fitInput() */
.chat-input .btn { height: 44px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
/* how-to guides (step 17f): the main ones in an empty chat, the ones that match over the box as you type, and a guide's
   steps in the chat, in a teal-edged card that says it used no question */
.chat-empty .suggestions + .secondary { margin-top: 16px; }
.chip.guide-chip { gap: 7px; }
.chip.guide-chip .icon-svg { flex: none; color: var(--accent-ink); }
.chat-guides { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px 0; }
.chat-guides .chip { font-size: 12.5px; padding: 4px 10px; }
.msg.guide { width: 100%; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface); }
.guide-title { display: flex; align-items: center; gap: 7px; font-weight: 700; color: var(--accent-ink); }
.msg.guide .md ol { margin: 0; }
.msg.guide .md li + li { margin-top: 3px; }

/* ----- buying Pro (Settings > Your plan; plan.js) ----- */
.billing { padding-top: 14px; border-top: 1px solid var(--border); }
.plan-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.plan-option { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; cursor: pointer;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  transition: border-color 140ms, background-color 140ms; }
.plan-option input { position: absolute; opacity: 0; pointer-events: none; }
.plan-option.on { border-color: var(--brand); background: var(--accent-wash); }
.plan-option:focus-within { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.plan-option-name { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.plan-option-price { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.plan-option-price s { font-weight: 500; }
.plan-option .offer-note { color: var(--accent-ink); font-weight: 600; }  /* an offer's price and how long (23 Oct 2026) */
.sub-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
/* a receipt, to read (its PDF is made on the server, server/reports.py) */
.receipt { display: flex; flex-direction: column; gap: 12px; }
.receipt-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
@media (max-width: 520px) { .plan-choice { grid-template-columns: minmax(0, 1fr); } }
/* refer a friend's link (24 Oct 2026): the link takes the row, its buttons wrap under it on a phone */
.invite-link .input { flex: 1 1 240px; min-width: 0; text-overflow: ellipsis; }

/* ----- receipts and other files on transactions (files.js, views/receipts.js; dev phase 2, step 9) ----- */
.file-row { display: flex; flex-wrap: wrap; gap: 8px; }
.file-thumb { position: relative; flex: none; display: grid; place-items: center; width: 56px; height: 56px; padding: 0;
  overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--text-2); cursor: pointer; transition: border-color 140ms, transform 120ms var(--ease-out); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .file-thumb:hover { border-color: var(--accent); } }
.file-kind { position: absolute; left: 3px; bottom: 3px; padding: 0 4px; border-radius: 4px; font-size: 9.5px; font-weight: 700;
  background: var(--surface); color: var(--text-2); }
.file-details { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.file-view { display: flex; flex-direction: column; gap: 12px; }
.file-big { display: block; max-width: 100%; max-height: min(64vh, 720px); margin: 0 auto; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: #fff; }
.file-pdf { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px; }
.file-pdf img { max-height: 280px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: #fff; }
.file-view-foot { align-items: center; }
.receipt-waiting { align-items: flex-start; }
.receipt-fields { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.8fr); gap: 6px; }
.receipt-fields .input { min-width: 0; width: 100%; }
.receipt-candidate { align-items: center; gap: 6px 10px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.receipt-row .file-thumb, .tax-receipt .file-thumb { width: 40px; height: 40px; }
.receipt-row .link { font: inherit; font-weight: inherit; text-align: left; }
.receipts-usage { margin: -4px 0 12px; }
.receipt-row > .num { white-space: nowrap; }
.tax-receipt { width: 52px; text-align: center; }
/* Choose payments: the payee and its line take what's left; the receipt and the amount keep their room */
.tax-pick .table { table-layout: fixed; width: 100%; }
.tax-pick .table td.amount { width: 96px; }
.tax-pick .txn-main, .tax-pick .txn-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
label.file-add-one { cursor: pointer; }
.receipt-actions { flex: none; gap: 2px; }
.receipt-edit-head { align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.receipt-waiting > .grow, .receipt-row > .grow { min-width: 0; }
@media (max-width: 640px) {
  .receipt-fields { grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); }
  .receipt-fields .input:first-child { grid-column: 1 / -1; }
  .file-thumb { width: 52px; height: 52px; }
  /* the amount, Edit and Remove go on a line of their own, so the payee keeps the width */
  .receipt-row { flex-wrap: wrap; row-gap: 2px; }
  .receipt-row > .grow { flex-basis: calc(100% - 54px); }
  .receipt-row > .num { margin-left: auto; }
  .receipt-waiting > .receipt-actions { flex-direction: column; }
}

/* ----- pages of a long list (ui.js Pager): ‹ 1 2 3 … 9 ›, how many are shown, and how many on a page ----- */
.pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px;
  padding: 10px 18px; border-top: 1px solid var(--border); }
.pager-pages { display: flex; align-items: center; gap: 2px; }
.pager-num { min-width: 34px; justify-content: center; padding-left: 8px; padding-right: 8px; font-variant-numeric: tabular-nums; }
.pager-num.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.pager-gap { padding: 0 4px; color: var(--muted); }
.pager-size { display: inline-flex; align-items: center; gap: 8px; }
.pager-size .select { width: auto; }
.flip { display: inline-flex; transform: scaleX(-1); }
@media (max-width: 640px) {
  .pager { justify-content: center; padding: 10px 12px; }
  .pager-pages { order: -1; width: 100%; justify-content: center; }
}

/* ----- installments (views/installments.js; dev phase 2, step 11) ----- */
.summary-tiles { margin-bottom: 16px; }
.installment .meter { margin: 2px 0; }
.installment > .row { align-self: flex-start; }
.inst-suggest { flex-wrap: wrap; row-gap: 6px; }
.inst-suggest > .grow { min-width: min(260px, 100%); }

/* ----- reports (views/reports.js; dev phase 2, step 13): the PDFs themselves are designed in server/pdf.py ----- */
.report-list { margin: 4px 0 0; padding-left: 18px; }
.chip .swatch { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 2px; }
.link-row { color: inherit; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .link-row:hover .grow { color: var(--accent-ink); } }
a.btn.disabled { pointer-events: none; opacity: 0.55; }

/* ----- debts (views/debts.js; dev phase 2, step 12) ----- */
.debt .num { min-width: 96px; text-align: right; font-weight: 650; }
.debt > .grow { min-width: 0; }
.debt .txn-sub { white-space: normal; max-width: none; }  /* the rate, payment and payoff month wrap rather than cut */
@media (max-width: 640px) { .debt .num { min-width: 0; } }
.debt.muted-row .num, .debt.muted-row .txn-main { color: var(--muted); }
.planner-extra .money-input .input { width: 140px; }
.plan-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.plan-col { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); }
.plan-col.now { background: var(--surface-2); }
.plan-date { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.plan-gain { color: var(--good-text); font-weight: 650; }
.debt-line { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: inherit; text-decoration: none;
  transition: border-color 140ms; }
@media (hover: hover) and (pointer: fine) { .debt-line:hover { border-color: var(--accent); } }
.debt-line-date { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
@media (max-width: 640px) {
  .plan-cols { grid-template-columns: minmax(0, 1fr); }
  .plan-date, .debt-line-date { font-size: 16px; }
}

/* ----- trips (views/trips.js, travel mode; dev phase 2, step 10) ----- */
.trips { align-items: start; }
.trip { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; }
.trip-head { display: flex; align-items: flex-start; gap: 10px; }
.trip-head h2 { font-size: 15px; }
.trip-figures { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.trip-spent { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.trip-day { text-align: right; }
.trip-day .num { font-weight: 650; }
.trip-over { color: var(--critical-text); font-weight: 650; }
.trip-cats .list-item { padding: 6px 8px; }
.trip-cats .num { min-width: 92px; text-align: right; }
.trip-actions { margin-top: 2px; }
@media (max-width: 640px) {
  .trip { padding: 14px; }
  .trip-spent { font-size: 18px; }
}

/* ----- LHDN tax relief (views/tax.js); its PDF is made on the server (server/reports.py) ----- */
/* each relief one row, like a trip's categories (every other one shaded), with a thin bar for its limit; tapping
   it opens its parts under it */
.tax-relief { border-radius: var(--radius-xs); }
.tax-reliefs > .tax-relief:nth-child(even) { background: var(--stripe); }
.tax-relief.open { box-shadow: inset 0 0 0 1px var(--border); }
.tax-relief-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border: 0; border-radius: inherit;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; }
.tax-relief-head:focus-visible { outline: 2.5px solid var(--accent); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .tax-relief-head:hover { background: color-mix(in srgb, var(--text) 5%, transparent); } }
.tax-relief-name { min-width: 0; font-weight: 600; }
.tax-relief-name .badge { vertical-align: 1px; }
.tax-count { min-width: 22px; text-align: right; }
.tax-amount { display: flex; flex-direction: column; align-items: flex-end; min-width: 96px; line-height: 1.3; text-align: right; }
.tax-amount .num { font-weight: 650; }
.tax-relief-head .fold-chevron { display: inline-flex; color: var(--muted); transition: transform 160ms ease-out; }
.tax-relief-head[aria-expanded="true"] .fold-chevron { transform: rotate(180deg); }
.tax-relief > .meter { height: 4px; margin: -3px 38px 9px 48px; }  /* under the name, as wide as the row's text */
.tax-relief-body { display: flex; flex-direction: column; gap: 4px; padding: 0 38px 10px 48px; }
.tax-parts { display: flex; flex-direction: column; }
.tax-part-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0; }
.tax-part-row + .tax-part-row { border-top: 1px solid var(--border); }
.tax-part-name { font-size: 13px; font-weight: 600; }
.tax-receipts { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; vertical-align: -1px; }
.tax-other { display: inline-flex; align-items: center; gap: 8px; }
.tax-note details { margin-top: 4px; }
.tax-note summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent-ink); }
.tax-note ul { margin: 4px 0 0; padding-left: 18px; }
.tax-box { display: inline-flex; align-items: center; gap: 6px; }
.tax-box .prefix { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.tax-box .input { width: 130px; text-align: right; }
.tax-box.count .input { width: 76px; }
.tax-icon { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--border); }
button.badge.likely { border: 0; cursor: pointer; font: inherit; font-size: 11.5px; font-weight: 650; vertical-align: 1px; }
.tax-bottom { justify-content: flex-end; margin-top: 12px; }
.tax-pick { max-height: min(52vh, 460px); overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tax-summary tr.total td { border-top: 2px solid var(--border-strong); }
@media (max-width: 640px) {
  .page-head > .row.tax-actions { flex-wrap: wrap; }
  .page-head > .row.tax-actions > .select { flex: 1 1 100%; }  /* the year on its own line, the button under it */
}

/* ----- the first-time tour (tour.js): everything dimmed but one thing, and a card that explains it ----- */
.tour { position: fixed; inset: 0; z-index: 70; }
.tour-blocker { position: absolute; inset: 0; }  /* the page waits while the tour shows it */
.tour-spot { position: fixed; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-wash), 0 0 0 9999px rgba(6, 20, 19, 0.55);
  transition: top 420ms var(--ease-out), left 420ms var(--ease-out), width 420ms var(--ease-out), height 420ms var(--ease-out); }
.tour-spot.center { box-shadow: 0 0 0 9999px rgba(6, 20, 19, 0.55); }
/* the card stands out from the page under it: a teal outline and a soft halo (step 17a) */
.tour-card { position: fixed; width: 340px; max-width: calc(100vw - 24px); display: flex; flex-direction: column; gap: 10px;
  padding: 18px 18px 14px; background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 0 0 5px var(--accent-wash), 0 18px 48px rgba(0, 0, 0, 0.35); outline: 0; animation: tour-in 360ms var(--ease-out) both; }
@keyframes tour-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.tour-part { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 650; color: var(--accent-ink); }
.tour-part span:last-child { color: var(--muted); font-weight: 600; }
.tour-card h2 { font-size: 17px; letter-spacing: -0.01em; }
.tour-card p { color: var(--text-2); }
.tour-dots { display: flex; flex-wrap: wrap; gap: 4px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--border-strong); transition: width 240ms var(--ease-out), background-color 240ms; }
.tour-dots i.done { background: color-mix(in srgb, var(--brand) 45%, var(--surface)); }
.tour-dots i.on { width: 18px; background: var(--brand); }
.tour-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 2px; }
.tour-actions .skip { margin-right: auto; padding-left: 0; color: var(--text-2); }
/* Next (and Done) glows, and a ring keeps rising off it like the one round the logo on the login page's statement
   story, so the way on is plain; on a stop with its own button (the Family steps, step 17e), that button glows */
.tour-card .btn.primary { position: relative; box-shadow: 0 0 16px -2px color-mix(in srgb, var(--accent) 60%, transparent); }
.tour-card .btn.primary::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  animation: tour-glow 2.4s ease-out 0.5s infinite; }
.tour-do { min-height: 38px; margin: 2px 0; }
@keyframes tour-glow { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  to { box-shadow: 0 0 0 11px color-mix(in srgb, var(--accent) 0%, transparent); } }
@media (max-width: 640px) {
  .tour-card { left: 12px; right: 12px; width: auto; max-width: none; padding: 16px 16px 12px; }
  /* room under the page while the tour shows, so what it shows near the end of a short page can still scroll up
     under the top bar instead of under the card (step 17e) */
  body.touring .main { padding-bottom: 75vh; }
}
@media (prefers-reduced-motion: reduce) {
  .tour-spot { transition: none; }
  .tour-card, .tour-dots i, .tour-card .btn.primary::after { animation: none; transition: none; }
}

/* ----- responsive ----- */
@media (max-width: 1240px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-wide, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 24px 26px 100px; }
  .app-header { padding-left: 26px; padding-right: 26px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(310px, 86vw); z-index: 55; transform: translateX(-100%);
    transition: transform 260ms var(--ease-drawer); padding: calc(18px + var(--sat)) 14px calc(16px + var(--sab)); box-shadow: none; }
  .sidebar.open { transform: none; box-shadow: 0 0 48px rgba(0, 0, 0, 0.3); }
  .app-header { padding: var(--sat) 14px 0; min-height: calc(58px + var(--sat)); }
  .app-header .brand { display: flex; }
  .app-header .crumbs { display: none; }
  .main { padding: 18px 16px calc(var(--tabbar-h) + 92px + var(--sab)); }
  .chat-bubble { bottom: calc(var(--tabbar-h) + 16px + var(--sab)); right: 16px; width: 54px; height: 54px; }
  .toasts { left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 80px + var(--sab)); max-width: none; }
  .kv { grid-template-columns: 110px 1fr; }
  body.chat-open .toasts { right: 12px; }
  .hide-mobile { display: none; }
  .table td, .table th { padding: 10px 8px; }
  .header-actions .btn.primary .label { display: none; }
  .header-actions .lang-select { display: none; }
  .header-actions .lang-toggle { display: inline-flex; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* ----- hosted mode: login, sign-up, recovery kit ----- */
/* desktop: the deep teal panel (three short stories that play in turn) beside the form; the panel is the wider side */
.auth-page { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(0, 7fr) minmax(420px, 5fr); background: var(--page); }
.auth-cover { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 22px; padding: calc(32px + var(--sat)) clamp(32px, 4vw, 64px) 32px;
  background: var(--panel); color: var(--panel-ink); }
.auth-cover::before { content: ""; position: absolute; left: -20%; top: -30%; width: 80%; height: 80%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(94, 234, 212, 0.16), transparent); }
.auth-cover::after { content: ""; position: absolute; right: -180px; bottom: -160px; width: 560px; height: 560px; border-radius: 50%; pointer-events: none;
  background: repeating-radial-gradient(circle, transparent 0 15px, rgba(234, 246, 244, 0.06) 15px 16px); }
.auth-cover > * { position: relative; z-index: 1; }
.auth-cover .brand { color: var(--panel-ink); padding: 0; align-self: flex-start; }
.auth-cover .brand-tag { color: var(--panel-muted); }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.home-link { display: inline-flex; align-items: center; gap: 7px; color: var(--panel-ink); font-weight: 600; font-size: 14px; text-decoration: none;
  padding: 7px 12px; border: 1px solid rgba(234, 246, 244, 0.25); border-radius: 999px; }
@media (hover: hover) and (pointer: fine) { .home-link:hover { background: rgba(234, 246, 244, 0.08); } }
.auth-cover h2 { font-size: clamp(28px, 2.9vw, 42px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.06; }
.auth-cover h2 .soft { color: var(--mint); }
.auth-cover .lede { color: var(--panel-muted); font-size: 15px; max-width: 48ch; }
.auth-cover :focus-visible { outline-color: var(--mint); }

/* the stories: stacked in one grid cell (so the panel never jumps), the current one fades and rises in */
.story { flex: 1; display: flex; flex-direction: column; gap: 22px; min-height: 0; }
.story-stage { flex: 1; display: grid; align-items: center; }
.story-slide { grid-area: 1 / 1; display: flex; flex-direction: column; gap: 18px; opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity 360ms var(--ease-out), transform 460ms var(--ease-out), visibility 0s linear 460ms; }
.story-slide.is-active { opacity: 1; visibility: visible; transform: none;
  transition: opacity 520ms var(--ease-out) 140ms, transform 620ms var(--ease-out) 140ms, visibility 0s; }
.story-slide.is-active [data-in] { animation: story-in 620ms var(--ease-out) both; animation-delay: calc(180ms + var(--i, 0) * 80ms); }
@keyframes story-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes story-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes story-grow { from { transform: scaleX(0); } }
@keyframes story-pop { from { opacity: 0; transform: translate(-50%, -50%) scale(0.6); } }
@keyframes story-slide-in { from { opacity: 0; transform: translateX(-12px); } }
@keyframes story-float { from { transform: translateY(-5px); } to { transform: translateY(6px); } }
@keyframes story-pulse { from { transform: scale(1); opacity: 0.55; } to { transform: scale(1.35); opacity: 0; } }

/* 1. your money: a balance, transactions and budgets, with the tools floating around them */
.story-demo { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); grid-template-areas: "bal txn" "bud txn";
  gap: 14px; max-width: 860px; padding: 22px 0 30px; }
.demo-card { border: 1px solid var(--panel-rule); border-radius: 14px; padding: 16px; background: rgba(255, 255, 255, 0.05); }
.demo-card .label { font-size: 12.5px; color: var(--panel-muted); font-weight: 600; }
.demo-card .big { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 6px; }
.demo-balance { grid-area: bal; }
.demo-txns { grid-area: txn; }
.demo-budgets { grid-area: bud; display: flex; flex-direction: column; gap: 10px; }
.demo-balance > svg { display: block; width: 100%; height: 56px; }
.spark-fill { fill: rgba(94, 234, 212, 0.14); }
.spark-line { fill: none; stroke: var(--mint); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 1; }
.story-slide.is-active .spark-line { animation: story-draw 1.4s var(--ease-out) 0.45s both; }
.demo-up { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--mint); }
.demo-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.demo-list li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--panel-rule); }
.demo-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.story-slide.is-active .demo-list li { animation: story-slide-in 480ms var(--ease-out) both; animation-delay: calc(520ms + var(--i) * 110ms); }
.demo-list .dot { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(94, 234, 212, 0.12); color: var(--mint); }
.demo-list .in { color: #8ff0c3; font-weight: 650; }
.demo-meter { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--panel-ink); }
.demo-meter .row span:last-child { color: var(--panel-muted); }
.demo-meter .track { height: 6px; border-radius: 4px; background: rgba(234, 246, 244, 0.12); overflow: hidden; }
.demo-meter .track i { display: block; height: 100%; width: var(--w); border-radius: 4px; background: var(--mint); transform-origin: left; }
.demo-meter .track i.warn { background: #f0b429; }
.story-slide.is-active .demo-meter .track i { animation: story-grow 900ms var(--ease-out) both; animation-delay: calc(700ms + var(--i) * 120ms); }
.demo-chip { position: absolute; z-index: 2; display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px 7px 8px; border-radius: 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.45); font-size: 13px; font-weight: 650; }
.demo-chip .icon-svg { color: var(--accent); }
.demo-chip.c1 { top: 4px; right: 12%; }
.demo-chip.c2 { bottom: 8px; left: 22%; }
.demo-chip.c3 { bottom: 64px; right: 7%; }
.story-slide.is-active .demo-chip { animation: story-in 600ms var(--ease-out) both, story-float 4.2s ease-in-out 1.4s infinite alternate; animation-delay: 1.1s, 1.7s; }
.story-slide.is-active .demo-chip.c2 { animation-delay: 1.25s, 2.2s; animation-duration: 600ms, 5s; }
.story-slide.is-active .demo-chip.c3 { animation-delay: 1.4s, 1.9s; animation-duration: 600ms, 4.6s; }
.demo-note { font-size: 12px; color: var(--panel-muted); }

/* 2. every statement: the file types flow into Monurus, and what that gives you */
.story-flow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: center; max-width: 960px; }
.story-flow .hub { position: relative; aspect-ratio: 1; width: 100%; max-width: 420px; margin: 0 auto; }
/* the lines are in the hub's 100x100 box (always square), so their widths and dashes are in its units: 0.6 is 2.5px at
   the full 420px */
.story-flow .lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.story-flow .lines path { fill: none; stroke-width: 0.6; stroke-linecap: round; }
.story-flow .lines path.base { stroke: rgba(234, 246, 244, 0.18); stroke-dasharray: 1.2 1.7; }
.story-flow .lines path.draw { stroke: var(--mint); stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0.5; }
.story-slide.is-active .lines path.draw { animation: story-draw 900ms var(--ease-out) both; animation-delay: calc(650ms + var(--i) * 110ms); }
/* then, for as long as the story shows, a spark runs down each line into the logo, one after another round the
   circle; it starts under the file's tile and ends under the logo (the pause button stops it) */
.story-flow .sparks { filter: drop-shadow(0 0 3px rgba(94, 234, 212, 0.95)); }
.story-flow .sparks path { stroke: #dcfff9; stroke-width: 1; stroke-dasharray: 0.16 1; stroke-dashoffset: 0.16; }
.story-slide.is-active .sparks path { animation: story-spark 1.8s cubic-bezier(0.5, 0, 0.8, 0.6) infinite; animation-delay: calc(1.5s + var(--i) * 300ms); }
@keyframes story-spark { from { stroke-dashoffset: 0.16; } to { stroke-dashoffset: -0.7; } }
.story.stopped .sparks path, .story.stopped .hub-center::after { animation-play-state: paused; }
.story-flow .node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: 96px; text-align: center; }
.story-slide.is-active .story-flow .node { animation: story-pop 520ms cubic-bezier(0.34, 1.56, 0.64, 1) both; animation-delay: calc(250ms + var(--i) * 80ms); }
.story-flow .node .tile { width: 46px; height: 46px; padding: 0; border-radius: 13px; display: grid; place-items: center; background: var(--surface); color: var(--accent);
  border: 1px solid var(--border); box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.5); }
.story-flow .node > span:last-child { font-size: 12px; font-weight: 650; color: var(--panel-ink); line-height: 1.25; }
.story-flow .hub-center { position: absolute; left: 50%; top: 50%; width: 28%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 28%;
  display: grid; place-items: center; background: #0a1716; border: 1px solid rgba(94, 234, 212, 0.35); box-shadow: 0 0 0 6px rgba(94, 234, 212, 0.08); }
.story-flow .hub-center img { width: 70%; height: 70%; }
.story-flow .hub-center::after { content: ""; position: absolute; inset: -6px; border-radius: 30%; border: 2px solid var(--mint); opacity: 0; }
.story-slide.is-active .story-flow .hub-center::after { animation: story-pulse 2.4s ease-out 1.5s infinite; }
.story-points, .story-locks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.story-points li, .story-locks li { display: grid; grid-template-columns: 38px 1fr; gap: 2px 12px; align-items: start; align-content: start; padding: 12px 14px;
  border: 1px solid var(--panel-rule); border-radius: 14px; background: rgba(255, 255, 255, 0.05); }
/* padding 0: the figures' .tile padding would push the icon to the tile's corner */
.story-points .tile, .story-locks .tile { grid-row: span 2; width: 38px; height: 38px; padding: 0; border-radius: 11px; display: grid; place-items: center;
  background: rgba(94, 234, 212, 0.12); color: var(--mint); }
.story-points b, .story-locks b { font-size: 14px; font-weight: 700; }
.story-points span:last-child, .story-locks span:last-child { font-size: 13px; color: var(--panel-muted); line-height: 1.45; }

/* 3. locked with your password: six reasons in two columns */
.story-locks { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 720px; }
@media (min-width: 1360px) { .story-locks { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 960px; } }

/* the tabs under the stories: each with its progress line, and the pause button */
.story-nav { display: flex; align-items: flex-end; gap: 14px; padding-top: 18px; border-top: 1px solid var(--panel-rule); }
.story-tabs { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.story-tabs button { display: flex; flex-direction: column; align-items: stretch; gap: 9px; padding: 6px 0; border: 0; background: none; color: var(--panel-muted);
  font: inherit; font-size: 13.5px; font-weight: 600; text-align: left; cursor: pointer; transition: color 160ms; }
.story-tabs button[aria-selected="true"] { color: var(--panel-ink); }
@media (hover: hover) and (pointer: fine) { .story-tabs button:hover { color: var(--panel-ink); } }
.story-progress { display: block; height: 3px; border-radius: 3px; background: rgba(234, 246, 244, 0.16); overflow: hidden; }
.story-progress i { display: block; height: 100%; background: var(--mint); transform-origin: left; animation: story-fill var(--story-ms) linear both; }
.story.paused .story-progress i { animation-play-state: paused; }
.story.still .story-progress i { animation: none; }
@keyframes story-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.story-pause { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(234, 246, 244, 0.25);
  background: transparent; color: var(--panel-ink); cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .story-pause:hover { background: rgba(234, 246, 244, 0.08); } }
/* reduced motion: the stories still switch from the tabs, but nothing rises, draws or floats */
@media (prefers-reduced-motion: reduce) {
  .story-slide, .story-slide.is-active { transition: opacity 200ms linear, visibility 0s; transform: none; }
  .story-slide.is-active *, .story-slide.is-active *::after { animation: none !important; }
}
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 460px; padding: 34px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 25px; font-weight: 700; letter-spacing: -0.02em; }
.auth-card > p.secondary { margin-top: -10px; color: var(--accent-ink); font-weight: 500; }
.auth-brand { display: none; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; font-size: 14px; }
/* passkeys (step 17): "or", then the passkey button, under the login form */
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn.auth-passkey { width: 100%; justify-content: center; }
.auth-foot { display: flex; align-items: center; gap: 8px; }
/* an input with its icon in front, and the password's show/hide eye */
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .icon-svg { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.input-icon > .input { width: 100%; padding-left: 42px; min-height: 46px; }
.input-icon > .eye { position: absolute; right: 5px; }
.input-icon > .input.with-eye { padding-right: 48px; }
.auth-card .btn.primary { min-height: 48px; font-size: 16px; }
.form-error { color: var(--critical-text); font-weight: 600; }
.toggle.consent { align-items: flex-start; }
.toggle.consent input { margin-top: 3px; }
.recovery-code { font-family: var(--mono); font-size: 19px; font-weight: 600; letter-spacing: 0.05em; text-align: center; padding: 16px 12px; border-radius: var(--radius);
  background: var(--surface-2); border: 1.5px dashed var(--border-strong); user-select: all; word-break: break-all; }
/* narrower desktops: the stories keep their main parts */
@media (max-width: 1280px) {
  .story-flow { grid-template-columns: minmax(0, 1fr); }
  .story-flow .hub { max-width: 280px; }
  .story-points li:nth-child(n + 2) { display: none; }
  .story-locks { grid-template-columns: minmax(0, 1fr); }
  .story-locks li:nth-child(n + 5) { display: none; }
}
@media (max-width: 1100px) {
  .auth-page { grid-template-columns: minmax(0, 1fr) minmax(400px, 1fr); }
  .story-demo { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bal" "txn"; }
  .demo-budgets, .demo-chip.c3 { display: none; }
  .story-points { display: none; }
}
/* phones: the panel becomes a band at the top with the logo, the headline and the way home */
@media (max-width: 860px) {
  .auth-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-cover { padding: calc(18px + var(--sat)) 20px 24px; gap: 12px; }
  .auth-cover h2 { font-size: 27px; margin-top: 8px; }
  .auth-cover::after { width: 300px; height: 300px; right: -110px; bottom: auto; top: -40px; }
  .auth-main { justify-content: flex-start; padding: 16px 12px calc(28px + var(--sab)); }
  .auth-card { padding: 24px 20px; box-shadow: var(--shadow); }
}

/* ----- a bank account: the add/edit form, and the welcome steps before the first import ----- */
.account-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.account-form > .form-error, .account-form > .row, .account-form > .color-pick { grid-column: 1 / -1; }
/* the account's colour: 10 round swatches; one another account has is marked with a small ring */
.color-pick { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.color-pick legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch-option { position: relative; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.swatch-option input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.swatch-option span { width: 26px; height: 26px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform 120ms var(--ease-out), box-shadow 140ms; }
.swatch-option.used span { box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4px var(--c); background: color-mix(in srgb, var(--c) 30%, var(--surface)); }
.swatch-option input:checked + span { background: var(--c); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); transform: scale(1.04); }
.swatch-option input:focus-visible + span { outline: 2.5px solid var(--accent); outline-offset: 5px; }
@media (hover: hover) and (pointer: fine) { .swatch-option:hover span { transform: scale(1.1); } }
@media (pointer: coarse) { .swatch-option { width: 40px; height: 40px; } .swatch-option span { width: 30px; height: 30px; } }
/* Settings: each account's icon on a wash of its colour */
.icon-bubble.acct-bubble { background: color-mix(in srgb, var(--c) 16%, var(--surface)); border-color: color-mix(in srgb, var(--c) 45%, var(--surface));
  color: color-mix(in srgb, var(--c) 70%, var(--text)); }
.list-item .account-form { padding: 4px 0; }
.welcome { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.welcome-head { display: flex; flex-direction: column; gap: 6px; }
.welcome-head .big { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; background: var(--tile-1); color: var(--tile-1-ink); margin-bottom: 6px; }
.welcome-head h2 { font-size: 23px; font-weight: 700; letter-spacing: -0.02em; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps > li { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.steps > li.current { border-color: var(--brand); box-shadow: var(--shadow); }
.steps > li.todo { color: var(--muted); }
.step-title { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 15px; }
.step-num { width: 30px; height: 30px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.steps > li.current .step-num { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.steps > li.done .step-num { background: var(--good-wash); color: var(--good-text); border-color: transparent; }
.steps > li > :not(.step-title) { margin-left: 42px; }

.stack.tight { gap: 6px; }
.usage { display: flex; flex-direction: column; gap: 6px; }
.usage .bar-track { grid-column: auto; }
.bar-fill.over { background: var(--warning); }
.goal h2 { margin: 0; }
.bar-fill.done { background: var(--good); }
.tile-mini { padding: 11px 13px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }

/* calendar: spending shaded in 5 steps of one colour (lighter = less), expected items as chips */
.cal-title { min-width: 160px; text-align: center; font-weight: 650; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding: 12px; }
.cal-wd { font-size: 12px; color: var(--muted); text-align: center; padding: 4px 0; font-weight: 600; }
.cal-day { min-height: 84px; display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 7px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font: inherit; text-align: left; cursor: pointer; }
.cal-day:disabled { cursor: default; }
.cal-day.cal-blank { background: transparent; border-color: transparent; }
@media (hover: hover) and (pointer: fine) { .cal-day:not(:disabled):hover { border-color: var(--border-strong); } }
.cal-day.today { border-color: var(--brand); border-width: 2px; }
.cal-day.picked { outline: 2.5px solid var(--accent); outline-offset: -2px; }
.cal-day.not-yet .cal-num { color: var(--muted); }
.cal-num { font-size: 12px; font-weight: 700; }
/* the day's net in a light pill, so green (more came in than went out) and red read on any shade; the day you picked
   also shows what came in and went out (computers; on a phone that's in the day's card under the grid) */
.cal-net { align-self: flex-start; max-width: 100%; padding: 1px 7px; border-radius: 99px; font-size: 12px; font-weight: 700;
  background: color-mix(in srgb, var(--surface) 90%, transparent); color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-net.pos { color: var(--good-text); }
.cal-net.neg { color: var(--critical-text); }
.cal-inout { display: flex; flex-direction: column; padding: 0 2px; font-size: 11px; font-weight: 600; line-height: 1.35; color: var(--text-2); }
.cal-inout > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-day-figures { padding-bottom: 0; }
.cal-day-figures .ring-figures { margin-bottom: 0; }
.shade-1 { background: color-mix(in srgb, var(--heat) 9%, var(--surface)); }
.shade-2 { background: color-mix(in srgb, var(--heat) 18%, var(--surface)); }
.shade-3 { background: color-mix(in srgb, var(--heat) 28%, var(--surface)); }
.shade-4 { background: color-mix(in srgb, var(--heat) 40%, var(--surface)); }
.shade-5 { background: color-mix(in srgb, var(--heat) 54%, var(--surface)); }
.cal-legend { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; }
.cal-legend i { display: inline-block; width: 15px; height: 15px; border-radius: 3px; border: 1px solid var(--border); }
.cal-chip { display: flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 5px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); min-width: 0; }
.cal-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.cal-chip.income { background: var(--good-wash); color: var(--good-text); }
.cal-chip.card { background: var(--warning-wash); color: var(--warning-text); }
.cal-chip.cancelling .cal-chip-name { text-decoration: line-through; }
.cal-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-bottom: 10px; }
.cal-note { margin-top: 8px; }
.cal-day-list { margin-top: 12px; }
.cal-day-expected { padding-bottom: 0; }
.cal-day-expected .cal-chip { padding: 4px 8px; font-size: 12px; }
.cal-net.cal-short, .cal-dots { display: none; }
/* phones: the same grid, small (about 40% of the screen), with the day's list right under it */
@media (max-width: 760px) {
  .cal-nav .cal-title { min-width: 0; flex: 1; }
  .cal-grid { gap: 3px; padding: 6px; }
  .cal-wd { font-size: 10.5px; padding: 1px 0; }
  .cal-day { min-height: 0; height: 44px; padding: 3px 2px; gap: 1px; align-items: center; text-align: center; border-radius: 6px; }
  .cal-day.today { border-width: 2px; }
  .cal-num { font-size: 11px; line-height: 1.2; }
  .cal-net, .cal-inout, .cal-day .cal-chip, .cal-more { display: none; }
  .cal-net.cal-short { display: block; align-self: center; padding: 0 3px; border-radius: 4px; font-size: 10px; line-height: 1.3; }
  .cal-dots { display: flex; gap: 2px; justify-content: center; margin-top: auto; }
  .cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-2); }
  .cal-dots i.income { background: var(--good); }
  .cal-dots i.card { background: var(--warning); }
  .cal-legend i { width: 12px; height: 12px; }
}

/* ----- phones: the native-feel baseline (from the mobile-native skill) ----- */
html {
  -webkit-tap-highlight-color: transparent;  /* the grey flash on tap: every control has its own :active instead */
  -webkit-text-size-adjust: 100%;            /* no font inflation in landscape */
}
@media (display-mode: standalone) {
  html, body { overscroll-behavior: none; }  /* installed app: no whole-page rubber band */
}
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn.small { min-height: 38px; padding: 6px 12px; }
}
/* iPhones and iPads zoom into a text box whose text is under 16px, and don't zoom back out. Only iOS knows
   -webkit-touch-callout, so only there do text boxes keep 16px; Android phones get the smaller size below. */
@supports (-webkit-touch-callout: none) {
  @media (pointer: coarse) { input, select, textarea, .input, .select { font-size: 16px !important; } }
}
button, a, .btn, .chip, .nav-link, .tab, [role="button"] { touch-action: manipulation; }
button, .btn, .chip, .nav-link, .tab, .badge { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }
@media (prefers-reduced-motion: reduce) {
  .btn:active:not(:disabled) { transform: none; }
  .sidebar, .toast, .modal, .drawer, .chat-popup { transition: none; }
}
.icon-svg { display: block; flex: none; }

/* the bottom tab bar (phones) */
.tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(var(--tabbar-h) + var(--sab)); padding-bottom: var(--sab);
  background: color-mix(in srgb, var(--surface) 95%, transparent); border-top: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.3) blur(12px); backdrop-filter: saturate(1.3) blur(12px);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0;
  border: 0; background: none; color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.tab > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tab.on { color: var(--text); }
.tab.on .tab-icon { color: var(--brand); background: var(--accent-soft); }
.tab-icon { position: relative; display: inline-flex; padding: 3px 14px; border-radius: 999px; transition: transform 120ms var(--ease-out), background-color 160ms; }
.tab:active .tab-icon { transform: scale(0.92); }
.tab-dot { position: absolute; top: 0; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--critical); border: 2px solid var(--surface); }
/* after the rule above, or its display: none wins: the tab bar (and its Menu button, the way to every other page) shows on phones */
@media (max-width: 860px) { .tabbar { display: grid; } }

/* transactions on phones: each row a two-line entry (merchant and amount, then category and balance) */
@media (max-width: 640px) {
  .txn-table thead { display: none; }
  .txn-table, .txn-table tbody { display: block; }
  .txn-table tr { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "check main amount" "check cat balance";
    gap: 7px 10px; padding: 13px 14px; align-items: center; }
  .txn-table tbody tr:nth-child(even) { background: var(--stripe); }
  .txn-table tbody tr > td { background: none !important; }  /* the row carries the stripe or the selection */
  .txn-table tbody tr.selected { background: var(--accent-wash); }
  .txn-table td { display: block; padding: 0 !important; border: 0; }
  .txn-table td:nth-child(1) { grid-area: check; align-self: start; padding-top: 2px; }
  .txn-table td:nth-child(2) { display: none; }
  .txn-table td:nth-child(3) { grid-area: main; min-width: 0; }
  .txn-table td:nth-child(4) { grid-area: cat; min-width: 0; }
  .txn-table td:nth-child(5) { grid-area: amount; font-size: 15px; }
  .txn-table td:nth-child(6) { grid-area: balance; font-size: 12.5px; }
  .txn-table .txn-sub { max-width: 100%; }
  .txn-table .cat-select { max-width: 100%; }
  .txn-table .mobile-date { display: inline; }
  .txn-table tr.clickable:active { background: var(--surface-2); }
}
.mobile-date { display: none; }
.money-short { display: none; }
/* ----- phones: smaller type and icons and tighter spacing, so more fits on the screen (dev phase 2, step 4) ----- */
@media (max-width: 640px) {
  :root { --tabbar-h: 58px; --radius: 12px; }
  body { font-size: 12.5px; line-height: 1.5; }
  .small { font-size: 11.5px; }
  h1 { font-size: 18px; }
  h2 { font-size: 13.5px; }
  .main { padding: 14px 12px calc(var(--tabbar-h) + 84px + var(--sab)); }
  .app-header { min-height: calc(50px + var(--sat)); padding: var(--sat) 12px 0; }
  .app-header .brand img { width: 24px; height: 24px; }
  .app-header .brand-word { font-size: 15.5px; }
  .header-actions { gap: 6px; }
  .header-actions .btn { min-height: 34px; }
  .header-actions .btn.icon-round { width: 34px; height: 34px; }
  .header-actions .btn.primary { padding: 0 10px; }
  .page-head { margin-bottom: 12px; gap: 10px; }
  .page-head h1 { font-size: 18px; }
  .page-head p { margin-top: 3px; font-size: 12px; }
  .page-head > .row { width: 100%; flex-wrap: wrap; }  /* long Malay labels go onto a second line */
  .page-head > .row > .select, .page-head > .row > .btn { flex: 1; }
  .dash { gap: 12px; }

  .ring-figures { padding: 6px 8px; gap: 4px; }
  .ring-figures strong { font-size: 12.5px; }
  .ring-figures span { font-size: 10.5px; }
  .section, .dash-row { margin-top: 12px; }
  .grid, .dash-row, .dash-row > .stack { gap: 12px; }
  .card-head { padding: 10px 12px; gap: 8px; }
  .card-head .sub { margin-top: 2px; font-size: 11.5px; }
  .card-body { padding: 10px 12px 12px; }
  .card-pad { padding: 12px; }
  .icon-tile { width: 30px; height: 30px; border-radius: 9px; }
  .icon-tile .icon-svg { width: 16px; height: 16px; }
  .icon-bubble { width: 32px; height: 32px; border-radius: 9px; font-size: 15px; }
  .icon-bubble .icon-svg { width: 16px; height: 16px; }
  .list-item { gap: 10px; padding: 7px 8px; }
  .filters { gap: 8px; margin-bottom: 14px; }
  .filters > .input, .filters > .select { flex: 1 1 140px; }
  .banner { flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
  .household-banner > .grow { flex-basis: calc(100% - 28px); }  /* the words across, the button under them */
  .household-banner > .btn { margin-left: 28px; }
  .money-input .input { width: 100%; }
  .tile { padding: 10px 12px; }
  .tile .label { font-size: 11.5px; }
  .tile .value { font-size: 16px; }
  /* a strip of three figures (Budgets, Recurring, Debts, Tax relief, the monthly review): three small ones in a row
     (step 17a), amounts from RM 1,000 without the sen, the line under them two lines at most */
  .grid-3:has(> .card.tile) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3 > .card.tile { padding: 8px 9px; }
  .grid-3 > .card.tile .label { font-size: 10.5px; line-height: 1.3; }
  .grid-3 > .card.tile .value { font-size: 13.5px; margin-top: 2px; white-space: nowrap; }
  .grid-3 > .card.tile .delta { font-size: 10px; line-height: 1.3; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden; }
  .tile .money-full { display: none; }
  .tile .money-short { display: inline; }
  /* a budget: its View button goes under the figures instead of taking a column of its own */
  .budget-item { flex-wrap: wrap; row-gap: 2px; }
  .budget-item > .grow { flex: 1 1 calc(100% - 42px); }
  .budget-item > .btn { align-self: flex-start !important; margin-left: 32px; }
  /* the bank accounts: thin rows, one under another */
  .acct-grid { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .acct-card { padding: 7px 10px 8px; }
  .acct-value { font-size: 14px; }
  .acct-totals { gap: 2px 14px; margin-top: 6px; padding: 6px 10px; font-size: 11.5px; }
  /* charts and lists */
  .ring-wrap { width: min(180px, 100%); }
  .ring-wrap .chart-box { height: 180px !important; }  /* its canvas gets a height from the code; smaller here */
  .ring-center strong { font-size: 15px; }
  .ring-center span { font-size: 11px; }
  .cat-list { margin-top: 8px; }
  .cat-list li { gap: 4px 8px; padding: 5px 8px; font-size: 12.5px; }
  .cat-list .share { font-size: 11.5px; }
  .segmented button { padding: 4px 10px; font-size: 12px; }
  .chart-legend { gap: 4px 12px; margin-bottom: 8px; font-size: 12px; }
  .bar-list { gap: 10px; }
  table.table { font-size: 12.5px; }
  .table th { font-size: 11px; }
  .txn-table tr { gap: 4px 10px; padding: 8px 10px; }
  .txn-table td:nth-child(5) { font-size: 13.5px; }
  .txn-sub { font-size: 11px; }
  /* the balance's account name gives way to the category picker beside it */
  .txn-table .acct-tag { display: block; max-width: 104px; margin-left: auto; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; text-align: right; }
  .txn-table .acct-tag .legend-swatch { margin-right: 5px; vertical-align: -1px; }
  /* a folding card's title has the whole line; Chart / Table goes under it */
  .card.foldable .fold-head { flex-basis: 100%; }
  .empty { padding: 32px 16px; }
  .welcome-head h2 { font-size: 20px; }
  .step-title { font-size: 14px; }
  .modal-head, .modal-body, .modal-foot, .drawer-head, .drawer-body { padding-left: 16px; padding-right: 16px; }
  .btn { font-size: 12.5px; }
  /* the tab bar and the chat bubble */
  .tab { gap: 2px; font-size: 10.5px; }
  .tab-icon { padding: 2px 12px; }
  .tab-icon .icon-svg { width: 20px; height: 20px; }
  .chat-bubble { right: 14px; bottom: calc(var(--tabbar-h) + 14px + var(--sab)); width: 50px; height: 50px; }
  .chat-glyph { width: 24px; height: 24px; }
  .toasts { bottom: calc(var(--tabbar-h) + 72px + var(--sab)); }
  /* the chat: a sheet over the bottom three-quarters, the page dimmed above it; drag it down (or tap above) to close */
  .chat-scrim { display: block; position: fixed; inset: 0; z-index: 43; background: rgba(6, 20, 19, 0.4); touch-action: none;
    transition: opacity 200ms var(--ease-out); }
  @starting-style { .chat-scrim { opacity: 0; } }
  .chat-popup, .chat-popup.expanded { inset: auto 0 0 0; width: auto; max-width: none; height: 75dvh; max-height: calc(100dvh - var(--sat) - 12px);
    padding-bottom: var(--sab); border-width: 1px 0 0; border-radius: 18px 18px 0 0; transform-origin: bottom center;
    transition: transform 260ms var(--ease-drawer); }
  @starting-style { .chat-popup { opacity: 1; transform: translateY(100%); } }
  .chat-popup.dragging { transition: none; }
  .sheet-handle { display: flex; justify-content: center; padding: 8px 0 2px; background: var(--surface-2); touch-action: none; cursor: grab; }
  .sheet-handle span { width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); }
  .chat-popup-head { padding-top: 4px; touch-action: none; }
  .chat-resize, .chat-size { display: none; }
  .chat-log { padding: 12px; gap: 12px; }
  .chat-input { padding: 10px; }
}
/* touch screens: controls stay easy to hit, just not oversized (iPhones keep 16px text boxes: see above) */
@media (max-width: 640px) and (pointer: coarse) {
  .btn { min-height: 35px; }
  .btn.small { min-height: 30px; padding: 3px 9px; }
  .input, .select, textarea.input { min-height: 34px; padding: 5px 10px; font-size: 13.5px; }  /* step 17c: a step shorter */
  .cat-select { min-height: 30px; font-size: 13px; }
  .chip { padding: 3px 9px; font-size: 11.5px; }
}
@media (max-width: 520px) {
  .card.welcome { border: 0; box-shadow: none; background: transparent; padding: 4px 0 0; }
  .account-form .btn.primary { width: 100%; min-height: 48px; font-size: 16px; }
  .steps > li > :not(.step-title) { margin-left: 0; }
}

/* ----- coloured headers (12 Oct 2026, from the owner's picture) -----
   A card's header, or a figure tile, filled with one of the app's colours, with white text, in both themes.
   tone-1 teal, tone-2 terracotta, tone-3 blue, tone-4 sand (the dashboard's figure icons); tone-5 plum, tone-6
   indigo, tone-7 olive for lists that need more (trips, goals). Each is at least 4.5:1 with white, and with the 86%
   white of the line under a title. The icon in a coloured header sits in a brighter tile of the same colour.
   Bank accounts use their own colour, darkened the same way (--acct-mix, --acct-shade). */
:root {
  --on-tone: #fff; --on-tone-2: rgba(255, 255, 255, 0.86);
  --tone-1: #0f766e; --tone-1-end: #0b5c55; --tone-1-tile: #1fa596;
  --tone-2: #a8492a; --tone-2-end: #8a3a1f; --tone-2-tile: #d4693e;
  --tone-3: #2c5c99; --tone-3-end: #224a7d; --tone-3-tile: #4b82cc;
  --tone-4: #86610b; --tone-4-end: #6c4e08; --tone-4-tile: #d9a527;
  --tone-5: #7d4787; --tone-5-end: #643a6d; --tone-5-tile: #a96cb5;
  --tone-6: #4c4796; --tone-6-end: #3d397b; --tone-6-tile: #7671cf;
  --tone-7: #4c6f16; --tone-7-end: #3d5a11; --tone-7-tile: #7ea635;
  --acct-mix: 70%; --acct-shade: #000;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tone-1: #0f564e; --tone-1-end: #0b4039; --tone-1-tile: #1fae98;
    --tone-2: #6e3420; --tone-2-end: #552818; --tone-2-tile: #cf6a3f;
    --tone-3: #1e4676; --tone-3-end: #17375d; --tone-3-tile: #3a77c6;
    --tone-4: #5e4a12; --tone-4-end: #4a3a0e; --tone-4-tile: #e0ac2e;
    --tone-5: #53305c; --tone-5-end: #412548; --tone-5-tile: #a76ab3;
    --tone-6: #34306a; --tone-6-end: #292654; --tone-6-tile: #7a74d0;
    --tone-7: #3a5216; --tone-7-end: #2d4011; --tone-7-tile: #7fa83a;
    --acct-mix: 50%; --acct-shade: #0a1214;
  }
}
:root[data-theme="dark"] {
  --tone-1: #0f564e; --tone-1-end: #0b4039; --tone-1-tile: #1fae98;
  --tone-2: #6e3420; --tone-2-end: #552818; --tone-2-tile: #cf6a3f;
  --tone-3: #1e4676; --tone-3-end: #17375d; --tone-3-tile: #3a77c6;
  --tone-4: #5e4a12; --tone-4-end: #4a3a0e; --tone-4-tile: #e0ac2e;
  --tone-5: #53305c; --tone-5-end: #412548; --tone-5-tile: #a76ab3;
  --tone-6: #34306a; --tone-6-end: #292654; --tone-6-tile: #7a74d0;
  --tone-7: #3a5216; --tone-7-end: #2d4011; --tone-7-tile: #7fa83a;
  --acct-mix: 50%; --acct-shade: #0a1214;
}
.tone { --h: var(--tone-1); --h-end: var(--tone-1-end); --h-tile: var(--tone-1-tile); --h-tile-ink: #fff;
  background: linear-gradient(100deg, var(--h) 0%, var(--h-end) 100%); color: var(--on-tone); }
.tone-2 { --h: var(--tone-2); --h-end: var(--tone-2-end); --h-tile: var(--tone-2-tile); }
.tone-3 { --h: var(--tone-3); --h-end: var(--tone-3-end); --h-tile: var(--tone-3-tile); }
.tone-4 { --h: var(--tone-4); --h-end: var(--tone-4-end); --h-tile: var(--tone-4-tile); --h-tile-ink: #2e2200; }
.tone-5 { --h: var(--tone-5); --h-end: var(--tone-5-end); --h-tile: var(--tone-5-tile); }
.tone-6 { --h: var(--tone-6); --h-end: var(--tone-6-end); --h-tile: var(--tone-6-tile); }
.tone-7 { --h: var(--tone-7); --h-end: var(--tone-7-end); --h-tile: var(--tone-7-tile); }
/* a header on top of its card: over the card's border, its corners rounded with the card's */
.card > .card-head.tone:first-child { margin: -1px -1px 0; border-bottom-color: transparent; border-radius: var(--radius) var(--radius) 0 0; }
.card.folded > .card-head.tone:first-child, .card > .card-head.tone:only-child { border-radius: var(--radius); margin-bottom: -1px; }
.tone h2, .tone h3, .tone strong, .tone .txn-main { color: var(--on-tone); }
.tone .sub, .tone .muted, .tone .secondary, .tone .small, .tone .label { color: var(--on-tone-2); }
.tone .icon-tile { background: var(--h-tile); color: var(--h-tile-ink); }
.tone h2 > .icon-svg:first-child { box-sizing: content-box; flex: none; padding: 7px; border-radius: 9px;
  background: var(--h-tile); color: var(--h-tile-ink); }
.tone .fold-chevron { color: var(--on-tone-2); }
.tone a:not(.btn), .tone .link { color: var(--on-tone); }
.tone .btn { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.32); color: var(--on-tone); box-shadow: none; }
.tone .btn.ghost { background: transparent; border-color: transparent; }
.tone .btn.primary { background: #fff; border-color: #fff; color: var(--h); }
.tone .btn.danger { color: var(--on-tone); }
@media (hover: hover) and (pointer: fine) {
  .tone .btn:hover, .tone .btn.ghost:hover { background: rgba(255, 255, 255, 0.24); }
  .tone .btn.primary:hover { background: rgba(255, 255, 255, 0.88); border-color: transparent; }
}
.tone .segmented { background: rgba(0, 0, 0, 0.2); border-color: rgba(255, 255, 255, 0.16); }
.tone .segmented button { color: var(--on-tone-2); }
.tone .segmented button.on { background: rgba(0, 0, 0, 0.34); color: var(--on-tone); box-shadow: none; }
.tone .badge { background: rgba(255, 255, 255, 0.18); color: var(--on-tone); }
.tone .badge.good, .tone .badge.accent { background: rgba(190, 255, 220, 0.22); }
.tone .badge.warn, .tone .badge.bad { background: rgba(255, 214, 150, 0.26); }
.tone .delta { color: var(--on-tone-2); }
.tone .delta.good, .tone .money-in { color: #c3f7d6; }
.tone .delta.bad { color: #ffd2c9; }
.tone :focus-visible { outline-color: #fff !important; }
/* figure tiles: each its own coloured card (not one bordered strip) */
.grid.tone-tiles:has(> .card.tile) { gap: 12px; background: none; border: 0; border-radius: 0; overflow: visible; box-shadow: none; }
.grid.tone-tiles > .card.tile.tone { border: 0; border-radius: var(--radius); box-shadow: var(--shadow);
  background: linear-gradient(120deg, var(--h) 0%, var(--h-end) 100%); }
.tone-tiles > .tile.tone .value { color: var(--on-tone); }

/* soft colour on a button (Recurring's Yes / Not recurring / Want to cancel / View): the figure icons' washes */
.btn.tint-1 { background: var(--tile-1); border-color: transparent; color: var(--tile-1-ink); }
.btn.tint-2 { background: var(--tile-2); border-color: transparent; color: var(--tile-2-ink); }
.btn.tint-3 { background: var(--tile-3); border-color: transparent; color: var(--tile-3-ink); }
.btn.tint-4 { background: var(--tile-4); border-color: transparent; color: var(--tile-4-ink); }
/* Recurring's Want to cancel: a red outline, "stop this" without shouting (step 17a) */
.btn.danger-outline { background: var(--surface); border-color: color-mix(in srgb, var(--critical) 60%, transparent); color: var(--critical-text); }
@media (hover: hover) and (pointer: fine) { .btn.danger-outline:hover { background: var(--critical-wash); } }
@media (hover: hover) and (pointer: fine) {
  .btn.tint-1:hover, .btn.tint-2:hover, .btn.tint-3:hover, .btn.tint-4:hover { filter: brightness(0.95); }
}

/* tab pages (step 17b, tabs.js): text tabs on a line, the open one teal with a teal bar under it; the row slides
   sideways when it doesn't fit, and the new tab's content slides in from the side it's on */
.tab-pages { margin-top: 18px; }
.dash > .tab-pages { margin-top: 2px; }  /* the dashboard's own gap is enough */
.tabs { display: flex; gap: 2px; margin-bottom: 14px; border-bottom: 1px solid var(--border); overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn { flex: none; position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px 11px; border: 0;
  background: none; color: var(--text-2); font: inherit; font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
  touch-action: manipulation; -webkit-user-select: none; user-select: none; transition: color 140ms; }
.tab-btn[aria-selected="true"] { color: var(--accent-ink); }
.tab-btn[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--accent); }
.tab-btn:focus-visible { outline: 2.5px solid var(--accent); outline-offset: -3px; border-radius: 8px; }
.tab-btn:active { color: var(--text); }
@media (hover: hover) and (pointer: fine) { .tab-btn:hover { color: var(--text); } }
.tab-count { min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 11px;
  font-weight: 650; line-height: 18px; text-align: center; }
.tab-btn[aria-selected="true"] .tab-count { background: var(--accent-wash); color: var(--accent-ink); }
.tab-panel > .section:first-child, .tab-panel > .card:first-child, .tab-panel > .grid:first-child { margin-top: 0; }
.tab-panel.from-right { animation: tab-from-right 220ms var(--ease-out); }
.tab-panel.from-left { animation: tab-from-left 220ms var(--ease-out); }
@keyframes tab-from-right { from { opacity: 0; transform: translateX(18px); } }
@keyframes tab-from-left { from { opacity: 0; transform: translateX(-18px); } }
@media (prefers-reduced-motion: reduce) { .tab-panel.from-right, .tab-panel.from-left { animation: none; } }
/* a part the Settings search jumps to: under the top bar, and glowing teal for a moment */
.tab-panel [id] { scroll-margin-top: calc(var(--header-h) + 14px); }
.flash { animation: flash 1.8s var(--ease-out); border-radius: var(--radius-sm); }
@keyframes flash { 0%, 45% { box-shadow: 0 0 0 3px var(--accent), 0 0 0 8px var(--accent-wash); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Settings' search: a box with a magnifier, and what it finds in a list under it */
.settings-search { position: relative; max-width: 560px; }
.search-box { display: flex; align-items: center; gap: 8px; padding-left: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--muted); }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.search-box .input { flex: 1; min-width: 0; border: 0; background: none; box-shadow: none; padding-left: 0; }
.search-box .input:focus { box-shadow: none; outline: 0; }
.search-hits { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; padding: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.search-hit { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 8px 10px; border: 0;
  border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; }
.search-hit:active { background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) { .search-hit:hover { background: var(--surface-2); } }
.search-hits > p { margin: 6px 8px; }

/* the dashboard's accounts (step 17b): a chip each, its box in the account's colour with the account's symbol in it
   (its type's icon: bank, card or phone; step 17i), filled when it counts and an outline when it doesn't */
.acct-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.acct-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 6px; border: 1px solid var(--border); border-radius: 99px;
  background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; transition: border-color 140ms, color 140ms; }
.acct-chip.on { border-color: color-mix(in srgb, var(--acct-color) 70%, var(--border)); color: var(--text); }
.acct-chip:disabled { cursor: default; }
.acct-chip:active:not(:disabled) { transform: scale(0.97); }
.acct-chip-box { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--acct-color);
  color: var(--acct-color); transition: background-color 140ms, color 140ms; }
.acct-chip.on .acct-chip-box { background: var(--acct-color); color: #fff; }

/* the ⋯ menu (ui.js MoreMenu): a small card under its button, at the right */
.more-menu { position: relative; flex: none; }
.more-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; display: flex; flex-direction: column; gap: 1px;
  min-width: 160px; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18); animation: menu-in 160ms var(--ease-out); transform-origin: top right; }
@keyframes menu-in { from { opacity: 0; transform: scale(0.96); } }
.more-menu-item { padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 13px;
  text-align: left; cursor: pointer; touch-action: manipulation; }
.more-menu-item:disabled { color: var(--muted); cursor: default; }
.more-menu-item.danger { color: var(--critical-text); }
.more-menu-item:active:not(:disabled) { background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) { .more-menu-item:hover:not(:disabled) { background: var(--surface-2); } }
@media (prefers-reduced-motion: reduce) { .more-menu-list { animation: none; } }

/* an on/off switch (a rule): a pill with a knob, teal when on */
.switch { position: relative; flex: none; display: inline-flex; width: 38px; height: 22px; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { width: 100%; height: 100%; border-radius: 99px; background: var(--border-strong); transition: background-color 160ms; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 180ms var(--ease-out); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* Rules (step 17i): one list in the order they're checked, like a music app's queue. Drag a rule by its handle (≡) to
   move it, or use the arrow keys on the handle; its switch, Edit and Delete on the right */
.rule-queue { position: relative; list-style: none; margin: 0; padding: 0 0 6px; }
.rule-row { display: flex; align-items: flex-start; gap: 8px; padding: 10px 14px 10px 6px; background: var(--surface); }
.rule-row + .rule-row { border-top: 1px solid var(--border); }
.rule-row.dragging { position: relative; z-index: 2; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.rule-row.dragging + .rule-row { border-top-color: transparent; }
.rule-handle { flex: none; display: grid; place-items: center; width: 34px; height: 36px; margin: -6px 0 -6px; padding: 0; border: 0;
  border-radius: 8px; background: none; color: var(--muted); cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; }
.rule-row.dragging .rule-handle { color: var(--accent-ink); cursor: grabbing; }
.rule-handle:focus-visible { outline: 2.5px solid var(--accent); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .rule-handle:hover { color: var(--text); background: var(--surface-2); } }
.rule-row > .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rule-words { font-weight: 700; overflow-wrap: anywhere; }
.rule-then { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.rule-row.off .rule-words, .rule-row.off .rule-then, .rule-row.off .small { opacity: 0.55; }
.rule-clash { display: flex; align-items: flex-start; gap: 5px; margin-top: 3px; color: var(--warning-text); }
.rule-clash .icon-svg { margin-top: 2px; }
.rule-tools { flex: none; display: flex; align-items: center; gap: 2px; margin-top: -4px; }
.rule-tools .switch { margin-right: 6px; }
@media (max-width: 640px) {
  .rule-row { padding: 9px 8px 9px 2px; gap: 6px; }
  .rule-handle { width: 30px; }
  .rule-then { font-size: 11.5px; }
}

/* Transactions on phones (step 17c): the accounts' chips and a line of their totals that opens the cards, then the
   search with a Filters button, and the filters that are on */
.txn-accounts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.acct-summary { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); font: inherit; text-align: left; cursor: pointer;
  touch-action: manipulation; }
.acct-summary .acct-totals { flex: 1; margin: 0; padding: 0; border: 0; background: none; }
.acct-summary-chevron { display: inline-flex; color: var(--muted); transition: transform 160ms var(--ease-out); }
.acct-summary[aria-expanded="true"] .acct-summary-chevron { transform: rotate(180deg); }
.filter-bar { display: flex; align-items: center; gap: 8px; }
.filter-bar .input { flex: 1; min-width: 0; }
.filter-bar .btn { flex: none; }
.filter-bar .btn.on { border-color: var(--accent); color: var(--accent-ink); }
.filter-on { display: flex; gap: 6px; overflow-x: auto; margin: 8px -12px 12px; padding: 0 12px 2px; scrollbar-width: none; }
.filter-on::-webkit-scrollbar { display: none; }
.filter-on .chip { flex: none; }
.filter-sheet { display: flex; flex-direction: column; gap: 10px; }
.filter-sheet > .select, .filter-sheet > .row > .select { width: 100%; }
.filter-sheet .row.wrap { gap: 6px; }
/* the page numbers above a list too: only the numbers */
.pager.top { border-top: 0; border-bottom: 1px solid var(--border); justify-content: center; }
.pager.top .pager-count, .pager.top .pager-size { display: none; }

/* the calendar's category (step 17d): the picker beside the month, and the month's categories as rows to tap */
.cal-category { max-width: 220px; }
.cal-cats .bar-list { gap: 4px; }
.cal-cats .bar-row { width: 100%; padding: 7px 8px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text);
  font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; }
.cal-cats .bar-row.on { background: var(--accent-wash); }
.cal-cats .bar-row:active { background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) { .cal-cats .bar-row:hover:not(.on) { background: var(--surface-2); } }
@media (max-width: 760px) {  /* the picker on its own line under the month */
  .cal-nav { flex-wrap: wrap; }
  .page-head > .row.cal-nav > .cal-category { order: 5; max-width: none; flex: 1 1 100%; }
}

/* Transactions: "Needs review" stands out among the filters */
.chip.chip-review { background: var(--warning-wash); color: var(--warning-text); border-color: color-mix(in srgb, var(--warning) 55%, transparent); font-weight: 650; }
.chip.chip-review.on { background: var(--warning); color: #2e2200; border-color: var(--warning); }

/* bank account cards: the header in the account's colour (tick, icon tile, name, balance, pencil), details under it */
.acct-card { --acct-color: var(--accent); container-type: inline-size; }
/* a narrow card (three in a row on a laptop, a small phone): the name keeps the room, the icon tile goes */
@container (max-width: 340px) { .acct-head .acct-label .icon-tile { display: none; } }
.acct-card.colored { border-left: 1px solid var(--border); padding: 0; gap: 0; overflow: visible; }
.acct-card .acct-head { margin: -1px -1px 0; padding: 8px 10px 8px 12px; border-radius: var(--radius) var(--radius) 0 0; color: #fff;
  background: linear-gradient(100deg, color-mix(in srgb, var(--acct-color) var(--acct-mix), var(--acct-shade)),
    color-mix(in srgb, var(--acct-color) calc(var(--acct-mix) - 12%), var(--acct-shade))); }
.acct-head .acct-label .icon-tile { width: 28px; height: 28px; border-radius: 8px; background: var(--acct-color); color: #fff; }
.acct-head .acct-label .icon-tile .icon-svg { color: #fff; }
.acct-head input[type="checkbox"] { accent-color: #fff; }
.acct-head .acct-value .suffix, .acct-head .acct-value.muted { color: var(--on-tone-2); }
.acct-head .btn.ghost { color: #fff; }
@media (hover: hover) and (pointer: fine) { .acct-head .btn.ghost:hover { background: rgba(255, 255, 255, 0.2); } }
.acct-head :focus-visible { outline-color: #fff !important; }
.acct-card .acct-body { display: flex; flex-direction: column; gap: 6px; padding: 7px 12px 10px; }
.acct-card .acct-body .acct-usage { position: static; height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--acct-color) 20%, var(--surface-2)); overflow: hidden; }
.acct-card .acct-body .acct-usage i { border-radius: 99px; background: var(--acct-color); }
.acct-card .acct-body .acct-usage.high i { background: var(--warning); }

/* Debts: a card's icon on its account's colour */
.icon-bubble.acct-fill { background: var(--c); border-color: transparent; color: #fff; }

/* Import: the picked account's colour beside its box */
.acct-pick { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.acct-pick .select { min-width: 0; }
.acct-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border); }

/* Trips and goals: the header is the card's top, in the trip's (or goal's) colour */
.card.trip { padding: 0; gap: 0; }
.card.trip > .trip-body { display: flex; flex-direction: column; gap: 12px; padding: 14px 18px 16px; }
.trip-head.card-head { align-items: flex-start; flex-wrap: nowrap; padding: 12px 18px; }
.card.goal-card { padding: 0; gap: 0; }
.goal-card > .card-body { display: flex; flex-direction: column; gap: 12px; }
.goal-head.card-head { flex-wrap: nowrap; align-items: flex-start; }
.goal-head .grow { min-width: 0; }
@media (max-width: 640px) {
  .grid.tone-tiles:has(> .card.tile) { gap: 8px; }
  .tab-pages { margin-top: 14px; }
  .tabs { margin: 0 -12px 12px; padding: 0 6px; }  /* edge to edge, so the row can slide under the screen's edges */
  .tab-btn { padding: 9px 10px 10px; font-size: 13px; }
  .acct-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px; padding: 0 12px 2px; scrollbar-width: none; }
  .acct-chips::-webkit-scrollbar { display: none; }
  .acct-chip { flex: none; }
  .stored-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 6px; }  /* Privacy's counts: a small grid */
  .stored-grid .tile-mini { padding: 8px 9px; }
  .card.trip > .trip-body { padding: 12px 14px 14px; }
  .trip-head.card-head { padding: 10px 14px; }
  .tax-reliefs { padding-left: 8px; padding-right: 8px; }
  /* the name gets the row's width; what it comes to goes under it, beside the count */
  .tax-relief-head { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto 16px; grid-template-areas: "icon name name chev" ". amount count chev";
    gap: 2px 8px; padding: 9px 8px; }
  .tax-relief-head > .tax-icon { grid-area: icon; }
  .tax-relief-name { grid-area: name; }
  .tax-amount { grid-area: amount; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0 4px; min-width: 0; text-align: left; }
  .tax-count { grid-area: count; min-width: 0; }
  .tax-relief-head .fold-chevron { grid-area: chev; }
  .tax-relief > .meter { margin: -2px 32px 9px 42px; }
  .tax-relief-body { padding: 0 8px 10px; }
  .tax-part-row > div.grow { flex-basis: 100%; }  /* a part's buttons on their own line under it */
  .acct-card .acct-head { padding: 7px 8px 7px 10px; }
  .acct-card .acct-body { padding: 6px 10px 8px; }
}

/* ----- Home (phones, polish Oct 2026): the period, the accounts, a compact category card, then every page as an
   icon in its group ----- */
.home { gap: 12px; }
/* spending and income by category, small: the four figures as a flat bar, then a 124 px ring with the top 5 beside it */
.home-cats .card-head { flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 12px; }
.home-cats .card-head > .row { flex: 1 1 170px; flex-wrap: nowrap; }  /* the icon beside the title; the switch goes under it when both don't fit (Malay) */
.home-cats .card-head .card-title h2 { font-size: 13.5px; line-height: 1.25; }
.home-cats .card-head .segmented { flex: none; }
.home-cats .card-head .segmented button { padding: 4px 9px; font-size: 11.5px; }
.home-cats .card-body { padding: 10px 12px 12px; }
.home-cats .kpis.bar { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.home-cats-empty { margin-top: 10px; }
.home-ring { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.home-ring .ring-wrap { flex: none; width: 124px; margin: 0; }
.home-ring .ring-wrap .chart-box { height: 124px !important; }
.home-ring .ring-center strong { font-size: 13px; }
.home-ring .ring-center span { font-size: 10.5px; }
.home-cat-list { flex: 1; min-width: 0; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.home-cat-list li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 4px 6px;
  border-radius: 7px; font-size: 12px; cursor: pointer; }
.home-cat-list li:active { background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) { .home-cat-list li:hover { background: var(--surface-2); } }
.home-cat-list li:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.home-cat-list .swatch { width: 10px; height: 10px; border-radius: 3px; }
.home-cat-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.home-cat-list .amt { font-weight: 700; }

/* the page icons, like the owner's bank app (their pick, 23 Oct, step 17i): under each group's coloured title, a white
   tile per page with a soft shadow, the icon's lines in the app's teal and its name inside the tile, four across */
.home-group { --g: var(--tone-1-tile); }
.home-group.g-organise { --g: var(--tone-3-tile); }
.home-group.g-plan { --g: var(--tone-2-tile); }
.home-groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.home-group-title { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; font-size: 14px; font-weight: 700; }
.home-group-title::before { content: ""; width: 4px; height: 16px; border-radius: 4px; background: var(--g); }
.home-icons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.home-icon { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; min-height: 86px;
  padding: 14px 4px 10px; border: 1px solid var(--tile-edge); border-radius: 14px; background: var(--surface); box-shadow: var(--tile-shadow);
  text-align: center; color: var(--text); text-decoration: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation; transition: transform 120ms var(--ease-out), border-color 120ms; }
.home-icon:active { transform: scale(0.95); }
@media (hover: hover) and (pointer: fine) { .home-icon:hover { border-color: color-mix(in srgb, var(--brand) 45%, transparent); } }
.home-icon-tile { flex: none; display: grid; place-items: center; color: var(--brand); }
.home-icon-label { max-width: 100%; font-size: 11px; font-weight: 600; line-height: 1.25; overflow-wrap: break-word; }
.home-icon .badge { position: absolute; z-index: 1; top: 6px; left: calc(50% + 9px); min-width: 20px; justify-content: center;
  padding: 1px 6px; border-radius: 99px; font-size: 11px; box-shadow: 0 0 0 2px var(--surface); }
.home-icon:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .home-icon { transition: none; } .home-icon:active { transform: none; } }
@media (min-width: 520px) { .home-icons { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); } }

/* ----- One container per page (step 17i, the owner's pick of 23 Oct): a page's sections share one card (.sheet). Each
   section's header is a coloured bar beside its title, with the line under it (.card-head.sec, coloured by tone-1 to
   tone-7), and a band of the page's colour runs between two sections. Panels side by side on a computer are columns
   of the one card, the band running down between them. A page with one section is that card on its own. ----- */
.card-head.sec { --bar: var(--tone-1-tile); position: relative; padding: 16px 18px 8px 32px; border-bottom: 0; }
.card-head.sec.tone-2 { --bar: var(--tone-2-tile); }
.card-head.sec.tone-3 { --bar: var(--tone-3-tile); }
.card-head.sec.tone-4 { --bar: var(--tone-4-tile); }
.card-head.sec.tone-5 { --bar: var(--tone-5-tile); }
.card-head.sec.tone-6 { --bar: var(--tone-6-tile); }
.card-head.sec.tone-7 { --bar: var(--tone-7-tile); }
.card-head.sec::before { content: ""; position: absolute; left: 18px; top: 18px; width: 4px; height: 20px; border-radius: 4px; background: var(--bar); }
.card-head.sec h2 { font-size: 16px; line-height: 1.3; }
.card-head.sec h2 > .icon-svg:first-child, .card-head.sec .icon-tile { display: none; }  /* the bar says it instead */
.card-head.sec + .card-body { padding-top: 6px; }
.card.folded > .card-head.sec { padding-bottom: 16px; }
.sheet { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); }
.sheet:empty { display: none; }
.sheet > .card, .sheet > .grid > .card { margin: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.sheet > .grid { gap: 0; }
/* the band: above every section but the first (only sections: a pop-up drawn among them stays as it is) */
.sheet > :is(.card, .grid) ~ :is(.card, .grid), .sheet > .grid > .card ~ .card { position: relative; border-top: 10px solid transparent; }
.sheet > :is(.card, .grid) ~ :is(.card, .grid)::before, .sheet > .grid > .card ~ .card::before { content: ""; position: absolute; left: 0;
  right: 0; top: -10px; height: 10px; background: var(--page); border-block: 1px solid var(--border); }
@media (min-width: 1181px) {  /* side by side: the band runs down between the columns */
  .sheet > .grid-2 > .card ~ .card { border-top: 0; border-left: 10px solid transparent; }
  .sheet > .grid-2 > .card ~ .card::before { left: -10px; right: auto; top: 0; bottom: 0; width: 10px; height: auto; border-block: 0;
    border-inline: 1px solid var(--border); }
}
@media (max-width: 640px) {
  .card-head.sec { padding: 14px 12px 6px 26px; }
  .card-head.sec::before { left: 12px; top: 16px; height: 18px; }
  .card-head.sec h2 { font-size: 15px; }
  .card.folded > .card-head.sec { padding-bottom: 14px; }
}

/* the figures at the top of a page (step 17i, Stats in charts.js): the dashboard's cards, three across, on a computer;
   on a phone one strip split in three, each with its icon in its colour */
.kpis.stats, .kpis.bar.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.stats .kpi-foot { color: var(--muted); font-weight: 500; }
.kpis.bar.stats > .card.kpi { padding: 10px 6px; gap: 4px; }
.kpis.bar.stats .icon-tile { display: grid; width: 24px; height: 24px; border-radius: 7px; }
.kpis.bar.stats .icon-tile .icon-svg { width: 15px; height: 15px; }
.kpis.bar.stats .kpi-top { gap: 6px; }
.kpis.bar.stats .kpi-label { font-size: 11px; line-height: 1.2; text-align: left; }
.kpis.bar.stats .kpi-value { font-size: 14.5px; }
.kpis.bar.stats .kpi-foot { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }

/* the dashboard's period picker, with "No earlier period to compare" under it when it's so (step 17i) */
.dash-period { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dash-period > .small { margin: 0; }
@media (max-width: 640px) { .dash-period { align-items: flex-start; } }
