/* Layout: a deep-forest ledger rail on the left (the brand surface in both themes) beside a paper workspace;
   content sits on a 12-column grid that collapses to one column on phones, where the rail becomes a top band. */
/* Arthly — a product of Aylin Core. Palette from the Aylin Core mark: orange #FF7540 on deep teal #1A2C2F.
   Layout: brand rail on the left (white in light, deep teal in dark) beside the workspace; 12-column grid that
   collapses to one column on phones, where the rail becomes a top band. Personal = orange accent, Company = blue. */
:root {
  --paper: #F6F1E8;
  --surface: #FFFDF9;
  --sunken: #EFE8DC;
  --line: #DDD3C2; /* card edges a touch crisper on the cream (phone 1.7.2; was #E5DCCD) */
  --ink: #1F2A2C;
  --ink-2: #5B6062;
  --ink-3: #676964; /* 4.94:1 on --paper, 5.47:1 on --surface, 4.56:1 on --sunken */
  --brand: #FF7540;
  --brand-deep: #1A2C2F;
  --forest: #1A2C2F;
  --forest-2: #22393D;
  --on-forest: #EEF4F3;
  --on-forest-2: #93AAAA;
  --gold: #FF7540;
  --accent: #FF7540;
  --accent-ink: #1A2C2F;
  --accent-text: #B5431A; /* orange for text and links only: 4.93:1 on --paper, 4.56:1 on --sunken */
  --accent-soft: #FF754021;
  /* status colours as text (≥4.5:1 on every light background; same as the phone app) and as fills (original shades) */
  --good: #0D7655;
  --bad: #B44038;
  --spend: #2F6A6F;
  --warn: #8C5E16;
  --good-fill: #0D7A58; --bad-fill: #C2453C; --warn-fill: #B4791C;
  --info: #2F67C4;
  --banner-bg: #F1EBE0; /* the info / sample banner: a neutral cream with an orange icon (phone 1.7.2; was peach #FFF1E9) */
  --banner-line: #DDD3C2;
  --banner-icon: #D95B26;
  --shadow: 0 1px 2px rgba(26, 44, 47, .07), 0 10px 26px -14px rgba(26, 44, 47, .24); /* a touch deeper, so cards sit crisply on the cream */
  --doc-paper: #FFFFFF;
  --doc-ink: #16191A;
  --doc-muted: #6A716C;
  --doc-line: #E4E2DC;
  --display: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --body: 'Figtree', -apple-system, 'Segoe UI', Roboto, system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius: 18px;
  /* Type scale: the only font sizes in the app (mirrored by `fs` in ui.tsx for inline styles). Nothing below 12px.
     --fs-hero is for the big headline numbers (overview total, amount entry). */
  --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-15: 15px; --fs-17: 17px; --fs-20: 20px; --fs-24: 24px; --fs-30: 30px;
  --fs-hero: clamp(34px, 5vw, 48px);
  --lh-small: 1.45; /* line-height for text at 14px and below */
  /* light theme: cream workspace beside the same deep-teal brand rail as the dark theme */
  --rail-bg: #1A2C2F; --rail-border: transparent; --rail-ink: #E6F0EF; --rail-ink-2: #8FA7A7; --rail-hover: rgba(255,255,255,.05);
  --rail-active-bg: #4A3328; --rail-active-ink: #FFFFFF; --rail-indicator: #FF7540; --rail-line: rgba(255,255,255,.08); --rail-dot: #FF7540;
  --switch-bg: rgba(255,255,255,.07); --switch-on-bg: #FF7540; --switch-on-ink: #1A2C2F; --switch-shadow: none;
  --hero-bg: #FFEEE4; --hero-ink: #1A2C2F; --hero-ink-2: #7A5544; --hero-track: rgba(255,117,64,.2); --hero-fill: #FF7540;
  --hero-hi: #B5431A; --hero-line: rgba(185,70,26,.14); --hero-chip: rgba(255,255,255,.8); --hero-mark: #FF7540; --hero-ring: color-mix(in srgb, var(--hero-mark) 9%, transparent);
  --hero-good: #0D7655; --hero-bad: #B44038; /* ≥4.7:1 on every book’s light hero */
  --accent-on-ink: #FF7540; /* accent text on --ink (the toast’s Undo); same as the phone */
  /* bar charts by period (phone 1.7.2): the current period bright, earlier ones the same colour faded; money in stays green */
  --chart-now: #E8692F; --chart-past: #F6C5AC; --chart-in-past: #A3CBBC;
}
:root[data-profile="company"] {
  --accent: #2B4A9B; --accent-ink: #FFFFFF; --accent-text: #2B4A9B; --accent-soft: #2B4A9B14; --spend: #E0784C; /* ink blue (owner, 17 Oct 2026; was #2D50C2) */
  --rail-active-bg: #23324F; --rail-indicator: #7E9BFF; --switch-on-bg: #3D5DD6; --switch-on-ink: #FFFFFF; /* the rich blue pill with white text, both themes (was #7E9BFF / #0A1638) */
  --hero-bg: #E4E9F6; --hero-ink: #131E4A; --hero-ink-2: #46578F; --hero-track: rgba(43,74,155,.16); --hero-fill: #2B4A9B; /* the ink blue's own hue (was #E5EBF8 / #4C5C92) */
  --hero-hi: #233F9E; --hero-line: rgba(43,74,155,.16); --hero-mark: #2B4A9B; --hero-ring: color-mix(in srgb, var(--hero-mark) 6%, transparent); --hero-good: #0D7655; --accent-on-ink: #9DB3FF;
  --chart-now: #2B4A9B; --chart-past: #AEB9D5;
}
:root[data-profile="family"] {
  --accent: #2B7A73; --accent-ink: #FFFFFF; --accent-text: #22665F; --accent-soft: #2B7A7314; --spend: #E0784C;
  --rail-active-bg: #1C4A46; --rail-indicator: #5FC9BE; --switch-on-bg: #5FC9BE; --switch-on-ink: #072624;
  --hero-bg: #E0F1ED; --hero-ink: #0F2E2B; --hero-ink-2: #456E69; --hero-track: rgba(43,122,115,.18); --hero-fill: #2B7A73;
  --hero-hi: #1D5C56; --hero-line: rgba(43,122,115,.16); --hero-mark: #2B7A73; --hero-ring: color-mix(in srgb, var(--hero-mark) 7%, transparent); --hero-good: #0D7655; --accent-on-ink: #7FD8CE;
  --chart-now: #2B7A73; --chart-past: #AECBC6;
}
@media (prefers-color-scheme: dark) {
  /* Auto (follow the device), the default: the same values as the chosen dark theme below (FE-UX-16 checks they match) */
  :root:not([data-theme="light"]) {
    --paper: #0F1214; --surface: #181C1F; --sunken: #242A2D; --line: #30373B; --raised: #1E2326; /* page < card < dialog: a neutral charcoal, same as the phone 1.7.2 (was #0E1415 / #1A2221 / #222B2A / #2C3735 / #1F2827) */
    --ink: #EAF0F1; --ink-2: #9DA8AC; --ink-3: #87949A; /* 4.66:1 on --sunken, 5.5:1 on --surface; same as the phone */
    --accent: #FF7540; --accent-ink: #1A2C2F; --accent-text: #FF9268; --accent-soft: #FF75402B;
    --good: #3FC48F; --bad: #F47E82; --spend: #6AAAAD; --warn: #F0B23E; --info: #7AA2FF; --good-fill: #3FC48F; --bad-fill: #F47E82; --warn-fill: #F0B23E; /* softer green and red (was #34CC93 / #FF6B72) */
    --banner-bg: #1B2023; --banner-line: #30373B; --banner-icon: #FF9268;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -14px rgba(0, 0, 0, .7);
    --rail-bg: #1A2C2F; --rail-border: rgba(255,255,255,.07); --rail-ink: #E6F0EF; --rail-ink-2: #8FA7A7; --rail-hover: rgba(255,255,255,.05);
    --rail-active-bg: #4A3328; --rail-active-ink: #FFFFFF; --rail-indicator: #FF7540; --rail-line: rgba(255,255,255,.08); --rail-dot: #FF7540;
    --switch-bg: rgba(255,255,255,.07); --switch-on-bg: #FF7540; --switch-on-ink: #1A2C2F; --switch-shadow: none;
    --hero-bg: #2B1C16; --hero-ink: #FBF3EE; --hero-ink-2: #C2A698; --hero-track: rgba(255,255,255,.12); --hero-fill: #FF7540; /* a warm ember of its own (was the shared teal #1A2C2F) */
    --hero-hi: #FF9268; --hero-line: rgba(255,255,255,.1); --hero-chip: rgba(255,255,255,.08); --hero-mark: #FF9268; --hero-ring: color-mix(in srgb, var(--hero-mark) 9%, transparent);
    --hero-good: #3FC48F; --hero-bad: #FFB3B7; --accent-on-ink: #B5431A;
    --chart-now: #FF8A57; --chart-past: #704634; --chart-in-past: #275C4A;
    color-scheme: dark;
  }
  :root:not([data-theme="light"])[data-profile="family"] {
    --accent: #5FC9BE; --accent-ink: #072624; --accent-text: #7FD8CE; --accent-soft: #5FC9BE24; --spend: #F08A5D;
    --rail-active-bg: #1C4A46; --rail-indicator: #5FC9BE; --switch-on-bg: #5FC9BE; --switch-on-ink: #072624; --accent-on-ink: #22665F;
    --hero-bg: #0F2B27; --hero-ink: #ECF7F4; --hero-ink-2: #8FBDB4; --hero-fill: #5FC9BE; --hero-hi: #7FD8CE; --hero-mark: #7FD8CE; /* a deep teal of its own */
    --chart-now: #5FC9BE; --chart-past: #335E5B;
  }
  :root:not([data-theme="light"])[data-profile="company"] {
    --accent: #3D5DD6; --accent-ink: #FFFFFF; --accent-text: #9DB3FF; --accent-soft: #3D5DD629; --spend: #F08A5D; /* a rich blue fill with white text (5.6:1); the light blue only as text and links (was #7E9BFF with dark text) */
    --rail-active-bg: #23324F; --rail-indicator: #7E9BFF; --switch-on-bg: #3D5DD6; --switch-on-ink: #FFFFFF; --accent-on-ink: #2B4A9B;
    --hero-bg: #172243; --hero-ink: #EEF2FF; --hero-ink-2: #A3B1DA; --hero-fill: #8FA8FF; --hero-hi: #9DB3FF; --hero-mark: #8FA8FF; /* deep ink-navy */
    --chart-now: #8FA8FF; --chart-past: #455174;
  }
}
:root[data-theme="dark"] {
  --paper: #0F1214; --surface: #181C1F; --sunken: #242A2D; --line: #30373B; --raised: #1E2326; /* page < card < dialog: a neutral charcoal, same as the phone 1.7.2 (was #0E1415 / #1A2221 / #222B2A / #2C3735 / #1F2827) */
  --ink: #EAF0F1; --ink-2: #9DA8AC; --ink-3: #87949A; /* 4.66:1 on --sunken, 5.5:1 on --surface; same as the phone */
  --accent: #FF7540; --accent-ink: #1A2C2F; --accent-text: #FF9268; --accent-soft: #FF75402B;
  --good: #3FC48F; --bad: #F47E82; --spend: #6AAAAD; --warn: #F0B23E; --info: #7AA2FF; --good-fill: #3FC48F; --bad-fill: #F47E82; --warn-fill: #F0B23E; /* softer green and red (was #34CC93 / #FF6B72) */
  --banner-bg: #1B2023; --banner-line: #30373B; --banner-icon: #FF9268;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -14px rgba(0, 0, 0, .7);
  --rail-bg: #1A2C2F; --rail-border: rgba(255,255,255,.07); --rail-ink: #E6F0EF; --rail-ink-2: #8FA7A7; --rail-hover: rgba(255,255,255,.05);
  --rail-active-bg: #4A3328; --rail-active-ink: #FFFFFF; --rail-indicator: #FF7540; --rail-line: rgba(255,255,255,.08); --rail-dot: #FF7540;
  --switch-bg: rgba(255,255,255,.07); --switch-on-bg: #FF7540; --switch-on-ink: #1A2C2F; --switch-shadow: none;
  --hero-bg: #2B1C16; --hero-ink: #FBF3EE; --hero-ink-2: #C2A698; --hero-track: rgba(255,255,255,.12); --hero-fill: #FF7540; /* a warm ember of its own (was the shared teal #1A2C2F) */
  --hero-hi: #FF9268; --hero-line: rgba(255,255,255,.1); --hero-chip: rgba(255,255,255,.08); --hero-mark: #FF9268; --hero-ring: color-mix(in srgb, var(--hero-mark) 9%, transparent);
  --hero-good: #3FC48F; --hero-bad: #FFB3B7; --accent-on-ink: #B5431A;
  --chart-now: #FF8A57; --chart-past: #704634; --chart-in-past: #275C4A;
  color-scheme: dark;
}
:root[data-theme="dark"][data-profile="family"] {
  --accent: #5FC9BE; --accent-ink: #072624; --accent-text: #7FD8CE; --accent-soft: #5FC9BE24; --spend: #F08A5D;
  --rail-active-bg: #1C4A46; --rail-indicator: #5FC9BE; --switch-on-bg: #5FC9BE; --switch-on-ink: #072624; --accent-on-ink: #22665F;
  --hero-bg: #0F2B27; --hero-ink: #ECF7F4; --hero-ink-2: #8FBDB4; --hero-fill: #5FC9BE; --hero-hi: #7FD8CE; --hero-mark: #7FD8CE; /* a deep teal of its own */
  --chart-now: #5FC9BE; --chart-past: #335E5B;
}
:root[data-theme="dark"][data-profile="company"] {
  --accent: #3D5DD6; --accent-ink: #FFFFFF; --accent-text: #9DB3FF; --accent-soft: #3D5DD629; --spend: #F08A5D; /* a rich blue fill with white text (5.6:1); the light blue only as text and links (was #7E9BFF with dark text) */
  --rail-active-bg: #23324F; --rail-indicator: #7E9BFF; --switch-on-bg: #3D5DD6; --switch-on-ink: #FFFFFF; --accent-on-ink: #2B4A9B;
  --hero-bg: #172243; --hero-ink: #EEF2FF; --hero-ink-2: #A3B1DA; --hero-fill: #8FA8FF; --hero-hi: #9DB3FF; --hero-mark: #8FA8FF; /* deep ink-navy */
  --chart-now: #8FA8FF; --chart-past: #455174;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { background: var(--paper); color: var(--ink); font: var(--fs-15)/1.5 var(--body); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; letter-spacing: -0.02em; }
.num, .amt { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: max(.92em, var(--fs-12)); letter-spacing: -0.01em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.ic { flex: none; display: block; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100dvh; }
.rail { background: var(--rail-bg); color: var(--rail-ink); border-right: 1px solid var(--rail-border); }
.rail-in { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; padding-block: 22px 18px; padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: 18px; scrollbar-width: thin; scrollbar-color: transparent transparent; }
.rail-in:hover, .rail-in:focus-within { scrollbar-color: rgba(255,255,255,.18) transparent; }
.rail-in::-webkit-scrollbar { width: 8px; }
.rail-in::-webkit-scrollbar-track { background: transparent; }
.rail-in::-webkit-scrollbar-thumb { background: transparent; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.rail-in:hover::-webkit-scrollbar-thumb, .rail-in:focus-within::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.18); }
.rail-in::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.32); }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; }
.brand-btn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; width: fit-content; border-radius: 10px; }
.coin { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--brand-deep); display: grid; place-items: center; font: 800 var(--fs-17)/1 var(--display); box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .12); }
.word { font: 800 var(--fs-24)/1 var(--display); letter-spacing: -0.04em; }
.word span { color: var(--rail-dot); }
.switch { display: grid; grid-template-columns: 1fr 1fr; background: var(--switch-bg); border-radius: 14px; padding: 4px; gap: 4px; }
.switch button { border: 0; background: transparent; color: var(--rail-ink-2); border-radius: 10px; padding: 8px 6px; display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: var(--fs-14); }
.switch button[aria-selected="true"] { background: var(--switch-on-bg); color: var(--switch-on-ink); box-shadow: var(--switch-shadow); }
.books { padding: 0 6px; display: grid; gap: 2px; }
.books .lbl { font-size: var(--fs-12); letter-spacing: .06em; text-transform: uppercase; color: var(--rail-ink-2); }
.books .nm { font-weight: 600; font-size: var(--fs-15); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: grid; gap: 2px; }
.nav button { border: 0; background: transparent; color: var(--rail-ink-2); display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; font-weight: 500; text-align: left; position: relative; }
.nav button:hover { background: var(--rail-hover); color: var(--rail-ink); }
.nav button[aria-current="page"] { background: var(--rail-active-bg); color: var(--rail-active-ink); font-weight: 650; }
.nav button[aria-current="page"]::before { content: ""; position: absolute; left: -18px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--rail-indicator); }
.nav .badge { margin-left: auto; font-size: var(--fs-12); font-weight: 700; background: var(--bad-fill); color: #fff; border-radius: 999px; padding: 1px 7px; }
.nav-sep { height: 1px; background: var(--rail-line); margin: 6px 4px; }
.rail-foot { margin-top: auto; display: grid; gap: 10px; font-size: var(--fs-13); color: var(--rail-ink-2); padding: 0 6px; }
.save-dot { display: inline-flex; align-items: center; gap: 7px; }
.save-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); display: inline-block; }
.save-dot[data-s="saved"] i { background: #4ED3A0; }
.save-dot[data-s="error"] i { background: #FF7A80; }

.main-wrap { min-width: 0; padding-block: 0 56px; padding-left: 32px; padding-right: max(32px, env(safe-area-inset-right, 0px)); }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-block: 20px 16px; background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.top-title { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; }
.back-btn { flex: none; width: 40px; height: 40px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; color: var(--ink); }
.back-btn:hover { border-color: var(--ink-3); }
.topbar h1 { font-size: var(--fs-30); font-weight: 800; line-height: 1.1; }
.topbar .sub { color: var(--ink-2); font-size: var(--fs-14); margin-top: 2px; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.banner > svg { flex: none; color: var(--banner-icon); }
.banner { margin-top: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 14px; background: var(--banner-bg); border: 1px solid var(--banner-line); font-size: var(--fs-14); }
.banner b { font-weight: 700; }
.banner > div { flex: 1 1 260px; min-width: 0; }
.banner .btn { margin-left: auto; }

/* ---------- primitives ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 9px 14px; font-weight: 600; font-size: var(--fs-14); white-space: nowrap; transition: transform .08s ease, background .15s ease; }
.btn:hover { background: var(--sunken); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent-text); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.btn-sm { padding: 6px 10px; font-size: var(--fs-13); border-radius: 10px; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.icon-btn:hover { color: var(--ink); background: var(--sunken); }
.seg { display: inline-flex; background: var(--sunken); border-radius: 12px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: none; white-space: nowrap; border: 0; background: transparent; color: var(--ink-2); padding: 6px 12px; border-radius: 9px; font-weight: 600; font-size: var(--fs-14); display: inline-flex; align-items: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
/* the sliding highlight (see Seg in ui.tsx); without it, the pressed button keeps its own background */
.seg { position: relative; }
.seg button { position: relative; z-index: 1; transition: color .2s ease; }
.seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 0; width: var(--thumb-w, 0); transform: translateX(var(--thumb-x, 0)); background: var(--accent); border-radius: 9px; box-shadow: 0 4px 12px -6px var(--accent); opacity: 0; pointer-events: none; }
.seg.has-thumb .seg-thumb { opacity: 1; }
.seg.thumb-ready .seg-thumb { transition: transform .28s cubic-bezier(.2, .8, .2, 1), width .28s cubic-bezier(.2, .8, .2, 1); }
.seg.has-thumb button[aria-pressed="true"] { background: transparent; box-shadow: none; color: var(--accent-ink); }
.seg.has-thumb button:not([aria-pressed="true"]):hover { color: var(--ink); }
.seg.icons button { padding: 7px 9px; }
/* Add transaction: the four types (Spending, Income, Transfer, Opening balance) share the row; on phones the labels
   wrap onto two lines instead of one sliding out of sight */
#tx-form > .seg { display: flex; width: 100%; }
#tx-form > .seg button { flex: 1 1 auto; justify-content: center; }
@media (max-width: 520px) {
  #tx-form > .seg button { white-space: normal; text-align: center; line-height: 1.2; padding-inline: 6px; font-size: var(--fs-13); }
  #tx-form > .seg button .ic { display: none; }
}
/* Accounts: each account's opening balance and the link to add or change it */
.acc-opening { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: var(--fs-13); color: var(--ink-2); margin-top: 2px; min-width: 0; }
.acc-opening .btn-link { font-size: var(--fs-13); }
@media (pointer: coarse) { .acc-opening .btn-link { position: relative; } .acc-opening .btn-link::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); } }
/* Match bank balance: the before-and-after line in the dialog */
.match-preview { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: var(--fs-14); color: var(--ink-2); overflow-wrap: anywhere; }
.match-preview b { color: var(--ink); white-space: nowrap; }
.match-preview svg { vertical-align: -2px; color: var(--good); }
/* Monthly balances: each month's closing figure on the right */
.monthly-close { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; white-space: nowrap; }
/* Setup: the optional "money in your accounts today" fields */
.setup-opening { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.kbd { font: 600 var(--fs-12) var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--ink-3); }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-top: 8px; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-h h2 { font-size: var(--fs-17); font-weight: 650; }
.panel-h .link { border: 0; background: none; color: var(--accent-text); font-weight: 600; font-size: var(--fs-14); padding: 0; }
.eyebrow { font-size: var(--fs-12); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.spread { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.empty { text-align: center; padding: 36px 16px; display: grid; gap: 8px; justify-items: center; color: var(--ink-2); }
.empty .ring-ic { width: 54px; height: 54px; border-radius: 18px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; }
.empty h3 { font-size: var(--fs-17); color: var(--ink); }

/* hero (forest card) */
.hero { background: var(--hero-bg); color: var(--hero-ink); border-radius: 22px; padding: 24px 26px; position: relative; overflow: hidden; display: grid; gap: 16px; align-content: space-between; }
.hero::after { content: ""; position: absolute; width: 340px; height: 340px; border-radius: 50%; right: -120px; top: -170px; border: 46px solid var(--hero-ring); pointer-events: none; }
.hero .k { color: var(--hero-ink-2); font-weight: 600; font-size: var(--fs-14); }
.hero .big { font: 800 var(--fs-hero)/1 var(--display); letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.hero .chip { display: inline-flex; align-items: center; gap: 6px; background: var(--hero-chip); border-radius: 999px; padding: 4px 11px; font-size: var(--fs-13); font-weight: 600; }
.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; border-top: 1px solid var(--hero-line); padding-top: 14px; }
.hero-stats .v { font-weight: 700; font-size: var(--fs-17); font-variant-numeric: tabular-nums; }
.hero-stats .l { color: var(--hero-ink-2); font-size: var(--fs-13); }
.gold { color: var(--hero-hi); }
.bar { height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar.on-forest { background: var(--hero-track); height: 10px; }
.bar.on-forest > i { background: var(--hero-fill); }
.bar > i.warn { background: var(--warn-fill); } .bar > i.bad { background: var(--bad-fill); }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 4px; }
.tile .l { color: var(--ink-2); font-size: var(--fs-13); display: flex; align-items: center; gap: 6px; }
.tile .v { font: 650 var(--fs-24)/1.15 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .s { font-size: var(--fs-13); color: var(--ink-3); }
.tile.alert { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }

/* lists & tables */
.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); min-width: 0; }
.li:first-child { border-top: 0; }
.li .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .s { font-size: var(--fs-13); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .grow { flex: 1; min-width: 0; }
/* rows with several buttons: when the name would be squeezed, the buttons move to a line of their own */
.li.li-wrap { flex-wrap: wrap; }
.li.li-wrap > .grow { min-width: 10em; }
.li.li-wrap > .li-actions { margin-left: auto; }
/* very narrow phones: when the name and the amount can't share a line, the amount moves under it, on the right */
@media (max-width: 400px) { .li { flex-wrap: wrap; } .li > .grow { min-width: 8.5em; } .li > .grow ~ .amt { margin-left: auto; } }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cat { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-13); background: var(--sunken); border-radius: 999px; padding: 3px 10px 3px 8px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat .dot { width: 8px; height: 8px; }
.avatar { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: var(--fs-13); flex: none; }
.pos { color: var(--good); } .neg { color: var(--ink); } .xfer { color: var(--ink-3); }

.table { width: 100%; container-type: inline-size; }
/* a table squeezed by the space it has (iPad mini, split screen, sidebar open) drops its least important
   column (.hide-md) and switches to its narrower column set, so names don't vanish and figures don't overlap */
@container (max-width: 860px) {
  .table .hide-md { display: none; }
  .table > .thead, .table > .trow { grid-template-columns: var(--cols-md, var(--cols)); }
}
.thead, .trow { display: grid; grid-template-columns: var(--cols); gap: 14px; align-items: center; padding: 12px 14px; }
.thead { font-size: var(--fs-12); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.trow { border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 0; transition: background .12s ease; }
.trow:hover { background: var(--sunken); }
.trow:last-child { border-bottom: 0; }
.trow > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r { text-align: right; justify-self: end; }
.day-h { padding: 14px 14px 6px; font-size: var(--fs-12); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); display: flex; justify-content: space-between; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-13); font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-paid { color: var(--good); background: color-mix(in srgb, var(--good) 13%, transparent); }
.st-overdue { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.st-sent { color: var(--info); background: color-mix(in srgb, var(--info) 13%, transparent); }
.st-partial { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.st-draft { color: var(--ink-2); background: var(--sunken); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; flex: 1 1 240px; min-width: 0; color: var(--ink-3); }
.search input { border: 0; background: transparent; padding: 9px 0; outline: none; flex: 1; min-width: 0; color: var(--ink); }
.select, .input, textarea.input { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; min-width: 0; color: var(--ink); }
.select:focus, .input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.period { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.period button { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--ink-2); }
.period button:hover:not(:disabled) { background: var(--sunken); color: var(--ink); }
.period button:disabled { opacity: .35; cursor: default; }
.period span { font-weight: 650; min-width: 130px; text-align: center; font-size: var(--fs-15); }

/* credit card tiles */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.ccard { aspect-ratio: 1.62; max-width: 100%; border-radius: 22px; padding: 20px; color: #fff; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; border: 0; text-align: left; transition: transform .15s ease; }
.ccard:hover { transform: translateY(-2px); }
.ccard::before { content: ""; position: absolute; width: 240px; height: 240px; border-radius: 50%; background: rgba(255, 255, 255, .09); right: -80px; top: -110px; }
.ccard::after { content: ""; position: absolute; width: 170px; height: 170px; border-radius: 50%; background: rgba(0, 0, 0, .1); left: -60px; bottom: -95px; }
.ccard > * { position: relative; z-index: 1; }
.ccard .chipm { width: 36px; height: 26px; border-radius: 6px; background: linear-gradient(135deg, #F7DD8A, #D9B24C); }
.ccard .nm { font-weight: 700; font-size: var(--fs-17); }
.ccard .lbl { font-size: var(--fs-12); opacity: .75; font-weight: 600; }
.ccard .owed { font: 800 var(--fs-30)/1.05 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ccard .meta { font-size: var(--fs-13); opacity: .85; }
.ccard .cbar { height: 5px; border-radius: 9px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.ccard .cbar i { display: block; height: 100%; background: #fff; }
.ccard .due { font-size: var(--fs-12); font-weight: 700; background: rgba(255, 255, 255, .2); padding: 3px 9px; border-radius: 99px; }
.ccard .due.urgent { background: #fff; color: #1a1a1a; }
.add-tile { border: 1.5px dashed var(--ink-3); background: transparent; border-radius: 22px; color: var(--ink-2); display: grid; place-items: center; gap: 6px; min-height: 160px; font-weight: 600; }
.add-tile:hover { color: var(--accent-text); border-color: var(--accent); }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-lab { fill: var(--ink-3); font: 500 var(--fs-12) var(--body); }
.c-lab.on { fill: var(--ink); font-weight: 700; }
.c-track { stroke: var(--sunken); }
.legend { display: grid; gap: 10px; }
.legend .li { padding: 6px 0; border: 0; }
.donut-wrap { display: grid; gap: 14px; justify-items: center; }
.donut-wrap .legend { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; gap: 2px 16px; }

/* forms & dialogs */
dialog { border: 0; padding: 0; border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45); width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); }
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(6, 14, 11, .55); backdrop-filter: blur(3px); }
.dlg { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); }
.dlg-h { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 6px; gap: 12px; }
.dlg-h h2 { font-size: var(--fs-20); font-weight: 650; }
.dlg-b { padding: 12px 22px; overflow-y: auto; display: grid; gap: 14px; }
.dlg-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px 20px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.dlg-f .left { margin-right: auto; display: flex; gap: 8px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: var(--fs-13); font-weight: 650; color: var(--ink-2); }
.field .hint { font-size: var(--fs-13); color: var(--ink-3); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.input, .select { width: 100%; }
.amount-in { font: 800 var(--fs-hero)/1.1 var(--display); letter-spacing: -0.03em; border: 0; border-bottom: 2px solid var(--line); border-radius: 0; padding: 4px 0 8px; width: 100%; background: transparent; outline: none; font-variant-numeric: tabular-nums; }
.amount-in:focus { border-bottom-color: var(--accent); }
.kind-expense .amount-in { color: var(--bad); } .kind-income .amount-in { color: var(--good); }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches label { position: relative; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.swatches input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: 14px; font-weight: 600; font-size: var(--fs-14); opacity: 0; pointer-events: none; transition: all .2s ease; z-index: 100; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast { display: flex; align-items: center; gap: 14px; }
.toast.show.has-undo { pointer-events: auto; padding-right: 8px; }
.toast-undo { border: 0; background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 45%, transparent); color: var(--accent-on-ink); font: 700 var(--fs-14)/1 var(--body); padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.toast-undo:hover { background: color-mix(in srgb, var(--paper) 26%, transparent); }

/* invoice document (stays paper-white in both themes) */
.doc { background: var(--doc-paper); color: var(--doc-ink); border-radius: 6px; padding: 40px 42px; box-shadow: var(--shadow), 0 0 0 1px var(--line); font-size: var(--fs-13); line-height: 1.5; min-width: 0; }
.doc h4 { margin: 0 0 6px; font-size: var(--fs-12); letter-spacing: .08em; text-transform: uppercase; color: var(--doc-muted); }
.doc-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.doc-biz { font: 800 var(--fs-20)/1.2 var(--display); letter-spacing: -0.02em; }
.doc-logo { max-height: 52px; max-width: 180px; margin-bottom: 8px; }
.doc .m { color: var(--doc-muted); }
.doc-kind { font: 800 var(--fs-30)/1 var(--display); letter-spacing: -0.03em; color: var(--accent-print, #2B4A9B); text-align: right; }
.doc-meta { text-align: right; display: grid; gap: 2px; }
.doc-parties { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--doc-line); }
.doc-due { text-align: right; }
.doc-due .v { font: 800 var(--fs-24)/1.1 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.doc-items { width: 100%; border-collapse: collapse; margin-top: 26px; font-variant-numeric: tabular-nums; color: var(--doc-ink); font-size: var(--fs-13); }
.doc-items td { color: var(--doc-ink); }
.doc-items th { text-align: left; font-size: var(--fs-12); letter-spacing: .08em; text-transform: uppercase; color: var(--doc-muted); font-weight: 700; padding: 9px 10px; background: #F3F4F7; }
.doc-items td { padding: 11px 10px; border-bottom: 1px solid var(--doc-line); vertical-align: top; }
.doc-items .r, .doc-items th.r { text-align: right; }
.doc-totals { margin-left: auto; width: min(300px, 100%); margin-top: 16px; display: grid; gap: 7px; font-variant-numeric: tabular-nums; }
.doc-totals .row { justify-content: space-between; }
.doc-totals .grand { background: var(--accent-print, #2B4A9B); color: #fff; padding: 10px 12px; border-radius: 8px; font-weight: 800; font-size: var(--fs-15); }
.doc-foot { margin-top: 30px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; padding-top: 18px; border-top: 1px solid var(--doc-line); white-space: pre-line; }
.doc-stamp { display: inline-block; border: 2px solid currentColor; color: #0B9467; font: 800 var(--fs-14) var(--display); letter-spacing: .12em; padding: 3px 10px; border-radius: 6px; transform: rotate(-6deg); }

.inv-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.inv-layout.inv-view { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.inv-items { display: grid; gap: 8px; }
.inv-item { display: grid; grid-template-columns: minmax(0, 1fr) 70px 120px 34px; gap: 8px; align-items: center; }
.inv-item .amt { text-align: right; }
/* When the editor form is narrow (laptops, with the preview beside it), each line puts its description on a full-width
   row and HSN / Qty / Rate / GST underneath, instead of squeezing the description to a sliver. */
.inv-layout > form { container: invform / inline-size; }
@container invform (max-width: 640px) {
  .inv-item { grid-template-columns: repeat(4, minmax(0, 1fr)) 34px !important; row-gap: 6px; }
  .inv-item > :first-child { grid-column: 1 / -1; }
  .inv-item:not(.eyebrow) { padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
  .inv-item.eyebrow { display: none; }
  .inv-item .li-f { display: grid; gap: 3px; min-width: 0; align-self: end; }
  .inv-item .li-l { display: block; }
}
/* each small field's own caption, shown only in the stacked layout (and on phones) */
.li-f { display: contents; }
.li-l { display: none; font: 700 var(--fs-12)/var(--lh-small) var(--body); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.sticky-prev { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 96px); }
.side-actions { display: grid; gap: 8px; }

.loading { display: grid; place-items: center; min-height: 50vh; color: var(--ink-3); gap: 12px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--sunken); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .span-8, .span-7, .span-5, .span-4 { grid-column: span 12; }
  .inv-layout, .inv-layout.inv-view { grid-template-columns: minmax(0, 1fr); }
  .sticky-prev { position: static; }
}
@media (max-width: 920px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; }
  .rail-in { position: static; height: auto; }
  .rail-in { padding-block: 14px 10px; padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); gap: 12px; }
  .rail-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
  .books, .rail-foot, .nav-sep { display: none; }
  .nav { display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; margin: 0 -4px; }
  .nav button { flex: none; padding: 8px 12px; }
  .nav button[aria-current="page"]::before { display: none; }
  .main-wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .topbar h1 { font-size: var(--fs-24); }
  .span-6, .span-3 { grid-column: span 12; }
  .donut-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
}
@media (min-width: 921px) { .rail-top { display: contents; } }
@media (max-width: 700px) {
  .thead { display: none; }
  .trow { grid-template-columns: minmax(0, 1fr) auto !important; row-gap: 2px; }
  .trow .hide-sm { display: none; }
  .doc { padding: 24px 20px; }
  .inv-item { grid-template-columns: minmax(0, 1fr) 56px 92px 30px; }
  .top-actions .lbl-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- additions for the React build ---------- */
#root { min-height: 100dvh; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.page { animation: rise .28s var(--ease-out); }
@keyframes rise { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- motion: small and quick; all of it is switched off by prefers-reduced-motion above ---------- */
:root { --ease-out: cubic-bezier(.2, .8, .2, 1); }
/* cards arrive in a short cascade when a page opens */
.page .grid > *, .page .tiles > *, .page > .panel, .page > .stack > .panel { animation: card-in .42s var(--ease-out) backwards; }
.page .grid > :nth-child(2), .page .tiles > :nth-child(2) { animation-delay: .04s; }
.page .grid > :nth-child(3), .page .tiles > :nth-child(3) { animation-delay: .08s; }
.page .grid > :nth-child(4), .page .tiles > :nth-child(4) { animation-delay: .12s; }
.page .grid > :nth-child(5) { animation-delay: .16s; }
.page .grid > :nth-child(n+6) { animation-delay: .2s; }
@keyframes card-in { from { opacity: 0; transform: translateY(10px); } }
/* rows that appear after a filter, tab or search change slide in; rows that stay put don't move */
.page .trow, .page .li, .page .pay-row { animation: row-in .3s var(--ease-out) backwards; }
.page .trow:nth-child(2), .page .li:nth-child(2) { animation-delay: .02s; }
.page .trow:nth-child(3), .page .li:nth-child(3) { animation-delay: .04s; }
.page .trow:nth-child(4), .page .li:nth-child(4) { animation-delay: .06s; }
.page .trow:nth-child(5), .page .li:nth-child(5) { animation-delay: .08s; }
.page .trow:nth-child(6), .page .li:nth-child(6) { animation-delay: .1s; }
.page .trow:nth-child(n+7), .page .li:nth-child(n+7) { animation-delay: .12s; }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } }
/* panels and tiles that appear when you switch tabs (Invoices / Quotes / Notes and the like) */
.page .panel, .page .tile, .page .empty { animation: card-in .35s var(--ease-out) backwards; }
/* progress bars fill from the left */
.bar > i { transform-origin: left center; animation: bar-fill .7s var(--ease-out) .1s backwards; }
@keyframes bar-fill { from { transform: scaleX(0); } }
/* dialogs and their backdrop */
dialog[open] { animation: pop .22s var(--ease-out); }
dialog[open]::backdrop { animation: fade .22s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
/* the big number on the overview settles in */
.hero .big { animation: rise .5s var(--ease-out) .05s backwards; }
/* things you can tap respond to the pointer */
.tile, .ccard { transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out), border-color .18s ease, background-color .3s ease, color .3s ease; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ccard:hover { transform: translateY(-3px); }
.btn { transition: transform .08s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease; }
.btn-primary:hover { box-shadow: 0 6px 16px -8px var(--accent); }
.nav button { transition: background .15s ease, color .15s ease, transform .18s var(--ease-out); }
/* pointing at a menu item nudges it a little (only on devices with a real pointer) */
@media (hover: hover) {
  .nav button:hover { transform: translateX(3px); }
  .nav button:hover svg { transform: scale(1.08); }
  .tabbar button:hover { transform: translateY(-2px); }
}
.nav button svg { transition: transform .18s var(--ease-out); }
/* the light/dark button: the icon turns as it swaps */
.theme-toggle svg { animation: theme-spin .35s var(--ease-out); }
.theme-toggle:hover svg { transform: rotate(-15deg); transition: transform .2s var(--ease-out); }
@keyframes theme-spin { from { transform: rotate(-90deg) scale(.6); opacity: 0; } }
.tabbar button { transition: transform .18s var(--ease-out), color .15s ease; }
.nav button[aria-current="page"]::before { animation: grow-y .25s var(--ease-out); }
@keyframes grow-y { from { transform: scaleY(0); } }
.trow { transition: background .12s ease, transform .12s ease; }
.trow:active { transform: scale(.995); }
/* switching light and dark cross-fades instead of flashing */
body, .panel, .hero, .rail, .topbar, dialog { transition: background-color .3s ease, border-color .3s ease, color .3s ease; }
.clickable { cursor: pointer; }
.li.clickable:hover .t { color: var(--accent-text); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.legend-row { display: flex; gap: 18px; justify-content: center; margin-top: 6px; font-size: var(--fs-13); color: var(--ink-2); }
.legend-row > span { display: inline-flex; align-items: center; gap: 6px; }
.c-big { font: 700 var(--fs-17) var(--display); fill: var(--ink); }
.stat-num { font: 650 var(--fs-24)/1.2 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.date-tile { width: 40px; height: 42px; border-radius: 12px; background: var(--sunken); color: var(--ink-2); display: grid; place-items: center; align-content: center; line-height: 1.05; font-size: var(--fs-12); flex: none; }
.date-tile b { font-size: var(--fs-15); color: var(--ink); }
.avatar.sm { width: 30px; height: 30px; border-radius: 10px; font-size: var(--fs-12); }
.list.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); column-gap: 28px; }
.list.cols-2 .li:nth-child(2) { border-top: 0; }
.theme-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 520px; }
.theme-tile { display: grid; justify-items: center; gap: 6px; padding: 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); font-weight: 650; }
.theme-tile[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.err { color: var(--bad); font-size: var(--fs-13); }
.inline-new { display: grid; gap: 10px; padding: 12px; border: 1px dashed var(--line); border-radius: 14px; }
.inv-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pay-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: var(--fs-14); }
.pay-row:first-child { border-top: 0; }
.filter-tabs { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.filter-tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: var(--fs-13); color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; transition: background .2s ease, color .2s ease, border-color .2s ease, transform .08s ease; }
.filter-tabs button:active { transform: scale(.96); }
.filter-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.filter-tabs .n { font-size: var(--fs-12); opacity: .7; }
.totals-box { display: grid; gap: 8px; font-variant-numeric: tabular-nums; }
.totals-box .row { justify-content: space-between; }
@media (max-width: 920px) { .theme-tiles { max-width: none; } }

.spark { display: flex; gap: 10px; align-items: stretch; height: 92px; max-width: 520px; }
.sb { flex: 1; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 5px; text-align: center; font-size: var(--fs-12); color: var(--hero-ink-2); }
.sb i { align-self: end; display: block; border-radius: 6px 6px 2px 2px; background: var(--chart-past); } /* earlier months: the books' colour, faded (phone 1.7.2; was a flat grey track in dark) */
.sb.on i { background: var(--hero-fill); }
.sb.on span { color: var(--hero-ink); font-weight: 700; }

/* ---------- sign-in ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100dvh; background: var(--paper); }
.auth-side { background: #1A2C2F; color: #EEF4F3; display: flex; flex-direction: column; gap: 34px; padding-block: 40px; padding-left: max(48px, env(safe-area-inset-left, 0px)); padding-right: 48px; position: relative; overflow: hidden; }
.auth-side .word span { color: #FF7540; }
.auth-side::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -200px; bottom: -220px; border: 70px solid rgba(255, 117, 64, .07); }
.auth-pitch h1 { font: 800 clamp(var(--fs-30), 3.4vw, 48px)/1.06 var(--display); letter-spacing: -0.035em; max-width: 15ch; color: #F4F8F7; }
.auth-pitch p { color: #A3B8B8; font-size: var(--fs-17); max-width: 46ch; margin: 14px 0 0; }
.auth-demo { display: grid; gap: 12px; max-width: 380px; position: relative; z-index: 1; }
.auth-demo-card { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); border-radius: 18px; padding: 16px 18px; display: grid; gap: 8px; }
.auth-demo-card .k { color: #A3B8B8; font-size: var(--fs-13); }
.auth-demo-card .v { font: 800 var(--fs-30)/1 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.auth-demo-card .bar.on-forest { background: rgba(255, 255, 255, .12); }
.auth-demo-card .bar.on-forest > i { background: #FF7540; }
.auth-demo-card.small { max-width: 260px; justify-self: end; }
.auth-demo-card.small .v { font-size: var(--fs-24); }
.auth-points { list-style: none; padding: 0; margin: auto 0 0; display: grid; gap: 10px; color: #C6D6D5; font-size: var(--fs-15); position: relative; z-index: 1; }
.auth-points li { display: flex; gap: 10px; align-items: center; }
.auth-main { display: grid; place-items: center; padding-block: 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.auth-card { width: min(420px, 100%); display: grid; gap: 10px; }
.auth-card h2 { font-size: var(--fs-30); font-weight: 800; }
.auth-btn { width: 100%; justify-content: flex-start; padding: 13px 16px; font-size: var(--fs-15); border-radius: 14px; }
.auth-btn .grow { flex: 1; text-align: left; }
.g-mark { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; background: var(--sunken); font: 800 var(--fs-15) var(--display); color: var(--ink); }
.auth-note { font-size: var(--fs-14); line-height: 1.5; background: var(--banner-bg); border: 1px solid var(--banner-line); border-radius: 12px; padding: 10px 12px; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: var(--fs-13); margin: 8px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-fine { color: var(--ink-3); font-size: var(--fs-13); text-align: center; margin: 6px 0 0; }
.auth-mobile-brand { display: none; margin-bottom: 10px; }
.auth-mobile-brand .word span { color: var(--brand); }
@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .auth-mobile-brand { display: block; }
}

/* ---------- small additions ---------- */
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--rail-hover); min-width: 0; }
.rail-icon { width: 32px; height: 32px; border-color: transparent; background: transparent; color: var(--rail-ink-2); }
.rail-icon:hover { background: var(--rail-active-bg); color: var(--rail-ink); }
.logo-box { width: 160px; height: 84px; border: 1px dashed var(--line); border-radius: 12px; display: grid; place-items: center; background: var(--doc-paper); overflow: hidden; color: var(--doc-muted); font-size: var(--fs-13); }
.logo-box img { max-width: 140px; max-height: 66px; }
.report-options { display: grid; gap: 8px; }
.report-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; }
.report-opt[data-on="true"] { border-color: var(--accent); background: var(--accent-soft); }
.report-opt input { accent-color: var(--accent); margin-top: 3px; }
.report-opt span { display: grid; gap: 2px; }
.report-opt span span { color: var(--ink-2); font-size: var(--fs-13); }
.btn-link { border: 0; background: none; color: var(--accent-text); font-weight: 650; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.show-sm { display: none; }
dialog.confirm { width: min(420px, calc(100vw - 32px)); }
@media (max-width: 700px) { .show-sm { display: block; } }
@media (max-width: 920px) { .user-chip { display: none; } }

/* ---------- maker mark (Aylin Core) ---------- */
.brand-logo { display: block; flex: none; }
.maker { display: flex; align-items: center; gap: 8px; font-size: var(--fs-12); color: var(--rail-ink-2); line-height: var(--lh-small); }
.maker .brand-logo { height: 15px; width: auto; }
.auth-maker { display: flex; align-items: center; gap: 12px; color: #A3B8B8; font-size: var(--fs-13); position: relative; z-index: 1; }
.auth-maker .brand-logo { height: 26px; width: auto; }
.about-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.about-row .brand-logo { height: 40px; width: auto; }
.arthly-mark { display: block; flex: none; border-radius: 27%; }
:root[data-theme="dark"] .rail .arthly-mark { box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rail .arthly-mark { box-shadow: 0 0 0 1px rgba(255,255,255,.08); } }
.auth-side .arthly-mark { box-shadow: 0 0 0 1px rgba(255,255,255,.1); }
.rail-foot .maker { padding-top: 10px; border-top: 1px solid var(--rail-line); }
.auth-card-maker { justify-content: center; color: var(--ink-3); margin-top: 18px; display: none; }
.about-maker { display: grid; justify-items: start; gap: 4px; }
@media (max-width: 860px) { .auth-card-maker { display: flex; } }

/* ---------- round 2: GST, jobs, bills, cash flow, investments, PIN ---------- */
.chase { display: flex; align-items: center; gap: 12px; background: var(--banner-bg); border: 1px solid var(--banner-line); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: var(--fs-14); flex-wrap: wrap; }
.chase > .ic { color: var(--accent-text); flex: none; }
.chip-sm { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px; background: var(--sunken); color: var(--ink-2); font: 600 var(--fs-12)/1.6 var(--mono); white-space: nowrap; }
.tag-ic { display: inline-block; margin-left: 6px; vertical-align: -2px; color: var(--ink-3); }
.kv { display: flex; justify-content: space-between; gap: 12px; }
.kv > span:first-child { color: var(--ink-3); flex: none; }
.kv > :last-child { text-align: right; min-width: 0; }
.sub-panel { background: var(--sunken); border-radius: 14px; padding: 14px; }
.einv-box { border: 1px dashed var(--line); border-radius: 14px; padding: 12px 14px; }
.einv-box summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.doc-einv { background: #F4F5F7; border-radius: 8px; padding: 8px 12px; font-size: var(--fs-12); color: var(--doc-muted); display: grid; gap: 2px; margin: -6px 0 16px; word-break: break-all; }
.doc-einv b { color: var(--doc-ink); font-weight: 600; margin-right: 4px; }
.doc-words { font-size: var(--fs-12); color: var(--doc-muted); font-style: italic; margin-top: 10px; text-align: right; }
.doc-upi { display: flex; gap: 14px; align-items: center; white-space: normal; }
.upi-qr { flex: none; border: 1px solid var(--doc-line); border-radius: 8px; padding: 4px; background: #fff; }
.receipt-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.receipt-thumb { width: 54px; height: 54px; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; padding: 0; background: var(--sunken); display: grid; place-items: center; cursor: zoom-in; }
.receipt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pdf-badge { font: 700 var(--fs-12) var(--mono); color: var(--bad); }
dialog.receipt-view { border: 0; border-radius: 18px; padding: 14px; max-width: min(92vw, 760px); max-height: 90vh; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog.receipt-view::backdrop { background: rgba(8, 14, 16, .6); }
dialog.receipt-view img { display: block; max-width: 100%; max-height: 76vh; border-radius: 10px; margin-top: 10px; }
.rv-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 650; }
.imp-table { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.imp-row { display: grid; grid-template-columns: 22px 70px minmax(0, 1fr) 170px 120px; gap: 10px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: var(--fs-14); }
.imp-row:last-child { border-bottom: 0; }
.imp-row.off { opacity: .5; }
.imp-row em { color: var(--ink-3); font-style: normal; font-size: var(--fs-12); }
.select.sm { height: 32px; font-size: var(--fs-13); padding-block: 0; }
.job-ic { width: 34px; height: 34px; flex: none; border-radius: 10px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.job-ic.lg { width: 48px; height: 48px; border-radius: 14px; }
.job-figures { display: grid; grid-template-columns: repeat(4, minmax(90px, auto)); gap: 4px 22px; }
.job-figures > div { display: grid; }
.job-figures .k { font-size: var(--fs-13); color: var(--ink-3); }
.job-figures .v { font: 700 var(--fs-17)/1.3 var(--display); font-variant-numeric: tabular-nums; }
.flow-chart { width: 100%; height: auto; display: block; }
.flow-chart .ax { font-size: var(--fs-12); fill: var(--ink-3); }
.legend-row i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.weeks { display: grid; }
.week { border-bottom: 1px solid var(--line); }
.week:last-child { border-bottom: 0; }
.week-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1.4fr) 1fr 1fr 1fr 18px; gap: 10px; align-items: center; padding: 11px 10px; border: 0; background: none; color: var(--ink); text-align: left; font-variant-numeric: tabular-nums; border-radius: 10px; }
.week-row:hover { background: var(--sunken); }
.week-row .wk { font-weight: 600; }
.week-ev { padding: 0 10px 12px; display: grid; gap: 2px; }
.ev { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto 120px; gap: 10px; align-items: center; font-size: var(--fs-14); padding: 4px 0; }
.ev em { color: var(--bad); font-style: normal; font-size: var(--fs-12); }
.legend-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 6px 16px; margin-top: 12px; font-size: var(--fs-13); }
.legend-2 > div { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.legend-2 i { width: 10px; height: 10px; border-radius: 3px; }
.group-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 10px 4px; font-weight: 700; }
.group-h > span:first-child { display: flex; align-items: center; gap: 8px; }
.group-h i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.group-h em { font-style: normal; font-weight: 600; font-size: var(--fs-13); margin-left: 6px; }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 9px; }
.ask { display: grid; gap: 14px; max-width: 820px; margin: 0 auto; }
.ask-thread { display: grid; gap: 14px; min-height: 40vh; align-content: start; }
.ask-intro { text-align: center; padding: 36px 12px 10px; display: grid; justify-items: center; gap: 10px; }
.ask-intro h2 { font: 800 var(--fs-24)/1.15 var(--display); letter-spacing: -.02em; margin: 0; text-wrap: balance; }
.ask-intro p { max-width: 54ch; margin: 0; }
.ask-badge { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.ask-sugg { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 14px; font-size: var(--fs-14); cursor: pointer; text-align: left; }
.chip-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.ask-turn { display: grid; gap: 8px; }
.ask-q { justify-self: end; max-width: 80%; background: var(--accent-soft); color: var(--ink); border-radius: 16px 16px 4px 16px; padding: 10px 14px; font-weight: 550; }
.ask-a { justify-self: start; max-width: 92%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 12px 16px; line-height: 1.55; }
.ask-a.err { border-color: var(--bad); }
.ask-bar { position: sticky; bottom: max(12px, env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; background: var(--paper); padding: 8px 0; }
.act-day { display: grid; gap: 2px; margin-bottom: 14px; }
.act-day .eyebrow { margin-bottom: 4px; }
.act-row { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-14); }
.act-row:last-child { border-bottom: 0; }
.act-ic { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--sunken); color: var(--ink-2); }
.policy { line-height: 1.6; font-size: var(--fs-15); max-width: 70ch; }
.policy h3 { font: 700 var(--fs-17) var(--display); margin: 18px 0 6px; }
.policy ul { padding-left: 20px; margin: 6px 0; }
.policy.compact { font-size: var(--fs-13); }
.policy.compact h3 { font-size: var(--fs-14); margin-top: 12px; }
.auth-policy { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; background: var(--surface); }
.email-form .seg { width: 100%; }
.lock-btn { border: 0; background: none; color: var(--rail-ink-2); display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-13); padding: 2px 6px; cursor: pointer; }
.lock-btn:hover { color: var(--rail-ink); }
.sec-ic { width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.pin-dialog .dlg-body, .pin-dialog { max-width: 380px; }
.pin-box { display: grid; justify-items: center; gap: 14px; padding: 6px 0 4px; text-align: center; }
.pin-box > .ic { color: var(--accent-text); }
.pin-hidden { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.pin-dots { display: flex; gap: 14px; cursor: text; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-3); transition: background .12s, border-color .12s; }
.pin-dots span[data-on="true"] { background: var(--accent); border-color: var(--accent); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 64px); gap: 10px; }
.pin-pad button { height: 54px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 650 var(--fs-20) var(--display); cursor: pointer; display: grid; place-items: center; }
.pin-pad button:hover:not(:disabled) { background: var(--sunken); }
.about-maker-inline { color: var(--ink-3); margin-top: 6px; }
@media (max-width: 760px) {
  .imp-row { grid-template-columns: 22px 54px minmax(0, 1fr) 96px; }
  .imp-row .select { display: none; }
  .job-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .week-row { grid-template-columns: minmax(0, 1.3fr) 1fr 1fr 18px; }
  .week-row > span:nth-child(3) { display: none; }
  .ev { grid-template-columns: 56px minmax(0, 1fr) 96px; }
  .ev .chip-sm { display: none; }
  .ask-q, .ask-a { max-width: 100%; }
}

.einv-qr { float: right; display: grid; justify-items: center; gap: 2px; margin-left: 10px; font-size: var(--fs-12); }

.doc-sign { margin: 18px 0 0 auto; width: max-content; max-width: 100%; display: grid; justify-items: end; gap: 4px; font-size: var(--fs-13); text-align: right; }
.doc-sign img { max-height: 52px; max-width: 180px; object-fit: contain; }
.doc-sign .line { border-top: 1px solid var(--doc-line); padding-top: 4px; min-width: 170px; }
.sig-box img { mix-blend-mode: multiply; }

.gsi-btn { min-height: 44px; display: flex; justify-content: center; }

/* ---------- phones: bottom tab bar + "More" sheet ---------- */
.tabbar, .sheet-wrap { display: none; }
@media (max-width: 700px) {
  .rail .nav, .rail .rail-nav { display: none; }
  .rail-in { padding-block: 12px 10px; }
  .main-wrap { padding-bottom: calc(148px + env(safe-area-inset-bottom, 0px)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--rail-bg); border-top: 1px solid var(--line); padding: 6px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px)); box-shadow: 0 -6px 24px -18px rgba(0, 0, 0, .35); }
  .tabbar button { border: 0; background: none; color: var(--ink-3); display: grid; justify-items: center; gap: 3px; padding: 6px 2px; border-radius: 12px; font: 600 var(--fs-12)/1.1 var(--body); position: relative; min-width: 0; }
  .tabbar button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .tabbar button[aria-current="page"] { color: var(--accent-text); background: var(--accent-soft); }
  .dot-badge { position: absolute; top: 4px; right: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; background: var(--bad-fill); }
  .sheet-wrap { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(8, 14, 16, .45); animation: fade .15s ease-out; }
  .sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface); border-radius: 22px 22px 0 0; padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(92px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); max-height: 80vh; overflow: auto; animation: up .2s ease-out; }
  .sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 14px; }
  .sheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .sheet-grid button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 14px; padding: 12px 6px; display: grid; justify-items: center; gap: 6px; font: 600 var(--fs-13)/1.2 var(--body); text-align: center; }
  .sheet-grid button[aria-current="page"] { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
  .sheet-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
  .sheet-foot .maker { color: var(--ink-3); width: 100%; }
  .inv-item { grid-template-columns: repeat(4, minmax(0, 1fr)) 30px !important; }
  .inv-item > :first-child { grid-column: 1 / -1; }
  .inv-item.eyebrow { display: none; }
  .inv-item .li-f { display: grid; gap: 3px; min-width: 0; align-self: end; }
  .inv-item .li-l { display: block; }
  .toast { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
.panel-h { flex-wrap: wrap; row-gap: 8px; }
@media (max-width: 700px) { .panel-h > div.row { flex-wrap: wrap; } }

.invite-note { display: grid; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--sunken); border: 1px solid var(--line); }
.ok-note { color: var(--pos, #1F7A63); font-size: var(--fs-14); }
.row-del { width: 32px; height: 32px; color: var(--ink-3); }
.row-del:hover { color: var(--bad); border-color: var(--bad); }

/* ---------- family */
.switch.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.switch.three button { flex-direction: column; padding: 6px 2px; font-size: var(--fs-12); gap: 2px; line-height: 1.15; }
.switch.three button svg { width: 15px; height: 15px; }
.payer { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--ink-2); }
.payer i { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font: 700 var(--fs-12)/1 var(--body); color: #fff; font-style: normal; }
.mem-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mem-row:last-child { border-bottom: 0; }
.mem-av { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font: 700 var(--fs-13)/1 var(--display); flex: none; }
.settle-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--sunken); flex-wrap: wrap; }
.settle-card .amt { font: 700 var(--fs-17)/1.2 var(--display); }
.owe-pos { color: var(--good); } .owe-neg { color: var(--bad); }
.split-grid { display: grid; gap: 8px; }
.split-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 110px; gap: 10px; align-items: center; }
.split-row input.input { padding-block: 6px; }
.fam-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-13); font-weight: 600; }
.pocket { display: grid; gap: 6px; }
.pocket .big { font: 800 var(--fs-hero)/1.05 var(--display); letter-spacing: -0.02em; }
@media (max-width: 560px) { .split-row { grid-template-columns: auto minmax(0, 1fr) 92px; } }
.fam-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.fam-card > .grow { flex: 1 1 320px; }
.fam-card .mem-av { color: var(--accent-ink); }
[hidden] { display: none !important; }

/* first-time setup: what else Arthly is for */
.use-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.use-pick { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.use-pick input { margin: 3px 0 0; accent-color: var(--accent); }
.use-pick > svg { flex: none; color: var(--ink-2); margin-top: 1px; }
.use-pick b { display: block; font-size: var(--fs-15); }
.use-pick span span { display: block; font-size: var(--fs-13); color: var(--ink-3); line-height: var(--lh-small); margin-top: 2px; }
.use-pick.on { border-color: var(--accent); background: var(--accent-soft); }
.use-pick.on > svg { color: var(--accent-text); }
@media (max-width: 520px) { .use-picks { grid-template-columns: 1fr; } }

/* books: switch with a + to add the ones not in use yet */
.books-row { display: flex; gap: 8px; align-items: stretch; }
.books-row .switch { flex: 1; min-width: 0; }
.switch.one { grid-template-columns: 1fr; }
.add-book { flex: none; width: 42px; border-radius: 13px; border: 1.5px dashed color-mix(in srgb, var(--rail-ink-2) 70%, transparent); background: transparent; color: var(--rail-ink); display: grid; place-items: center; }
.add-book:hover { background: var(--rail-hover); border-style: solid; }
.book-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.book-row:first-child { border-top: 0; padding-top: 4px; }
.book-row .grow { flex: 1 1 260px; }
.book-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--sunken); color: var(--ink-2); flex: none; }
.book-row.on .book-ic { background: var(--accent-soft); color: var(--accent-text); }
.book-state { font-size: var(--fs-12); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 1px 8px; border-radius: 999px; background: var(--sunken); color: var(--ink-3); }
.book-state.on { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.add-pick { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px; color: var(--ink); }
.add-pick:hover { border-color: var(--accent); background: var(--accent-soft); }
.add-pick b { display: block; font-size: var(--fs-15); }
.add-pick .grow span { display: block; color: var(--ink-3); font-size: var(--fs-13); margin-top: 2px; }
.use-picks.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .use-picks.three { grid-template-columns: 1fr; } }
.mask-btn { width: 40px; height: 40px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; color: var(--ink-2); display: inline-grid; place-items: center; }
.mask-btn.on { color: var(--accent-text); border-color: var(--accent); background: var(--accent-soft); }
.use-picks.three .use-pick { flex-direction: column; gap: 6px; position: relative; padding: 14px 12px 12px; }
.use-picks.three .use-pick input { position: absolute; top: 12px; right: 12px; margin: 0; width: 17px; height: 17px; }
.use-picks.three .use-pick > svg { width: 22px; height: 22px; }
.use-picks + .hint { font-size: var(--fs-13); color: var(--ink-3); }
@media (max-width: 640px) { .use-picks.three .use-pick { flex-direction: row; } .use-picks.three .use-pick input { position: static; } }
.books-row:has(.add-book) .switch:not(.one) button { flex-direction: column; padding: 6px 2px; font-size: var(--fs-12); gap: 2px; line-height: 1.15; }
.books-row:has(.add-book) .switch:not(.one) button svg { width: 15px; height: 15px; }
.switch button { min-width: 0; }

/* loans */
.loan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 14px; }
.loan-card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--surface); min-width: 0; }
.loan-card .bar { margin-top: 8px; }
.loan-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 12px; }
.loan-facts span { display: block; font-size: var(--fs-12); color: var(--ink-3); }
.loan-facts b { font-size: var(--fs-14); }
.split-preview { background: var(--sunken); border-radius: 12px; padding: 10px 12px; font-size: var(--fs-14); }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.tbl th { text-align: left; font-size: var(--fs-12); color: var(--ink-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tbl .r { text-align: right; }
.scan-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--accent-soft); border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 14px; padding: 10px 12px; }
.scan-btn { cursor: pointer; background: var(--surface); }
.scan-btn.busy { opacity: .7; cursor: progress; }
.scan-msg { font-size: var(--fs-13); color: var(--ink-2); flex: 1 1 220px; min-width: 0; }
.err-text { color: var(--bad); }
.regime-tbl th.best { color: var(--good); }
.regime-tbl tr.strong td { font-weight: 700; }
.regime-tbl td:first-child { min-width: 180px; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px 20px; }
.checklist .done { color: var(--ink-3); text-decoration: line-through; }
.comp-item { flex-wrap: wrap; row-gap: 8px; }
.comp-item.is-done .t { color: var(--ink-3); }
.comp-amt { display: flex; flex-direction: column; align-items: flex-end; min-width: 120px; }
.cstat { font-size: var(--fs-12); font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--sunken); color: var(--ink-2); white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; }
.cstat.soon { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.cstat.late { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.cstat.done { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.comp-done { font-size: var(--fs-13); }
@media (max-width: 640px) { .comp-amt { align-items: flex-start; min-width: 0; } }

/* ---------- TDS and GST page ---------- */
.ts-note { font-size: var(--fs-14); margin: 0 0 16px; max-width: 900px; }
.ts-group { border-top: 1px solid var(--line); padding: 12px 0 8px; }
.ts-group:first-of-type { border-top: 0; padding-top: 2px; }
.ts-group.is-done .ts-head .t { color: var(--ink-3); }
.ts-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ts-head .grow { flex: 1; }
.ts-head .t { font-weight: 650; }
.ts-toolbar .select { width: auto; max-width: 100%; }
.ts-head .s { font-size: var(--fs-13); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-head .amt { font-weight: 700; white-space: nowrap; }
.ts-quarters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 8px 0 4px; }
.ts-quarters:empty { display: none; }
.ts-row { display: flex; align-items: center; gap: 12px; padding: 7px 10px; margin: 0 -10px; border-radius: 10px; cursor: pointer; font-size: var(--fs-14); min-width: 0; }
.ts-row:hover, .ts-row:focus-visible { background: var(--sunken); }
.ts-row .grow { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-row .amt { white-space: nowrap; font-weight: 600; }
.ts-total { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; font-weight: 650; }
.ts-gst { container-type: inline-size; }
.ts-gst-row { display: grid; grid-template-columns: minmax(96px, 1.1fr) repeat(6, minmax(0, 1fr)); gap: 12px; align-items: center; padding: 10px 8px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.ts-gst-row > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-gst-row > .ts-m { display: inline-flex; align-items: center; gap: 6px; }
.ts-mn { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ts-sub { display: none; font-size: var(--fs-12); font-weight: 500; color: var(--ink-3); white-space: normal; }
.ts-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ts-gst-row:hover { background: var(--sunken); }
.ts-gst-h, .ts-gst-t { cursor: default; }
.ts-gst-h:hover, .ts-gst-t:hover { background: none; }
.ts-gst-h { font-size: var(--fs-12); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.ts-gst-t { font-weight: 700; border-bottom: 0; }
.ts-docs { padding: 4px 18px 8px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--sunken) 50%, transparent); }
@container (max-width: 720px) {
  .ts-gst-row { grid-template-columns: minmax(84px, 1fr) repeat(3, minmax(0, 1fr)); gap: 8px; padding-inline: 4px; }
  .ts-gst-row .ts-split { display: none; }
  .ts-gst-h { font-size: var(--fs-12); letter-spacing: .02em; }
  .ts-gst-h > * { white-space: normal; }
  .ts-docs { padding-inline: 8px; }
}
@container (max-width: 540px) {
  .ts-gst-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ts-gst-row .ts-wide { display: none; }
  .ts-sub { display: block; }
  .ts-gst-row > .ts-m { align-items: flex-start; }
}
@media (max-width: 400px) { .ts-gst-row { font-size: var(--fs-13); } .ts-head .amt { font-size: var(--fs-14); } }
.panel a:not(.btn) { color: var(--accent-text); }

/* ---------- quick search (Ctrl/⌘ + K) ---------- */
kbd { font: 600 var(--fs-12)/1 var(--body); padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--sunken); color: var(--ink-2); }
.quick-btn { color: var(--ink-2); }
.quick-btn kbd { margin-left: 2px; }
dialog.quick { width: min(620px, calc(100vw - 32px)); margin-top: min(14vh, 120px); padding: 0; }
.quick-in { display: flex; flex-direction: column; max-height: min(560px, calc(100dvh - 140px)); }
.quick-q { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.quick-q input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: 500 var(--fs-17)/1.3 var(--body); }
.quick-list { overflow-y: auto; padding: 6px; }
.quick-group { font: 700 var(--fs-12)/1 var(--body); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 12px 10px 6px; }
.quick-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; cursor: pointer; min-width: 0; }
.quick-item[aria-selected="true"] { background: var(--accent-soft); }
.quick-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--sunken); color: var(--ink-2); flex: none; transition: background .15s ease, color .15s ease; }
.quick-item[aria-selected="true"] .quick-ic { background: var(--accent); color: var(--accent-ink); }
.quick-l { display: grid; min-width: 0; flex: 1; }
.quick-l .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-l .h { font-size: var(--fs-13); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-enter { color: var(--accent-text); font-weight: 700; }
.quick-none { padding: 22px 14px; color: var(--ink-2); text-align: center; }
.quick-foot { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); font-size: var(--fs-12); color: var(--ink-3); }
.quick-foot kbd { margin-right: 3px; }
@media (max-width: 700px) { .quick-foot { display: none; } dialog.quick { margin-top: 12px; } }

/* ---------- charts draw in (switched off by prefers-reduced-motion) ---------- */
.chart .c-a, .chart .c-b, .flow-chart .c-a, .flow-chart .c-b { transform-box: fill-box; transform-origin: 50% 100%; animation: bar-up .6s cubic-bezier(.2, .8, .2, 1) backwards; }
@keyframes bar-up { from { transform: scaleY(0); } }
/* donut slices and rings grow along their arc from where they start */
circle.c-slice { animation: arc-in .8s cubic-bezier(.2, .8, .2, 1) backwards; }
@keyframes arc-in { from { stroke-dasharray: 0 9999; } }

/* something you just added glows briefly in its list */
.trow.fresh, .li.fresh { animation: fresh-glow 2.4s ease-out; }
@keyframes fresh-glow { 0%, 25% { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); } 100% { background: transparent; box-shadow: inset 3px 0 0 transparent; } }

/* switching books or light/dark cross-fades the whole page */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .38s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
@media (prefers-reduced-motion: reduce) { ::view-transition-old(root), ::view-transition-new(root) { animation: none; } }

.note-ok { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); font-weight: 600; font-size: var(--fs-14); }

/* ---------- delete straight from a list row ---------- */
.row-del-cell { display: flex; justify-content: flex-end; }
.row-del { border: 0; background: transparent; color: var(--ink-3); width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; transition: background .15s ease, color .15s ease, opacity .15s ease; }
.row-del:hover, .row-del:focus-visible { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
@media (hover: hover) { .trow .row-del { opacity: .45; } .trow:hover .row-del, .trow:focus-within .row-del { opacity: 1; } }
/* phones: the row keeps its own layout; the delete button sits in a reserved space on the right */
@media (max-width: 700px) {
  .trow:has(> .row-del-cell) { position: relative; padding-right: 40px; }
  .trow > .row-del-cell { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
}

/* a client row's actions: Statement (and Delete for owners) */
.row-acts { gap: 4px; }
.row-stmt:hover, .row-stmt:focus-visible { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent-text); }
@media (max-width: 700px) { .trow:has(> .row-acts) { padding-right: 72px; } }

/* ---------- statement of account (Clients → Statement) ---------- */
.stmt-controls { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.stmt-controls .field { flex: 1 1 150px; min-width: 0; }
.stmt-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stmt-sum > div { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--paper); min-width: 0; }
.stmt-sum span { font-size: var(--fs-12); color: var(--ink-3); }
.stmt-sum b { font-size: var(--fs-15); font-weight: 650; overflow-wrap: anywhere; }
.stmt-sum .stmt-close b { color: var(--accent-text); }
.stmt-wrap { margin-top: 14px; max-height: 420px; overflow: auto; }
.stmt-tbl td { vertical-align: top; }
.stmt-tbl .stmt-date { white-space: nowrap; }
.stmt-tbl .stmt-part, .stmt-tbl .stmt-detail { display: block; }
.stmt-tbl .stmt-detail { font-size: var(--fs-12); }
.stmt-tbl .r.amt { white-space: nowrap; }
.stmt-tbl .stmt-mob { display: none; font-size: var(--fs-13); color: var(--ink-2); }
@media (max-width: 700px) { .stmt-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* phones: Debit and Credit fold into the Particulars cell, leaving Date, Particulars and Balance */
@media (max-width: 560px) {
  .stmt-tbl .stmt-dc { display: none; }
  .stmt-tbl .stmt-mob { display: block; }
  .stmt-tbl th, .stmt-tbl td { padding: 7px 6px; font-size: var(--fs-13); }
  .stmt-tbl .stmt-date { white-space: normal; width: 4.5em; }
  .stmt-tbl td { overflow-wrap: anywhere; }
}

/* phones: an invoice row is number + client on top and the amount, right-aligned, across the full second line */
@media (max-width: 700px) {
  .trow.inv-row { grid-template-columns: auto minmax(0, 1fr) !important; }
  .trow.inv-row > .amt { grid-column: 1 / -1; }
}

/* ---------- the book switch: the highlight slides to the chosen books ---------- */
.switch { position: relative; view-transition-name: book-switch; }
.switch button { position: relative; z-index: 1; transition: color .25s ease; }
.switch button[aria-selected="true"] { background: transparent; box-shadow: none; }
.switch-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; z-index: 0; pointer-events: none;
  width: calc((100% - 8px - (var(--n) - 1) * 4px) / var(--n));
  transform: translateX(calc(var(--i) * (100% + 4px)));
  background: var(--switch-on-bg); border-radius: 10px; box-shadow: var(--switch-shadow);
  transition: transform .34s cubic-bezier(.2, .8, .2, 1), background-color .3s ease;
}
/* while the page cross-fades to the other books, the switch stays live so its slide shows */
::view-transition-old(book-switch) { display: none; }
::view-transition-new(book-switch) { animation: none; }

/* ---------- touch: 44px hit areas ---------- */
/* On touch screens every icon-only button gets at least a 44×44 hit area. The button and its icon keep their size;
   an invisible ::after extends the area that takes the tap. */
@media (pointer: coarse) {
  .icon-btn, .row-del, .period button, .lock-btn, .swatches label { position: relative; }
  .icon-btn::after, .row-del::after, .period button::after, .lock-btn::after, .swatches label::after {
    content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%);
  }
}

/* ---------- sidebar: pages under collapsible headings ---------- */
.rail-nav { display: grid; gap: 6px; }
.nav-group { display: grid; gap: 2px; }
.nav-h { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; color: var(--rail-ink-2); padding: 8px 12px 4px; border-radius: 10px; font: 700 var(--fs-12)/1.2 var(--body); letter-spacing: .06em; text-transform: uppercase; text-align: left; cursor: pointer; }
.nav-h > span:first-child { flex: 1; }
.nav-h:hover { color: var(--rail-ink); background: var(--rail-hover); }
.nav-h .ic { transition: transform .18s var(--ease-out); }
.nav-h[aria-expanded="true"] .ic { transform: rotate(90deg); }
.nav-h .badge { font-size: var(--fs-12); font-weight: 700; background: var(--bad-fill); color: #fff; border-radius: 999px; padding: 1px 7px; letter-spacing: 0; }
.nav button[data-folded] { display: none; }
@media (max-width: 920px) {
  /* tablets: one scrolling row of every page, no headings */
  .rail-nav { display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; margin: 0 -4px; }
  .rail-nav .nav-group, .rail-nav .nav { display: contents; }
  .nav-h { display: none; }
  .nav button[data-folded] { display: flex; }
}
/* phone "More" sheet: the same headings */
.sheet-sec + .sheet-sec { margin-top: 14px; }
.sheet-h { font: 700 var(--fs-12)/1.2 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 0 2px 8px; }

/* ---------- checks under form fields ---------- */
.field-err, .field > .field-err { display: block; color: var(--bad); font-size: var(--fs-13); font-weight: 500; line-height: var(--lh-small); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .amount-in[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 1px color-mix(in srgb, var(--bad) 45%, transparent); }

/* ---------- ⓘ explanations of tax words ---------- */
.term { display: inline-flex; vertical-align: middle; margin-left: 3px; }
.term-i { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--ink-3); cursor: help; position: relative; }
.term-i:hover, .term-i[aria-expanded="true"] { color: var(--accent-text); }
.term-i:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (pointer: coarse) { .term-i::after { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); } }
.term-tip { position: fixed; z-index: 200; background: var(--ink); color: var(--paper); border-radius: 12px; padding: 10px 12px; font: 500 var(--fs-13)/var(--lh-small) var(--body); text-transform: none; letter-spacing: 0; text-align: left; white-space: normal; box-shadow: var(--shadow); pointer-events: none; animation: fade .12s ease-out; }
.term-tip b { font-weight: 700; }

/* ---------- money at a glance ---------- */
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.glance-tile { display: grid; gap: 3px; align-content: start; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 13px 16px; color: var(--ink); min-width: 0; cursor: pointer; transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out); }
.glance-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.glance-tile .l { font-size: var(--fs-13); font-weight: 650; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.glance-tile .l::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.glance-tile[data-tone="in"] .l::before { background: var(--good-fill); }
.glance-tile[data-tone="out"] .l::before { background: var(--spend); }
.glance-tile[data-tone="tax"] .l::before { background: var(--accent); }
.glance-tile[data-tone="late"] { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.glance-tile[data-tone="late"] .l { color: var(--bad); }
.glance-tile[data-tone="late"] .l::before { background: var(--bad-fill); }
.glance-tile .v { font: 650 var(--fs-20)/1.2 var(--display); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.glance-tile .s { font-size: var(--fs-13); line-height: var(--lh-small); color: var(--ink-3); }
@media (max-width: 700px) {
  .glance { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .glance-tile { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 10px; padding: 10px 14px; }
  .glance-tile .v { font-size: var(--fs-17); text-align: right; }
  .glance-tile .s { grid-column: 1 / -1; }
}

/* ---------- getting started (new company books) ---------- */
.setup-card { display: grid; gap: 12px; }
.setup-head { display: flex; align-items: flex-start; gap: 12px; }
.setup-head h2 { font-size: var(--fs-20); font-weight: 700; }
.setup-count { font-size: var(--fs-14); color: var(--ink-2); margin-top: 2px; }
.setup-bar { height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.setup-bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s var(--ease-out); }
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.setup-step { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 14px; padding: 11px 12px; cursor: pointer; }
.setup-step:hover { background: var(--sunken); }
.setup-step .t { display: block; font-weight: 650; }
.setup-step .s { display: block; font-size: var(--fs-13); line-height: var(--lh-small); color: var(--ink-3); }
.setup-step > .ic { color: var(--ink-3); }
.setup-tick { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 700 var(--fs-13)/1 var(--body); border: 1.5px solid var(--line); color: var(--ink-2); }
.setup-step[data-done] .setup-tick { background: var(--good-fill); border-color: var(--good-fill); color: #fff; }
.setup-step[data-done] .t { color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--ink-3); }

/* ---------- offline / can't-save bar ---------- */
.offline-bar { margin-top: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 14px; border-radius: 12px; font-size: var(--fs-14); font-weight: 600; background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line)); color: var(--ink); }
.offline-bar .ic { color: var(--warn); }
.offline-bar .btn-link { margin-left: auto; }

/* ---------- quick add: the round + on phones, and the shortcuts list ---------- */
.fab-wrap { display: none; }
@media (max-width: 700px) {
  .fab-wrap { display: block; position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 41; }
  .fab { width: 56px; height: 56px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .55); transition: transform .18s var(--ease-out); }
  .fab.open .ic { transform: rotate(45deg); }
  .fab .ic { transition: transform .18s var(--ease-out); }
  .fab-menu { position: absolute; right: 0; bottom: 66px; display: grid; gap: 4px; min-width: 190px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); animation: up .15s ease-out; }
  .fab-menu button { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 11px; background: transparent; color: var(--ink); font-weight: 600; text-align: left; }
  .fab-menu button:hover, .fab-menu button:focus-visible { background: var(--sunken); }
  /* the + adds a transaction here, so the header button would be a second one */
  .top-actions .add-tx { display: none; }
}
.keys-list { margin: 0; display: grid; gap: 8px; }
.keys-list > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.keys-list dt { white-space: nowrap; }
.keys-list dd { margin: 0; }
.keys-list kbd, .shortcuts-dlg kbd { font: 600 var(--fs-12) var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--ink-2); background: var(--sunken); }
.keys-note { font-size: var(--fs-13); margin: 4px 0 0; }

/* ---------- printing on A4: invoices and reports, black on white ---------- */
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  :root {
    --paper: #fff !important; --surface: #fff !important; --sunken: #f2f2f2 !important; --line: #c8c8c8 !important;
    --ink: #000 !important; --ink-2: #222 !important; --ink-3: #444 !important; --accent-text: #000 !important;
    --hero-bg: #fff !important; --hero-ink: #000 !important; --hero-ink-2: #333 !important; --hero-hi: #000 !important; --hero-good: #000 !important; --hero-bad: #000 !important;
    --doc-paper: #fff !important; --doc-ink: #000 !important; --doc-muted: #333 !important; --doc-line: #bbb !important;
    --shadow: none !important; color-scheme: light;
  }
  html, body { background: #fff !important; color: #000 !important; }
  * { animation: none !important; transition: none !important; box-shadow: none !important; text-shadow: none !important; }
  .rail, .tabbar, .sheet-wrap, .fab-wrap, .offline-bar, .banner, .toast, .top-actions, .back-btn, .toolbar .search, .seg, .filter-tabs, .glance, .setup-card, .row-del-cell, dialog, .term-i, button { display: none !important; }
  .app { display: block !important; }
  .main-wrap { padding: 0 !important; }
  .topbar { position: static !important; padding: 0 0 10px !important; background: none !important; backdrop-filter: none !important; }
  .topbar h1 { font-size: 20pt; }
  .grid { display: block !important; }
  .grid > *, .panel, .hero { margin: 0 0 10px !important; }
  .panel, .hero, .tile { background: #fff !important; color: #000 !important; border: 1px solid #c8c8c8 !important; break-inside: avoid; }
  .trow, .li, tr, .doc-total, .doc-sign { break-inside: avoid; }
  h1, h2, h3, .panel-h, .group-h { break-after: avoid; }
  .chart, svg { max-width: 100% !important; }
  a { color: #000; text-decoration: none; }
  /* an invoice prints as just the document */
  .app[data-route="invoice"] .topbar, .app[data-route="invoice"] .sticky-prev { display: none !important; }
  .app[data-route="invoice"] .inv-layout { display: block !important; }
  .doc { border: 0 !important; border-radius: 0 !important; padding: 0 !important; max-width: none !important; }
  .ellipsis { white-space: normal !important; overflow: visible !important; }
}

/* very narrow phones (320–400px): names keep room to be read */
@media (max-width: 400px) {
  .hide-xs { display: none !important; }
  .trow.inv-row { grid-template-columns: minmax(0, 1fr) !important; }
  .trow.inv-row > .amt { text-align: right; }
  .mem-row.bal-row { grid-template-columns: minmax(0, 1fr); row-gap: 2px; }
  .mem-row.bal-row > :last-child { justify-self: end; }
}

/* ---------- “▲ 12% vs Sep” under overview figures: arrow and sign, not colour alone ---------- */
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-12); font-weight: 650; line-height: 1.3; white-space: nowrap; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.hero .delta { color: var(--hero-ink-2); }
.hero .delta.good { color: var(--hero-good); }
.hero .delta.bad { color: var(--hero-bad); }
.hero .big + .delta, .hero .delta.under-big { margin-top: -6px; font-size: var(--fs-13); }
.hero-stats .delta { display: flex; margin-top: 2px; }

/* ---------- invoice list: Mark paid and Send reminder on the row ---------- */
.row-acts { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.row-act { border: 0; background: transparent; color: var(--ink-2); height: 30px; min-width: 30px; padding: 0 7px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: var(--fs-13); font-weight: 600; cursor: pointer; }
.row-act:hover, .row-act:focus-visible { background: var(--accent-soft); color: var(--accent-text); }
.row-act .lbl { display: none; }
.row-act .lbl::after { content: attr(data-l); }
.row-acts .row-del-cell { display: contents; }

/* phones: the actions get their own line under the amount, with words */
@media (max-width: 700px) {
  .trow > .row-acts { grid-column: 1 / -1; justify-self: stretch; gap: 8px; margin-top: 4px; }
  .trow > .row-acts.only-del { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); margin: 0; }
  .trow:has(> .row-acts.only-del) { position: relative; padding-right: 40px; }
  .row-act { border: 1px solid var(--line); height: 34px; padding: 0 12px; }
  .row-act .lbl { display: inline; }
}

/* ---------- suggested category: a chip to accept, never applied by itself ---------- */
.sugg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: -4px; }
.sugg-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 4px 6px 4px 11px; border: 1px dashed var(--accent); border-radius: 999px; background: var(--accent-soft); color: var(--ink); font-size: var(--fs-13); cursor: pointer; max-width: 100%; }
.sugg-chip > span:not(.sugg-use) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sugg-chip .ic { color: var(--accent-text); }
.sugg-use { background: var(--surface); color: var(--accent-text); border-radius: 999px; padding: 3px 10px; font-weight: 700; }
.sugg-chip:hover .sugg-use, .sugg-chip:focus-visible .sugg-use { background: var(--accent); color: var(--accent-ink); }
.sugg-row .hint { font-size: var(--fs-12); color: var(--ink-2); }

/* ---------- bulk edit on Transactions: tick boxes and a sticky bar ---------- */
.sel-cell { display: flex; align-items: center; justify-content: center; align-self: stretch; cursor: pointer; }
.sel-cell input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.trow.selected { background: var(--accent-soft); }
.bulk-bar { position: sticky; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.bulk-bar .select { width: auto; flex: 1 1 180px; max-width: 280px; }
.bulk-n { font-size: var(--fs-14); }
.bulk-sel-btn { display: none; }
/* the whole cell (full row height) ticks the box, which is the touch target */
@media (max-width: 700px) {
  .bulk-sel-btn { display: inline-flex; }
  .table .sel-cell { display: none; }
  .table.selecting .trow { position: relative; padding-left: 48px; }
  .table.selecting .trow > .sel-cell { display: flex; position: absolute; left: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; }
  .bulk-bar { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .bulk-bar .select { max-width: none; }
  .app:has(.bulk-bar) .fab-wrap { display: none; }
}
/* a mid-width invoice list with row actions drops the Issued column so client names keep room */
@container (min-width: 861px) and (max-width: 1120px) {
  .table.has-acts .hide-acts { display: none; }
  .table.has-acts > .thead, .table.has-acts > .trow { grid-template-columns: var(--cols-acts); }
}
.row-acts { gap: 2px; }

/* =====================================================================================================================
   Beautify pass (owner, 17 Oct 2026): amounts, charts, illustrations, avatars, book identity, celebrations, motion,
   richer dark mode, festival accents. Every animation here is switched off by prefers-reduced-motion (see the end).
   ===================================================================================================================== */
:root {
  --raised: #FFFDF9;
  /* one chart palette for every chart: colour-blind-safe order (blue / orange / teal / ochre / violet / rose / grey);
     --chart-1 is the books' own colour, --chart-2 always contrasts with it */
  --chart-1: #E8692F; --chart-2: #2B4A9B; --chart-3: #2B7A73; --chart-4: #C9A227; --chart-5: #8E5BA8; --chart-6: #B4536B; --chart-7: #6B7A80;
  /* illustrations */
  --ill-line: #1A2C2F; --ill-accent: var(--accent); --ill-warm: #FF7540; --ill-bg: var(--accent-soft); --ill-bg-2: color-mix(in srgb, var(--accent) 16%, var(--surface));
  --ill-paper: #FFFDF9; --ill-ink-on-warm: #1A2C2F; --ill-ink-on-accent: var(--accent-ink);
  /* the overview hero's pattern, per books: warm dots (Personal), ledger grid (Company), soft rings (Family) */
  --hero-pattern: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--hero-mark) 16%, transparent) 1.1px, transparent 1.5px) 0 0 / 14px 14px;
  /* festival colours (hero only) */
  --fest-1: #E8692F; --fest-2: #8A3A14; --fest-3: #F2B33D; --fest-h1: #E8488C; --fest-h2: #40AA6E; --fest-h3: #F2B33D; --fest-h4: #466EDC; /* full strength: the motif sits clear of the text (phone 1.7.2) */
  --fest-pine: #2F6B4F; --fest-pine-edge: rgba(26, 44, 47, .18); --fest-trunk: #8A5A3B; --fest-berry: #B8323A; --fest-snow: #7E93C9;
  --fest-saffron: #FF9933; --fest-white: #FFFFFF; --fest-white-edge: rgba(26, 44, 47, .12); --fest-green: #138808;
  --focus-ring: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
:root[data-profile="company"] {
  --chart-1: #2B4A9B; --chart-2: #E8692F;
  --hero-pattern: linear-gradient(color-mix(in srgb, var(--hero-mark) 10%, transparent) 1px, transparent 1px) 0 0 / 22px 22px, linear-gradient(90deg, color-mix(in srgb, var(--hero-mark) 10%, transparent) 1px, transparent 1px) 0 0 / 22px 22px;
}
:root[data-profile="family"] {
  --chart-1: #2B7A73; --chart-2: #E8692F; --chart-3: #2B4A9B;
  --hero-pattern: repeating-radial-gradient(circle at 100% 0, transparent 0 14px, color-mix(in srgb, var(--hero-mark) 12%, transparent) 14px 15.5px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --raised: #1E2326;
    --chart-1: #FF8A57; --chart-2: #8FA8FF; --chart-3: #5FC9BE; --chart-4: #E8C350; --chart-5: #B78CDA; --chart-6: #E07C97; --chart-7: #9AA8AD;
    --ill-line: #C6D6D5; --ill-paper: #1E2326; --ill-bg-2: color-mix(in srgb, var(--accent) 22%, var(--surface));
    --fest-2: #FFC2A6; --fest-snow: #DCEBFF; --fest-pine: #4FA477; --fest-pine-edge: #BFF0D2; --fest-trunk: #C89A72; --fest-berry: #FF6B72;
  }
  :root:not([data-theme="light"])[data-profile="company"] {
    --chart-1: #8FA8FF; --chart-2: #FF8A57;
  }
  :root:not([data-theme="light"])[data-profile="family"] {
    --chart-1: #5FC9BE; --chart-2: #FF8A57; --chart-3: #8FA8FF;
  }
}
:root[data-theme="dark"] {
  --raised: #1E2326;
  --chart-1: #FF8A57; --chart-2: #8FA8FF; --chart-3: #5FC9BE; --chart-4: #E8C350; --chart-5: #B78CDA; --chart-6: #E07C97; --chart-7: #9AA8AD;
  --ill-line: #C6D6D5; --ill-paper: #1E2326; --ill-bg-2: color-mix(in srgb, var(--accent) 22%, var(--surface));
  --fest-2: #FFC2A6; --fest-snow: #DCEBFF; --fest-pine: #4FA477; --fest-pine-edge: #BFF0D2; --fest-trunk: #C89A72; --fest-berry: #FF6B72;
}
:root[data-theme="dark"][data-profile="company"] {
  --chart-1: #8FA8FF; --chart-2: #FF8A57;
}
:root[data-theme="dark"][data-profile="family"] {
  --chart-1: #5FC9BE; --chart-2: #FF8A57; --chart-3: #8FA8FF;
}

/* ---------- spacing: one 4/8 grid and one card-header style ---------- */
.panel { padding: 20px; }
.panel-h { margin-bottom: 16px; min-height: 28px; }
.panel-h h2 { font: 650 var(--fs-17)/1.25 var(--display); letter-spacing: -0.01em; }
.tile { padding: 16px; border-radius: 16px; }
.li { padding: 12px 0; }
.hero { padding: 24px; }
@media (max-width: 700px) { .panel { padding: 16px; } .hero { padding: 20px; } }

/* ---------- amounts (MoneyText in Art.tsx): one rule for every standalone figure ----------
   Running text, lists and tables: a plain, full-size ₹ on the baseline (no rule at all).
   Standalone figures (MoneyText `fig`: the hero, tiles, glance tiles, hero stats, Receivables totals, card and account
   balances, settle-up cards; every CountUp): the currency symbol or code at --sym-ratio of the figure, weight 600, top-
   aligned with the digits' cap height, in the same proportion at every size (the offset is in the figure's own ems,
   so tests can compare it); paise smaller on the baseline; L / K / Cr units small. The symbol keeps the figure's colour
   (no fading), so red and green figures still read 4.5:1. */
:root { --sym-ratio: .6; --frac-ratio: .66; }
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.money .m-unit { margin-left: .03em; }
.money.fig .m-sym { font-size: calc(var(--sym-ratio) * 1em); font-weight: 600; position: relative; top: calc(-.28em / var(--sym-ratio)); margin-right: .06em; }
.money.fig .m-frac { font-size: calc(var(--frac-ratio) * 1em); font-weight: 600; }
.money.fig .m-unit { font-size: .72em; font-weight: 700; opacity: .85; }
.hero .big .money .m-sign { font-size: .7em; }
.hero-stats .v { font: 650 var(--fs-17)/1.25 var(--display); letter-spacing: -0.01em; }
/* Hide amounts: the four dots stay apart (in a bold display face they run together), sized and centred on the figures */
.money .m-mask { font-weight: 500; font-size: .72em; letter-spacing: .2em; position: relative; top: -.24em; margin-right: -.2em; }
/* plain-text amounts (tiles, stats, list figures): while amounts are hidden they hold only "₹••••", so space them the same way */
:root[data-masked] .amt, :root[data-masked] .glance-tile .v, :root[data-masked] .hero-stats .v, :root[data-masked] .tile .v, :root[data-masked] .stat-num { letter-spacing: .14em; }
:root[data-masked] .amt .money, :root[data-masked] .hero-stats .v .money, :root[data-masked] .tile .v .money { letter-spacing: normal; }
.counting { display: inline-block; }

/* ---------- avatars and category icons ---------- */
.avatar.ini { color: #fff; font: 700 var(--fs-13)/1 var(--display); letter-spacing: .01em; border-radius: 50%; }
.avatar.ini.sm { font-size: var(--fs-12); }
.avatar.ini::before { content: attr(data-initials); }
.cat-badge { flex: none; display: inline-grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: color-mix(in srgb, var(--c) 78%, var(--ink)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent); }
.tx-desc { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tx-desc > .grow { min-width: 0; flex: 1; overflow: hidden; }
.tx-desc .cat-badge { width: 34px !important; height: 34px !important; }
@media (max-width: 400px) { .tx-desc .cat-badge { display: none; } }

/* ---------- illustrations ---------- */
.ill { display: block; flex: none; max-width: 100%; height: auto; }
.empty .ill { margin-bottom: 4px; animation: ill-in .5s var(--ease-out) backwards; }
@keyframes ill-in { from { opacity: 0; transform: translateY(6px) scale(.96); } }
.setup-head .ill { width: 88px; margin: -6px 0 -10px; }
@media (max-width: 520px) { .setup-head .ill { display: none; } }
.auth-art { position: relative; z-index: 1; max-width: 400px; }
.ill-signin { width: 100%; height: auto; }

/* ---------- the overview hero: the books' texture, kept away from the text ---------- */
.hero { isolation: isolate; }
.app[data-route="dashboard"] .hero::before { content: ""; position: absolute; inset: 0; background: var(--hero-pattern); pointer-events: none; z-index: -1;
  -webkit-mask-image: linear-gradient(105deg, transparent 38%, #000 82%); mask-image: linear-gradient(105deg, transparent 38%, #000 82%); }
.hero::after { z-index: -1; }
:root[data-theme="dark"] .hero { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); } }

/* festival accents (Settings → Appearance; off by default; only on the festival's dates) */
.hero[data-festival] > .row:first-child { padding-right: 112px; }
.fest-art { position: absolute; top: 14px; right: 16px; width: 112px; height: auto; pointer-events: none; z-index: 0; }
.fest-greet { font: 600 var(--fs-13)/var(--lh-small) var(--body); color: var(--hero-ink-2); }
.fest-art .flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flicker 1.6s ease-in-out infinite alternate; }
@keyframes flicker { from { transform: scaleY(1) rotate(-2deg); } to { transform: scaleY(1.12) rotate(2deg); } }
@media (max-width: 520px) { .fest-art { width: 84px; top: 12px; right: 12px; } .hero[data-festival] > .row:first-child { padding-right: 88px; } }

/* ---------- charts ---------- */
/* bars by period, as on the phone (1.7.2): money in green, money out in the books' colour; the current period bright,
   earlier (or later, projected) periods the same colours faded into the card */
.c-a { fill: var(--good-fill); } .c-b { fill: var(--chart-now); }
.c-a.past { fill: var(--chart-in-past); } .c-b.past { fill: var(--chart-past); }
.chart-wrap { position: relative; }
.chart .hit, .flow-chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover, .chart .hit:focus-visible, .flow-chart .hit:hover, .flow-chart .hit:focus-visible { fill: color-mix(in srgb, var(--ink) 5%, transparent); outline: none; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--paper); border-radius: 12px; padding: 8px 12px; font: 500 var(--fs-13)/var(--lh-small) var(--body); box-shadow: var(--shadow); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .15s ease, left .18s var(--ease-out), top .18s var(--ease-out); }
.chart-tip.on { opacity: 1; }
.chart-tip b { display: block; font-weight: 700; margin-bottom: 2px; }
.chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.area-fill { opacity: .9; }

/* ---------- motion: gentle page fade and press feedback ---------- */
.page { animation: page-in .26s var(--ease-out); }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }
.btn:active:not(:disabled), .icon-btn:active:not(:disabled), .chip-btn:active, .seg button:active, .theme-tile:active { transform: scale(.97); }
.glance-tile:active, .setup-step:active, .add-pick:active, .use-pick:active, .li.clickable:active, .ccard:active, .loan-card:active { transform: scale(.985); }
.icon-btn, .chip-btn, .theme-tile, .setup-step, .add-pick, .li.clickable { transition: transform .1s ease, background-color .15s ease, border-color .15s ease, color .15s ease; }

/* ---------- focus rings ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: var(--focus-ring); }
.rail :focus-visible, .tabbar :focus-visible { outline-color: var(--rail-indicator); box-shadow: 0 0 0 4px color-mix(in srgb, var(--rail-indicator) 25%, transparent); }
.input:focus-visible, .select:focus-visible, textarea.input:focus-visible { box-shadow: var(--focus-ring); }

/* ---------- toast: a check that draws itself after a save ---------- */
.toast-ok { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--good-fill); color: #fff; margin-left: -4px; }
.toast-ok path { stroke-dasharray: 20; stroke-dashoffset: 20; animation: draw-check .38s .08s var(--ease-out) forwards; }
.toast.show .toast-ok { animation: pop-in .28s var(--ease-out); }
@keyframes draw-check { to { stroke-dashoffset: 0; } }
@keyframes pop-in { from { transform: scale(.4); opacity: 0; } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 300; }

/* ---------- loading: placeholders shaped like the overview ---------- */
.skel-app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100dvh; }
.skel-rail { background: var(--rail-bg); border-right: 1px solid var(--rail-border); padding: 22px 18px; display: grid; align-content: start; gap: 14px; }
.skel-main { padding: 24px 32px; display: grid; align-content: start; gap: 16px; }
.skel { background: var(--sunken); border-radius: 12px; position: relative; overflow: hidden; }
.skel-rail .skel { background: rgba(255, 255, 255, .07); }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 55%, transparent), transparent); animation: shimmer 1.3s ease-in-out infinite; }
.skel-rail .skel::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.skel-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.skel-hero { height: 230px; border-radius: 22px; background: var(--hero-bg); }
.skel-label { text-align: center; color: var(--ink-3); font-size: var(--fs-14); }
@media (max-width: 920px) { .skel-app { grid-template-columns: minmax(0, 1fr); } .skel-rail { grid-auto-flow: column; padding: 14px 16px; } .skel-main { padding: 16px; } .skel-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .skel-row { grid-template-columns: minmax(0, 1fr); } }

/* ---------- invoice designs: Classic (as before), Modern, Minimal; brand colour from Settings ---------- */
.doc { --inv-accent: var(--accent-print, #2B4A9B); }
.doc-band .doc-stamp { color: #fff; }
.doc .doc-kind { color: var(--inv-accent); }
.doc .doc-totals .grand { background: var(--inv-accent); }
.doc.inv-bold { padding-top: 0; overflow: hidden; }
.doc.inv-bold .doc-band { margin: 0 -42px 28px; padding: 26px 42px 22px; background: var(--inv-accent); color: #fff; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-end; }
.doc.inv-bold .doc-band .doc-kind { color: #fff; }
.doc.inv-bold .doc-band .m, .doc.inv-bold .doc-band h4 { color: rgba(255, 255, 255, .82); }
.doc.inv-bold .doc-logo { background: #fff; border-radius: 8px; padding: 6px; }
.doc.inv-bold .doc-items th { background: color-mix(in srgb, var(--inv-accent) 10%, #fff); color: var(--doc-ink); }
.doc.inv-bold .doc-totals .grand { border-radius: 999px; }
@media (max-width: 700px) { .doc.inv-bold .doc-band { margin: 0 -20px 22px; padding: 20px; } }
.style-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.style-pick { display: grid; gap: 8px; justify-items: center; padding: 10px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-weight: 650; font-size: var(--fs-14); }
.style-pick[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.style-thumb { width: 100%; max-width: 92px; aspect-ratio: .78; border-radius: 6px; background: #fff; box-shadow: 0 0 0 1px var(--doc-line); position: relative; overflow: hidden; }
.style-thumb i { position: absolute; display: block; border-radius: 2px; background: #D9DCE1; }
.accent-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.accent-swatch { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); padding: 0; }
.accent-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
@media (pointer: coarse) { .accent-swatch { position: relative; } .accent-swatch::after { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); } }
.accent-row input[type="color"] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
@media (max-width: 420px) { .style-picks { gap: 6px; } .style-pick { padding: 8px 4px; font-size: var(--fs-13); } }

/* ---------- richer dark mode: layered surfaces, soft borders, a glow on accents ---------- */
:root[data-theme="dark"] dialog, :root[data-theme="dark"] .fab-menu, :root[data-theme="dark"] .sheet, :root[data-theme="dark"] .bulk-bar { background: var(--raised); box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 30px 80px -20px rgba(0, 0, 0, .7); }
:root[data-theme="dark"] .panel, :root[data-theme="dark"] .tile, :root[data-theme="dark"] .glance-tile, :root[data-theme="dark"] .loan-card { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 1px 2px rgba(0, 0, 0, .25); }
:root[data-theme="dark"] .rail { border-right: 1px solid var(--rail-border); box-shadow: 1px 0 0 rgba(0, 0, 0, .35); }
:root[data-theme="dark"] .btn-primary { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent), 0 6px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
:root[data-theme="dark"] .seg-thumb, :root[data-theme="dark"] .switch-thumb { box-shadow: 0 0 16px -4px color-mix(in srgb, var(--accent) 70%, transparent); }
:root[data-theme="dark"] .nav button[aria-current="page"]::before { box-shadow: 0 0 10px 1px var(--rail-indicator); }
:root[data-theme="dark"] .bar > i, :root[data-theme="dark"] .setup-bar > i { box-shadow: 0 0 10px -2px color-mix(in srgb, var(--accent) 70%, transparent); }
:root[data-theme="dark"] .tabbar { border-top-color: var(--rail-border); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) dialog, :root:not([data-theme="light"]) .fab-menu, :root:not([data-theme="light"]) .sheet, :root:not([data-theme="light"]) .bulk-bar { background: var(--raised); box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 30px 80px -20px rgba(0, 0, 0, .7); }
  :root:not([data-theme="light"]) .panel, :root:not([data-theme="light"]) .tile, :root:not([data-theme="light"]) .glance-tile, :root:not([data-theme="light"]) .loan-card { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 1px 2px rgba(0, 0, 0, .25); }
  :root:not([data-theme="light"]) .rail { border-right: 1px solid var(--rail-border); box-shadow: 1px 0 0 rgba(0, 0, 0, .35); }
  :root:not([data-theme="light"]) .btn-primary { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent), 0 6px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
  :root:not([data-theme="light"]) .seg-thumb, :root:not([data-theme="light"]) .switch-thumb { box-shadow: 0 0 16px -4px color-mix(in srgb, var(--accent) 70%, transparent); }
  :root:not([data-theme="light"]) .nav button[aria-current="page"]::before { box-shadow: 0 0 10px 1px var(--rail-indicator); }
  :root:not([data-theme="light"]) .bar > i, :root:not([data-theme="light"]) .setup-bar > i { box-shadow: 0 0 10px -2px color-mix(in srgb, var(--accent) 70%, transparent); }
  :root:not([data-theme="light"]) .tabbar { border-top-color: var(--rail-border); }
}

/* ---------- quiet scrollbars on dark backgrounds (as in the sidebar) ---------- */
:root[data-theme="dark"] :is(.dlg-b, .quick-list, .imp-table, .table-wrap, .auth-policy, .sheet, .receipt-view) { scrollbar-width: thin; scrollbar-color: transparent transparent; }
:root[data-theme="dark"] :is(.dlg-b, .quick-list, .imp-table, .table-wrap, .auth-policy, .sheet, .receipt-view):is(:hover, :focus-within) { scrollbar-color: rgba(255, 255, 255, .18) transparent; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.dlg-b, .quick-list, .imp-table, .table-wrap, .auth-policy, .sheet, .receipt-view) { scrollbar-width: thin; scrollbar-color: transparent transparent; }
  :root:not([data-theme="light"]) :is(.dlg-b, .quick-list, .imp-table, .table-wrap, .auth-policy, .sheet, .receipt-view):is(:hover, :focus-within) { scrollbar-color: rgba(255, 255, 255, .18) transparent; }
}
:is(.dlg-b, .quick-list, .imp-table, .table-wrap, .auth-policy, .sheet)::-webkit-scrollbar { width: 8px; height: 8px; }
:is(.dlg-b, .quick-list, .imp-table, .table-wrap, .auth-policy, .sheet)::-webkit-scrollbar-thumb { background: transparent; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
:is(.dlg-b, .quick-list, .imp-table, .table-wrap, .auth-policy, .sheet):hover::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--ink) 22%, transparent); }

@media (prefers-reduced-motion: reduce) {
  .page, .empty .ill, .toast-ok, .toast-ok path, .fest-art .flame, .skel::after { animation: none !important; }
  .toast-ok path { stroke-dashoffset: 0; }
  .chart-tip { transition: none; }
}
@media print {
  .fest-art, .fest-greet, .hero::before, .confetti { display: none !important; }
  .doc.inv-bold .doc-band { margin: 0 0 22px !important; padding: 18px 20px !important; border-radius: 6px; }
  .doc .doc-band, .doc .doc-totals .grand, .doc.inv-bold .doc-items th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.delta .dg { display: inline-flex; align-items: center; margin-right: 1px; }
.delta .dg-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the sticky page header is solid, so cards scrolling under it never show through */
.topbar { background: var(--paper); backdrop-filter: none; -webkit-backdrop-filter: none; }
.doc.inv-bold .doc-parties { border-top: 0; margin-top: 0; padding-top: 4px; }

/* ---------- notifications (the bell): lib/alerts.ts, Alerts.tsx ---------- */
:root { --book-personal: #B5431A; --book-company: #2B4A9B; --book-family: #22665F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --book-personal: #FF9268; --book-company: #9DB3FF; --book-family: #7FD8CE; } }
:root[data-theme="dark"] { --book-personal: #FF9268; --book-company: #9DB3FF; --book-family: #7FD8CE; }
:root { --badge-bg: #C2453C; } /* the light theme's bad-fill; white on it is 4.9:1 in both themes */
.rail-brand { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.bell-wrap { position: relative; display: inline-flex; flex: none; }
.bell-btn { position: relative; width: 38px; height: 38px; border-radius: 12px; border-color: transparent; background: transparent; color: var(--rail-ink); }
.bell-btn:hover, .bell-btn.on { background: var(--rail-active-bg); color: var(--rail-ink); }
.bell-badge { position: absolute; top: 1px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--badge-bg, #C2453C); color: #fff; font: 700 var(--fs-12)/14px var(--body); letter-spacing: -.01em; text-align: center; border: 2px solid var(--rail-bg); pointer-events: none; transform: translate(25%, -15%); }
.alerts-scrim { position: fixed; inset: 0; z-index: 49; background: rgba(8, 14, 16, .09); animation: fade .15s ease-out; } /* a light dim, no blur; clicking it closes */
.alerts-pop { position: fixed; top: 72px; left: 16px; z-index: 50; width: min(420px, calc(100vw - 32px)); max-height: min(72vh, 640px); display: flex; flex-direction: column; background: var(--raised, var(--surface)); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 60px -20px rgba(20, 20, 20, .35), var(--shadow); animation: fade .12s ease-out; text-align: left; }
.alerts-grip { display: none; }
.alerts-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.alerts-head h2 { font-size: var(--fs-17); font-weight: 750; margin: 0; flex: 1; }
.alerts-tabs { padding: 10px 14px 4px; overflow-x: auto; scrollbar-width: none; flex: none; }
.alerts-tabs .seg { display: flex; width: 100%; } /* fills the row: 2 to 4 tabs share it evenly, no trailing gap */
.alerts-tabs .seg button { flex: 1 1 0; min-width: 0; justify-content: center; padding-inline: 8px; }
.alerts-body { overflow: auto; padding: 6px 8px 10px; overscroll-behavior: contain; }
.alert-group { margin-top: 6px; }
.alert-gh { font-size: var(--fs-12); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); margin: 8px 10px 4px; }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.alert-row { width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 10px; border: 0; border-radius: 12px; background: none; text-align: left; color: var(--ink); }
.alert-row:hover, .alert-row:focus-visible { background: var(--sunken); }
.alert-row > .ic { flex: none; color: var(--ink-3); margin-top: 2px; }
.alert-sev { flex: none; width: 4px; align-self: stretch; border-radius: 2px; background: var(--line); }
.alert-row[data-sev="urgent"] .alert-sev { background: var(--bad-fill); }
.alert-row[data-sev="soon"] .alert-sev { background: var(--warn-fill); }
.alert-row[data-sev="info"] .alert-sev { background: var(--info); }
.alert-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.alert-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.book-chip { font: 700 var(--fs-12)/1 var(--body); padding: 4px 8px; border-radius: 999px; color: var(--ink-2); background: color-mix(in srgb, currentColor 12%, transparent); }
.book-chip[data-book="personal"] { color: var(--book-personal); }
.book-chip[data-book="company"] { color: var(--book-company); }
.book-chip[data-book="family"] { color: var(--book-family); }
.alert-tag { font-size: var(--fs-12); font-weight: 650; color: var(--ink-3); }
.alert-row[data-sev="urgent"] .alert-tag { color: var(--bad); }
.alert-row[data-sev="soon"] .alert-tag { color: var(--warn); }
.alert-t { font-weight: 650; font-size: var(--fs-14); line-height: var(--lh-small); overflow-wrap: anywhere; }
.alert-d { font-size: var(--fs-13); line-height: var(--lh-small); color: var(--ink-2); overflow-wrap: anywhere; }
.alert-act { font-size: var(--fs-12); font-weight: 650; color: var(--accent-text); }
.alert-row[data-read] .alert-t { font-weight: 550; color: var(--ink-2); }
.alert-unread { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--accent); }
.alerts-caught { margin: 10px; color: var(--ink-3); font-size: var(--fs-13); text-align: center; }
.alerts-empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 18px 16px 22px; color: var(--ink-2); font-size: var(--fs-14); }
.alerts-empty b { color: var(--ink); font-size: var(--fs-15); }
@media (max-width: 700px) {
  .alerts-scrim { background: rgba(8, 14, 16, .35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
  .alerts-pop { position: fixed; top: max(24px, env(safe-area-inset-top, 0px)); left: 0; right: 0; bottom: 0; width: auto; max-height: none; border-radius: 22px 22px 0 0; border-width: 1px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); animation: up .2s ease-out; }
  .alerts-grip { display: block; margin: 8px auto 2px; }
  .alerts-head { padding-left: 16px; }
}
@media (prefers-reduced-motion: reduce) { .alerts-pop, .alerts-scrim { animation: none !important; } .alerts-scrim { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; } }
@media (prefers-reduced-transparency: reduce) { .alerts-scrim { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; } }
@media (max-width: 920px) {
  .rail-brand { flex: 1 1 auto; justify-content: flex-start; }
  .rail-brand .bell-wrap { margin-left: auto; }
  .bell-btn { width: 40px; height: 40px; }
}
@media print { .bell-wrap { display: none !important; } }
@media (max-width: 360px) { .alerts-tabs { padding-inline: 10px; } .alerts-tabs .seg button { padding-inline: 4px; font-size: var(--fs-13); } }

/* ---------- a small “⋯” menu on a row (Settings → Your books, family books) ---------- */
.more-wrap { position: relative; display: inline-flex; }
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: grid; gap: 2px; min-width: 220px; padding: 6px; background: var(--raised, var(--surface)); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); animation: fade .12s ease-out; }
.more-menu button { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font-weight: 600; text-align: left; white-space: nowrap; }
.more-menu button:hover, .more-menu button:focus-visible { background: var(--sunken); }
.more-menu button.danger { color: var(--bad); }
@media (prefers-reduced-motion: reduce) { .more-menu { animation: none; } }

/* ---------- “View in” currency on the overview (display only): lib/fxview.ts, ViewIn.tsx ---------- */
.view-in { display: grid; gap: 6px; justify-items: end; margin-bottom: -4px; }
.view-in-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.view-in-ctl { font-size: var(--fs-13); font-weight: 600; color: var(--ink-2); }
.view-in-sel { width: auto; min-width: 0; max-width: min(260px, 70vw); padding-block: 6px; font-size: var(--fs-14); }
.view-in-busy { font-size: var(--fs-13); }
.view-in-note, .view-in-msg { margin: 0; font-size: var(--fs-13); line-height: var(--lh-small); text-align: right; max-width: 640px; }
.view-in-note { color: var(--ink-2); }
.view-in-msg { color: var(--warn); }
@media (max-width: 700px) { .view-in { justify-items: start; } .view-in-row { justify-content: flex-start; } .view-in-note, .view-in-msg { text-align: left; } }
@media print { .view-in { display: none !important; } }

/* ---------- the book switch's menu (BookMenu.tsx): right-click / Shift+F10 on desktop, long press on touch ---------- */
.switch button { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.book-menu { position: fixed; z-index: 90; display: grid; gap: 2px; padding: 6px; background: var(--raised, var(--surface)); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); animation: fade .12s ease-out; }
.book-menu button { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font-weight: 600; text-align: left; }
.book-menu button > svg { flex: none; margin-top: 2px; }
.book-menu button:hover:not([aria-disabled="true"]), .book-menu button:focus-visible { background: var(--sunken); outline: none; }
.book-menu button.danger { color: var(--bad); }
.book-menu button[aria-disabled="true"] { color: var(--ink-3); cursor: not-allowed; }
.book-menu .bm-l { display: grid; gap: 2px; min-width: 0; }
.book-menu .bm-why, .book-menu .bm-note { font: 500 var(--fs-12)/var(--lh-small) var(--body); color: var(--ink-3); }
.book-menu .bm-note { margin: 4px 12px 6px; }
.book-menu.sheet { left: 0; right: 0; bottom: 0; border-radius: 20px 20px 0 0; padding: 10px 10px max(14px, env(safe-area-inset-bottom, 0px)); border-bottom: 0; animation: bm-up .2s var(--ease-out, ease-out); }
.book-menu .bm-head { display: grid; gap: 2px; padding: 8px 12px 10px; font: 650 var(--fs-17)/1.25 var(--display); }
.book-menu .bm-head span { font: 500 var(--fs-13)/var(--lh-small) var(--body); color: var(--ink-2); }
.bm-scrim { position: fixed; inset: 0; z-index: 89; background: rgba(10, 16, 18, .38); }
@keyframes bm-up { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .book-menu, .book-menu.sheet { animation: none; } }

/* the header's light/dark button while following the device (Auto): a small “A” in its corner */
.theme-toggle { position: relative; }
.theme-auto-mark { position: absolute; right: -4px; bottom: -4px; min-width: 17px; height: 17px; padding: 0 3px; border-radius: 9px; background: var(--sunken); color: var(--ink-2); border: 1px solid var(--line); font: 700 var(--fs-12)/15px var(--body); text-align: center; pointer-events: none; }

/* read-only dialogs (company viewers, family children): everything shown, nothing editable */
.ro-set { border: 0; padding: 0; margin: 0; min-width: 0; display: contents; }
.ro-hint { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; color: var(--ink-2); }

/* ---------- invoice designs: Ledger and Statutory GST (lib/invoiceStyle.ts; the PDF draws the same in lib/pdf.ts) ---------- */
/* the invoice fonts, from public/fonts (SIL Open Font License); downloaded only when an invoice uses them */
@font-face { font-family: 'Inv Plex'; src: url('/fonts/IBMPlexSans-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inv Plex'; src: url('/fonts/IBMPlexSans-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inv Plex'; src: url('/fonts/IBMPlexSans-Bold.ttf') format('truetype'); font-weight: 700 800; font-display: swap; }
@font-face { font-family: 'Inv Poppins'; src: url('/fonts/Poppins-SemiBold.ttf') format('truetype'); font-weight: 600 800; font-display: swap; }
@font-face { font-family: 'Inv Serif'; src: url('/fonts/SourceSerif4-SemiBold.ttf') format('truetype'); font-weight: 600 800; font-display: swap; }
.doc.inv-ledger, .doc.inv-statutory, .doc.inv-bold, .doc.inv-letterhead, .doc.inv-sidebar { font-family: 'Inv Plex', 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif; }
/* Bold: Poppins for the name, title and amount due, on the band in the brand colour */
.doc.inv-bold .doc-biz, .doc.inv-bold .doc-kind, .doc.inv-bold .doc-due .v, .doc.inv-sidebar .doc-kind, .doc.inv-sidebar .doc-biz { font-family: 'Inv Poppins', 'Poppins', 'Segoe UI', sans-serif; font-weight: 600; letter-spacing: -0.01em; }
.doc.inv-bold .doc-due .v { color: var(--inv-accent); }
/* Letterhead: centred serif letterhead over a double rule */
.doc.inv-letterhead .doc-head { flex-direction: column; align-items: center; text-align: center; gap: 10px; border-bottom: 3px double var(--inv-accent); padding-bottom: 14px; }
.doc.inv-letterhead .doc-head > div:first-child { display: grid; justify-items: center; }
.doc.inv-letterhead .doc-biz { font-family: 'Inv Serif', 'Source Serif 4', Georgia, serif; font-weight: 600; font-size: var(--fs-24); color: var(--inv-accent); letter-spacing: 0; }
.doc.inv-letterhead .doc-meta { text-align: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 14px; }
.doc.inv-letterhead .doc-kind { flex-basis: 100%; text-align: center; font-family: 'Inv Serif', 'Source Serif 4', Georgia, serif; font-weight: 600; font-size: var(--fs-15); letter-spacing: .3em; text-transform: uppercase; color: var(--doc-ink); margin: 6px 0 2px; }
.doc.inv-letterhead .doc-parties { border-top: 0; }
.doc.inv-letterhead .doc-parties h4 { color: var(--inv-accent); }
.doc.inv-letterhead .doc-items th { background: transparent; border-top: 1px solid var(--doc-ink); border-bottom: 1px solid var(--doc-ink); }
.doc.inv-letterhead .doc-totals .grand { background: transparent; color: var(--doc-ink); border-radius: 0; padding-inline: 0; border-top: 1px solid var(--doc-ink); border-bottom: 3px double var(--doc-ink); font-family: 'Inv Serif', 'Source Serif 4', Georgia, serif; font-size: var(--fs-16); }
/* Sidebar: business, client and how to pay in a tinted column; the invoice itself on the right */
.doc.inv-sidebar { display: grid; grid-template-columns: minmax(0, 30%) minmax(0, 1fr); column-gap: 32px; align-content: start;
  background: linear-gradient(to right, color-mix(in srgb, var(--inv-accent) 7%, #fff) calc(58px + (100% - 116px) * .3), var(--doc-paper) 0); }
.doc.inv-sidebar .doc-head, .doc.inv-sidebar .doc-parties { display: contents; }
.doc.inv-sidebar .doc-head > div:first-child { grid-column: 1; grid-row: 1; }
.doc.inv-sidebar .doc-parties > div:first-child { grid-column: 1; grid-row: 2; padding-top: 18px; }
.doc.inv-sidebar .doc-foot { grid-column: 1; grid-row: 3 / span 8; grid-template-columns: minmax(0, 1fr); align-content: start; border-top: 0; margin-top: 18px; padding-top: 0; }
.doc.inv-sidebar .doc-meta { grid-column: 2; grid-row: 1; text-align: left; }
.doc.inv-sidebar .doc-kind { text-align: left; color: var(--doc-ink); font-size: var(--fs-30); }
.doc.inv-sidebar .doc-due { grid-column: 2; grid-row: 2; text-align: left; padding-top: 18px; border-top: 1.4px solid var(--doc-ink); margin-top: 14px; }
.doc.inv-sidebar .doc-due .v { color: var(--inv-accent); }
.doc.inv-sidebar > :not(.doc-head):not(.doc-parties):not(.doc-foot) { grid-column: 2; }
.doc.inv-sidebar .doc-parties h4, .doc.inv-sidebar .doc-foot h4 { color: var(--inv-accent); }
.doc.inv-sidebar .doc-items th { background: transparent; border-bottom: 1.2px solid var(--doc-ink); }
.doc.inv-sidebar .doc-totals .grand { background: transparent; color: var(--inv-accent); border-top: 1.5px solid var(--doc-ink); border-radius: 0; padding-inline: 0; font-family: 'Inv Poppins', 'Poppins', sans-serif; font-size: var(--fs-18); }
@media (max-width: 700px) {
  .doc.inv-sidebar { display: block; background: var(--doc-paper); }
  .doc.inv-sidebar .doc-head, .doc.inv-sidebar .doc-parties { display: flex; }
  .doc.inv-sidebar .doc-due { border-top: 0; margin-top: 0; padding-top: 0; }
}
@media print { .doc.inv-sidebar { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.doc.inv-ledger .doc-biz, .doc.inv-ledger .doc-due .v { font-family: inherit; font-weight: 600; letter-spacing: 0; }
.doc.inv-ledger .doc-kind { font-family: inherit; font-weight: 600; font-size: var(--fs-24); line-height: 1.1; text-transform: uppercase; letter-spacing: .02em; }
.doc.inv-ledger .doc-head { border-bottom: 1.5px solid var(--doc-ink); padding-bottom: 18px; }
.doc.inv-ledger .doc-parties { border-top: 0; }
.doc.inv-ledger .doc-items th { background: transparent; border-bottom: 1.2px solid var(--doc-ink); }
.doc.inv-ledger .doc-totals .grand { background: transparent; color: var(--inv-accent); border-top: 1.5px solid var(--doc-ink); border-radius: 0; padding-inline: 0; font-size: var(--fs-18); font-weight: 600; }

.doc.inv-statutory { padding: 28px; }
.st-frame { border: 1.5px solid var(--doc-ink); }
.st-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-bottom: 1.5px solid var(--doc-ink); }
.st-row > * { padding: 10px 12px; min-width: 0; }
.st-row > * + * { border-left: 1px solid var(--doc-ink); }
.st-row.st-head { grid-template-columns: minmax(0, 1fr) 200px; }
.st-row.st-sum { grid-template-columns: minmax(0, 1fr) minmax(220px, 40%); }
.st-name { font-weight: 700; font-size: var(--fs-16); text-transform: uppercase; }
.st-title { display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center; }
.st-title b { color: var(--inv-accent); font-size: var(--fs-18); letter-spacing: .04em; }
.st-title span { border: 1px solid var(--doc-ink); padding: 1px 8px; font-size: var(--fs-12); font-weight: 700; }
.st-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 14px; align-content: start; }
.st-facts dt { color: var(--doc-muted); }
.st-facts dd { margin: 0; overflow-wrap: anywhere; }
.st-scroll { overflow-x: auto; border-bottom: 1.5px solid var(--doc-ink); }
.st-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: var(--fs-12); }
.st-table th, .st-table td { border: 1px solid #BFC4C2; padding: 6px 7px; vertical-align: top; }
.st-table th { background: #F1F2F0; font-weight: 700; text-align: left; white-space: nowrap; }
.st-table tr > :first-child { border-left: 0; }
.st-table tr > :last-child { border-right: 0; }
.st-table thead tr:first-child > * { border-top: 0; }
.st-table tbody tr:last-child > *, .st-table tfoot tr:last-child > * { border-bottom: 0; }
.st-table .r { text-align: right; white-space: nowrap; }
.st-table tfoot td { background: #F1F2F0; font-weight: 700; }
.st-totals { display: grid; gap: 3px; font-variant-numeric: tabular-nums; }
.st-totals .row { justify-content: space-between; }
.st-totals .grand { font-weight: 700; font-size: var(--fs-15); border-top: 1px solid var(--doc-ink); padding-top: 4px; margin-top: 2px; }
.st-label { display: block; font-size: var(--fs-12); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--doc-muted); margin-bottom: 2px; }
.st-end { display: grid; gap: 8px; align-content: start; white-space: pre-line; }
.st-end .doc-upi, .st-end .einv-qr { white-space: normal; }
.st-sign { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; text-align: right; gap: 10px; min-height: 120px; }
.st-sign img { max-height: 52px; max-width: 180px; object-fit: contain; }
.st-sign .line { border-top: 1px solid var(--doc-line); padding-top: 4px; min-width: 170px; }
.st-note { text-align: center; color: var(--doc-muted); font-size: var(--fs-12); margin-top: 8px; }
@media (max-width: 700px) {
  .doc.inv-statutory { padding: 14px; }
  .st-row, .st-row.st-head, .st-row.st-sum { grid-template-columns: minmax(0, 1fr); }
  .st-row > * + * { border-left: 0; border-top: 1px solid var(--doc-ink); }
}
@media print {
  .doc.inv-statutory .st-table th, .doc.inv-statutory .st-table tfoot td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

