/* PPC Audit Tool: the design system and the frame every page sits in.
   Restrained: near-neutral grays tinted toward the brand's grey, near-black ink for actions, and color only
   where it means something (red waste or failure, green opportunity or pass, amber waiting on you). The brand
   red lives in the logo mark only. Tokens first; components after. */

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-var.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}
/* Arial nudged to Inter's metrics, so the swap doesn't move the page. */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial");
  size-adjust: 107%;
  ascent-override: 90%;
  descent-override: 22%;
  line-gap-override: 0%;
}

:root { color-scheme: light dark; }

/* Light: the default, and any part of the page marked data-theme="light" (the Appearance pictures). */
:root, [data-theme="light"] {
  /* surfaces */
  --canvas: oklch(0.993 0.0015 180);
  --side: oklch(0.972 0.004 180);
  --surface: oklch(1 0 0);
  --sunken: oklch(0.966 0.004 180);
  --seg-on: oklch(1 0 0);
  --hover: oklch(0.2 0.006 180 / 0.045);
  --hover-strong: oklch(0.2 0.006 180 / 0.075);
  --line: oklch(0.912 0.005 180);
  --line-strong: oklch(0.85 0.006 180);
  --scrim: oklch(0.2 0.01 180 / 0.32);

  /* ink */
  --ink: oklch(0.21 0.006 180);
  --ink-2: oklch(0.43 0.008 180);
  --ink-3: oklch(0.53 0.008 180);
  --primary: var(--ink);
  --primary-hover: oklch(0.32 0.007 180);
  --on-primary: oklch(0.99 0 0);
  --focus: oklch(0.21 0.006 180);

  /* meaning */
  --bad: oklch(0.52 0.19 27);
  --bad-bg: oklch(0.965 0.022 27);
  --bad-line: oklch(0.86 0.07 27);
  --good: oklch(0.5 0.12 155);
  --good-bg: oklch(0.966 0.028 155);
  --good-line: oklch(0.86 0.06 155);
  --warn: oklch(0.52 0.12 62);
  --warn-bg: oklch(0.972 0.035 85);
  --warn-line: oklch(0.87 0.08 80);

  /* elevation */
  --shadow-sm: 0 1px 2px oklch(0.2 0.01 180 / 0.05);
  --shadow-md: 0 1px 2px oklch(0.2 0.01 180 / 0.05), 0 6px 20px oklch(0.2 0.01 180 / 0.07);
  --shadow-pop: 0 1px 3px oklch(0.2 0.01 180 / 0.08), 0 12px 32px oklch(0.2 0.01 180 / 0.12);
}
[data-theme="light"] { color-scheme: light; }

:root {
  /* brand: the logo mark only */
  --brand-red: #ef3b38;
  --brand-grey: #8e9895;

  /* type */
  --font: "Inter", "Inter Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text-xs: 0.75rem;     /* 12 captions, table headers */
  --text-sm: 0.8125rem;   /* 13 meta */
  --text-ui: 0.875rem;    /* 14 controls, tables, nav */
  --text-md: 1rem;        /* 16 body and prose */
  --text-lg: 1.1875rem;   /* 19 section titles */
  --text-xl: 1.4375rem;   /* 23 page titles */

  /* space (4pt) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* shape */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 22px;

  /* motion */
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 300ms;

  /* layers */
  --z-sticky: 10;
  --z-scrim: 30;
  --z-drawer: 40;
  --z-popover: 50;
  --z-toast: 60;
  --z-drop: 70;

  /* frame */
  --side-w: 248px;
  --rail-w: 60px;

  /* names the older page styles use */
  --fg: var(--ink); --muted: var(--ink-2); --faint: var(--ink-3); --bg: var(--canvas); --card: var(--surface);
  --accent: var(--ink); --accent-fg: var(--on-primary); --accent-soft: var(--sunken);
  --ok: var(--good); --ok-soft: var(--good-bg); --warn-soft: var(--warn-bg); --bad-soft: var(--bad-bg);
  --bubble: var(--sunken); --code: var(--sunken); --line-2: var(--line-strong); --shadow: var(--shadow-md);
}

/* Dark: the computer's setting unless the person chose light in Settings, or their choice of dark. The two blocks
   are the same tokens; tests/test_web_theme.py keeps them identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: oklch(0.175 0.004 180);
    --side: oklch(0.15 0.004 180);
    --surface: oklch(0.205 0.005 180);
    --sunken: oklch(0.225 0.005 180);
    --seg-on: oklch(0.3 0.006 180);
    --hover: oklch(0.98 0.004 180 / 0.055);
    --hover-strong: oklch(0.98 0.004 180 / 0.09);
    --line: oklch(0.285 0.006 180);
    --line-strong: oklch(0.37 0.007 180);
    --scrim: oklch(0.08 0.004 180 / 0.55);

    --ink: oklch(0.95 0.003 180);
    --ink-2: oklch(0.79 0.006 180);
    --ink-3: oklch(0.68 0.007 180);
    --primary: oklch(0.95 0.003 180);
    --primary-hover: oklch(0.86 0.004 180);
    --on-primary: oklch(0.18 0.004 180);
    --focus: oklch(0.95 0.003 180);

    --bad: oklch(0.73 0.15 25);
    --bad-bg: oklch(0.27 0.05 25);
    --bad-line: oklch(0.42 0.09 25);
    --good: oklch(0.77 0.13 155);
    --good-bg: oklch(0.26 0.04 155);
    --good-line: oklch(0.42 0.07 155);
    --warn: oklch(0.82 0.12 80);
    --warn-bg: oklch(0.28 0.045 80);
    --warn-line: oklch(0.45 0.08 80);

    --shadow-sm: none;
    --shadow-md: 0 1px 2px oklch(0 0 0 / 0.3), 0 8px 24px oklch(0 0 0 / 0.25);
    --shadow-pop: 0 1px 3px oklch(0 0 0 / 0.4), 0 16px 40px oklch(0 0 0 / 0.45);
  }
}
[data-theme="dark"] {
  --canvas: oklch(0.175 0.004 180);
  --side: oklch(0.15 0.004 180);
  --surface: oklch(0.205 0.005 180);
  --sunken: oklch(0.225 0.005 180);
  --seg-on: oklch(0.3 0.006 180);
  --hover: oklch(0.98 0.004 180 / 0.055);
  --hover-strong: oklch(0.98 0.004 180 / 0.09);
  --line: oklch(0.285 0.006 180);
  --line-strong: oklch(0.37 0.007 180);
  --scrim: oklch(0.08 0.004 180 / 0.55);

  --ink: oklch(0.95 0.003 180);
  --ink-2: oklch(0.79 0.006 180);
  --ink-3: oklch(0.68 0.007 180);
  --primary: oklch(0.95 0.003 180);
  --primary-hover: oklch(0.86 0.004 180);
  --on-primary: oklch(0.18 0.004 180);
  --focus: oklch(0.95 0.003 180);

  --bad: oklch(0.73 0.15 25);
  --bad-bg: oklch(0.27 0.05 25);
  --bad-line: oklch(0.42 0.09 25);
  --good: oklch(0.77 0.13 155);
  --good-bg: oklch(0.26 0.04 155);
  --good-line: oklch(0.42 0.07 155);
  --warn: oklch(0.82 0.12 80);
  --warn-bg: oklch(0.28 0.045 80);
  --warn-line: oklch(0.45 0.08 80);

  --shadow-sm: none;
  --shadow-md: 0 1px 2px oklch(0 0 0 / 0.3), 0 8px 24px oklch(0 0 0 / 0.25);
  --shadow-pop: 0 1px 3px oklch(0 0 0 / 0.4), 0 16px 40px oklch(0 0 0 / 0.45);
}
[data-theme="dark"] { color-scheme: dark; }

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 var(--text-ui)/1.5 var(--font);
  font-kerning: normal;
  font-optical-sizing: auto;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; color: var(--ink); }
h1 { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.017em; }
h2 { font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.012em; }
h3 { font-size: var(--text-md); font-weight: 600; letter-spacing: -0.006em; }
h4 { font-size: var(--text-ui); font-weight: 600; }
p { margin: 0 0 var(--s3); text-wrap: pretty; }
a { color: inherit; text-decoration-line: underline; text-decoration-color: var(--line-strong);
    text-underline-offset: 0.2em; text-decoration-thickness: 1px;
    transition: text-decoration-color var(--dur-1) var(--ease-out); }
a:hover { text-decoration-color: currentColor; }
code, kbd, .mono { font-family: var(--mono); font-size: 0.88em; }
code { background: var(--sunken); border: 1px solid var(--line); padding: 0 5px; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s5) 0; }
::selection { background: oklch(0.85 0.06 230 / 0.55); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
.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; }
[hidden] { display: none !important; }

.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75;
        stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon.lg { width: 18px; height: 18px; }
.icon.sm { width: 14px; height: 14px; vertical-align: -2px; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- controls */

.btn, button.btn, a.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: 32px; padding: 0 var(--s3); border-radius: var(--r-sm);
  font: 500 var(--text-ui)/1 var(--font); color: var(--ink); text-decoration: none; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm);
  cursor: pointer; user-select: none;
  transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out),
              color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.btn:hover { background: var(--sunken); border-color: var(--ink-3); }
.btn:active { transform: scale(0.98); }
.btn-primary, button.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost, button.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--hover); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--bad); }
/* ACOS and TACOS against target: green on target, red off it. */
td.on-target { background: var(--good-bg); color: var(--good); }
td.off-target { background: var(--bad-bg); color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.btn-sm { height: 28px; padding: 0 10px; font-size: var(--text-sm); }
.btn-icon { width: 32px; padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }

/* Older pages' bare buttons and fields look like the new ones. */
main.page button:not([class]), main.page button.danger {
  display: inline-flex; align-items: center; gap: var(--s2); height: 32px; padding: 0 var(--s3);
  border-radius: var(--r-sm); border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary);
  font: 500 var(--text-ui)/1 var(--font); cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
main.page button:not([class]):hover { background: var(--primary-hover); }
main.page button:not([class]):active { transform: scale(0.98); }
main.page button.danger { background: var(--surface); color: var(--bad); border-color: var(--bad-line); }
main.page button.danger:hover { background: var(--bad-bg); }
button.link { background: none; border: 0; padding: 0; color: var(--ink-2); font: inherit; cursor: pointer;
              text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 0.2em; }
button.link:hover { color: var(--ink); text-decoration-color: currentColor; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"],
input[type="number"], input:not([type]), select, textarea {
  width: 100%; height: 36px; padding: 0 var(--s3); border-radius: var(--r-sm);
  font: 400 var(--text-ui)/1.4 var(--font); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
textarea { height: auto; padding: var(--s2) var(--s3); }
select { appearance: none; padding-right: 32px;
         background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%23737a78' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px oklch(0.6 0.01 180 / 0.22);
}
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ink); }
label { display: block; font-size: var(--text-sm); font-weight: 500; color: var(--ink-2); margin-bottom: var(--s1); }

/* ---------------------------------------------------------------- the frame */

.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh;
         transition: grid-template-columns var(--dur-3) var(--ease-out); }
.side { overflow-x: hidden; }
html[data-side="rail"] .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }

.side {
  position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: var(--z-drawer);
  display: flex; flex-direction: column; min-height: 0;
  background: var(--side); border-right: 1px solid var(--line);
  view-transition-name: side;
}
.side-top { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s3) var(--s2) var(--s4); min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--ink); text-decoration: none;
         font-weight: 600; font-size: var(--text-ui); letter-spacing: -0.01em; border-radius: var(--r-sm); }
.brand .mark { width: 20px; height: 20px; flex: none; }
.brand-name { white-space: nowrap; overflow: hidden; }
.brand-name span { color: var(--ink-3); font-weight: 500; }
.side-toggle { color: var(--ink-3); }

.side-new { margin: var(--s1) var(--s3) var(--s3); justify-content: flex-start; width: calc(100% - var(--s5)); }
.side-new .icon { color: var(--ink-2); }
.side-new kbd { margin-left: auto; font-family: var(--font); font-size: var(--text-xs); color: var(--ink-3); }

.nav { display: grid; gap: 2px; padding: 0 var(--s2); }
.nav a, .recent a {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 10px;
  border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-weight: 500;
  transition: color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out);
}
.nav a:hover, .recent a:hover { color: var(--ink); background: var(--hover); }
.nav a[aria-current="page"], .recent a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] .here, .recent a[aria-current="page"] .here {
  position: absolute; inset: 0; border-radius: inherit; background: var(--hover-strong); z-index: -1;
  view-transition-name: nav-here;
}
.nav a, .recent a { isolation: isolate; }
.nav .nav-text, .recent .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-section { margin: var(--s5) var(--s4) var(--s1) var(--s4); font-size: var(--text-xs); font-weight: 500; color: var(--ink-3); }
.recent { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 1px; padding: 0 var(--s2) var(--s3);
          scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.recent a { font-weight: 400; min-height: 30px; }
.recent .empty-line { padding: var(--s1) 10px; color: var(--ink-3); font-size: var(--text-sm); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot.waiting { background: var(--warn); }
.dot.working { background: var(--ink-2); animation: breathe 1.6s var(--ease-out) infinite; }
@keyframes breathe { 50% { opacity: 0.3; } }
.recent .more { color: var(--ink-3); font-size: var(--text-sm); }

.side-foot { border-top: 1px solid var(--line); padding: var(--s2); }
.me { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 8px;
      border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); font: inherit; text-align: left;
      cursor: pointer; transition: background-color var(--dur-1) var(--ease-out); }
.me:hover { background: var(--hover); }
.avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
          background: var(--surface); border: 1px solid var(--line-strong); font-size: 11px; font-weight: 600;
          letter-spacing: 0.02em; color: var(--ink-2); }
.me .who { flex: 1; min-width: 0; line-height: 1.25; }
.me .who b, .me .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who b { font-weight: 500; }
.me .who span { color: var(--ink-3); font-size: var(--text-xs); }
.me .icon { color: var(--ink-3); }

/* The person's menu: a popover above their name. */
.menu {
  position: fixed; inset: auto auto 64px 8px; width: calc(var(--side-w) - 16px); margin: 0; padding: var(--s1);
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-pop); z-index: var(--z-popover);
  opacity: 1; transform: none;
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out),
              overlay var(--dur-2) allow-discrete, display var(--dur-2) allow-discrete;
}
.menu:not(:popover-open) { opacity: 0; transform: translateY(4px) scale(0.98); }
@starting-style { .menu:popover-open { opacity: 0; transform: translateY(4px) scale(0.98); } }
.menu .head { padding: var(--s2) 10px; border-bottom: 1px solid var(--line); margin-bottom: var(--s1); }
.menu .head b { display: block; font-weight: 500; }
.menu .head span { display: block; color: var(--ink-3); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 10px;
                        border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-2); font: inherit;
                        text-decoration: none; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--hover); color: var(--ink); }
.menu hr { margin: var(--s1) 0; }
.menu form { margin: 0; }

/* The person's menu: Settings, with its shortcut, and the theme switch. */
.menu .shortcut { margin-left: auto; font: 500 var(--text-xs)/1 var(--font); color: var(--ink-3); }
.menu-theme { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 3px 0 10px; color: var(--ink-2); }
.menu-theme > span:first-child { flex: 1; }

/* Light, dark or system as three icons in a segmented switch. The radios fill their segments, so a click or the
   arrow keys pick one. */
.seg-theme { gap: 2px; }
.seg-theme label { position: relative; display: grid; place-items: center; width: 30px; height: 26px; margin: 0;
                   border-radius: 4px; color: var(--ink-3); cursor: pointer;
                   transition: color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out); }
.seg-theme label:hover { color: var(--ink); }
.seg-theme input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg-theme label:has(:checked) { background: var(--seg-on); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg-theme label:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }

/* rail: the sidebar folded to its icons. Every control is a 36px square on the rail's centre line. */
html[data-side="rail"] .side .brand-name, html[data-side="rail"] .side .nav-text, html[data-side="rail"] .side-section,
html[data-side="rail"] .side .recent, html[data-side="rail"] .side-new .nav-text, html[data-side="rail"] .side-new kbd,
html[data-side="rail"] .me .who, html[data-side="rail"] .me > .icon { display: none; }
html[data-side="rail"] .side-top { flex-direction: column; padding: var(--s3) 0 var(--s2); gap: var(--s2); }
html[data-side="rail"] .brand { flex: none; justify-content: center; width: 36px; height: 36px; }
html[data-side="rail"] .side-toggle { width: 36px; height: 36px; }
/* display: flex, not the button's inline-flex: auto margins centre only a block-level box. */
html[data-side="rail"] .side-new { display: flex; width: 36px; height: 36px; margin: var(--s1) auto var(--s3); padding: 0; }
html[data-side="rail"] .nav { justify-items: center; }
html[data-side="rail"] .nav a { justify-content: center; width: 36px; min-height: 36px; padding: 0; }
html[data-side="rail"] .side-foot { margin-top: auto; }
html[data-side="rail"] .me { justify-content: center; width: 36px; min-height: 36px; padding: 0; margin: 0 auto; }
html[data-side="rail"] .menu { width: 232px; }

.main { min-width: 0; display: flex; flex-direction: column; view-transition-name: page; }
.notice-bar { display: flex; align-items: center; justify-content: center; gap: var(--s2); padding: var(--s2) var(--s4);
              font-size: var(--text-sm); font-weight: 500; background: var(--warn-bg); color: var(--warn);
              border-bottom: 1px solid var(--warn-line); text-align: center; }
.notice-bar.out { background: var(--bad-bg); color: var(--bad); border-bottom-color: var(--bad-line); }

.page-head { display: flex; align-items: center; gap: var(--s3); min-height: 56px; padding: var(--s2) var(--s6);
             border-bottom: 1px solid var(--line); background: var(--canvas); }
.page-head h1 { font-size: var(--text-md); font-weight: 600; letter-spacing: -0.006em; flex: 1; min-width: 0;
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs { display: flex; align-items: center; gap: var(--s2); flex: 1; min-width: 0; font-size: var(--text-ui); }
.crumbs a { color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.crumbs a:hover { color: var(--ink); }
.crumbs .icon { color: var(--ink-3); }
.crumbs h1, .crumbs .here-crumb { flex: 0 1 auto; font-size: var(--text-md); font-weight: 600; letter-spacing: -0.006em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-actions { display: flex; align-items: center; gap: var(--s2); flex: none; }
.page-head .menu-btn { display: none; }

.page { width: 100%; max-width: 1120px; margin: 0 auto; padding: var(--s6) var(--s6) var(--s8); }
.page.narrow { max-width: 880px; }
.page > h1:first-child { margin-bottom: var(--s2); }
.lede { color: var(--ink-2); max-width: 72ch; margin-bottom: var(--s5); }

/* A page that fills the window and scrolls inside (the chat). */
.fill .shell { height: 100vh; height: 100dvh; }
.fill .main { height: 100vh; height: 100dvh; min-height: 0; }
.chat-main { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* Home shows its header only where the menu button lives. */
.page-head.mobile-only { display: none; }

/* Signed-out pages: sign-in, privacy. */
main.public { max-width: 760px; padding-top: var(--s7); }
.public-brand { display: inline-flex; align-items: center; gap: 10px; margin-bottom: var(--s6); color: var(--ink);
                text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.public-brand .mark { width: 22px; height: 22px; }
.public-brand span span { color: var(--ink-3); font-weight: 500; }
main.public.signin-page { max-width: 412px; padding-top: 12vh; }
.signin { max-width: none; }
.signin h1 { margin-bottom: var(--s1); }
.signin .lede { margin-bottom: var(--s5); }
.signin form { display: grid; gap: var(--s4); }
.signin .btn { width: 100%; height: 38px; }
.form-error { display: flex; gap: var(--s2); align-items: center; padding: 10px 12px; border-radius: var(--r-sm);
              background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-line); font-weight: 500; }

.scrim { position: fixed; inset: 0; z-index: var(--z-scrim); background: var(--scrim);
         opacity: 0; pointer-events: none; transition: opacity var(--dur-3) var(--ease-out); }

/* ---------------------------------------------------------------- settings */

/* A large dialog over the page, which blurs and dims behind it: the sections on the left, the chosen one on the
   right. The native <dialog> keeps focus inside, makes the page behind inert and closes on Esc. */
.settings {
  width: min(1000px, calc(100vw - 64px)); height: min(680px, calc(100dvh - 64px)); max-width: none; max-height: none;
  margin: auto; padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop);
  opacity: 1; transform: none;
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out),
              overlay var(--dur-2) allow-discrete, display var(--dur-2) allow-discrete;
}
.settings[open] { display: flex; flex-direction: column; }
html:has(.settings[open]) { overflow: hidden; }  /* the page behind stays put */
.settings:not([open]) { opacity: 0; transform: translateY(6px) scale(0.985); }
@starting-style { .settings[open] { opacity: 0; transform: translateY(6px) scale(0.985); } }
.settings::backdrop {
  background: var(--scrim, oklch(0.2 0.01 180 / 0.32));
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 1;
  transition: opacity var(--dur-2) var(--ease-out), overlay var(--dur-2) allow-discrete, display var(--dur-2) allow-discrete;
}
.settings:not([open])::backdrop { opacity: 0; }
@starting-style { .settings[open]::backdrop { opacity: 0; } }

.set-head { flex: none; display: flex; align-items: center; gap: var(--s3); min-height: 56px; padding: 0 var(--s3) 0 var(--s5);
            border-bottom: 1px solid var(--line); }
.set-head h2 { flex: 1; font-size: var(--text-md); font-weight: 600; letter-spacing: -0.006em; }
.set-head .btn-icon { width: 36px; height: 36px; }
.set-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr); }

.set-nav { display: flex; flex-direction: column; gap: 2px; padding: var(--s3) var(--s2); border-right: 1px solid var(--line);
           overflow-y: auto; }
.set-nav [role="tab"] { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 10px; border: 0;
                        border-radius: var(--r-sm); background: none; color: var(--ink-2); font: 500 var(--text-ui)/1.2 var(--font);
                        text-align: left; white-space: nowrap; cursor: pointer;
                        transition: color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out); }
.set-nav [role="tab"]:hover { color: var(--ink); background: var(--hover); }
.set-nav [role="tab"][aria-selected="true"] { color: var(--ink); background: var(--hover-strong); }

.set-panels { min-width: 0; overflow-y: auto; padding: var(--s5) var(--s6) var(--s6); scrollbar-width: thin;
              scrollbar-color: var(--line-strong) transparent; }
.set-panel { max-width: 720px; animation: panel-in var(--dur-2) var(--ease-out); }
.set-panel h3 { font-size: var(--text-lg); letter-spacing: -0.012em; margin-bottom: var(--s2); }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } }

/* A setting: what it is and what it does on the left, its value or control on the right. */
.set-row { display: flex; align-items: center; gap: var(--s3) var(--s5); padding: var(--s4) 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row.stack { flex-direction: column; align-items: stretch; }
.set-row form { margin: 0; flex: none; }
.set-row > .btn { flex: none; }
.set-text { display: block; flex: 1; min-width: 0; margin: 0; font: 400 var(--text-ui)/1.45 var(--font); color: var(--ink); }
.set-text b { display: block; font-weight: 500; }
.set-text span { display: block; max-width: 62ch; margin-top: 2px; color: var(--ink-2); font-size: var(--text-sm); text-wrap: pretty; }
label.set-text { cursor: pointer; }
.set-value { flex: 0 1 auto; min-width: 0; text-align: right; overflow-wrap: anywhere; }
.set-value.faint { color: var(--ink-3); }
.set-note { margin: 0; min-height: 0; color: var(--bad); font-size: var(--text-sm); }
.set-note:empty { display: none; }

/* The theme choices as pictures of the app in each theme. */
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 176px)); gap: var(--s4); }
.theme-opt { position: relative; display: grid; gap: var(--s2); margin: 0; color: var(--ink-2);
             font: 500 var(--text-ui)/1.2 var(--font); cursor: pointer; }
.theme-opt input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; }
.theme-pic { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--r-md);
             border: 1px solid var(--line-strong); background: var(--canvas);
             transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out); }
.theme-opt:hover .theme-pic { border-color: var(--ink-3); }
.theme-opt:has(:checked) .theme-pic { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.theme-opt:has(:focus-visible) .theme-pic { outline: 2px solid var(--focus); outline-offset: 3px; }
.theme-name { display: flex; align-items: center; gap: 6px; transition: color var(--dur-1) var(--ease-out); }
.theme-opt:has(:checked) .theme-name { color: var(--ink); }
.theme-name .icon { color: var(--ink-3); }
.theme-opt:has(:checked) .theme-name .icon { color: var(--ink); }

.mini { position: absolute; inset: 0; display: flex; background: var(--canvas); }
.mini i { display: block; height: 4px; border-radius: 2px; background: var(--line); }
.mini-side { flex: none; display: flex; flex-direction: column; gap: 5px; width: 30%; padding: 11% 6%;
             background: var(--side); border-right: 1px solid var(--line); }
.mini-side i { background: var(--line-strong); }
.mini-side i:first-child { width: 70%; margin-bottom: 3px; background: var(--ink-3); }
.mini-main { flex: 1; display: flex; flex-direction: column; gap: 5px; padding: 12% 11%; }
.mini-main .mini-h { width: 46%; height: 5px; margin-bottom: 2px; background: var(--ink); }
.mini-main .mini-box { height: 14px; margin-bottom: 4px; border-radius: 5px; background: var(--surface);
                       border: 1px solid var(--line-strong); }
.mini-main .short { width: 62%; }
.theme-pic .mini + .mini { clip-path: polygon(100% 0, 100% 100%, 0 100%); }

/* An on/off switch: a checkbox drawn as a track and thumb. */
input.switch { appearance: none; position: relative; flex: none; width: 36px; height: 20px; margin: 0; border-radius: 999px;
               background: var(--line-strong); cursor: pointer; transition: background-color var(--dur-2) var(--ease-out); }
input.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
                      background: var(--on-primary); box-shadow: 0 1px 2px oklch(0.2 0.01 180 / 0.2);
                      transition: transform var(--dur-2) var(--ease-out); }
input.switch:checked { background: var(--primary); }
input.switch:checked::after { transform: translateX(16px); }
input.switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* While the theme changes, the whole page crossfades as one picture. */
html.theme-swap .side, html.theme-swap .main, html.theme-swap .composer, html.theme-swap .here { view-transition-name: none !important; }
html.theme-swap::view-transition-old(root), html.theme-swap::view-transition-new(root) {
  animation-duration: var(--dur-3); animation-timing-function: var(--ease-out);
}

/* ---------------------------------------------------------------- shared content */

.panel, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.card { padding: var(--s5); margin-bottom: var(--s4); }
.card > h3:first-child, .card > h2:first-child { margin-bottom: var(--s3); }
.card h3 { margin: var(--s4) 0 var(--s2); }
.card h3:first-child { margin-top: 0; }
.card h4 { margin: var(--s4) 0 var(--s2); }
.panel-warn { border-color: var(--warn-line); }
.panel-bad { border-color: var(--bad-line); }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: var(--text-xs); font-weight: 500; color: var(--ink-3); white-space: nowrap; }
tr:last-child > td { border-bottom: 0; }
.card table th:first-child, .card table td:first-child { padding-left: 0; }
.card table th:last-child, .card table td:last-child { padding-right: 0; }
.scroll { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: var(--text-sm); }
.ok { color: var(--good); }
.warn { color: var(--warn); }
.error { color: var(--bad); }
.notice { background: var(--good-bg); border: 1px solid var(--good-line); color: var(--good); padding: 10px 14px;
          border-radius: var(--r-sm); font-weight: 500; }
ul.problems { padding-left: 20px; }
ul.problems li { color: var(--bad); margin-bottom: var(--s1); }
.row { display: flex; gap: var(--s3); align-items: end; flex-wrap: wrap; }
.row > div { flex: 1 1 180px; }
details > summary { cursor: pointer; }
details > summary::marker { color: var(--ink-3); }

.pill, .label { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
                font-size: var(--text-xs); font-weight: 500; line-height: 1.6; white-space: nowrap;
                background: var(--sunken); color: var(--ink-2); border: 1px solid var(--line); }
.label-Scale, .label-on-track { background: var(--good-bg); color: var(--good); border-color: var(--good-line); }
.label-Maintain, .label-none { background: var(--sunken); color: var(--ink-2); }
.label-Fix { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.label-Cut, .label-at-risk { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }

/* A status: its icon and word in its tone. Never color alone. */
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.tone-bad { color: var(--bad); }
.tone-warn { color: var(--warn); }
.tone-good { color: var(--good); }
.tone-plain { color: var(--ink); }
.tone-quiet { color: var(--ink-3); }

tr.flagged > td { background: var(--bad-bg); }
.accounts.history { min-width: 640px; }
.empty { padding: var(--s7) var(--s5); text-align: center; }
.empty h3 { margin-bottom: var(--s2); }
.empty p { color: var(--ink-2); max-width: 46ch; margin: 0 auto; }

/* ---------------------------------------------------------------- the message box (home and chat) */

.composer {
  position: relative; display: block; border: 1px solid var(--line-strong); border-radius: var(--r-xl);
  background: var(--surface); box-shadow: var(--shadow-md); padding: 10px 10px 8px 18px;
  view-transition-name: composer;
  transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.composer:focus-within { border-color: var(--ink-3); }
.composer textarea { display: block; width: 100%; height: auto; min-height: 28px; max-height: 240px; padding: 6px 0;
                     border: 0; border-radius: 0; background: transparent; box-shadow: none; resize: none; outline: none;
                     font: 400 var(--text-md)/1.55 var(--font); color: var(--ink); }
.composer textarea:hover, .composer textarea:focus-visible { border: 0; box-shadow: none; }
.composer .bar { display: flex; align-items: center; gap: var(--s1); margin-top: 2px; }
.composer .grow { flex: 1; min-width: 0; font-size: var(--text-sm); color: var(--bad); }
.composer .attach { width: 34px; height: 34px; border-radius: 50%; color: var(--ink-2); margin-left: -8px; }
.send { width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center; flex: none;
        background: var(--primary); color: var(--on-primary); cursor: pointer;
        transition: background-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out), opacity var(--dur-1); }
.send:hover { background: var(--primary-hover); }
.send:active { transform: scale(0.94); }
.send[disabled] { background: var(--line-strong); color: var(--surface); cursor: default; transform: none; }
.send .icon { width: 17px; height: 17px; stroke-width: 2.1; }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.file { display: inline-flex; align-items: center; gap: 6px; max-width: 280px; height: 28px; padding: 0 6px 0 10px;
        border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--sunken); color: var(--ink-2);
        font-size: var(--text-sm); animation: pop-in var(--dur-2) var(--ease-out); }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; }
.file button { width: 20px; height: 20px; border: 0; border-radius: 4px; background: none; color: var(--ink-3);
               display: grid; place-items: center; cursor: pointer; padding: 0; }
.file button:hover { background: var(--hover-strong); color: var(--ink); }
@keyframes pop-in { from { opacity: 0; transform: scale(0.96); } }

.drop { position: fixed; inset: 12px; z-index: var(--z-drop); display: grid; place-items: center; pointer-events: none;
        border: 2px dashed var(--ink-3); border-radius: var(--r-lg);
        background: color-mix(in oklch, var(--canvas) 88%, transparent);
        font-size: var(--text-lg); font-weight: 600; color: var(--ink);
        opacity: 0; transition: opacity var(--dur-2) var(--ease-out); }
.drop.show { opacity: 1; }
.drop .icon { width: 28px; height: 28px; display: block; margin: 0 auto var(--s3); }

/* ---------------------------------------------------------------- home */

.home { width: 100%; max-width: 1120px; margin: 0 auto; padding: var(--s7) var(--s6) var(--s8); }
.greet { max-width: 760px; margin: 0 auto var(--s5); }
.greet h1 { font-size: var(--text-xl); }
.greet p { color: var(--ink-2); margin: var(--s1) 0 0; }
.start { max-width: 760px; margin: 0 auto; }
.suggest { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.suggest button { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
                  color: var(--ink-2); font: 500 var(--text-sm)/1 var(--font); cursor: pointer;
                  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), border-color var(--dur-1); }
.suggest button:hover { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.assistant-off { margin-top: var(--s3); color: var(--ink-2); font-size: var(--text-sm); }

.now { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: start; gap: var(--s4); margin: var(--s7) 0 var(--s6); }
.now.calm { grid-template-columns: 1fr; }
.list { padding: var(--s2) 0; min-width: 0; }
.list-head { display: flex; align-items: baseline; gap: var(--s2); padding: var(--s2) var(--s4) var(--s1); }
.list-head h2 { font-size: var(--text-ui); font-weight: 600; letter-spacing: 0; }
.count { color: var(--ink-3); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.list-head .live-note { margin-left: auto; color: var(--ink-3); font-size: var(--text-xs); }
.items { list-style: none; margin: 0; padding: 0; }
.item { position: relative; display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s4);
        animation: item-in var(--dur-3) var(--ease-out); }
.item + .item { border-top: 1px solid var(--line); }
.item > .icon { color: var(--ink-3); }
.item.question > .icon { color: var(--warn); }
.item.failed > .icon { color: var(--bad); }
.item .what { flex: 1; min-width: 0; }
.item .what a { display: block; font-weight: 500; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .what a::after { content: ""; position: absolute; inset: 0; }
.item .what span { display: block; color: var(--ink-2); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .go { flex: none; font-size: var(--text-sm); font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px;
            transition: color var(--dur-1) var(--ease-out), transform var(--dur-2) var(--ease-out); }
.item:hover { background: var(--hover); }
.item:hover .go { color: var(--ink); transform: translateX(2px); }
.item.done > .icon { color: var(--good); }
.items .none { padding: 10px var(--s4); color: var(--ink-3); }
.calm-line { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); color: var(--ink-2); }
.calm-line .icon { color: var(--good); }
@keyframes item-in { from { opacity: 0; transform: translateY(4px); } }

.accounts-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); margin-bottom: var(--s3); }
.accounts-head h2 { flex: none; }
.sum { flex: 1 1 320px; color: var(--ink-2); margin: 0; }
.sum b { font-weight: 600; font-variant-numeric: tabular-nums; }
.sum .waste { color: var(--bad); }
.sum .gain { color: var(--good); }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px;
        border: 1px solid var(--line); background: transparent; color: var(--ink-2); cursor: pointer;
        font: 500 var(--text-sm)/1 var(--font);
        transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), border-color var(--dur-1); }
.chip:hover { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip[aria-pressed="true"] .count { color: inherit; opacity: 0.75; }
.search { position: relative; width: 240px; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { height: 32px; padding-left: 32px; padding-right: 30px; }
.search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-family: var(--font); font-size: 11px;
              color: var(--ink-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; line-height: 16px; }
.seg { display: inline-flex; padding: 2px; border-radius: var(--r-sm); background: var(--sunken); border: 1px solid var(--line); }
.seg a { height: 26px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 4px; text-decoration: none;
         color: var(--ink-2); font-weight: 500; font-size: var(--text-sm); }
.seg a[aria-current="true"] { background: var(--seg-on); color: var(--ink); box-shadow: var(--shadow-sm); }

.table-wrap { overflow-x: auto; }
.accounts { table-layout: fixed; min-width: 860px; }
.accounts th { padding: 8px var(--s3); background: var(--sunken); border-bottom: 1px solid var(--line); }
.accounts th:first-child { border-top-left-radius: var(--r-md); padding-left: var(--s4); }
.accounts th:last-child { border-top-right-radius: var(--r-md); }
.accounts th button { all: unset; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; border-radius: 4px; }
.accounts th button:hover { color: var(--ink); }
.accounts th button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.accounts th .sort { opacity: 0; transition: opacity var(--dur-1), transform var(--dur-2) var(--ease-out); }
.accounts th[aria-sort] .sort { opacity: 1; }
.accounts th[aria-sort="ascending"] .sort { transform: rotate(180deg); }
.accounts th.num button { flex-direction: row-reverse; }
.accounts td { padding: 12px var(--s3); vertical-align: middle; }
.accounts td:first-child { padding-left: var(--s4); }
.accounts tbody tr { position: relative; transition: background-color var(--dur-1) var(--ease-out); }
.accounts tbody tr:hover, .accounts tbody tr:focus-within { background: var(--hover); }
.acct a { display: block; font-weight: 500; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct a::after { content: ""; position: absolute; inset: 0; }
.acct a:focus-visible { outline: none; }
.accounts tbody tr:has(.acct a:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.acct span { display: block; color: var(--ink-3); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when b { display: block; font-weight: 400; }
.when span { display: block; color: var(--ink-3); font-size: var(--text-sm); }
.money { font-weight: 500; }
.money.waste { color: var(--bad); }
.money.gain { color: var(--good); }
.money.none { color: var(--ink-3); font-weight: 400; }
.bench { display: inline-flex; align-items: center; gap: var(--s2); }
.bench .ticks { display: inline-flex; gap: 2px; }
.bench .ticks i { width: 6px; height: 12px; border-radius: 2px; background: var(--line-strong); }
.bench .ticks i.pass { background: var(--good); }
.bench .ticks i.fail { background: var(--bad); }
.spark { display: block; overflow: visible; }
.spark polyline { fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--ink); }
.row-act { position: relative; z-index: 1; opacity: 0; transition: opacity var(--dur-1) var(--ease-out); }
.accounts tbody tr:hover .row-act, .accounts tbody tr:focus-within .row-act, .row-act:focus-visible { opacity: 1; }
.accounts-foot { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-top: 1px solid var(--line);
                 color: var(--ink-3); font-size: var(--text-sm); }
.accounts-foot .btn { margin-left: auto; }
.no-match td { text-align: center; color: var(--ink-2); padding: var(--s6) var(--s4); }

.unassigned { margin-top: var(--s6); }
.unassigned-head { display: flex; align-items: baseline; gap: var(--s2); margin-bottom: var(--s2); }
.unassigned-head h2 { font-size: var(--text-md); }
.unassigned-head p { margin: 0; color: var(--ink-3); font-size: var(--text-sm); }
.claim-list { list-style: none; margin: 0; padding: 0; }
.claim-list li { display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s4); }
.claim-list li + li { border-top: 1px solid var(--line); }
.claim-list .what { flex: 1; min-width: 0; }
.claim-list .what b { font-weight: 500; }
.claim-list .what span { color: var(--ink-3); font-size: var(--text-sm); margin-left: var(--s2); }

/* ---------------------------------------------------------------- page to page */

@view-transition { navigation: auto; }
::view-transition-old(side) { display: none; }
::view-transition-new(side) { animation: none; }
::view-transition-old(page) { animation: page-out 90ms var(--ease-in) both; }
::view-transition-new(page) { animation: page-in var(--dur-2) var(--ease-out) 60ms both; }
::view-transition-group(nav-here), ::view-transition-group(composer) { animation-duration: var(--dur-3); animation-timing-function: var(--ease-out); }
::view-transition-old(composer), ::view-transition-new(composer) { height: 100%; object-fit: none; object-position: left bottom; }
/* The message box and the nav highlight glide only when both pages have them; otherwise they fade with the page. */
::view-transition-old(composer):only-child, ::view-transition-old(nav-here):only-child { animation: page-out 90ms var(--ease-in) both; }
::view-transition-new(composer):only-child, ::view-transition-new(nav-here):only-child { animation: page-in var(--dur-2) var(--ease-out) 60ms both; }
@keyframes page-out { to { opacity: 0; } }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 860px) {
  .shell, html[data-side="rail"] .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%);
          box-shadow: var(--shadow-pop); transition: transform var(--dur-3) var(--ease-out); view-transition-name: none; }
  html.nav-open .side { transform: none; }
  html.nav-open .scrim { opacity: 1; pointer-events: auto; }
  html[data-side="rail"] .side .brand-name, html[data-side="rail"] .side .nav-text, html[data-side="rail"] .side-section,
  html[data-side="rail"] .side-new .nav-text, html[data-side="rail"] .me .who, html[data-side="rail"] .me > .icon { display: revert; }
  html[data-side="rail"] .side .recent { display: grid; }
  .side .side-toggle { display: none; }
  .rail-row { display: none; }  /* the sidebar is a drawer here, never a rail */
  .set-row:has(+ .rail-row) { border-bottom: 0; }
  .menu { width: calc(min(300px, 86vw) - 16px); }
  .page-head .menu-btn { display: inline-flex; margin-left: calc(-1 * var(--s2)); }
  .page-head.mobile-only { display: flex; }
  .page-head { padding: var(--s2) var(--s4); position: sticky; top: 0; z-index: var(--z-sticky); }
  .page { padding: var(--s5) var(--s4) var(--s7); }
  .home { padding: var(--s5) var(--s4) var(--s7); }
  .now { grid-template-columns: 1fr; margin: var(--s6) 0 var(--s5); }
  .search { width: 100%; order: -1; }
  .greet h1 { font-size: var(--text-lg); }
}
@media (max-width: 700px) {
  /* The accounts table becomes a list of rows: name and status, then the money. */
  #acctTable { min-width: 0; table-layout: auto; }
  #acctTable thead { display: none; }
  #acctTable tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s3); padding: var(--s3) var(--s4);
                       border-bottom: 1px solid var(--line); }
  #acctTable tbody tr:last-child { border-bottom: 0; }
  #acctTable td { display: block; padding: 0; border: 0; }
  #acctTable td:first-child { padding-left: 0; }
  #acctTable td.c-status { text-align: right; }
  #acctTable td.c-last { grid-column: 1; }
  #acctTable td.c-wasted { grid-column: 2; text-align: right; }
  #acctTable td.c-wasted::before { content: "Wasted "; color: var(--ink-3); font-weight: 400; font-size: var(--text-sm); }
  #acctTable td.c-gain, #acctTable td.c-bench, #acctTable td.c-trend, #acctTable td.c-act { display: none; }

  /* Settings fills the screen, with its sections as a row of tabs under the title. */
  .settings { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; }
  .set-head { padding: 0 var(--s2) 0 var(--s4); }
  .set-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .set-nav { flex-direction: row; gap: var(--s1); padding: var(--s2) var(--s3); overflow-x: auto; overflow-y: hidden;
             border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .set-nav [role="tab"] { flex: none; min-height: 36px; }
  .set-panels { padding: var(--s4) var(--s4) var(--s6); }
  .set-row:not(.stack) { flex-wrap: wrap; }
  .set-row:not(.stack) .set-text { flex-basis: 220px; }
  .themes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
}
@media (max-width: 440px) {
  .set-nav [role="tab"] .icon { display: none; }  /* the three tabs fit a phone's width */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
                           transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .spin { animation: none !important; }
}

/* The review page: approve or reject each action */
.review-bar { position: sticky; top: var(--s2); z-index: var(--z-sticky); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4); margin-bottom: var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-md); }
.review-counts { font-size: var(--text-ui); font-variant-numeric: tabular-nums; }
.review-error { flex: 1 1 200px; margin: 0; }
.review-error[hidden] { display: none; }
.review-bar .btn-primary { margin-left: auto; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); }
.review-head h3 { margin: 0; }
.review-list { list-style: none; margin: 0; padding: 0; }
.review-item { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.review-what { min-width: 0; font-size: var(--text-ui); overflow-wrap: anywhere; }
.review-choice { display: inline-flex; flex: none; gap: var(--s1); }
.review-final { flex: none; }
.review-choice [data-choose="approved"][aria-pressed="true"] { background: var(--good-bg); border-color: var(--good-line); color: var(--good); }
.review-choice [data-choose="rejected"][aria-pressed="true"] { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
@media (max-width: 700px) {
  .review-item { flex-direction: column; gap: var(--s2); }
}
