/* Archie team dashboard.
   Loads after /portal-assets/tokens.css, so it shares the portal's fonts,
   colours, buttons and pills. Denser than the portal and table first, with
   one difference on purpose: a dark top bar, so nobody ever mistakes this
   internal view (everyone's details at once) for a client's own portal.
   Geist Mono is used for numbers and ids only. */

body { overflow: hidden; }

/* ============================== LOGIN ==============================
   Sign in, forgot password and the setup link share one split layout,
   after the AutoLoopers team portal: a brand panel on the left, the form on
   the right, inputs with icons, a show/hide eye, one full-width button.
   The brand panel is Archie's own dark with the signal gradient, the same
   dark as the top bar, so it reads as the team side from the first screen. */
body.auth { overflow: auto; background: var(--surface); }
.lg { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }

.lg-art {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(28px, 3.4vw, 48px); background: var(--dark, #12121A); color: #F2F2F7;
}
.lg-art::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 55% at 78% 18%, rgba(110, 168, 255, 0.30), transparent 70%),
    radial-gradient(55% 50% at 18% 88%, rgba(94, 234, 212, 0.22), transparent 70%),
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0));
}
.lg-art::after {
  /* the Archie ring, large and quiet, behind the copy */
  content: ""; position: absolute; z-index: -1; width: min(62vh, 560px); aspect-ratio: 1;
  right: -14%; top: 50%; transform: translateY(-50%); border-radius: 50%;
  border: 2px dashed rgba(110, 168, 255, 0.16); box-shadow: inset 0 0 120px rgba(94, 234, 212, 0.06);
}
.lg-art-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lg-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.lg-brand .logo-tile { width: 34px; height: 34px; border-radius: 10px; background: var(--dark-3); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1); }
.lg-chip {
  display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: var(--r-pill);
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  font-size: 12.5px; font-weight: 500; color: #E6E6EE; white-space: nowrap;
}
.lg-art-copy { max-width: 500px; }
.lg-art-copy h2 { margin: 0; text-wrap: balance; font-size: clamp(28px, 2.6vw, 38px); font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; }
.lg-art-copy p { margin: 12px 0 0; font-size: 15.5px; line-height: 1.55; color: #B4B4C4; }

.lg-card { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 64px clamp(24px, 6vw, 88px); background: var(--surface); }
.lg-card > * { width: 100%; max-width: 400px; }
.lg-title { margin: 0; text-align: center; font-size: 34px; font-weight: 650; letter-spacing: -0.035em; line-height: 1.08; }
.lg-sub { margin: 10px 0 28px; text-align: center; font-size: 15px; color: var(--ink-3); }
.lg-mode { margin: 0 0 14px; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.lg-field + .lg-field { margin-top: 16px; }
.lg-field label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.lg-input {
  display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 8px 0 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line-strong);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.lg-input:focus-within { border-color: #9DB8EA; box-shadow: 0 0 0 4px rgba(110, 168, 255, 0.16); }
.lg-input > svg, .lg-eye svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.lg-input > svg { color: var(--ink-4, #9A9AAA); }
.lg-input input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink); }
.lg-input input::placeholder { color: var(--ink-4, #A5A5B4); }
.lg-eye { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-3); cursor: pointer; }
.lg-eye:hover { background: var(--sunken); color: var(--ink); }
.lg-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 12px 0 18px; }
.lg-link { border: 0; background: none; padding: 0; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.lg-link:hover { color: var(--ink); text-decoration-color: currentColor; }
.lg-tip { font-size: 12.5px; color: var(--ink-3); }
.lg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 50px;
  border: 0; border-radius: var(--r-pill); background: var(--ink); color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.lg-btn:hover:not(:disabled) { background: #26263A; }
.lg-btn:active:not(:disabled) { transform: translateY(1px); }
.lg-btn:disabled { opacity: 0.55; cursor: default; }
.lg-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lg-note, .lg-err { margin: 14px 0 0; font-size: 14px; line-height: 1.5; }
.lg-note { color: var(--ok-ink); }
.lg-err { color: var(--danger-ink); }
.lg-note:empty, .lg-err:empty { display: none; }
.lg-foot { margin-top: 36px; text-align: center; font-size: 12.5px; color: var(--ink-4, #9A9AAA); }

@media (max-width: 860px) {
  .lg { grid-template-columns: minmax(0, 1fr); }
  .lg-art { min-height: 0; padding: 20px 16px; }
  .lg-art::after, .lg-art-copy { display: none; }
  .lg-card { justify-content: flex-start; padding: 40px 16px 48px; }
  .lg-title { font-size: 30px; }
}

/* ============================== SHELL ==============================
   A dark sidebar on the left (the menu, after the AutoLoopers team portal),
   and a light top row with the page title, search and refresh. The sidebar
   keeps the dashboard's dark on purpose, so nobody ever mistakes this
   internal view (everyone's details at once) for a client's own portal. */
.app { --side: 236px; --top: 60px; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); height: 100dvh; overflow: hidden; }
.col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.side {
  display: flex; flex-direction: column; min-height: 0; padding: 16px 12px 12px;
  background: var(--dark); color: var(--mist); z-index: 40; overflow-y: auto;
}
.side :focus-visible { outline-color: var(--aqua); }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 18px; }
.side .logo-tile { background: var(--dark-3); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); }
.tb-brand { display: flex; align-items: center; gap: 10px; flex: none; }
.side .wordmark { color: var(--mist); }
.tb-pill {
  height: 22px; padding: 0 9px; display: inline-flex; align-items: center; border-radius: var(--r-pill);
  background: rgba(255,255,255,0.07); color: var(--mist-2); font-size: var(--t-xs); font-weight: 500;
}
.side .side-x { display: none; }

.tb-nav { display: flex; flex-direction: column; gap: 2px; }
.nv-h { margin: 16px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255,255,255,0.38); }
.nv-h:first-child { margin-top: 0; }
.tb-tab {
  height: 36px; padding: 0 10px; display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--mist-2); text-align: left;
  font-size: var(--t-sm); font-weight: 500; transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.tb-tab[hidden] { display: none; }
.tb-tab svg { flex: none; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.tb-tab .nv-t { flex: 1; min-width: 0; }
.tb-tab:hover { color: var(--mist); background: rgba(255,255,255,0.05); }
.tb-tab.active { color: #fff; background: rgba(255,255,255,0.10); box-shadow: inset 2px 0 0 var(--aqua); }
.tb-tab .cnt {
  min-width: 20px; height: 18px; padding: 0 6px; display: grid; place-items: center; border-radius: var(--r-pill);
  background: rgba(255,255,255,0.08); color: var(--mist-2); font-family: var(--mono); font-size: 11px; font-weight: 500;
}
.tb-tab.active .cnt { color: var(--mist); }
.tb-tab .cnt.alert { background: var(--danger); color: var(--dark); }

.side-foot { margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 6px; border-top: 1px solid rgba(255,255,255,0.08); }
.me-btn {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border: 0; border-radius: 10px;
  background: transparent; color: var(--mist); text-align: left; font: inherit; cursor: pointer;
}
.me-btn:hover { background: rgba(255,255,255,0.06); }
.me-av {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #6EA8FF, #5EEAD4); color: var(--dark); font-size: 12.5px; font-weight: 700;
}
.me-t { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me-t b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-t span { font-size: 11.5px; color: var(--mist-2); }
.tb-btn {
  height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(255,255,255,0.12); border-radius: var(--r-sm); background: transparent;
  color: var(--mist); font-size: var(--t-xs); font-weight: 500; transition: background var(--dur) var(--ease);
}
.tb-btn.icon { width: 32px; padding: 0; justify-content: center; flex: none; }
.tb-btn:hover { background: rgba(255,255,255,0.07); }
.tb-btn svg, .top-btn svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.side-scrim { display: none; }

.topbar {
  flex: none; height: var(--top); display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 30;
}
.top-title { font-size: var(--t-md); font-weight: 600; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-btn {
  height: 34px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; flex: none;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface);
  color: var(--ink-2); font-size: var(--t-xs); font-weight: 500; transition: background var(--dur) var(--ease);
}
.top-btn:hover { background: var(--sunken); color: var(--ink); }
.top-btn.icon { width: 34px; padding: 0; justify-content: center; }
#menuBtn { display: none; }
.tb-right { display: flex; align-items: center; gap: 10px; flex: none; }
.tb-stamp { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.spinning svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- search ---------------- */
.sr-btn {
  justify-self: center; display: flex; align-items: center; gap: 10px; width: clamp(220px, 34vw, 440px); height: 38px;
  padding: 0 8px 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--canvas);
  font: inherit; font-size: var(--t-sm); color: var(--ink-3); cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.sr-btn:hover { background: var(--surface); border-color: #C9CCD8; box-shadow: var(--shadow-1); }
.sr-btn-t { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-ic { flex: none; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.sr-kbd, .sr-esc, .sr-foot kbd {
  flex: none; padding: 2px 7px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface); font-family: var(--mono); font-size: 11px; color: var(--ink-3);
}
.sr-wrap { position: fixed; inset: 0; z-index: 90; display: flex; justify-content: center; padding: min(12vh, 110px) 16px 24px; }
.sr-wrap[hidden] { display: none; }
.sr-scrim { position: absolute; inset: 0; background: rgba(18, 18, 26, 0.36); backdrop-filter: blur(2px); }
.sr-panel {
  position: relative; align-self: flex-start; width: min(660px, 100%); max-height: min(620px, calc(100dvh - min(12vh, 110px) - 24px));
  display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface);
  box-shadow: var(--shadow-pop); overflow: hidden; animation: sr-pop 0.16s var(--ease);
}
@keyframes sr-pop { from { opacity: 0; transform: translateY(-6px) scale(0.985); } to { opacity: 1; transform: none; } }
.sr-in { flex: none; display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.sr-in input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); }
.sr-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 8px 10px; }
.sr-g { margin: 12px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.sr-g .n { margin-left: 6px; font-family: var(--mono); font-weight: 500; letter-spacing: 0; }
.sr-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; font: inherit; cursor: pointer; }
.sr-row[aria-selected="true"] { background: var(--sunken); }
.sr-row .ic { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--sunken-2); color: var(--ink-2); font-size: 12px; font-weight: 700; }
.sr-row[aria-selected="true"] .ic { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.sr-row .ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sr-row .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sr-row .t { font-size: var(--t-sm); font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-row .m { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-row mark { background: rgba(94, 234, 212, 0.32); color: inherit; border-radius: 3px; padding: 0 1px; }
.sr-row .go { flex: none; font-size: 12px; color: var(--ink-4, #9A9AAA); opacity: 0; }
.sr-row[aria-selected="true"] .go { opacity: 1; }
.sr-empty { padding: 28px 12px; text-align: center; font-size: var(--t-sm); color: var(--ink-3); }
.sr-foot { flex: none; display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--canvas); font-size: 12px; color: var(--ink-3); }
.sr-foot kbd { margin-right: 4px; padding: 0 5px; }

/* ---------------- programme filter ---------------- */
.filterbar {
  flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 10px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line); z-index: 20;
}
.fb-lab { flex: none; font-size: var(--t-sm); font-weight: 500; color: var(--ink-3); }
.fb-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chip {
  height: 30px; padding: 0 6px 0 12px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface);
  color: var(--ink-2); font-size: var(--t-sm); font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.chip:hover { background: var(--sunken); color: var(--ink); }
.chip .cn {
  min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: var(--r-pill);
  background: var(--sunken); color: var(--ink-3); font-family: var(--mono); font-size: 11px;
}
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.active .cn { background: rgba(255,255,255,0.16); color: #fff; }
.chip.unknown { border-style: dashed; border-color: #E2B95A; }
.fb-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex: none; min-width: 0; }
.fb-note { font-size: var(--t-xs); color: var(--ink-3); }

/* ---------------- page ---------------- */
.main { flex: 1; min-height: 0; overflow-y: auto; }
.page { max-width: 1240px; margin: 0 auto; padding: 28px 24px 72px; }
.view { display: none; }
.view.active { display: block; }

/* ============================== PRIMITIVES ============================== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.card-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 16px 20px 4px; }
.card-h h2 { font-size: var(--t-base); font-weight: 600; letter-spacing: -0.01em; }
.card-h .sub { font-size: var(--t-xs); color: var(--ink-3); }
.card-h .spacer { margin-left: auto; }
.card-b { padding: 12px 20px 18px; }
.card-b.flush { padding: 8px 0 4px; overflow-x: auto; }

.grid { display: grid; gap: 16px; align-items: start; }
.g-2, .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }

.section-t { margin: 40px 0 14px; font-size: var(--t-md); font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.section-t:first-child { margin-top: 0; }

.empty { padding: 28px 20px; text-align: center; color: var(--ink-3); font-size: var(--t-sm); }
.loading { padding: 48px 0; text-align: center; color: var(--ink-3); font-size: var(--t-sm); }
.mono { font-family: var(--mono); font-size: 12px; }
.tdim { color: var(--ink-3); }
.nowrap { white-space: nowrap; }
.tnum { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }

/* the five headline numbers, one strip */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stat { padding: 20px 22px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--line-2); }
.stat .n { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { margin-top: 6px; font-size: var(--t-sm); font-weight: 500; color: var(--ink-2); }
.stat .h { margin-top: 2px; font-size: var(--t-xs); color: var(--ink-3); }
.stat.alert .n { color: var(--danger-ink); }
.stat.good .n { color: var(--ok-ink); }

/* pills (base in tokens.css) */
.pill + .pill { margin-left: 2px; }
.pill.stage-registered { background: var(--sunken); color: var(--ink-3); }
.pill.stage-opened { background: var(--sunken); color: var(--ink-2); }
.pill.stage-talking { background: var(--run-wash); color: var(--run-ink); }
.pill.stage-ready { background: var(--warn-wash); color: var(--warn-ink); }
.pill.stage-booked { background: var(--ok-wash); color: var(--ok-ink); }
.pill.stage-done { background: var(--sunken-2); color: var(--ink-2); }
.pill.high { background: var(--danger-wash); color: var(--danger-ink); }
.pill.medium { background: var(--warn-wash); color: var(--warn-ink); }
.pill.info { background: var(--run-wash); color: var(--run-ink); }
.pill.live { background: var(--ok-wash); color: var(--ok-ink); }
/* Elite is the cohort worth spotting at a glance, so it gets the one violet. */
.pill.prog-elite { background: var(--violet-wash); color: var(--violet-ink); }
.pill.prog-regular { background: var(--sunken); color: var(--ink-2); }
.pill.prog-unassigned { background: var(--sunken); color: var(--ink-3); }
.pill.prog-unknown { background: var(--warn-wash); color: var(--warn-ink); box-shadow: inset 0 0 0 1px #E2B95A; }

/* tables */
table { width: 100%; border-collapse: collapse; }
thead th {
  position: sticky; top: 0; background: var(--surface); text-align: left; white-space: nowrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: var(--t-xs); font-weight: 500; color: var(--ink-3);
}
thead th:first-child, tbody td:first-child { padding-left: 20px; }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); font-size: var(--t-sm); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.row { cursor: pointer; transition: background var(--dur) var(--ease); }
tbody tr.row:hover { background: var(--canvas); }
td.who { min-width: 220px; }
td.who .nm { font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
td.who .em { font-size: var(--t-xs); color: var(--ink-3); }

/* funnel */
.funnel { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.fn-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 84px; align-items: center; gap: 14px; }
.fn-lab { font-size: var(--t-sm); color: var(--ink-2); }
.fn-track { height: 8px; border-radius: var(--r-pill); background: var(--sunken); overflow: hidden; }
.fn-fill { height: 100%; min-width: 2px; border-radius: inherit; background: var(--accent); transition: width 600ms var(--ease); }
.fn-val { text-align: right; font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.fn-val i { margin-left: 6px; font-style: normal; color: var(--ink-3); }

/* bar breakdown */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 116px minmax(0, 1fr) 28px; align-items: center; gap: 12px; }
.bar-lab { font-size: var(--t-sm); color: var(--ink-2); }
.bar-lab::first-letter { text-transform: uppercase; }
.bar-track { height: 6px; border-radius: var(--r-pill); background: var(--sunken); overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--accent); }
.bar-fill.warn { background: var(--warn); }
.bar-val { text-align: right; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

/* key value readouts */
.kv { display: flex; flex-direction: column; }
.kv.kv-gap { margin-bottom: 16px; }
.kv-row { display: flex; align-items: baseline; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: var(--t-sm); }
.kv-row:last-child { border-bottom: 0; }
.kv-row .k { flex: none; min-width: 176px; color: var(--ink-3); }
.kv-row .v { flex: 1; min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.kv-row .v.none, .kv-row .none { color: var(--ink-3); }
.kv-row .v.mono { font-size: 12px; }

/* needs you */
.att { display: flex; flex-direction: column; }
.att-row { display: flex; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line-2); cursor: pointer; transition: background var(--dur) var(--ease); }
.att-row:first-child { border-top: 0; }
.att-row:hover { background: var(--canvas); }
.att-bar { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; flex: none; background: var(--ink-5); }
.att-row.high .att-bar { background: var(--danger); }
.att-row.medium .att-bar { background: var(--warn); }
.att-row.info .att-bar { background: var(--run); }
.att-b { flex: 1; min-width: 0; }
.att-t { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; font-size: var(--t-sm); font-weight: 500; }
.att-t .who { min-width: 0; font-weight: 400; color: var(--ink-3); }
.att-d { margin-top: 2px; font-size: var(--t-xs); color: var(--ink-3); }
.all-clear { display: flex; align-items: center; gap: 10px; padding: 16px 20px; font-size: var(--t-sm); color: var(--ok-ink); }

/* calls */
.call-row { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-top: 1px solid var(--line-2); cursor: pointer; transition: background var(--dur) var(--ease); }
.call-row:first-child { border-top: 0; }
.call-row:hover { background: var(--canvas); }
.call-when { flex: none; min-width: 220px; }
.call-when .d { font-size: var(--t-sm); font-weight: 500; font-variant-numeric: tabular-nums; }
.call-when .r { font-size: var(--t-xs); color: var(--ink-3); }
.call-who { flex: 1; min-width: 0; }
.call-who .n { font-size: var(--t-sm); font-weight: 500; }
.call-who .e { font-size: var(--t-xs); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.call-row.past .call-when, .call-row.past .call-who { opacity: 0.6; }

/* signups */
.spark { display: flex; align-items: flex-end; gap: 4px; height: 64px; padding-top: 4px; }
.spark i { flex: 1; min-height: 3px; border-radius: 3px 3px 1px 1px; background: var(--sunken-2); transition: background var(--dur) var(--ease); }
.spark i[data-n]:not([data-n="0"]) { background: var(--accent); }
.spark i:hover { background: var(--run); }
.spark-ax { display: flex; justify-content: space-between; margin-top: 8px; font-size: var(--t-xs); color: var(--ink-3); }

/* system problems */
.prob { display: flex; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line-2); font-size: var(--t-sm); }
.prob:first-child { border-top: 0; }
.prob .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--warn-ink); }
.prob .ic svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* notes */
.note { display: block; padding: 12px 14px; margin-bottom: 12px; border-radius: var(--r-md); font-size: var(--t-sm); line-height: 1.5; }
.note.block { margin-bottom: 16px; }
.note.warn { background: var(--warn-wash); color: var(--warn-ink); }
.note.err { background: var(--danger-wash); color: var(--danger-ink); }
.note.good { background: var(--ok-wash); color: var(--ok-ink); }
.note strong { font-weight: 600; }
.note-list { margin-top: 8px; padding-left: 18px; }
.note-list li + li { margin-top: 2px; }

/* buttons that act */
.act {
  height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
  font-size: var(--t-sm); font-weight: 500; transition: background var(--dur) var(--ease);
}
.act:hover { background: var(--sunken); }
.act:disabled { opacity: 0.6; cursor: default; }
.act svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ============================== DETAIL PANEL ============================== */
.scrim {
  position: fixed; inset: 0; z-index: 40; background: rgba(11,11,20,0.36);
  opacity: 0; visibility: hidden; transition: opacity var(--dur-slow) var(--ease), visibility var(--dur-slow);
}
.scrim.show { opacity: 1; visibility: visible; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(680px, 100vw);
  display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--shadow-pop);
  transform: translateX(100%); transition: transform var(--dur-slow) var(--ease);
}
.panel.show { transform: none; }
.panel-h { flex: none; display: flex; align-items: flex-start; gap: 12px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.panel-h .ttl { flex: 1; min-width: 0; }
.panel-h h2 { font-size: var(--t-xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.panel-h .meta { margin-top: 6px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: var(--t-xs); color: var(--ink-3); }
.panel-h .meta .sep { color: var(--ink-5); }
.panel-h .meta .mono { font-size: 11.5px; color: var(--ink-3); }
.x-btn {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center; border: 0; border-radius: var(--r-md);
  background: transparent; color: var(--ink-3); transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.x-btn:hover { background: var(--sunken); color: var(--ink); }
.x-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; }
.panel-b { flex: 1; overflow-y: auto; padding: 20px 24px 56px; }
.panel-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.panel-actions .pill { height: 26px; padding: 0 11px; margin-right: 4px; }

/* Inside the panel, sections are separated by space and a hairline rather
   than boxed again: one container (the panel) is enough. */
.panel .card { border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.panel .card-h { padding: 18px 0 2px; }
.panel .card-b { padding: 10px 0 18px; }
.panel .card-b.flush { padding: 8px 0 8px; }
.panel .empty { text-align: left; padding: 6px 0 4px; }

.brief-f { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.brief-f:last-child { border-bottom: 0; }
.brief-f .fk { margin-bottom: 2px; font-size: var(--t-xs); font-weight: 500; color: var(--ink-3); }
.brief-f .fv { font-size: var(--t-base); line-height: 1.55; white-space: pre-wrap; }

.steps-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.step-chip {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  font-size: var(--t-sm); color: var(--ink-2); transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.step-chip:hover { border-color: var(--line-strong); background: var(--canvas); }
.step-chip:disabled { opacity: 0.55; cursor: default; }
.step-chip .sd { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1.5px var(--ink-5); }
.step-chip.completed { background: var(--ok-wash); border-color: transparent; color: var(--ok-ink); }
.step-chip.completed .sd { background: var(--ok); box-shadow: none; }
.step-chip.skipped { color: var(--ink-3); border-style: dashed; }

/* transcript */
.msgs { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 8px; }
.msg { display: flex; gap: 10px; }
.msg .av {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--sunken); color: var(--ink-2); font-size: 10.5px; font-weight: 600;
}
.msg.user .av { background: var(--run-wash); color: var(--run-ink); }
.msg.assistant .av { background: var(--dark-2); color: var(--mist); }
.msg.tool .av, .msg.event .av, .msg.nudge .av { background: transparent; }
.msg.tool .av::before, .msg.event .av::before, .msg.nudge .av::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-5); }
.msg.tool.tool-bad .av::before { background: var(--danger); }
.msg .bd { flex: 1; min-width: 0; }
.msg .tx { font-size: var(--t-sm); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .ts { margin-top: 2px; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.msg.tool .tx, .msg.event .tx { font-size: var(--t-xs); color: var(--ink-3); }
.msg.tool.tool-bad .tx { color: var(--danger-ink); }

/* ============================== NARROW ============================== */
@media (max-width: 1200px) {
  .tb-stamp { display: none; }
}
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(4) { border-left: 0; }
  .stat:nth-child(n+4) { border-top: 1px solid var(--line-2); }
  .g-2-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  /* The sidebar becomes a drawer behind the menu button. */
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(280px, 84vw); transform: translateX(-102%); transition: transform var(--dur-slow, 240ms) var(--ease); box-shadow: var(--shadow-pop); }
  body.nav-open .side { transform: none; }
  .side .side-x { display: inline-flex; }
  body.nav-open .side-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(18,18,26,0.36); }
  #menuBtn { display: inline-flex; }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; padding: 0 12px; }
  .sr-btn { width: 38px; padding: 0; justify-content: center; justify-self: end; }
  .sr-btn-t, .sr-btn .sr-kbd { display: none; }
  #refreshBtn span { display: none; }
  #refreshBtn { width: 34px; padding: 0; justify-content: center; }
  .filterbar { padding: 10px 16px; }
  .fb-lab { display: none; }
  .fb-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .page { padding: 20px 16px 56px; }
  .g-2, .g-4 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 16px; }
  .stat .n { font-size: 26px; }
  .stat:nth-child(n) { border-left: 0; border-top: 1px solid var(--line-2); }
  .stat:nth-child(-n+2) { border-top: 0; }
  .stat:nth-child(even) { border-left: 1px solid var(--line-2); }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .fn-row { grid-template-columns: 112px minmax(0, 1fr) 72px; gap: 10px; }
  .call-row { flex-wrap: wrap; gap: 6px 16px; }
  .call-when { min-width: 0; width: 100%; }
  .call-tags { justify-content: flex-start; }
  .kv-row { flex-direction: column; gap: 2px; }
  .kv-row .k { min-width: 0; }
  .panel-h, .panel-b { padding-left: 16px; padding-right: 16px; }
  .steps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* People */
.people-bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: 16px 0 4px; }
.rv-row { padding: 16px 20px; border-top: 1px solid var(--line); }
.rv-row:first-child { border-top: 0; }
.rv-t { font-weight: 500; }
.rv-t strong { font-weight: 600; }
.rv-d { margin-top: 2px; font-size: var(--t-sm); color: var(--ink-3); }
.rv-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.rv-acts .act .tdim { margin-left: 6px; font-size: var(--t-xs); }
.rv-acts .act.quiet { border-color: transparent; color: var(--ink-3); }
.rv-in { height: 32px; padding: 0 10px; min-width: 220px; border: 1px solid var(--line); border-radius: var(--r-md); font: inherit; font-size: var(--t-sm); background: var(--surface, #fff); color: var(--ink); }
.rv-in:focus { outline: 2px solid var(--accent, #6EA8FF); outline-offset: 1px; }
.rv-err { margin-top: 8px; font-size: var(--t-sm); color: var(--danger-ink); }
.sub-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sub-tag { padding: 2px 8px; border-radius: 999px; background: var(--sunken); font-size: var(--t-xs); color: var(--ink-2, var(--ink)); white-space: nowrap; }
.sub-tag.on { cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); background: transparent; }
.sub-tag.on:hover { background: var(--sunken); }
.people-bar .fb-note .act { margin-left: 8px; }

/* ------------------------------- team ------------------------------- */
body.cant-sync #syncBtn,
body.cant-people #peopleSyncBtn,
body.cant-people .rv-acts { display: none; }
body.cant-steps .step-chip[data-step] { pointer-events: none; }
.tm-form { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 20px; align-items: center; }
.tm-form input, .tm-form select, .tm-sel {
  font: inherit; font-size: var(--t-sm); padding: 7px 10px; border: 1px solid var(--line, #E3E3EA);
  border-radius: 8px; background: var(--surface, #fff); color: var(--ink);
}
.tm-form input { min-width: 0; flex: 1 1 180px; }
.tm-link { padding: 0 20px 16px; font-size: var(--t-sm); color: var(--ink-2); }
.tm-link code { display: block; margin-top: 6px; padding: 8px 10px; background: var(--sunken); border-radius: 8px; font-family: var(--mono); font-size: 12px; word-break: break-all; user-select: all; }
.tm-err { padding: 0 20px 14px; font-size: var(--t-sm); color: var(--danger-ink); }
.tm-err:empty { display: none; }
.tm-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tm-off td { opacity: 0.55; }
.au-row { display: grid; grid-template-columns: 120px 1fr; gap: 4px 14px; padding: 10px 20px; border-top: 1px solid var(--line, #EEEEF2); font-size: var(--t-sm); }
.au-row:first-child { border-top: 0; }
.au-when { color: var(--ink-3); font-family: var(--mono); font-size: 11.5px; padding-top: 2px; }
.au-what b { font-weight: 600; }
@media (max-width: 640px) { .au-row { grid-template-columns: 1fr; } 
.tm-row { cursor: pointer; }
.tm-row:hover td { background: var(--sunken); }
.ac-form { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 20px; }
.ac-form label { font-size: var(--t-sm); font-weight: 500; color: var(--ink-2); margin-top: 4px; }
.ac-form input { font: inherit; font-size: var(--t-sm); height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); outline: 0; }
.ac-form input:focus { border-color: #9DB8EA; box-shadow: 0 0 0 4px rgba(110,168,255,0.16); }
.ac-form .act { align-self: flex-start; margin-top: 6px; }
.ac-msg { font-size: var(--t-sm); }
.ac-msg.ok { color: var(--ok-ink); }
.ac-msg.bad { color: var(--danger-ink); }
.ac-msg:empty { display: none; }
.ac-h { font-size: var(--t-base); font-weight: 600; margin: 8px 0 6px; }
.ac-note { font-size: var(--t-sm); color: var(--ink-3); line-height: 1.5; }
.panel .au-row { padding: 10px 0; }
