/* ═══════════════════════════════════════════════
   PROPOSALONE — Shared Design System
   Warm Graphite · Steel Blue Accent
   Next313 / Dignetix Ltd
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400&family=Barlow+Condensed:wght@600;700;800;900&family=Barlow+Semi+Condensed:wght@500;600;700&display=swap');

/* ── TOKENS ── */
:root {
  /* Cool slate dark palette (v0.36.0). Moved off the old warm near-black
     (#0C0B09 + brown surfaces), which muddied contrast, to a cooler ground
     with lighter surfaces, stronger border separation, and brighter text.
     The steel-blue brand accent (--st/--stb) is unchanged. */
  --bg:       #0E1014;
  --bgw:      #121519;
  --navbg:    #13161B;
  --sur:      #181C22;
  --sur2:     #1F242B;
  --sur3:     #272D35;
  --bdr:      #333A44;
  --bdr2:     #404956;
  --st:       #5A9FD4;
  /* Primary-button blue + its hover. White text on --std is 5.72:1
     (pinned by test/lib/wcag-contrast.test.js). --st stays the link /
     accent colour in dark only — white on it is 2.86:1, never do that. */
  --std:      #2D6A9F;
  --stdh:     #24557F;
  --stb:      #7BBDE8;
  --stg:      rgba(90,159,212,0.10);
  --tx:       #F0F2F5;
  --txd:      #C3CAD3;
  --txm:      #9AA3AE;
  --amb:      #E0A95A;
  --ambd:     rgba(224,169,90,0.14);
  --grn:      #5FC495;
  --grnd:     rgba(95,196,149,0.14);
  --red:      #D87A7A;
  --redd:     rgba(216,122,122,0.14);
  --radius:   6px;
  --radius-sm:4px;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

/* Phase-page action bar (v0.36.0). Primary phase actions sit at the top of
   the content area, right-aligned — close to the work — instead of floating
   in the far page corner. On tabbed pages (Decision) the actions share the
   tab row; .phase-tabrow holds the tabs left + actions right with the tab
   underline spanning the whole row. */
.phase-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.phase-tabrow { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; border-bottom: 1px solid var(--bdr); margin-bottom: 12px; }
.phase-tabrow .dec-tabs { border-bottom: none; margin-bottom: 0; }
@media (max-width: 720px) { .phase-actions { justify-content: flex-start; } }

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* The hidden attribute always wins. An author-level display (a class with
   display:flex, say) otherwise overrides the browser's built-in [hidden]
   rule and shows an element the code meant to hide. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--tx);
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── LAYOUT SHELL ──
   Sidebar shell (redesign 2026-10-13). Every in-app page is
     <div class="app-shell"><aside class="app-nav" id="app-nav"></aside><div class="app-main">…</div></div>
   The <aside> is an empty, CSS-sized placeholder until shell.js renders
   into it, so the main column never jumps when the module loads. Width
   is driven by <html data-nav="expanded|collapsed"> (set by the head
   pre-script before first paint; see shell.js SHELL_PRE_SCRIPT). */
.app-shell {
  display: flex;
  flex-direction: row;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.app-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
/* The support-session banner is position:fixed at the bottom (app.js);
   pad the shell by its height so it never covers the sidebar footer. */
body.has-support-banner .app-shell { padding-bottom: 32px; }

.body-row {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
/* Flex children default to flex-shrink:1, which squashes stacked cards
   to fit inside .main-content rather than triggering its overflow:auto.
   Result: the last card on a long page (Reports → Repository overview)
   gets compressed to near-zero height and feels "cut off". Keeping
   children at their natural height makes overflow:auto kick in and
   the page scrolls properly. */
.main-content > * { flex-shrink: 0; }

/* Visually hidden, still read by assistive tech. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── APP NAV (sidebar) ──
   Class names are deliberately NOT .sidebar* — repository.html owns
   those for its own department panel. Only .app-nav-scroll scrolls; the
   aside itself stays overflow:visible so the dropdowns anchored inside
   it (bell panel, search results, avatar menu) can escape its box. */
.app-nav {
  position: relative; z-index: 30;
  width: 236px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 12px 14px;
  background: var(--navbg);
  border-right: 1px solid var(--bdr);
  overflow: visible;
  color: var(--txd);
}
/* Width animates only once shell.js has painted (.is-ready) — otherwise
   the restored collapse state would visibly slide in on every load. */
.app-nav.is-ready { transition: width 0.18s ease, padding 0.18s ease; }
@media (prefers-reduced-motion: reduce) { .app-nav.is-ready { transition: none; } }
/* Gated items (Filing / Admin) render with the `hidden` attribute. The
   author-level display:flex on .app-nav-item would otherwise beat the
   browser's built-in [hidden] rule and show them to everyone. */
.app-nav [hidden] { display: none !important; }

.app-nav-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.app-nav-brand { padding: 0 4px; min-height: 44px; }
.app-nav-brand .brand-symbol { width: 28px; height: 28px; }
.app-nav-brand .brand-name { font-size: 18px; }

.app-nav-iconbtn {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex-shrink: 0;
  border: 0; border-radius: var(--radius);
  background: transparent; color: var(--txm);
  cursor: pointer; transition: background 0.12s, color 0.12s;
}
.app-nav-iconbtn svg { width: 18px; height: 18px; }
.app-nav-iconbtn:hover { background: var(--sur2); color: var(--tx); }
.app-nav-iconbtn:focus-visible,
.app-nav-item:focus-visible,
.app-nav-view:focus-visible,
.app-nav-theme-opt:focus-visible,
.app-nav-avatar:focus-visible,
.app-nav-mark:focus-visible,
.notif-btn:focus-visible { outline: 2px solid var(--st); outline-offset: -2px; }
.app-nav-close { display: none; }

/* The global search box mounts from the shell module after first paint;
   reserving its 40px keeps the nav list below from shifting when it lands. */
.app-nav-search-slot { min-height: 40px; }
.app-nav-workspace {
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 12px;
  background: var(--sur2); border: 1px solid var(--bdr); border-radius: var(--radius);
}
.app-nav-ws-label { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--txm); }
.app-nav-ws-name { font-size: 13px; font-weight: 600; color: var(--tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-nav-ws-switch { font-size: 11px; color: var(--stb); margin-top: 2px; }
.app-nav-ws-switch:hover { text-decoration: underline; }

/* Global search (global-search.js mounts .nav-search into the slot). */
.nav-search {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 40px; padding: 0 10px;
  background: var(--sur2); border: 1px solid var(--bdr);
  border-radius: var(--radius);
  color: var(--txm); font-size: 12px;
  transition: border-color 0.15s;
}
.nav-search:focus-within { border-color: var(--st); }
.nav-search svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-search input {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--tx); font-size: 13px; font-family: inherit;
}
.nav-search input::placeholder { color: var(--txm); }
.app-nav-search-btn { display: none; }

.app-nav-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
}
.app-nav-list { display: flex; flex-direction: column; gap: 2px; }
.app-nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 0 12px;
  border-radius: var(--radius);
  color: var(--txd); font-size: 13.5px; font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.app-nav-item:hover { background: var(--sur2); color: var(--tx); }
.app-nav-item.is-active {
  background: var(--sur3); color: var(--tx); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--st);
}
.app-nav-icon { position: relative; display: grid; place-items: center; width: 20px; height: 20px; flex-shrink: 0; }
.app-nav-icon svg { width: 18px; height: 18px; }
.app-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-nav-section-label {
  padding: 0 12px 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--txm);
}
.app-nav-views { display: flex; flex-direction: column; gap: 2px; }
.app-nav-view {
  display: flex; align-items: center; gap: 10px;
  min-height: 34px; padding: 0 12px;
  border-radius: var(--radius);
  color: var(--txd); font-size: 12.5px;
}
.app-nav-view:hover { background: var(--sur2); color: var(--tx); }
.app-nav-view.is-active { background: var(--sur3); color: var(--tx); }
.app-nav-view-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.app-nav-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.app-nav-theme {
  display: grid; grid-template-columns: 1fr 1fr; padding: 3px;
  background: var(--sur2); border: 1px solid var(--bdr); border-radius: var(--radius);
}
.app-nav-theme-opt {
  min-height: 34px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--txm);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.app-nav-theme-opt:hover { color: var(--tx); }
.app-nav-theme-opt[aria-pressed="true"] { background: var(--sur); color: var(--tx); box-shadow: 0 1px 2px rgba(0,0,0,0.18); }
.app-nav-theme-flip { display: none; align-self: center; }

/* Send Feedback, matched to FieldVault's sidebar button. */
.app-nav-feedback {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 42px; padding: 0 12px;
  border: 1px solid var(--bdr2); border-radius: 8px;
  background: var(--sur2); color: var(--tx);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.app-nav-feedback:hover { background: var(--sur3); }
.app-nav-feedback:focus-visible { outline: 2px solid var(--st); outline-offset: 2px; }
.app-nav-user { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.app-nav-user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.app-nav-user-name { font-size: 13px; font-weight: 600; color: var(--tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-nav-user-role { font-size: 11.5px; color: var(--txm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Signed-out visitor on a public page (help.html): the user row is a link. */
.app-nav-signin { display: inline-flex; align-items: center; min-height: 40px; padding: 0 10px; font-size: 13px; font-weight: 600; color: var(--st); text-decoration: none; border-radius: var(--radius-sm); }
.app-nav-signin:hover { background: var(--sur3); }

/* Notification bell — exactly one per page, in the sidebar user row;
   notification-bell.js wraps it and adds the badge + panel. */
.notif-btn {
  width: 40px; height: 40px; flex-shrink: 0;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--txd); position: relative;
  transition: border-color 0.15s, background 0.12s, color 0.12s;
}
.notif-btn svg { width: 18px; height: 18px; }
.notif-btn:hover { background: var(--sur2); color: var(--tx); }

/* Avatar */
/* White initials, so the gradient stays on the two primary-button blues
   (--stdh → --std, both ≥ 4.5:1 under white). Never --st: in dark mode
   that is #5A9FD4 and white on it is 2.86:1. */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--stdh), var(--std));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
  letter-spacing: 0.5px; flex-shrink: 0;
}
.avatar.sm { width: 26px; height: 26px; font-size: 9px; }
.avatar.muted { background: var(--sur3); color: var(--txd); }
/* #nav-avatar is a <button> so the account menu is keyboard-reachable. */
button.avatar { border: 0; padding: 0; font-family: inherit; cursor: pointer; }
.app-nav-avatar { width: 36px; height: 36px; font-size: 12px; background: var(--std); }

/* Attribution footer, matched to FieldVault's sidebar:
   "Built in Detroit by [mark] · v<version>" on one quiet line. */
.app-nav-foot {
  padding: 10px 4px 2px; border-top: 1px solid var(--bdr);
  color: var(--txm);
}
.app-nav-identity-row {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  font-size: 11px; line-height: 1.4;
}
.app-nav-mark { display: inline-flex; line-height: 0; border-radius: 4px; }
.app-nav-mark img { display: block; width: 24px; height: 24px; transition: transform 0.15s; }
.app-nav-mark:hover img { transform: scale(1.12); }
.app-nav-build { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Attention indicator on the Admin item (admin-attention.js). Rides the
   icon so it stays visible in the collapsed rail. */
.nav-attention-dot {
  position: absolute; top: -3px; right: -3px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--amb);
  box-shadow: 0 0 0 2px var(--navbg);
  pointer-events: none;
}

/* Dropdown placement. notification-bell.js, global-search.js and the
   avatar menu style their panels for the old top nav (anchored right,
   opening downward) and the first two inject <style> tags AFTER the
   linked sheets. The two-class selectors below out-specify them, so
   source order doesn't matter: bell panel opens to the right of the
   rail bottom-aligned, search opens below its box, avatar menu opens
   upward from the user row. */
.app-nav .nb-panel { top: auto; bottom: 0; left: calc(100% + 10px); right: auto; width: 360px; max-width: calc(100vw - 260px); }
.app-nav .gs-dropdown { top: calc(100% + 6px); left: 0; right: auto; width: 360px; max-width: calc(100vw - 48px); }
.app-nav .user-menu-dropdown { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; }

/* Collapsed rail (76px) — desktop only; phones use the drawer below,
   which is always the expanded layout. */
@media (min-width: 721px) {
  :root[data-nav="collapsed"] .app-nav { width: 76px; padding: 14px 10px; }
  :root[data-nav="collapsed"] .app-nav-top { flex-direction: column; gap: 4px; }
  :root[data-nav="collapsed"] .app-nav-brand { padding: 0; justify-content: center; }
  :root[data-nav="collapsed"] .app-nav-brand .brand-name,
  :root[data-nav="collapsed"] .app-nav-workspace,
  :root[data-nav="collapsed"] .app-nav-search-slot,
  :root[data-nav="collapsed"] .app-nav-label,
  :root[data-nav="collapsed"] .app-nav-views,
  :root[data-nav="collapsed"] .app-nav-theme,
  :root[data-nav="collapsed"] .app-nav-user-text,
  :root[data-nav="collapsed"] .app-nav-built,
  :root[data-nav="collapsed"] .app-nav-build { display: none; }
  :root[data-nav="collapsed"] .app-nav-search-btn { display: grid; align-self: center; }
  :root[data-nav="collapsed"] .app-nav-item { justify-content: center; padding: 0; }
  :root[data-nav="collapsed"] .app-nav-theme-flip { display: grid; }
  :root[data-nav="collapsed"] .app-nav-feedback { width: 44px; min-height: 44px; padding: 0; align-self: center; }
  /* align-items:center matters: account-menu.js wraps the avatar in a
     block-level .user-menu and the bell in .nb-wrap, and a column flex
     would stretch both to the rail width, leaving the controls left-
     aligned instead of centred under the icons. */
  :root[data-nav="collapsed"] .app-nav-user { flex-direction: column; align-items: center; gap: 6px; padding: 0; }
  :root[data-nav="collapsed"] .app-nav-foot { align-items: center; padding: 12px 0 0; }
  :root[data-nav="collapsed"] .app-nav-identity-row { justify-content: center; }
  :root[data-nav="collapsed"] .app-nav .nb-panel { max-width: calc(100vw - 100px); }
}

/* Phone top bar — rendered by shell.js as the first child of .app-main;
   only visible at phone width. Menu button + brand, nothing else. */
.app-topbar { display: none; }
.app-nav-backdrop { display: none; }

/* ── SIDEBAR ── */
.sidebar {
  width: 220px;
  background: var(--sur);
  border-right: 1px solid var(--bdr);
  display: flex; flex-direction: column;
  overflow: hidden; flex-shrink: 0;
}
.sidebar-section { padding: 16px 0 8px; }
.sidebar-section-label {
  font-size: 9px; font-weight: 700;
  letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--txm); padding: 0 14px; margin-bottom: 4px;
}
.sidebar-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.1s;
}
.sidebar-item:hover { background: var(--sur2); }
.sidebar-item.active {
  background: var(--stg);
  border-left-color: var(--st);
}
.sidebar-item-left {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 500; color: var(--txd);
}
.sidebar-item.active .sidebar-item-left { color: var(--tx); font-weight: 600; }
.sidebar-count {
  font-size: 10px; font-weight: 700; color: var(--st);
  background: rgba(90,159,212,0.15);
  padding: 1px 7px; border-radius: 10px;
}
.sidebar-divider { height: 1px; background: var(--bdr); margin: 8px 0; }

/* ── RIGHT RAIL ── */
.right-rail {
  width: 230px;
  background: var(--bgw);
  border-left: 1px solid var(--bdr);
  padding: 18px 16px;
  display: flex; flex-direction: column;
  gap: 22px; overflow-y: auto; flex-shrink: 0;
}

/* ── CARDS ── */
.card {
  background: var(--sur);
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
}
.card-head-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.8px; text-transform: uppercase; color: var(--txd);
}
.card-body { padding: 16px; }
.card-body-lg { padding: 18px 20px; }

/* ── SECTION LABEL ── */
.sec-label {
  font-size: 9px; font-weight: 700;
  letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--txm); margin-bottom: 10px;
}

/* ── PILLS / BADGES ── */
.pill {
  display: inline-block;
  padding: 2px 9px; border-radius: 10px;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase;
  white-space: nowrap; line-height: 1.6;
}
.pill-steel  { color: var(--stb);  background: rgba(90,159,212,0.16); }
.pill-steelb { color: var(--stb);  background: rgba(122,189,232,0.14); }
.pill-green  { color: var(--grn);  background: var(--grnd); }
.pill-amber  { color: var(--amb);  background: var(--ambd); }
.pill-red    { color: var(--red);  background: var(--redd); }
.pill-muted  { color: var(--txd);  background: var(--sur3); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px;
  font-family: inherit; font-size: 11px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap;
  transition: opacity 0.15s, background 0.15s;
}
.btn:hover { opacity: 0.88; }
.btn-sm { padding: 5px 11px; font-size: 9px; }

.btn-primary { background: var(--std);  color: #fff; }
/* Primary hover darkens instead of fading — at 0.88 opacity white text
   on --std over a light page dropped under 4.5:1. */
.btn-primary:hover { opacity: 1; background: var(--stdh); }
.btn-ghost   { background: transparent; color: var(--txd); border: 1px solid var(--bdr); }
.btn-success { background: var(--grnd); color: var(--grn); border: 1px solid rgba(90,184,138,0.3); }
.btn-danger  { background: var(--redd); color: var(--red); border: 1px solid rgba(201,107,107,0.3); }

/* Disabled / gated buttons read as clearly inactive regardless of
   variant. `:disabled` is the native form; `.is-disabled` is used for
   buttons we keep clickable on purpose (to explain why on click) but
   want to look disabled — see completePhaseButtonHtml. */
.btn:disabled, .btn.is-disabled {
  background: var(--sur3); color: var(--txm);
  border: 1px solid var(--bdr); cursor: not-allowed;
}
.btn:disabled:hover, .btn.is-disabled:hover { opacity: 1; }

/* The gated "Complete & continue" button reads amber ("not ready yet")
   instead of plain grey, and flips back to the blue primary the moment
   its phase requirements are met and the gate lifts. */
#complete-phase-btn.is-disabled {
  background: var(--ambd); color: var(--amb); border: 1px solid var(--amb);
}

/* ── FORM FIELDS ── */
.field-label {
  font-size: 9px; font-weight: 700;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--txm); margin-bottom: 5px;
}
.field-value {
  background: var(--sur2); border: 1px solid var(--bdr);
  border-radius: var(--radius-sm); padding: 8px 11px;
  font-size: 12px; color: var(--tx); line-height: 1.45;
}
.field-input {
  background: var(--sur2); border: 1px solid var(--bdr);
  border-radius: var(--radius-sm); padding: 8px 11px;
  font-size: 12px; color: var(--tx); font-family: inherit;
  width: 100%; outline: none;
  transition: border-color 0.15s;
}
.field-input:focus { border-color: var(--st); }
.field-input::placeholder { color: var(--txm); }

/* ── TABLES ── */
.table-head {
  display: grid; padding: 8px 16px;
  background: var(--sur2); border-bottom: 1px solid var(--bdr);
}
.th {
  font-size: 9px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--txm);
  overflow: hidden;
}
.table-row {
  display: grid; padding: 11px 16px;
  align-items: center;
  border-bottom: 1px solid var(--bdr);
  transition: background 0.1s;
}
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: var(--sur2); }
.td { font-size: 11px; color: var(--txd); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-name { font-size: 12px; font-weight: 600; color: var(--tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-sub  { font-size: 10px; color: var(--txm); margin-top: 1px; }

/* ── TOGGLE ── */
.toggle {
  width: 32px; height: 17px; border-radius: 9px;
  position: relative; cursor: pointer;
  transition: background 0.2s; flex-shrink: 0;
}
.toggle.on  { background: var(--st); }
.toggle.off { background: var(--sur3); border: 1px solid var(--bdr); }
.toggle-knob {
  width: 13px; height: 13px; border-radius: 50%;
  background: #fff; position: absolute; top: 2px;
  transition: left 0.2s;
}
.toggle.on  .toggle-knob { left: 17px; }
.toggle.off .toggle-knob { left: 2px; }

/* ── SCORE BAR ── */
.score-bar { display: flex; align-items: center; gap: 8px; }
.score-track {
  height: 4px; border-radius: 2px;
  background: var(--sur3); overflow: hidden; flex: 1; max-width: 60px;
}
.score-fill { height: 100%; border-radius: 2px; }
.score-fill.high   { background: var(--grn); }
.score-fill.mid    { background: var(--st); }
.score-fill.low    { background: var(--amb); }
.score-val { font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-val.high { color: var(--grn); }
.score-val.mid  { color: var(--stb); }
.score-val.low  { color: var(--amb); }

/* ── PHASE TRACKER ── */
.phase-track { display: flex; align-items: flex-start; }
.phase-step  { flex: 1; display: flex; flex-direction: column; align-items: center; }
.phase-connectors { display: flex; align-items: center; width: 100%; }
.phase-line  { flex: 1; height: 2px; }
.phase-line.done   { background: var(--grn); }
.phase-line.future { background: var(--bdr); }
.phase-dot {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 800;
}
.phase-dot.done   { background: var(--grn); color: #fff; }
.phase-dot.active { background: var(--std); color: #fff; border: 2px solid var(--stb); }
.phase-dot.future { background: var(--sur3); color: var(--txm); border: 1px solid var(--bdr); }
.phase-label {
  font-size: 7px; font-weight: 600; text-transform: uppercase;
  text-align: center; margin-top: 5px; line-height: 1.25; letter-spacing: 0.3px;
}
.phase-label.done   { color: var(--grn); }
.phase-label.active { color: var(--stb); }
.phase-label.future { color: var(--txm); }

/* Clickable tracker step. The base .phase-step is a plain div; the
   `.clickable` class is added per-step by phase-tracker.js for steps
   the user is allowed to navigate to (past phases for everyone,
   future phases for admin/RL on active RFPs). */
.phase-step.clickable { cursor: pointer; user-select: none; }
.phase-step.clickable:hover .phase-label { color: var(--stb); }
.phase-step.clickable:hover .phase-dot.done   { box-shadow: 0 0 0 3px var(--grnd); }
.phase-step.clickable:hover .phase-dot.future { background: var(--sur3); border-color: var(--stb); color: var(--stb); }

/* Phase groups (v0.25.0): consecutive phases that share a category
   label render inside a group wrapper. The group label sits above
   the bubbles; the bubbles inside continue to render as normal
   .phase-step elements so the connector lines remain continuous. */
.phase-group { display: flex; flex-direction: column; }
.phase-group-label {
  font-size: 8px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--stb);
  text-align: center; margin-bottom: 4px;
  padding-bottom: 3px; border-bottom: 1px dashed var(--bdr);
}
/* Standalone steps put the phase name in the group header above, so
   the per-bubble label is hidden to avoid duplication — kept in the
   DOM (visibility:hidden) so the dot rows stay vertically aligned with
   grouped columns that do show a bubble label. */
.phase-label.phase-label-spacer { visibility: hidden; }
.phase-group-bubbles { display: flex; align-items: flex-start; }
.phase-group-bubbles .phase-step { flex: 1; }

/* Archive (phase 8) reads as a destination, not a working step.
   Muted background + dashed border separator + reduced opacity. */
.phase-step.archive .phase-dot {
  background: var(--sur3); color: var(--txm);
  border: 1px dashed var(--bdr2);
}
.phase-step.archive .phase-dot.done {
  background: var(--sur3); color: var(--grn);
  border: 1.5px solid var(--grn);
}
.phase-step.archive .phase-dot.active {
  background: var(--sur2); color: var(--txd);
  border: 2px dashed var(--bdr2);
}
.phase-step.archive .phase-label { color: var(--txm); font-style: italic; }

/* Intake (phase 1) reads as a passive origin step — recorded
   automatically at RFP creation, so it's always complete and never
   clickable. Muted dot (no green "done" fill) + italic muted label. */
.phase-step.intake .phase-dot,
.phase-step.intake .phase-dot.done,
.phase-step.intake .phase-dot.active {
  background: var(--sur3); color: var(--txm);
  border: 1px dashed var(--bdr2);
}
.phase-step.intake .phase-label { color: var(--txm); font-style: italic; }

/* ── ACTIVITY FEED ── */
.activity-item {
  display: flex; gap: 10px;
  padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid var(--bdr);
}
.activity-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.activity-icon {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--sur3); border: 1px solid var(--bdr);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: var(--stb); flex-shrink: 0; margin-top: 1px;
}
.activity-who   { font-size: 11px; font-weight: 700; color: var(--tx); }
.activity-what  { font-size: 10px; color: var(--txm); margin-top: 1px; line-height: 1.4; }
.activity-when  { font-size: 9px; color: var(--txm); margin-top: 2px; }

/* ── BANNER / ALERT ── */
.banner {
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  display: flex; gap: 10px; align-items: flex-start;
}
.banner-icon  { font-size: 13px; flex-shrink: 0; margin-top: 1px; }
.banner-title { font-size: 10px; font-weight: 700; margin-bottom: 2px; }
.banner-body  { font-size: 10px; line-height: 1.5; }
.banner-info   { background: rgba(90,159,212,0.08); border: 1px solid rgba(90,159,212,0.22); }
.banner-info   .banner-title { color: var(--stb); }
.banner-info   .banner-body  { color: var(--txd); }
.banner-warn   { background: var(--ambd); border: 1px solid rgba(212,150,74,0.3); }
.banner-warn   .banner-title { color: var(--amb); }
.banner-warn   .banner-body  { color: var(--txd); }
.banner-success{ background: var(--grnd); border: 1px solid rgba(90,184,138,0.3); }
.banner-success .banner-title { color: var(--grn); }
.banner-success .banner-body  { color: var(--txd); }

/* ── PAGE HEADER ── */
.page-header {
  display: flex; align-items: flex-end;
  justify-content: space-between; gap: 16px;
}
.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--tx); line-height: 1; margin-bottom: 4px;
}
.page-subtitle { font-size: 11px; color: var(--txm); }

/* ── STAT CARDS ── */
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); }
.stat-card {
  padding: 14px 20px;
  border-right: 1px solid var(--bdr);
  background: var(--bgw);
}
.stat-card:last-child { border-right: none; }
.stat-label { font-size: 9px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--txm); margin-bottom: 7px; }
.stat-value { font-family: 'Barlow Condensed', sans-serif; font-size: 32px; font-weight: 900; color: var(--tx); line-height: 1; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.stat-delta { font-size: 10px; font-weight: 600; }
.stat-delta.up   { color: var(--grn); }
.stat-delta.down { color: var(--red); }
.stat-delta.warn { color: var(--amb); }

/* ── PIPELINE BAR ── */
.pipeline-bar { display: flex; border-bottom: 1px solid var(--bdr); }
.pipeline-phase {
  flex: 1; padding: 10px 0 10px 16px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s, background 0.12s;
  cursor: pointer;
  user-select: none;
  /* Column flex so the count pins to the bottom regardless of how
     many lines the label wraps to. Without this, narrow cells with
     long labels ("COVER SHEET") push their count below the line of
     shorter labels ("REVIEW"), breaking the row alignment on
     mobile. v0.27.1 fix. */
  display: flex; flex-direction: column;
}
.pipeline-phase-count { margin-top: auto; }
@media (hover: hover) {
  .pipeline-phase:hover { background: var(--sur2); }
}
.pipeline-phase.has-items { border-bottom-color: var(--st); }
.pipeline-phase.selected { background: var(--sur2); border-bottom-color: var(--stb); border-bottom-width: 3px; }
.pipeline-phase-label { font-size: 8px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--txm); margin-bottom: 3px; }
.pipeline-phase.has-items .pipeline-phase-label { color: var(--stb); }
.pipeline-phase.selected .pipeline-phase-label { color: var(--stb); }
.pipeline-phase-count { font-family: 'Barlow Condensed', sans-serif; font-size: 20px; font-weight: 900; color: var(--txm); line-height: 1; }
.pipeline-phase.has-items .pipeline-phase-count { color: var(--tx); }
.pipeline-phase.selected .pipeline-phase-count { color: var(--tx); }

/* Pipeline groups (v0.25.0). Decision (2-3) and Prepare (4-5) get a
   small banner label above their cells. Standalones (Review, Submit,
   Archive) sit in matching wrappers with an invisible spacer so the
   count rows stay vertically aligned. */
.pipeline-group { flex: 1; display: flex; flex-direction: column; }
.pipeline-group-label {
  font-size: 8px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--stb);
  padding: 4px 0 3px 16px;
  border-bottom: 1px dashed var(--bdr);
  background: var(--sur2);
}
.pipeline-group-label.pipeline-group-label-spacer {
  visibility: hidden; background: transparent; border-bottom-color: transparent;
}
.pipeline-group-cells { display: flex; flex: 1; }
.pipeline-group-cells .pipeline-phase { flex: 1; }

/* Archive cell — visual destination, muted compared to working
   phases. Reads as "where finished RFPs live" rather than another
   working step in the pipeline. */
.pipeline-phase.archive {
  background: var(--sur2);
  border-left: 1px dashed var(--bdr2);
}
.pipeline-phase.archive .pipeline-phase-label { color: var(--txm); font-style: italic; }
.pipeline-phase.archive .pipeline-phase-count { color: var(--txm); }
.pipeline-phase.archive.has-items { border-bottom-color: var(--bdr2); }
.pipeline-phase.archive.has-items .pipeline-phase-label,
.pipeline-phase.archive.has-items .pipeline-phase-count { color: var(--txd); }

/* Intake cell — passive origin step, recorded at RFP creation. Muted
   and non-clickable (not a filterable working phase). Separator on its
   right edge mirrors Archive's left-edge divider. */
.pipeline-phase.intake {
  background: var(--sur2);
  border-right: 1px dashed var(--bdr2);
  cursor: default;
}
.pipeline-phase.intake .pipeline-phase-label { color: var(--txm); font-style: italic; }
.pipeline-phase.intake .pipeline-phase-count { color: var(--txm); }
.pipeline-phase.intake.has-items { border-bottom-color: var(--bdr2); }
.pipeline-phase.intake.has-items .pipeline-phase-label,
.pipeline-phase.intake.has-items .pipeline-phase-count { color: var(--txd); }

/* On phones the cells get narrow enough that the 16px left padding
   eats most of the content width. Tighten the inner padding (cell
   + group label) so labels have room to render without wrapping. */
@media (max-width: 720px) {
  .pipeline-phase { padding: 8px 4px 8px 8px; }
  .pipeline-phase-label { font-size: 8px; letter-spacing: 0.5px; }
  .pipeline-phase-count { font-size: 17px; }
  .pipeline-group-label { padding: 3px 0 2px 8px; letter-spacing: 0.5px; }
}

/* ── SECTION TABS (Admin) ── */
.sub-tabs { display: flex; background: var(--bgw); border-bottom: 1px solid var(--bdr); flex-shrink: 0; }
.sub-tab {
  padding: 11px 18px; font-size: 10px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--txd); background: transparent; border: none;
  border-bottom: 2px solid transparent; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.sub-tab:hover { color: var(--tx); }
.sub-tab.active { color: var(--stb); border-bottom-color: var(--st); }

/* Numeric attention pill on a sub-tab. Painted by admin-attention.js
   when /api/admin/attention reports a non-zero count for that area. */
.sub-tab-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  min-width: 16px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
  text-align: center;
  color: var(--amb);
  background: var(--ambd);
  border: 1px solid var(--amb);
  border-radius: 8px;
  vertical-align: 1px;
}

/* ── DOCUMENT ITEM ── */
.doc-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: var(--radius-sm);
  background: var(--sur2); border: 1px solid var(--bdr);
  margin-bottom: 6px; cursor: pointer;
  transition: border-color 0.15s;
}
.doc-item:hover { border-color: var(--bdr2); }
.doc-icon { font-size: 13px; flex-shrink: 0; }
.doc-name { font-size: 10px; color: var(--txd); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* "Open in new tab" affordance on right-rail doc/ref rows — faint until
   the row is hovered, so the rail stays calm at rest. */
.doc-open { flex-shrink: 0; font-size: 11px; color: var(--txm); opacity: 0.5; transition: opacity 0.15s, color 0.15s; }
.doc-item:hover .doc-open { opacity: 1; color: var(--stb); }

/* ── REVISION TAG ── */
.rev-tag {
  font-size: 9px; font-weight: 700; color: var(--st);
  background: var(--sur3); padding: 2px 7px;
  border-radius: 3px; font-variant-numeric: tabular-nums; flex-shrink: 0;
}

/* ── COMMENT CARD ── */
.comment-card {
  background: var(--sur2); border-radius: var(--radius-sm);
  padding: 8px 10px; border: 1px solid var(--bdr); margin-bottom: 7px;
}
.comment-who  { font-size: 9px; font-weight: 700; color: var(--stb); }
.comment-when { font-size: 9px; color: var(--txm); font-weight: 400; }
.comment-text { font-size: 10px; color: var(--txd); margin-top: 3px; line-height: 1.5; }

/* ── HERO BAND ── */
.hero-band {
  background: var(--bgw); border-bottom: 1px solid var(--bdr);
  padding: 20px 28px 16px;
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-shrink: 0;
}
.hero-date  { font-size: 9px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase; color: var(--txm); margin-bottom: 5px; }
.hero-title { font-family: 'Barlow', sans-serif; font-size: 22px; font-weight: 900; color: var(--tx); line-height: 1.1; margin-bottom: 5px; }
.hero-sub   { font-size: 12px; color: var(--txd); }

/* ── BREADCRUMB ── */
.breadcrumb { font-size: 10px; color: var(--txm); letter-spacing: 0.8px; }
.breadcrumb a { color: var(--txm); transition: color 0.15s; }
.breadcrumb a:hover { color: var(--txd); }

/* Page-level breadcrumb row — sits below the global top-nav on RFP
   sub-pages (cover-sheet, rfp-detail, team-setup, review, etc.) so the
   global nav stays persistent while the user is "inside" an RFP. */
.page-breadcrumb {
  background: var(--bgw);
  border-bottom: 1px solid var(--bdr);
  padding: 8px 24px;
  flex-shrink: 0;
}
.page-breadcrumb .breadcrumb { font-size: 11px; }

/* ── ADMIN GROUPS (top-level) ──
   Two-tier admin nav: groups on top, sub-tabs below. Same look-and-
   feel as .sub-tabs but slightly bolder and with a stronger active
   underline so the hierarchy reads correctly. */
.admin-groups {
  display: flex;
  background: var(--sur);
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
}
.admin-group {
  padding: 12px 22px; font-size: 11px; font-weight: 800;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--txd); background: transparent; border: none;
  border-bottom: 3px solid transparent; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.admin-group:hover { color: var(--tx); }
.admin-group.active { color: var(--stb); border-bottom-color: var(--stb); }

/* ── GRID UTILITIES ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.col-span-2 { grid-column: 1 / -1; }

/* ── SCROLLBAR STYLING ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--sur3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--bdr2); }

/* ── UTILS ── */
.flex-row   { display: flex; align-items: center; }
.gap-4      { gap: 4px; }
.gap-6      { gap: 6px; }
.gap-8      { gap: 8px; }
.gap-12     { gap: 12px; }
.gap-16     { gap: 16px; }
.flex-1     { flex: 1; }
.min-w-0    { min-width: 0; }
.trunc      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-4       { margin-top: 4px; }
.mt-8       { margin-top: 8px; }
.mt-12      { margin-top: 12px; }
.mb-6       { margin-bottom: 6px; }
.mb-10      { margin-bottom: 10px; }
.mb-16      { margin-bottom: 16px; }
.text-muted { color: var(--txm); }
.text-dim   { color: var(--txd); }
.text-steel { color: var(--stb); }
.text-green { color: var(--grn); }
.text-amber { color: var(--amb); }
.text-red   { color: var(--red); }
.fw-600     { font-weight: 600; }
.fw-700     { font-weight: 700; }
.fs-10      { font-size: 10px; }
.fs-11      { font-size: 11px; }
.fs-12      { font-size: 12px; }

/* ── DESKTOP-ONLY MARKER ──────────────────────────────────────────
   Pages that aren't fully usable on phones (intricate response editor,
   the autofill review modal, etc.) can add `data-desktop-only` to a
   container; we'll show a soft banner on mobile rather than a broken
   layout. Add the attribute on the page; the banner shows itself. */
.mobile-only-banner { display: none; }
@media (max-width: 720px) {
  [data-desktop-only] .mobile-only-banner {
    display: block;
    background: rgba(212, 159, 90, 0.16);
    border: 1px solid var(--amb);
    color: var(--amb);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    line-height: 1.45;
    margin-bottom: 12px;
  }
}

/* ── RESPONSIVE: tablet ───────────────────────────────────────────
   Below 1024px, the right rail (small KPIs, news, etc.) is the
   first thing to drop — it's never load-bearing for any task. */
@media (max-width: 1024px) {
  .right-rail { display: none; }
  .sidebar { width: 180px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
/* The rail's 1024px budget is for the CONTENT column, and the sidebar
   takes 236px (expanded) / 76px (collapsed) off the viewport first.
   right-rail.js measures .app-main for the same decision before it
   fetches anything. */
@media (max-width: 1260px) { :root[data-nav="expanded"] .right-rail { display: none; } }
@media (max-width: 1100px) { :root[data-nav="collapsed"] .right-rail { display: none; } }

/* ── RESPONSIVE: phone ────────────────────────────────────────────
   Below 720px, stack body-row vertically. Sidebar becomes a
   horizontal-scrollable strip at the top of the content area. */
@media (max-width: 720px) {
  /* Sidebar becomes an off-canvas drawer (always the expanded layout)
     behind a backdrop; shell.js toggles body.app-drawer-open. Fades
     rather than slides: a transform on .app-nav would turn the fixed-
     positioned bell panel / avatar menu inside it into drawer-relative
     boxes and push them off-screen. */
  .app-nav {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(300px, 86vw);
    z-index: 1500;
    opacity: 0; visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.4);
  }
  .app-nav.is-ready { transition: opacity 0.18s ease, visibility 0.18s; }
  body.app-drawer-open .app-nav { opacity: 1; visibility: visible; }
  .app-nav-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1490;
  }
  body.app-drawer-open .app-nav-backdrop { display: block; }
  .app-nav-collapse { display: none; }
  .app-nav-close { display: grid; }
  /* Dropdowns inside the 300px drawer: bell panel + avatar menu pin to
     the viewport bottom; search results fill the search box width. */
  .app-nav .nb-panel,
  .app-nav .user-menu-dropdown {
    position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px;
    width: auto; max-width: none; min-width: 0;
  }
  .app-nav .gs-dropdown { left: 0; right: 0; width: auto; max-width: none; }

  /* Phone top bar: 44px menu button + brand. */
  .app-topbar {
    display: flex; align-items: center; gap: 6px;
    height: 52px; padding: 0 8px; flex-shrink: 0;
    background: var(--navbg); border-bottom: 1px solid var(--bdr);
  }
  .app-topbar .brand { gap: 8px; }
  .app-topbar .brand-symbol { width: 24px; height: 24px; }
  .app-topbar .brand-name { font-size: 16px; }
  .app-topbar-menu { width: 44px; height: 44px; }

  /* Breadcrumb truncation — applies inside .page-breadcrumb (its
     own row) and any inline breadcrumbs left in the page body. */
  .breadcrumb {
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 10px;
  }
  .page-breadcrumb { padding: 6px 14px; }

  /* Admin groups shrink on phone the same way sub-tabs do. */
  .admin-groups { overflow-x: auto; flex-wrap: nowrap; }
  .admin-group { padding: 9px 14px; flex-shrink: 0; font-size: 10px; letter-spacing: 0.8px; }

  /* Stack sidebar above main content */
  .body-row { flex-direction: column; overflow-y: auto; }
  /* Bottom padding so an inline-expanded edit row at the bottom of a
     list isn't clipped against the viewport edge — Save / Cancel
     buttons stay reachable on phone. */
  .main-content { padding: 14px 14px 96px; gap: 12px; }
  .hero-band { padding: 14px 14px 12px; flex-wrap: wrap; gap: 8px; }

  /* Select inputs — native iOS / Android renders them as rounded
     pills which looked oversized against the rest of the chrome.
     Square them up to match the flat input style and supply our
     own caret. */
  select, select.form-input, select.search-bar {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border-radius: 4px;
    padding-right: 26px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%237f8a99' d='M5 6 0 0h10z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 10px 6px;
  }

  /* Sidebar → horizontal pill strip. Each .sidebar-item becomes a
     pill that scrolls left/right. Header + footer rows still stack. */
  .sidebar {
    width: auto;
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--bdr);
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
  }
  .sidebar > div:first-child,
  .sidebar > div:last-child,
  .sidebar #review-queue-wrap {
    display: none;
  }
  .sidebar > div[id$="-list"],
  .sidebar #dept-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 8px 12px;
    overflow-x: auto;
    flex: 1;
  }
  .sidebar-item {
    flex-shrink: 0;
    padding: 6px 12px;
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--sur2);
    white-space: nowrap;
  }
  .sidebar-item.active {
    background: rgba(90,159,212,0.18);
    border-bottom-color: var(--st);
    border-left: none;
  }
  .sidebar-item-left { font-size: 11px; }

  /* Sub-tabs — let them scroll horizontally rather than wrap */
  .sub-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .sub-tab { padding: 9px 12px; flex-shrink: 0; font-size: 9px; letter-spacing: 0.6px; }

  /* Forms in 2-column → 1-column. row-gap stays generous so labels
     visibly attach to their own input below; otherwise (with the 5px
     field-label margin-bottom) labels read as belonging to the input
     above them. */
  .field-grid,
  .grid-2 { grid-template-columns: 1fr; row-gap: 16px; column-gap: 8px; }
  .grid-4 { grid-template-columns: 1fr 1fr; }

  /* Tables built with grid-template-columns blowing out the layout —
     allow the row to wrap and the cells to shrink. Page-specific
     column rules (.users-cols, .notif-cols, etc.) still apply but
     the row itself wraps to multiple lines now. */
  .table-row,
  .table-head {
    grid-template-columns: 1fr !important;
    gap: 4px;
  }
  .table-head { display: none; }

  /* Modals: full-bleed on phones */
  .modal-dialog {
    max-width: 100% !important;
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  /* Page header (title + buttons) wraps */
  .page-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-title { font-size: 16px; }
  .page-subtitle { font-size: 11px; }

  /* Long button labels (e.g. "✓ Complete & continue to Auto-Fill")
     overflow the page header at narrow widths because .btn has
     white-space:nowrap globally. Let them wrap inside the button
     rather than blowing past the viewport edge. */
  .btn { white-space: normal; max-width: 100%; line-height: 1.25; text-align: center; }

  /* Utility: hide content on phones. Used for long button-label
     suffixes (Complete-button "& continue to Auto-Fill", etc.). */
  .hide-on-mobile { display: none; }
}

/* ── PRINT (cheap win for the Reports tab later) ────────────────── */
@media print {
  .app-nav, .app-topbar, .app-nav-backdrop, .sidebar, .right-rail, .sub-tabs, .admin-groups, .page-breadcrumb, .notif-btn { display: none !important; }
  .app-shell { display: block; height: auto; overflow: visible; }
  .app-main, .body-row { display: block; overflow: visible; }
  .main-content { padding: 0; overflow: visible; }
  .card { border: 1px solid #999; break-inside: avoid; }
}
