/* TeamPulse direction C "Day". Paper, ink, one stroke. See PLAN.md. */

/* ---------- tokens ---------- */
:root {
  --paper: #f6f5f3;
  --sheet: #ffffff;
  --sheet-2: #efeeea;
  --ink: var(--jc-charcoal);
  --ink-2: var(--jc-body);
  --ink-3: #6b6f7a;
  --ink-3-strong: #5b5f6a; /* muted text on a tinted surface: 5.5:1 on --sheet-2 and --stroke-tint */
  --brand-2: var(--jc-charcoal);
  --mark-ink: var(--jc-red-dark);   /* company logo slot: initials on a tint until the real logo lands */
  --mark-tint: var(--jc-red-tint);
  --rule: #e2e0db;
  --rule-2: #cfccc5;
  --stroke: var(--jc-red);
  --stroke-deep: var(--jc-red-deep);
  --stroke-text: var(--jc-red-dark);
  --stroke-tint: var(--jc-red-tint);
  --on-stroke: #ffffff;
  --bad: var(--jc-red-dark);
  --bad-tint: var(--jc-red-tint);
  --good: #1f7a3d;
  --good-tint: #e4f3e9;
  --warn: #7a5d00; /* 5.4:1 on --warn-tint, 6.9:1 on paper; same 46° hue as before, darker */
  --warn-tint: #fbf1c7;

  --font: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
  --rail: 76px;
  --gutter: 40px;
  --r-sheet: 14px;
  --r-btn: 8px;
  --topbar-h: 60px;
  --tabbar-h: 0px;
  --max: 1180px;
}

:root[data-brand="keptstaffed"] {
  --paper: var(--ks-cream);
  --sheet: #fffefa;
  --sheet-2: #efece0;
  --ink: var(--ks-ink);
  --ink-2: var(--ks-body);
  --ink-3: #656a56;
  --ink-3-strong: #5a5f4c; /* 5.3:1 on every Kept Staffed tint */
  --brand-2: var(--ks-olive);
  --mark-ink: var(--ks-olive);
  --mark-tint: #e6e7d9;
  --rule: var(--ks-border);
  --rule-2: #cdc8b0;
  --stroke: var(--ks-teal);
  --stroke-deep: var(--ks-teal-hover);
  --stroke-text: var(--ks-teal-hover);
  --stroke-tint: #e1f0ee;
  /* Urgent red for Kept Staffed: cooler than the site's #a32d12 (hue 11) so it never drifts toward
     terracotta next to the teal strokes; the tint is mixed from it on white. */
  --bad: #9b2420;
  --bad-tint: #f5e9e9;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--font);
  font-optical-sizing: auto;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: var(--tabbar-h);
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
svg { display: inline-block; vertical-align: middle; }
.nav-icon, .icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--stroke); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: 8px; top: -40px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: var(--r-btn); z-index: 100; }
.skip-link:focus { top: 8px; }

.ink { color: var(--ink); }
.muted { color: var(--ink-3); }
.bad { color: var(--bad); }
.good { color: var(--good); }
.num {
  font-weight: 700;
  color: var(--brand-2);
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ---------- top bar ---------- */
.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 20px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  white-space: nowrap;
  line-height: 1.1;
}
.wordmark-text { display: flex; flex-direction: column; align-items: flex-start; }
/* The company's logo slot: a quiet rounded square with the company initials in the company color.
   The real logo replaces the initials once a company uploads one; it changes with the company switch. */
.company-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--mark-tint);
  color: var(--mark-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.wordmark-app { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.wordmark-company { font-size: 11.5px; font-weight: 500; color: var(--ink-3); margin-top: 1px; }
:root[data-brand="keptstaffed"] .wordmark-company { color: var(--brand-2); }
.company-switch {
  display: inline-flex;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  padding: 2px;
  background: var(--sheet);
  flex: none;
}
.company-option {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
}
.company-option:hover { color: var(--ink); }
.company-option.is-current {
  background: var(--brand-2);
  color: #fff;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  height: 100%;
}
.nav-module {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  margin-right: 6px;
}
.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: var(--topbar-h);
  font-weight: 500;
  color: var(--ink-2);
}
.nav-item:hover { color: var(--ink); }
.nav-item[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav-item[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 10px; right: 10px; bottom: 0;
  height: 3px;
  background: var(--stroke);
  border-radius: 2px 2px 0 0;
}
.nav-item .nav-icon { display: none; }
.nav-badge {
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--stroke-deep);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.nav-rule { width: 1px; height: 22px; background: var(--rule-2); margin: 0 8px; }
.nav-soon {
  font-size: 13px;
  color: var(--ink-3);
  padding: 0 10px;
  white-space: nowrap;
}
.nav-soon small, .soon-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: middle;
}
.topbar-end { display: flex; align-items: center; gap: 12px; flex: none; }
.phone-view-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px 6px 8px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-btn);
  background: var(--sheet);
  color: var(--ink-2);
}
.phone-view-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.phone-view-toggle[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--sheet-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  letter-spacing: 0.02em;
}
.avatar-sm { width: 26px; height: 26px; font-size: 12px; }

/* ---------- page shell ---------- */
.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--gutter) 64px;
}
.page:focus { outline: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-btn);
  border: 1px solid var(--rule-2);
  background: var(--sheet);
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn-primary {
  background: var(--stroke-deep);
  border-color: var(--stroke-deep);
  color: var(--on-stroke);
}
.btn-primary:hover { background: var(--stroke-text); border-color: var(--stroke-text); }
:root[data-brand="keptstaffed"] .btn-primary { background: var(--stroke); border-color: var(--stroke); }
:root[data-brand="keptstaffed"] .btn-primary:hover { background: var(--stroke-deep); border-color: var(--stroke-deep); }
.btn-quiet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-btn);
  color: var(--stroke-text);
  font-weight: 500;
  font-size: 14px;
}
.btn-quiet:hover { background: var(--stroke-tint); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-soon { color: var(--ink-3); border-style: dashed; }
.btn-soon:hover { border-color: var(--rule-2); background: var(--sheet-2); color: var(--ink-3-strong); }
.btn-soon .soon-tag { margin-left: 2px; }
.btn-soon-compact { display: none; color: var(--ink-3); padding-left: 6px; padding-right: 6px; }
.btn-soon-compact:hover { background: var(--sheet-2); color: var(--ink-3-strong); }
.btn-soon-compact .soon-tag { margin-left: 2px; }
/* queue and lead rows carry the single quiet "Call, Text later" control at every width; the two
   dashed buttons appear only in the card's action column, next to the RingCentral note */
.queue-actions .btn-soon-compact { display: inline-flex; }
.soon-foot { font-size: 12.5px; color: var(--ink-3); margin-top: 12px; max-width: 60ch; }
.btn .caret { width: 14px; height: 14px; margin-left: -2px; }

/* module cue: shown only where the top bar cannot carry the module label (under 1100px) */
.module-cue { display: none; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin-bottom: 10px; }
.module-cue .module-name { color: var(--ink); }
.module-cue .module-soon { font-weight: 500; }
.module-cue .module-soon .soon-tag { margin-left: 4px; }
.back-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.back-row .module-cue { margin-bottom: 16px; }

/* ---------- chips ---------- */
.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  background: var(--sheet);
  white-space: nowrap;
  line-height: 1.5;
}
.status-chip[data-group="closed"] { color: var(--ink-3); background: transparent; }
.status-chip[data-status="do_not_hire"] { color: var(--bad); border-color: var(--bad); }
.status-chip[data-group="hired"] { color: var(--good); border-color: var(--good); }
.status-chip[data-group="fadv"] { border-color: var(--ink-2); }
.loc-code {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--sheet-2);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
}
.pill-type { background: var(--stroke-tint); color: var(--stroke-text); }
.lang-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  border: 1px solid var(--rule-2);
  border-radius: 4px;
  padding: 0 5px;
}

/* ---------- location filter ---------- */
.loc-filter {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.loc-filter button {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--rule-2);
  background: var(--sheet);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.loc-filter button:hover { border-color: var(--ink-3); color: var(--ink); }
.loc-filter button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.loc-filter .count { font-weight: 700; font-variant-numeric: tabular-nums; }
.loc-filter button[aria-pressed="false"] .count { color: var(--ink-3); }

/* ---------- HOME: the planner ---------- */
.plan { position: relative; }
.plan::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: calc(var(--rail) - 1px);
  width: 1px;
  background: var(--rule-2);
}
.day-head {
  display: grid;
  grid-template-columns: var(--rail) 1fr auto;
  gap: 0 24px;
  align-items: start;
  padding-bottom: 18px;
  position: relative;
}
.leaf {
  background: var(--paper);
  position: relative;
  z-index: 1;
  padding-right: 10px;
  line-height: 1;
  text-align: right;
  width: var(--rail);
}
.leaf-day {
  display: block;
  font-size: 88px;
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 0.86;
  color: var(--brand-2);
  margin-left: -6px;
}
.leaf-wd, .leaf-mo {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.leaf-mo { color: var(--ink-3); }
.day-title {
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1.15;
  padding-top: 6px;
}
.day-line {
  margin-top: 8px;
  max-width: 60ch;
  font-size: 16px;
  color: var(--ink-2);
}
.day-line strong { color: var(--ink); font-weight: 600; }
.day-alert-link { color: var(--stroke-text); font-weight: 500; text-decoration: underline; text-decoration-color: var(--stroke-tint); text-underline-offset: 3px; line-height: 1.2; text-align: left; }
.day-alert-link:hover { text-decoration-color: var(--stroke-text); }
.day-text { grid-column: 2; grid-row: 1; }
.day-score { grid-column: 3; grid-row: 1; }
.day-filter { grid-column: 2 / -1; grid-row: 3; margin-top: 12px; }
.day-score {
  display: flex;
  gap: 28px;
  align-items: flex-end;
  padding-top: 8px;
}
.score { display: flex; flex-direction: column; align-items: flex-start; min-width: 72px; }
.score .num { font-size: 48px; }
.score-label { font-size: 14px; color: var(--ink-3); margin-top: 6px; font-weight: 500; }
.progress {
  grid-column: 2 / -1;
  grid-row: 2;
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  margin-top: 14px;
  overflow: hidden;
}
.progress > span { display: block; height: 100%; background: var(--stroke); border-radius: 2px; }

.block {
  position: relative;
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  gap: 0 24px;
  padding: 14px 0 18px;
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}
.block-rail {
  position: relative;
  text-align: right;
  padding-right: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 24px;
  font-variant-numeric: tabular-nums;
}
.block-rail .rail-sub { display: block; font-weight: 500; color: var(--ink-3); font-size: 12px; line-height: 1.3; margin-top: 2px; }
.block-mark {
  position: absolute;
  top: 0;
  right: -3px;
  width: 5px;
  height: 24px;
  border-radius: 3px;
  background: var(--stroke);
}
.block.is-urgent .block-mark { background: var(--bad); }
.block.is-done .block-mark { background: var(--rule-2); }
/* Compact blocks: the carried task and the done morning check are one line each on desktop, so the
   follow-up queue starts inside the first screen. The check's updates open from the line itself. */
.fold-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  margin: -2px -6px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--ink-2);
  text-align: left;
}
@media (hover: hover) { .fold-toggle:hover { background: var(--sheet); color: var(--ink); } }
.fold-toggle strong { color: var(--ink); font-weight: 600; }
.fold-text { min-width: 0; }
.fold-toggle .caret { width: 14px; height: 14px; flex: none; }
.fold-toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }
.fold-body { margin-top: 2px; }
.block-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 24px;
  flex-wrap: wrap;
}
.block-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  line-height: 24px;
  letter-spacing: -0.01em;
}
.block-count { font-size: 15px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.block-note { font-size: 14px; color: var(--ink-3); margin-left: auto; }
.block-text { margin-top: 6px; max-width: 60ch; color: var(--ink-2); }

/* task rows */
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 24px;
}
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-box {
  width: 20px; height: 20px;
  border: 1.5px solid var(--rule-2);
  border-radius: 6px;
  background: var(--sheet);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.check-box svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 2.6; fill: none; opacity: 0; }
.check input:checked + .check-box { background: var(--stroke-deep); border-color: var(--stroke-deep); }
:root[data-brand="keptstaffed"] .check input:checked + .check-box { background: var(--stroke); border-color: var(--stroke); }
.check input:checked + .check-box svg { opacity: 1; }
.check input:focus-visible + .check-box { outline: 2px solid var(--stroke); outline-offset: 2px; }
.task-title { font-size: 16px; font-weight: 500; color: var(--ink); }
.is-done .task-title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--rule-2); }
.task-sub { font-size: 14px; color: var(--ink-2); }
.task-sub strong { color: var(--ink); font-weight: 600; }
.task-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--stroke-text);
  border-bottom: 1px solid var(--stroke-tint);
}
.task-link:hover { border-color: var(--stroke-text); }
.task-when { font-size: 13px; color: var(--ink-3); margin-left: auto; }
.task-when.bad { color: var(--bad); font-weight: 600; }

/* alerts inside the morning check: one line each, so the done check stays short and the
   follow-up queue lands inside the first desktop screen */
.alert-list { margin-top: 8px; border-top: 1px solid var(--rule); }
.alert-row {
  display: grid;
  grid-template-columns: 10px minmax(120px, 180px) 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}
.alert-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rule-2); }
.alert-row.is-unread .alert-dot { background: var(--stroke); }
.alert-row.is-unread .alert-name, .alert-row.is-unread .alert-text { font-weight: 600; color: var(--ink); }
.alert-row[data-type="fadv_failed"] .alert-text, .alert-row[data-type="drug_positive"] .alert-text { color: var(--bad); }
.alert-row[data-type="fadv_complete"] .alert-text { color: var(--good); }
.alert-row[data-type="fadv_needs_review"] .alert-text { color: var(--warn); }
.alert-name { color: var(--ink); font-weight: 500; }
.alert-name:hover { text-decoration: underline; }
.alert-time { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.alert-list.is-compact { margin-top: 0; border-top: 0; }
.alert-list.is-compact .alert-row { grid-template-columns: 10px minmax(0, 1fr) auto; gap: 2px 10px; }
.alert-list.is-compact .alert-text, .alert-list.is-compact .alert-time { grid-column: 2; }
.alert-list.is-compact .btn-quiet, .alert-list.is-compact .alert-row > span:last-child { grid-column: 3; grid-row: 1 / 4; }

/* follow-up queue */
.queue-group { margin-top: 10px; }
.group-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule-2);
}
.group-title .group-count { color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.queue-group[data-group="overdue"] .group-title { color: var(--bad); }
.queue-group[data-group="overdue"] .group-title .group-count { color: var(--bad); }
.queue-later > summary { cursor: pointer; list-style: none; }
.queue-later > summary::-webkit-details-marker { display: none; }
.queue-later > summary::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--ink-3);
  border-bottom: 1.5px solid var(--ink-3);
  transform: rotate(-45deg);
  margin-right: 8px;
  position: relative;
  top: -2px;
}
.queue-later[open] > summary::before { transform: rotate(45deg); top: -3px; }
.queue-empty { padding: 14px 0; color: var(--ink-3); font-size: 14px; border-bottom: 1px solid var(--rule); }

.queue-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}
.queue-row:hover { background: linear-gradient(90deg, transparent, var(--sheet) 10%, var(--sheet) 90%, transparent); }
.queue-row.is-moved { background: var(--stroke-tint); }
.queue-when { display: flex; flex-direction: column; line-height: 1; }
.queue-days { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.is-overdue .queue-days { color: var(--bad); }
.queue-days-today { font-size: 20px; }
.queue-days-unit { font-size: 12px; color: var(--ink-3); margin-top: 4px; font-weight: 500; }
.is-overdue .queue-days-unit { color: var(--bad); }
.queue-main { min-width: 0; }
.queue-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.queue-name:hover { text-decoration: underline; }
.queue-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-3);
}
.queue-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* new leads */
.lead-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}
.lead-row:hover { background: linear-gradient(90deg, transparent, var(--sheet) 10%, var(--sheet) 90%, transparent); }
.lead-who { font-size: 13px; }
.lead-who.is-mine { color: var(--good); font-weight: 600; }
.lead-who.is-unassigned { color: var(--bad); font-weight: 600; }

/* ---------- APPLICANT dossier ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
  margin-bottom: 16px;
}
.back-link:hover { color: var(--ink); }
.dossier-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 28px;
  align-items: start;
}
.dossier {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-sheet);
  overflow: hidden;
}
.dossier-head {
  padding: 22px 24px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
}
.pill-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; grid-column: 1; grid-row: 1; min-height: 36px; }
.field-picker-toggle {
  grid-column: 2;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  border: 1px solid var(--rule-2);
  background: var(--sheet);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  grid-row: 1 / 3;
  align-self: start;
}
.field-picker-toggle:hover { border-color: var(--ink-3); color: var(--ink); }
.field-picker-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.dossier-name {
  grid-column: 1;
  grid-row: 2;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--ink);
  margin-top: 6px;
  overflow-wrap: anywhere;
}
.identity {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 15px;
}
.identity-line { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.identity-line svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.identity-line span { overflow-wrap: anywhere; }
.dossier-quick {
  grid-column: 1 / -1;
  grid-row: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.dossier-quick .btn-soon { display: none; }
.dossier-quick .btn-soon-compact { display: inline-flex; margin-left: auto; }
.dossier-tabs {
  display: flex;
  gap: 4px;
  padding: 14px 24px 0;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: none;
}
.dossier-tabs::-webkit-scrollbar { display: none; }
.dossier-tab {
  position: relative;
  padding: 8px 10px 12px;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
  flex: none;
}
.dossier-tab:hover { color: var(--ink); }
.dossier-tab[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.dossier-tab[aria-selected="true"]::after {
  content: '';
  position: absolute;
  left: 10px; right: 10px; bottom: -1px;
  height: 3px;
  background: var(--stroke);
  border-radius: 2px 2px 0 0;
}
.dossier-tab .tab-count { color: var(--ink-3); font-weight: 500; margin-left: 4px; font-size: 13px; }
.dossier-tab .tab-short { display: none; }
.dossier-body { padding: 20px 24px 24px; }
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 28px;
}
.field { min-width: 0; }
.field.is-wide { grid-column: 1 / -1; }
.field dt { font-size: 12.5px; font-weight: 500; color: var(--ink-3); margin-bottom: 2px; }
.field dd { font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.field dd .status-chip { vertical-align: middle; }
.field dd.is-empty { color: var(--ink-3); }
.field-note { font-size: 15px; color: var(--ink); }
.field-note .by { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.fadv-mini { display: flex; flex-wrap: wrap; gap: 6px; }
.fadv-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--sheet-2);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
}
.fadv-badge b { font-weight: 700; color: var(--ink); letter-spacing: 0.02em; }
.fadv-badge[data-state="clear"] { background: var(--good-tint); color: var(--good); }
.fadv-badge[data-state="needs_review"] { background: var(--warn-tint); color: var(--warn); }
.fadv-badge[data-state="failed"], .fadv-badge[data-state="positive"] { background: var(--bad-tint); color: var(--bad); }
.fadv-badge[data-state="not_started"] { color: var(--ink-3-strong); }
.dossier-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: var(--sheet-2);
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--ink-2);
}
.dossier-foot .status-control { background: var(--sheet); }

.dossier-aside h2 { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-bottom: 10px; }
.dossier-actions { display: flex; flex-direction: column; gap: 8px; }
.dossier-actions .btn { justify-content: flex-start; width: 100%; }

/* FADV tab */
.fadv-list { border-top: 1px solid var(--rule); }
.fadv-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 4px 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  align-items: center;
}
.fadv-key { font-weight: 700; color: var(--ink); letter-spacing: 0.02em; font-size: 14px; }
.fadv-name { color: var(--ink); font-weight: 500; }
.fadv-name small { display: block; color: var(--ink-3); font-size: 13px; font-weight: 400; margin-top: 2px; }
.fadv-state {
  font-size: 13px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--sheet-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.fadv-state[data-state="clear"] { background: var(--good-tint); color: var(--good); }
.fadv-state[data-state="needs_review"] { background: var(--warn-tint); color: var(--warn); }
.fadv-state[data-state="failed"], .fadv-state[data-state="positive"] { background: var(--bad-tint); color: var(--bad); }
.fadv-state[data-state="not_started"] { color: var(--ink-3-strong); }
.fadv-extra { margin-top: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* timeline tab */
.note-composer { display: flex; gap: 8px; margin-bottom: 18px; }
.note-composer input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-btn);
  background: var(--paper);
}
.timeline { position: relative; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 1px; background: var(--rule-2); }
.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
}
.tl-glyph {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--sheet);
  border: 1px solid var(--rule-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  position: relative;
  z-index: 1;
}
.tl-glyph svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tl-item[data-kind="status"] .tl-glyph { background: var(--ink); border-color: var(--ink); color: #fff; }
.tl-item[data-kind="fadv"] .tl-glyph { background: var(--stroke-tint); border-color: var(--stroke-tint); color: var(--stroke-text); }
.tl-text { color: var(--ink); font-size: 15px; }
.tl-item[data-kind="status"] .tl-text { font-weight: 600; }
.tl-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* documents tab */
.doc-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.doc-icon {
  width: 36px; height: 44px;
  border: 1px solid var(--rule-2);
  border-radius: 4px;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-3);
  background: var(--paper);
}
.doc-name { font-weight: 500; color: var(--ink); }
.doc-meta { font-size: 13px; color: var(--ink-3); }

/* ---------- popover / sheet ---------- */
.popover-backdrop {
  position: fixed; inset: 0;
  z-index: 40;
  background: transparent;
}
.popover-backdrop.is-passive { pointer-events: none; }
.popover {
  position: absolute;
  z-index: 41;
  min-width: 260px;
  max-width: min(420px, calc(100vw - 24px));
  background: var(--sheet);
  border: 1px solid var(--rule-2);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 0 var(--rule);
}
.popover-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.popover-close { margin-top: 8px; color: var(--ink-3); }
.menu { display: flex; flex-direction: column; gap: 2px; max-height: min(56vh, 460px); overflow: auto; }
.avatar.is-none { color: var(--ink-3); background: transparent; border: 1px dashed var(--rule-2); }
.alert-seen { margin-top: 6px; }
.alert-seen > summary { cursor: pointer; list-style: none; font-size: 13px; color: var(--ink-3); border-bottom: 0; padding-bottom: 2px; }
.alert-seen > summary::-webkit-details-marker { display: none; }
.alert-seen > summary::before { content: ''; display: inline-block; width: 6px; height: 6px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(-45deg); margin-right: 8px; position: relative; top: -2px; }
.alert-seen[open] > summary::before { transform: rotate(45deg); top: -3px; }
.alert-seen .alert-list { margin-top: 4px; }
.menu-group { font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 8px 10px 4px; }
.menu-item, .status-option, .field-picker-option, .assign-option, .next-option, .touch-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 15px;
}
.menu-item:hover, .status-option:hover, .field-picker-option:hover, .assign-option:hover, .next-option:hover, .touch-option:hover { background: var(--paper); }
.status-option[aria-checked="true"], .assign-option[aria-checked="true"] { background: var(--stroke-tint); color: var(--stroke-text); font-weight: 600; }
.status-option[data-status="do_not_hire"] { color: var(--bad); }
.field-picker-option .check-box { margin-right: 2px; }
.field-picker-option[aria-pressed="true"] .check-box { background: var(--stroke-deep); border-color: var(--stroke-deep); }
:root[data-brand="keptstaffed"] .field-picker-option[aria-pressed="true"] .check-box { background: var(--stroke); border-color: var(--stroke); }
.field-picker-option[aria-pressed="true"] .check-box svg { opacity: 1; }
.field-picker .menu { max-height: 56vh; }
.picker-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-3); }
.touch-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.touch-option { justify-content: center; border: 1px solid var(--rule-2); font-weight: 500; }
.popover textarea, .popover input[type="date"], .popover input[type="text"] {
  width: 100%;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-btn);
  background: var(--paper);
  resize: vertical;
}
.popover .row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* ---------- MESSAGES ---------- */
.messages {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-sheet);
  height: calc(100vh - var(--topbar-h) - 56px);
  min-height: 520px;
  overflow: hidden;
}
.conv-list { border-right: 1px solid var(--rule); display: flex; flex-direction: column; min-height: 0; }
.conv-head { padding: 18px 20px 10px; }
.conv-head h1 { font-size: 22px; font-weight: 600; color: var(--ink); letter-spacing: -0.015em; }
.conv-head p { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.conv-scroll { overflow: auto; flex: 1; padding: 0 10px 10px; }
.conv-section { font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 12px 10px 4px; }
.conversation-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 10px;
  border-radius: 10px;
}
.conversation-item:hover { background: var(--paper); }
.conversation-item.is-current { background: var(--stroke-tint); }
.conv-glyph {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--sheet-2);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  grid-row: 1 / 3;
}
.conversation-item.is-current .conv-glyph { background: var(--stroke-deep); color: var(--on-stroke); } /* red-deep: 5.06:1 with white */
:root[data-brand="keptstaffed"] .conversation-item.is-current .conv-glyph { background: var(--stroke); }
.conv-name { font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-item.has-unread .conv-name { font-weight: 700; }
.conv-preview { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; grid-column: 2 / -1; }
/* on the selected item's tint the muted text needs the darker muted (5.6:1 in JCruz) */
.conversation-item.is-current .conv-preview, .conversation-item.is-current .conv-time { color: var(--ink-3-strong); }
.conv-unread {
  min-width: 20px; height: 20px;
  border-radius: 999px;
  background: var(--stroke-deep);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}
:root[data-brand="keptstaffed"] .conv-unread, :root[data-brand="keptstaffed"] .nav-badge { background: var(--stroke); }
.conv-time { font-size: 12px; color: var(--ink-3); }

.thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.thread-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--rule);
}
.thread-back { display: none; }
.thread-title { font-size: 17px; font-weight: 600; color: var(--ink); }
.thread-members { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-scroll { flex: 1; overflow: auto; padding: 12px 20px; min-height: 0; }
/* once scrolled, a message that straddles the top edge fades under the header instead of being
   sliced; at the top of the thread nothing is faded */
.thread-scroll.is-scrolled {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 36px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 36px);
}
.day-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  margin: 14px 0 8px;
  scroll-margin-top: 16px;
}
.day-sep::before, .day-sep::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.unread-sep { color: var(--stroke-text); }
.unread-sep::before, .unread-sep::after { background: var(--stroke); }
.message {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 2px 12px;
  padding: 7px 0;
}
.message .avatar { grid-row: 1 / 3; margin-top: 2px; }
.msg-head { display: flex; align-items: baseline; gap: 10px; }
.msg-author { font-weight: 600; color: var(--ink); font-size: 14.5px; }
.msg-time { font-size: 12px; color: var(--ink-3); }
.msg-text { color: var(--ink); overflow-wrap: anywhere; }
.message.is-mine .msg-author { color: var(--stroke-text); }
.applicant-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 6px 0 0;
  padding: 4px 10px 4px 6px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--paper);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.applicant-chip:hover { border-color: var(--stroke); color: var(--stroke-text); }
.applicant-chip .avatar-sm { width: 22px; height: 22px; font-size: 11px; }
.applicant-chip .chip-status { color: var(--ink-3); font-weight: 400; }
.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--rule);
  background: var(--sheet);
}
.composer-input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 140px;
  padding: 10px 12px;
  border: 1px solid var(--rule-2);
  border-radius: 10px;
  background: var(--paper);
  resize: none;
  line-height: 1.4;
}
.composer-input:focus { border-color: var(--ink-3); outline: none; }
.composer-input:focus-visible { outline: 2px solid var(--stroke); }

/* ---------- DASHBOARD briefing ---------- */
.brief-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
}
.brief-head h1 { font-size: 30px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; line-height: 1.1; }
.brief-head h1 small { display: block; font-size: 14px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; margin-bottom: 6px; }
.brief-intro { max-width: 60ch; font-size: 16px; color: var(--ink-2); margin-top: 10px; }
.brief-section { padding: 28px 0 8px; border-top: 1px solid var(--rule-2); margin-top: 24px; }
.brief-section:first-of-type { border-top: 0; margin-top: 12px; }
.brief-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.015em;
}
.brief-title::before { content: ''; width: 5px; height: 22px; border-radius: 3px; background: var(--stroke); }
.brief-title small { font-size: 14px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.brief-line { max-width: 64ch; font-size: 17px; color: var(--ink-2); margin: 10px 0 20px 17px; line-height: 1.45; }
.brief-line strong { color: var(--ink); font-weight: 600; }
.brief-grid { display: grid; grid-template-columns: 180px repeat(2, minmax(0, 1fr)); gap: 24px 36px; margin-left: 17px; }
.brief-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.figure .num { font-size: 56px; display: block; }
.figure .figure-label { font-size: 14px; color: var(--ink-3); margin-top: 6px; }
.fig-title { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-bottom: 10px; }
.bars { display: grid; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.bar-row .bar-label { color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row svg { width: 100%; height: 12px; display: block; }
.bar-row rect { fill: var(--brand-2); }
.bar-row .bar-val { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-row .delta { color: var(--ink-3); font-weight: 500; font-size: 12.5px; margin-left: 4px; }
.bar-row .delta.up { color: var(--good); }
.bar-row .delta.down { color: var(--bad); }
.fadv-figures { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 22px 0 0 17px; }
.fadv-fig .num { font-size: 36px; display: block; }
.fadv-fig .figure-label { font-size: 13.5px; color: var(--ink-3); margin-top: 4px; }
.fadv-fig[data-tone="warn"] .num { color: var(--warn); }
.fadv-fig[data-tone="bad"] .num { color: var(--bad); }
.fadv-fig[data-tone="good"] .num { color: var(--good); }
.funnel { margin: 22px 0 0 17px; }
.funnel svg { width: 100%; height: 18px; display: block; }
.funnel-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.funnel-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.funnel-closed { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 36px; margin: 24px 0 0 17px; }
.holdup-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 2px 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.holdup-days { font-size: 20px; font-weight: 700; color: var(--bad); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.holdup-days small { font-size: 11px; font-weight: 500; color: var(--ink-3); display: block; letter-spacing: 0; }
.holdup-name { font-weight: 600; color: var(--ink); }
.holdup-name:hover { text-decoration: underline; }
.holdup-reason { font-size: 13.5px; color: var(--ink-2); grid-column: 2; }
.brief-table { width: calc(100% - 17px); border-collapse: collapse; margin: 20px 0 0 17px; font-size: 14.5px; } /* ends on the same right edge as the other blocks */
.two-col .brief-table { width: 100%; }
.brief-table th, .brief-table td { text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.brief-table th { font-weight: 600; color: var(--ink-3); font-size: 13px; }
.brief-table th:first-child, .brief-table td:first-child { text-align: left; padding-left: 0; font-weight: 600; color: var(--ink); }
.brief-table td.lead { font-weight: 700; color: var(--ink); }
.brief-table td.worst { color: var(--bad); font-weight: 600; }
.brief-table td.zero { color: var(--ink-3); }
.brief-table .row-sub { font-weight: 400; color: var(--ink-3); font-size: 12.5px; display: block; }
.brief-note { font-size: 13px; color: var(--ink-3); margin: 10px 0 0 17px; }

/* ---------- APPLICANTS list ---------- */
.list-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.list-head h1 { font-size: 30px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; }
.list-head p { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--sheet);
  width: min(360px, 100%);
}
.search input { border: 0; background: none; flex: 1; min-width: 0; outline: none; }
/* the pill carries the ring, since the input's own outline is off */
.search:focus-within { outline: 2px solid var(--stroke); outline-offset: 2px; }
.search svg { color: var(--ink-3); }
.loc-group { margin-top: 22px; }
.loc-group h2 { font-size: 16px; font-weight: 600; color: var(--ink); padding-bottom: 8px; border-bottom: 1px solid var(--rule-2); display: flex; gap: 8px; align-items: baseline; }
.loc-group h2 span { color: var(--ink-3); font-weight: 600; font-size: 14px; }
.applicant-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) auto minmax(0, 1fr) auto auto;
  gap: 8px 16px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-3);
}
.applicant-row:hover { background: linear-gradient(90deg, transparent, var(--sheet) 10%, var(--sheet) 90%, transparent); }
.applicant-row .name { font-weight: 600; color: var(--ink); font-size: 15px; }
.applicant-row .name:hover { text-decoration: underline; }

/* ---------- phone view stage ---------- */
.phone-stage { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 8px; }
.phone-stage-note { font-size: 14px; color: var(--ink-3); max-width: 60ch; text-align: center; }
.device {
  padding: 12px;
  background: var(--ink);
  border-radius: 44px;
  box-shadow: inset 0 0 0 2px #3a3d47;
}
.phone-frame { display: block; width: 390px; height: 844px; border: 0; border-radius: 32px; background: var(--paper); }

/* ---------- toasts ---------- */
/* Desktop: top right, just under the top bar, so the bar's controls stay clickable and no queue row
   is covered. Phone: above the tab bar (and at the top while a bottom sheet is open). The toast body
   lets taps through; only Dismiss catches them. */
.toast-stack {
  position: fixed;
  right: 16px;
  top: calc(var(--topbar-h) + 8px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 50;
  width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.toast button { pointer-events: auto; color: #fff; opacity: 0.75; font-size: 13px; font-weight: 600; }
.toast button:hover { opacity: 1; }

.empty { color: var(--ink-3); padding: 24px 0; }
.not-found { text-align: left; padding: 40px 0; }
.not-found h1 { font-size: 26px; color: var(--ink); font-weight: 600; margin-bottom: 8px; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .queue-row.is-moved { animation: settle 1.6s ease-out forwards; }
  @keyframes settle { from { background: var(--stroke-tint); } to { background: transparent; } }
  .toast { animation: toast-in 180ms ease-out; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  .popover.is-sheet { animation: sheet-in 200ms ease-out; }
  @keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* ---------- ≥ 720: phone view control, compact one-line blocks ---------- */
@media (min-width: 720px) {
  .phone-view-toggle { display: inline-flex; }
  :root[data-frame="1"] .phone-view-toggle { display: none; }
  .block.is-compact { padding: 6px 0 8px; }
}
/* from 900 the compact rows stay on one line and a long title ends in an ellipsis; narrower, they wrap */
@media (min-width: 900px) {
  .block.is-compact .task-row { flex-wrap: nowrap; }
  .block.is-compact .check { min-width: 0; flex: 0 1 auto; }
  .block.is-compact .task-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .block.is-compact .task-link, .block.is-compact .task-when, .block.is-compact .fold-toggle { flex: none; }
}

/* ---------- tablet 720–1199 (the full-width bar, with the logo slot, needs 1200 to fit the 40 px gutters) ---------- */
@media (max-width: 1199px) {
  :root { --gutter: 24px; }
  .topbar-inner { gap: 12px; }
  .nav-module, .nav-soon { display: none; }
  .module-cue { display: flex; }
  .nav-item { padding: 0 9px; }
  .nav-item[aria-current="page"]::after { left: 9px; right: 9px; }
  .phone-view-toggle { padding: 7px 8px; }
  .phone-view-toggle span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dossier-layout { grid-template-columns: minmax(0, 1fr); }
  .dossier-actions { flex-direction: row; flex-wrap: wrap; }
  .dossier-actions .btn { width: auto; }
  .brief-grid { grid-template-columns: 1fr 1fr; }
  .brief-grid .figure { grid-column: 1 / -1; }
  .queue-row { grid-template-columns: 84px minmax(0, 1fr); }
  .queue-actions { grid-column: 2; justify-content: flex-start; }
  /* lead rows have no days column: the name keeps the full width and the actions sit under it */
  .lead-row { grid-template-columns: minmax(0, 1fr); }
  .lead-row .queue-actions { grid-column: 1; }
}

/* ---------- 720–899: icon nav ---------- */
/* The bar cannot hold four labels plus the company switch below 900 px, so the nav is icons only here
   (labels stay for screen readers and as tooltips). The Phone view control is icon-only here too. */
@media (min-width: 720px) and (max-width: 899px) {
  .nav-item { padding: 0 10px; }
  .nav-item .nav-icon { display: block; width: 22px; height: 22px; }
  .nav-item .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-item[aria-current="page"]::after { left: 10px; right: 10px; }
  .nav-badge { position: absolute; top: 9px; left: calc(50% + 4px); }
}

/* ---------- phone < 720 ---------- */
@media (max-width: 719px) {
  :root { --gutter: 16px; --rail: 50px; --topbar-h: 52px; --tabbar-h: 64px; }
  .topbar-inner { gap: 10px; }
  .wordmark { gap: 8px; }
  .wordmark-app { font-size: 16px; }
  .wordmark-company { font-size: 11px; }
  .company-mark { width: 26px; height: 26px; border-radius: 8px; font-size: 11px; }
  .company-switch { margin-left: auto; }
  .module-cue { margin-bottom: 8px; }
  .back-row .module-cue { margin-bottom: 16px; }
  .toast-stack { right: auto; top: auto; left: 50%; bottom: calc(var(--tabbar-h) + 14px); transform: translateX(-50%); align-items: stretch; width: min(480px, calc(100vw - 32px)); }
  /* while a bottom sheet is open, toasts go to the top so they never cover the sheet's rows */
  html:has(.popover.is-sheet) .toast-stack { top: calc(var(--topbar-h) + 8px); bottom: auto; }
  .company-option { padding: 5px 10px; font-size: 12px; }
  .topbar-end .viewer-avatar { display: none; }
  .phone-view-toggle { display: none; }

  /* nav becomes the tab bar */
  .main-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: var(--tabbar-h);
    margin: 0;
    padding: 0 4px calc(env(safe-area-inset-bottom, 0px));
    background: var(--sheet);
    border-top: 1px solid var(--rule);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    z-index: 30;
  }
  .nav-module, .nav-rule, .nav-soon { display: none; }
  .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    height: 100%;
    padding: 4px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-3);
  }
  .nav-item .nav-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .nav-item .nav-icon { display: block; }
  .nav-item[aria-current="page"] { color: var(--stroke-text); }
  .nav-item[aria-current="page"]::after { top: 0; bottom: auto; left: 22%; right: 22%; border-radius: 0 0 2px 2px; }
  .nav-badge { position: absolute; top: 6px; left: calc(50% + 6px); }

  .page { padding: 20px var(--gutter) 40px; }

  /* home */
  .day-head { grid-template-columns: var(--rail) minmax(0, 1fr); gap: 0 16px; padding-bottom: 20px; }
  .leaf { padding-right: 8px; }
  .leaf-day { font-size: 56px; margin-left: -2px; }
  .leaf-wd, .leaf-mo { font-size: 12.5px; }
  .day-title { font-size: 20px; padding-top: 4px; }
  .day-line { font-size: 15px; }
  /* the updates link is its own 40 px tap line (the text sits centered in it) */
  .day-alert-link { display: flex; align-items: center; min-height: 40px; margin: -4px 0 -8px; }
  .day-text { grid-column: 2; grid-row: 1; }
  /* done / left on one line so the queue's first row lands inside the first screen */
  .day-score { grid-column: 2; grid-row: 2; padding-top: 12px; gap: 18px; align-items: baseline; }
  .score { flex-direction: row; align-items: baseline; gap: 6px; min-width: 0; }
  .score .num { font-size: 30px; }
  .score-label { margin-top: 0; font-size: 13.5px; }
  .progress { grid-column: 2; grid-row: 3; margin-top: 10px; }
  .day-filter { grid-column: 2; grid-row: 4; margin-top: 14px; min-width: 0; }
  .day-head { padding-bottom: 12px; }
  /* the location chips scroll sideways in one row instead of wrapping to two; the row runs to the
     screen edge with a paper fade there, and a gutter inside the scroller, so the cut reads as
     "more to the right" and the last chip is whole once scrolled */
  .home-loc-filter {
    display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-right: calc(-1 * var(--gutter)); padding-right: 40px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
  }
  .home-loc-filter::-webkit-scrollbar { display: none; }
  .home-loc-filter button { flex: none; }
  .loc-filter button { padding: 6px 10px; font-size: 12.5px; }

  .block { grid-template-columns: var(--rail) minmax(0, 1fr); gap: 0 16px; padding: 12px 0 18px; }
  .block-rail { padding-right: 12px; font-size: 12px; }
  .block-mark { width: 4px; right: -2px; }
  .block-title { font-size: 17px; }
  .block-queue .block-note { display: none; }
  .block-queue .queue-group:first-of-type { margin-top: 8px; }
  .task-row { gap: 6px 12px; }
  .task-row .check { flex: 1 1 100%; align-items: flex-start; }
  .task-row .check-box { margin-top: 2px; }
  .task-title { font-size: 15px; }
  .task-link { margin-left: 30px; }
  .fold-toggle { margin-left: 24px; }
  .task-when { margin-left: auto; }
  .alert-row { grid-template-columns: 10px minmax(0, 1fr) auto; gap: 4px 10px; }
  .alert-row .alert-text { grid-column: 2; }
  .alert-row .alert-time { grid-column: 2; }
  .alert-row .btn-quiet { grid-column: 3; grid-row: 1 / 4; }

  /* queue rows: the first line (name plus days late) is one 44 px link, then one meta line with the
     avatar, one touch line, and one action line of 40 px buttons */
  .queue-row { grid-template-columns: minmax(0, 1fr); gap: 2px 10px; padding: 2px 0 10px; }
  .queue-main { display: contents; }
  .queue-name {
    grid-column: 1 / -1; grid-row: 1;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    min-height: 44px;
    font-size: 16px; line-height: 1.25;
  }
  .queue-name:hover { text-decoration: none; }
  .queue-name:hover .queue-name-text { text-decoration: underline; }
  .queue-name .queue-name-text { min-width: 0; }
  .queue-when { flex: none; flex-direction: row; align-items: baseline; gap: 5px; }
  .queue-days { font-size: 18px; }
  .queue-days-today { font-size: 15px; }
  .queue-days-unit { margin-top: 0; }
  .queue-meta { grid-column: 1 / -1; grid-row: 2; gap: 4px 8px; font-size: 12.5px; margin-top: 0; }
  .queue-meta .avatar-sm { margin-left: auto; width: 24px; height: 24px; font-size: 11.5px; }
  .queue-meta .queue-touch { order: 2; flex: 1 1 100%; }
  .queue-actions { grid-column: 1 / -1; grid-row: 3; justify-content: flex-start; align-items: center; gap: 6px; margin-top: 4px; }
  .queue-actions .btn { padding: 7px 10px; font-size: 13px; min-height: 40px; }
  .queue-actions .btn-quiet { min-height: 40px; }
  .queue-actions .btn-soon { display: none; }
  .queue-actions .btn-soon-compact { display: inline-flex; margin-left: auto; font-size: 12.5px; }
  .lead-row { grid-template-columns: minmax(0, 1fr); }
  .lead-row .queue-actions { justify-content: flex-start; }
  /* an unassigned lead's "Take this lead" gets its own full line above the usual three */
  .lead-row .queue-actions .btn-primary { flex: 1 1 100%; justify-content: center; }
  .lead-row .queue-meta .lead-who { margin-left: auto; }
  .dossier-quick .btn, .dossier-quick .btn-quiet, .dossier-actions .btn { min-height: 40px; }

  /* dossier */
  .dossier-head { padding: 18px 16px 0; grid-template-columns: minmax(0, 1fr) auto; }
  .field-picker-toggle { padding: 0 10px; }
  .field-picker-toggle span { display: none; }
  .dossier-name { font-size: 28px; }
  .identity { flex-direction: column; gap: 6px; }
  .dossier-tabs { padding: 12px 10px 0; gap: 0; }
  .dossier-tab { padding: 8px 8px 12px; font-size: 14px; }
  .dossier-tab[aria-selected="true"]::after { left: 8px; right: 8px; }
  .dossier-tab .tab-long { display: none; }
  .dossier-tab .tab-short { display: inline; }
  .dossier-tab .tab-count { font-size: 12.5px; margin-left: 3px; }
  .dossier-body { padding: 18px 16px 20px; }
  .field-grid { grid-template-columns: 1fr; gap: 14px; }
  .dossier-foot { padding: 12px 16px; }
  .dossier-quick .btn { padding: 8px 12px; font-size: 14px; }
  .dossier-aside { margin-top: 18px; }
  .dossier-actions { flex-direction: row; flex-wrap: wrap; }
  .dossier-actions .btn { width: auto; }
  .fadv-row { grid-template-columns: 56px minmax(0, 1fr); }
  .fadv-row .fadv-state { grid-column: 2; justify-self: start; }
  .fadv-extra { grid-template-columns: 1fr; }

  /* popovers become bottom sheets */
  .popover-backdrop { background: rgba(15, 17, 23, 0.35); }
  .popover {
    position: fixed !important;
    left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important;
    max-width: none;
    border-radius: 16px 16px 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    max-height: 82vh;
    overflow: auto;
  }
  .popover::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--rule-2); margin: -4px auto 12px; }

  /* messages: list → thread */
  .messages {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100vh - var(--topbar-h) - var(--tabbar-h) - 24px);
    min-height: 420px;
    border-radius: 12px;
  }
  .messages:not(.is-thread) .thread { display: none; }
  .messages:not(.is-thread) { height: auto; min-height: 0; }
  .messages:not(.is-thread) .conv-scroll { overflow: visible; }
  .messages.is-thread .conv-list { display: none; }
  .conv-list { border-right: 0; }
  .thread-back { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; color: var(--ink); margin-left: -8px; }
  .thread-back:hover { background: var(--paper); }
  .thread-head { padding: 10px 14px; }
  .thread-scroll { padding: 8px 14px; }
  .composer { padding: 10px 12px 12px; }

  /* dashboard */
  .brief-head h1 { font-size: 26px; }
  .brief-title { font-size: 20px; }
  .brief-line { font-size: 15.5px; margin-left: 0; }
  .brief-grid, .brief-grid.two, .two-col { grid-template-columns: 1fr; margin-left: 0; gap: 20px; }
  .figure .num { font-size: 48px; }
  .fadv-figures { grid-template-columns: repeat(3, 1fr); margin-left: 0; gap: 14px 8px; }
  .fadv-fig .num { font-size: 30px; }
  .funnel { margin-left: 0; }
  .brief-table { margin-left: 0; width: 100%; display: block; }
  .brief-table thead { display: none; }
  .brief-table tbody, .brief-table tr { display: block; }
  .brief-table tr { padding: 10px 0 6px; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .brief-table td { display: block; text-align: left; padding: 0; border: 0; }
  .brief-table td:first-child { grid-column: 1 / -1; font-size: 16px; }
  /* every label cell is two lines tall so the values beside each other share a baseline */
  .brief-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-3); line-height: 1.3; min-height: 30px; }
  .brief-table td.lead::before, .brief-table td.worst::before, .brief-table td.zero::before { color: var(--ink-3); font-weight: 500; }
  .brief-note { margin-left: 0; }

  /* applicants */
  .applicant-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; padding: 11px 0; align-items: center; }
  .applicant-row .avatar { grid-column: 1; grid-row: 1 / 3; }
  .applicant-row .name { grid-column: 2; grid-row: 1; }
  .applicant-row .status-chip { grid-column: 3; grid-row: 1; justify-self: end; }
  .applicant-row .row-type { grid-column: 2; grid-row: 2; font-size: 13px; }
  .applicant-row .row-next { grid-column: 3; grid-row: 2; justify-self: end; font-size: 13px; }
}

@media (max-width: 400px) {
  .company-option { padding: 5px 8px; font-size: 11.5px; }
  .queue-actions .btn { padding: 6px 8px; font-size: 12.5px; min-height: 40px; }
  .queue-actions .btn-soon-compact { padding: 6px 2px 6px 4px; font-size: 12px; gap: 4px; min-height: 40px; }
  .queue-actions .btn-soon-compact .soon-tag { padding: 1px 5px; font-size: 12px; margin-left: 0; }
  .fadv-figures { grid-template-columns: repeat(3, 1fr); }
}
