/* ==========================================================================
   Sixpence — design system
   Warm paper neutrals, one ledger-green accent, serif figures, tabular numbers.
   ========================================================================== */

/* ---- Fonts (self-hosted; see assets/fonts/LICENSE-*.txt) ----------------- */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/geist-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/geist-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- Tokens ------------------------------------------------------------- */
:root {
  color-scheme: light;

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;

  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --sunken: #eeebe4;
  --line: #e4e0d7;
  --line-strong: #d3cec2;

  --ink: #1c1b18;
  --ink-2: #57544c;
  --ink-3: #85817a;
  --ink-inverse: #faf9f6;

  --accent: #0e7a4b;
  --accent-ink: #0b6840;
  --accent-soft: #e3f0e8;
  --focus: #0e7a4b;

  --pos: #0b6840;
  --neg: #a84a16;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --danger: #b42318;
  --danger-soft: #fbe9e7;

  /* Chart series — validated for CVD separation on the light surface */
  --series-in: #0e7a4b;
  --series-out: #e0873a;
  --series-muted: #c9c4b8;
  --chart-grid: #ece9e2;
  --chart-axis: #85817a;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(58, 48, 30, 0.06);
  --shadow: 0 1px 2px rgba(58, 48, 30, 0.05), 0 8px 24px -12px rgba(58, 48, 30, 0.18);
  --shadow-lg: 0 24px 60px -20px rgba(40, 32, 18, 0.35);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-w: 248px;

  --z-sticky: 10;
  --z-drawer: 40;
  --z-dialog: 50;
  --z-toast: 60;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #12110f;
    --surface: #1b1a17;
    --surface-2: #201f1b;
    --sunken: #171613;
    --line: #2d2b26;
    --line-strong: #3d3a33;
    --ink: #f0ede6;
    --ink-2: #b4afa4;
    --ink-3: #807b71;
    --ink-inverse: #151411;
    --accent: #3fae84;
    --accent-ink: #6cc9a2;
    --accent-soft: #1b2e25;
    --focus: #5fbf96;
    --pos: #6cc9a2;
    --neg: #eb9a5c;
    --warn: #e8b453;
    --warn-soft: #2e2615;
    --danger: #f08a7e;
    --danger-soft: #34201d;
    --series-in: #178a6e;
    --series-out: #d27a2c;
    --series-muted: #4a463e;
    --chart-grid: #2a2823;
    --chart-axis: #8d887d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12110f;
  --surface: #1b1a17;
  --surface-2: #201f1b;
  --sunken: #171613;
  --line: #2d2b26;
  --line-strong: #3d3a33;
  --ink: #f0ede6;
  --ink-2: #b4afa4;
  --ink-3: #807b71;
  --ink-inverse: #151411;
  --accent: #3fae84;
  --accent-ink: #6cc9a2;
  --accent-soft: #1b2e25;
  --focus: #5fbf96;
  --pos: #6cc9a2;
  --neg: #eb9a5c;
  --warn: #e8b453;
  --warn-soft: #2e2615;
  --danger: #f08a7e;
  --danger-soft: #34201d;
  --series-in: #178a6e;
  --series-out: #d27a2c;
  --series-muted: #4a463e;
  --chart-grid: #2a2823;
  --chart-axis: #8d887d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
}

/* ---- Base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xs { width: 13px; height: 13px; }

.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;
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: var(--z-toast);
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--ink-inverse); font-size: 14px;
  transition: top 0.15s var(--ease-out);
}
.skip-link:focus { top: 12px; }
@media (min-width: 1024px) { .hide-desktop { display: none !important; } }

/* ---- Typography helpers ------------------------------------------------- */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.eyebrow { font-size: 12px; font-weight: 500; color: var(--ink-3); letter-spacing: 0.01em; }

.figure {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(40px, 5vw, 56px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
}
.figure-md { font-family: var(--font-serif); font-size: 32px; line-height: 1.05; letter-spacing: -0.015em; font-variant-numeric: tabular-nums lining-nums; }
.figure-sm { font-family: var(--font-serif); font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums lining-nums; }
.figure .currency, .figure-md .currency { color: var(--ink-3); margin-right: 0.04em; }

.link { color: var(--accent-ink); text-underline-offset: 3px; }
.link:hover { text-decoration: underline; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; padding: 1px 5px; border-radius: 5px; background: var(--sunken); }

/* ---- Layout primitives -------------------------------------------------- */
.stack > * + * { margin-top: var(--gap, 16px); }
.stack-lg { --gap: 22px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 8px); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid { display: grid; gap: var(--gap, 20px); }

/* ---- App shell ---------------------------------------------------------- */
.shell { min-height: 100dvh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: var(--z-drawer);
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  background: var(--bg);
  border-right: 1px solid var(--line);
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-width: thin;
}
.sidebar > * { min-width: 0; }

.brand { display: inline-flex; align-items: center; padding: 4px 6px; font-family: var(--font-serif); font-weight: 400; font-size: 22px; line-height: 1; letter-spacing: -0.005em; }
.brand .wordmark-x { color: var(--accent); }

.nav { margin-top: 28px; display: grid; gap: 2px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--ink-2); font-size: 14.5px;
  transition: background-color 0.15s, color 0.15s;
}
.nav a:hover { background: var(--sunken); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.nav a[aria-current="page"] .icon { color: var(--accent); }
.nav-button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink-2); font-size: 14.5px; text-align: left; cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.nav-button:hover { background: var(--sunken); color: var(--ink); }
.nav .badge { margin-left: auto; }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 99px; background: var(--accent); color: #fff;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.topbar-actions { display: flex; gap: 2px; }
.has-dot { position: relative; }
.has-dot.is-on::after {
  content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px;
  border-radius: 99px; background: var(--accent); box-shadow: 0 0 0 2px var(--bg);
}

.sidebar-foot { margin-top: auto; display: grid; gap: 10px; min-width: 0; }
.sidebar-foot > * { min-width: 0; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  min-width: 0; overflow: hidden;
}
.user-chip form { flex: none; display: flex; }
.avatar {
  display: grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent-ink);
  font-weight: 600; font-size: 13px;
}
.user-chip .who { min-width: 0; flex: 1; line-height: 1.25; }
.user-chip .who strong,
.user-chip .who span {
  display: block; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-chip .who strong { font-size: 13.5px; font-weight: 500; }
.user-chip .who span { font-size: 12px; color: var(--ink-3); }

.shell-main { padding-left: var(--sidebar-w); min-width: 0; }

.topbar {
  display: none;
  position: sticky; top: 0; z-index: var(--z-sticky);
  height: 56px; padding: 0 12px;
  align-items: center; justify-content: space-between; gap: 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.scrim { display: none; }

.page { max-width: 1180px; margin: 0 auto; padding: clamp(20px, 3.4vh, 36px) 40px clamp(28px, 4vh, 44px); }

.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: clamp(18px, 2.6vh, 28px); }
.page-title { font-family: var(--font-serif); font-weight: 400; font-size: clamp(32px, 3.4vw, 42px); letter-spacing: -0.02em; line-height: 1.05; }
.page-sub { margin-top: 6px; color: var(--ink-2); max-width: 60ch; }

@media (max-width: 1023px) {
  .sidebar {
    width: min(84vw, 300px);
    transform: translateX(-100%);
    transition: transform 0.28s var(--ease-out);
    box-shadow: var(--shadow-lg);
  }
  .shell[data-nav-open] .sidebar { transform: none; }
  .shell[data-nav-open] .scrim {
    display: block; position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1);
    background: rgba(20, 18, 14, 0.4);
    animation: fade-in 0.2s var(--ease-out);
  }
  .shell-main { padding-left: 0; }
  .topbar { display: flex; }
  .page { padding: 20px 16px 32px; }
  .page-header { margin-bottom: 20px; }
}

/* ---- Panels ------------------------------------------------------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.panel-pad { padding: 22px 24px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.panel-head.flush { border-bottom: 0; padding-bottom: 4px; }
.panel-title { font-size: 15px; font-weight: 600; }
.panel-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.panel-foot { padding: 14px 24px; border-top: 1px solid var(--line); }
.form-panel { margin-bottom: 28px; }
.section-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.section-gap { margin-top: 40px; }

@media (max-width: 640px) {
  .panel-pad { padding: 18px 16px; }
  .panel-head { padding: 16px; }
  .panel-foot { padding: 12px 16px; }
}

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s var(--ease-out), box-shadow 0.15s;
}
.btn:hover { --btn-bg: var(--surface-2); --btn-bd: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }

.btn-primary { --btn-bg: var(--ink); --btn-fg: var(--ink-inverse); --btn-bd: var(--ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { --btn-bg: color-mix(in srgb, var(--ink) 86%, var(--bg)); --btn-bd: var(--btn-bg); }


.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; color: var(--ink-2); }
.btn-ghost:hover { --btn-bg: var(--sunken); --btn-bd: transparent; color: var(--ink); }

.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: var(--danger); }
.btn-danger:hover { --btn-bg: color-mix(in srgb, var(--danger) 88%, #000); --btn-bd: var(--btn-bg); }
.btn-danger-quiet { --btn-fg: var(--danger); }
.btn-danger-quiet:hover { --btn-bg: var(--danger-soft); --btn-bd: color-mix(in srgb, var(--danger) 40%, transparent); }

.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 7px; border: 0;
  background: transparent; color: var(--ink-3); cursor: pointer;
  transition: background-color 0.15s, color 0.15s, transform 0.1s var(--ease-out);
}
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---- Forms -------------------------------------------------------------- */
.field { display: grid; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.label .optional { font-weight: 400; color: var(--ink-3); }
.hint { font-size: 12.5px; color: var(--ink-3); }
.field-error { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--danger); }
.checkbox { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.checkbox > span { display: grid; gap: 2px; }
.checkbox strong { font-weight: 500; }

.input, .select, .textarea {
  width: 100%; min-width: 0;
  height: 40px; padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  font-size: 14.5px;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); opacity: 0.8; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent);
}
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.input[type="date"], .input[type="month"] { font-variant-numeric: tabular-nums; }
.input[type="number"] { font-variant-numeric: tabular-nums; }

.select {
  appearance: none; -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2385817a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}

.input-affix { position: relative; }
.input-affix .affix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); font-size: 14.5px; pointer-events: none;
}
.input-affix .input { padding-left: calc(18px + var(--affix-w, 1ch)); }
.input-affix .affix-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input-affix.has-btn .input { padding-right: 42px; }

.input-amount { height: 52px; font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.input-affix .affix.lg { font-size: 20px; }

.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.fieldset { border: 0; padding: 0; margin-inline: 0; display: grid; gap: 10px; min-width: 0; }
.fieldset legend { padding: 0; margin-bottom: 2px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }


/* Segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--sunken); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button, .seg label {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 7px; border: 0; background: transparent;
  font-size: 13.5px; color: var(--ink-2); white-space: nowrap; cursor: pointer;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg a:hover, .seg label:hover { color: var(--ink); }
.seg [aria-current="true"], .seg [aria-pressed="true"], .seg input:checked + label {
  background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line);
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.field .seg { justify-self: start; }

/* ---- Alerts & toasts ---------------------------------------------------- */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 10px;
  font-size: 14px; border: 1px solid;
}
.alert .icon { margin-top: 1px; }
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.alert-note { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }

.toasts {
  position: fixed; z-index: var(--z-toast);
  right: 20px; bottom: 20px;
  display: grid; gap: 8px; width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 12px 14px; border-radius: 12px;
  background: var(--ink); color: var(--ink-inverse);
  box-shadow: var(--shadow-lg); font-size: 14px;
  animation: toast-in 0.35s var(--ease-out) both;
}
.toast .icon { color: color-mix(in srgb, var(--ink-inverse) 70%, transparent); }
.toast[data-type="success"] .icon { color: #5fd4a0; }
.toast[data-type="error"] .icon { color: #ff9d8f; }
:root[data-theme="dark"] .toast[data-type="success"] .icon { color: var(--accent); }
.toast p { flex: 1; }
.toast button { border: 0; background: transparent; color: inherit; opacity: 0.6; cursor: pointer; padding: 4px; border-radius: 6px; display: grid; }
.toast button:hover { opacity: 1; }
.toast.leaving { animation: toast-out 0.22s ease-in both; }
@media (max-width: 640px) { .toasts { left: 16px; right: 16px; bottom: 16px; width: auto; } }

@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Dialog ------------------------------------------------------------- */
.dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.dialog[open] { animation: rise 0.25s var(--ease-out); }
.dialog::backdrop { background: rgba(20, 18, 14, 0.45); animation: fade-in 0.2s var(--ease-out); }
.dialog-body { padding: 22px 22px 8px; }
.dialog-title { font-size: 17px; font-weight: 600; }
.dialog-text { margin-top: 6px; color: var(--ink-2); font-size: 14.5px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 22px 20px; }

/* ---- Data display ------------------------------------------------------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--sunken); color: var(--ink-2);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.tag-good { background: var(--accent-soft); color: var(--accent-ink); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-bad { background: var(--danger-soft); color: var(--danger); }

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.swatch-in { background: var(--series-in); }
.swatch-out { background: var(--series-out); }
.swatch-muted { background: var(--series-muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend .line-key { width: 14px; height: 2px; border-radius: 2px; }

/* Progress */
.progress { position: relative; height: 8px; border-radius: 99px; background: var(--sunken); overflow: visible; }
.progress-sm { height: 5px; }
.progress-bar {
  height: 100%; width: var(--value, 0%); max-width: 100%; border-radius: inherit;
  background: var(--accent);
  transform-origin: left; animation: grow 0.9s var(--ease-out) both;
}
.progress-bar.warn { background: #c98a1a; }
.progress-bar.bad { background: var(--danger); }
.progress-bar.muted { background: var(--ink-3); }
.progress-marker {
  position: absolute; top: -4px; bottom: -4px; left: var(--at, 0%);
  width: 2px; margin-left: -1px; border-radius: 2px; background: var(--ink);
  box-shadow: 0 0 0 2px var(--surface);
}
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Horizontal breakdown bars */
.bars { display: grid; gap: 14px; }
.bar-row { display: grid; gap: 7px; }
.bar-row .spread { font-size: 14px; }
.bar-track { height: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.bar-fill { height: 100%; width: var(--value, 0%); border-radius: 99px; background: var(--series-out); transform-origin: left; animation: grow 0.9s var(--ease-out) both; }
.bar-fill.in { background: var(--series-in); }

/* Stat strip */
.stats { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); }
.stat { padding: 20px 24px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat .eyebrow { display: flex; align-items: center; gap: 7px; }
.stat .value { margin-top: 10px; }
.stat .note { margin-top: 6px; font-size: 13px; color: var(--ink-3); }
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 420px) {
  .stat { padding: 16px; }
  .stat .figure-md { font-size: 26px; }
}

/* Ledger (transaction lists) */
.ledger-day { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 18px 24px 8px; font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.ledger-day:first-child { padding-top: 14px; }
.ledger-row {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto;
  align-items: center; gap: 14px;
  padding: 10px 16px 10px 24px;
  border-top: 1px solid var(--line);
  transition: background-color 0.12s;
}
.ledger-day + .ledger-row { border-top: 0; }
.ledger-row:hover { background: var(--surface-2); }
.ledger-row.is-editing { background: var(--accent-soft); }
.ledger-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--sunken); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.ledger-icon.in { color: var(--pos); }
.ledger-icon.out { color: var(--neg); }
.ledger-main { min-width: 0; }
.ledger-title { font-size: 14.5px; font-weight: 500; }
.ledger-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.ledger-amount { font-size: 15px; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.ledger-actions { display: flex; gap: 2px; }
.repeat-mark { display: inline-flex; vertical-align: -1px; margin-left: 4px; color: var(--ink-3); }
.ledger-row.compact { grid-template-columns: 36px minmax(0, 1fr) auto; }
@media (max-width: 640px) { .ledger-row.compact { grid-template-columns: 32px minmax(0, 1fr) auto; } }
@media (max-width: 640px) {
  .ledger-day { padding: 16px 16px 6px; }
  .ledger-row { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px 10px 16px; }
  .ledger-icon { width: 32px; height: 32px; border-radius: 9px; }
  .ledger-actions { grid-column: 2 / -1; justify-content: flex-end; margin-top: -6px; }
}

/* Plain data table */
.table { font-size: 14px; }
.table th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table-wrap { overflow-x: auto; }

/* Empty states */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 48px 24px; }
.empty-art { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; background: var(--sunken); color: var(--ink-3); margin-bottom: 6px; }
.empty-title { font-size: 16px; font-weight: 600; }
.empty p { color: var(--ink-2); max-width: 42ch; font-size: 14px; }
.empty .btn { margin-top: 10px; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pagination .pages { display: flex; gap: 4px; }
.pagination a, .pagination span.cur {
  display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px;
  border-radius: 7px; font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.pagination a:hover { background: var(--sunken); color: var(--ink); }
.pagination span.cur { background: var(--ink); color: var(--ink-inverse); font-weight: 500; }
.pagination .gap { color: var(--ink-3); padding: 0 2px; align-self: center; }

/* Charts */
.chart { position: relative; height: 260px; }
.chart-lg { height: 300px; }
.chart canvas { position: absolute; inset: 0; }
details.data-table { margin-top: 14px; font-size: 13px; }
details.data-table summary { cursor: pointer; color: var(--ink-3); width: fit-content; }
details.data-table summary:hover { color: var(--ink); }
details.data-table[open] summary { margin-bottom: 8px; }
details.data-table .table-wrap { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }

/* Disclosure toggle panels */
[data-collapsible][hidden] { display: none !important; }
.reveal { animation: rise 0.3s var(--ease-out); }

/* ---- Page-specific: overview ------------------------------------------- */
.overview-top { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; }
.overview-hero { padding: 26px 28px; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; }
.overview-hero .figure { margin-top: 12px; }
.hero-caption { margin-top: 12px; }
.hero-split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding-top: 20px; border-top: 1px solid var(--line); }
.hero-split dt { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.hero-split dd { margin: 6px 0 0; font-size: 19px; font-weight: 500; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.hero-split dd small { display: block; font-size: 12.5px; font-weight: 400; color: var(--ink-3); letter-spacing: 0; margin-top: 2px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.overview-col { display: grid; gap: 20px; min-width: 0; }
@media (max-width: 1080px) {
  .overview-top, .overview-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .overview-hero { padding: 20px 16px; }
  .hero-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hero-split > div:last-child { grid-column: 1 / -1; }
}

.mini-list { display: grid; }
.mini-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 14px 24px; border-top: 1px solid var(--line); }
.mini-row:first-child { border-top: 0; }
.mini-row .progress { grid-column: 1 / -1; margin-top: 6px; }
.mini-row .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .mini-row { padding: 12px 16px; } }

.setup { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 20px; }
.setup-step { display: grid; gap: 6px; padding: 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); transition: border-color 0.15s, transform 0.15s var(--ease-out), box-shadow 0.15s; }
.setup-step:hover { border-color: var(--ink-3); transform: translateY(-2px); box-shadow: var(--shadow); }
.setup-step .n { font-family: var(--font-serif); font-size: 28px; line-height: 1; color: var(--ink-3); }
.setup-step strong { font-weight: 600; margin-top: 8px; }
.setup-step span { font-size: 13.5px; color: var(--ink-2); }
.setup-step.done { background: var(--surface-2); }
.setup-step.done .n { color: var(--accent); }

/* ---- Page-specific: transactions --------------------------------------- */
.tx-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.tx-form { position: sticky; top: 24px; }
.tx-side { display: grid; gap: 20px; align-content: start; position: sticky; top: 24px; }
.tx-side .tx-form { position: static; }
.schedule-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 12px 12px 12px 24px; border-top: 1px solid var(--line); }
.panel-head + .schedule-row { border-top: 0; }
.tx-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.tx-filters { flex: 1 1 100%; display: flex; gap: 8px; }
.tx-filters .search { flex: 1; }
.tx-filters .input, .tx-filters .select { height: 36px; }
.tx-filters .search .input { padding-left: 34px; }
.tx-filters .select { width: auto; max-width: 45%; }
.month-nav { display: inline-flex; align-items: center; gap: 2px; }
.month-nav .label-month { min-width: 128px; text-align: center; font-weight: 500; font-size: 14px; }
.tx-summary { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: baseline; padding: 18px 24px 4px; }
@media (max-width: 1023px) {
  .tx-layout { grid-template-columns: minmax(0, 1fr); }
  .tx-side { position: static; order: -1; }
}
@media (max-width: 640px) { .tx-summary { padding: 16px 16px 4px; } }

/* ---- Page-specific: budgets & goals ------------------------------------ */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
@media (max-width: 400px) { .card-grid { grid-template-columns: minmax(0, 1fr); } }
.card { display: flex; flex-direction: column; padding: 20px 22px; gap: 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-title { font-size: 16px; font-weight: 600; }
.card-meta { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.card .progress { margin-top: 12px; }
.card-detail { margin-top: 10px; }
.card-foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.cat-limits { display: grid; gap: 10px; }
.cat-limits .spread { font-size: 13px; }
.cat-limits .progress { margin-top: 6px; }
.budget-group + .budget-group { margin-top: 36px; }
details.more summary { cursor: pointer; font-size: 13px; color: var(--ink-2); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary .icon { transition: transform 0.2s var(--ease-out); }
details.more[open] summary .icon { transform: rotate(90deg); }
details.more[open] summary { margin-bottom: 12px; }

.limit-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 16px; }
.limit-item { display: grid; grid-template-columns: minmax(0, 1fr) 120px; align-items: center; gap: 10px; font-size: 14px; }

.account-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 14px 16px 14px 24px; border-top: 1px solid var(--line); }
.account-row:first-child { border-top: 0; }
@media (max-width: 640px) {
  .account-row { grid-template-columns: 36px minmax(0, 1fr) auto; padding: 12px 12px 12px 16px; }
  .account-row .ledger-actions { grid-column: 2 / -1; justify-content: flex-end; }
}

.contribute { display: flex; gap: 8px; }
.contribute .input-affix { flex: 1; }
.contribute .input { height: 34px; }

/* ---- Page-specific: notifications -------------------------------------- */
.notice-list .panel-head { padding-top: 14px; padding-bottom: 14px; }
.notice {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 14px; align-items: start;
  padding: 16px 24px; border-top: 1px solid var(--line);
  transition: background-color 0.12s;
}
.panel-head + .notice { border-top: 0; }
.notice:hover { background: var(--surface-2); }
.notice-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--sunken); color: var(--ink-2); }
.notice-icon.type-budget { color: var(--neg); }
.notice-icon.type-upcoming { color: var(--accent-ink); }
.notice-icon.type-security { color: var(--danger); }
.notice-main { display: grid; gap: 3px; min-width: 0; }
.notice-title { font-size: 14.5px; font-weight: 500; }
.notice-body { font-size: 13.5px; color: var(--ink-2); }
.notice-time { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; padding-top: 2px; }
.notice.is-unread .notice-title::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 99px;
  background: var(--accent); vertical-align: 2px;
}
.notice:not(.is-unread) .notice-title { color: var(--ink-2); font-weight: 400; }
@media (max-width: 640px) {
  .notice { grid-template-columns: 32px minmax(0, 1fr); padding: 14px 16px; }
  .notice-time { grid-column: 2; padding-top: 0; }
}

.mail-status { display: grid; gap: 12px; justify-items: start; }

/* ---- Page-specific: settings ------------------------------------------- */
.settings { display: grid; gap: 0; }
.settings-section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px 40px; padding: 32px 0; border-top: 1px solid var(--line); }
.settings-section:first-child { border-top: 0; padding-top: 4px; }
.settings-section h2 { font-size: 15px; font-weight: 600; }
.settings-section .desc { margin-top: 6px; font-size: 13.5px; color: var(--ink-2); }
.settings-section form { max-width: 520px; }
@media (max-width: 800px) { .settings-section { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 24px 0; } }

/* ---- Page-specific: reports -------------------------------------------- */
.report-filters { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.report-filters form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.report-filters .input { width: 158px; height: 36px; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
.report-grid .wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .report-grid { grid-template-columns: minmax(0, 1fr); } }
.breakdown td .bar-track { min-width: 80px; }

/* ---- Auth --------------------------------------------------------------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-main { display: flex; flex-direction: column; padding: clamp(16px, 2.6vh, 28px) 40px; }
.auth-form { width: 100%; max-width: 380px; margin: auto; padding: clamp(8px, 3vh, 40px) 0; }
.auth-form h1 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(30px, 4.4vh, 40px); letter-spacing: -0.02em; line-height: 1.05; }
.auth-form .lede { margin-top: clamp(6px, 1vh, 10px); color: var(--ink-2); }
.auth-aside {
  position: relative; overflow: hidden;
  margin: 12px; border-radius: 20px;
  background: #1a2a22; color: #eef3ee;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 44px;
}
.auth-aside::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(92, 190, 140, 0.28), transparent 60%),
    radial-gradient(80% 60% at 0% 100%, rgba(224, 135, 58, 0.16), transparent 60%);
}
.auth-aside::after {
  content: ""; position: absolute; inset: 0; opacity: 0.35; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}
.auth-aside > * { position: relative; }
.auth-quote { font-family: var(--font-serif); font-size: clamp(28px, 2.6vw, 38px); line-height: 1.15; letter-spacing: -0.015em; max-width: 18ch; }
.auth-aside .sheet {
  margin-bottom: auto; align-self: flex-end;
  width: min(360px, 100%); padding: 18px 20px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px); font-size: 13.5px;
}
.sheet-row { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.1); font-variant-numeric: tabular-nums; }
.sheet-row:first-of-type { border-top: 0; }
.sheet-row span:first-child { color: rgba(238, 243, 238, 0.7); }
.auth-foot { font-size: 13px; color: var(--ink-3); }
.pw-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; margin-top: 6px; font-size: 12.5px; color: var(--ink-3); list-style: none; padding: 0; }
.pw-rules li { display: flex; align-items: center; gap: 6px; transition: color 0.15s; }
.pw-rules li::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: var(--line-strong); transition: background-color 0.15s; }
.pw-rules li.ok { color: var(--accent-ink); }
.pw-rules li.ok::before { background: var(--accent); }
.sheet-head { display: flex; justify-content: space-between; margin-bottom: 6px; color: rgba(238, 243, 238, 0.7); }
.sheet-good { color: #8fdcb5; }
.auth-cite { margin-top: 14px; font-size: 14px; color: rgba(238, 243, 238, 0.65); }
.auth-alert { margin-top: clamp(14px, 2.2vh, 24px); }
.auth-fields { --gap: clamp(12px, 2vh, 18px); margin-top: clamp(16px, 3vh, 28px); }
.auth-switch { margin-top: clamp(14px, 2.2vh, 24px); font-size: 14px; color: var(--ink-2); }
@media (max-width: 960px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-main { padding: 20px 16px; }
}

/* ---- Marketing ---------------------------------------------------------- */
.site { overflow-x: clip; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

.site-header { position: sticky; top: 0; z-index: var(--z-sticky); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.site-header[data-scrolled] { border-bottom-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav .text-link { padding: 8px 12px; font-size: 14px; color: var(--ink-2); border-radius: 8px; }
.site-nav .text-link:hover { color: var(--ink); background: var(--sunken); }
@media (max-width: 520px) { .site-nav .hide-sm { display: none; } }

.hero { padding: 88px 0 72px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.hero h1 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(46px, 6.4vw, 84px); line-height: 0.98; letter-spacing: -0.03em; }
.hero h1 em { font-style: italic; color: var(--accent-ink); }
.hero .lede { margin-top: 24px; font-size: 18px; color: var(--ink-2); max-width: 46ch; line-height: 1.55; }
.hero-cta { margin-top: 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.hero-note { margin-top: 18px; font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
@media (max-width: 960px) { .hero { padding: 48px 0 24px; } .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; } }

.hero h1, .hero .lede, .hero-cta, .hero-note, .hero-visual { animation: rise 0.55s var(--ease-out) both; }
.hero .lede { animation-delay: 60ms; }
.hero-visual { animation-delay: 140ms; }
.hero-cta { animation-delay: 120ms; }
.hero-note { animation-delay: 180ms; }

.statement {
  position: relative;
  padding: 24px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.statement-head { display: flex; justify-content: space-between; align-items: baseline; }
.statement .figure { font-size: 52px; margin-top: 10px; }
.statement .ledger-row { padding-left: 0; padding-right: 0; grid-template-columns: 34px minmax(0, 1fr) auto; }
.statement .ledger-row:hover { background: none; }
.statement-rows { margin-top: 18px; }
.statement-budget { margin-top: 18px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.statement-budget .progress { margin-top: 10px; }
.statement-tab {
  position: absolute; right: -18px; bottom: -40px;
  padding: 12px 14px; border-radius: 12px;
  background: var(--ink); color: var(--ink-inverse); box-shadow: var(--shadow-lg);
  font-size: 13px; display: grid; gap: 2px;
  transform: rotate(2deg);
}
.statement-tab strong { font-family: var(--font-serif); font-weight: 400; font-size: 24px; line-height: 1; }
@media (max-width: 640px) { .statement-tab { display: none; } .statement { padding: 18px; } }

.band { padding: 96px 0; }
.band + .band { border-top: 1px solid var(--line); }
@media (max-width: 640px) { .band { padding: 64px 0; } }
.band-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 32px 64px; align-items: start; }
.band-head h2 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(34px, 4vw, 52px); line-height: 1.02; letter-spacing: -0.02em; position: sticky; top: 96px; }
@media (max-width: 860px) { .band-head { grid-template-columns: minmax(0, 1fr); } .band-head h2 { position: static; } }

.feature-list { display: grid; }
.feature { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 18px; padding: 26px 0; border-top: 1px solid var(--line); }
.feature:first-child { border-top: 0; padding-top: 6px; }
.feature .glyph { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--accent-ink); }
.feature h3 { font-size: 17px; font-weight: 600; }
.feature p { margin-top: 6px; color: var(--ink-2); max-width: 54ch; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface); }
.fact { padding: 28px; }
.fact:nth-child(even) { border-left: 1px solid var(--line); }
.fact:nth-child(n+3) { border-top: 1px solid var(--line); }
.fact strong { display: block; font-size: 16px; font-weight: 600; }
.fact p { margin-top: 6px; color: var(--ink-2); font-size: 14.5px; }
@media (max-width: 640px) {
  .facts { grid-template-columns: minmax(0, 1fr); }
  .fact:nth-child(even) { border-left: 0; }
  .fact + .fact { border-top: 1px solid var(--line); }
  .fact { padding: 22px 18px; }
}

.closing { padding: 88px 0 96px; }
.closing-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; padding: 40px 44px; border-radius: 22px; background: var(--ink); color: var(--ink-inverse); }
.closing-card h2 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.05; letter-spacing: -0.02em; max-width: 20ch; }
.closing-card .btn { --btn-bg: var(--ink-inverse); --btn-fg: var(--ink); --btn-bd: var(--ink-inverse); }
.closing-card .btn:hover { --btn-bg: color-mix(in srgb, var(--ink-inverse) 88%, var(--ink)); }
@media (max-width: 640px) { .closing-card { padding: 28px 22px; } }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 36px; font-size: 13.5px; color: var(--ink-3); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; }

/* ---- Error page --------------------------------------------------------- */
.notfound { min-height: 100dvh; display: grid; place-items: center; padding: 24px; text-align: center; }
.notfound .code { font-family: var(--font-serif); font-size: clamp(96px, 16vw, 160px); line-height: 0.9; letter-spacing: -0.04em; color: var(--ink-3); }
.notfound-title { font-size: 22px; margin-top: 12px; }
.notfound-text { margin: 8px auto 0; max-width: 44ch; color: var(--ink-2); }
.notfound-actions { display: flex; justify-content: center; margin-top: 24px; }

/* ---- Print (also used as a no-JS PDF fallback) -------------------------- */
@media print {
  .sidebar, .topbar, .toasts, .no-print, .skip-link { display: none !important; }
  .shell-main { padding-left: 0; }
  body { background: #fff; }
  .panel { box-shadow: none; break-inside: avoid; }
  .page { padding: 0; max-width: none; }
}

/* ---- Motion ------------------------------------------------------------- */
/* Two additions, both deliberately short. The blanket prefers-reduced-motion
   rule near the top of this file already flattens everything below; view
   transitions run on pseudo-elements that rule can't reach, so they're turned
   off explicitly. */

/* Page-to-page crossfade. The browser does the work: the chrome is named so it
   holds still while the content under it changes, instead of dissolving with
   the rest of the page. Browsers without support navigate exactly as before. */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.18s;
  animation-timing-function: var(--ease-out);
}

.sidebar { view-transition-name: sidebar; }
.topbar { view-transition-name: topbar; }
.site-header { view-transition-name: site-header; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  /* Belt and braces: a browser that ignores @view-transition inside a media
     query still lands on the new page with no movement. */
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

/* Scroll reveal, used on the landing page. Content is only hidden when there is
   scripting to reveal it: theme.js sets data-js before the first paint, so with
   JS off nothing is ever hidden and with JS on nothing ever flashes.
   [data-reveal] raises the element itself, [data-reveal-group] its children. */
[data-js] [data-reveal],
[data-js] [data-reveal-group] > * {
  opacity: 0;
  transform: translateY(10px);
}

[data-js] [data-reveal].is-in,
[data-js] [data-reveal-group].is-in > * {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
  transition-delay: var(--stagger, 0ms);
}

[data-reveal-group] > :nth-child(2) { --stagger: 60ms; }
[data-reveal-group] > :nth-child(3) { --stagger: 120ms; }
[data-reveal-group] > :nth-child(4) { --stagger: 180ms; }
[data-reveal-group] > :nth-child(n+5) { --stagger: 240ms; }

@media print {
  [data-js] [data-reveal],
  [data-js] [data-reveal-group] > * { opacity: 1 !important; transform: none !important; }
}

/* Pointer-only polish: touch devices fire a false hover on tap. */
@media (hover: hover) and (pointer: fine) {
  .feature .glyph { transition: transform 0.18s var(--ease-out), border-color 0.18s, color 0.18s; }
  .feature:hover .glyph { transform: translateY(-2px); border-color: var(--line-strong); }

  .hero-cta .btn .icon,
  .closing-card .btn .icon { transition: transform 0.18s var(--ease-out); }
  .hero-cta .btn:hover .icon,
  .closing-card .btn:hover .icon { transform: translateX(3px); }
}
