/* =============================================================================
   Trove Tools — Components  v2.1.0-preview
   v2.1.0: Nav drawer (one menu for every app; pairs with trove-drawer.js)
   Requires tokens.css. Tokens only: no raw hex values in this file.
   ========================================================================== */

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

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

/* The hidden attribute always wins, even over components that set display. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-body)/var(--lh-body) var(--font-body);
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 {
  margin: 0 0 var(--sp-3);
  color: var(--head);
  font-family: var(--font-display);
  text-wrap: balance;
  line-height: 1.25;
}
h1 { font-size: var(--fs-h1); font-weight: 700; }
h2 { font-size: var(--fs-h2); font-weight: 700; }
h3 { font-size: var(--fs-h3); font-weight: 600; }

p { margin: 0 0 var(--sp-4); }

a { color: var(--gold-ink); text-underline-offset: 2px; }

.eyebrow {
  display: block;
  margin-bottom: var(--sp-2);
  color: var(--gold-ink);
  font: 600 var(--fs-eyebrow)/1.3 var(--font-display);
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
}

.label {
  color: var(--muted);
  font: 600 var(--fs-label)/1.3 var(--font-display);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.sub  { color: var(--muted); font-size: var(--fs-sub); }
.hint { color: var(--muted); font-size: var(--fs-hint); }
.num  { font-variant-numeric: tabular-nums; }

/* Focus: one rule for every interactive element. */
:where(a, button, input, select, textarea, summary, [tabindex], .tab, .btn, .seg-btn):focus-visible {
  outline: var(--bw-rule) solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: var(--focus-halo);
}

/* ---- Layout -------------------------------------------------------------- */
.wrap {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
}

.section { margin-block: var(--gap-section); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-5); flex-wrap: wrap; margin-bottom: var(--sp-5);
}

.grid   { display: grid; gap: var(--gap-grid); }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split  { display: grid; gap: var(--gap-section); grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.split > * { min-width: 0; }

.stack   > * + * { margin-top: var(--sp-4); }
.row     { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }

/* ---- Top bar + tabs ------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: var(--z-bar);
  background: var(--navy);
  color: var(--on-navy);
  border-bottom: var(--bw-rule) solid var(--gold);
  --focus-halo: none;   /* already on navy: the gold ring alone passes */
}
.topbar-inner {
  display: flex; align-items: center; gap: var(--sp-8);
  min-height: 56px;
  max-width: var(--content-max); margin-inline: auto;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
}
.wordmark { display: flex; flex-direction: column; line-height: 1; text-decoration: none; color: inherit; }
/* Brand lockup: the Trove mark (crown T) beside the wordmark. The mark image
   carries its own navy ground, so it reads on navy bars and light pages alike. */
.brand-lockup { display: flex; align-items: center; gap: var(--sp-4); text-decoration: none; color: inherit; flex: none; }
.brand-mark { display: block; width: 34px; height: 34px; border-radius: var(--r-btn); }
.wordmark-name {
  font: 500 20px/1 var(--font-display);
  letter-spacing: var(--track-wordmark);
  color: var(--pearl);
}
.wordmark-tag {
  margin-top: 4px;
  font: 600 var(--fs-tagline)/1 var(--font-display);
  letter-spacing: var(--track-tagline);
  text-transform: uppercase;
  color: var(--gold);
}
.tabs { display: flex; gap: var(--sp-1); flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tab {
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-tab) var(--r-tab) 0 0;
  border: 0; background: transparent;
  color: var(--pearl); opacity: .78;
  font: 600 var(--fs-tab)/1.2 var(--font-display);
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
.tab:hover { opacity: 1; }
.tab.is-active, .tab[aria-current="page"], .tab[aria-selected="true"] {
  opacity: 1;
  background: var(--navy-2);
  box-shadow: inset 0 calc(-1 * var(--bw-rule)) 0 var(--gold);
}
.topbar-user { display: flex; align-items: center; gap: var(--sp-4); margin-left: auto; flex: none; }
.avatar {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy-3); color: var(--gold-2);
  border: 1px solid var(--gold);
  font: 600 12px/1 var(--font-display);
}
.sync-pill {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 3px var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--navy-2); color: var(--pearl);
  border: 1px solid var(--navy-3);
  font: 600 var(--fs-label)/1.4 var(--font-display);
  letter-spacing: var(--track-label); text-transform: uppercase;
}
.sync-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }

/* ---- Nav drawer ----------------------------------------------------------
   One menu for every app, on every screen size (NAV_DRAWER_BUILD_PLAN.md).
   The top bar holds only the brand lockup, an optional status chip, and the
   menu button. trove-drawer.js renders the drawer; write the markup by hand
   only where that script can't run (React: same classes).

   <header class="topbar"><div class="topbar-inner">
     <a class="brand-lockup" id="home-link" ...>...</a>
     <div class="topbar-end">
       <span class="chip">optional status</span>
       <button class="menu-toggle" aria-label="Menu" aria-expanded="false"
               aria-controls="trove-drawer"><span class="menu-bars"></span></button>
     </div>
   </div></header>
   ------------------------------------------------------------------------- */
.topbar-end { display: flex; align-items: center; gap: var(--sp-4); margin-left: auto; flex: none; }
.menu-toggle {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  border-radius: var(--r-btn);
  border: 1px solid var(--navy-3);
  background: var(--navy-2); color: var(--pearl);
  cursor: pointer;
}
.menu-toggle:hover, .menu-toggle[aria-expanded="true"] { border-color: var(--gold); }
.menu-bars, .menu-bars::before, .menu-bars::after {
  display: block; width: 18px; height: 2px; border-radius: 1px;
  background: currentColor;
}
.menu-bars { position: relative; }
.menu-bars::before, .menu-bars::after { content: ""; position: absolute; left: 0; }
.menu-bars::before { top: -6px; }
.menu-bars::after  { top: 6px; }

html.drawer-open { overflow: hidden; }
.drawer-scrim {
  position: fixed; inset: 0; z-index: var(--z-drawer);
  background: var(--scrim);
  opacity: 0; visibility: hidden;
}
.drawer-scrim.is-open { opacity: 1; visibility: visible; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: calc(var(--z-drawer) + 1);
  width: var(--drawer-w);
  display: flex; flex-direction: column;
  background: var(--card); color: var(--ink);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-drawer);
  transform: translateX(100%); visibility: hidden;
}
.drawer.is-open { transform: none; visibility: visible; }

.drawer-head {
  display: flex; align-items: center; gap: var(--sp-5);
  padding: var(--sp-7) var(--sp-7) var(--sp-6);
  padding-top: max(var(--sp-7), env(safe-area-inset-top));
  background: var(--navy); color: var(--on-navy);
  border-bottom: var(--bw-rule) solid var(--gold);
  --focus-halo: none;
}
.drawer-av {
  display: inline-grid; place-items: center; flex: none; overflow: hidden;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--navy-3); color: var(--gold-2);
  border: 1px solid var(--gold);
  font: 600 14px/1 var(--font-display);
}
.drawer-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.drawer-id { min-width: 0; flex: 1 1 auto; }
.drawer-name {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--pearl); font: 600 14.5px/1.3 var(--font-display);
}
.drawer-role {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 2px; color: var(--gold-2); font-size: var(--fs-hint);
}
.drawer-close {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: var(--r-btn);
  border: 1px solid var(--navy-3); background: transparent; color: var(--pearl);
  font: 400 20px/1 var(--font-body); cursor: pointer;
}
.drawer-close:hover { border-color: var(--gold); }

.drawer-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: var(--sp-3) 0; }
.drawer-label {
  display: block;
  padding: var(--sp-6) var(--sp-7) var(--sp-2);
  color: var(--muted);
  font: 600 var(--fs-label)/1.3 var(--font-display);
  letter-spacing: var(--track-label); text-transform: uppercase;
}
.drawer-nav { display: flex; flex-direction: column; }
/* Rows: links and buttons look the same. */
.drawer-row {
  display: flex; align-items: center; gap: var(--sp-5);
  width: 100%; min-height: 44px;
  padding: var(--sp-3) var(--sp-7);
  border: 0; background: transparent; color: var(--ink);
  font: 500 14px/1.3 var(--font-body); text-align: left;
  text-decoration: none; cursor: pointer;
}
.drawer-row:hover { background: var(--line-2); }
.drawer-row[aria-current="page"] {
  background: var(--select-bg); color: var(--head); font-weight: 600;
  box-shadow: inset var(--bw-tile) 0 0 var(--gold);
}
.drawer-ico {
  display: inline-grid; place-items: center; flex: none;
  width: 20px; height: 20px; color: var(--muted); font-size: 16px; line-height: 1;
}
.drawer-row[aria-current="page"] .drawer-ico { color: var(--gold-ink); }
.drawer-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drawer-slot { padding: var(--sp-3) var(--sp-7); }
.drawer-slot:empty { display: none; }

.drawer-foot {
  flex: none;
  padding: var(--sp-3) 0 max(var(--sp-5), var(--safe-b));
  border-top: 1px solid var(--line);
}
.drawer-theme { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-4) var(--sp-7); }
.drawer-theme .seg { flex-wrap: nowrap; }
.drawer-row.is-signout { color: var(--red); }
.drawer-row.is-signout .drawer-ico { color: var(--red); }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 36px;
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--r-btn);
  border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
  font: 600 13px/1.2 var(--font-display);
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--gold); }
.btn-primary { background: var(--primary-bg); color: var(--primary-fg); border-color: var(--primary-bg); }
.btn-gold    { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.btn-primary:hover, .btn-gold:hover { border-color: var(--gold-2); }
.btn-sm { min-height: 28px; padding: var(--sp-1) var(--sp-4); font-size: 12px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; border-color: var(--line); }
.btn.is-added { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.btn.is-added::before { content: "✓"; }

/* ---- Chips --------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 2px var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--line-2); color: var(--ink);
  border: 1px solid transparent;
  font: 600 11px/1.5 var(--font-display);
  white-space: nowrap;
}
.chip-now   { background: var(--red-bg);   color: var(--red); }
.chip-watch { background: var(--amber-bg); color: var(--amber); }
.chip-info  { background: var(--blue-bg);  color: var(--blue); }
.chip-ok    { background: var(--green-bg); color: var(--green); }
.chip-source  { background: transparent; color: var(--muted); border-color: var(--line); }
.chip-example { background: transparent; color: var(--gold-ink); border: 1px dashed var(--gold); font-style: italic; }

/* ---- Cards --------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--pad-card);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.card-head h3 { margin: 0; }

/* Project card: 4px status rail on the left. */
.project { border-left: var(--bw-status) solid var(--blue); }
.project.is-stuck   { border-left-color: var(--red); }
.project.is-waiting { border-left-color: var(--amber); }
.project.is-done    { border-left-color: var(--green); opacity: .8; }
.project-meta { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; margin-top: var(--sp-3); }

/* Talking-point row: rank | body | money */
.tp-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: var(--sp-5); align-items: start;
  padding: var(--sp-5) 0;
  border-top: 1px solid var(--line-2);
}
.tp-row:first-child { border-top: 0; }
.tp-rank {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--line-2); color: var(--head);
  font: 700 12px/1 var(--font-display);
}
.tp-body strong { color: var(--head); font-weight: 600; }
.tp-money { text-align: right; font: 700 15px/1.3 var(--font-display); color: var(--head); white-space: nowrap; }
.tp-money small { display: block; color: var(--muted); font: 500 var(--fs-hint) var(--font-body); }

/* ---- Stat tiles + metric pills ------------------------------------------ */
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: var(--bw-tile) solid var(--gold);
  border-radius: var(--r-tile);
  padding: var(--sp-5) var(--sp-6);
  box-shadow: var(--shadow);
}
.stat-label { color: var(--muted); font: 600 var(--fs-label)/1.3 var(--font-display); letter-spacing: var(--track-label); text-transform: uppercase; }
.stat-value { margin-top: var(--sp-2); color: var(--head); font: 700 var(--fs-stat)/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.stat-note  { margin-top: var(--sp-1); color: var(--muted); font-size: var(--fs-hint); }
.stat-big .stat-value { font-size: var(--fs-stat-big); }
.stat-good { border-top-color: var(--green); }
.stat-bad  { border-top-color: var(--red); }

.metric {
  display: inline-flex; align-items: baseline; gap: var(--sp-2);
  padding: 3px var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--line-2);
  font-size: var(--fs-hint); color: var(--muted);
}
.metric b { color: var(--head); font: 700 13px/1 var(--font-display); }

/* ---- Forms --------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.field-label { color: var(--muted); font: 600 var(--fs-label)/1.3 var(--font-display); letter-spacing: var(--track-label); text-transform: uppercase; }
.input, .select, .textarea {
  width: 100%;
  min-height: 38px;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-btn);
  border: 1px solid var(--line);
  background: var(--input); color: var(--ink);
  font: 400 var(--fs-body)/1.4 var(--font-body);
}
.textarea { min-height: 88px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 1; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); outline: none; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: var(--bw-rule) solid var(--focus-ring); outline-offset: 2px; box-shadow: var(--focus-halo); }
.field.is-invalid .input, .field.is-invalid .select, .field.is-invalid .textarea { border-color: var(--red); }

.saved-inline { color: var(--green); font: 600 var(--fs-hint) var(--font-display); }
.saved-inline::before { content: "✓ "; }

.save-state {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 2px var(--sp-4); border-radius: var(--r-pill);
  font: 600 11px/1.5 var(--font-display);
}
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.save-state.ok   { background: var(--green-bg); color: var(--green); }
.save-state.busy { background: var(--amber-bg); color: var(--amber); }
.save-state.err  { background: var(--red-bg);   color: var(--red); }

/* ---- Filters / segmented pills ------------------------------------------ */
.seg { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.seg-btn {
  padding: 5px var(--sp-5);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
  font: 600 12px/1.3 var(--font-display);
  cursor: pointer;
}
.seg-btn:hover { border-color: var(--gold); }
.seg-btn.is-active, .seg-btn[aria-pressed="true"] { background: var(--active-bg); color: var(--active-fg); border-color: var(--active-bg); }

/* ---- Data table ---------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--card);
}
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th {
  text-align: left; white-space: nowrap;
  padding: var(--sp-4) var(--sp-5);
  background: var(--line-2);
  color: var(--muted);
  font: 600 var(--fs-label)/1.3 var(--font-display);
  letter-spacing: var(--track-label); text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
.table td { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--line-2); vertical-align: middle; }
.table tr:first-child td { border-top: 0; }
.table .r { text-align: right; }
.bar { position: relative; height: 6px; min-width: 60px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.bar > span { position: absolute; inset: 0 auto 0 0; background: var(--bar-fill); border-radius: 3px; }
.pos  { color: var(--green); font-weight: 600; }
.neg  { color: var(--red);   font-weight: 600; }
.flag { color: var(--amber); font-weight: 600; }

/* ---- Meter + sparkline --------------------------------------------------- */
.meter { position: relative; height: 10px; border-radius: 5px; background: var(--line-2); }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--bar-fill); }
.meter-target { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--head); border-radius: 1px; }
.meter-legend { display: flex; justify-content: space-between; margin-top: var(--sp-2); color: var(--muted); font-size: var(--fs-hint); }

.spark { position: relative; display: inline-block; line-height: 0; }
.spark svg { display: block; overflow: visible; }
.spark-line { fill: none; stroke: var(--bar-fill); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark-area { fill: var(--bar-fill); opacity: .12; }
.spark-dot  { fill: var(--card); stroke: var(--bar-fill); stroke-width: 2; }
.spark-tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  z-index: var(--z-pop);
  padding: var(--sp-2) var(--sp-4);
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-tile);
  box-shadow: var(--shadow-pop);
  line-height: 1.3; white-space: nowrap; font-size: var(--fs-hint);
  pointer-events: none;
}
.spark-tip b { display: block; color: var(--head); font: 700 15px/1.2 var(--font-display); }
.spark-tip[hidden] { display: none; }

/* ---- Disclosure ---------------------------------------------------------- */
details.disclose {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}
details.disclose > summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-5) var(--pad-card);
  list-style: none; cursor: pointer;
  color: var(--head); font: 600 var(--fs-h3)/1.3 var(--font-display);
  border-radius: var(--r-card);
}
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::after { content: "▾"; color: var(--gold); font-size: 14px; }
details.disclose[open] > summary::after { content: "▴"; }
details.disclose[open] > summary { border-bottom: 1px solid var(--line-2); border-radius: var(--r-card) var(--r-card) 0 0; }
details.disclose > .disclose-body { padding: var(--sp-5) var(--pad-card) var(--pad-card); }

.more-toggle {
  border: 0; background: none; padding: var(--sp-1) 0; cursor: pointer;
  color: var(--gold-ink); font: 600 12px/1.3 var(--font-display);
}
.more-toggle::after { content: " ▾"; color: var(--gold); }
.more-toggle[aria-expanded="true"]::after { content: " ▴"; }

/* ---- Checklist rows ------------------------------------------------------ */
.check-row {
  display: flex; align-items: flex-start; gap: var(--sp-5);
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--line-2);
}
.check-row:first-child { border-top: 0; }
.check-row input[type="checkbox"] {
  flex: none; width: 20px; height: 20px; margin: 1px 0 0;
  accent-color: var(--gold); cursor: pointer;
}
.check-row .check-text { flex: 1 1 auto; min-width: 0; }
.check-row .check-meta { color: var(--muted); font-size: var(--fs-hint); }
.check-row.is-done .check-text,
.check-row:has(input:checked) .check-text { color: var(--muted); text-decoration: line-through; }

/* ---- Step indicator + flow bar ------------------------------------------ */
.steps { display: flex; flex-wrap: wrap; gap: var(--sp-3); list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step {
  counter-increment: step;
  display: inline-flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-1) var(--sp-5) var(--sp-1) var(--sp-1);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--card); color: var(--muted);
  font: 600 12px/1.3 var(--font-display);
}
.step::before {
  content: counter(step);
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--line-2); color: var(--head); font-weight: 700;
}
.step.is-done { color: var(--green); border-color: var(--green); background: var(--green-bg); }
.step.is-done::before { content: "✓"; background: var(--green); color: var(--card); }
.step.is-current { background: var(--navy); color: var(--pearl); border-color: var(--gold); }
.step.is-current::before { background: var(--gold); color: var(--navy); }

.flow { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line-2); gap: 2px; }
.flow > span { flex: 1 1 0; background: var(--line); }
.flow > span.is-done    { background: var(--green); }
.flow > span.is-current { background: var(--gold); }

/* ---- Timeline ------------------------------------------------------------ */
.timeline { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 0 var(--sp-7); }
.tl-week {
  position: sticky; top: 72px; align-self: start;
  padding-top: var(--sp-3);
  color: var(--gold-ink); font: 600 var(--fs-eyebrow)/1.3 var(--font-display);
  letter-spacing: var(--track-label); text-transform: uppercase;
}
.tl-items { border-left: var(--bw-rule) solid var(--gold); padding: var(--sp-2) 0 var(--sp-8) var(--sp-7); min-width: 0; }
.tl-item { position: relative; padding: var(--sp-3) 0; }
.tl-item::before {
  content: ""; position: absolute; left: calc(-1 * var(--sp-7) - 6px); top: 14px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--card); border: var(--bw-rule) solid var(--gold);
}
.tl-item h4 { margin: 0; color: var(--head); font: 600 var(--fs-h3)/1.3 var(--font-display); }

/* ---- Tool tiles (portal home) -------------------------------------------- */
.tool-grid { display: grid; gap: var(--gap-grid); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tool-grid > * { min-width: 0; }
.tool-tile {
  position: relative;
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--sp-5); align-items: start;
  padding: var(--sp-6);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
  box-shadow: var(--shadow);
  color: inherit; text-decoration: none;
  -webkit-touch-callout: none;
}
.tool-tile:hover { border-color: var(--gold); }
.tool-icon {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--r-tile); background: var(--line-2);
  font-size: 20px; line-height: 1;
}
.tool-name { display: block; color: var(--head); font: 600 var(--fs-h3)/1.3 var(--font-display); padding-right: var(--sp-8); }
.tool-desc { display: block; margin-top: 2px; color: var(--muted); font-size: var(--fs-hint); line-height: 1.4; }
.tool-tile .chip { margin-top: var(--sp-3); }
.tool-pin { position: absolute; top: var(--sp-4); right: var(--sp-4); color: var(--gold); font-size: 13px; line-height: 1; }
.tool-tile.is-locked { border-style: dashed; box-shadow: none; cursor: default; }
.tool-tile.is-locked:hover { border-color: var(--line); }
.tool-tile.is-locked .tool-icon { opacity: .55; }
.tool-tile.is-locked .tool-name { color: var(--muted); }

/* ---- Feedback ------------------------------------------------------------ */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--sp-7) + var(--safe-b));
  z-index: var(--z-toast);
  max-width: min(92vw, 480px);
  padding: var(--sp-4) var(--sp-7);
  border-radius: var(--r-card);
  background: var(--toast-bg); color: var(--toast-fg);
  border: 1px solid var(--gold);
  box-shadow: var(--shadow-pop);
  font: 500 13.5px/1.4 var(--font-body);
}
.toast.is-inline { position: static; transform: none; display: inline-block; }

.empty {
  padding: var(--sp-9) var(--sp-7);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--r-card);
  color: var(--muted);
}
.empty h3 { color: var(--head); margin-bottom: var(--sp-2); }

.status-err  { color: var(--red);   font-weight: 600; font-size: var(--fs-hint); }
.status-good { color: var(--green); font-weight: 600; font-size: var(--fs-hint); }

/* ---- Callouts ------------------------------------------------------------ */
.recap {
  padding: var(--sp-5) var(--sp-7);
  border-left: var(--bw-tile) solid var(--gold);
  border-radius: 0 var(--r-tile) var(--r-tile) 0;
  background: var(--card);
  box-shadow: var(--shadow);
}
.pending {
  padding: var(--sp-5) var(--sp-7);
  border: 1px dashed var(--gold);
  border-radius: var(--r-tile);
  background: var(--amber-bg);
  color: var(--ink);
}
.pending strong { color: var(--amber); }

/* ---- Motion (opt-in only) ----------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .btn, .seg-btn, .input, .select, .textarea, .tab, details.disclose {
    transition: border-color var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
  }
  /* Visible at once on open (so focus can move in), hidden only after the slide-out. */
  .drawer               { transition: transform .22s var(--ease), visibility 0s linear .22s; }
  .drawer.is-open       { transition: transform .22s var(--ease), visibility 0s; }
  .drawer-scrim         { transition: opacity .22s var(--ease), visibility 0s linear .22s; }
  .drawer-scrim.is-open { transition: opacity .22s var(--ease), visibility 0s; }
}

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 980px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .grid-3, .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline { grid-template-columns: minmax(0, 1fr); }
  .tl-week { position: static; }
}
@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); padding-top: var(--sp-3); }
  .tabs { order: 3; flex-basis: 100%; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .tp-row { grid-template-columns: 28px minmax(0, 1fr); }
  .tp-money { grid-column: 2; text-align: left; }
}
@media (max-width: 520px) {
  .grid-4, .tool-grid { grid-template-columns: minmax(0, 1fr); }
}
