/* Capital & Parts — the whole visual layer. No framework: everything the browser needs is here.
   "Ledger, not dashboard": calm neutrals, one accent, numbers that line up.
   Tokens come first; every rule below reads from them. Change a colour here, not inline. */

/* Inter, vendored (SIL OFL — see INTER-LICENSE.txt). Latin only; the fallback stack covers the rest. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); }

/* ---------------------------------------------------------------- tokens ----------------- */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f3f4f7;
  --row-hover: #f7f8fb;
  --line: #e9ebf0;
  --line-strong: #d5d9e2;
  --ink: #131a2b;
  --ink-2: #48526a;
  /* The muted tone is the one that gets contrast wrong. #646e88 measures 5.1:1 on white and
     4.6:1 on --surface-2, the darkest tint muted text sits on. The original #7a8397 was 3.8:1,
     below the 4.5:1 floor. Measured with axe across every page in both themes, not eyeballed. */
  --ink-3: #646e88;
  --accent: #2f4fd8;
  --accent-hover: #2743bd;
  --accent-ink: #ffffff;
  --accent-soft: #eef1fd;
  --good: #1f7a4d;
  --good-soft: #e3f4ea;
  --warn: #9a5008;          /* 5.3:1 on --warn-soft; #b25e09 was 4.15:1 as badge text */
  --warn-soft: #fdf0df;
  --bad: #b42323;
  --bad-soft: #fbe6e6;
  --info: #5a3fc0;
  --info-soft: #ece7fa;

  /* Chart series. Validated as a categorical pair (CVD ΔE 30, normal ΔE 34). */
  --chart-in: #2f4fd8;
  --chart-out: #b25e09;

  /* The sidebar is the one dark surface: it anchors the page and keeps the content area calm. */
  --side-bg: #111827;
  --side-ink: #e8ebf3;
  --side-muted: #9aa3b8;
  --side-line: rgba(255, 255, 255, .08);
  --side-hover: rgba(255, 255, 255, .05);

  --font: "Inter", "Segoe UI", ui-sans-serif, system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px;
  --fs-xl: 20px; --fs-2xl: 26px; --fs-3xl: 34px; --fs-4xl: 40px;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --radius-sm: 6px; --radius: 8px; --radius-lg: 10px;
  /* Shadows belong to things that float — menus, sheets, toasts. Resting surfaces get a
     hairline and nothing else; that single decision is most of what makes a page calm. */
  --shadow-sm: 0 1px 1px rgba(19, 26, 43, .03);
  --shadow-md: 0 4px 16px rgba(19, 26, 43, .08);
  --shadow-lg: 0 16px 48px rgba(19, 26, 43, .18);
  --focus-ring: 0 0 0 3px rgba(47, 79, 216, .3);

  --sidebar-w: 232px;
  --topbar-h: 56px;
  --row-h: 46px;
  --control-h: 40px;

  /* The thumb. Every control a finger lands on is at least this tall on a touch screen;
     the pointer-based override below relaxes it for a mouse, where 44px looks clumsy. */
  --tap: 44px;

  /* Motion. Only three durations exist, all ease-out: anything longer than --dur-slow is
     decoration, and decoration is what makes an app feel slow. */
  --dur-fast: 120ms;
  --dur: 160ms;
  --dur-slow: 200ms;
  --ease: cubic-bezier(.2, .8, .3, 1);

  /* Skeletons: the resting tone of content that has not arrived yet. */
  --skeleton: #e7eaf2;
}

/* ---------------------------------------------------------------- dark ------------------
   Dark is a token swap and nothing else — no rule below this block knows which theme it is
   in. `prefers-color-scheme` is the default; [data-theme] is the user overriding it, and
   each palette is written twice so the toggle wins in both directions.

   The ink scale stays above 4.5:1 on its own surface in both themes, muted tone included. */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c111c;
    --surface: #141b2a;
    --surface-2: #1b2334;
    --row-hover: #1e273a;
    --line: #262f42;
    --line-strong: #3a465f;
    --ink: #eef1f8;
    --ink-2: #b6bfd2;
    --ink-3: #8b95ab;
    --accent: #7b96ff;
    --accent-hover: #93a9ff;
    --accent-ink: #0c111c;
    --accent-soft: #1d2846;
    --good: #5bd39a;
    --good-soft: #14302a;
    --warn: #eaa34a;
    --warn-soft: #33260f;
    --bad: #ff8a85;
    --bad-soft: #3a1b1e;
    --info: #b09bff;
    --info-soft: #251f42;
    --chart-in: #7b96ff;
    --chart-out: #eaa34a;
    --side-bg: #090d16;
    --side-ink: #e8ebf3;
    --side-muted: #8b95ab;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .45);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .6);
    --focus-ring: 0 0 0 3px rgba(123, 150, 255, .4);
    --skeleton: #222c40;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c111c;
  --surface: #141b2a;
  --surface-2: #1b2334;
  --row-hover: #1e273a;
  --line: #262f42;
  --line-strong: #3a465f;
  --ink: #eef1f8;
  --ink-2: #b6bfd2;
  --ink-3: #8b95ab;
  --accent: #7b96ff;
  --accent-hover: #93a9ff;
  --accent-ink: #0c111c;
  --accent-soft: #1d2846;
  --good: #5bd39a;
  --good-soft: #14302a;
  --warn: #eaa34a;
  --warn-soft: #33260f;
  --bad: #ff8a85;
  --bad-soft: #3a1b1e;
  --info: #b09bff;
  --info-soft: #251f42;
  --chart-in: #7b96ff;
  --chart-out: #eaa34a;
  --side-bg: #090d16;
  --side-ink: #e8ebf3;
  --side-muted: #8b95ab;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .6);
  --focus-ring: 0 0 0 3px rgba(123, 150, 255, .4);
  --skeleton: #222c40;
  color-scheme: dark;
}

[data-density="compact"] { --row-h: 36px; }

/* ---------------------------------------------------------------- reset ------------------
   The few browser defaults the app relies on being normalised. */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0; font-weight: 600; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-2) 0; }
a { color: var(--accent); }
label { display: inline-block; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; }
textarea { resize: vertical; }
img, svg { vertical-align: middle; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
th { text-align: inherit; }
summary { cursor: pointer; }
code { font-size: .9em; color: var(--info); }

/* Every figure in the app lines up: one rule, used everywhere numbers appear. */
.num, .money, td.num, th.num, .metric-value, .kv-value, .stat-value, input[type="number"] {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}
.num, td.num, th.num { text-align: right; white-space: nowrap; }
.nowrap, td.nowrap, th.nowrap { white-space: nowrap; }

.zero { color: var(--ink-3); }
.negative { color: var(--bad); }
.positive { color: var(--good); }

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

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 200;
  background: var(--surface); color: var(--ink); padding: 10px 16px;
  border-radius: var(--radius); box-shadow: var(--shadow-md); text-decoration: none;
}
.skip-link:focus { left: 8px; }

/* ---------------------------------------------------------------- controls ---------------
   Buttons and inputs. These replace the Bootstrap classes the markup uses, so the names
   stay familiar but every pixel is decided here. */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 0 12px; height: 32px;
  font-size: var(--fs-sm); font-weight: 500; line-height: 1; white-space: nowrap;
  text-decoration: none; cursor: pointer; user-select: none;
  transition: background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* The primary button has a hairline of its own darker tone and a one-pixel inset highlight:
   the two together are what make a flat colour read as a pressable object. */
.btn-primary {
  background: var(--accent); border-color: var(--accent-hover); color: var(--accent-ink); font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(19, 26, 43, .12);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-outline-secondary {
  border-color: var(--line-strong); color: var(--ink); background: var(--surface);
  box-shadow: 0 1px 1px rgba(19, 26, 43, .04);
}
.btn-outline-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.btn-sm { font-size: var(--fs-xs); padding: 0 10px; height: 28px; }
.btn-link { color: var(--accent); text-decoration: none; padding: 0; border: 0; background: none; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

/* A finger is not a pointer. Where the input is coarse, every control that gets tapped grows
   to --tap; on a mouse the compact sizes stay, because 44px buttons on a desk look clumsy.
   .btn-link is excluded — it is text in a sentence, not a target. */
@media (pointer: coarse) {
  .btn:not(.btn-link), .icon-btn, .form-control, .form-select, .expander,
  .tabbar button, .menu button, .menu a, .segmented button {
    min-height: var(--tap);
  }
  .btn-sm { padding: 0 12px; font-size: var(--fs-sm); }
  /* The row itself is the target in card mode, so its buttons may stay small — but they
     still need room around them not to collide. */
  .table-wrap.cards .row-actions .btn { min-height: var(--tap); }
}

/* A button that is waiting on the network says so, cannot be pressed again, and keeps its
   width so the layout does not jump when the label changes. */
.btn[aria-busy="true"], .btn[data-busy="true"] { opacity: 1; cursor: progress; }
.btn[data-busy="true"] > .spin {
  display: inline-block; width: 13px; height: 13px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.w-100 { width: 100%; }
/* Present to assistive technology, absent from the layout. For a label that sight gets from context. */
.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; }

.form-control, .form-select {
  display: block; width: 100%; height: var(--control-h); padding: 0 var(--sp-3);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface);
  box-shadow: 0 1px 1px rgba(19, 26, 43, .03);
  color: var(--ink); font-size: var(--fs-md); line-height: 1.4; appearance: none;
  transition: border-color .12s, box-shadow .12s, background-color .12s;
}
.form-select {
  padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a8397' 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 12px center; background-size: 16px;
}
textarea.form-control { height: auto; min-height: 76px; padding: 9px var(--sp-3); }
.form-control::placeholder { color: var(--ink-3); }
.form-control:focus, .form-select:focus {
  background-color: var(--surface); border-color: var(--accent); outline: none; box-shadow: var(--focus-ring);
}
.form-control:disabled, .form-control[readonly] { background: var(--surface-2); color: var(--ink-3); }
.form-label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.form-text { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 5px; }
.mb-3 { margin-bottom: var(--sp-4); }

.spinner-border {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- auth pages ------------- */

.auth-body { min-height: 100vh; background: var(--side-bg); }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-5); }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); padding: var(--sp-6);
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.auth-brand { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.auth-brand strong { display: block; font-size: var(--fs-lg); }
.auth-brand span { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.auth-title { font-size: var(--fs-2xl); margin-bottom: var(--sp-1); }
.auth-sub { color: var(--ink-2); margin-bottom: var(--sp-5); font-size: var(--fs-sm); }
.auth-error {
  background: var(--bad-soft); color: var(--bad); border: 1px solid rgba(180, 35, 35, .25);
  padding: var(--sp-3); border-radius: var(--radius); font-size: var(--fs-sm); margin-bottom: var(--sp-4);
}
.auth-foot { margin: var(--sp-4) 0 0; font-size: var(--fs-xs); color: var(--ink-3); text-align: center; }

/* ---------------------------------------------------------------- shell ------------------ */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.main-column { display: flex; flex-direction: column; min-width: 0; }

.sidebar {
  background: var(--side-bg); color: var(--side-ink);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 16px var(--sp-4) 14px; }
.sidebar-brand img { border-radius: 7px; width: 26px; height: 26px; flex: none; }
.sidebar-brand strong { display: block; font-size: var(--fs-sm); color: #fff; font-weight: 600; letter-spacing: -.01em; }
.sidebar-brand span { display: block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); margin-top: 1px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 var(--sp-3); }
.nav-group { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--side-muted);
             padding: 18px 10px 6px; font-weight: 600; opacity: .8; }
/* The active item is a soft tint, not a solid block: the sidebar should say where you are
   without shouting it, so the page next to it keeps the eye. */
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; margin-bottom: 1px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--side-muted); font-size: var(--fs-sm); text-align: left; cursor: pointer;
  position: relative; font-weight: 500; line-height: 20px;
}
.nav-item svg { opacity: .7; flex: none; width: 16px; height: 16px; }
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item[aria-current="page"] { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-item[aria-current="page"] svg { opacity: 1; color: var(--accent); }
.nav-item .nav-label { flex: 1; min-width: 0; }
.nav-count {
  font-size: var(--fs-xs); color: var(--side-muted); font-variant-numeric: tabular-nums;
  padding: 0 2px; opacity: .9;
}
.nav-item[aria-current="page"] .nav-count { color: #fff; }
.nav-count.warn { color: #f4b453; font-weight: 600; }

.sidebar-foot { border-top: 1px solid var(--side-line); padding: var(--sp-3); }
.who { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2); }
.who-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 650; font-size: var(--fs-sm); flex: none;
}
.who-name { min-width: 0; flex: 1; }
.who-name strong { display: block; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.who-name span { font-size: var(--fs-xs); color: var(--side-muted); }
.sidebar .btn-outline-secondary { background: transparent; border-color: var(--side-line); color: var(--side-muted); }
.sidebar .btn-outline-secondary:hover { background: var(--side-hover); color: #fff; border-color: var(--side-line); }

.sidebar-scrim { position: fixed; inset: 0; background: rgba(19, 26, 43, .5); z-index: 40; }

/* ---------------------------------------------------------------- top bar ---------------- */

.topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-5);
  position: sticky; top: 0; z-index: 30;
}
.crumbs { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); min-width: 0; }
.crumbs button { border: 0; background: none; color: var(--ink-3); padding: 0; cursor: pointer; }
.crumbs button:hover { color: var(--accent); }
.crumbs .sep { color: var(--line-strong); }
.crumbs .current { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#topbar-theme { margin-left: auto; display: flex; }
.topbar-search { position: relative; width: min(360px, 40vw); }
.topbar-search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.topbar-search input {
  width: 100%; height: 32px; padding: 0 56px 0 32px; border: 1px solid transparent;
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); font-size: var(--fs-sm); appearance: none;
}
.topbar-search input:focus { background: var(--surface); border-color: var(--accent); outline: none; box-shadow: var(--focus-ring); }
.topbar-search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); pointer-events: none;
  font-size: 10px; color: var(--ink-3); background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px; padding: 2px 5px; font-family: var(--font);
}
.topbar-search input:not(:placeholder-shown) ~ kbd { display: none; }

.search-results {
  position: absolute; top: calc(100% + 6px); right: 0; width: min(460px, 90vw); z-index: 50;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); max-height: 60vh; overflow-y: auto; padding: var(--sp-2);
}
.search-group { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
                padding: var(--sp-3) var(--sp-3) var(--sp-1); font-weight: 650; }
.search-hit {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; border: 0; background: none;
  padding: 8px var(--sp-3); border-radius: var(--radius); text-align: left; cursor: pointer; color: var(--ink);
}
.search-hit:hover, .search-hit.active { background: var(--accent-soft); }
.search-hit small { display: block; color: var(--ink-3); font-size: var(--fs-xs); }
.search-hit .num { margin-left: auto; font-size: var(--fs-sm); color: var(--ink-2); }
.search-empty { padding: var(--sp-4); color: var(--ink-3); font-size: var(--fs-sm); text-align: center; }

.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line-strong);
  background: var(--surface); border-radius: var(--radius-sm); color: var(--ink-2); cursor: pointer; flex: none; padding: 0;
  box-shadow: 0 1px 1px rgba(19, 26, 43, .04);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

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

.page { flex: 1; padding: 28px var(--sp-6) 64px; max-width: 1320px; width: 100%; margin: 0 auto; }
.page:focus { outline: none; }
.page-loading { display: grid; place-items: center; gap: var(--sp-4); padding: 80px 0; color: var(--ink-3); }

.page-head { display: flex; align-items: flex-end; gap: var(--sp-4); margin-bottom: 28px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; }
.page-head .eyebrow:empty { display: none; }
.page-head h1 { font-size: var(--fs-2xl); margin: 0; }
.page-head .subtitle { color: var(--ink-3); font-size: var(--fs-sm); margin: 5px 0 0; }
.page-head .actions { margin-left: auto; display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

.back-link {
  border: 0; background: none; color: var(--ink-2); font-size: var(--fs-sm);
  padding: 0 0 var(--sp-3); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.back-link:hover { color: var(--accent); }

/* ---------------------------------------------------------------- panels & grids --------- */

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  margin-bottom: var(--sp-5); overflow: hidden; min-width: 0;
}
.panel-head {
  display: flex; align-items: center; gap: var(--sp-3); padding: 14px 20px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap; min-height: 52px;
}
.panel-head h2 { font-size: var(--fs-md); font-weight: 600; letter-spacing: -.01em; }
.panel-head p { margin: 2px 0 0; font-size: var(--fs-xs); color: var(--ink-3); }
.panel-head .actions { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.panel-body { padding: 20px; }
.panel-body > :last-child { margin-bottom: 0; }

/* Grids use explicit column counts per breakpoint, never auto-fit: a row of three with one
   orphan underneath is exactly what auto-fit produces at tablet widths. */
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); margin-bottom: var(--sp-5); align-items: start; }
.split > .panel { margin-bottom: 0; }
.split.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Metric cards. (Not `.cards` — that name is the table primitive's card-mode switch.) */
.metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: var(--sp-5);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
}

.strip {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px 24px; margin-bottom: var(--sp-4); display: grid; gap: var(--sp-6);
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; align-items: center;
}
.strip .eyebrow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
/* The one headline figure on the page. Everything else on the overview is smaller than this. */
.strip-amount { font-size: var(--fs-4xl); font-weight: 600; letter-spacing: -.03em; line-height: 1.05; margin: 6px 0 4px; }
.strip-amount small { font-size: var(--fs-sm); color: var(--ink-3); font-weight: 600; margin-right: 8px; letter-spacing: .04em; vertical-align: 12px; }
.strip .actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ---------------------------------------------------------------- metrics ---------------- */

/* Four figures in one bordered strip, divided by hairlines — one object on the page, not
   four competing cards. No coloured top edges: a tone that matters is said in the foot, in
   words, which is also the only way it survives on a phone in the sun. */
.metric {
  position: relative; background: none; border: 0; border-left: 1px solid var(--line);
  border-radius: 0; padding: 18px 20px 16px; box-shadow: none;
  display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%; min-width: 0;
  color: var(--ink); font: inherit;
}
.metric:first-child { border-left: 0; }
button.metric { cursor: pointer; transition: background-color var(--dur-fast); }
button.metric:hover { background: var(--row-hover); }
.metric-icon { display: none; }
.metric-label { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.metric-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; display: none; flex: none; }
.metric.tone-warn .metric-label::before { display: inline-block; background: var(--warn); }
.metric.tone-bad  .metric-label::before { display: inline-block; background: var(--bad); }
.metric.tone-good .metric-label::before { display: inline-block; background: var(--good); }
.metric-value { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -.025em; line-height: 1.15; overflow-wrap: anywhere; margin-top: 4px; }
.metric-value small { font-size: 11px; color: var(--ink-3); font-weight: 600; margin-right: 6px; letter-spacing: .05em; vertical-align: 7px; }
.metric-foot { font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.45; }

/* ---------------------------------------------------------------- tables ----------------- */

.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.grid thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface); color: var(--ink-3);
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600;
  padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line);
  line-height: 1.25; vertical-align: bottom;
}
/* A header label may take two lines; a column must not take 160px to say "Investor balance".
   This also overrides the global th.num nowrap, which exists for figures, not labels. */
table.grid thead th, table.grid thead th.num, table.grid thead th.nowrap { white-space: normal; }
table.grid thead th.num { text-align: right; }
table.grid th.sortable { cursor: pointer; user-select: none; }
table.grid th.sortable:hover { color: var(--ink); }
table.grid th .arrow { opacity: .35; margin-left: 3px; }
table.grid th[aria-sort] .arrow { opacity: 1; color: var(--accent); }
table.grid tbody td { padding: 0 14px; height: var(--row-h); border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover { background: var(--row-hover); }
table.grid tbody tr.clickable { cursor: pointer; }
table.grid tbody tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
table.grid tbody tr.flash { animation: flash 3s ease-out; }
@keyframes flash { 0%, 55% { background: var(--accent-soft); } 100% { background: transparent; } }
table.grid tbody tr.voided td { color: var(--ink-3); text-decoration: line-through; }
table.grid tbody tr.group-start td { border-top: 1px solid var(--line-strong); }
table.grid td strong { display: block; font-weight: 600; color: var(--ink); }
table.grid td small { display: block; color: var(--ink-3); font-size: var(--fs-xs);
                      overflow: hidden; text-overflow: ellipsis; max-width: 26ch; white-space: nowrap; }
table.grid tfoot td {
  padding: 11px 14px; border-top: 1px solid var(--line-strong);
  font-weight: 600; background: var(--surface); white-space: nowrap;
}
/* Row actions stay quiet until the row is hovered, so a long table reads as data, not buttons.
   Quiet means the muted ink, not a faded opacity: the muted ink still passes 4.5:1, and a
   faded button on a phone — where nothing is ever hovered — would stay faded forever. */
table.grid .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
@media (hover: hover) {
  table.grid tbody tr:not(:hover):not(:focus-within) .row-actions .btn-quiet { color: var(--ink-3); }
}

/* Columns that a narrower screen can do without: hidden by width, shown again in card mode. */
@media (max-width: 1439.98px) { table.grid .col-lg { display: none; } }
/* Secondary text truncates sooner where the table is tight; the full text is in the record. */
@media (max-width: 1439.98px) { table.grid td small { max-width: 22ch; } }
@media (max-width: 991.98px) { table.grid .col-md { display: none; } }

/* ---------------------------------------------------------------- badges ----------------- */

.badge-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
  line-height: 18px; letter-spacing: .01em;
}
.badge-pill.good { background: var(--good-soft); color: var(--good); }
.badge-pill.warn { background: var(--warn-soft); color: var(--warn); }
.badge-pill.bad  { background: var(--bad-soft);  color: var(--bad); }
.badge-pill.info { background: var(--info-soft); color: var(--info); }
.badge-pill.accent { background: var(--accent-soft); color: var(--accent); }
.badge-pill.outline { background: none; border: 1px solid currentColor; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--ink-3); }
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.info { background: var(--info); }
.dot.accent { background: var(--accent); }

/* ---------------------------------------------------------------- key/value -------------- */

.kv { display: flex; flex-direction: column; }
/* One weight for the lines, one for the total. If every value is bold, none of them is. */
.kv-row { display: flex; align-items: baseline; gap: var(--sp-3); padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: 0; }
.kv-row.total { border-top: 1px solid var(--line-strong); border-bottom: 0; margin-top: var(--sp-2); padding-top: var(--sp-3); }
.kv-label { color: var(--ink-2); font-size: var(--fs-sm); }
.kv-value { margin-left: auto; font-weight: 500; text-align: right; font-size: var(--fs-sm); }
.kv-value .cur { font-size: 10px; color: var(--ink-3); font-weight: 600; letter-spacing: .05em; margin-right: 4px; }
.kv-row.total .kv-label { color: var(--ink); font-weight: 600; }
.kv-row.total .kv-value { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -.01em; }

/* ---------------------------------------------------------------- misc blocks ------------ */

.empty { text-align: center; padding: 56px var(--sp-5); color: var(--ink-3); }
.empty-symbol { width: 48px; height: 48px; margin: 0 auto var(--sp-4); color: var(--line-strong); }
.empty h3 { font-size: var(--fs-lg); color: var(--ink); margin-bottom: var(--sp-2); }
.empty p { font-size: var(--fs-sm); max-width: 42ch; margin: 0 auto var(--sp-4); }

.segmented { display: inline-flex; background: var(--surface-2); border-radius: var(--radius); padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: none; padding: 6px 12px; border-radius: 6px; font-size: var(--fs-sm);
  color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.segmented button .count { font-size: var(--fs-xs); color: var(--ink-3); }
.segmented.theme button { padding: 5px 10px; font-size: var(--fs-xs); gap: 5px; }
.segmented.theme button svg { opacity: .7; }
.segmented.theme button[aria-pressed="true"] svg { opacity: 1; color: var(--accent); }

/* A labelled control inside a menu, or a preference row on the Account page. */
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
            padding: 6px var(--sp-3); font-size: var(--fs-sm); color: var(--ink-2); }
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
            padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pref-row:last-child { border-bottom: 0; padding-bottom: 0; }
.pref-row:first-child { padding-top: 0; }
.pref-row > div { min-width: 0; }
.pref-row strong { display: block; font-weight: 600; font-size: var(--fs-sm); }
.pref-row small { display: block; color: var(--ink-3); font-size: var(--fs-xs); margin-top: 2px; }

/* Five segments of one bar. Done segments fill; the label sits under each. Reads at a
   glance from across a counter, which numbered circles joined by dashes never did. */
.stepper { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; list-style: none; padding: 0; margin: 0; }
.stepper li { display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-xs); color: var(--ink-3); min-width: 0; }
.stepper li::before { content: ""; height: 4px; border-radius: 2px; background: var(--line); display: block; }
.stepper li.done::before { background: var(--accent); }
.stepper .marker { display: none; }
.stepper li.done { color: var(--ink); font-weight: 500; }
@media (max-width: 639.98px) { .stepper li { font-size: 10px; } }

.next-step {
  display: flex; align-items: center; gap: var(--sp-4); padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); margin: var(--sp-5) 0 var(--sp-4); flex-wrap: wrap;
}
.next-step strong { display: block; color: var(--accent); font-size: 11px;
                    text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.next-step p { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--ink-2); }
.next-step .btn { margin-left: auto; }

.reasons { display: grid; gap: var(--sp-3); padding: var(--sp-4) 0 0; }
.reasons div { font-size: var(--fs-sm); }
.reasons strong { display: block; color: var(--ink); }
.reasons p { margin: 2px 0 0; color: var(--ink-3); font-size: var(--fs-xs); }

.attention { display: grid; gap: 2px; }
.attention button {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left;
  border: 0; background: none; padding: 10px var(--sp-3); border-radius: var(--radius); cursor: pointer;
}
.attention button:hover { background: var(--surface-2); }
.attention .what { flex: 1; min-width: 0; }
.attention .what strong { display: block; font-size: var(--fs-sm); }
.attention .what small { color: var(--ink-3); font-size: var(--fs-xs); }
.attention svg { color: var(--ink-3); flex: none; }

.rail { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.rail > .panel { position: sticky; top: calc(var(--topbar-h) + var(--sp-5)); }
.rail > .panel > .panel-body { padding: var(--sp-3); }
.rail-list { display: grid; gap: 2px; }
.rail-item {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center;
  gap: var(--sp-2); width: 100%; text-align: left; cursor: pointer;
  border: 0; background: none; padding: 9px var(--sp-2); border-radius: var(--radius); color: var(--ink);
}
.rail-item:hover { background: var(--surface-2); }
.rail-item[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.rail-item .who-avatar { width: 26px; height: 26px; font-size: 11px; }
.rail-item .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.rail-item .name .badge-pill { font-size: 10px; padding: 1px 6px; }
.rail-item .num { font-size: var(--fs-xs); }

.aging { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.aging div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); min-width: 0; }
.aging span { display: block; font-size: var(--fs-xs); color: var(--ink-3); }
.aging strong { display: block; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.aging div.warn strong { color: var(--warn); }
.aging div.bad strong { color: var(--bad); }

.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-5); overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 9px 14px; font-size: var(--fs-sm); color: var(--ink-2);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .count { color: var(--ink-3); font-size: var(--fs-xs); margin-left: 5px; }

.summary-bar {
  position: sticky; top: var(--topbar-h); z-index: 20; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 20px;
  margin-bottom: var(--sp-4); display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap;
}
.summary-bar h1 { font-size: var(--fs-xl); }
.summary-bar .meta { font-size: var(--fs-xs); color: var(--ink-3); display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; margin-top: 3px; }
.summary-bar .actions { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }

progress { width: 100%; height: 7px; border-radius: 99px; overflow: hidden; border: 0; background: var(--surface-2); appearance: none; }
progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
progress.mini { display: block; height: 5px; margin-top: 5px; min-width: 88px; }

.filters { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--sp-4); }
.filters .field { display: grid; gap: 4px; margin: 0; min-width: 0; }
.filters .field.grow { flex: 1 1 220px; }
.filters .field > .form-control, .filters .field > .form-select { min-width: 150px; }
.filters .field.grow > .form-control { min-width: 0; }
.filters label { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 600; }

/* The report picker: chips in named groups, so fifteen reports still read as a short list. */
.report-nav { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.report-group { display: flex; align-items: flex-start; gap: var(--sp-3); flex-wrap: wrap; }
.report-group > span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
                       font-weight: 600; min-width: 72px; line-height: 28px; }
@media (max-width: 639.98px) {
  .filters .field { flex: 1 1 calc(50% - var(--sp-3)); }
  .filters .field > .form-control, .filters .field > .form-select { min-width: 0; }
  .report-group { flex-direction: column; gap: 4px; }
  .report-group > span { line-height: 1.4; }
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 11px;
  font-size: var(--fs-xs); color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }

.activity-item { display: flex; align-items: center; gap: var(--sp-3); padding: 10px var(--sp-5); border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-item .what { flex: 1; min-width: 0; }
.activity-item strong { display: block; font-size: var(--fs-sm); }
.activity-item small { color: var(--ink-3); font-size: var(--fs-xs); }
.activity-item .amount { font-weight: 600; font-variant-numeric: tabular-nums; }
button.activity-item {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left;
  cursor: pointer; color: var(--ink);
}
button.activity-item:hover { background: var(--row-hover); }
button.activity-item:last-child { border-bottom: 0; }

/* ---------------------------------------------------------------- chart ------------------ */

.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text, .chart .ticks text { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; stroke: none; }
.chart .bar { stroke: none; transition: opacity .12s; outline: 0; }
.chart .bar.in { fill: var(--chart-in); }
.chart .bar.out { fill: var(--chart-out); }
.chart .bar:hover, .chart .bar:focus-visible { opacity: .72; }
.chart-legend { display: flex; gap: var(--sp-4); font-size: var(--fs-xs); color: var(--ink-2); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }
.chart-legend i.in { background: var(--chart-in); }
.chart-legend i.out { background: var(--chart-out); }
.chart-table { margin-top: var(--sp-3); font-size: var(--fs-xs); }
.chart-table summary { color: var(--ink-3); }
.chart-table .table-wrap { margin-top: var(--sp-2); border: 1px solid var(--line); border-radius: var(--radius); }
.chart-table table.grid thead th { position: static; }
.tip {
  position: fixed; z-index: 120; pointer-events: none; max-width: 260px;
  background: var(--ink); color: #fff; padding: 8px 10px; border-radius: 6px; font-size: var(--fs-xs);
  box-shadow: var(--shadow-lg); white-space: pre-line; line-height: 1.45;
}

/* ---------------------------------------------------------------- modal & forms ---------- */

dialog.sheet {
  border: 0; border-radius: var(--radius-lg); padding: 0; width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg); color: var(--ink); background: var(--surface);
}
dialog.sheet.wide { width: min(980px, calc(100vw - 32px)); }
dialog.sheet::backdrop { background: rgba(19, 26, 43, .5); }
dialog.sheet form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-top { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line); }
.modal-top > div { flex: 1; min-width: 0; }
.modal-top h2 { font-size: var(--fs-lg); }
.modal-top p { margin: 3px 0 0; font-size: var(--fs-xs); color: var(--ink-3); }
.modal-top .icon-btn { margin-left: auto; }
.modal-body { padding: var(--sp-5); overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap;
}
.modal-foot .btn-group-end { margin-left: auto; display: flex; gap: var(--sp-2); }

/* Fields in one row share a top edge: the grid aligns to the start, and a field never
   stretches its label row to fill the cell — that is what pushed neighbours out of line. */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-4); align-items: start; }
.field { display: grid; gap: 5px; margin-bottom: var(--sp-4); align-content: start; min-width: 0; }
.form-grid .field { margin-bottom: 0; }
.field > label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin: 0; line-height: 20px; }
.field small { font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.4; }
.money-input { position: relative; }
.money-input .prefix {
  position: absolute; left: var(--sp-3); top: 50%; transform: translateY(-50%);
  font-size: var(--fs-xs); color: var(--ink-3); pointer-events: none; font-weight: 600;
}
.money-input input { padding-left: 46px; }
.field-error { font-size: var(--fs-xs); color: var(--bad); }

.entry-summary { display: flex; flex-direction: column; gap: 1px; font-size: var(--fs-xs); color: var(--ink-3); }
.entry-summary strong { font-size: var(--fs-lg); color: var(--ink); font-variant-numeric: tabular-nums; }

.hint {
  background: var(--surface-2); border-left: 3px solid var(--line-strong); padding: var(--sp-3) var(--sp-4);
  border-radius: 0 var(--radius) var(--radius) 0; font-size: var(--fs-xs); color: var(--ink-2); margin-bottom: var(--sp-4);
}
.discard {
  background: var(--warn-soft); border: 1px solid rgba(178, 94, 9, .25); border-radius: var(--radius);
  padding: var(--sp-4); margin-bottom: var(--sp-4);
}
.discard strong { display: block; color: var(--warn); }
.discard p { margin: 3px 0 var(--sp-3); font-size: var(--fs-sm); }
.discard .actions { display: flex; gap: var(--sp-2); }

/* The invoice line editor: a table on wide screens, one stacked block per line on phones. */
.line-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); margin-bottom: var(--sp-3); }
.line-table th {
  text-align: left; font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); padding: 0 var(--sp-2) 6px; font-weight: 650;
}
.line-table td { padding: 4px var(--sp-2); vertical-align: top; }
.line-table .form-control, .line-table .form-select { height: 36px; }
.line-total { text-align: right; font-variant-numeric: tabular-nums; padding-top: 12px !important; white-space: nowrap; }
.line-table th:nth-child(1), .line-table td:nth-child(1) { width: 42%; }
.line-table th:nth-child(2), .line-table td:nth-child(2) { width: 15%; }
.line-table th:nth-child(3), .line-table td:nth-child(3) { width: 23%; }

.alloc-row { display: flex; align-items: center; gap: var(--sp-3); padding: 9px 0; border-bottom: 1px solid var(--line); }
.alloc-row .what { flex: 1; min-width: 0; }
.alloc-row strong { display: block; font-size: var(--fs-sm); }
.alloc-row small { display: block; color: var(--ink-3); font-size: var(--fs-xs); }
.alloc-row input { width: 140px; flex: none; }

/* ---------------------------------------------------------------- toast, menus, tabbar --- */

.link-cell { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-align: left; }
.link-cell:hover { text-decoration: underline; }

/* Toasts stack upward from the bottom. Each one names what was recorded and carries its own
   way out — a link to the record, or the reversal — so a confirmation is never a dead end.
   On a phone they sit above the tab bar, where the thumb already is. */
.toast-stack {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  display: flex; flex-direction: column-reverse; align-items: stretch; gap: var(--sp-2);
  width: min(560px, 92vw); pointer-events: none;
}
.toast-note {
  display: flex; align-items: center; gap: var(--sp-3); pointer-events: auto;
  background: var(--ink); color: var(--bg); padding: 11px 14px 11px 18px;
  border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: var(--fs-sm);
  animation: toast-in var(--dur-slow) var(--ease);
}
.toast-note .toast-text { flex: 1; min-width: 0; }
.toast-note .toast-text strong { display: block; font-weight: 600; }
.toast-note .toast-text small { opacity: .8; font-size: var(--fs-xs); }
.toast-note .toast-do {
  flex: none; border: 1px solid currentColor; background: none; color: inherit;
  border-radius: var(--radius); padding: 6px 12px; font-size: var(--fs-xs); font-weight: 600;
  cursor: pointer; min-height: 32px;
}
.toast-note .toast-do:hover { background: rgba(127, 127, 127, .25); }
.toast-note .toast-shut {
  flex: none; border: 0; background: none; color: inherit; opacity: .7;
  cursor: pointer; padding: 4px; border-radius: var(--radius); line-height: 0;
}
.toast-note .toast-shut:hover { opacity: 1; }
.toast-note.bad { background: var(--bad); color: #fff; }
.toast-note.good { background: var(--good); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 767.98px) { .toast-stack { bottom: calc(68px + env(safe-area-inset-bottom)); } }

/* ---------------------------------------------------------------- skeletons --------------
   A wait longer than a blink shows the shape of what is coming, not a spinner in a void.
   The shimmer is the one looping animation in the app and it stops dead under
   prefers-reduced-motion, where the resting tone alone carries the meaning. */

.sk { background: var(--skeleton); border-radius: 6px; position: relative; overflow: hidden; }
.sk::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(127, 127, 127, .18), transparent);
  animation: sk-sweep 1.3s infinite;
}
@keyframes sk-sweep { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .sk::after { display: none; } }

.sk-line { height: 12px; margin: 9px 0; }
.sk-row { display: flex; align-items: center; gap: var(--sp-4); padding: 0 var(--sp-4);
          height: var(--row-h); border-bottom: 1px solid var(--line); }
.sk-row > .sk { height: 12px; flex: 1; }
.sk-row > .sk.narrow { flex: 0 0 72px; }
.sk-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.sk-metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-4); }
.sk-metric .sk:first-child { height: 10px; width: 55%; }
.sk-metric .sk:last-child { height: 22px; width: 78%; margin-top: var(--sp-3); }
@media (max-width: 1199.98px) { .sk-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639.98px) { .sk-metrics { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- field errors -----------
   A validation message belongs beside the field it is about, not in a browser bubble that
   vanishes. Colour is never the only signal: the message is a sentence. */

.field.invalid .form-control, .field.invalid .form-select,
td.invalid .form-control, td.invalid .form-select { border-color: var(--bad); }
.field.invalid .form-control:focus, .field.invalid .form-select:focus,
td.invalid .form-control:focus, td.invalid .form-select:focus { box-shadow: 0 0 0 3px var(--bad-soft); }
.field-error {
  display: flex; align-items: flex-start; gap: 6px; margin-top: 5px;
  color: var(--bad); font-size: var(--fs-xs); font-weight: 500;
}
.field-error svg { flex: none; margin-top: 1px; }

/* The spelled-out echo under a large figure: a sanity check before the money moves. */
.money-echo { display: block; margin-top: 5px; color: var(--ink-2); font-size: var(--fs-xs); }
.money-echo strong { color: var(--ink); font-weight: 600; }

/* The first-run explainer: four numbered steps, the shape of the whole app in one panel. */
.first-run { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-4); }
.first-run li { display: flex; align-items: flex-start; gap: var(--sp-3); }
.first-run .marker {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 700;
}
.first-run .what { min-width: 0; }
.first-run strong { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.first-run strong svg { color: var(--ink-3); }
.first-run small { display: block; color: var(--ink-2); margin-top: 2px; }

/* One-tap fills sit with the field's hint, under the input they fill. */
.fill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fill-row .btn { min-height: 30px; }
@media (pointer: coarse) { .fill-row .btn { min-height: 36px; } }

.menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 232px; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: var(--sp-2);
}
.menu button, .menu a {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; border: 0; background: none;
  padding: 8px var(--sp-3); border-radius: var(--radius); font-size: var(--fs-sm); color: var(--ink);
  text-align: left; cursor: pointer; text-decoration: none;
}
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu button:disabled { opacity: .5; cursor: not-allowed; }
.menu hr { margin: var(--sp-2) 0; }
.menu-wrap { position: relative; }

.shortcut-grid { display: grid; grid-template-columns: 1fr auto; gap: 9px var(--sp-4); align-items: center; font-size: var(--fs-sm); }
.shortcut-grid kbd {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px;
  padding: 2px 7px; font-size: var(--fs-xs); font-family: var(--font); color: var(--ink-2);
}

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 35; background: var(--surface);
  border-top: 1px solid var(--line); display: flex; padding: 6px 4px env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; border: 0; background: none; display: grid; justify-items: center; gap: 2px;
  padding: 6px 2px; font-size: 10px; color: var(--ink-3); cursor: pointer;
}
.tabbar button[aria-current="page"] { color: var(--accent); font-weight: 650; }

/* ---------------------------------------------------------------- utilities --------------
   The Content-Security-Policy forbids inline style attributes, so anything that would have
   been a one-off `style="…"` lives here instead. Keep this list short and generic. */

.note-text { font-size: var(--fs-sm); color: var(--ink-2); margin: 0 0 var(--sp-4); }
.note-text:last-child { margin-bottom: 0; }
.note-good { font-size: var(--fs-sm); color: var(--good); margin: 0; display: flex; align-items: center; gap: var(--sp-2); }
.muted-line { font-size: var(--fs-sm); color: var(--ink-3); margin: 0; }
.sub-head { font-size: var(--fs-sm); margin: var(--sp-5) 0 var(--sp-2); }
.sub-head.tight { margin: var(--sp-4) 0 var(--sp-2); }
.field.flush { margin: 0; }
.field.spaced { margin-top: var(--sp-4); }
.gap-above { margin-top: var(--sp-4); }
.gap-below { margin-bottom: var(--sp-4); }
.bare-row { border: 0; padding: 0 0 6px; }
.tiny-foot { margin-top: 6px; }
.panel-head.inline { padding: var(--sp-4) 0 var(--sp-2); border: 0; }
.panel-head.inline h2 { font-size: var(--fs-sm); }
.file-size { color: var(--ink-3); }

/* ---------------------------------------------------------------- records ----------------
   Expandable rows, the movement sub-ledgers they unfold into, and the transaction viewer. */

.expander {
  width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
  color: var(--ink-3); display: inline-grid; place-items: center; cursor: pointer; padding: 0;
}
.expander:hover { color: var(--ink); border-color: var(--line-strong); }
.expander svg { transition: transform .15s ease; }
.expander[aria-expanded="true"] { background: var(--accent); color: #fff; border-color: transparent; }
.expander[aria-expanded="true"] svg { transform: rotate(90deg); }
table.grid th.expand-cell, table.grid td.expand-cell { width: 42px; padding-right: 0; }

table.grid tbody tr.sub-row > td {
  background: var(--surface-2); height: auto; padding: var(--sp-3) var(--sp-4) var(--sp-4) 58px;
}
table.grid tbody tr.sub-row:hover { background: transparent; }
.sub-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sub-title {
  display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4);
  font-size: 11px; font-weight: 650; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--line);
}
.sub-block table.grid thead th { position: static; }
.sub-block table.grid tbody tr:last-child td { border-bottom: 0; }
.sub-note { margin: 0; padding: var(--sp-3) var(--sp-4); font-size: var(--fs-xs); color: var(--ink-2); border-top: 1px solid var(--line); }
.sub-actions { display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
table.grid tbody tr.current td { background: var(--accent-soft); }

.rec-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-2); }
.rec-amount { margin-left: auto; font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.rec-summary { margin: 0 0 var(--sp-4); color: var(--ink-2); font-size: var(--fs-sm); }
.rec-section { margin-top: var(--sp-5); }
.rec-section > h3 {
  display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2);
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3);
}
.rec-section > h3 .btn { margin-left: auto; }
.rec-section .table-wrap { border: 1px solid var(--line); border-radius: var(--radius); }
.rec-section table.grid thead th { position: static; }
.kv-value .link-cell { font-weight: 600; }

.rev { padding: var(--sp-3) 0; border-bottom: 1px dashed var(--line); }
.rev:last-child { border-bottom: 0; }
.rev strong { display: block; font-size: var(--fs-sm); }
.rev small { color: var(--ink-3); font-size: var(--fs-xs); }
.diff { list-style: none; padding: 0; margin: var(--sp-2) 0 0; display: grid; gap: 4px; font-size: var(--fs-xs); }
.diff li { display: flex; gap: var(--sp-2); align-items: baseline; flex-wrap: wrap; }
.diff li span { color: var(--ink-3); min-width: 110px; }
.diff li s { color: var(--bad); }
.diff li b { color: var(--good); font-weight: 600; }

.doc-list { display: grid; gap: 6px; }
.doc-list a {
  display: flex; align-items: center; gap: var(--sp-2); padding: 8px var(--sp-3);
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); font-size: var(--fs-sm); text-decoration: none;
}
.doc-list a:hover { background: var(--surface-2); }
.doc-list a small { margin-left: auto; color: var(--ink-3); font-size: var(--fs-xs); }

/* ---------------------------------------------------------------- responsive -------------
   Breakpoints: 1200 (full sidebar, four cards, three-up panels), 992 (sidebar becomes a
   drawer), 900 (tables become cards), 768 (phone chrome), 640 (single-column forms). */

@media (min-width: 900px) {
  /* A wide table scrolls inside its panel; these shadows say so at the edges. */
  .table-wrap {
    background:
      linear-gradient(to right, var(--surface) 30%, rgba(255, 255, 255, 0)) 0 0,
      linear-gradient(to right, rgba(255, 255, 255, 0), var(--surface) 70%) 100% 0,
      radial-gradient(farthest-side at 0 50%, rgba(19, 26, 43, .14), transparent) 0 0,
      radial-gradient(farthest-side at 100% 50%, rgba(19, 26, 43, .14), transparent) 100% 0;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
  }
}

@media (min-width: 992px) { .only-narrow { display: none !important; } }
@media (max-width: 767.98px) { .only-wide { display: none !important; } }

/* Between 992 and 1199 the sidebar keeps its place but shrinks to icons, so tables and
   panels get the width they need. */
@media (min-width: 992px) and (max-width: 1199.98px) {
  :root { --sidebar-w: 72px; }
  .sidebar-brand { justify-content: center; padding: 18px 0 var(--sp-4); }
  .sidebar-brand > div, .nav-group, .nav-label, .who-name { display: none; }
  .sidebar-nav { padding: var(--sp-3) 10px 0; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .nav-count { position: absolute; top: 3px; right: 6px; font-size: 10px; padding: 0 5px; line-height: 16px; }
  .who { justify-content: center; padding: var(--sp-2) 0; }
  .who .btn { display: none; }
  .sidebar-foot .menu-wrap { display: none; }
}

/* Below 1440 the shopkeeper rail becomes a row of pills above the invoices. Beside them, an
   eight-column table has 750px on a 1280 laptop and scrolls sideways — which a ledger must
   never do. Above them it has the full width and fits. */
@media (max-width: 1439.98px) {
  .rail { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
  .rail > .panel { position: static; }
  .rail > .panel > .panel-body { padding: var(--sp-2); }
  .rail-list { display: flex; overflow-x: auto; gap: var(--sp-2); padding-bottom: 2px; }
  .rail-item { grid-template-columns: 22px auto auto; width: auto; flex: none; padding: 7px 10px; border: 1px solid var(--line); border-radius: 99px; }
  .rail-item .who-avatar { width: 22px; height: 22px; font-size: 10px; }
}

@media (max-width: 1199.98px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .split.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split.three > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 1099.98px) {
  /* The aging strip becomes a list: five tiles never divide cleanly below this width. */
  .aging { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px var(--sp-4); }
  .aging div { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); border: 0; border-radius: 0; padding: 8px 0; border-bottom: 1px dashed var(--line); background: none; }
  .aging div:last-child { border-bottom: 0; }
  .aging span, .aging strong { display: inline; }
  .aging strong { font-size: var(--fs-md); }
}

@media (max-width: 999.98px) {
  .strip { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
}

@media (max-width: 991.98px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 45;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .app.nav-open .sidebar { transform: none; }
  .topbar { padding: 0 var(--sp-4); }
  .topbar-search { width: auto; flex: 1; }
  .topbar-search kbd { display: none; }
  .summary-bar { position: static; }
}

@media (max-width: 899.98px) {
  /* `.split.three` is more specific than `.split`, so the two-column rule from the wider
     breakpoint would otherwise win here and squash three panels into two on a phone. */
  .split, .split.three { grid-template-columns: minmax(0, 1fr); }
  .split.three > :last-child { grid-column: auto; }

  /* Tables become cards: each row is a labelled block, so nothing scrolls sideways. */
  .table-wrap.cards table.grid, .table-wrap.cards thead, .table-wrap.cards tbody,
  .table-wrap.cards tr, .table-wrap.cards td { display: block; width: 100%; }
  .table-wrap.cards thead, .table-wrap.cards tfoot { display: none; }
  .table-wrap.cards tr {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
    margin-bottom: var(--sp-3); padding: 6px 16px 10px;
  }
  /* Each cell is a label on the left and its value on the right, like a receipt — so the
     figures line up down the card's edge instead of drifting under labels of uneven length. */
  .table-wrap.cards td { height: auto !important; border: 0; padding: 7px 0;
                         display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4);
                         text-align: left !important; white-space: normal !important;
                         border-bottom: 1px solid var(--line); }
  .table-wrap.cards td:last-child { border-bottom: 0; }
  .table-wrap.cards td::before {
    content: attr(data-label); flex: 1; color: var(--ink-3);
    font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
  }
  /* The value keeps its own block context, so <strong> over <small> still stacks. */
  .table-wrap.cards td > .cell { flex: none; max-width: 62%; min-width: 0; text-align: right; }
  /* The first cell is the card's title: no label, a little larger, the full width. */
  .table-wrap.cards td:first-child { padding: 8px 0 10px; }
  .table-wrap.cards td:first-child::before { display: none; }
  .table-wrap.cards td:first-child > .cell { flex: 1; max-width: none; text-align: left; font-size: var(--fs-md); }
  /* The one figure a card is really about. Columns opt in with cls: 'card-primary'. */
  .table-wrap.cards td.card-primary > .cell { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.02em; }
  .table-wrap.cards td.card-primary::before { color: var(--ink-2); }
  .table-wrap.cards td:has(> .cell:empty) { display: none; }
  /* A cell whose only content is a dash says nothing on a card; drop it to keep cards short. */
  .table-wrap.cards td:has(> .cell > .zero:only-child) { display: none; }
  .table-wrap.cards td small { max-width: none; white-space: normal; }
  .table-wrap.cards .row-actions { justify-content: flex-end; flex-wrap: wrap; }
  .table-wrap.cards td:has(> .cell > progress) > .cell { text-align: left; max-width: 58%; }
  .table-wrap.cards progress.mini { margin-top: 6px; }
  .table-wrap.cards td.expand-cell { display: none; }
  .table-wrap.cards tr.sub-row { padding: 0; border: 0; background: none; }
  .table-wrap.cards tr.sub-row > td { padding: 0 0 var(--sp-3); background: none; }
  .table-wrap.cards tr.sub-row > td::before { display: none; }
  .sub-block table.grid { font-size: var(--fs-xs); }
  /* Columns hidden by width come back as card rows (revert would restore table-cell). */
  .table-wrap.cards td.col-lg, .table-wrap.cards td.col-md { display: flex; }
}

@media (max-width: 767.98px) {
  .page { padding: var(--sp-4); padding-bottom: 84px; }
  .page-head { align-items: flex-start; }
  .topbar-search input { padding-right: var(--sp-3); }
  dialog.sheet, dialog.sheet.wide {
    width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; margin: 0;
  }
  /* dvh accounts for the phone's collapsing address bar; vh above is the fallback. */
  dialog.sheet, dialog.sheet.wide { height: 100dvh; max-height: 100dvh; }

  /* The form must FILL the sheet, not just sit at the top of it. Without an explicit height
     a short form leaves its buttons stranded mid-screen above a blank expanse; with it, the
     body takes the slack and the actions sit at the bottom, under the thumb. */
  dialog.sheet form { max-height: 100dvh; height: 100%; }
  .modal-body, .modal-top, .modal-foot { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .metric-value { font-size: var(--fs-xl); }
  .strip-amount { font-size: var(--fs-2xl); }
  .rec-amount { margin-left: 0; width: 100%; }
  .activity-item { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .panel-head, .panel-body { padding-left: var(--sp-4); padding-right: var(--sp-4); }
}

@media (max-width: 639.98px) {
  .metrics { grid-template-columns: minmax(0, 1fr); }
  .metric { border-left: 0; }
  .metric:nth-child(n+2) { border-top: 1px solid var(--line); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }

  /* One invoice line becomes a block: the item across the top, then quantity, price and total. */
  .line-table thead { display: none; }
  .line-table, .line-table tbody { display: block; }
  .line-table tr.line { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2) var(--sp-3);
                        padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
  .line-table td { display: block; padding: 0; width: auto !important; }
  .line-table td:first-child { grid-column: 1 / -1; }
  .line-table td:last-child { grid-column: 1 / -1; text-align: right; }
  .line-table td[data-label]::before { content: attr(data-label); display: block; font-size: 10px; letter-spacing: .07em;
                                       text-transform: uppercase; color: var(--ink-3); font-weight: 650; margin-bottom: 4px; }
  .line-table .line-total { padding-top: 0 !important; text-align: left; font-size: var(--fs-md); line-height: 36px; }
  .line-table td:last-child.line-total { line-height: 1; }
  .alloc-row { flex-wrap: wrap; }
  .alloc-row input { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------------------------------------------------------------- print ------------------ */

@media print {
  .sidebar, .topbar, .tabbar, .no-print, .skip-link, .sidebar-scrim, .tip { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  .page { max-width: none; padding: 0; }
  .panel { break-inside: avoid; box-shadow: none; border-color: #999; margin-bottom: 14px; }
  .summary-bar { position: static; box-shadow: none; }
  table.grid { font-size: 10px; }
  table.grid thead th { position: static; background: #eee; color: #000; }
  table.grid tbody td { height: auto; padding: 4px 6px; border-bottom: 1px solid #ccc; }
  table.grid td small { max-width: none; }
  .metric { break-inside: avoid; border: 1px solid #999; }
  .tabs { display: none; }
  .print-all [role="tabpanel"] { display: block !important; }
}
