/* Editorial Newsroom Command Desk stylesheet: self-contained, warm archival paper,
   Vietnamese-safe typography, and zero external dependencies.

   Line-break protections (scripts/check_linebreaks.py):
   `.nowrap`, `flex-wrap: wrap`, and `text-wrap: balance/pretty` keep multi-syllable
   Vietnamese names, compounds, and headings from splitting awkwardly. */

:root {
  /* Surfaces */
  --bg: #f8f7f4;
  --bg-subtle: #f1efe9;
  --sidebar-bg: #fcfbf9;
  --paper: #ffffff;

  /* Borders */
  --line: #e5e2dc;
  --line-strong: #d4cfc7;
  /* Contrast verified: 4.80:1 on #ffffff and 4.48:1 on #f8f7f4 (>= 3:1 control floor). */
  --field-line: #78716c;

  /* Ink */
  --ink: #18181b;
  --ink-secondary: #3f3f46;
  --muted: #57534e;
  --ink-subtle: #78716c;

  /* Semantic newsroom accents */
  --accent: #1e3a5f;
  --accent-hover: #172e4c;
  --accent-fill: #1e3a5f;
  --accent-fill-hover: #172e4c;
  --accent-soft: #eff4fa;
  --accent-border: #cbd9ea;

  --danger: #b91c1c;
  --danger-hover: #991b1b;
  --danger-fill: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-tint: #fef8f8;
  --danger-border: #fecaca;

  --warn: #b45309;
  --warn-ink: #92400e;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;

  --ok: #15803d;
  --ok-hover: #166534;
  --ok-fill: #15803d;
  --ok-fill-hover: #166534;
  --ok-soft: #f0fdf4;
  --ok-border: #bbf7d0;

  --on-fill: #ffffff;

  /* Highlighted flagged spans */
  --mark-bg: #fef08a;
  --mark-border: #eab308;
  --mark-critical-bg: #fee2e2;
  --mark-critical-border: #dc2626;

  /* Typography */
  --font-sans: "Inter", "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Spacing & radii (lowercase letters + hyphens only) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* Subtle elevation */
  --shadow-xs: 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-sm: 0 1px 3px rgba(24, 24, 27, 0.06), 0 1px 2px rgba(24, 24, 27, 0.03);
  --shadow-md: 0 6px 18px rgba(24, 24, 27, 0.08), 0 2px 6px rgba(24, 24, 27, 0.04);

  /* Layout metrics */
  --sidebar-width: 248px;
  --topbar-height: 60px;
  --content-max: 1200px;
}

[data-theme="dark"] {
  --bg: #141413;
  --bg-subtle: #1c1b1a;
  --sidebar-bg: #181716;
  --paper: #201f1d;
  --line: #32302d;
  --line-strong: #44403c;
  --field-line: #a8a29e;
  --ink: #f5f5f4;
  --ink-secondary: #d6d3d1;
  --muted: #a8a29e;
  --ink-subtle: #8c857d;
  --accent: #93c5fd;
  --accent-hover: #bfdbfe;
  --accent-fill: #1d4ed8;
  --accent-fill-hover: #1e40af;
  --accent-soft: #172554;
  --accent-border: #1e3a8a;
  --danger: #f87171;
  --danger-hover: #fca5a5;
  --danger-fill: #b91c1c;
  --danger-soft: #2a1414;
  --danger-tint: #241212;
  --danger-border: #7f1d1d;
  --warn: #fbbf24;
  --warn-ink: #fcd34d;
  --warn-soft: #291f0b;
  --warn-border: #78350f;
  --ok: #4ade80;
  --ok-hover: #86efac;
  --ok-fill: #15803d;
  --ok-fill-hover: #166534;
  --ok-soft: #0f2417;
  --ok-border: #166534;
  --on-fill: #ffffff;
  --mark-bg: #713f12;
  --mark-border: #ca8a04;
  --mark-critical-bg: #7f1d1d;
  --mark-critical-border: #f87171;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  text-wrap: pretty;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.nowrap {
  white-space: nowrap;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 10px 16px;
  z-index: 50;
  border-radius: 0 0 8px 0;
  border: 1px solid var(--line);
}

.skip:focus {
  left: 0;
}

/* --- Environment Identity Banner --- */
.stack-banner {
  margin: 0;
  padding: 10px 16px;
  background: var(--danger-fill);
  color: var(--on-fill);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
  text-wrap: pretty;
}

/* --- Form Controls: First rule for every control explicitly uses var(--field-line) --- */
.field input {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--field-line);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  min-width: 0;
  width: 100%;
}

.field select {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--field-line);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  min-width: 0;
  width: 100%;
}

.field textarea {
  font: inherit;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--field-line);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  min-width: 100%;
  width: 100%;
  resize: vertical;
}

.field textarea.text-input {
  font-family: var(--font-sans);
  font-size: 14px;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form input {
  min-width: 0;
  width: 120px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--paper);
  padding: 6px 9px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius-sm);
}

/* --- Persistent Sidebar + Workspace Shell --- */
.nav-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 30;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.sidebar-brand::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--danger);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.3;
}

.brand .org {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--danger);
  white-space: nowrap;
}

.brand .app {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-subtle);
  padding: 0 10px;
  margin: 0 0 6px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--ink);
  text-decoration: none;
}

.nav-link[aria-current="page"] {
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--muted);
}

.nav-link[aria-current="page"] .nav-icon {
  color: var(--danger);
}

.nav-count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--danger-fill);
  color: var(--on-fill);
  font-variant-numeric: tabular-nums;
}

.sidebar-foot {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.account-info {
  min-width: 0;
}

.account-name {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-role {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.signout {
  margin: 0;
}

.btn-signout {
  padding: 5px 10px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.btn-signout:hover {
  border-color: var(--danger-border);
  color: var(--danger);
  background: var(--danger-soft);
}

.build-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--ink-subtle);
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 27, 0.45);
  z-index: 25;
}

/* --- Workspace & Topbar --- */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--topbar-height);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 10px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.topbar-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.theme-btn:hover {
  color: var(--ink);
  border-color: var(--accent);
}

/* --- Live SSE Indicator --- */
.live {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--muted);
  white-space: nowrap;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.live.on {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: var(--ok-border);
}

.live.on .live-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.18);
}

.live.off {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}

.live.off .live-dot {
  background: var(--danger);
}

/* --- Main Page Container --- */
.page {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 28px 56px;
}

h1 {
  font-size: 23px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
  text-wrap: balance;
}

h2 {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 12px;
  text-wrap: balance;
}

h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 14px 0 8px;
  color: var(--ink-secondary);
}

.intro {
  color: var(--muted);
  margin: 0 0 20px;
  max-width: 62ch;
  font-size: 14.5px;
  text-wrap: pretty;
}

.notice,
.error,
.trial {
  width: 100%;
  max-width: var(--content-max);
  margin: 16px auto 0;
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
}

.workspace .notice,
.workspace .error,
.workspace .trial {
  width: auto;
  margin: 16px 28px 0;
}

.notice {
  background: var(--ok-soft);
  border: 1px solid var(--ok-border);
  border-left: 3px solid var(--ok);
  color: var(--ok);
}

.error {
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-left: 3px solid var(--danger);
  color: var(--danger);
}

.trial {
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-left: 3px solid var(--warn);
  color: var(--warn-ink);
}

.finding .error {
  margin: 12px 0 0;
  width: 100%;
}

.back {
  max-width: var(--content-max);
  margin: 16px auto 0;
  padding: 0 28px;
}

/* --- Buttons --- */
button,
.button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

button:hover,
.button:hover,
.btn:hover {
  border-color: var(--accent);
  background: var(--bg-subtle);
  text-decoration: none;
}

.btn-sm {
  font-size: 13px;
  padding: 6px 12px;
}

button.primary,
.button.primary,
.btn-primary {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--on-fill);
}

button.primary:hover,
.button.primary:hover,
.btn-primary:hover {
  background: var(--accent-fill-hover);
  border-color: var(--accent-fill-hover);
  color: var(--on-fill);
}

.btn-confirm {
  background: var(--ok-fill);
  border-color: var(--ok-fill);
  color: var(--on-fill);
}

.btn-confirm:hover {
  background: var(--ok-fill-hover);
  border-color: var(--ok-fill-hover);
  color: var(--on-fill);
}

.btn-reject,
.btn-danger-outline {
  background: var(--paper);
  border-color: var(--danger-border);
  color: var(--danger);
}

.btn-reject:hover,
.btn-danger-outline:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

.btn-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* --- KPI Strip (Admin Feed) --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 15px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
}

.kpi-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.kpi-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.kpi-card.kpi-critical::before {
  background: var(--danger);
}

.kpi-card.kpi-warn::before {
  background: var(--warn);
}

.kpi-card.kpi-ok::before {
  background: var(--ok);
}

.kpi-card.kpi-accent::before {
  background: var(--accent);
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.kpi-card.kpi-critical .kpi-value {
  color: var(--danger);
}

.kpi-card.kpi-ok .kpi-value {
  color: var(--ok);
}

.kpi-sub {
  font-size: 12px;
  color: var(--ink-subtle);
}

/* --- Parked Revisions Notice --- */
.parked {
  margin-bottom: 18px;
  padding: 13px 16px;
  border-radius: var(--radius);
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-left: 3px solid var(--warn);
  color: var(--warn-ink);
}

.parked-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.parked h2,
.parked-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.parked-hint {
  font-size: 12.5px;
}

.parked-intro {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: inherit;
}

.parked ul {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13.5px;
}

.parked a {
  color: var(--warn-ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.parked-notice {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-left: 3px solid var(--warn);
  color: var(--warn-ink);
  font-size: 13.5px;
  margin: 0;
}

/* --- Filter & Search Shell --- */
.filter-shell {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  margin-bottom: 20px;
  overflow: hidden;
}

.filter-tabs-row {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--sidebar-bg);
}

.seg-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.seg-btn {
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  color: var(--muted);
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}

.seg-btn:hover {
  background: var(--bg-subtle);
  color: var(--ink);
  text-decoration: none;
}

.seg-btn.active {
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

.seg-btn.seg-critical.active {
  background: var(--danger-fill);
  color: var(--on-fill);
}

.filters {
  padding: 12px 16px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-shell .filters {
  margin-bottom: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.filters-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  margin-bottom: 22px;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.filters input,
.filters select {
  font: inherit;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--field-line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  min-width: 155px;
}

.search-wrap {
  position: relative;
  flex: 1 1 260px;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--ink-subtle);
  pointer-events: none;
}

.filters input.search-input {
  width: 100%;
  padding-left: 34px;
}

.filter-reset,
.reset {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 7px 8px;
  white-space: nowrap;
}

.filter-reset:hover,
.reset:hover {
  color: var(--danger);
  text-decoration: underline;
}

/* --- Editorial Triage Cards (Feed) --- */
.queue {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card[data-critical="true"] {
  border-color: var(--danger-border);
}

.card-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.card-head-grid {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.card-head-main {
  flex: 1 1 420px;
  min-width: 0;
}

.card-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.section-pill {
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  white-space: nowrap;
}

.dot-sep {
  color: var(--line-strong);
}

.card-head h2 {
  margin: 0;
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.card-head h2 a {
  color: var(--ink);
}

.card-head h2 a:hover {
  color: var(--accent);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.reading-disclosure {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.reading-disclosure summary {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.reading-disclosure summary::-webkit-details-marker {
  display: none;
}

.reading-disclosure summary:hover {
  color: var(--accent);
}

.reading-disclosure .reading {
  margin: 8px 0 2px;
  font-size: 13.5px;
  color: var(--ink-secondary);
  max-width: 46rem;
  line-height: 1.6;
}

.reading-label {
  color: var(--muted);
  font-weight: 600;
}

/* --- Finding Rows --- */
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
}

.row:last-child {
  border-bottom: 0;
}

.row.is-critical {
  background: var(--danger-tint);
  border-left-color: var(--danger);
}

.tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 11px;
  font-size: 12.5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.45;
}

.badge.sev-critical {
  background: var(--danger-fill);
  color: var(--on-fill);
}

.badge.sev-non-critical {
  background: var(--bg-subtle);
  color: var(--muted);
  border: 1px solid var(--line);
}

.badge.state-unverified {
  background: var(--warn-soft);
  color: var(--warn-ink);
  border: 1px solid var(--warn-border);
}

.badge.state-confirmed {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid var(--ok-border);
}

.badge.state-rejected {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.badge.state-fixed,
.badge.state-removed,
.badge.state-live {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.badge.model-pending {
  background: var(--warn-soft);
  color: var(--warn-ink);
  border: 1px solid var(--warn-border);
}

.badge.count {
  background: var(--ink);
  color: var(--paper);
}

.critical-why-chip {
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
}

.meta-chip,
.tag {
  font-size: 12px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.stamp,
.tags time {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--ink-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* --- Error Focus Block (Passage + Suggestion) --- */
.error-focus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 18px;
  align-items: stretch;
  margin-bottom: 10px;
}

.error-focus.no-suggestion {
  grid-template-columns: minmax(0, 1fr);
}

.context-box {
  margin: 0;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  max-width: 46rem;
}

.row.is-critical .context-box,
.finding.sev-critical .context-box {
  border-left-color: var(--danger);
  background: var(--paper);
}

.context-box a {
  color: inherit;
  text-decoration: none;
}

.context-box a:hover {
  text-decoration: none;
}

.context-box mark,
.places mark {
  background: var(--mark-bg);
  color: var(--ink);
  padding: 1px 4px;
  border-radius: 3px;
  border-bottom: 2px solid var(--mark-border);
  font-weight: 600;
}

.row.is-critical .context-box mark,
.finding.sev-critical .context-box mark {
  background: var(--mark-critical-bg);
  border-bottom-color: var(--mark-critical-border);
  color: var(--ink);
}

.suggestion-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 10px 14px;
  min-width: 195px;
  max-width: 300px;
  background: var(--ok-soft);
  border: 1px solid var(--ok-border);
  border-radius: var(--radius-sm);
}

.suggestion-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ok);
}

.suggestion-value {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ok);
  line-height: 1.45;
}

.reason-line {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--ink-secondary);
  max-width: 46rem;
  line-height: 1.55;
}

.judge-line {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: var(--muted);
  max-width: 46rem;
}

.judge-line strong {
  color: var(--ink-secondary);
  font-weight: 600;
}

.meta {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13.5px;
  text-wrap: pretty;
}

.meta-gap {
  display: inline-block;
  width: 14px;
}

/* --- Collapsible Technical Details & Shared Evidence --- */
.tech-details {
  margin-top: 8px;
}

.tech-details summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 0;
  list-style: none;
  user-select: none;
}

.tech-details summary::-webkit-details-marker {
  display: none;
}

.tech-details summary:hover {
  color: var(--accent);
}

.chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

details[open] > summary .chevron {
  transform: rotate(90deg);
}

.tech-well {
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink-secondary);
}

.evidence-grid {
  margin: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 14px;
}

.evidence-grid dt {
  color: var(--muted);
  font-weight: 600;
}

.evidence-grid dd {
  margin: 0;
  color: var(--ink-secondary);
  min-width: 0;
  overflow-wrap: anywhere;
}

.evidence .clause {
  margin-top: 2px;
}

.evidence .clause summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

.evidence .clause p {
  margin: 6px 0 0;
  padding: 8px 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.tech-footer-meta {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.tech-well > .tech-footer-meta:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* --- Article Decision Workspace (2-Column Desktop) --- */
.breadcrumb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}

.back-link:hover {
  color: var(--accent);
}

.article-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.article-rail {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rail-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-xs);
}

.rail-card h1 {
  margin: 10px 0 12px;
  font-size: 18.5px;
  font-weight: 700;
  line-height: 1.4;
}

.meta-kv {
  margin: 0 0 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  font-size: 13px;
}

.meta-kv dt {
  color: var(--muted);
}

.meta-kv dd {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.rail-actions .btn,
.rail-actions form,
.rail-actions button {
  width: 100%;
}

.rail-heading {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.rail-reading {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-secondary);
}

.jump-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.jump-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}

.jump-list a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.jump-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.jump-dot.critical {
  background: var(--danger);
}

.jump-dot.normal {
  background: var(--warn);
}

.article-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.article-main .block {
  margin-top: 0;
}

.section-heading {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.findings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.finding {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.finding.sev-critical {
  border-color: var(--danger-border);
  border-left: 4px solid var(--danger);
}

.proof-well {
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}

.proof-well-title {
  margin: 0 0 8px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.places-label {
  margin-top: 10px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.places {
  list-style: none;
  margin: 4px 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.places li {
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.place-context {
  display: block;
  width: 100%;
  color: var(--muted);
  font-size: 13.5px;
  text-wrap: pretty;
}

.note {
  margin: 10px 0;
  padding: 9px 12px;
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  max-width: 46rem;
}

/* --- Decision Action Form --- */
.action {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  min-width: 0;
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Visual order leads with Confirm/Reject while DOM keeps value="note" first for Enter safety */
.buttons .btn-confirm {
  order: 1;
}

.buttons .btn-reject {
  order: 2;
}

.buttons .btn-note {
  order: 3;
}

.confirm-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-subtle);
}

.advanced {
  margin-top: 14px;
}

.advanced summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.advanced.more summary {
  color: var(--muted);
  font-size: 12.5px;
}

.more-body {
  margin-top: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

.pending {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warn-border);
  border-left: 3px solid var(--warn);
  background: var(--warn-soft);
  color: var(--warn-ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13.5px;
}

.pending form.undo {
  margin-left: auto;
}

.decided {
  margin: 14px 0 0;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ok-border);
  border-left: 3px solid var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 13.5px;
  font-weight: 500;
}

.next {
  margin: 16px 0 0;
}

.next a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  font-weight: 600;
  font-size: 13.5px;
}

/* --- Revisions & Diffs --- */
.revision {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 12px;
}

.revision summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.diff {
  list-style: none;
  margin: 12px 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hunk {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 14px;
}

.hunk .old {
  padding: 10px 14px;
  background: var(--danger-soft);
  border-bottom: 1px solid var(--danger-border);
  color: var(--ink);
}

.hunk .new {
  padding: 10px 14px;
  background: var(--ok-soft);
  color: var(--ink);
}

.diff-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  color: var(--muted);
}

.diff .old p,
.diff .new p {
  margin: 4px 0;
  text-wrap: pretty;
}

.body {
  max-width: 44rem;
  font-size: 15px;
  line-height: 1.72;
  color: var(--ink-secondary);
}

.body p {
  margin: 0 0 12px;
  text-wrap: pretty;
}

.captions {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13.5px;
}

.captions li {
  margin-bottom: 6px;
}

.caption-credit {
  display: block;
  color: var(--ink-subtle);
  font-size: 12.5px;
}

/* --- Secondary Pages: Panels, Metric Tiles, Tables & Forms --- */
.block {
  margin-top: 28px;
}

.panel-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  margin-top: 20px;
}

.panel-card h2 {
  margin-top: 0;
}

.subtle-note-card {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-top: 20px;
}

.subtle-note-card h2 {
  font-size: 15px;
  margin-bottom: 6px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.tile {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
}

.tile-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.tile-value {
  font-size: 27px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.tile-note {
  font-size: 12.5px;
  color: var(--muted);
  text-wrap: pretty;
}

.tile.is-breach {
  border-color: var(--danger-border);
  box-shadow: inset 0 3px 0 var(--danger);
}

.tile-flag {
  display: inline-block;
  align-self: flex-start;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-weight: 700;
  font-size: 11.5px;
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.columns > .block,
.columns > .panel-card {
  margin-top: 0;
}

.table-scroll {
  overflow-x: auto;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.table-scroll .table {
  border: 0;
  border-radius: 0;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 14px;
}

.table th,
.table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table th {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  background: var(--sidebar-bg);
}

.table tr:last-child td {
  border-bottom: 0;
}

.table td.number,
.table th.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rate-breach {
  color: var(--danger);
  font-weight: 700;
}

.bar-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.bar-track {
  width: 72px;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  flex-shrink: 0;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
}

.wide {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-span-full {
  grid-column: 1 / -1;
}

.proposal {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.proposal-text {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent-border);
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.changes tr.change-before td {
  background: var(--danger-soft);
  color: var(--danger);
}

.changes tr.change-before td[data-label]:last-child {
  text-decoration: line-through;
}

.changes tr.change-after td {
  background: var(--ok-soft);
}

.enrolment {
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-top: 20px;
}

.enrolment dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 12px 0 0;
}

.enrolment dt {
  color: var(--muted);
  font-weight: 600;
}

.enrolment dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.enrolment code {
  word-break: break-all;
  background: var(--paper);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--warn-border);
}

.empty,
.empty-state {
  padding: 28px 20px;
  text-align: center;
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14.5px;
  margin: 0;
}

td.empty {
  border: 0;
  border-radius: 0;
}

/* --- Auth & Unauthenticated Pages --- */
.auth-masthead {
  padding: 16px 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  border-top: 3px solid var(--danger);
}

.page-auth {
  padding-top: 32px;
}

.signin {
  max-width: 420px;
  margin: 6vh auto 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px solid var(--danger);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 32px;
}

.signin h1 {
  margin-bottom: 8px;
}

.signin form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.signin button[type="submit"] {
  width: 100%;
  padding: 10px 16px;
}

.error-card {
  max-width: 560px;
  margin: 6vh auto 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.error-card .error {
  margin: 14px 0 0;
}

.error-card .back {
  padding: 0;
  margin: 18px 0 0;
}

.foot {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.foot span {
  white-space: nowrap;
}

/* --- Responsive Breakpoints --- */
@media (max-width: 1024px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-md);
  }

  .nav-toggle-input:checked ~ .shell .sidebar {
    transform: translateX(0);
  }

  .nav-toggle-input:checked ~ .sidebar-backdrop {
    display: block;
  }

  .menu-toggle {
    display: inline-flex;
  }
}

@media (max-width: 900px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .article-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-rail {
    position: static;
  }

  .error-focus {
    grid-template-columns: minmax(0, 1fr);
  }

  .suggestion-box {
    max-width: none;
  }
}

/* Stack breakpoint (720px, matching config/settings.toml ui_stack_breakpoint_px) */
@media (max-width: 720px) {
  .topbar {
    padding: 10px 14px;
  }

  .page {
    padding: 16px 14px 44px;
  }

  .workspace .notice,
  .workspace .error,
  .workspace .trial {
    margin: 12px 14px 0;
  }

  .card-head,
  .row,
  .finding,
  .panel-card {
    padding-left: 15px;
    padding-right: 15px;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .filters label {
    min-width: 0;
    width: 100%;
  }

  .filters input,
  .filters select {
    width: 100%;
    min-width: 0;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .evidence-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .evidence-grid dd {
    margin-bottom: 8px;
  }

  .tags time,
  .stamp {
    margin-left: 0;
  }

  .buttons button {
    white-space: normal;
    text-align: center;
    max-width: 100%;
  }

  button,
  .button,
  .btn,
  .seg-btn,
  .nav-link,
  .inline-form input,
  .field input,
  .field select,
  .filters select,
  .filters input,
  .tech-details summary,
  .places a,
  .stamp {
    min-height: 44px;
  }

  .table-scroll {
    max-height: none;
    border: 0;
    background: transparent;
  }

  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table {
    border: 0;
    background: transparent;
  }

  .table tr {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    margin-bottom: 12px;
    padding: 6px 14px;
  }

  .table td {
    border: 0;
    padding: 7px 0;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: baseline;
  }

  .table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 600;
  }

  .table td:empty {
    display: none;
  }
}
