/* RedFish Content Desk
   ─────────────────────────────────────────────────────────────────────────
   Built to the RedFish Inspections brand kit. Every value below comes from
   tokens/tokens.css or the pattern documents; nothing is improvised.

   No dark mode. The palette has no dark variant and the brand kit is explicit
   that one must not be invented silently.                                   */

/* ─────────────────────────────── fonts ──────────────────────────────── */

/* Self-hosted, as the brand requires. Google serves Source Sans 3 as a single
   variable file covering 400–700, so one request covers every weight used. */
@font-face {
  font-family: 'Source Sans 3';
  src: url('fonts/source-sans-3.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ─────────────────────────────── tokens ─────────────────────────────── */

:root {
  /* brand */
  --brand-primary: #aa0203;
  --brand-primary-hover: #8c0102;
  --brand-accent: #f3eaea;

  /* neutrals */
  --text-heading: #000000;
  --text-body: #505050;
  --text-muted: #767676;
  --surface: #ffffff;
  --surface-alt: #fbf9f9;
  --border-subtle: #e6e0e0;
  --border-strong: #d4cbcb;

  /* status: a foreground always paired with its own tint */
  --status-success: #1a7f4b;    --status-success-bg: #e8f5ee;
  --status-caution: #b7791f;    --status-caution-bg: #fdf4e3;
  --status-warning: #c2410c;    --status-warning-bg: #fdece3;
  --status-danger:  #aa0203;    --status-danger-bg:  #f3eaea;
  --status-neutral: #767676;    --status-neutral-bg: #f2f2f2;

  /* chart series, in order. No blue, by design. */
  --chart-1: #aa0203; --chart-2: #767676; --chart-3: #b7791f;
  --chart-4: #1a7f4b; --chart-5: #c2410c;

  /* shape */
  --radius: 10px;
  --radius-sm: 8px;
  --border-width: 1px;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);

  /* type */
  --font-sans: 'Source Sans 3', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'Menlo', monospace;

  --text-h1: 52px;        --text-h1-line: 59.8px;
  --text-h2: 36px;        --text-h2-line: 44px;
  --text-h3: 26px;        --text-h3-line: 34px;
  --text-h4: 20px;        --text-h4-line: 28px;
  --text-body-size: 18px; --text-body-line: 32px;
  --text-body-sm: 15px;   --text-body-sm-line: 24px;
  --text-caption: 13px;   --text-caption-line: 20px;
  --text-metric: 42px;    --text-metric-line: 48px;

  /* layout constants */
  --nav-rail-width: 256px;
  --nav-brand-height: 72px;
  --nav-item-height: 44px;
  --nav-icon-size: 18px;
  --section-rail-width: 248px;
  --measure: 75ch;
}

.card-surface {
  background-color: var(--surface);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

.tabular { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* ──────────────────────────────── base ──────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--surface-alt);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: var(--text-body-sm);
  line-height: var(--text-body-sm-line);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }
a { color: var(--brand-primary); }

h1, h2, h3, h4 { margin: 0; color: var(--text-heading); }
h1 { font-size: var(--text-h1); line-height: var(--text-h1-line); font-weight: 700; }
h2 { font-size: var(--text-h2); line-height: var(--text-h2-line); font-weight: 700; }
h3 { font-size: var(--text-h3); line-height: var(--text-h3-line); font-weight: 600; }
h4 { font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; }

:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; border-radius: 3px; }

.mono { font-family: var(--font-mono); }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Any class that sets display (.segmented is flex) would otherwise beat the
   browser's own rule for hidden, and the element would stay on screen. */
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ───────────────────────── left navigation rail ─────────────────────── */

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--nav-rail-width);
  background: var(--surface);
  border-right: var(--border-width) solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 30;
}

/* zone 1 — brand row. 72px is the total footprint, divider included. */
.rail-brand {
  height: var(--nav-brand-height);
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: var(--border-width) solid var(--border-subtle);
  text-decoration: none;
}

.lockup { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lockup img { height: 34px; width: auto; flex: none; display: block; }
.lockup-text {
  font-size: 19px; line-height: 24px; font-weight: 600;
  letter-spacing: -0.01em; white-space: nowrap;
}
.lockup-text .mark-1 { color: var(--brand-primary); }
.lockup-text .mark-2 { color: var(--text-heading); }

/* zone 2 — nav list */
.rail-nav { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  height: var(--nav-item-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-body);
  font-size: var(--text-body-sm);
  line-height: var(--text-body-sm-line);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  width: 100%;
  transition: color .12s ease, background-color .12s ease;
}
.nav-item svg { width: var(--nav-icon-size); height: var(--nav-icon-size); flex: none; }
.nav-item .nav-label { flex: 1; min-width: 0; }

/* Hover and active share a background; only the text colour differs. Hovering
   the item you are already on therefore produces no visual change. */
.nav-item:hover { background: var(--brand-accent); color: var(--text-heading); }
.nav-item.is-active { background: var(--brand-accent); color: var(--brand-primary); }

.nav-badge {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--status-warning); flex: none; }

/* zone 3 — account footer */
.rail-foot {
  flex: none;
  border-top: var(--border-width) solid var(--border-subtle);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rail-who { min-width: 0; flex: 1; padding: 0 4px; }
.rail-name {
  font-size: var(--text-caption); line-height: var(--text-caption-line); font-weight: 600;
  color: var(--text-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rail-role {
  font-size: var(--text-caption); line-height: var(--text-caption-line);
  color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rail-signout {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 6px; color: var(--text-muted);
}
.rail-signout:hover { background: var(--brand-accent); color: var(--text-heading); }
.rail-signout svg { width: 16px; height: 16px; }

/* ──────────────────────────────── page ──────────────────────────────── */

.page { margin-left: var(--nav-rail-width); min-height: 100vh; }

.page-head {
  height: var(--nav-brand-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: var(--border-width) solid var(--border-subtle);
  position: sticky; top: 0; z-index: 20;
}

.page-head h1 { font-size: var(--text-h3); line-height: var(--text-h3-line); font-weight: 600; }

.main { padding: 28px; max-width: 1320px; }

.view-intro {
  font-size: var(--text-body-sm);
  line-height: var(--text-body-sm-line);
  color: var(--text-body);
  max-width: var(--measure);
  margin-bottom: 20px;
}

/* market filter */
.segmented { display: flex; gap: 2px; }
.seg {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-body-sm);
  font-weight: 600;
  color: var(--text-body);
  white-space: nowrap;
  transition: color .12s ease, background-color .12s ease;
}
.seg:hover { background: var(--brand-accent); color: var(--text-heading); }
.seg.is-active { background: var(--brand-accent); color: var(--brand-primary); }

/* ─────────────────────────────── buttons ────────────────────────────── */

.btn {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: var(--border-width) solid var(--border-subtle);
  background: var(--surface);
  color: var(--text-heading);
  font-size: var(--text-body-sm);
  font-weight: 600;
  transition: background-color .12s ease, border-color .12s ease;
}
.btn:hover:not(:disabled) { background: var(--brand-accent); border-color: var(--border-strong); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-primary-hover); border-color: var(--brand-primary-hover); }

/* ──────────────────────────────── cards ─────────────────────────────── */

.card {
  background: var(--surface);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px;
  border-bottom: var(--border-width) solid var(--border-subtle);
}
.card-title { font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; color: var(--text-heading); }
.card-aside { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); }
.card-body { padding: 20px; }

.prose { font-size: var(--text-body-size); line-height: var(--text-body-line); color: var(--text-body); max-width: var(--measure); }
.prose + .prose { margin-top: 12px; }

.note-sm { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); max-width: var(--measure); }
.note-sm + .note-sm { margin-top: 8px; }

/* ──────────────────────────── stat tiles ────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }

.stat {
  background: var(--surface);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 18px 20px;
}
.stat-label {
  font-size: var(--text-caption); line-height: var(--text-caption-line);
  letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 600;
}
.stat-value {
  font-size: var(--text-metric); line-height: var(--text-metric-line); font-weight: 700;
  color: var(--text-heading); font-variant-numeric: tabular-nums; margin-top: 6px;
}
.stat[data-tone='brand'] .stat-value { color: var(--brand-primary); }
.stat-note { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); margin-top: 4px; }

/* ──────────────────────────── status chips ──────────────────────────── */

.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: var(--text-caption);
  line-height: var(--text-caption-line);
  font-weight: 600;
  white-space: nowrap;
}
.chip[data-tone='success'] { color: var(--status-success); background: var(--status-success-bg); }
.chip[data-tone='caution'] { color: var(--status-caution); background: var(--status-caution-bg); }
.chip[data-tone='warning'] { color: var(--status-warning); background: var(--status-warning-bg); }
.chip[data-tone='danger']  { color: var(--status-danger);  background: var(--status-danger-bg); }
.chip[data-tone='neutral'] { color: var(--status-neutral); background: var(--status-neutral-bg); }

/* ─────────────────────────────── filters ────────────────────────────── */

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip-btn {
  padding: 6px 12px;
  border: var(--border-width) solid var(--border-subtle);
  border-radius: 999px;
  background: var(--surface);
  font-size: var(--text-body-sm);
  font-weight: 600;
  color: var(--text-body);
}
.chip-btn:hover { background: var(--brand-accent); color: var(--text-heading); }
.chip-btn.is-active { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }

/* ──────────────────────────────── rows ──────────────────────────────── */

.row-head {
  display: grid; grid-template-columns: 4px minmax(0,1fr) 160px 132px 96px;
  gap: 14px; padding: 10px 20px 10px 0;
  border-bottom: var(--border-width) solid var(--border-subtle);
  background: var(--surface-alt);
}
.row-head span {
  font-size: var(--text-caption); line-height: var(--text-caption-line);
  letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 600;
}

.row {
  width: 100%;
  display: grid; grid-template-columns: 4px minmax(0,1fr) 160px 132px 96px;
  gap: 14px; align-items: center;
  padding: 0 20px 0 0;
  border-bottom: var(--border-width) solid var(--border-subtle);
  text-align: left;
  min-height: 60px;
  transition: background-color .12s ease;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-alt); }
.row.is-selected { background: var(--brand-accent); }

.row-stripe { align-self: stretch; background: var(--status-neutral); }
.row-stripe[data-sev='ok']        { background: var(--status-success); }
.row-stripe[data-sev='monitor']   { background: var(--status-caution); }
.row-stripe[data-sev='deficient'] { background: var(--status-danger); }

.row-main { min-width: 0; padding: 12px 0; }
.row-title {
  font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600;
  color: var(--text-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-meta {
  font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px;
}
.row-kw {
  font-family: var(--font-mono); font-size: var(--text-caption); color: var(--text-body);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-when {
  font-size: var(--text-caption); color: var(--text-muted);
  font-variant-numeric: tabular-nums; text-align: right;
}

/* ─────────────────────────────── tables ─────────────────────────────── */

.scroll-x { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; min-width: 520px; }
.table th, .table td { padding: 8px 16px 8px 0; text-align: left; vertical-align: top; }
.table thead th {
  font-size: var(--text-caption); line-height: var(--text-caption-line);
  letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 600;
  border-bottom: var(--border-width) solid var(--border-subtle);
}
.table tbody td { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); border-bottom: 1px solid #f0ebeb; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody td:first-child { font-weight: 600; color: var(--text-heading); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table.pad-l th, .table.pad-l td { padding-left: 20px; }

/* coverage matrix */
.matrix td, .matrix th { text-align: center; }
.matrix tbody th { text-align: left; white-space: nowrap; font-size: var(--text-body-sm); font-weight: 600; color: var(--text-heading); padding: 8px 16px 8px 20px; }
.cell {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; border-radius: 6px;
  font-size: 11px; font-weight: 700;
  border: 1px solid var(--border-subtle); color: var(--text-muted); background: var(--surface);
}
.cell[data-c='published'] { background: var(--status-success); border-color: var(--status-success); color: #fff; }
.cell[data-c='scheduled'] { background: var(--status-success-bg); border-color: var(--status-success); color: var(--status-success); }
.cell[data-c='draft']     { background: var(--status-caution-bg); border-color: var(--status-caution); color: var(--status-caution); }
.cell[data-c='gap']       { background: var(--surface); border-style: dashed; color: var(--text-muted); }

.legend { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; font-size: var(--text-body-sm); color: var(--text-body); }
.legend-item { display: flex; align-items: center; gap: 8px; }

/* ─────────────────────────── section rail (docs) ────────────────────── */

.split { display: grid; grid-template-columns: var(--section-rail-width) minmax(0, 1fr); gap: 20px; align-items: start; }
.split-rail { position: sticky; top: 100px; display: flex; flex-direction: column; gap: 16px; }

.rail-card {
  background: var(--surface);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.rail-entry {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-body-sm);
  line-height: var(--text-body-sm-line);
  font-weight: 600;
  color: var(--text-body);
  text-align: left;
  transition: color .12s ease, background-color .12s ease;
}
.rail-entry:hover { background: var(--brand-accent); color: var(--text-heading); }
.rail-entry.is-active { background: var(--brand-accent); color: var(--brand-primary); }

.doc-panel {
  background: var(--surface);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 24px;
}
.doc-head { padding-bottom: 16px; border-bottom: var(--border-width) solid var(--border-subtle); margin-bottom: 16px; }
.doc-head h2 { font-size: var(--text-h3); line-height: var(--text-h3-line); font-weight: 600; }
.doc-summary { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); max-width: 70ch; margin-top: 4px; }

.doc-blocks { display: flex; flex-direction: column; gap: 16px; }
.doc-blocks h3 { font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; margin-top: 8px; }
.doc-blocks p { font-size: var(--text-body-size); line-height: var(--text-body-line); max-width: var(--measure); }
.doc-blocks ul, .doc-blocks ol { font-size: var(--text-body-size); line-height: var(--text-body-line); max-width: var(--measure); padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.doc-blocks ul { list-style: disc; }
.doc-blocks ol { list-style: decimal; }

.doc-note { display: flex; gap: 10px; padding: 12px; border-radius: var(--radius-sm); }
.doc-note[data-status='gap'] { background: var(--status-danger-bg); }
.doc-note[data-status='placeholder'] { background: var(--status-neutral-bg); }
.doc-note svg { width: 16px; height: 16px; flex: none; margin-top: 4px; }
.doc-note[data-status='gap'] svg { color: var(--status-danger); }
.doc-note[data-status='placeholder'] svg { color: var(--text-muted); }
.doc-note-title { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); }
.doc-note-text { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); max-width: var(--measure); }

.figure { border: var(--border-width) solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--surface-alt); padding: 16px; }
.figure svg { width: 100%; height: auto; display: block; }
.figure figcaption { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); margin-top: 10px; }

/* ────────────────────────────── detail pane ─────────────────────────── */

.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 40; }

.detail {
  position: fixed; inset: 0 0 0 auto;
  width: min(640px, 100%);
  background: var(--surface);
  border-left: var(--border-width) solid var(--border-subtle);
  z-index: 50; overflow-y: auto;
}

.detail-head {
  position: sticky; top: 0; background: var(--surface); z-index: 2;
  border-bottom: var(--border-width) solid var(--border-subtle);
  padding: 20px 24px;
}
.detail-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.detail-eyebrow {
  font-size: var(--text-caption); line-height: var(--text-caption-line);
  letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 600;
}
.detail-title { font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; margin-top: 6px; }
.detail-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.icon-btn {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 6px; color: var(--text-muted);
}
.icon-btn:hover { background: var(--brand-accent); color: var(--text-heading); }
.icon-btn svg { width: 16px; height: 16px; }

.detail-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 16px 24px;
  border-bottom: var(--border-width) solid var(--border-subtle);
  background: var(--surface-alt);
}
.detail-body { padding: 24px; }

.section { margin-bottom: 24px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding-bottom: 8px; margin-bottom: 12px;
  border-bottom: var(--border-width) solid var(--border-subtle);
}
.section-label {
  font-size: var(--text-caption); line-height: var(--text-caption-line);
  letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 600;
}

.kv { display: grid; grid-template-columns: 140px minmax(0,1fr); gap: 8px 16px; }
.kv dt {
  font-size: var(--text-caption); line-height: var(--text-caption-line);
  letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 600;
}
.kv dd { margin: 0; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); overflow-wrap: anywhere; }

.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  padding: 2px 8px; border-radius: 6px;
  border: var(--border-width) solid var(--border-subtle);
  background: var(--surface-alt);
  font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-body);
}

.draft-preview { background: var(--surface-alt); border: var(--border-width) solid var(--border-subtle); border-radius: var(--radius-sm); padding: 20px; }
.draft-preview h4 { font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; }
.draft-byline { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); margin-top: 6px; padding-bottom: 14px; border-bottom: var(--border-width) solid var(--border-subtle); }
.draft-preview p { font-size: var(--text-body-size); line-height: var(--text-body-line); margin-top: 14px; max-width: var(--measure); }
.draft-preview .h2 { font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; color: var(--text-heading); margin-top: 18px; }

/* evidence */
.ev-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-alt); border: var(--border-width) solid var(--border-subtle);
}
.ev-row + .ev-row { margin-top: 8px; }
.ev-label { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); }
.ev-figure { font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 700; color: var(--brand-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev-base { font-size: var(--text-caption); color: var(--text-muted); white-space: nowrap; }

/* ─────────────────────── the content inspection ─────────────────────── */

.inspection { border: var(--border-width) solid var(--border-subtle); border-radius: var(--radius); overflow: hidden; }

.insp-verdict-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  border-bottom: var(--border-width) solid var(--border-subtle);
  background: var(--surface-alt);
}
.insp-dial { flex: none; }
.insp-verdict { font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; }
.insp-verdict[data-sev='ok']        { color: var(--status-success); }
.insp-verdict[data-sev='monitor']   { color: var(--status-caution); }
.insp-verdict[data-sev='deficient'] { color: var(--status-danger); }
.insp-explain { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); margin-top: 2px; }

.finding { display: grid; grid-template-columns: 4px 66px minmax(0,1fr); gap: 0 12px; align-items: start; border-bottom: var(--border-width) solid var(--border-subtle); }
.finding:last-child { border-bottom: 0; }
.finding-stripe { align-self: stretch; }
.finding-stripe[data-sev='ok']        { background: var(--status-success); }
.finding-stripe[data-sev='monitor']   { background: var(--status-caution); }
.finding-stripe[data-sev='deficient'] { background: var(--status-danger); }
.finding-code { font-family: var(--font-mono); font-size: var(--text-caption); color: var(--text-muted); padding: 14px 0 14px 12px; }
.finding-body { padding: 14px 16px 14px 0; min-width: 0; }
.finding-label { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); }
.finding-note { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); margin-top: 2px; max-width: var(--measure); }

/* ──────────────────────────── system rows ───────────────────────────── */

.check-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; border-bottom: var(--border-width) solid var(--border-subtle); }
.check-row:last-child { border-bottom: 0; }
.check-icon { flex: none; margin-top: 2px; }
.check-icon svg { width: 18px; height: 18px; display: block; }
.check-icon[data-s='ok'] { color: var(--status-success); }
.check-icon[data-s='fail'] { color: var(--status-danger); }
.check-icon[data-s='skip'] { color: var(--text-muted); }
.check-name { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); width: 176px; flex: none; }
.check-detail { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); min-width: 0; overflow-wrap: anywhere; }

.gap-row { display: flex; gap: 12px; padding: 16px 20px; border-bottom: var(--border-width) solid var(--border-subtle); }
.gap-row:last-child { border-bottom: 0; }
.gap-row svg { width: 18px; height: 18px; flex: none; margin-top: 3px; color: var(--status-warning); }
.gap-title { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); }
.gap-line { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); margin-top: 4px; max-width: var(--measure); }
.gap-line b { color: var(--text-heading); font-weight: 600; }

/* ───────────────────────────── schedule ─────────────────────────────── */

.week { display: grid; grid-template-columns: repeat(7, minmax(132px, 1fr)); gap: 1px; background: var(--border-subtle); min-width: 940px; }
.day { background: var(--surface); padding: 12px; min-height: 170px; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.day-name { font-size: var(--text-caption); letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.day-num { font-size: var(--text-body-sm); color: var(--text-body); font-variant-numeric: tabular-nums; font-weight: 600; }
.day.is-today { background: var(--brand-accent); }
.day.is-today .day-num { color: var(--brand-primary); font-weight: 700; }

.slot { border-left: 3px solid var(--text-muted); padding: 8px 10px; margin-bottom: 8px; background: var(--surface-alt); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.slot[data-kind='gbp']       { border-left-color: var(--brand-primary); }
.slot[data-kind='email']     { border-left-color: var(--status-caution); }
.slot[data-kind='wordpress'] { border-left-color: var(--status-success); }
.slot[data-kind='script']    { border-left-color: var(--status-warning); }
.slot-kind { font-size: 11px; line-height: 16px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.slot-text { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-heading); margin-top: 2px; }
.slot-where { font-size: 11px; line-height: 16px; color: var(--text-muted); margin-top: 3px; }

/* ──────────────────────────── misc states ───────────────────────────── */

.empty { padding: 56px 24px; text-align: center; }
.empty-title { font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; color: var(--text-heading); }
.empty-note { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); margin-top: 8px; max-width: 62ch; margin-inline: auto; }

.banner { display: flex; gap: 10px; padding: 12px; border-radius: var(--radius-sm); background: var(--status-caution-bg); margin-bottom: 20px; }
.banner svg { width: 16px; height: 16px; flex: none; margin-top: 4px; color: var(--status-caution); }
.banner-title { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); }
.banner-text { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); max-width: var(--measure); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--text-heading); color: #fff;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: var(--text-body-sm); font-weight: 600; z-index: 90;
}
.toast[data-tone='bad'] { background: var(--status-danger); }

.progress-track { height: 8px; background: var(--status-neutral-bg); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--brand-primary); transition: width .4s ease; }

.spinner {
  width: 16px; height: 16px; border: 2px solid var(--border-subtle);
  border-top-color: var(--brand-primary); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sparkline { display: block; }
.delta { font-size: var(--text-body-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.delta[data-dir='up']   { color: var(--status-success); }
.delta[data-dir='down'] { color: var(--status-danger); }
.delta[data-dir='flat'] { color: var(--text-muted); }

/* ─────────────────────────────── login ─────────────────────────────── */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--surface-alt); }
.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 32px;
}
.login-lockup { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.login-lockup img { height: 56px; width: auto; }
.login-lockup .lockup-text { font-size: var(--text-h3); line-height: var(--text-h3-line); }
.login-sub { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-muted); margin-bottom: 24px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 10px 12px;
  border: var(--border-width) solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-heading);
  font-size: var(--text-body-sm);
}
.field input:focus { outline: 2px solid var(--brand-primary); outline-offset: 1px; border-color: transparent; }

.login-btn {
  width: 100%; padding: 11px;
  border-radius: var(--radius-sm);
  background: var(--brand-primary); color: #fff;
  font-size: var(--text-body-sm); font-weight: 600;
}
.login-btn:hover:not(:disabled) { background: var(--brand-primary-hover); }
.login-btn:disabled { opacity: .6; cursor: not-allowed; }

.login-error {
  margin-top: 16px; padding: 12px; border-radius: var(--radius-sm);
  background: var(--status-danger-bg); color: var(--status-danger);
  font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600;
}

/* ─────────────────────── welcome and guided tour ────────────────────── */

/* The welcome window: the same scrim as the detail pane, one card on top. */
.welcome-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: flex; padding: 24px; overflow-y: auto;
  background: rgba(0, 0, 0, .4);
  opacity: 0; transition: opacity .18s ease;
}
.welcome-backdrop.is-open { opacity: 1; }

.welcome {
  margin: auto;      /* centred, and still scrollable when taller than the window */
  width: min(560px, 100%);
  background: var(--surface);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 28px;
  transform: translateY(6px); transition: transform .18s ease;
}
.welcome-backdrop.is-open .welcome { transform: none; }

.welcome-title { font-size: var(--text-h3); line-height: var(--text-h3-line); font-weight: 600; margin-top: 20px; }
.welcome-lead { font-size: var(--text-body-size); line-height: var(--text-body-line); color: var(--text-body); margin-top: 8px; }

.welcome-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.welcome-steps li {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px; border-radius: var(--radius-sm);
  background: var(--surface-alt); border: var(--border-width) solid var(--border-subtle);
}
.welcome-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; margin-bottom: 6px;
  background: var(--brand-accent); color: var(--brand-primary);
  font-size: var(--text-caption); font-weight: 700; font-variant-numeric: tabular-nums;
}
.welcome-step-title { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); font-weight: 600; color: var(--text-heading); }
.welcome-step-text { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-body); }

.welcome-guide { display: flex; gap: 10px; margin-top: 20px; font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); }
.welcome-guide > svg { width: 18px; height: 18px; flex: none; margin-top: 3px; color: var(--brand-primary); }
.welcome-guide a { font-weight: 600; white-space: nowrap; }
.welcome-guide a svg { width: 14px; height: 14px; margin-left: 4px; vertical-align: -2px; }

.welcome-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 24px; padding-top: 20px;
  border-top: var(--border-width) solid var(--border-subtle);
}
.welcome-note { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); max-width: 36ch; }
.welcome-actions { display: flex; gap: 8px; flex: none; }

/* The tour. The layer covers the page, so nothing underneath can be clicked
   while it runs. The dimming is the highlight's own shadow spread across the
   window, which leaves a hole exactly over the thing being explained. It is a
   scrim, not elevation; the step card carries the one card shadow. */
.tour-layer { position: fixed; inset: 0; z-index: 100; opacity: 0; transition: opacity .2s ease; }
.tour-layer.is-open { opacity: 1; }

.tour-spot {
  position: fixed;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .5);
  outline: 2px solid var(--brand-primary);
  pointer-events: none;
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease, outline-color .2s ease;
}
.tour-spot.is-empty { outline-color: transparent; }

.tour-pop {
  position: fixed;
  width: min(380px, calc(100vw - 24px));
  background: var(--surface);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 20px;
  opacity: 0; visibility: hidden;
  transition: opacity .15s ease, visibility 0s linear .15s;
}
.tour-pop.is-shown { opacity: 1; visibility: visible; transition: opacity .15s ease; }

.tour-eyebrow {
  font-size: var(--text-caption); line-height: var(--text-caption-line);
  letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 600;
}
.tour-title { font-size: var(--text-h4); line-height: var(--text-h4-line); font-weight: 600; margin-top: 6px; }
.tour-body { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); color: var(--text-body); margin-top: 6px; }
.tour-hint { font-size: var(--text-caption); line-height: var(--text-caption-line); color: var(--text-muted); margin-top: 10px; }

.tour-progress { height: 4px; border-radius: 999px; background: var(--status-neutral-bg); overflow: hidden; margin-top: 16px; }
.tour-progress-fill { height: 100%; background: var(--brand-primary); transition: width .25s ease; }

.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.tour-actions-right { display: flex; gap: 8px; }
.tour-end { padding: 8px 2px; font-size: var(--text-body-sm); font-weight: 600; color: var(--text-muted); }
.tour-end:hover { color: var(--text-heading); }

.tour-loading {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--card-shadow);
  font-size: var(--text-body-sm); font-weight: 600; color: var(--text-body);
}

/* ───────────────────────────── responsive ───────────────────────────── */

@media (max-width: 1080px) {
  .split { grid-template-columns: 1fr; }
  .split-rail { position: static; }
  .rail-card { flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 900px) {
  .rail {
    position: static; width: auto; height: auto;
    flex-direction: row; align-items: center;
    border-right: 0; border-bottom: var(--border-width) solid var(--border-subtle);
  }
  .rail-brand { border-bottom: 0; border-right: var(--border-width) solid var(--border-subtle); }
  .rail-nav { flex-direction: row; overflow-x: auto; padding: 10px 12px; }
  .nav-item { white-space: nowrap; }
  .rail-foot { border-top: 0; border-left: var(--border-width) solid var(--border-subtle); }
  .rail-who { display: none; }
  .page { margin-left: 0; }
  .page-head { position: static; height: auto; padding: 16px 20px; flex-wrap: wrap; }
  .main { padding: 20px; }
  .row-head { display: none; }
  .row { grid-template-columns: 4px minmax(0,1fr) auto; }
  .row-kw, .row-when { display: none; }
}

@media (max-width: 560px) {
  .welcome-backdrop { padding: 16px; }
  .welcome { padding: 20px; }
  .welcome-lead { font-size: var(--text-body-sm); line-height: var(--text-body-sm-line); }
  .welcome-steps { grid-template-columns: 1fr; }
  .welcome-steps li { display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 12px; }
  .welcome-num { grid-row: span 2; margin-bottom: 0; }
  .welcome-foot { flex-direction: column; align-items: stretch; }
  .welcome-note { max-width: none; }
  .welcome-actions { justify-content: flex-end; }
  .tour-pop { padding: 16px; }
}
