/* ============================================================
   FAIRWORK — EMPLOYER PORTAL
   Aesthetic: Industrial utility. Dense, functional, trustworthy.
   Fonts: DM Mono (data) + DM Sans (UI)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,500;8..60,600;8..60,700&display=swap');

/* ── TOKENS ──
   Premium legal / editorial: warm ivory paper, warm ink, one oxblood
   accent. Colour appears as dots, rules and text — never paint buckets.
   Serif for display (titles), sans for UI, mono ONLY for data. */
:root {
  --ink:        #171511;
  --ink-2:      #36322a;
  --ink-3:      #6e675a;
  --ink-4:      #9d9587;
  --line:       #e6e2d6;
  --line-2:     #f0ede4;
  --paper:      #faf9f4;
  --white:      #ffffff;

  --red:        #a83a2e;
  --red-bg:     #f9f1ef;
  --red-line:   #e0c0b8;
  --amber:      #936700;
  --amber-bg:   #f8f3e6;
  --amber-line: #ddcda0;
  --green:      #2e6b4b;
  --green-bg:   #eff4ef;
  --green-line: #bdd5c4;
  --blue:       #2d4a6b;
  --blue-bg:    #eef1f5;
  --blue-line:  #c0cbd9;

  --accent:      #7d2a2a;   /* oxblood — the single product accent */
  --accent-dark: #621f1f;

  --nav-w:      240px;
  --radius:     3px;
  --radius-lg:  4px;
  --mono:       'DM Mono', monospace;
  --sans:       'DM Sans', sans-serif;
  --serif:      'Source Serif 4', Georgia, serif;
  --shadow:     0 1px 2px rgba(23,21,17,.05);
  --shadow-lg:  0 6px 20px rgba(23,21,17,.10);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
}

/* ── FORM CONTROLS — one consistent editorial control everywhere,
   including the previously-raw date/time pickers ── */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"],
input[type="tel"], select, textarea {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  accent-color: var(--accent);
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus,
input[type="number"]:focus, input[type="date"]:focus, input[type="time"]:focus,
input[type="tel"]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink-3);
  box-shadow: 0 0 0 2px rgba(125, 42, 42, .08);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* ── LAYOUT ── */
#nav {
  width: var(--nav-w);
  min-height: 100vh;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
}

#main {
  margin-left: var(--nav-w);
  flex: 1;
  /* min-width:0 matters: #main is a flex item, so without it any nowrap
     descendant (a one-line complaint summary, a wide chip row) sets the
     page's min-content width and the whole app overflows the viewport on
     phones instead of truncating/wrapping inside its own card. */
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── NAV ── */
.nav-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.nav-brand-name {
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 500;
  color: #fff;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.nav-brand-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -.01em;
}
/* Wordmark: the "AI" inside f-AI-rwork is the brand blue, rest inherits white */
.brand-ai { color: var(--blue); }

.nav-links {
  flex: 1;
  padding: 12px 0;
  list-style: none;
}
.nav-links li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: color .15s, background .15s;
  border-left: 2px solid transparent;
}
.nav-links li a:hover {
  color: #fff;
  background: rgba(255,255,255,.05);
}
.nav-links li a.active {
  color: #fff;
  border-left-color: var(--accent);
  border-left-width: 3px;
  background: rgba(255,255,255,.06);
}
.nav-links li a svg {
  width: 16px; height: 16px;
  opacity: .7;
  flex-shrink: 0;
}
.nav-links li a.active svg { opacity: 1; }

/* Recruit nav item: visible (so the product is known) but not yet live —
   dimmed, no hover feedback, cursor communicates it isn't clickable. */
.nav-links li a.nav-soon { cursor: default; opacity: .55; }
.nav-links li a.nav-soon:hover { color: rgba(255,255,255,.55); background: none; }
.nav-soon-badge {
  margin-left: auto;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.75);
  padding: 2px 7px;
  border-radius: 100px;
}

/* Owner-only affordances (Team + Settings nav, the Team view) collapse entirely
   for a manager. Presentation only — every owner-only endpoint is gated 403/404
   server-side; this just keeps the manager's UI to what they can act on. The
   body class is set in applyRoleGating() once /my_org returns the role. */
body.role-manager .owner-only { display: none !important; }

/* ── Head Office (owner console overview) ──────────────────────────────────
   Headline number tiles + a two-column widget row. Numbers use the serif
   display face like .p-stat; tiles wrap responsively. */
.ho-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.ho-tile {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 16px 18px;
}
.ho-tile-num { font-size: 1.7rem; font-weight: 600; font-family: var(--serif); line-height: 1.1; }
.ho-tile-label { font-size: .75rem; color: var(--ink-4); margin-top: 4px; }
.ho-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.ho-two-col .card { margin-bottom: 0 !important; }

/* Owner console is view-only on operational detail reached via the Pushed
   inbox: hide action affordances inside the detail renderers. The server still
   enforces the gate; this prevents accidental edits. Marked-up action wrappers
   opt in with .owner-hide-action (added on the detail action rows). */
body.owner-readonly .owner-hide-action { display: none !important; }

/* Active-site switcher (multi-site managers) — lives in the page header. */
.site-switcher { display: inline-flex; align-items: center; gap: 8px; }
.site-switcher > span {
  font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-4);
}
.site-switcher select {
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px;
  font: inherit; font-size: .85rem; background: var(--paper); cursor: pointer;
}

.nav-section-label {
  font-family: var(--mono);
  font-size: .65rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.25);
  padding: 16px 20px 6px;
}

.nav-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .75rem;
  color: rgba(255,255,255,.3);
  font-family: var(--mono);
}

/* ── PAGE HEADER ── */
.page-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-title {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.01em;
}
.page-subtitle {
  font-size: .8rem;
  color: var(--ink-4);
  margin-top: 2px;
}

/* ── PAGE BODY ── */
.page-body {
  flex: 1;
  padding: 28px 32px 110px;   /* bottom clearance: the floating Check button must never cover content */
  max-width: 1100px;
}

/* ── VIEWS ── */
.view { display: none; }
.view.active { display: block; }

/* ── CARDS — ledger style: hairline frame, 2px ink top-rule ── */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 16px;
}

/* ── STATS BANNER ── */
.stats-banner {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.stats-banner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.stats-banner-title {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.stats-banner-source {
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--ink-4);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stat-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--paper);
}
.stat-box.red    { background: var(--white); border-top: 2px solid var(--red); }
.stat-box.amber  { background: var(--white); border-top: 2px solid var(--amber); }
.stat-box.green  { background: var(--white); border-top: 2px solid var(--green); }
.stat-value {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-box.red   .stat-value { color: var(--red); }
.stat-box.amber .stat-value { color: var(--amber); }
.stat-box.green .stat-value { color: var(--green); }
.stat-label {
  font-size: .7rem;
  font-weight: 600;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 2px;
}
.stat-sub {
  font-size: .7rem;
  color: var(--ink-4);
}

/* ── RISK BADGE — coloured dot + small caps text, no pill ── */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.risk-badge.high   { color: var(--red); }
.risk-badge.medium { color: var(--amber); }
.risk-badge.low    { color: var(--green); }
.risk-badge::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
/* Deadline (contestability-window) chip: rendered beside the risk badge, so
   it must not repeat the risk dot, and "4 days left" must never wrap into a
   two-line pill. Its urgency colouring is inline (mattersTableHtml). */
.risk-badge.dl-chip { white-space: nowrap; padding: 1px 7px; border: 1px solid; border-radius: 9px; }
.risk-badge.dl-chip::before { display: none; }

/* ── Row overflow menu (⋯) — rowMenuHtml(), one quick action per row ── */
.row-menu { position: relative; display: inline-flex; }
.row-menu-btn { min-width: 34px; padding-left: 10px; padding-right: 10px; font-weight: 700; }
.row-menu-pop {
  display: none;
  position: absolute; top: calc(100% + 4px); right: 0;
  min-width: 190px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 15, 8, .12);
  padding: 4px;
  z-index: 60;
  flex-direction: column;
  text-align: left;
}
.row-menu-pop.open { display: flex; }
.row-menu-pop.up { top: auto; bottom: calc(100% + 4px); }
.row-menu-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; border-radius: 6px;
  padding: 8px 10px; font: inherit; font-size: .82rem; color: var(--ink-2);
  cursor: pointer; white-space: nowrap;
}
.row-menu-item:hover { background: var(--paper); color: var(--ink); }
.row-menu-item.danger { color: #c0392b; }
.row-menu-item.danger:hover { background: #fbeceb; }

/* ── TYPE BADGE — typographic label ── */
.type-badge {
  display: inline-block;
  padding: 0;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.type-badge.performance    { color: var(--blue); }
.type-badge.conduct        { color: var(--amber); }
.type-badge.serious_misconduct { color: var(--red); }
.type-badge.attendance     { color: #6b4a8f; }
.type-badge.redundancy     { color: var(--ink-3); }
.type-badge.casual_cessation { color: #2a7d6f; }
.type-badge.general_protections_risk { color: var(--red); }
.type-badge.unclear        { color: var(--ink-3); }

/* ── SITUATION INPUT ── */
.situation-box {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}
.situation-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: -.01em;
}
.situation-hint {
  font-size: .8rem;
  color: var(--ink-4);
  margin-bottom: 16px;
}
.situation-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: .9rem;
  color: var(--ink);
  resize: vertical;
  background: var(--paper);
  transition: border-color .15s;
  line-height: 1.6;
}
.situation-textarea:focus {
  outline: none;
  border-color: var(--ink-2);
  background: var(--white);
}
.situation-textarea::placeholder { color: var(--ink-4); }

.profile-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}
/* Who-row: two-up on desktop. Replaces an inline grid-template-columns that
   outranked the ≤600px single-column collapse and kept it two-up on phones;
   as a class it ties on specificity, so the later `.profile-row{1fr}` in the
   600px block wins there. */
.profile-row-2 { grid-template-columns: 1fr 1fr; }

/* Mobile intake stepper — neutral on desktop: .intake-section stays a plain
   block (every section visible) and the footer nav is hidden. The ≤600px block
   flips this into a one-section-at-a-time paced flow. */
.intake-stepnav { display: none; }
.field-group label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.field-group select,
.field-group input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: .875rem;
  color: var(--ink);
  background: var(--paper);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .15s;
}
.field-group select:focus,
.field-group input:focus {
  outline: none;
  border-color: var(--ink-2);
  background: var(--white);
}

.gp-warning {
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .8rem;
  color: var(--ink-2);
  margin-top: 12px;
  display: none;
}
.gp-warning.visible { display: flex; gap: 8px; align-items: flex-start; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: var(--white);
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--ink-4);
}
.btn-secondary:hover { background: var(--paper); border-color: var(--ink-2); }
.btn-sm {
  padding: 6px 12px;
  font-size: .8rem;
}
.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-line);
}
.btn-danger:hover { background: #fae5e2; }
.btn-full { width: 100%; justify-content: center; margin-top: 16px; }
.btn svg { width: 14px; height: 14px; }
.btn:disabled, .btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── TOASTS (transient feedback, bottom-right) ── */
.toast {
  position: fixed;
  bottom: 80px;
  right: 28px;
  background: var(--ink);
  color: var(--white);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: .825rem;
  z-index: 400;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease;
}
.toast-error {
  background: var(--red);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Undo toast — bottom-LEFT (clear of the floating Check button), ~5s, with a
   one-tap reversal of a lasting action. */
.toast-undo {
  left: 28px;
  right: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-right: 8px;
}
.toast-undo-btn {
  background: none;
  border: none;
  color: #e8c39a;
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 6px;
  flex-shrink: 0;
}
.toast-undo-btn:hover { color: #fff; text-decoration: underline; }
@media (max-width: 600px) { .toast-undo { left: 16px; right: 16px; } }

/* ── INVALID FIELD (validation feedback) ── */
.field-error {
  border-color: var(--red) !important;
  background: var(--red-bg) !important;
}

/* ── ASSESSMENT OUTPUT ── */
.assessment-output {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.assessment-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--paper);
}
.assessment-body {
  padding: 24px;
  font-size: .875rem;
  line-height: 1.7;
  color: var(--ink-2);
}
.assessment-body h2, .assessment-body h3 {
  font-size: .875rem;
  font-weight: 700;
  color: var(--ink);
  margin: 20px 0 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.assessment-body h2:first-child, .assessment-body h3:first-child { margin-top: 0; }
.assessment-body p { margin-bottom: 12px; }
.assessment-body strong { color: var(--ink); font-weight: 600; }
.assessment-body em { font-style: italic; }
.assessment-body ul, .assessment-body ol {
  margin: 8px 0 12px 20px;
}
.assessment-body li { margin-bottom: 6px; }
.assessment-body hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}
.assessment-body a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Structured-assessment "stations" — classified out of the renderer's inline
   styles so the ≤600px reading-flow pass can retune them without !important.
   Desktop values match the prior inline styles 1:1, except the keystone's
   left-rule + title colour moved from the off-palette bright #16a34a to the
   warm --green token (the one element that broke the oxblood/ivory palette). */
.fwa-exposure {
  font-size: .82rem;
  color: var(--ink-3);
  font-style: italic;
  border-left: 2px solid var(--line);
  padding-left: 12px;
  margin-bottom: 18px;
}
.fwa-keystone {
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 0 0 18px;
}
.fwa-keystone-title { font-weight: 700; color: var(--green); margin-bottom: 6px; }
.fwa-keystone-body { margin: 0; color: var(--ink); }
.fwa-onemove { margin: 10px 0 0; font-size: .85rem; color: var(--ink-2); }

/* Case citation chips */
.case-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: .7rem;
  padding: 2px 8px;
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid var(--blue-line);
  border-radius: 3px;
  margin: 1px 2px;
}

/* ── PATHWAY NOTES CARD ── */
.pathway-notes-card {
  background: var(--blue-bg);
  border: 1px solid var(--blue-line);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.pathway-notes-label {
  font-family: var(--mono);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--blue);
  margin-bottom: 6px;
}
.pathway-notes-body {
  font-size: .825rem;
  color: var(--ink-2);
  line-height: 1.6;
}

/* ── STEP GUIDANCE ── */
.step-guidance-area { margin-bottom: 16px; }
.step-guidance-prompt { padding: 8px 0; }
.step-guidance-content { padding: 4px 0 12px; }
.guidance-section { margin-bottom: 14px; }
.guidance-label {
  font-family: var(--mono);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-4);
  margin-bottom: 5px;
}
.guidance-text {
  font-size: .85rem;
  color: var(--ink-2);
  line-height: 1.65;
}
.guidance-why { color: var(--ink-3); font-style: italic; }

/* ── STEP NOTES ── */
.step-notes-section {
  border-top: 1px solid var(--line-2);
  padding-top: 14px;
  margin-top: 4px;
}
.step-notes-label {
  font-family: var(--mono);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-4);
  margin-bottom: 6px;
}
.step-notes-input {
  width: 100%;
  min-height: 72px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: .825rem;
  color: var(--ink);
  resize: vertical;
  background: var(--paper);
  line-height: 1.5;
  transition: border-color .15s;
}
.step-notes-input:focus {
  outline: none;
  border-color: var(--ink-2);
  background: var(--white);
}
.step-notes-input::placeholder { color: var(--ink-4); }

/* ── PATHWAY ── */
.pathway-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.pathway-progress {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--ink-4);
}
.progress-bar-wrap {
  width: 160px;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--ink);
  border-radius: 2px;
  transition: width .3s ease;
}
.timeframe-box {
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: .8rem;
  color: var(--ink-2);
}
.timeframe-box strong { font-weight: 700; }

.step-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color .15s;
  box-shadow: var(--shadow);
}
.step-card.completed {
  background: var(--paper);
  border-color: var(--line);
  opacity: .7;
}
.step-card.completed .step-title { text-decoration: line-through; color: var(--ink-4); }
.step-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  cursor: pointer;
}
.step-check {
  width: 22px; height: 22px;
  border: 2px solid var(--line);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  margin-top: 1px;
}
.step-check:hover { border-color: var(--green); }
.step-card.completed .step-check {
  background: var(--green);
  border-color: var(--green);
}
.step-check svg { display: none; }
.step-card.completed .step-check svg { display: block; }
.step-meta { flex: 1; }
.step-number {
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--ink-4);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.step-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}
.step-timing {
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--ink-4);
  margin-top: 3px;
}
.step-body {
  padding: 0 20px 16px 56px;
  font-size: .825rem;
  color: var(--ink-3);
  line-height: 1.6;
  display: none;
}
.step-body.open { display: block; }
/* ── PATHWAY TYPE HEADER ── */
.pathway-type-header {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.pathway-type-header.pth-blue   { background: var(--white); border-left: 3px solid var(--blue); }
.pathway-type-header.pth-red    { background: var(--white); border-left: 3px solid var(--red); }
.pathway-type-header.pth-amber  { background: var(--white); border-left: 3px solid var(--amber); }
.pathway-type-header.pth-purple { background: var(--white); border-left: 3px solid #6b4a8f; }
.pathway-type-header.pth-gray   { background: var(--white); border-left: 3px solid var(--ink-4); }

.pth-label {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.pth-stages {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.pth-stage {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pth-stage-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--ink-2);
  background: rgba(255,255,255,.7);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: var(--radius);
  padding: 3px 8px;
}
.pth-arrow {
  font-size: 1rem;
  color: var(--ink-4);
  font-weight: 300;
}
.pth-note {
  font-size: .72rem;
  color: var(--red);
  margin-top: 8px;
  font-style: italic;
}

/* ── STEP TAGS ── */
.step-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.step-role-tag {
  font-family: var(--mono);
  font-size: .6rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--blue-bg);
  border: 1px solid var(--blue-line);
  border-radius: var(--radius);
  padding: 2px 6px;
}
.step-urgency-tag {
  font-family: var(--mono);
  font-size: .6rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius);
  border: 1px solid;
}
/* Urgency colours */
.step-urgency-tag:not(:empty) {
  color: var(--amber);
  background: var(--amber-bg);
  border-color: var(--amber-line);
}
.step-timing-inline {
  font-family: var(--mono);
  font-size: .6rem;
  color: var(--ink-4);
}

.step-case-note {
  background: var(--paper);
  border-left: 3px solid var(--line);
  padding: 8px 12px;
  margin: 10px 0;
  font-size: .775rem;
  color: var(--ink-3);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.step-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ── DOCUMENT MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,17,23,.5);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in .15s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
}
.modal-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-3);
  padding: 4px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  transition: color .15s;
}
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 24px; }

/* ── DOCUMENT TEMPLATE ── */
.doc-template {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  font-family: 'Georgia', serif;
  font-size: .875rem;
  line-height: 1.7;
  color: var(--ink);
}
.doc-header-bar {
  background: var(--ink);
  color: var(--white);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius) var(--radius) 0 0;
}
.doc-company {
  font-family: var(--sans);
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: -.01em;
}
.doc-type-label {
  font-family: var(--mono);
  font-size: .65rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .6;
}
.doc-inner {
  padding: 28px 32px;
}

/* Confidential banner */
.doc-confidential {
  font-family: var(--mono);
  font-size: .65rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: center;
  padding: 0 0 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

/* Letterhead */
.doc-letterhead {
  text-align: right;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.doc-letterhead-name {
  font-family: var(--sans);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
  margin-bottom: 4px;
}
.doc-letterhead-detail {
  font-family: var(--sans);
  font-size: .775rem;
  color: var(--ink-3);
  line-height: 1.6;
}

.doc-meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.doc-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.doc-field-label {
  font-family: var(--sans);
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-3);
}
.doc-field-value {
  font-size: .875rem;
  color: var(--ink);
  border-bottom: 1px solid var(--ink-4);
  padding-bottom: 2px;
  min-height: 22px;
}
.doc-field-input {
  font-family: 'Georgia', serif;
  font-size: .875rem;
  color: var(--ink);
  border: none;
  border-bottom: 1px solid var(--ink-4);
  background: transparent;
  width: 100%;
  padding: 2px 0;
  outline: none;
}
.doc-field-input:focus { border-bottom-color: var(--ink); }
.doc-subject {
  font-family: var(--sans);
  font-weight: 700;
  font-size: .875rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
}

/* Document body — rendered markdown, Georgia serif */
.doc-body-text {
  font-family: 'Georgia', serif;
  font-size: .875rem;
  line-height: 1.75;
  color: var(--ink-2);
}
.doc-body-text p  { margin-bottom: 12px; }
.doc-body-text h2,
.doc-body-text h3 {
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 700;
  color: var(--ink);
  margin: 20px 0 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.doc-body-text h2:first-child,
.doc-body-text h3:first-child { margin-top: 0; }
.doc-body-text strong { color: var(--ink); font-weight: 700; }
.doc-body-text em    { font-style: italic; }
.doc-body-text ul,
.doc-body-text ol   { margin: 8px 0 12px 20px; }
.doc-body-text li   { margin-bottom: 6px; }
.doc-body-text hr   { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

/* Hand-fill blanks: a short inline blank for facts (Time: ___), a full
   ruled writing line for free-text answers. Both print as clean rules. */
.doc-blank {
  display: inline-block;
  width: 110px;
  border-bottom: 1px solid var(--ink-3);
  height: .95em;
  vertical-align: baseline;
}
.doc-blank-line {
  display: inline-block;
  width: 100%;
  border-bottom: 1px solid var(--ink-3);
  height: 1.6em;
  vertical-align: baseline;
}

/* Typed document blocks — the model emits semantics (form fields,
   write-in areas, numbered operative paragraphs); these draw them. */
.doc-numbered,
.doc-bullets { margin: 8px 0 16px 0; padding-left: 26px; }
.doc-numbered li,
.doc-bullets li { margin-bottom: 8px; padding-left: 4px; }

.doc-form-grid { margin: 10px 0 18px; }
.doc-form-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.doc-form-label {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-2);
  flex: 0 0 200px;
}
.doc-form-value {
  flex: 1;
  min-width: 0;
  border: none;
  border-bottom: 1px solid var(--ink-3);
  border-radius: 0;
  background: transparent;
  font-family: 'Georgia', serif;
  font-size: .875rem;
  color: var(--ink);
  padding: 2px 4px;
}
.doc-form-value:focus { outline: none; border-bottom-color: var(--ink); }

.doc-write-in { margin: 10px 0 20px; }
.doc-write-in-lead { margin-bottom: 6px; }
.doc-rule { border-bottom: 1px solid var(--ink-3); height: 2.1em; }

/* Signatures */
.doc-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.doc-sig-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.doc-sig-label-top {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-2);
  margin-bottom: 4px;
}
.doc-sig-line {
  border-bottom: 1px solid var(--ink);
  height: 64px;
}
.doc-sig-hint {
  font-family: var(--sans);
  font-size: .68rem;
  color: var(--ink-4);
  letter-spacing: .04em;
  margin-top: 2px;
}
.doc-sig-date-row {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.doc-sig-name  { flex: 2; }
.doc-sig-date-input { flex: 1; }

.doc-sig-label {
  font-family: var(--sans);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
}

/* Document footer */
.doc-footer {
  margin-top: 36px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--ink-4);
  text-align: center;
  line-height: 1.6;
}

.doc-actions {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--paper);
}

/* ── QUICK CHECK MODAL ── */
.check-modal-body { padding: 24px; }
.check-result {
  display: none;
  margin-top: 20px;
}
.check-result.visible { display: block; }
.check-verdict {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.check-verdict.high   { background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--red); }
.check-verdict.medium { background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--amber); }
.check-verdict.low    { background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--green); }
.check-verdict-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.check-verdict-text {
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}
.check-detail-section {
  margin-bottom: 14px;
}
.check-detail-label {
  font-family: var(--mono);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-4);
  margin-bottom: 6px;
}
.check-detail-text {
  font-size: .85rem;
  color: var(--ink-2);
  line-height: 1.6;
}
.check-steps-list {
  list-style: none;
  counter-reset: steps;
}
.check-steps-list li {
  counter-increment: steps;
  display: flex;
  gap: 10px;
  font-size: .825rem;
  color: var(--ink-2);
  padding: 6px 0;
  border-bottom: 1px solid var(--line-2);
}
.check-steps-list li::before {
  content: counter(steps);
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 700;
  color: var(--white);
  background: var(--ink-3);
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── WHAT IF CHAT ── */
.chat-container {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.chat-messages {
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-empty {
  text-align: center;
  color: var(--ink-4);
  font-size: .825rem;
  padding: 24px;
}
.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: .85rem;
  line-height: 1.6;
}
.chat-bubble.user {
  background: var(--ink);
  color: var(--white);
  align-self: flex-end;
  border-radius: var(--radius-lg) var(--radius-lg) 2px var(--radius-lg);
}
.chat-bubble.assistant {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-2);
  align-self: flex-start;
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 2px;
}
.chat-input-row {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.chat-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: .875rem;
  background: var(--white);
  color: var(--ink);
  transition: border-color .15s;
}
.chat-input:focus { outline: none; border-color: var(--ink-2); }
.chat-input::placeholder { color: var(--ink-4); }
.chat-suggestions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 16px 0;
}
.chat-suggestion {
  padding: 5px 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: .75rem;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .15s;
}
.chat-suggestion:hover { background: var(--ink); color: var(--white); border-color: var(--ink); }

/* ── MATTERS LIST ── */
.matters-table {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
}
.matters-table th {
  text-align: left;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.matters-table td {
  padding: 16px 16px;
  border-bottom: 1px solid var(--line-2);
  font-size: .85rem;
  color: var(--ink-2);
  vertical-align: middle;
}
.matters-table tr:last-child td { border-bottom: none; }
.matters-table tr:hover td { background: var(--paper); }

/* Active Matters: Employee 140px | Situation auto | Type 110px | Risk 110px | Updated 100px | Actions 215px */
.matters-table th:nth-child(1), .matters-table td:nth-child(1) { width: 140px; }
.matters-table th:nth-child(2), .matters-table td:nth-child(2) { width: auto; }
.matters-table th:nth-child(3), .matters-table td:nth-child(3) { width: 110px; }
.matters-table th:nth-child(4), .matters-table td:nth-child(4) { width: 110px; }
.matters-table th:nth-child(5), .matters-table td:nth-child(5) { width: 100px; }

/* Last column (actions) — fixed width; the buttons (Continue + Send to head
   office + Archive + Delete) WRAP onto a second line within it (the cell's flex
   div is flex-wrap:wrap) rather than bleeding past the card edge. */
.matters-table th:last-child {
  width: 320px;
  min-width: 320px;
}
.matters-table td:last-child {
  width: 320px;
  min-width: 320px;
  vertical-align: middle;
}

/* Employees register reuses matters-table chrome but has its own columns:
   Name | Role | Type | Tenure | Flags | (open). Proportional widths spread
   the content evenly instead of letting Role absorb all the slack. */
.staff-table th:nth-child(1), .staff-table td:nth-child(1) { width: 28%; }
.staff-table th:nth-child(2), .staff-table td:nth-child(2) { width: 24%; }
.staff-table th:nth-child(3), .staff-table td:nth-child(3) { width: 12%; }
.staff-table th:nth-child(4), .staff-table td:nth-child(4) { width: 11%; }
.staff-table th:nth-child(5), .staff-table td:nth-child(5) { width: 15%; }
.staff-table th:last-child, .staff-table td:last-child {
  width: 10%;
  min-width: 0;
  text-align: right;
}
/* Multi-site register inserts a Site column after Type:
   Name | Role | Type | Site | Tenure | Flags | (open). Re-spread all seven so
   none collapse under table-layout:fixed (the 6-col %s above leave the shifted
   Flags column with no width otherwise). Higher specificity (two classes) beats
   the 6-col rules; last-child keeps its 10%. */
.staff-table.has-site th:nth-child(1), .staff-table.has-site td:nth-child(1) { width: 22%; }
.staff-table.has-site th:nth-child(2), .staff-table.has-site td:nth-child(2) { width: 17%; }
.staff-table.has-site th:nth-child(3), .staff-table.has-site td:nth-child(3) { width: 11%; }
.staff-table.has-site th:nth-child(4), .staff-table.has-site td:nth-child(4) { width: 15%; }
.staff-table.has-site th:nth-child(5), .staff-table.has-site td:nth-child(5) { width: 11%; }
.staff-table.has-site th:nth-child(6), .staff-table.has-site td:nth-child(6) { width: 14%; }
.matter-ref {
  font-weight: 600;
  color: var(--ink);
}
.matter-situation {
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 100%;
}

/* ── LOADING ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,17,23,.4);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
}
.loading-overlay.active { display: flex; }
.loading-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
}
.loading-spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--ink-3);
  letter-spacing: .06em;
}
.loading-sub {
  font-size: .75rem;
  color: var(--ink-4);
  margin-top: 4px;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 32px;
  color: var(--ink-4);
}
.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: .4;
}
.empty-state-title {
  font-weight: 600;
  color: var(--ink-3);
  margin-bottom: 6px;
  font-size: .9rem;
}
.empty-state-text { font-size: .825rem; }

/* ── FLOATING CHECK BUTTON ── */
.float-check-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--ink);
  color: var(--white);
  border: none;
  border-radius: 100px;
  padding: 12px 20px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: .825rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 90;
  transition: all .15s;
}
.float-check-btn:hover {
  background: var(--ink-2);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.float-check-btn svg { width: 15px; height: 15px; }

/* ── DIVIDER ── */
.section-divider {
  height: 1px;
  background: var(--line);
  margin: 24px 0;
}

/* ── AUTH OVERLAY ── */
#auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--ink);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}
.auth-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: modal-in .15s ease;
}
.auth-logo {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 6px;
}
.auth-heading {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 24px;
}
.auth-card .field-group {
  margin-bottom: 12px;
}
.auth-card .field-group label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--ink-3);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.auth-card .gate-input {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  margin-bottom: 0;
}
.auth-card .gate-input:focus {
  outline: none;
  border-color: var(--ink-2);
  background: var(--white);
}
.auth-card .btn-full {
  margin-top: 4px;
}
.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
}
.auth-links a {
  font-size: .8rem;
  color: var(--ink-3);
  text-decoration: none;
}
.auth-links a:hover { color: var(--ink); }
.auth-error {
  display: none;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--red-bg);
  border: 1px solid var(--red-line);
  border-radius: var(--radius);
  font-size: .8rem;
  color: var(--red);
}
.auth-success {
  display: none;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--green-bg);
  border: 1px solid var(--green-line);
  border-radius: var(--radius);
  font-size: .8rem;
  color: var(--green);
}

/* ── NAV USER / SIGN OUT ── */
.nav-user {
  padding: 12px 20px 4px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.nav-user-email {
  font-size: .7rem;
  color: rgba(255,255,255,.35);
  font-family: var(--mono);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-sign-out {
  font-size: .75rem;
  color: rgba(255,255,255,.4);
  text-decoration: none;
}
.nav-sign-out:hover { color: rgba(255,255,255,.7); }

/* ── NAV BUG BUTTON ── */
.nav-bug-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: rgba(255,255,255,.3);
  font-size: .72rem;
  padding: 8px 20px;
  text-align: left;
  cursor: pointer;
  font-family: var(--sans);
}
.nav-bug-btn:hover { color: rgba(255,255,255,.55); }

/* legacy gate-card kept for any remaining references */
.gate-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
  margin-bottom: 4px;
}
.gate-subtitle {
  font-size: .875rem;
  color: var(--ink-3);
  margin-bottom: 24px;
}
.gate-input {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: .95rem;
  color: var(--ink);
  background: var(--paper);
  transition: border-color .15s;
  margin-bottom: 12px;
}
.gate-input:focus { outline: none; border-color: var(--ink-2); background: var(--white); }
.gate-error {
  font-size: .8rem;
  color: var(--red);
  text-align: center;
  margin-top: 10px;
  min-height: 20px;
}
.gate-note {
  font-size: .72rem;
  color: var(--ink-4);
  text-align: center;
  margin-top: 20px;
}
@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}
.gate-shake { animation: gate-shake .45s ease; }

/* ── RATE LIMIT BANNER ── */
.rate-limit-banner {
  display: none;
  background: var(--amber-bg);
  border-bottom: 1px solid var(--amber-line);
  padding: 10px 32px;
  font-size: .85rem;
  color: var(--amber);
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 50;
}
.rate-limit-banner.visible { display: block; }

/* ── PRINT STYLES ── */
@media print {
  @page { margin: 25mm; }

  body { background: white !important; }

  /* Default: hide app chrome */
  #nav, .float-check-btn, .page-header,
  .doc-actions { display: none !important; }
  #main { margin-left: 0 !important; }

  /* printing-doc mode: isolate modal document */
  body.printing-doc .page-body  { display: none !important; }
  body.printing-doc #check-modal { display: none !important; }
  body.printing-doc #doc-modal {
    position: static !important;
    background: none !important;
    padding: 0 !important;
    display: block !important;
    overflow: visible !important;
  }
  body.printing-doc .modal {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    animation: none !important;
  }
  body.printing-doc .modal-header { display: none !important; }
  body.printing-doc .modal-body   { padding: 0 !important; }
  body.printing-doc #doc-profile-form { display: none !important; }
  body.printing-doc #doc-output   { display: block !important; }

  /* Document itself */
  .doc-header-bar { display: none !important; }
  .doc-template   { border: none !important; box-shadow: none !important; }
  .doc-confidential {
    font-size: 7pt;
    letter-spacing: .16em;
  }
  .doc-letterhead-name { font-size: 14pt; }
  .doc-body-text  { font-size: 11pt !important; line-height: 1.7 !important; }
  .doc-sig-line   { height: 56px !important; }
  .doc-form-label { font-size: 8pt !important; }
  .doc-form-value { font-size: 11pt !important; }
  .doc-rule       { height: 26pt !important; }
  .doc-write-in,
  .doc-form-row   { break-inside: avoid; }

  /* Employer-only chrome must never reach paper. printDocument()'s popup hides
     these with its own inline stylesheet, but Ctrl+P — and the popup-blocked
     fallback window.print() — print the app page with THIS stylesheet. */
  .no-print,
  .employer-guidance-box { display: none !important; }

  /* The on-screen footer carries the product disclaimer — that line has no
     place in a letter handed to the employee (or tendered to the Commission).
     The employer sees it on screen before printing; paper stays clean. */
  .doc-footer { display: none !important; }

  /* The paged viewport (A4 minus 25mm margins ≈ 600px) is narrower than the
     900px mobile breakpoint, so without these overrides every PRINTED letter
     gets the phone layout: Date/Reference/To/From one-per-row and stacked
     signature blocks. !important so they beat the max-width rules, which come
     later in the sheet and also match while printing. */
  .doc-meta-row   { grid-template-columns: 1fr 1fr !important; }
  .doc-signatures { grid-template-columns: 1fr 1fr !important; }

  /* Never strand a section heading at a page bottom, and keep each numbered
     particular / bullet on one page — a particular split mid-sentence reads
     badly in a document that may be cited later ("paragraph 2 of the letter"). */
  .doc-body-text h2,
  .doc-body-text h3 { break-after: avoid; }
  .doc-numbered li,
  .doc-bullets li   { break-inside: avoid; }
}

/* ── PATHWAY TABS ── */
.pathway-tab-hidden { display: none !important; }
.pathway-tab-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}
.pathway-tab {
  padding: 6px 14px;
  border: none;
  background: var(--paper);
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: .775rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.pathway-tab:not(:last-child) { border-right: 1px solid var(--line); }
.pathway-tab.active { background: var(--ink); color: var(--white); }
.pathway-tab:hover:not(.active) { background: var(--line-2); }

/* ── TIMELINE ── */
.timeline-event {
  display: flex;
  gap: 16px;
  padding: 0 0 20px 0;
  position: relative;
}
.timeline-event::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 16px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.timeline-event:last-child::before { display: none; }
.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
  z-index: 1;
}
.timeline-content { flex: 1; }
.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.timeline-type {
  font-family: var(--mono);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-4);
}
.timeline-date {
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--ink-4);
}
.timeline-title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.timeline-body {
  font-size: .825rem;
  color: var(--ink-3);
  line-height: 1.6;
}

/* ── MATTERS FILTER ── */
.matters-filter-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.matters-filter-btn {
  padding: 6px 14px;
  border: none;
  background: var(--paper);
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: .775rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.matters-filter-btn:not(:last-child) { border-right: 1px solid var(--line); }
.matters-filter-btn.active { background: var(--ink); color: var(--white); }
.matters-filter-btn:hover:not(.active) { background: var(--line-2); }

/* Refine controls (employee / risk / sort) on the Matters view */
.matters-refine {
  font-family: var(--sans);
  font-size: .775rem;
  color: var(--ink-2);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  cursor: pointer;
  max-width: 180px;
}
.matters-refine:hover { border-color: var(--ink-4); }

/* ── INDUSTRY CASES ── */
.stats-case-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}
.stats-case-row:last-child { border-bottom: none; }
.stats-case-header { width: 100%; margin-bottom: 4px; }
.stats-case-outcome {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
}
.stats-case-key-fact {
  width: 100%;
  font-size: .775rem;
  color: var(--ink-2);
  line-height: 1.5;
  padding-left: 2px;
}
.stats-case-relevance {
  width: 100%;
  font-size: .75rem;
  color: var(--blue);
  line-height: 1.5;
  padding-left: 2px;
  font-style: italic;
}

/* ── RESPONSIVE ── */

/* Hamburger + left header cluster — the hamburger only appears once the
   sidebar collapses (≤900px); on desktop it's hidden and the header is
   visually unchanged. */
.nav-toggle { display: none; }
.page-header-left { display: flex; align-items: center; gap: 14px; min-width: 0; }

/* Horizontal-scroll shell around wide ledger tables */
.table-scroll { width: 100%; }

/* Off-canvas drawer backdrop (only meaningful on mobile) */
#nav-backdrop { display: none; }

@media (max-width: 900px) {
  :root { --nav-w: 0px; }

  /* Sidebar → off-canvas drawer. Display stays flex (matching the inline
     style JS sets at sign-in); we slide with transform instead of toggling
     display, so the auth gate's display:none still hides it pre-login. */
  #nav {
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 264px;
    box-shadow: 0 0 40px rgba(0,0,0,.35);
    z-index: 250;
  }
  body.nav-open #nav { transform: translateX(0); }

  #nav-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(15,17,23,.5);
    z-index: 240;
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
  }
  body.nav-open #nav-backdrop { opacity: 1; pointer-events: auto; }

  #main { margin-left: 0; }

  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex-shrink: 0; padding: 0;
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); color: var(--ink); cursor: pointer;
  }
  .nav-toggle svg { width: 18px; height: 18px; }

  .page-header { padding: 14px 16px; }
  .page-title { font-size: 1.15rem; }
  .page-body { padding: 20px 16px 100px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-row { grid-template-columns: 1fr 1fr; }
  .doc-meta-row { grid-template-columns: 1fr; }
  .doc-signatures { grid-template-columns: 1fr; }

  /* Stack header rows that set a title opposite a control group */
  .assessment-header,
  .pathway-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .pathway-header .pathway-tab-group { align-self: stretch; }
  .progress-bar-wrap { width: 100%; }

  /* Wide tables scroll sideways within their card instead of overflowing */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .matters-table { table-layout: auto; min-width: 560px; }
  .matters-table th, .matters-table td { padding: 12px; }

  /* Modals fill the small screen with a little edge breathing room */
  .modal-overlay { padding: 16px 12px; }
  .modal { max-width: 100%; }
  .modal-body, .check-modal-body { padding: 18px; }

  /* Floating Check button: compact, clear of the home indicator */
  .float-check-btn { bottom: 16px; right: 16px; padding: 11px 16px; font-size: .8rem; }

  /* Auth gate breathes inside the dark overlay */
  #auth-overlay { align-items: flex-start; padding: 8vh 20px 20px; }
  .auth-card { padding: 28px 24px; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .profile-row { grid-template-columns: 1fr; }

  /* 16px controls stop iOS Safari auto-zooming on focus */
  .field-group input, .field-group select, textarea,
  .gate-input, .chat-input,
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="date"], input[type="time"],
  input[type="tel"], select { font-size: 16px; }

  .page-title { font-size: 1.08rem; }
  .page-subtitle { font-size: .75rem; }

  /* ── Tighter container padding on phones ── */
  .card { padding: 18px 16px; }

  /* ── Touch targets: small buttons reach ~40px on phones ── */
  .btn-sm { padding: 8px 13px; min-height: 40px; }

  /* ── Assessment output: looser single-column reading flow ── */
  .assessment-body { padding: 18px 16px; }
  .assessment-header { padding: 14px 16px; }
  .fwa-exposure { font-size: .8rem; padding-left: 10px; margin-bottom: 14px; }
  .fwa-keystone { margin: 20px 0; padding: 13px 15px; }

  /* ════════════════════════════════════════════════════════════════
     TABLE → stacked cards  (Active Matters + Employees register).
     Both tables share the .matters-table chrome and are desktop-dense (6
     cols, a wide actions column, 560px min-width) — on a phone the 900px
     layer just scrolls them sideways. Here we reflow each row into a
     hairline-divided list of label/value rows (the column name comes from
     each cell's data-label via ::before).
     The shared structure targets .matters-table (both tables); the few
     matters-only column rules (the Situation cell, the actions <div>) stay
     scoped with :not(.staff-table). The column-width rules (~L1402-1419)
     sit OUTSIDE any media query, so each is overridden with !important here.
     ════════════════════════════════════════════════════════════════ */
  #matters-table-content { padding: 0 16px; }   /* the matters-view card is padding:0 */
  .matters-table { display: block; min-width: 0; }
  .matters-table thead { display: none; }
  .matters-table tbody { display: block; }
  .matters-table tr {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
  }
  .matters-table tr:first-child { border-top: none; padding-top: 2px; }
  .matters-table tr:hover td { background: none; }
  /* The register card is also padding:0 but has no inner padded wrapper like
     #matters-table-content, so inset each row to keep it off the card edge. */
  .staff-table tr { padding-left: 16px; padding-right: 16px; }
  .matters-table td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    width: auto !important;
    min-width: 0 !important;
    padding: 2px 0 !important;
    border-bottom: none !important;
    white-space: normal !important;
    text-align: right;
    font-size: .82rem;
  }
  .matters-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-4);
    text-align: left;
    align-self: center;
  }
  /* A register cell with no value (current employee, no flags) drops out
     rather than showing a lonely "FLAGS" label. */
  .staff-table td:empty { display: none; }
  /* First cell → list-item title: full width, prominent, unlabelled.
     Matters employee ref and staff name both use .matter-ref. */
  .matters-table td:nth-child(1) { display: block; text-align: left; }
  .matters-table td:nth-child(1)::before { display: none; }
  .matters-table td:nth-child(1) .matter-ref { font-size: 1rem; }
  /* Matters' Situation → label above, wraps freely (no ellipsis clip). The
     register's 2nd cell is a short Role, so it keeps the default value row. */
  .matters-table:not(.staff-table) td:nth-child(2) { display: block; text-align: left; }
  .matters-table:not(.staff-table) td:nth-child(2)::before { display: block; margin-bottom: 1px; }
  .matters-table:not(.staff-table) td:nth-child(2) .matter-situation { white-space: normal; color: var(--ink-3); }
  /* Last cell → full-width action button at the card foot. */
  .matters-table td:last-child {
    display: block;
    text-align: left;
    margin-top: 8px;
    padding-top: 10px !important;
    border-top: 1px solid var(--line-2) !important;
  }
  .matters-table td:last-child::before { display: none; }
  .matters-table:not(.staff-table) td:last-child > div { flex-wrap: wrap !important; gap: 8px !important; }
  .matters-table td:last-child .btn { flex: 1 1 auto; justify-content: center; min-height: 40px; }
  /* The ⋯ menu stays compact beside the stretched primary action; its
     popover items are inside the pop, not flex items of the button row. */
  .matters-table td:last-child .row-menu { flex: 0 1 auto; }
  .matters-table td:last-child .row-menu-btn { flex: 0 0 auto; min-width: 46px; }


  /* ════════════════════════════════════════════════════════════════
     INTAKE → paced stepper.
     One .intake-section on screen at a time; #intake-stepnav below the card
     drives Back/Continue (the controller flips the last Continue to "Assess").
     The inline Assess button is hidden. Textarea grows; the paper-trail
     checkboxes get full-row 40px tap targets. Desktop is untouched (sections
     all visible, footer display:none from the base rule).
     ════════════════════════════════════════════════════════════════ */
  .situation-box { padding: 18px 16px; }
  .situation-textarea { min-height: 140px; }

  .intake-section { display: none; }
  .intake-section.step-active { display: block; }
  .intake-inline-assess { display: none; }

  .intake-stepnav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
  }
  .intake-stepnav .btn { min-height: 44px; }
  .intake-stepnav .intake-back { flex: 0 0 auto; }
  .intake-stepnav .intake-next { flex: 1 1 auto; justify-content: center; }
  .intake-stepcount {
    flex: 0 0 auto;
    font-family: var(--mono);
    font-size: .72rem;
    letter-spacing: .04em;
    color: var(--ink-4);
    white-space: nowrap;
  }

  /* Each checkbox <label> wraps its <input>, so the whole 40px row is tappable.
     The inline width:auto on the inputs is overridden here. */
  #situation-procedural-group > div > label { min-height: 40px; }
  #situation-procedural-group input[type="checkbox"] {
    width: 20px !important;
    height: 20px;
    flex: 0 0 auto;
  }
}

/* ============================================================
   STAFF PLATFORM — employees, tasks, complaints, agenda
   ============================================================ */

.p-sub { font-size: .75rem; color: var(--ink-4); line-height: 1.5; }

/* Chips, editorial: typographic labels, not pill rainbows. Colour lives in
   the text alone; the severity/status meaning stays per colour class. */
.p-chip {
  display: inline-block; font-size: .66rem; font-weight: 700;
  padding: 0; border: none; background: none; border-radius: 0;
  text-transform: uppercase; letter-spacing: .1em; vertical-align: middle;
}
.p-chip-grey  { color: var(--ink-4); }
.p-chip-red   { color: var(--red); }
.p-chip-amber { color: var(--amber); }
.p-chip-blue  { color: var(--blue); }
.p-chip-green { color: var(--green); }

/* Manager Review — per-manager performance scorecards. Severity reads from a
   left rule (no pastel fills); numbers in mono, everything else editorial. */
.mgr-window {
  font-family: var(--mono); font-size: .62rem; font-weight: 500;
  letter-spacing: .06em; color: var(--ink-4); text-transform: uppercase;
  margin-left: 8px;
}
.mgr-card {
  border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: 8px; padding: 13px 15px; margin-top: 12px;
  background: var(--white);
}
.mgr-card.band-needs_support { border-left-color: var(--red); }
.mgr-card.band-keeping_up     { border-left-color: var(--amber); }
.mgr-card.band-on_top         { border-left-color: var(--green); }
.mgr-head { display: flex; align-items: baseline; gap: 10px; }
.mgr-head strong { font-size: .9rem; color: var(--ink); }
.mgr-score {
  margin-left: auto; font-family: var(--mono); font-size: .8rem;
  font-weight: 600; color: var(--ink-2);
}
.mgr-score span { font-size: .62rem; color: var(--ink-4); }
.mgr-metrics { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 9px; }
.mgr-metric { font-size: .72rem; color: var(--ink-3); }
.mgr-metric.mgr-warn { color: var(--amber); }
.mgr-num { font-family: var(--mono); font-weight: 600; color: var(--ink-2); }
.mgr-warn .mgr-num { color: var(--amber); }
.mgr-recs { list-style: none; margin: 11px 0 0; padding: 0; }
.mgr-recs li {
  position: relative; padding: 0 0 0 15px; margin-top: 6px;
  font-size: .78rem; line-height: 1.45; color: var(--ink-2);
}
.mgr-recs li::before { content: '\2192'; position: absolute; left: 0; color: var(--ink-4); }
.mgr-detail { margin-top: 10px; }
.mgr-detail summary {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-4); cursor: pointer;
}
.mgr-detail summary:hover { color: var(--ink-2); }

/* Dashboard triage groups (Overdue / Today / This Week) */
.p-dash-group-title {
  font-family: var(--mono);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .09em;
  color: var(--ink-4);
  padding: 12px 0 2px;
  border-bottom: 1px solid var(--line-2);
}
.p-dash-group-red { color: var(--red); }

/* "More ▾" dropdown on the assessment results action row */
.more-menu-wrap { position: relative; display: inline-block; }
.more-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px); left: 0;
  min-width: 180px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
}
.more-menu.open { display: block; }
.more-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none; border: none; cursor: pointer;
  font: inherit; font-size: .85rem;
  color: var(--ink-2);
  padding: 8px 10px;
  border-radius: var(--radius);
}
.more-menu-item:hover { background: var(--paper); color: var(--ink); }

/* "Do this next" hero — rank #1, set like a brief's headnote: white card,
   coloured top-rule (oxblood for a legal step, red when simply most late). */
.p-hero {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  margin: 4px 0 16px;
}
.p-hero-late  { border-top-color: var(--red); }
.p-hero-plain { border-top-color: var(--ink-3); }
.p-hero-label {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 8px;
}
.p-reason-chip {
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: none;
  color: var(--ink-4);
}
.p-reason-chip::before { content: '— '; }
.p-hero-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: 3px;
}
.p-hero-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
}

/* List rows — ledger lines: status dot flush left, title, a right-aligned
   date/lateness column where a ledger keeps its dates, then actions. */
.p-rail-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-2);
}
.p-rail-row:last-of-type { border-bottom: 0; }
.p-rail-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid var(--ink-4);
  background: transparent;
}
.p-rail-dot.late  { background: var(--red);   border-color: var(--red); }
.p-rail-dot.today { background: var(--amber); border-color: var(--amber); }
.p-rail-main {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: .875rem;
}
.p-rail-main .p-chip { margin-right: 7px; }
.p-rail-when {
  flex-shrink: 0;
  min-width: 88px;
  text-align: right;
  font-size: .75rem;
  color: var(--ink-4);
}
.p-rail-when.late  { color: var(--red);   font-weight: 600; }
.p-rail-when.today { color: var(--amber); font-weight: 600; }

/* Pinned "next legal step" rows — visually heavier than normal to-dos */
.p-pathway-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--blue-bg);
  border: 1px solid var(--blue-line);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin: 8px 0;
}
.p-pathway-date {
  border: 1px solid var(--blue-line);
  border-radius: 6px;
  padding: 4px 8px;
  font: inherit;
  font-size: .8rem;
  background: var(--white);
}

/* "All clear" banner — the earned state. Green rule, serif headline,
   one warm line; celebratory without confetti. */
.p-allclear {
  display: flex; align-items: center; gap: 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 2px solid var(--green);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.p-allclear-mark {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--green);
  border-radius: 50%;
  color: var(--green);
  font-size: 1rem; font-weight: 700;
}
.p-allclear-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

/* Quiet "from a complaint" deep link on complaint-sourced tasks */
.p-from-complaint {
  font-size: .75rem;
  color: var(--ink-4);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line);
}
.p-from-complaint:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* Brief highlight when deep-linking to a complaint card */
.p-flash { box-shadow: 0 0 0 2px var(--accent); transition: box-shadow .8s ease; }

/* Expand/collapse control under each dashboard group */
.p-see-more {
  display: block;
  background: none; border: none; cursor: pointer;
  font: inherit; font-size: .78rem; font-weight: 600;
  color: var(--ink-3);
  padding: 8px 0 2px;
}
.p-see-more:hover { color: var(--ink); text-decoration: underline; }

.p-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line-2);
}
.p-row:last-child { border-bottom: 0; }
.p-row.p-overdue { box-shadow: inset 3px 0 0 var(--red); margin: 0 -10px; padding: 10px; }

.p-alert {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--white); border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 8px;
  font-size: .85rem;
}

/* Cross-thread risk callout (dashboard) / flag (profile). Severity is signalled
   by the left rule and the eyebrow colour only — no pastel fill. Red = a live
   dismissal-vs-complaint conflict; amber = multiple active threads. */
.p-conflict {
  background: var(--white); border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
}
.p-conflict.is-medium { border-left-color: var(--amber); }
.p-conflict-eyebrow {
  font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--red); margin-bottom: 4px;
}
.p-conflict.is-medium .p-conflict-eyebrow { color: var(--amber); }
.p-conflict-head { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.p-conflict-body { font-size: .85rem; color: var(--ink-2); margin: 6px 0 12px; line-height: 1.5; }
.p-conflict-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.p-conflict-more { margin-top: 10px; }
.p-conflict-more > summary {
  cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--ink-3);
  list-style: none;
}
.p-conflict-more > summary::-webkit-details-marker { display: none; }
.p-conflict-more > summary::after { content: ' ▾'; color: var(--ink-4); }
.p-conflict-more[open] > summary::after { content: ' ▴'; }
.p-conflict-detail { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.p-conflict-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-4); margin-bottom: 4px;
}
.p-conflict-detail ul { margin: 0; padding-left: 16px; font-size: .82rem; color: var(--ink-2); }
.p-conflict-detail li { margin: 2px 0; }

.p-settings-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.p-event { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.p-event:last-child { border-bottom: 0; }
.p-event-head { display: flex; gap: 8px; align-items: center; margin-bottom: 3px; }
.p-timeline { max-height: 480px; overflow-y: auto; }

.p-stat { font-size: 1.55rem; font-weight: 600; font-family: var(--serif); }

.p-complaint-strip {
  display: flex; align-items: center; gap: 6px;
  border-left: 3px solid var(--red);
  border-top: 1px solid var(--line);
  font-size: .9rem; padding: 14px 18px;
}
.p-complaint-body {
  margin-top: 10px; padding: 10px 14px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: .85rem; white-space: pre-wrap; color: var(--ink-2);
}

/* Collapsed complaint cards: a one-line header that expands on click;
   the working surface only renders when open. */
.p-complaint-card { padding: 14px 20px; }
.p-complaint-card.expanded { padding: 20px; }
.p-complaint-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; cursor: pointer; user-select: none;
}
.p-complaint-card:not(.expanded):hover { border-color: var(--ink-4); }
.p-complaint-summary {
  margin-top: 4px; font-size: .82rem; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.p-complaint-chevron {
  color: var(--ink-4); font-size: .8rem;
  transition: transform .15s ease;
}
.p-complaint-chevron.open { transform: rotate(180deg); }

/* Quiet action — an underlined text link, not a third button weight */
.p-btn-quiet {
  background: transparent; border: none; color: var(--ink-4);
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--line); font-weight: 500;
}
.p-btn-quiet:hover { color: var(--ink-2); text-decoration-color: var(--ink-3); background: transparent; }

.platform-hint {
  font-size: .75rem; color: var(--ink-4); background: var(--paper);
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 8px 12px; margin-top: 10px; line-height: 1.5;
}

/* Help & Support — FAQ disclosure list (native <details>/<summary>) */
.faq-item { border-top: 1px solid var(--line); }
.faq-item:first-child { border-top: 0; }
.faq-item summary {
  list-style: none; cursor: pointer; padding: 13px 0; font-weight: 500;
  color: var(--ink); display: flex; align-items: center; gap: 10px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: '+'; color: var(--ink-3); font-size: 1.1rem; line-height: 1;
  width: 14px; text-align: center; flex-shrink: 0;
}
.faq-item[open] summary::before { content: '\2212'; }   /* − */
.faq-item summary:hover { color: var(--accent); }
.faq-item p {
  margin: 0 0 14px 24px; font-size: .85rem; color: var(--ink-2); line-height: 1.65;
}

.p-linknote {
  margin-top: 10px; padding: 9px 13px; font-size: .8rem;
  background: var(--blue-bg); border: 1px solid var(--blue-line);
  border-radius: var(--radius); color: var(--ink-2);
}
.p-linknote a { color: var(--blue); margin-left: 8px; }

.p-summary-card {
  background: var(--white); border: 1px solid var(--line);
  border-left: 3px solid var(--ink); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 16px; font-size: .9rem; line-height: 1.65;
  color: var(--ink-2);
  font-family: var(--serif);
}
.p-summary-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-4); margin-bottom: 5px;
}
.p-summary-gp {
  margin-top: 10px; padding: 8px 12px; font-size: .8rem;
  background: var(--amber-bg); border: 1px solid var(--amber-line);
  border-radius: var(--radius);
}

.p-clarify-q { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.p-clarify-q:last-child { border-bottom: 0; }

/* ── Phone-width fixes for platform cards (must sit AFTER the base rules —
      the earlier ≤600px layer is above .p-complaint-* in the file, so a rule
      there loses the same-specificity cascade to the base nowrap). ── */
@media (max-width: 600px) {
  /* Complaint card header: stack the two head groups — title+summary take a
     full row (summary wraps instead of ellipsising to a stub), the state
     chips drop to their own row underneath. */
  .p-complaint-head { flex-wrap: wrap; row-gap: 4px; }
  /* !important: the head children carry inline flex styles in the markup
     (platform.js), which would otherwise beat any stylesheet rule. */
  .p-complaint-head > div:first-child { flex: 1 1 100% !important; }
  .p-complaint-head > div:last-child { margin-left: auto; }
  .p-complaint-summary { white-space: normal; }
}
