/* Dataroom chrome — semantic tokens only, from the shared brand.css (the hub's token layer).
   If a value you need isn't a token, add the token upstream rather than a hex here. */

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-canvas);
  color: var(--color-text);
  font: var(--text-base) / var(--leading-body) var(--font-sans);
}

a { color: var(--color-link); }
a:hover { color: var(--color-link-hover); }
h1, h2, h3 { color: var(--color-heading); line-height: var(--leading-tight); }
code { font-family: var(--font-mono); font-size: 0.92em; }

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

.skip {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  z-index: 20;
}
.skip:focus { top: var(--space-2); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

[hidden] { display: none !important; }

.muted { color: var(--color-text-muted); }
/* text-muted, not text-subtle: subtle is ~3:1 on a white surface, under WCAG AA for text. */
.hint { margin: 0; font-size: var(--text-sm); color: var(--color-text-muted); }
.eyebrow {
  margin: 0 0 var(--space-1);
  font-size: var(--label-size);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-text-muted);
}
.status { color: var(--color-text-muted); }
.empty {
  margin: 0;
  padding: var(--space-7) var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
}

.icon { display: inline-flex; flex: none; }
.icon svg { display: block; }

/* ---- Top bar ------------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--space-5);
  height: 60px;
  padding: 0 var(--space-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-subtle);
}

.brand { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; }
.brand img { display: block; height: 24px; width: auto; }
/* The logo follows the theme: the OS choice, unless the reader picked one (data-theme). */
.brand .on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .on-light { display: none; }
  :root:not([data-theme="light"]) .brand .on-dark { display: block; }
}
:root[data-theme="dark"] .brand .on-light { display: none; }
:root[data-theme="dark"] .brand .on-dark { display: block; }
.brand-tag {
  font-size: var(--label-size);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-text-muted);
  border-left: 1px solid var(--color-border);
  padding-left: var(--space-3);
}

/* Dataroom | Manage — a segmented switch, admins only. */
.mode {
  display: flex;
  padding: 3px;
  gap: 2px;
  height: 32px;
  box-sizing: border-box;
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}
.mode a {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
}
.mode a:hover { color: var(--color-text); }
.mode a[aria-current="page"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }

.user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.user-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-out { white-space: nowrap; }

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  font-size: var(--text-xs);
  font-weight: 700;
}

/* ---- Page frame ---------------------------------------------------------------------------- */

.content {
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-8);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}
.card > h2 { margin: 0 0 var(--space-2); font-size: var(--text-lg); }
.card > .muted { margin: 0 0 var(--space-4); }

/* ---- Buttons and fields -------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--color-accent); color: var(--color-text-on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--color-accent-hover); color: var(--color-text-on-accent); }
.btn-ghost { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-ghost:hover:not(:disabled) { background: var(--color-accent-subtle); color: var(--color-text); }
.btn-danger { background: var(--color-danger); color: var(--color-text-on-accent); }
.btn-danger:hover { filter: brightness(1.08); color: var(--color-text-on-accent); }
.btn-quiet-danger { color: var(--color-danger); }
.btn-quiet-danger:hover:not(:disabled) { background: var(--color-danger-surface); color: var(--color-danger); }
.btn-small { padding: 2px var(--space-2); font-size: var(--text-sm); font-weight: 500; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--color-accent-subtle); }

.field { display: grid; gap: var(--space-1); font-size: var(--text-sm); font-weight: 600; }
.field input, .field select, .search input {
  font: inherit;
  font-weight: 400;
  font-size: var(--text-base);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  min-width: 0;
}
.field input:focus, .field select:focus, .search input:focus {
  outline: 2px solid var(--color-focus);
  outline-offset: -1px;
  border-color: transparent;
}
.check { display: flex; align-items: center; gap: var(--space-2); }
.check input { width: 16px; height: 16px; accent-color: var(--color-accent); }

.form-error {
  margin: var(--space-3) 0 0;
  padding: var(--space-2) var(--space-3);
  color: var(--color-danger);
  background: var(--color-danger-surface);
  border-radius: var(--radius-md);
}

/* ---- Sidebar lists (investor folders, admin folders) ---------------------------------------- */

.nav-title {
  margin: 0 0 var(--space-2);
  padding: 0 var(--space-3);
  font-size: var(--label-size);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-text-subtle);
}
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-list a, .nav-list button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.nav-list a:hover, .nav-list button:hover { background: var(--color-accent-subtle); }
.nav-list [aria-current="page"] { background: var(--color-accent-subtle); font-weight: 600; }
.nav-list [aria-current="page"] .icon { color: var(--color-accent); }
.nav-list .icon { color: var(--color-text-muted); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { font-size: var(--text-xs); color: var(--color-text-subtle); font-variant-numeric: tabular-nums; }

/* ---- Investor view: folders + documents ---------------------------------------------------- */

.room { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.room-nav { position: sticky; top: calc(60px + var(--space-6)); }

.room-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.room-head h1 { margin: 0; font-size: var(--text-xl); }
.search input { width: 260px; max-width: 100%; }

.doc-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.doc-rows:empty { display: none; }
.doc-rows li + li { border-top: 1px solid var(--color-border-subtle); }
.doc-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  color: var(--color-text);
  text-decoration: none;
  transition: background var(--duration) var(--ease);
}
.doc-row:hover { background: var(--color-surface-sunken); color: var(--color-text); }
.doc-row > .icon { color: var(--color-text-subtle); }
.doc-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-danger-surface);
  color: var(--color-danger);
}
.doc-text { flex: 1; min-width: 0; display: grid; }
.doc-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { display: block; font-size: var(--text-sm); color: var(--color-text-muted); font-weight: 400; }

/* ---- Acknowledgement ----------------------------------------------------------------------- */

.ack { max-width: 760px; margin: var(--space-4) auto; border-top: var(--rule-width) solid var(--color-accent); }
.ack h1 { margin: 0 0 var(--space-4); font-size: var(--text-xl); }
.ack-text {
  max-height: 48vh;
  overflow: auto;
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
  background: var(--color-surface-sunken);
  border-radius: var(--radius-md);
}
.ack-text > :first-child { margin-top: 0; }
.ack-text > :last-child { margin-bottom: 0; }
.ack-text li + li { margin-top: var(--space-2); }
.ack-form { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); }

/* ---- Viewer -------------------------------------------------------------------------------- */

.is-viewer .content { max-width: 1100px; padding-top: var(--space-4); }
.viewer-bar { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-4); flex-wrap: wrap; }
.viewer-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: var(--text-lg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pager { display: flex; align-items: center; gap: var(--space-2); }
.pager-count { min-width: 8ch; text-align: center; font-variant-numeric: tabular-nums; color: var(--color-text-muted); }
.page-frame { display: flex; justify-content: center; }
.page-canvas {
  display: block;
  max-width: 100%;
  background: var(--white);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-sm);
}

/* ---- Console ------------------------------------------------------------------------------- */

.console-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.console-head h1 { margin: 0; font-size: var(--text-xl); }

/* Scrolls sideways on a narrow screen, never up and down: overflow-x alone switches overflow-y on
   too, and a tab overlapping the underline made the bar 1px too tall — hence the stray
   scrollbar. The underline is an inset shadow now, inside the box. */
.tablist {
  display: flex;
  gap: var(--space-5);
  box-shadow: inset 0 -1px 0 var(--color-border);
  margin-bottom: var(--space-5);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.tablist::-webkit-scrollbar { display: none; }
.tablist [role="tab"] {
  flex: none;
  padding: var(--space-2) 0 var(--space-3);
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tablist [role="tab"]:hover { color: var(--color-text); }
.tablist [role="tab"][aria-selected="true"] { color: var(--color-heading); border-bottom-color: var(--color-accent); }

.split { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.split-nav {
  padding: var(--space-3) var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
}
.split-nav-head { display: flex; align-items: center; justify-content: space-between; padding-right: var(--space-1); margin-bottom: var(--space-2); }
.split-nav-head .nav-title { margin: 0; }
.split-main {
  min-width: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}
.pane-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.pane-head h2 { margin: 0 0 var(--space-1); font-size: var(--text-lg); }
.pane-head .muted { margin: 0; }
.pane-actions { display: flex; gap: var(--space-2); }
.pane-empty { padding: var(--space-7) var(--space-4); text-align: center; }
.pane-empty h2 { margin: 0 0 var(--space-2); }
.pane-empty p { max-width: 46ch; margin: 0 auto var(--space-4); }

.dropzone {
  display: grid;
  justify-items: center;
  gap: var(--space-1);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  border: 1.5px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface-sunken);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease);
}
.dropzone:hover, .dropzone.is-over, .dropzone:focus-within { border-color: var(--color-accent); background: var(--color-accent-subtle); }
.dropzone-icon { color: var(--color-accent); }
.link { color: var(--color-link); text-decoration: underline; }

.uploads { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: grid; gap: var(--space-2); }
.uploads:empty { display: none; }
.upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px auto;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
}
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-track { height: 6px; border-radius: var(--radius-pill); background: var(--color-border-subtle); overflow: hidden; }
.upload-bar { display: block; height: 100%; width: var(--p, 0%); background: var(--color-accent); transition: width 120ms linear; }
.upload.is-done .upload-bar { background: var(--color-success); }
.upload.is-done .upload-state { color: var(--color-success); }
.upload.is-error .upload-state { color: var(--color-danger); }
.upload-state { color: var(--color-text-muted); white-space: nowrap; }

.callout {
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  border-left: var(--rule-width) solid var(--color-accent);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}
.callout a { white-space: nowrap; margin-left: var(--space-1); }

.inline-form { display: flex; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.inline-form .field:first-child { flex: 1; min-width: 220px; }

.person { display: inline-flex; align-items: center; gap: var(--space-2); }
.chips { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); }
.chip {
  padding: 1px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-accent-subtle);
  color: var(--color-text);
  font-size: var(--text-xs);
  font-weight: 600;
}

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.stat {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.stat-label { font-size: var(--text-sm); color: var(--color-text-muted); }
.stat-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.stat-value--text { font-size: var(--text-md); line-height: 2.1rem; }
.stat-note { font-size: var(--text-sm); color: var(--color-text-subtle); }

.subhead {
  margin: var(--space-5) 0 var(--space-2);
  font-size: var(--label-size);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* Time by page — vertical bars, page numbers underneath. */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-bottom: 18px; overflow-x: auto; }
.bar-col { position: relative; display: flex; align-items: flex-end; flex: 1 0 14px; max-width: 36px; height: 100%; }
.bar { display: block; width: 100%; height: var(--h); min-height: 1px; background: var(--color-accent); border-radius: 2px 2px 0 0; }
.bar-label {
  position: absolute;
  left: 0; right: 0;
  bottom: -18px;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
  font-variant-numeric: tabular-nums;
}

.page-strip { display: inline-flex; align-items: flex-end; gap: 2px; height: 24px; }
.page-bar { flex: 0 0 5px; height: var(--h); background: var(--color-accent); border-radius: 1px; }

/* ---- Tables -------------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
.table th {
  text-align: left;
  font-size: var(--label-size);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.table td { padding: var(--space-3); border-bottom: 1px solid var(--color-border-subtle); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-rows tbody tr { cursor: pointer; }
.table-rows tbody tr:hover, .table-rows tbody tr[aria-selected="true"], .table-rows tbody tr[aria-expanded="true"] {
  background: var(--color-surface-sunken);
}
.detail-row td { background: var(--color-surface-sunken); padding: 0 var(--space-4) var(--space-4); }
.table-inner { font-size: var(--text-sm); background: var(--color-surface); border-radius: var(--radius-md); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .btn + .btn { margin-left: var(--space-1); }
.doc-cell { display: flex; align-items: center; gap: var(--space-3); color: var(--color-text); text-decoration: none; min-width: 0; }
.doc-cell:hover .doc-title { text-decoration: underline; }
.doc-cell .doc-icon { width: 30px; height: 30px; }

/* ---- Dialog and toast ---------------------------------------------------------------------- */

.dialog {
  width: min(440px, calc(100vw - 2 * var(--space-4)));
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgb(15 23 32 / 0.45); }
.dialog-form { display: grid; gap: var(--space-4); padding: var(--space-5); }
.dialog-form h2 { margin: 0; font-size: var(--text-lg); }
.dialog-form p { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

.toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-5);
  transform: translateX(-50%);
  max-width: calc(100vw - 2 * var(--space-4));
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--color-surface-inverse);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-lg);
  font-weight: 500;
  z-index: 30;
}
.toast.is-error { background: var(--color-danger); color: var(--color-text-on-accent); }

/* ---- Small screens ------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .room, .split { grid-template-columns: minmax(0, 1fr); }
  .room-nav { position: static; }
  .nav-list { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .topbar { padding: 0 var(--space-4); gap: var(--space-3); }
  .content { padding: var(--space-5) var(--space-4) var(--space-7); }
  .brand-tag, .user-email { display: none; }
  .console-head { flex-wrap: wrap; align-items: flex-start; }
  .upload { grid-template-columns: minmax(0, 1fr) auto; }
  .upload-track { display: none; }
  .search, .search input { width: 100%; }
}

/* ==== Projects, Q&A, permissions ============================================================= */

.page-head { margin-bottom: var(--space-5); }
.page-head h1 { margin: 0 0 var(--space-1); font-size: var(--text-xl); }
.page-head .muted { margin: 0; }
.section-title { margin: 0 0 var(--space-3); font-size: var(--text-md); }

.crumbs { margin-bottom: var(--space-3); font-size: var(--text-sm); color: var(--color-text-muted); }
.crumbs a { color: var(--color-text-muted); }
.crumbs a:hover { color: var(--color-link); }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }
.project-card {
  display: grid;
  gap: var(--space-2);
  align-content: start;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  text-decoration: none;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.project-card:hover { border-color: var(--color-accent); box-shadow: var(--shadow-md); color: var(--color-text); }
.project-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-accent-subtle);
  color: var(--color-accent);
}
.project-name { font-size: var(--text-md); font-weight: 700; color: var(--color-heading); }
.project-desc { color: var(--color-text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-text-muted); }
.project-stats { display: flex; gap: var(--space-4); font-size: var(--text-sm); color: var(--color-text-muted); }
.project-stats strong { color: var(--color-text); font-variant-numeric: tabular-nums; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-5); align-items: start; }
.dash-grid > .card > h2 { margin: 0 0 var(--space-2); font-size: var(--text-md); }
.archived { margin-top: var(--space-5); }
.archived summary { cursor: pointer; font-weight: 600; color: var(--color-text-muted); margin-bottom: var(--space-3); }

.mini-list { list-style: none; margin: 0; padding: 0; display: grid; }
.mini-list li + li { border-top: 1px solid var(--color-border-subtle); }
.mini-list a { display: grid; gap: 2px; padding: var(--space-3) 0; color: var(--color-text); text-decoration: none; }
.mini-list a:hover .mini-title { text-decoration: underline; }
.mini-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-meta { font-size: var(--text-sm); color: var(--color-text-muted); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}
.badge-warn { background: var(--color-warning-surface); color: var(--color-warning); border-color: transparent; }
.badge-accent { background: var(--color-accent-subtle); color: var(--color-accent); border-color: transparent; }
.tab-count:not(:empty) {
  display: inline-block;
  min-width: 18px;
  margin-left: var(--space-1);
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  font-size: var(--text-xs);
  text-align: center;
}

.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-warning-surface);
  color: var(--color-warning);
  font-weight: 600;
}

/* The room: folders + documents under the tabs. */
.room-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.folder-heading { margin: 0 0 var(--space-3); font-size: var(--text-md); }
.room-head p { margin: var(--space-1) 0 0; }
.doc-row .badge { margin-left: auto; }

/* Q&A */
.qa-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-5); align-items: start; }
.qa-filter { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.chip-btn {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.chip-btn[aria-pressed="true"] { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-text-on-accent); }
.qa-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.qa-item {
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.qa-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); font-size: var(--text-sm); color: var(--color-text-muted); }
.qa-question { margin: var(--space-3) 0 0; font-size: var(--text-md); white-space: pre-wrap; }
.qa-answer {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-left: var(--rule-width) solid var(--color-accent);
  border-radius: var(--radius-sm);
  background: var(--color-surface-sunken);
}
.qa-answer p { margin: var(--space-1) 0 0; white-space: pre-wrap; }
.qa-answer-label { font-size: var(--label-size); letter-spacing: var(--label-tracking); text-transform: uppercase; font-weight: 600; color: var(--color-text-muted); }
.qa-item--admin form { margin-top: var(--space-3); }
.qa-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.spacer { flex: 1; }
.ask-card { position: sticky; top: calc(60px + var(--space-5)); }
.ask-card h2 { margin: 0 0 var(--space-2); font-size: var(--text-lg); }

.stack { display: grid; gap: var(--space-3); }
textarea {
  font: inherit;
  font-size: var(--text-base);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  resize: vertical;
  width: 100%;
}
textarea:focus { outline: 2px solid var(--color-focus); outline-offset: -1px; border-color: transparent; }
.field-inline { display: flex; align-items: center; gap: var(--space-2); font-weight: 500; }
.field-inline select { padding: var(--space-1) var(--space-2); }

/* People */
.people-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-5); align-items: start; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.card-head h2 { margin: 0; font-size: var(--text-lg); }
.card-head p { margin: var(--space-1) 0 0; max-width: 70ch; }
.group-list { list-style: none; margin: 0; padding: 0; }
.group-item { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; border-top: 1px solid var(--color-border-subtle); }
.group-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-select, .level-select {
  font: inherit;
  font-size: var(--text-sm);
  padding: 2px var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
}

/* Permissions grid: colour carries the level; the text label says it too. */
.perm-table th, .perm-table td { white-space: nowrap; }
.perm-table thead th { vertical-align: bottom; }
.col-label { display: block; text-transform: none; letter-spacing: 0; font-size: var(--text-sm); color: var(--color-text); }
.col-sub { display: block; }
.col-close { margin-left: var(--space-1); border: 0; background: none; color: var(--color-text-subtle); cursor: pointer; font-size: var(--text-md); line-height: 1; }
.perm-table tbody th { text-transform: none; letter-spacing: 0; font-size: var(--text-base); color: var(--color-text); }
.perm-folder th { font-weight: 700; color: var(--color-heading); }
.perm-folder td, .perm-folder th { background: var(--color-surface-sunken); }
.perm-doc th { font-weight: 400; padding-left: var(--space-6); }
.level-select.lvl-none { color: var(--color-danger); }
.level-select.lvl-view { color: var(--color-accent); }
.level-select.lvl-download { color: var(--color-success); }
.level-select.is-set { font-weight: 700; border-color: currentColor; }
.level-pill { font-size: var(--text-sm); font-weight: 600; }
.level-pill.lvl-none { color: var(--color-danger); }
.level-pill.lvl-view { color: var(--color-accent); }
.level-pill.lvl-download { color: var(--color-success); }

.settings-card { max-width: 640px; }
.settings-card h2 { margin: 0 0 var(--space-3); font-size: var(--text-lg); }
.viewer-actions { display: flex; gap: var(--space-2); }

@media (max-width: 960px) {
  .dash-grid, .qa-layout, .people-grid, .room-body { grid-template-columns: minmax(0, 1fr); }
  .ask-card { position: static; }
}

/* ==== File kinds and the spreadsheet viewer =================================================== */

.doc-icon.kind-sheet { background: var(--color-success-surface); color: var(--color-success); }
.doc-icon.kind-image { background: var(--color-accent-subtle); color: var(--color-accent); }
.doc-icon.kind-file { background: var(--color-surface-sunken); color: var(--color-text-muted); }

.sheet-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  overflow-y: hidden;
}
.sheet-tabs [role="tab"] {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border-subtle);
  border-bottom: 0;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--color-surface-sunken);
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.sheet-tabs [role="tab"][aria-selected="true"] { background: var(--color-surface); color: var(--color-heading); }

/* The watermark tile is the grid's own background (cells are transparent), scrolling with it. */
.sheet {
  min-height: 60vh;
  max-height: calc(100vh - 220px);
  overflow: auto;
  border: 1px solid var(--color-border-subtle);
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  background-color: var(--white);
  background-image: var(--wm);
  background-attachment: local;
  color: #1F2933;
  box-shadow: var(--shadow-md);
}
.sheet-table { border-collapse: collapse; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.sheet-table th, .sheet-table td { border: 1px solid #E4E8EC; padding: 2px var(--space-2); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.sheet-table thead th { position: sticky; top: 0; z-index: 1; background: #F4F7F9; color: #5A6B75; font-weight: 600; text-align: center; }
.sheet-table tbody th { position: sticky; left: 0; background: #F4F7F9; color: #5A6B75; font-weight: 600; text-align: right; }
.sheet-table .corner { left: 0; z-index: 2; }
.sheet-note { margin: 0; padding: var(--space-2) var(--space-3); font-size: var(--text-sm); color: #5A6B75; }

/* ==== Viewer questions panel ================================================================== */

.viewer-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.viewer-body.has-panel { grid-template-columns: minmax(0, 1fr) 360px; }
.is-viewer .content { max-width: 1400px; }
.viewer-main { min-width: 0; }
.qa-panel {
  position: sticky;
  top: calc(60px + var(--space-4));
  max-height: calc(100vh - 60px - var(--space-6));
  overflow: auto;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.qa-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.qa-panel-head h2 { margin: 0; font-size: var(--text-md); }
.qa-ask { padding-bottom: var(--space-4); margin-bottom: var(--space-4); border-bottom: 1px solid var(--color-border-subtle); }
.qa-panel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.qa-panel-item .qa-question { font-size: var(--text-base); }
.qa-panel-empty { margin: 0; }
.link-btn { padding: 0; border: 0; background: none; color: var(--color-link); font: inherit; text-decoration: underline; cursor: pointer; }

@media (max-width: 960px) {
  .viewer-body.has-panel { grid-template-columns: minmax(0, 1fr); }
  .qa-panel { position: static; max-height: none; }
}

/* ==== Theme switch ============================================================================ */

.theme-toggle {
  margin-left: auto;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--color-text); background: var(--color-accent-subtle); }
.theme-toggle .theme-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .theme-sun { display: none; }
  :root:not([data-theme]) .theme-toggle .theme-moon { display: block; }
}

/* ==== Status roles ============================================================================
   The Financing Library maps every status to a ROLE (lib/financing/query.js STATUS_ROLES), and a
   role to these tokens — never a status to a colour. brand.css has no tinted "subtle" status
   surfaces with dark-mode pairs yet, so they are built here from the brand palette with
   light-dark(): a foreground and a background per role, each checked at ≥ 4.5:1 in both themes.
   Candidates to move upstream into brand.css. */
:root {
  --role-active-fg:   light-dark(var(--cc-blue-900), var(--cc-blue-300));
  --role-active-bg:   light-dark(color-mix(in srgb, var(--cc-blue-300) 16%, var(--white)), color-mix(in srgb, var(--cc-blue-600) 22%, var(--grey-950)));
  --role-positive-fg: light-dark(color-mix(in srgb, var(--green-600) 75%, var(--grey-950)), color-mix(in srgb, var(--green-600) 55%, var(--white)));
  --role-positive-bg: light-dark(color-mix(in srgb, var(--green-600) 12%, var(--white)), color-mix(in srgb, var(--green-600) 22%, var(--grey-950)));
  --role-pending-fg:  light-dark(color-mix(in srgb, var(--amber-600) 72%, var(--grey-950)), color-mix(in srgb, var(--amber-600) 55%, var(--white)));
  --role-pending-bg:  light-dark(color-mix(in srgb, var(--amber-600) 13%, var(--white)), color-mix(in srgb, var(--amber-600) 24%, var(--grey-950)));
  --role-neutral-fg:  var(--color-text-muted);
  --role-neutral-bg:  var(--color-surface-sunken);
  --role-danger-fg:   light-dark(color-mix(in srgb, var(--red-600) 80%, var(--grey-950)), color-mix(in srgb, var(--red-600) 55%, var(--white)));
  --role-danger-bg:   light-dark(color-mix(in srgb, var(--red-600) 11%, var(--white)), color-mix(in srgb, var(--red-600) 24%, var(--grey-950)));
  --row-hover:        light-dark(var(--grey-050), color-mix(in srgb, var(--white) 4%, var(--grey-950)));
  /* A filled accent that keeps white text at AA in both themes (the dark-mode accent is 3.8:1). */
  --fill-strong:      light-dark(var(--nf-navy-900), var(--cc-blue-800));
}
.role-active   { --fg: var(--role-active-fg);   --bg: var(--role-active-bg); }
.role-positive { --fg: var(--role-positive-fg); --bg: var(--role-positive-bg); }
.role-pending  { --fg: var(--role-pending-fg);  --bg: var(--role-pending-bg); }
.role-neutral  { --fg: var(--role-neutral-fg);  --bg: var(--role-neutral-bg); }
.role-danger   { --fg: var(--role-danger-fg);   --bg: var(--role-danger-bg); }

/* The console's existing badges, on the same checked pairs (the plain warning token on its
   surface falls short of 4.5:1 in dark mode). */
.badge-warn { background: var(--role-pending-bg); color: var(--role-pending-fg); }
.badge-accent { background: var(--role-active-bg); color: var(--role-active-fg); }
.badge .icon { margin-right: 3px; }

/* ==== Console home: module catalogue ========================================================== */

.home-head { max-width: 60ch; margin: var(--space-4) 0 var(--space-6); }
.home-head h1 { margin: 0 0 var(--space-2); font-size: var(--text-xl); letter-spacing: -0.01em; }
.home-head .muted { margin: 0; font-size: var(--text-md); }

.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
.module-card {
  position: relative;
  display: grid;
  gap: var(--space-3);
  align-content: start;
  padding: var(--space-5) var(--space-5) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  text-decoration: none;
  overflow: hidden;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}
/* The brand's 3px rule, along the top edge — it lights up on hover. */
.module-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: var(--rule-width);
  background: var(--color-border-subtle);
  transition: background var(--duration) var(--ease);
}
.module-card:hover { color: var(--color-text); border-color: var(--color-border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.module-card:hover::before, .module-card:focus-visible::before { background: var(--color-accent); }
.module-top { display: flex; align-items: center; justify-content: space-between; }
.module-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background: var(--color-surface-sunken);
  color: var(--color-heading);
}
.module-name { font-size: var(--text-lg); font-weight: 700; color: var(--color-heading); letter-spacing: -0.01em; }
.module-purpose { color: var(--color-text-muted); max-width: 52ch; }
.module-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: var(--space-2) 0 0;
  border-top: 1px solid var(--color-border-subtle);
  border-bottom: 1px solid var(--color-border-subtle);
}
.module-stat { display: grid; gap: 2px; padding: var(--space-3) var(--space-3) var(--space-3) 0; }
.module-stat + .module-stat { padding-left: var(--space-4); border-left: 1px solid var(--color-border-subtle); }
.module-stat-value { font-size: var(--text-lg); font-weight: 700; color: var(--color-heading); font-variant-numeric: tabular-nums; }
.module-stat-label { font-size: var(--text-sm); color: var(--color-text-muted); }
.module-stat.is-warn .module-stat-value { color: var(--role-pending-fg); }
.module-stat.is-loading .module-stat-value, .module-stat.is-loading .module-stat-label { color: var(--color-text-subtle); }
.module-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: var(--text-sm); }
.module-note { color: var(--color-text-muted); }
.module-note.is-error { color: var(--role-danger-fg); }
.module-go { display: inline-flex; align-items: center; gap: var(--space-1); font-weight: 600; color: var(--color-link); white-space: nowrap; }
.module-go .icon { transition: transform var(--duration) var(--ease); }
.module-card:hover .module-go .icon { transform: translateX(3px); }

/* ==== Financing Library: frame ================================================================ */

.is-fin .content { max-width: 1440px; }

.fin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.fin-head .eyebrow { font-size: var(--text-sm); letter-spacing: 0; text-transform: none; font-weight: 500; }
.fin-head .eyebrow a { color: inherit; text-decoration: none; }
.fin-head .eyebrow a:hover { color: var(--color-link); text-decoration: underline; }
.fin-head h1 { margin: 0; font-size: var(--text-lg); line-height: 1.3; letter-spacing: -0.01em; }
.fin-asof { margin: 2px 0 0; font-size: var(--text-sm); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.fin-tracks { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.fin-tracks a {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-decoration: none;
}
.fin-tracks a:hover { border-color: var(--color-border-strong); color: var(--color-text); }
.fin-tracks strong { color: var(--color-heading); font-variant-numeric: tabular-nums; }

.fin-nav { display: flex; gap: var(--space-5); margin-bottom: var(--space-4); box-shadow: inset 0 -1px 0 var(--color-border); overflow-x: auto; scrollbar-width: none; }
.fin-nav a {
  flex: none;
  padding: var(--space-1) 0 var(--space-2);
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  font-weight: 600;
  text-decoration: none;
}
.fin-nav a:hover { color: var(--color-text); }
.fin-nav a[aria-current="page"] { color: var(--color-heading); border-bottom-color: var(--color-accent); }

/* ---- Shared marks: pills, tags, evidence, engagement, chips, dates ---------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px var(--space-2) 1px 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--fg);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.role-neutral { border-color: var(--color-border); }
.pill-outline { background: transparent; border-color: currentColor; border-style: dashed; }

.track-tag { font-size: var(--text-sm); color: var(--color-text-muted); white-space: nowrap; }
.track-tag::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; vertical-align: 1px; border: 1.5px solid var(--color-text-muted); box-sizing: border-box; }
.track-grant::before { border-radius: 1px; }
.track-proposal::before { border-radius: 50%; }
.track-investor::before { rotate: 45deg; width: 6px; height: 6px; }

.ev-list { display: inline-flex; gap: 3px; }
.ev {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 3px;
  border: 1.5px solid var(--role-active-fg);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  text-decoration: none;
  cursor: help;
}
.ev-v { background: var(--fill-strong); border-color: var(--fill-strong); color: var(--color-text-on-accent); }
.ev-u { color: var(--role-active-fg); }
.ev-l { color: var(--color-text-muted); border-color: var(--color-text-muted); border-style: dashed; }
.ev-r { color: var(--color-text-muted); border-color: var(--color-text-muted); border-style: dotted; }

.eng { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); white-space: nowrap; color: var(--color-text); }
.eng-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; border: 1.5px solid var(--color-text-muted); }
.eng-active .eng-dot { background: var(--role-positive-fg); border-color: var(--role-positive-fg); }
.eng-warm .eng-dot { background: var(--role-active-fg); border-color: var(--role-active-fg); }
.eng-cold .eng-dot { background: var(--color-text-muted); }
.eng-not-invited .eng-dot { border-style: dashed; }
.eng-not-opened, .eng-not-invited, .eng-cold { color: var(--color-text-muted); }

.money { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; color: var(--color-text); }
.money.is-text { display: inline-block; font-weight: 400; color: var(--color-text-muted); max-width: 16ch; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

.p-chips { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.p-chip {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}
a.p-chip:hover { border-color: var(--color-accent); color: var(--color-link); }

/* A financing code (GRN-26-001): monospaced, one line, quieter than a P-code chip. */
.code-chip {
  display: inline-block;
  flex: none;
  padding: 0 5px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  background: var(--color-surface-sunken);
  color: var(--color-text);
  font: 600 var(--text-xs) / 18px var(--font-mono);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.icon-btn-small { width: 22px; height: 22px; border-radius: var(--radius-sm); }
.p-chip-more { border-style: dashed; color: var(--color-text-muted); }

.when { display: inline-grid; line-height: 1.35; }
.when-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.when-date.is-fuzzy, .up-when.is-fuzzy {
  font-style: italic;
  color: var(--color-text-muted);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: help;
}
.when-hint { font-size: var(--text-sm); color: var(--color-text-muted); white-space: nowrap; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; }
.when.is-overdue .when-date, .when.is-overdue .when-hint { color: var(--role-danger-fg); font-weight: 600; }

/* A short inline date for deadline lists ("14 Oct", "≈ Q4"); estimates dotted, with their span in the tooltip. */
.date-token { font-size: var(--text-sm); font-weight: 700; color: var(--color-heading); font-variant-numeric: tabular-nums; white-space: nowrap; }
.date-token.is-fuzzy { font-weight: 600; font-style: italic; color: var(--color-text-muted); text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }

mark { background: var(--role-pending-bg); color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---- States -------------------------------------------------------------------------------- */

.fin-empty { padding: var(--space-6) var(--space-4); text-align: center; }
.fin-empty-title { margin: 0 0 var(--space-1); font-weight: 600; color: var(--color-heading); }
.fin-empty-body { max-width: 52ch; margin: 0 auto var(--space-3); color: var(--color-text-muted); }
.fin-error {
  grid-column: 1 / -1;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--role-danger-fg);
  border-left-width: var(--rule-width);
  border-radius: var(--radius-md);
  background: var(--role-danger-bg);
}
.fin-error-title { margin: 0 0 var(--space-1); font-weight: 700; color: var(--role-danger-fg); }
.fin-error-body { margin: 0 0 var(--space-3); color: var(--color-text); }
.hint.is-error { color: var(--role-danger-fg); }

.skeleton { display: grid; gap: var(--space-2); padding: var(--space-1) 0; }
.skeleton-line { display: block; height: 12px; border-radius: var(--radius-sm); background: var(--color-surface-sunken); animation: fin-pulse 1.4s var(--ease) infinite; }
.skeleton-w1 { width: 72%; }
.skeleton-w2 { width: 46%; }
.skeleton-w3 { width: 88%; }
@keyframes fin-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton-line { animation: none; }
  .module-card, .module-card .icon { transition: none; }
  .module-card:hover { transform: none; }
}

/* ---- Dashboard ------------------------------------------------------------------------------ */

.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.kpi {
  position: relative;
  display: grid;
  gap: var(--space-1);
  align-content: start;
  min-width: 0;
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.kpi:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-sm); }
.kpi-label { font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); }
.kpi-pending .kpi-value { color: var(--role-pending-fg); }
/* The big number is the tile's link; ::after stretches it over the whole tile, and the
   sub-links sit above it so each opens its own list. */
.kpi-value {
  margin: 0 0 var(--space-1);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--color-heading);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.kpi-value::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-lg); }
.kpi-value:hover { color: var(--color-heading); }
.kpi-value:focus-visible { outline: none; }
.kpi:has(.kpi-value:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.kpi-subs { display: grid; justify-items: start; gap: 2px; font-size: var(--text-sm); }
.kpi-sub { position: relative; z-index: 1; color: var(--color-text-muted); }
a.kpi-sub { color: var(--color-link); text-decoration: underline; text-decoration-color: var(--color-border-strong); text-underline-offset: 2px; }
a.kpi-sub:hover { text-decoration-color: currentColor; }
.kpi-sub.is-danger { color: var(--role-danger-fg); font-weight: 600; }
.kpi-sub.is-strong { color: var(--color-text); font-weight: 600; }
.kpi-sub[title] { cursor: help; text-decoration: underline dotted var(--color-border-strong); text-underline-offset: 3px; }
.kpi.is-loading { min-height: 116px; }

.fin-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
.fin-col { display: grid; gap: var(--space-4); align-content: start; min-width: 0; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-12 { grid-column: 1 / -1; }

.panel { min-width: 0; background: var(--color-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5) var(--space-3);
}
.panel-head h2 { margin: 0; font-size: var(--text-base); font-weight: 650; }
.panel-note { margin: 0 0 var(--space-3); font-size: var(--text-sm); color: var(--color-text-muted); max-width: 60ch; }
.panel-link { font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.panel-hint { font-size: var(--text-sm); color: var(--color-text-muted); }
.panel-body { padding: 0 var(--space-5) var(--space-5); }
.panel-more { display: inline-flex; align-items: center; gap: var(--space-1); margin-top: var(--space-3); font-size: var(--text-sm); font-weight: 600; }

/* Upcoming dates */
.up-group + .up-group { margin-top: var(--space-4); }
.up-group-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}
.up-group-count { padding: 0 6px; border-radius: var(--radius-pill); background: var(--color-surface-sunken); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.up-list { list-style: none; margin: 0; padding: 0; }
.up-list li + li { border-top: 1px solid var(--color-border-subtle); }
/* One line a row (~44 px): date | name, track, countdown | amount | status, the last two in fixed
   right-aligned columns so they line up down the list. */
.up-row {
  display: grid;
  grid-template-columns: 3.75rem minmax(0, 1fr) minmax(0, 6.5rem) 7.5rem;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: 5px var(--space-2);
  margin: 0 calc(-1 * var(--space-2));
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
}
.up-row:hover { background: var(--row-hover); color: var(--color-text); }
.up-row:hover .up-name { text-decoration: underline; }
.up-main { display: flex; align-items: baseline; gap: var(--space-3); min-width: 0; }
.up-name { flex: 0 1 auto; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-meta { flex: none; display: flex; align-items: baseline; gap: var(--space-3); min-width: 0; overflow: hidden; white-space: nowrap; font-size: var(--text-sm); color: var(--color-text-muted); }
.up-when { font-variant-numeric: tabular-nums; }
.up-amount { min-width: 0; text-align: right; overflow: hidden; }
.up-amount .money.is-text { max-width: 100%; }
.up-status { display: flex; justify-content: flex-end; }

/* Investor pipeline while the ledger records no stages: the counts on one line. */
.pipe-counts { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-2); margin: 0 0 var(--space-2); font-size: var(--text-md); }
.pipe-counts a { color: var(--color-text); text-decoration: none; }
.pipe-counts a:hover { color: var(--color-link); text-decoration: underline; }
.pipe-counts strong { font-variant-numeric: tabular-nums; color: var(--color-heading); }
.pipe-sep { color: var(--color-text-muted); }
.pipe-summary .panel-note { margin-bottom: 0; }
.pipe-summary .panel-more { margin-top: var(--space-2); }
.up-more { display: inline-flex; align-items: center; gap: var(--space-1); margin: var(--space-1) 0 0; font-size: var(--text-sm); font-weight: 600; }

/* Bar lists: CSSOM-sized (--bar is set with style.setProperty; the CSP forbids style=""). */
/* (hbar-*, not bar-*: .bar-label is already the analytics tab's absolutely placed page number.) */
.hbar-list { display: grid; gap: 2px; }
.hbar-row {
  display: grid;
  grid-template-columns: minmax(96px, 8.5rem) minmax(48px, 1fr) 2.25rem minmax(0, 6.5rem);
  align-items: center;
  gap: var(--space-3);
  padding: 5px var(--space-2);
  margin: 0 calc(-1 * var(--space-2));
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--text-sm);
}
.hbar-row:hover { background: var(--row-hover); color: var(--color-text); }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hbar-track { height: 8px; border-radius: var(--radius-pill); background: var(--color-surface-sunken); overflow: hidden; }
.hbar-fill { display: block; height: 100%; inline-size: var(--bar, 0%); border-radius: var(--radius-pill); background: var(--fg); transition: inline-size 400ms var(--ease); }
.hbar-count { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar-note { text-align: right; color: var(--color-text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-row.is-muted .hbar-label, .hbar-row.is-muted .hbar-count { color: var(--color-text-muted); font-weight: 500; }
.hbar-divider {
  margin: var(--space-2) 0 var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border-subtle);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}
@media (prefers-reduced-motion: reduce) { .hbar-fill { transition: none; } }

/* Engagement */
.eng-callout {
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-left: var(--rule-width) solid var(--role-pending-fg);
  border-radius: var(--radius-sm);
  background: var(--role-pending-bg);
  font-size: var(--text-sm);
}
.fin-mini-table { font-size: var(--text-sm); }
.fin-mini-table td { padding: var(--space-2) var(--space-3); }
.fin-mini-table th:first-child, .fin-mini-table td:first-child { padding-left: 0; }
.fin-mini-table tr.is-flagged td { background: var(--role-pending-bg); }
.cell-link { font-weight: 600; margin-right: var(--space-2); }
/* The data room's Linked financing table. */
.fin-linked-table .fl-name { min-width: 220px; }
.fin-linked-table .fl-code { width: 1%; }
.fin-linked-table .fl-sub { display: block; font-size: var(--text-sm); color: var(--color-text-muted); }
.fin-linked-table td { vertical-align: middle; }

/* Coverage strip */
.cov-strip.type-strip { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.cov-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: var(--space-2); }
.cov-cell {
  display: grid;
  gap: 2px;
  height: 100%;
  padding: var(--space-2) var(--space-3) var(--space-3);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
  color: var(--color-text);
  text-decoration: none;
}
.cov-cell:hover { border-color: var(--color-border-strong); color: var(--color-text); }
.cov-code { font-size: var(--text-sm); font-weight: 700; color: var(--color-text-muted); }
.cov-count { font-size: var(--text-lg); font-weight: 700; color: var(--color-heading); font-variant-numeric: tabular-nums; }
.cov-name { font-size: var(--text-xs); color: var(--color-text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cov-cell.is-gap { background: var(--role-pending-bg); border-color: transparent; border-left: var(--rule-width) solid var(--role-pending-fg); }
.cov-cell.is-gap .cov-count, .cov-cell.is-gap .cov-name { color: var(--role-pending-fg); font-weight: 700; }

/* ---- Tracker ------------------------------------------------------------------------------- */

.trk-toolbar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-2); }
.trk-spacer { flex: 1 1 0; }
.menu-wrap { position: relative; display: inline-flex; }
.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.tb-btn:hover { border-color: var(--color-border-strong); }
.tb-btn[aria-expanded="true"] { border-color: var(--color-border-strong); background: var(--color-surface-sunken); }
.tb-btn .icon:last-child:not(:first-child) { transform: rotate(90deg); color: var(--color-text-muted); }
.tb-muted { color: var(--color-text-muted); font-weight: 500; }
.tb-icon { width: 32px; height: 32px; font-weight: 700; color: var(--color-text-muted); }
.tb-icon:hover, .tb-icon[aria-expanded="true"] { color: var(--color-text); }

/* Segmented control: buttons with aria-pressed. */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  height: 32px;
  box-sizing: border-box;
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}
.seg button {
  min-height: 24px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.seg button:hover:not(:disabled) { color: var(--color-text); }
.seg button[aria-pressed="true"] { background: var(--color-surface); color: var(--color-heading); box-shadow: var(--shadow-sm); }
.seg button:disabled { opacity: 0.45; cursor: not-allowed; }
.seg-small { height: auto; }
.seg-small button { min-height: 22px; padding: 0 var(--space-2); }

.trk-search { position: relative; flex: 1 1 220px; min-width: 200px; max-width: 380px; display: flex; align-items: center; }
.trk-search-icon { position: absolute; left: 10px; color: var(--color-text-muted); pointer-events: none; }
.trk-search input {
  width: 100%;
  height: 32px;
  padding: 0 2.5rem 0 2rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}
.trk-search input:focus { outline: 2px solid var(--color-focus); outline-offset: -1px; border-color: transparent; }
.trk-search .kbd { position: absolute; right: var(--space-2); pointer-events: none; }
.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font: 600 var(--text-xs) / 1 var(--font-mono);
}

.view-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--role-pending-fg); }

.chip-row { display: flex; align-items: center; gap: var(--space-2) var(--space-4); min-height: 28px; margin-bottom: var(--space-2); }
.chips { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); min-width: 0; }
.chip-row .trk-count { margin-left: auto; white-space: nowrap; }
.fchip-wrap { position: relative; display: inline-flex; }
.fchip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  white-space: nowrap;
}
.fchip:hover { border-color: var(--color-border-strong); }
.fchip-key { font-weight: 600; }
.fchip-op { color: var(--color-text-muted); }
.fchip-val { font-weight: 600; color: var(--color-heading); max-width: 28ch; overflow: hidden; text-overflow: ellipsis; }
.fchip-wrap:has(.fchip-x) .fchip { padding-right: 26px; }
.fchip.is-view { background: var(--color-surface-sunken); border-style: dashed; }
.fchip.is-view .fchip-val { color: var(--color-text); }
.fchip-x {
  position: absolute;
  right: 3px;
  top: 50%;
  translate: 0 -50%;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}
.fchip-x:hover { background: var(--color-surface-sunken); color: var(--color-text); }
.fchip-switch { gap: 6px; font-weight: 600; }
.switch-box { display: inline-grid; place-items: center; width: 14px; height: 14px; border: 1px solid var(--color-border-strong); border-radius: 3px; }
.fchip-switch[aria-pressed="true"] .switch-box { background: var(--fill-strong); border-color: var(--fill-strong); color: var(--color-text-on-accent); }
.chip-clear { font-size: var(--text-sm); }

.popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 15;
  width: max-content;
  min-width: 240px;
  max-width: 340px;
  max-height: min(420px, 60vh);
  overflow: auto;
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.popover.is-right { left: auto; right: 0; }
.pop-title { display: flex; justify-content: space-between; gap: var(--space-3); margin: var(--space-1) var(--space-2) var(--space-2); font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); }
.pop-rule { font-weight: 500; }
.menu { min-width: 220px; }
.menu-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 30px;
  padding: 3px var(--space-2);
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--row-hover); color: var(--color-text); }
.menu-item[aria-current="true"] { font-weight: 600; color: var(--color-heading); }
.menu-check { display: inline-grid; place-items: center; color: var(--color-link); }
.keys-pop { min-width: 260px; }
.keys-list { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2) var(--space-3); margin: 0 var(--space-2) var(--space-2); font-size: var(--text-sm); }
.keys-list dt { display: flex; gap: 3px; }
.keys-list dd { margin: 0; color: var(--color-text-muted); align-self: center; }
.pop-list { list-style: none; margin: 0; padding: 0; }
.pop-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  min-height: 30px;
  padding: 3px var(--space-2);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  cursor: pointer;
}
.pop-option:hover { background: var(--row-hover); }
.pop-option input { width: 15px; height: 15px; margin: 0; accent-color: var(--color-accent); }
.pop-option .pill { justify-self: start; }
.pop-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-count { color: var(--color-text-muted); font-variant-numeric: tabular-nums; font-size: var(--text-xs); }
.pop-clear { margin: var(--space-2) var(--space-2) var(--space-1); font-size: var(--text-sm); }
.pop-empty { margin: var(--space-2); }

.trk-count { margin: 0; font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }

/* The table scrolls inside its own frame, so the header can stay put while the rows move. */
.trk-scroll {
  max-height: calc(100vh - 60px - var(--space-6));
  overflow: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
}
.trk-table { font-size: var(--text-base); }
.trk-table thead th, .fin-mini-table thead th { font-size: var(--text-sm); letter-spacing: 0; text-transform: none; font-weight: 600; }
.trk-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 36px;
  background: var(--color-surface);
  padding: 0 var(--space-3);
  box-shadow: inset 0 -1px 0 var(--color-border);
  border-bottom: 0;
}
.trk-table td { height: 41px; padding: var(--space-2) var(--space-3); vertical-align: middle; white-space: nowrap; }
.trk-table .when { display: inline-flex; align-items: baseline; gap: var(--space-2); }
.trk-table .checked { display: inline-flex; align-items: center; gap: var(--space-2); }
.trk-table .clamp { display: block; -webkit-line-clamp: unset; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trk-table tbody tr { cursor: pointer; }
.trk-table tbody tr:hover td { background: var(--row-hover); }
.trk-table tbody tr:focus { outline: none; }
.trk-table tbody tr:focus-visible td, .trk-table tbody tr:focus td { background: var(--role-active-bg); }
.trk-table tbody tr:focus-visible td:first-child, .trk-table tbody tr:focus td:first-child { box-shadow: inset var(--rule-width) 0 0 var(--color-focus); }
/* The name column stays in view when the table scrolls sideways on a narrow screen. */
.trk-table th:first-child, .trk-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--color-surface); transition: box-shadow var(--duration) var(--ease); }
.trk-table thead th:first-child { z-index: 3; }
.trk-scroll.is-scrolled-x .trk-table th:first-child, .trk-scroll.is-scrolled-x .trk-table td:first-child { box-shadow: inset -1px 0 0 var(--color-border), 6px 0 8px -6px var(--color-border-strong); }
/* The code column (first, so it is the one that stays in view) takes its chip's width; the name
   gives up the room it needs, so a track's default columns still fit 1280 px. */
.trk-table .col-name { width: 22%; min-width: 200px; max-width: 400px; }
.trk-table .col-code { width: 1%; padding-right: var(--space-1); }
.trk-table .p-chips { flex-wrap: nowrap; }
.trk-table .col-next { min-width: 150px; }
.trk-table .col-text .clamp { max-width: clamp(120px, 11vw, 160px); }
.trk-table .col-amount { max-width: 16ch; }
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.th-sort:hover { color: var(--color-text); }
.num .th-sort { flex-direction: row-reverse; }
.th-arrow { width: 0; height: 0; border: 4px solid transparent; opacity: 0.35; border-top-color: currentColor; margin-top: 4px; }
.th-arrow.is-ascending { opacity: 1; border-top-color: transparent; border-bottom-color: currentColor; margin-top: -4px; }
.th-arrow.is-descending { opacity: 1; }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--color-heading); }

/* One line: the name, then its counterparty in muted text; both cut with an ellipsis (full text in
   the tooltip), the counterparty giving way first. */
/* Narrower on a laptop, so a track's default columns fit 1280 px without scrolling sideways. */
.name-cell { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; max-width: clamp(200px, 16.5vw, 380px); }
.name-link {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-heading);
  font-weight: 600;
  text-decoration: none;
}
.name-link:hover { color: var(--color-link); text-decoration: underline; }
.name-sub { flex: 0 100 auto; min-width: 4ch; font-size: var(--text-sm); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-cell .badge { flex: none; }
.pin-mark { color: var(--role-pending-fg); align-self: center; }
.pin-mark svg { fill: currentColor; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--text-sm); }
.checked { display: grid; justify-items: start; gap: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.col-nowrap { white-space: nowrap; }
.owner { font-size: var(--text-sm); }
.trk-loading { padding: var(--space-5); background: var(--color-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); }

/* ---- Board ----------------------------------------------------------------------------------- */

.board-note {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.board-frame { position: relative; }
.board-frame::after {
  content: "";
  position: absolute;
  inset: 0 0 var(--space-3) auto;
  width: 56px;
  pointer-events: none;
  background: linear-gradient(to right, transparent, var(--color-canvas));
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}
.board-frame.has-more::after { opacity: 1; }
.board {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: var(--space-3);
}
.board-col {
  flex: 0 0 272px;
  display: grid;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
}
.board-head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2); min-height: 32px; }
.board-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg); flex: none; }
.board-title { font-weight: 700; color: var(--color-heading); font-size: var(--text-sm); }
.board-count { padding: 0 6px; border-radius: var(--radius-pill); background: var(--color-surface); color: var(--color-text-muted); font-size: var(--text-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.board-sum { margin-left: auto; font-size: var(--text-sm); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.board-head .board-toggle { margin-left: auto; width: 24px; height: 24px; }
.board-sum + .board-toggle { margin-left: var(--space-1); }
.board-cards { display: grid; gap: var(--space-2); }
.board-card {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.board-card:hover { border-color: var(--color-border-strong); }
.board-card:focus { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.board-card.is-stale { border-left: var(--rule-width) solid var(--role-pending-fg); }
.board-name { font-weight: 600; color: var(--color-heading); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.board-name:hover { color: var(--color-link); text-decoration: underline; }
.board-org { font-size: var(--text-sm); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-facts { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); }
.board-facts .when-hint { display: none; }
.board-facts .money.is-text { margin-left: 0; max-width: none; }
.board-foot { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.board-foot:empty { display: none; }
.idle { display: inline-flex; align-items: center; gap: 3px; font-size: var(--text-xs); font-weight: 700; color: var(--role-pending-fg); }
.board-empty {
  margin: 0;
  padding: var(--space-5) var(--space-3);
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.board-col.is-collapsed { flex: 0 0 40px; padding: var(--space-1); }
.board-col.is-empty { background: transparent; border-style: dashed; }
.board-col.is-empty .board-strip { min-height: 160px; }
.board-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 220px;
  padding: var(--space-2) 0;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.board-strip:hover { background: var(--color-surface); color: var(--color-text); }
.board-strip-label { writing-mode: vertical-rl; white-space: nowrap; }
.board-strip-count { font-variant-numeric: tabular-nums; font-weight: 700; }

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

.rec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.rec-head-text { min-width: 0; flex: 1 1 520px; }
.rec-eyebrow { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); margin: 0 0 4px; font-size: var(--text-sm); font-weight: 500; color: var(--color-text-muted); }
.rec-code { display: inline-flex; align-items: center; gap: var(--space-1); }
.rec-code .code-chip { font-size: var(--text-sm); line-height: 22px; padding: 0 7px; }

.rounds-list { list-style: none; margin: 0; padding: 0; display: grid; }
.rounds-list li { display: grid; gap: 2px; padding: var(--space-2) 0; border-top: 1px solid var(--color-border-subtle); }
.rounds-list li:first-child { border-top: 0; padding-top: 0; }
.rounds-head { display: flex; align-items: center; gap: var(--space-2); }
.rounds-text, .rounds-outcome { font-size: var(--text-sm); }
.rounds-list li:not(.is-current) .code-chip { color: var(--color-text-muted); }
.rec-head h1 { margin: 0; font-size: var(--text-lg); line-height: 1.3; letter-spacing: -0.01em; max-width: 60ch; }
.rec-sub { margin: 2px 0 0; color: var(--color-text-muted); }
/* The key facts, once: each a quiet label over its value, divided by hairlines. */
.rec-meta { display: flex; align-items: stretch; flex-wrap: wrap; gap: var(--space-2) 0; margin-top: var(--space-3); }
.rec-meta > .pill { align-self: center; margin-right: var(--space-4); }
.rec-meta-item { display: grid; align-content: start; gap: 2px; min-width: 0; padding: 0 var(--space-4); border-left: 1px solid var(--color-border-subtle); }
.rec-meta-label { font-size: var(--text-xs); font-weight: 500; color: var(--color-text-muted); }
.rec-meta-item > :not(.rec-meta-label) { font-size: var(--text-sm); }
.rec-meta-val { display: inline-flex; align-items: center; gap: var(--space-2); white-space: nowrap; }
.rec-meta .when { display: inline-flex; gap: var(--space-2); align-items: baseline; }
.rec-meta .money.is-text { max-width: 28ch; }
.rec-actions { display: flex; align-items: center; gap: var(--space-2); }
.rec-actions .btn-small, .rec-actions .icon-btn { height: 28px; }
#pin[aria-pressed="true"] { background: var(--role-pending-bg); color: var(--role-pending-fg); border-color: transparent; }
#pin[aria-pressed="true"] svg { fill: currentColor; }
.email { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* Stage stepper (display only: the stage is the ledger's). */
.stepper { display: flex; align-items: stretch; flex-wrap: wrap; gap: 3px; list-style: none; margin: 0 0 var(--space-5); padding: 0; }
.step {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-1) var(--space-4);
  background: var(--color-surface-sunken);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%);
}
.step:first-child { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); border-radius: var(--radius-md) 0 0 var(--radius-md); }
.step.is-done { background: var(--role-active-bg); color: var(--role-active-fg); }
.step.is-current { background: var(--fill-strong); color: var(--color-text-on-accent); }
.step-gap { width: var(--space-4); }
.step-end { clip-path: none; border-radius: var(--radius-pill); border: 1px dashed var(--color-border-strong); background: transparent; }
.step-end.is-closed { background: var(--role-neutral-bg); color: var(--color-text); border-style: solid; }
.step-note { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-size: var(--text-sm); color: var(--color-text-muted); }

.rec-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; gap: var(--space-5); align-items: start; }
.rec-left, .rec-right { display: grid; gap: var(--space-4); }
.rec-main { min-width: 0; background: var(--color-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); padding: var(--space-2) var(--space-5) var(--space-5); }
.rec-main .tablist { margin-bottom: var(--space-4); }

.fact-group + .fact-group { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--color-border-subtle); }
.fact-group-title { margin: 0 0 var(--space-2); font-size: var(--text-sm); font-weight: 600; color: var(--color-heading); }
.facts { margin: 0; display: grid; gap: var(--space-2); }
.fact { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--space-2); font-size: var(--text-sm); }
.fact dt { color: var(--color-text-muted); }
.fact dd { margin: 0; min-width: 0; overflow-wrap: break-word; }
.fact-stack { display: grid; justify-items: start; gap: 3px; }
.prewrap { white-space: pre-wrap; }
.src-path { font-size: var(--text-xs); }
.work-form { display: grid; gap: var(--space-3); }
.work-form textarea { font-size: var(--text-sm); }
.work-form .field input { font-size: var(--text-sm); }

.ov-section + .ov-section { margin-top: var(--space-5); }
.ov-title { margin: 0 0 var(--space-2); font-size: var(--text-sm); font-weight: 700; color: var(--color-heading); }
.ov-section p { margin: 0 0 var(--space-2); max-width: 75ch; }
.fit-list { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.fit-list li { display: flex; align-items: baseline; gap: var(--space-2); font-size: var(--text-sm); }
.raw { margin-top: var(--space-5); border-top: 1px solid var(--color-border-subtle); padding-top: var(--space-3); }
.raw:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.raw-source { margin: var(--space-2) 0 0; font-size: var(--text-sm); color: var(--color-text-muted); }
.raw summary { cursor: pointer; font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); }
.raw-facts { margin-top: var(--space-3); }
.raw-facts .fact { grid-template-columns: 140px minmax(0, 1fr); }
.raw-inline .raw-source { margin-top: var(--space-3); max-width: none; }
tr.is-struck td:not(:last-child) { text-decoration: line-through; color: var(--color-text-muted); }
.nowrap { white-space: nowrap; }

.tl-head { display: flex; justify-content: flex-end; margin-bottom: var(--space-2); }
.tl-month { margin: var(--space-4) 0 var(--space-2); font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); }
.tl-upcoming { padding: var(--space-1) var(--space-4) var(--space-3); margin-bottom: var(--space-2); background: var(--role-active-bg); border-radius: var(--radius-md); }
.tl-upcoming .tl-month { margin-top: var(--space-3); color: var(--role-active-fg); }
.tl-list { list-style: none; margin: 0; padding: 0; position: relative; }
.tl-item { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--space-3); padding-bottom: var(--space-3); }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 1px; background: var(--color-border); }
.tl-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--color-surface-sunken); border: 1px solid var(--color-border-subtle); color: var(--color-text-muted); }
.tl-site .tl-icon { background: var(--role-active-bg); color: var(--role-active-fg); border-color: transparent; }
.tl-added .tl-icon { background: var(--role-positive-bg); color: var(--role-positive-fg); border-color: transparent; }
.tl-next .tl-icon { background: var(--color-surface); color: var(--role-active-fg); }
.tl-body { min-width: 0; padding-top: 4px; }
.tl-title { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.tl-detail { margin: 2px 0 0; font-size: var(--text-sm); color: var(--color-text-muted); }
.tl-meta { margin: 2px 0 0; font-size: var(--text-sm); color: var(--color-text-muted); }
.tl-item.is-struck .tl-title { text-decoration: line-through; color: var(--color-text-muted); }

.assoc .panel-body { font-size: var(--text-sm); }
.assoc-empty { display: grid; justify-items: start; gap: var(--space-2); }
.assoc-empty p { margin: 0; color: var(--color-text-muted); }
.link-quiet { margin-left: auto; align-self: center; color: var(--color-text-muted); font-size: var(--text-sm); text-decoration-color: var(--color-border-strong); }
.link-quiet:hover { color: var(--color-text); }
.room-line { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; margin: 0 0 var(--space-3); }
.room-name { font-weight: 700; font-size: var(--text-base); }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-bottom: var(--space-3); background: var(--color-border-subtle); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); overflow: hidden; }
.mini-stat { display: grid; gap: 1px; padding: var(--space-2); background: var(--color-surface); }
.mini-stat-value { font-weight: 700; color: var(--color-heading); font-variant-numeric: tabular-nums; }
.mini-stat-label { font-size: var(--text-xs); color: var(--color-text-muted); }
.room-scope { margin: var(--space-2) 0; font-weight: 600; }
.people-list { list-style: none; margin: 0 0 var(--space-2); padding: 0; }
.people-list li { display: grid; gap: 1px; padding: var(--space-2) 0; border-top: 1px solid var(--color-border-subtle); }
.person-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-meta { color: var(--color-text-muted); font-size: var(--text-xs); }
.assoc-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.assoc-projects, .assoc-related, .src-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.assoc-projects a { display: flex; align-items: baseline; gap: var(--space-2); padding: var(--space-1) 0; color: var(--color-text); text-decoration: none; }
.assoc-projects a:hover span:last-child { text-decoration: underline; color: var(--color-link); }
.assoc-related li { display: grid; gap: 3px; padding: var(--space-2) 0; border-top: 1px solid var(--color-border-subtle); }
.assoc-related li:first-child { border-top: 0; padding-top: 0; }
.assoc-related-meta { display: flex; align-items: center; gap: var(--space-2); color: var(--color-text-muted); }
.src-link { display: grid; gap: 1px; padding: var(--space-1) 0; text-decoration: none; }
.src-host { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.src-link .src-path { color: var(--color-text-muted); font-size: var(--text-xs); }
.src-link:hover .src-host { text-decoration: underline; }

/* The link-a-data-room dialog */
.dialog-wide { width: min(560px, calc(100vw - 2 * var(--space-4))); }
.link-steps { font-size: var(--text-sm) !important; font-weight: 600; color: var(--color-text-muted); }
.link-body { display: grid; gap: var(--space-3); }
.link-filter {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}
.link-filter:focus { outline: 2px solid var(--color-focus); outline-offset: -1px; border-color: transparent; }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); }
.pick-list li + li { border-top: 1px solid var(--color-border-subtle); }
.pick { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--space-3); padding: var(--space-3); cursor: pointer; }
.pick:hover { background: var(--row-hover); }
.pick:has(input:checked) { background: var(--role-active-bg); }
.pick input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--color-accent); }
.pick-main { display: grid; gap: 2px; min-width: 0; }
.pick-name { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; overflow-wrap: anywhere; }
.pick-meta { font-size: var(--text-sm); color: var(--color-text-muted); }
.pick.is-archived .pick-name { color: var(--color-text-muted); }
.pick-none { padding: var(--space-4); text-align: center; }
.pick-list.is-disabled { opacity: 0.55; }
.scope-choice { display: grid; gap: var(--space-2); }

/* ---- Tracking: priority, editable cells, pickers, drag and drop ------------------------------
   The site's own tracking (stage, our application stage, priority): Linear-style controls over
   the same tokens and roles as everything else. */

.prio { display: inline-flex; align-items: center; gap: 6px; color: var(--color-text); white-space: nowrap; }
.prio-label { font-size: var(--text-sm); }
/* Urgent is the one that shouts: the danger role, bold. None is quiet. */
.prio-urgent { color: var(--role-danger-fg); }
.prio-urgent .prio-label { font-weight: 700; }
.prio-none { color: var(--color-text-muted); }
.prio-none .icon { opacity: 0.7; }
.prio-mark { stroke: var(--color-surface); }

/* "None" for our application stage: an outline, not a filled pill. */
.pill-none { background: transparent; border-color: transparent; color: var(--color-text-muted); }

/* A table cell's value that opens a picker on click (or Enter). */
.cell-pick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  margin: -4px -6px;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.cell-pick:hover, .cell-pick[aria-expanded="true"] { background: var(--color-surface); border-color: var(--color-border); }
.cell-pick:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.trk-table .col-prio { width: 1%; padding-left: var(--space-2); padding-right: var(--space-2); }
.trk-table td.col-prio { text-align: center; }
.trk-table th.col-prio .th-sort { gap: 2px; color: var(--color-text-muted); }

/* The picker floats on the page (fin-pick.js places it through the CSSOM). */
.pick-pop { position: fixed; top: var(--pick-y, 0); left: var(--pick-x, 0); z-index: 50; min-width: 210px; }
.pick-list { display: grid; gap: 1px; }
.pick-item:focus { outline: none; background: var(--row-hover); }
.pick-item:focus-visible { box-shadow: inset 0 0 0 2px var(--color-focus); }
.pick-label { display: inline-flex; min-width: 0; }
.pick-key { font: 600 var(--text-xs) / 1 var(--font-mono); color: var(--color-text-muted); }
.pick-hint { margin: var(--space-2) var(--space-2) var(--space-1); font-size: var(--text-xs); color: var(--color-text-muted); }

/* Board: the note and the grants' "Group by" on one line; cards that move. */
.board-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.board-bar .board-note { margin: 0; }
.board-note .kbd { height: 18px; min-width: 18px; margin: 0 1px; }
.board-group { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-text-muted); }
/* A column keeps its width: a long line in a card is cut with an ellipsis, not a wider column. */
.board-col:not(.is-collapsed), .board-card, .board-facts { min-width: 0; }
.board-facts .money.is-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-card.is-movable { cursor: grab; user-select: none; -webkit-user-select: none; }
.board-card.is-dragging { opacity: 0.35; }
.board-ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--ghost-w);
  transform: translate(var(--ghost-x, 0), var(--ghost-y, 0)) rotate(1.5deg);
  z-index: 60;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.is-dragging-card, .is-dragging-card * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.board-col.is-drop-target { background: var(--role-active-bg); border-color: var(--color-focus); box-shadow: inset 0 0 0 1px var(--color-focus); }
.board-col.is-collapsed.is-drop-target .board-strip { color: var(--role-active-fg); }
.board-move { margin-left: auto; opacity: 0; transition: opacity var(--duration) var(--ease); }
.board-card:hover .board-move, .board-card:focus-within .board-move, .board-card:focus .board-move, .board-move[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .board-move { opacity: 1; } }

/* Record: the tracking controls in the header, and a clickable stepper. */
.rec-meta-item .cell-pick { margin: -3px -6px; justify-self: start; }
.rec-meta-item.is-tracking { padding-left: 0; border-left: 0; padding-right: var(--space-4); }
.rec-meta-item.is-tracking + .rec-meta-item.is-tracking { padding-left: var(--space-4); border-left: 1px solid var(--color-border-subtle); }
.rec-meta-sub { font-size: var(--text-xs); color: var(--color-text-muted); white-space: nowrap; }
.step-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: calc(-1 * var(--space-1)) calc(-1 * var(--space-4));
  padding: var(--space-1) var(--space-4);
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.step:not(.is-current):has(.step-btn:hover) { background: var(--role-active-bg); color: var(--role-active-fg); }
.step-btn:focus-visible { outline: none; text-decoration: underline 2px; text-underline-offset: 3px; }
.step:not(.is-current):has(.step-btn:focus-visible) { background: var(--role-active-bg); color: var(--role-active-fg); }
.step-note .link-btn { font-size: inherit; }

/* Dashboard: priority beside the name on the upcoming rows. */
.up-main .prio { align-self: center; }

/* ---- Responsive ----------------------------------------------------------------------------- */

@media (max-width: 1280px) {
  .rec-grid { grid-template-columns: 280px minmax(0, 1fr); grid-template-rows: auto 1fr; }
  /* Associations go under the tabs, beside the key facts, rather than below everything. */
  .rec-left { grid-row: 1 / span 2; }
  .rec-right { grid-column: 2; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }
}
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-5, .span-6, .span-7 { grid-column: 1 / -1; }
  .trk-spacer { display: none; }
}
@media (max-width: 900px) {
  .rec-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .rec-left, .rec-right { grid-row: auto; grid-column: auto; }
  .module-grid { grid-template-columns: minmax(0, 1fr); }
  .mode a { padding: var(--space-1) var(--space-2); }
}
@media (max-width: 600px) {
  .kpi-row { grid-template-columns: minmax(0, 1fr); }
  .hbar-row { grid-template-columns: minmax(80px, 7rem) minmax(0, 1fr) 2rem; }
  .hbar-note { display: none; }
  .up-row { grid-template-columns: 3.5rem minmax(0, 1fr) auto; }
  .up-main { flex-wrap: wrap; }
  .up-amount { grid-column: 2; grid-row: 2; text-align: left; }
  .up-status { grid-column: 3; grid-row: 1; }
}
