:root {
  --paper: #eef1f0;
  --paper-raised: #ffffff;
  --ink: #12181c;
  --ink-soft: #48545a;
  --ink-faint: #7c8a8a;
  --line: #d6dcda;
  --line-strong: #b9c2bf;
  --accent: #145c56;
  --accent-strong: #0d413d;
  --accent-soft: #e2eeec;
  --accent-soft-line: #bcd6d1;
  --sev-critical: #b23a30;
  --sev-critical-soft: #f7e4e1;
  --sev-high: #a06a0a;
  --sev-high-soft: #f6ecd8;
  --sev-medium: #3f5f9e;
  --sev-medium-soft: #e5eaf6;
  --sev-low: #47775f;
  --sev-low-soft: #e4efe8;
  --shadow: 0 1px 2px rgba(20, 30, 28, 0.06), 0 6px 20px -8px rgba(20, 30, 28, 0.18);
}

:root[data-theme="dark"] {
  --paper: #10161a;
  --paper-raised: #171f24;
  --ink: #e8edec;
  --ink-soft: #a7b3b1;
  --ink-faint: #71807e;
  --line: #29343a;
  --line-strong: #38454b;
  --accent: #5cc0b3;
  --accent-strong: #86dccf;
  --accent-soft: #163531;
  --accent-soft-line: #275149;
  --sev-critical: #e8776b;
  --sev-critical-soft: #3a201e;
  --sev-high: #d9a959;
  --sev-high-soft: #362c17;
  --sev-medium: #8ea6de;
  --sev-medium-soft: #202940;
  --sev-low: #86c1a4;
  --sev-low-soft: #1c3527;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10161a;
    --paper-raised: #171f24;
    --ink: #e8edec;
    --ink-soft: #a7b3b1;
    --ink-faint: #71807e;
    --line: #29343a;
    --line-strong: #38454b;
    --accent: #5cc0b3;
    --accent-strong: #86dccf;
    --accent-soft: #163531;
    --accent-soft-line: #275149;
    --sev-critical: #e8776b;
    --sev-critical-soft: #3a201e;
    --sev-high: #d9a959;
    --sev-high-soft: #362c17;
    --sev-medium: #8ea6de;
    --sev-medium-soft: #202940;
    --sev-low: #86c1a4;
    --sev-low-soft: #1c3527;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.font-display {
  font-family: ui-serif, "Iowan Old Style", "Palatino Linotype", "URW Palladio", Georgia, serif;
}

.mono {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

a { color: var(--accent-strong); }
:root[data-theme="dark"] a, :root:not([data-theme="light"]) a { color: var(--accent); }

.page {
  max-width: 1760px;
  margin: 0 auto;
  padding: 56px 28px 96px;
}

header.doc-head {
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 28px;
  margin-bottom: 40px;
}

.eyebrow {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

h1.doc-title {
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.15;
  margin: 0 0 10px;
  text-wrap: balance;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.doc-sub {
  color: var(--ink-soft);
  font-size: 16.5px;
  max-width: 62ch;
  margin: 0 0 20px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-size: 13px;
  color: var(--ink-faint);
}

.meta-row strong { color: var(--ink-soft); font-weight: 600; }

section { margin-bottom: 52px; }

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}

.sec-num {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-line);
  border-radius: 4px;
  padding: 2px 7px;
  flex-shrink: 0;
}

h2 {
  font-size: 21px;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.005em;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 10px;
}

p { margin: 0 0 14px; max-width: 68ch; }
p:last-child { margin-bottom: 0; }

.lede {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 66ch;
}

/* --- gap cards --- */
.gap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 720px) { .gap-grid { grid-template-columns: 1fr; } }

.gap-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 16px 18px;
  box-shadow: var(--shadow);
}
.gap-card .gap-num {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 8px;
  display: block;
}
.gap-card p { font-size: 14.5px; color: var(--ink-soft); margin: 0; }

/* --- tables --- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  background: var(--paper-raised);
}
th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}
thead th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-weight: 600;
  background: var(--paper);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
td.src-name { font-weight: 600; white-space: nowrap; }
td .tag {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--ink-faint);
}

/* --- tech inventory chips --- */
.tech-groups { display: grid; gap: 14px; }
.tech-group {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 620px) { .tech-group { grid-template-columns: 1fr; gap: 6px; } }
.tech-group-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-weight: 600;
  padding-top: 5px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  background: var(--paper-raised);
  white-space: nowrap;
}

/* --- severity table --- */
.sev-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
}
.sev-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.sev-critical { color: var(--sev-critical); background: var(--sev-critical-soft); }
.sev-critical::before { background: var(--sev-critical); }
.sev-high { color: var(--sev-high); background: var(--sev-high-soft); }
.sev-high::before { background: var(--sev-high); }
.sev-medium { color: var(--sev-medium); background: var(--sev-medium-soft); }
.sev-medium::before { background: var(--sev-medium); }
.sev-low { color: var(--sev-low); background: var(--sev-low-soft); }
.sev-low::before { background: var(--sev-low); }

.status-pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 5px;
  white-space: nowrap;
}
.status-confirmed { color: var(--accent-strong); background: var(--accent-soft); border: 1px solid var(--accent-soft-line); }
.status-reactive { color: var(--sev-high); background: var(--sev-high-soft); border: 1px solid var(--sev-high-soft); }
:root[data-theme="dark"] .status-confirmed, :root:not([data-theme="light"]) .status-confirmed { color: var(--accent); }
.status-todo { color: var(--ink-faint); background: transparent; border: 1px dashed var(--line-strong); }

.escalation-note {
  margin-top: 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
}
.escalation-note p { color: var(--ink); font-size: 14.5px; margin: 0; }
.escalation-note strong { color: var(--accent-strong); }

/* --- flowchart --- */
.flow {
  display: grid;
  grid-template-columns: 34px 1fr;
  column-gap: 16px;
}
.flow-node {
  display: contents;
}
.flow-rail {
  position: relative;
  display: flex;
  justify-content: center;
}
.flow-rail .circle {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--paper-raised);
  border: 2px solid var(--accent);
  color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  font-weight: 700;
  z-index: 1;
  flex-shrink: 0;
}
.flow-rail .stem {
  position: absolute;
  top: 30px;
  bottom: -22px;
  left: 50%;
  width: 2px;
  background: var(--line-strong);
  transform: translateX(-50%);
}
.flow-node:last-child .flow-rail .stem { display: none; }
.flow-content { padding-bottom: 22px; }
.flow-content .flow-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}
.flow-content .flow-desc {
  font-size: 13.5px;
  color: var(--ink-soft);
  max-width: 56ch;
}
.flow-branch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
@media (max-width: 560px) { .flow-branch { grid-template-columns: 1fr; } }
.branch-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--paper-raised);
  font-size: 13px;
}
.branch-card.matched { border-color: var(--accent-soft-line); }
.branch-card.unmatched { border-color: var(--sev-high); background: var(--sev-high-soft); }
.branch-card .branch-label {
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  display: block;
}
.branch-card.matched .branch-label { color: var(--accent-strong); }
.branch-card.unmatched .branch-label { color: var(--sev-high); }
.branch-card p { margin: 0; color: var(--ink-soft); font-size: 13px; }

/* --- RACI --- */
.raci-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.raci { min-width: 640px; }
table.raci th:first-child, table.raci td:first-child {
  position: sticky; left: 0;
  background: var(--paper-raised);
  font-weight: 500;
  min-width: 220px;
}
table.raci thead th:first-child { background: var(--paper); }
table.raci th, table.raci td { text-align: center; }
table.raci th:first-child, table.raci td:first-child { text-align: left; }
.raci-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  font-weight: 700;
}
.raci-r { background: var(--accent); color: #fff; }
:root[data-theme="dark"] .raci-r, :root:not([data-theme="light"]) .raci-r { color: #0a1613; }
.raci-a { background: var(--ink); color: var(--paper); }
.raci-c { border: 1.5px solid var(--line-strong); color: var(--ink-soft); background: transparent; }
.raci-i { color: var(--ink-faint); font-weight: 500; }
.raci-none { color: var(--ink-faint); opacity: 0.5; font-family: ui-monospace, monospace; }
.raci-cell + .raci-cell { margin-left: 4px; }
.to-confirm-flag {
  display: inline-block;
  margin-left: 4px;
  color: var(--sev-high);
  font-size: 10px;
  vertical-align: super;
}
.raci-legend {
  display: flex; flex-wrap: wrap; gap: 16px;
  font-size: 12.5px; color: var(--ink-faint);
  margin-top: 12px;
}
.raci-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* --- PoC comparison --- */
.poc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 640px) { .poc-grid { grid-template-columns: 1fr; } }
.poc-card {
  border-radius: 10px;
  padding: 18px 18px 20px;
  border: 1px solid var(--line);
}
.poc-card.real { background: var(--accent-soft); border-color: var(--accent-soft-line); }
.poc-card.sim { background: var(--paper-raised); }
.poc-card h3 { display: flex; align-items: center; gap: 8px; }
.poc-card h3 .sw { width: 8px; height: 8px; border-radius: 50%; }
.poc-card.real h3 .sw { background: var(--accent); }
.poc-card.sim h3 .sw { background: var(--ink-faint); }
.poc-card ul { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-soft); }
.poc-card li { margin-bottom: 6px; }
.poc-card li:last-child { margin-bottom: 0; }

/* --- open items --- */
.checklist { display: grid; gap: 10px; }
.checklist li {
  list-style: none;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
}
.checklist ol { margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist .num {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-line);
  border-radius: 5px;
  padding: 1px 6px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* --- closing --- */
.closing {
  border-top: 1px solid var(--line-strong);
  padding-top: 28px;
  margin-top: 48px;
}
blockquote.principle {
  margin: 0 0 16px;
  font-family: ui-serif, "Iowan Old Style", Georgia, serif;
  font-size: 20px;
  font-style: italic;
  line-height: 1.45;
  color: var(--ink);
  max-width: 56ch;
  border: none;
}
.closing p { color: var(--ink-soft); font-size: 14.5px; }

footer.doc-foot {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-faint);
  font-family: ui-monospace, monospace;
}

/* --- landing page --- */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
}
.landing-shield {
  font-size: 34px;
  margin-bottom: 18px;
}
.landing h1 {
  font-size: clamp(26px, 4.5vw, 36px);
  margin: 0 0 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.landing p.landing-sub {
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 0 30px;
  font-size: 16px;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--paper-raised);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  padding: 13px 24px;
  border-radius: 9px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
.landing-foot {
  margin-top: 20px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

.live-stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.live-stat { text-align: center; min-width: 80px; }
.live-stat-value {
  display: block;
  font-family: ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-strong);
}
:root[data-theme="dark"] .live-stat-value, :root:not([data-theme="light"]) .live-stat-value { color: var(--accent); }
.live-stat-label {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary { transition: none; }
}
