/* Leaption Ops portal — restyled to the main app's design system.
   Tokens below MIRROR frontend/css/styles.css :root (the source of truth —
   keep them in sync by hand; ops has no build step). Two deliberate
   divergences, both host constraints:
   1. Fonts: the global helmet Content-Security-Policy blocks third-party
      requests on this host, so there is NO Google Fonts link; Inter and
      Poppins are self-hosted (the @font-face rules below). --font-body is
      Inter with a system fallback; --font-logo is Poppins for the wordmark.
   2. Everything else (palette, type scale, radii, shadow, table + shell
      patterns) matches the app: green accent #0e6055, left sidebar shell,
      l-datatable-style tables that card-stack below 768px. */

/* Inter and the Poppins wordmark, self-hosted: the same files the customer
   portal ships, served on this host under /fonts/ (backend/ops/serveOpsSite.js).
   Poppins is 700; it also answers the wordmark's 800 so the browser doesn't
   fake a bolder weight. */
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/fonts/poppins-700.woff2") format("woff2");
  font-weight: 700 800;
  font-display: swap;
}

:root {
  /* Inter's contextual alternates off (E2E 12 Oct, L4): with them on, a
     digit, "x", digit ("mv53x970", "4x4 Hire") is drawn with a multiplication
     sign, so a name or an email reads wrong. Every text uses this, through
     the font-feature-settings property (check-typography.js). */
  --font-features:  "calt" 0;
  /* ── Palette (mirrors the app's locked palette) ── */
  --bg:             #ffffff;
  --panel:          #ffffff;
  --panel-strong:   #ffffff;
  --line:           rgba(28, 42, 43, 0.10);
  --text:           #1c2a2b;
  --ink:            #1c2a2b;
  --muted:          #5f6d69;
  --accent:         #0e6055;
  --accent-deep:    #0a4a42;
  --accent-light:   #1f7a6e;
  --hover:          rgba(14, 96, 85, 0.08);
  --row-active:     rgba(14, 96, 85, 0.14);
  --highlight:      #cf9f52;
  --warn:           #ab3b2d;
  --success:        #2e8b6f;
  --success-soft:   rgba(46, 139, 111, 0.12);
  --surface-sunken: #f6f8f8;
  --shadow:         0 1px 2px rgba(28, 42, 43, 0.04), 0 6px 24px rgba(28, 42, 43, 0.06);

  /* ── Typography tokens (CSP: local stacks only — see file header) ── */
  --font-body:      "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display:   var(--font-body);
  --font-logo:      "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:      ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-2xs:         0.72rem;
  --fs-xs:          0.78rem;
  --fs-sm:          0.82rem;
  --fs-base:        0.875rem;
  --fs-md:          1rem;
  --fs-lg:          1.15rem;
  --fs-xl:          1.4rem;
  --fs-2xl:         1.6rem;
  --lh-tight:       1.2;
  --lh-snug:        1.35;
  --lh-normal:      1.5;
  --fw-regular:     400;
  --fw-medium:      500;
  --fw-semibold:    600;
  --fw-bold:        700;
  --fw-heavy:       800;
  --radius-card:    16px;
  --radius-control: 10px;

  /* Semantic badge tints (DESIGN-SYSTEM.md §2 buckets) */
  --pill-success-bg:   rgba(14, 96, 85, 0.13);
  --pill-success-fg:   #0e6055;
  --pill-attention-bg: rgba(176, 83, 9, 0.12);
  --pill-attention-fg: #b45309;
  --pill-critical-bg:  rgba(192, 57, 43, 0.12);
  --pill-critical-fg:  #c0392b;
  --pill-neutral-bg:   rgba(111, 98, 87, 0.14);
  --pill-neutral-fg:   #5d534a;

  --danger-bg:      rgba(192, 57, 43, 0.10);
  --danger-fg:      #c0392b;
  --danger-border:  rgba(192, 57, 43, 0.28);

  /* ── Design tokens added 26 Sept 2026 (DESIGN-SYSTEM.md §8, decision D5) ──
     Required for all NEW CSS; existing rules move onto them screen by screen.
     Mirrored from frontend/css/styles.css :root (keep in sync by hand).
     Values are the ones the app already uses most. No hex/rgb outside :root in new rules. */

  /* Semantic colours (§1/§2). ONE red, ONE amber, ONE green. */
  --critical:        var(--warn);                 /* failed / overdue / destructive */
  --critical-soft:   rgba(171, 59, 45, 0.10);
  --attention:       #9a481f;                     /* needs a look / blocked / partial */
  --attention-soft:  rgba(188, 95, 50, 0.16);
  --accent-soft:     rgba(14, 96, 85, 0.12);      /* success pill / selected tint */
  --neutral-ink:     #5d534a;                     /* "not started yet" pills */
  --neutral-soft:    rgba(111, 98, 87, 0.14);

  /* Spacing scale (padding, margin, gap). 14px is not a step: use 12 or 16. */
  --sp-1:  4px;
  --sp-2:  6px;
  --sp-3:  8px;
  --sp-4:  10px;
  --sp-5:  12px;
  --sp-6:  16px;
  --sp-7:  20px;
  --sp-8:  24px;
  --sp-9:  32px;
  --sp-10: 48px;

  /* Corners: controls (--radius-control) and cards (--radius-card) above. */
  --radius-sm:      6px;    /* chips inside controls, small tiles */
  --radius-badge:   10px;   /* every pill / badge / chip (D3) */
  --radius-round:   999px;  /* buttons, toggles, avatars */

  /* Elevation and focus. */
  --shadow-pop:     0 8px 24px rgba(0, 0, 0, 0.12);           /* menus, popovers */
  --shadow-overlay: -24px 0 60px rgba(16, 21, 26, 0.14);      /* drawers, dialogs */
  --focus-ring:     0 0 0 3px rgba(14, 96, 85, 0.15);
  --focus-ring-critical: 0 0 0 3px rgba(171, 59, 45, 0.15);

  /* Ops review part E (27 Sept 2026): every colour below :root is a token. */
  --on-accent:      #ffffff;                      /* text on a green or red button */
  --accent-faint:   rgba(14, 96, 85, 0.05);
  --accent-tint:    rgba(14, 96, 85, 0.10);
  --glass-1:        rgba(255, 255, 255, 0.36);
  --glass-2:        rgba(255, 255, 255, 0.65);
  --glass-3:        rgba(255, 255, 255, 0.82);
  --line-warm:      rgba(70, 50, 31, 0.08);
  --shadow-accent:  0 4px 14px rgba(14, 96, 85, 0.25);
  --danger-hover:   #a03024;
  --danger-faint:   rgba(192, 57, 43, 0.04);
  --scrim:          rgba(28, 42, 43, 0.45);   /* = the staff app's --overlay-scrim */
  --overlay-blur:   none;                     /* = the staff app's --overlay-blur */
  --shadow-modal:   0 8px 40px rgba(0, 0, 0, 0.18);
  --shadow-toast:   0 6px 18px rgba(0, 0, 0, 0.18);
  --code-bg:        #0f1c1a;
  --code-ink:       #d7e7e2;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* L4-12Oct: the typography tokens' font features on all text, form controls
   included (they don't inherit them from the page in every browser). */
body, input, textarea, select, button {
  font-feature-settings: var(--font-features);
}


button, select, textarea, input { font: inherit; }

[hidden] { display: none !important; }

/* ── Brand wordmark (shared by sidebar, mobile top bar, login) ─────────────── */
.ops-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-logo);
  font-size: var(--fs-lg);
  font-weight: var(--fw-heavy);
  letter-spacing: -0.3px;
  color: var(--accent);
  white-space: nowrap;
}
.ops-wordmark-tag {
  font-family: var(--font-body);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 8px;
}

/* ── Login ─────────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--surface-sunken);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.login-brand { margin-bottom: 18px; }

.login-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--text);
  letter-spacing: 0.2px;
}

.login-sub {
  margin: 0 0 24px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.field { display: block; margin-bottom: 16px; }

.field-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  margin-bottom: 6px;
  color: var(--ink);
}

.field input {
  width: 100%;
  padding: 11px 14px;
  font-size: var(--fs-base);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  color: var(--ink);
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.login-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  font-size: var(--fs-sm);
  background: var(--danger-bg);
  color: var(--danger-fg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-control);
}

/* ── App shell — left sidebar + scrolling main (mirrors .app-shell) ────────── */
.app-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: 100vh;
  transition: grid-template-columns 220ms ease;
}

.app-shell > .main {
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

.app-shell.sidebar-collapsed { grid-template-columns: 92px 1fr; }

.sidebar {
  padding: 18px 18px 24px;
  border-right: 1px solid var(--line);
  background: var(--accent-faint);
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 6px 0;
}

.sidebar-collapse-button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 7px;
  border-radius: var(--radius-control);
  line-height: 0;
  transition: background 150ms ease, color 150ms ease, transform 220ms ease;
}

.sidebar-collapse-button:hover {
  background: var(--accent-tint);
  color: var(--accent-deep);
}

.sidebar-body {
  display: grid;
  align-content: start;
  gap: 6px;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  min-height: 0;
}
.sidebar-body::-webkit-scrollbar { display: none; }

.nav-link {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.nav-link.active,
.nav-link:hover {
  background: var(--accent-tint);
  color: var(--accent);
}

.nav-link:hover { transform: translateY(-1px); }

.nav-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--glass-1);
  border: 1px solid var(--line-warm);
  color: inherit;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.nav-icon svg { display: block; flex-shrink: 0; }

.nav-label { white-space: nowrap; }

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: var(--fw-heavy);
}

.sidebar-user-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sidebar-user-meta strong {
  font-size: var(--fs-base);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-meta span {
  color: var(--muted);
  font-size: var(--fs-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Collapsed state — icons only, centred */
.app-shell.sidebar-collapsed .nav-link {
  padding-left: 10px;
  padding-right: 10px;
  justify-content: center;
  min-height: 44px;
}
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .sidebar-user-meta,
.app-shell.sidebar-collapsed .sidebar-signout,
.app-shell.sidebar-collapsed .sidebar-brand .ops-wordmark { display: none; }
.app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; }
.app-shell.sidebar-collapsed .sidebar-user { justify-content: center; }
.app-shell.sidebar-collapsed .sidebar-collapse-button { transform: rotate(180deg); }

/* ── Mobile chrome (hidden on desktop) ─────────────────────────────────────── */
.mobile-top-bar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: 60px;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-nav-toggle {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--panel-strong);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mobile-nav-toggle::-webkit-scrollbar { display: none; }

.mobile-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  border-radius: var(--radius-control);
  transition: color 150ms ease, background 150ms ease;
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
}

.mobile-tab.active,
.mobile-tab:hover { color: var(--accent); }

.mobile-tab svg { display: block; }

/* Part E: five tabs fit a phone; "More" opens this sheet above the bar
   with the rest of the menu. */
.mobile-more {
  position: fixed;
  left: var(--sp-5); right: var(--sp-5);
  bottom: calc(64px + env(safe-area-inset-bottom));
  z-index: 101;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-pop);
  padding: var(--sp-2);
  display: grid;
}
.mobile-more[hidden] { display: none; }
.mobile-more-item {
  display: flex; align-items: center; gap: var(--sp-5);
  padding: var(--sp-5) var(--sp-6);
  border: 0; background: transparent; text-align: left;
  font: inherit; font-size: var(--fs-base); font-weight: var(--fw-semibold);
  color: var(--ink); border-radius: var(--radius-control); cursor: pointer;
}
.mobile-more-item.active, .mobile-more-item:hover { color: var(--accent); background: var(--hover); }

/* ── Main content area ─────────────────────────────────────────────────────── */
.ops-main { padding: 26px 30px 48px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--text);
}
.muted { color: var(--muted); font-size: var(--fs-base); margin: 0; }

.panel + .panel, .panel + .stat-grid, .stat-grid + .panel, .stat-grid + .queue-grid, .panel + .queue-grid { margin-top: 18px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2, .section-head h3 { margin: 0; color: var(--text); }
h3.sub { margin: 22px 0 10px; font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--ink); }

/* ── Buttons — pill-shaped, one green primary (DESIGN-SYSTEM.md §3) ────────── */
.btn,
.btn-primary,
.btn-primary-sm,
.btn-danger,
.btn-ghost,
.btn-ghost-dark,
.range-btn,
.legend-btn {
  border-radius: 999px;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease,
    border-color 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.btn {
  padding: 8px 16px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  border: 1px solid var(--line);
  background: var(--glass-2);
  color: var(--ink);
}
.btn:hover { background: var(--hover); transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-small { padding: 6px 12px; font-size: var(--fs-xs); }

.btn-primary-sm, .btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--on-accent);
  border: 0;
}
.btn-primary { width: 100%; padding: 12px 16px; font-size: var(--fs-base); font-weight: var(--fw-semibold); }
.btn-primary-sm { padding: 8px 16px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.btn-primary-sm:hover, .btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-accent); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-danger { background: var(--danger-fg); color: var(--on-accent); border: 0; padding: 8px 16px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.btn-danger:hover { background: var(--danger-hover); transform: translateY(-1px); }

.btn-ghost {
  padding: 7px 14px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--hover); }
.btn-ghost-dark { padding: 8px 16px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost-dark:hover { background: var(--hover); }

.sidebar-signout { width: 100%; }

/* ── Stat cards (main-app metric-card look) ─────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat-value { font-size: var(--fs-2xl); font-weight: var(--fw-bold); color: var(--ink); line-height: var(--lh-tight); }
.stat-label { font-size: var(--fs-2xs); color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.08em; }
.stat-sub { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--sp-1); line-height: var(--lh-snug); }
.stat-warn .stat-value { color: var(--pill-attention-fg); }
.stat-danger .stat-value { color: var(--danger-fg); }

/* ── Queues ─────────────────────────────────────────────────────────────────── */
.queue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
/* Grid gap spaces the panels; the stacked-panel margin would push every
   panel after the first down, so the rows never lined up (part E). */
.queue-grid > .panel { margin-top: 0; }
.queue-panel h2 { font-size: var(--fs-md); margin-bottom: 12px; }
.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.queue-item:first-child { border-top: none; }
.queue-main { display: flex; flex-direction: column; min-width: 0; }
.queue-name { font-weight: var(--fw-semibold); font-size: var(--fs-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-metric { font-size: var(--fs-xs); color: var(--muted); }

/* ── Search ─────────────────────────────────────────────────────────────────── */
.search-wrap { position: relative; margin-bottom: 18px; }
.search-input {
  width: 100%;
  padding: 12px 16px;
  font-size: var(--fs-base);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--glass-3);
  color: var(--ink);
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.search-results {
  position: absolute; z-index: 20; top: 50px; left: 0; right: 0;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.search-row {
  display: flex; gap: 10px; align-items: center; width: 100%; text-align: left;
  padding: 10px 14px; background: var(--panel); border: none; border-top: 1px solid var(--line);
  cursor: pointer; font-size: var(--fs-sm); color: var(--ink);
}
.search-row:first-child { border-top: none; }
.search-row:hover { background: var(--hover); }
.search-kind { font-size: var(--fs-2xs); font-weight: var(--fw-bold); color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; width: 64px; flex-shrink: 0; }

/* ── Filters + pager ────────────────────────────────────────────────────────── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filter-input {
  padding: 8px 12px;
  font-size: var(--fs-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  color: var(--ink);
}
.filter-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.inline-select { padding: 4px 8px; font-size: var(--fs-xs); }
.cell-control { white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.pager-info { font-size: var(--fs-sm); color: var(--muted); }

/* ── Tables — the app's l-datatable look ────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.data-table th {
  text-align: left;
  padding: 12px 12px;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: var(--fs-base);
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td.num, .data-table th.num { text-align: right; }
/* A code that must not break across lines (order numbers, IDs). */
.data-table td.nowrap { white-space: nowrap; }
.data-table td.empty { text-align: center; color: var(--muted); padding: 32px 20px; }
.data-table tbody tr { transition: background 120ms ease; }
.data-table tr.row-click { cursor: pointer; }
.data-table tr.row-click:hover td { background: var(--hover); }
.data-table tr.row-critical td { background: var(--danger-bg); }

/* Invoices tab (Claude drafts step 1): a second, smaller line in a cell
   ("4 library · 2 Claude"), and why a supplier's rules need a look. */
.data-table .cell-sub { display: block; font-size: var(--fs-xs); color: var(--muted); }
.look-reasons { display: grid; gap: var(--sp-1); font-size: var(--fs-sm); color: var(--pill-attention-fg); }
.page-intro { margin-bottom: var(--sp-5); }
.stat-wrap + .panel { margin-top: var(--sp-7); }
/* Rule library (Claude drafts step 2): the plain-words summary, the rules,
   Check and Try on a look-alike, and the actions. */
.layout-name { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.library-rules, .library-pending { display: grid; gap: var(--sp-4); }
.library-summary { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-2) var(--sp-6); margin: 0; font-size: var(--fs-sm); }
.library-summary dt { font-weight: var(--fw-semibold); color: var(--ink); }
.library-summary dd { margin: 0; color: var(--text); }
.library-features { font-size: var(--fs-sm); }
.library-json summary { cursor: pointer; font-size: var(--fs-sm); color: var(--accent); font-weight: var(--fw-semibold); }
.library-json pre {
  margin: var(--sp-3) 0 0; padding: var(--sp-5); max-height: 22rem; overflow: auto;
  font-family: var(--font-mono); font-size: var(--fs-xs); line-height: var(--lh-snug);
  background: var(--hover); border-radius: var(--radius-control);
}
.library-try-row, .library-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.library-try-row .filter-input { width: auto; min-width: 12rem; }
.library-try-result { display: grid; gap: var(--sp-1); font-size: var(--fs-sm); }
.library-try-result ul { margin: 0; padding-left: var(--sp-7); }
.library-warn { color: var(--pill-attention-fg); }
.library-modal { display: grid; gap: var(--sp-4); }
.library-edit-json { font-family: var(--font-mono); font-size: var(--fs-xs); }
/* Invoices tab, Give extra drafts (Claude drafts step 6): how many, and for
   the whole shop or one supplier. */
.give-drafts { display: grid; gap: var(--sp-3); }
/* Claude's unsure notes on a draft: notes, not warnings. */
.draft-unsure { display: grid; gap: var(--sp-1); font-size: var(--fs-sm); color: var(--muted); }
.give-drafts-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.give-drafts-row .filter-input { width: auto; min-width: 8rem; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent); }
/* Rule library on a phone: the summary one column. */
@media (max-width: 767px) {
  .library-summary { grid-template-columns: 1fr; gap: var(--sp-1); }
  .library-summary dd { margin-bottom: var(--sp-3); }
  .library-try-row .filter-input { width: 100%; }
  .give-drafts-row .filter-input { width: 100%; }
}

/* ── Badges — pill semantics (DESIGN-SYSTEM.md §2) ──────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  border-radius: 999px;
  /* Pills read as written, in sentence case ("Not set up"): no
     text-transform (E2E R7-11Oct; DESIGN-SYSTEM §6). */
}
.badge-neutral { background: var(--pill-neutral-bg); color: var(--pill-neutral-fg); }
.badge-ok { background: var(--pill-success-bg); color: var(--pill-success-fg); }
.badge-warn { background: var(--pill-attention-bg); color: var(--pill-attention-fg); }
.badge-danger { background: var(--pill-critical-bg); color: var(--pill-critical-fg); }

/* ── Account detail + tabs ──────────────────────────────────────────────────── */
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.detail-title { margin: 0; font-family: var(--font-display); font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--ink); }
.tab-nav { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
/* 11 tabs fit one line at 1366 (Getting started, 18 Oct 2026). */
.tab-btn {
  padding: 9px 10px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn.tab-danger { color: var(--danger-fg); }
.tab-btn.tab-danger.active { border-bottom-color: var(--danger-fg); }
.tab-body {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 22px;
}

.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.kv { display: flex; flex-direction: column; gap: 3px; }
.kv-label { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.kv-value { font-size: var(--fs-base); font-weight: var(--fw-semibold); }

.placeholder-banner {
  padding: 14px 16px;
  background: var(--surface-sunken);
  border: 1px dashed var(--line);
  border-radius: var(--radius-control);
  color: var(--muted);
  font-size: var(--fs-base);
  margin-bottom: 14px;
}
.note { margin-top: 14px; }

/* ── Spark (mini bar chart) ─────────────────────────────────────────────────── */
.spark-wrap { margin-top: 20px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 64px; padding-top: 4px; }
.spark-col { flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.spark-bar { width: 100%; max-width: 14px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: 0.85; }

/* ── Notes ──────────────────────────────────────────────────────────────────── */
.note-form { margin-bottom: 18px; }
.note-input {
  width: 100%;
  padding: 11px 14px;
  font-size: var(--fs-base);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  resize: vertical;
  font-family: inherit;
  background: var(--glass-3);
  color: var(--ink);
}
.note-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.note-form-foot { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.note-list { list-style: none; margin: 0; padding: 0; }
.note-card { border: 1px solid var(--line); border-radius: var(--radius-control); padding: 12px 14px; margin-bottom: 10px; }
.note-meta { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-xs); margin-bottom: 6px; }
.note-author { font-weight: var(--fw-bold); color: var(--accent); }
/* Ops review part A — the "no customer details" line under the note box, and
   the admin's Delete on each note (pushed to the right of the date). */
.note-hint { font-size: var(--fs-xs); margin-top: var(--sp-2); }
.note-meta { flex-wrap: wrap; }
.note-meta .note-delete { margin-left: auto; }
.note-meta { align-items: center; }
/* IDs (customer IDs on the Messages tab) read as codes, not words. */
.mono { font-family: var(--font-mono); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.note-text { font-size: var(--fs-base); white-space: pre-wrap; }
.inline-msg { font-size: var(--fs-xs); }
.inline-msg.err { color: var(--danger-fg); }

/* ── Danger zone ────────────────────────────────────────────────────────────── */
.danger-card {
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-control);
  padding: 16px;
  margin-top: 14px;
  background: var(--danger-faint);
}
.danger-card h3 { margin: 0 0 4px; color: var(--danger-fg); font-size: var(--fs-md); }
/* Export sits with the account actions but isn't dangerous. */
.danger-card--neutral { border-color: var(--line); background: var(--panel); }
.danger-card--neutral h3 { color: var(--ink); }
.danger-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.danger-form .filter-input { flex: 1; min-width: 200px; }

/* ── Modal (drawer/modal pattern: dimmed backdrop, esc/backdrop cancels) ────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--scrim);
  -webkit-backdrop-filter: var(--overlay-blur);
  backdrop-filter: var(--overlay-blur);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 20px; z-index: 300; overflow-y: auto;
}
.modal-card {
  background: var(--panel-strong);
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-modal);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-family: var(--font-display); font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--ink); }
.modal-x { background: transparent; border: none; font-size: var(--fs-md); cursor: pointer; color: var(--muted); border-radius: 999px; padding: 4px 8px; }
.modal-x:hover { background: var(--hover); color: var(--ink); }
.modal-body { padding: 20px; }
.modal-body .field-label { margin-top: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.json-dump { background: var(--code-bg); color: var(--code-ink); padding: 14px; border-radius: var(--radius-control); font-family: var(--font-mono); font-size: var(--fs-xs); overflow-x: auto; max-height: 320px; }

/* ── Toast ──────────────────────────────────────────────────────────────────── */
.toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 400; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-control);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--on-accent);
  box-shadow: var(--shadow-toast);
  transition: opacity 0.3s, transform 0.3s;
  animation: toast-in 220ms ease forwards;
}
.toast-ok { background: var(--accent); }
.toast-danger { background: var(--danger-fg); }
.toast-out { opacity: 0; transform: translateY(8px); }

/* ── Usage analytics ────────────────────────────────────────────────────────── */
.range-bar { display: flex; gap: 6px; margin-bottom: 16px; }
.range-btn { padding: 7px 14px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--muted); background: var(--panel); border: 1px solid var(--line); }
.range-btn:hover { background: var(--hover); }
.range-btn.active { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: var(--on-accent); border-color: var(--accent); }

.chart-legend { display: flex; gap: 8px; margin-bottom: 14px; }
.legend-btn { padding: 5px 12px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; opacity: 0.55; }
.legend-btn.active { opacity: 1; }
.legend-orders.active { border-color: var(--accent); color: var(--accent); }
.legend-customers.active { border-color: var(--highlight); color: var(--attention); }
.legend-notifications.active { border-color: var(--neutral-ink); color: var(--neutral-ink); }

.chart-series { margin-bottom: 14px; }
.chart-series-label { display: block; font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 4px; }
.spark-customers .spark-bar { background: var(--highlight); }
.spark-notifications .spark-bar { background: var(--neutral-ink); }

/* ── Misc states ────────────────────────────────────────────────────────────── */
.loading { padding: 30px; text-align: center; color: var(--muted); font-size: var(--fs-base); }
.error-box {
  padding: 14px 16px;
  background: var(--danger-bg);
  color: var(--danger-fg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-control);
  font-size: var(--fs-base);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive — mirrors the app: below 768px the sidebar is replaced by a
   fixed top bar + bottom tab bar, and every .data-table card-stacks (the
   l-datatable pattern: thead hides, each row becomes a card, each cell
   prints its column label from data-label via ::before).
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .app-shell { display: block; height: auto; }
  .app-shell > .main { overflow: visible; }
  .sidebar { display: none; }

  .mobile-top-bar { display: flex; }
  .mobile-nav-toggle { display: flex; }

  .ops-main {
    padding: 16px;
    padding-top: calc(60px + 16px);
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  /* Faint tray behind card-stacked tables so white cards read as raised */
  .panel:has(.data-table) { background: var(--surface-sunken); }

  .data-table, .data-table tbody { display: block; width: 100%; }
  .data-table thead { display: none; }

  .data-table tbody tr {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
    padding: 14px 16px;
    border: 0;
    border-radius: var(--radius-card);
    background: var(--panel);
    box-shadow: var(--shadow);
  }
  .data-table tbody tr:last-child { margin-bottom: 0; }

  .data-table tbody td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 0;
    text-align: left;
  }
  .data-table td.num { text-align: right; }

  /* Column label, printed from data-label (set centrally in ui.js table()) */
  .data-table td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    flex-shrink: 0;
    color: var(--muted);
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  .data-table tr.row-click:hover td { background: transparent; }
  .data-table tr.row-click:hover { background: var(--hover); }
  .data-table tr.row-critical td { background: transparent; }
  .data-table tr.row-critical { background: var(--danger-bg); }
  .data-table td.empty { justify-content: center; }

  /* Action cells: divided action row at the foot of the card */
  .data-table td.cell-control {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  .filter-bar .filter-input { flex: 1 1 140px; min-width: 0; }
  .queue-grid { grid-template-columns: 1fr; }
  .modal-overlay { padding: 24px 12px; }
  .detail-head { flex-wrap: wrap; }

  /* Account-detail tabs: one horizontally scrolling strip (same pattern as
     the bottom tab bar) instead of wrapping into a dense multi-line block. */
  .tab-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn { flex: 0 0 auto; white-space: nowrap; }
}

@media (max-width: 480px) {
  .ops-main { padding-left: 12px; padding-right: 12px; }
  .panel { padding: 14px; }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
}

/* ── Go-live tab (ops review part D) ─────────────────────────────────────────
   Label on the left, Yes/No pill or value on the right; stacks on a phone.
   Tokens only. */
.golive-problems {
  padding: var(--sp-5) var(--sp-6);
  background: var(--critical-soft);
  border-radius: var(--radius-control);
}
.golive-problems .sub { margin-top: 0; }
.golive-list { margin: var(--sp-2) 0 0; padding-left: var(--sp-7); display: grid; gap: var(--sp-2); font-size: var(--fs-base); }
.golive-ok {
  padding: var(--sp-5) var(--sp-6);
  background: var(--accent-soft);
  border-radius: var(--radius-control);
  color: var(--accent);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-base);
}
.golive-section { margin-top: var(--sp-8); }
.golive-rows { margin: var(--sp-3) 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); column-gap: var(--sp-9); }
.golive-row {
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-5);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-base);
}
.golive-row dt { color: var(--muted); flex: 1 1 auto; min-width: 0; }
.golive-row dd { margin: 0; text-align: right; overflow-wrap: anywhere; flex: 0 1 auto; }
/* A pill never squashes or re-capitalises a value ("Test mode", "1 · oldest 3 days"). */
.golive-row dd .badge { white-space: nowrap; }
@media (max-width: 767px) {
  .golive-rows { grid-template-columns: 1fr; }
}

/* ── ⋮ row menu (ops review part E) — the staff app's .row-action-menu,
   mirrored with tokens. The popover opens under the button, right-aligned. */
.row-action-menu { position: relative; display: inline-flex; }
.row-action-trigger {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.row-action-trigger:hover { background: var(--hover); color: var(--ink); }
.row-action-trigger:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.row-action-popover {
  position: absolute; top: 100%; right: 0;
  min-width: 140px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-pop);
  padding: var(--sp-1);
  z-index: 50;
}
.row-action-popover-item {
  display: block; width: 100%;
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  border: 0; background: transparent;
  font: inherit; font-size: var(--fs-base);
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--ink);
}
.row-action-popover-item:hover { background: var(--hover); }
.row-action-popover-item--danger { color: var(--danger-fg); }
.row-action-popover-item--danger:hover { background: var(--danger-bg); }
.data-table th.cell-actions, .data-table td.cell-actions { text-align: right; width: 1%; white-space: nowrap; }

/* ── Getting started tab and Overview card ───────────────────────────────────
   A state pill with a muted line under it (the date, "From real use", the
   step). The people table scrolls sideways on a computer when it's wider
   than the page; on a phone it's the usual card stack. Tokens only. */
.queue-lead { margin-bottom: var(--sp-3); display: grid; gap: var(--sp-1); }
.gs-summary {
  padding: var(--sp-5) var(--sp-6);
  background: var(--attention-soft);
  border-radius: var(--radius-control);
  color: var(--attention);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
}
.gs-people { overflow-x: auto; }
.gs-cell { display: inline-flex; flex-direction: column; align-items: flex-start; gap: var(--sp-1); }
.gs-when { display: block; font-size: var(--fs-xs); color: var(--muted); }
.golive-row dd .gs-when { text-align: right; }
@media (max-width: 768px) {
  .gs-people { overflow-x: visible; }
  .gs-cell { align-items: flex-end; text-align: right; }
}

/* ── Billing (Plans & billing Session 11) ─────────────────────────────────────
   The Accounts list's deadline cell (a date with its kind under it), the
   account's Billing tab: the expiring alert, the action cards (one per
   action, each opening its form), the people under Seats, and the
   timeline's mismatch rows. Tokens only. */
.cell-stack { display: inline-flex; flex-direction: column; gap: var(--sp-1); }
.cell-warn { color: var(--pill-attention-fg); }
.billing-link { color: var(--accent); font-weight: var(--fw-semibold); text-decoration: none; }
.billing-link:hover { text-decoration: underline; }
.billing-alert {
  padding: var(--sp-5) var(--sp-6);
  background: var(--attention-soft);
  border-radius: var(--radius-control);
  color: var(--attention);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--sp-5);
}
.billing-ok {
  padding: var(--sp-5) var(--sp-6);
  background: var(--accent-soft);
  border-radius: var(--radius-control);
  color: var(--accent);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--sp-5);
}
.billing-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-4); margin-top: var(--sp-4); }
.action-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: var(--sp-5);
  background: var(--panel);
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.action-card h4 { margin: 0; font-size: var(--fs-base); font-weight: var(--fw-bold); color: var(--ink); }
.action-card p { margin: 0; font-size: var(--fs-sm); color: var(--muted); flex: 1 1 auto; }
.action-card .btn { align-self: flex-start; }
.action-card--danger { border-color: var(--danger-border); background: var(--danger-faint); }
.action-card--danger h4 { color: var(--danger-fg); }
.billing-people { margin: var(--sp-2) 0 0; font-size: var(--fs-sm); color: var(--muted); }
.billing-form { display: grid; gap: var(--sp-3); }
.billing-form .filter-input, .billing-form .note-input { width: 100%; }
.billing-form .field-check { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--ink); }
.billing-form .field-check input { width: auto; }
.data-table tr.row-mismatch td { background: var(--danger-bg); }
/* Plans & billing Session 12: the Overview's Billing block (v6 §8.4): the
   cards, the status × plan table and its queue panels. Tokens only. */
.billing-block { margin-top: var(--sp-7); }
.billing-block .section-head { margin-bottom: var(--sp-5); }
.billing-block .stat-grid + .panel { margin-top: var(--sp-7); }
.billing-block .panel + .queue-grid { margin-top: var(--sp-7); }
.billing-counts h3.sub { margin-top: 0; }
.data-table tr.row-total td { font-weight: var(--fw-semibold); }
.queue-metric { white-space: normal; }
.timeline-detail { margin: var(--sp-1) 0 0; font-size: var(--fs-xs); color: var(--muted); }
@media (max-width: 768px) {
  .billing-actions { grid-template-columns: 1fr; }
  .cell-stack { align-items: flex-end; }
}

/* ── Help (Plans & billing Session 13): the sections, the search, the lifecycle diagram ── */
.help-search-wrap { margin-bottom: var(--sp-6); }
.help-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--sp-8); align-items: start; }
.help-layout[hidden] { display: none; }
.help-side { position: sticky; top: var(--sp-6); }
.help-nav { display: grid; gap: var(--sp-6); }
.help-nav-group h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-2xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.help-nav-btn { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: var(--sp-2) var(--sp-4); border-radius: var(--radius-control); font-family: inherit; font-size: var(--fs-sm); line-height: var(--lh-snug); color: var(--text); cursor: pointer; }
.help-nav-btn:hover { background: var(--hover); }
.help-nav-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: var(--fw-semibold); }
.help-nav-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.help-select { display: none; width: 100%; }
.help-article { min-width: 0; }
.help-group-label { margin: 0 0 var(--sp-1); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.help-article h2 { margin: 0 0 var(--sp-6); font-size: var(--fs-xl); }
.help-body { font-size: var(--fs-base); line-height: var(--lh-normal); color: var(--text); }
.help-body p { margin: 0 0 var(--sp-5); }
.help-body h4 { margin: var(--sp-8) 0 var(--sp-3); font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--ink); }
/* A deep link's target (a sub-heading, a glossary term, the "before you act" box) sits clear of the top; the phone's fixed top bar is 60px. */
.help-body [id] { scroll-margin-top: var(--sp-8); }
.help-body ul, .help-body ol { margin: 0 0 var(--sp-5); padding-left: var(--sp-8); }
.help-body li { margin-bottom: var(--sp-2); }
.help-body a { color: var(--accent); font-weight: var(--fw-semibold); text-decoration: none; }
.help-body a:hover { text-decoration: underline; }
.help-body code { font-family: var(--font-mono); font-size: var(--fs-xs); background: var(--surface-sunken); padding: 0 var(--sp-1); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.help-table { width: 100%; border-collapse: collapse; margin: 0 0 var(--sp-6); font-size: var(--fs-sm); line-height: var(--lh-snug); }
.help-table th, .help-table td { text-align: left; vertical-align: top; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); }
.help-table th { font-size: var(--fs-2xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.help-glossary { margin: 0; }
.help-glossary dt { font-weight: var(--fw-bold); color: var(--ink); margin-top: var(--sp-5); }
.help-glossary dd { margin: var(--sp-1) 0 0; }
.help-target { box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.help-box { border-left: 4px solid var(--attention); background: var(--attention-soft); border-radius: var(--radius-control); padding: var(--sp-5) var(--sp-6); margin: 0 0 var(--sp-6); }
.help-box p { margin: 0 0 var(--sp-2); }
.help-box ul { margin: 0; }
.help-diagram { margin: 0 0 var(--sp-6); }
.help-diagram svg { display: block; width: 100%; height: auto; font-family: var(--font-body); font-size: var(--fs-sm); }
.help-diagram figcaption { margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--muted); }
.help-state rect { stroke-width: 2; }
.help-state text { fill: var(--ink); font-weight: var(--fw-semibold); }
.help-state .help-state-sub { fill: var(--muted); font-weight: var(--fw-regular); font-size: var(--fs-2xs); }
.help-state--ok rect { stroke: var(--success); fill: var(--success-soft); }
.help-state--warn rect { stroke: var(--attention); fill: var(--attention-soft); }
.help-state--danger rect { stroke: var(--critical); fill: var(--critical-soft); }
.help-state--neutral rect { stroke: var(--neutral-ink); fill: var(--neutral-soft); }
.help-arrows path { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.help-arrows text, .help-diagram-note { fill: var(--muted); font-size: var(--fs-2xs); }
.help-diagram marker path { fill: var(--muted); }
.help-results { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.help-results-count { margin: 0; }
.help-result { display: grid; gap: var(--sp-1); width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-control); padding: var(--sp-4) var(--sp-5); font-family: inherit; cursor: pointer; }
.help-result:hover { background: var(--hover); }
.help-result:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.help-result-where { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--accent); }
.help-result-title { display: block; font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--ink); }
.help-result-snippet { font-size: var(--fs-sm); color: var(--text); line-height: var(--lh-snug); }
.help-result mark { background: var(--pill-attention-bg); color: inherit; }
.help-result--faq summary { cursor: pointer; display: grid; gap: var(--sp-1); }
.help-result-answer { margin-top: var(--sp-3); }
.help-link { color: var(--accent); font-weight: var(--fw-semibold); font-size: var(--fs-xs); text-decoration: none; white-space: nowrap; }
.help-link:hover { text-decoration: underline; }
.help-link--mark { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: var(--radius-round); border: 1px solid var(--accent); vertical-align: middle; }
.help-link-row { margin: 0 0 var(--sp-4); }
.help-unknown { margin: 0 0 var(--sp-5); }
@media (max-width: 768px) {
  .help-layout { grid-template-columns: 1fr; gap: var(--sp-5); }
  .help-side { position: static; }
  .help-nav { display: none; }
  .help-select { display: block; }
  .help-table { display: block; overflow-x: auto; }
  .help-body [id] { scroll-margin-top: calc(60px + var(--sp-6)); }
}
