@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css");

:root {
  color-scheme: light;
  --body-top: #ffffff;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #0f172a;
  --surface-subtle: #fbfdff;
  --surface-accent: #eff6ff;
  --surface-accent-strong: #f7faff;
  --surface-warning: #fff8eb;
  --surface-success: #f0fdf4;
  --surface-danger: #fef2f2;
  --ink: #111827;
  --muted: #5b6472;
  --line: #d7deea;
  --line-accent: #b9cdfd;
  --table-head: #edf4ff;
  --code-ink: #1e293b;
  --code-bg: #e8eef8;
  --code-line: #d9e2f2;
  --pre-bg: #111827;
  --pre-ink: #f9fafb;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --green: #0f766e;
  --amber: #b45309;
  --red: #b42318;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --body-top: #111827;
  --bg: #0b1120;
  --surface: #111827;
  --surface-strong: #020617;
  --surface-subtle: #162033;
  --surface-accent: #172554;
  --surface-accent-strong: #10203a;
  --surface-warning: #2b2114;
  --surface-success: #102a24;
  --surface-danger: #2b171a;
  --ink: #e5e7eb;
  --muted: #aeb8c8;
  --line: #334155;
  --line-accent: #3b82f6;
  --table-head: #1e293b;
  --code-ink: #dbeafe;
  --code-bg: #172554;
  --code-line: #1d4ed8;
  --pre-bg: #020617;
  --pre-ink: #e5e7eb;
  --accent: #60a5fa;
  --accent-strong: #93c5fd;
  --green: #5eead4;
  --amber: #fbbf24;
  --red: #fca5a5;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, var(--body-top) 0, var(--bg) 320px), var(--bg);
  line-height: 1.65;
}

body > main:not(.doc-shell) {
  max-width: 1080px;
  margin: 0 auto;
  padding: 44px 24px 72px;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.32);
  outline-offset: 3px;
  border-radius: 6px;
}

code {
  color: var(--code-ink);
  background: var(--code-bg);
  border: 1px solid var(--code-line);
  border-radius: 5px;
  padding: 2px 5px;
  font-size: 0.92em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.doc-shell {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 76px;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 14px;
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-left: -10px;
  border-radius: 8px;
  padding: 0 10px;
  color: var(--muted);
  text-decoration: none;
}

.top-nav a:hover {
  color: var(--accent-strong);
  background: var(--surface-accent);
}

.hero {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 22px;
}

.hero.compact {
  padding: 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin: 0 0 12px;
  border: 1px solid var(--line-accent);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--accent-strong);
  background: var(--surface-accent);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin-top: 0;
  line-height: 1.22;
  letter-spacing: 0;
}

h1 {
  max-width: 880px;
  margin-bottom: 10px;
  font-size: 48px;
  overflow-wrap: break-word;
}

h2 {
  margin-bottom: 12px;
  font-size: 24px;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

p {
  margin: 0 0 12px;
}

body > main:not(.doc-shell) h1 {
  font-size: 31px;
}

body > main:not(.doc-shell) h2 {
  margin-top: 32px;
  font-size: 21px;
}

body > main:not(.doc-shell) h3 {
  margin-top: 22px;
  font-size: 17px;
}

body > main:not(.doc-shell) section {
  margin-top: 18px;
}

body > main:not(.doc-shell) table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  margin: 12px 0;
}

body > main:not(.doc-shell) th,
body > main:not(.doc-shell) td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

body > main:not(.doc-shell) th {
  color: var(--ink);
  background: var(--table-head);
}

body > main:not(.doc-shell) tr:last-child td {
  border-bottom: 0;
}

.lead {
  max-width: 880px;
  color: var(--muted);
  font-size: 18px;
}

.meta {
  color: var(--muted);
  font-size: 14px;
}

.section {
  margin-top: 22px;
}

.section-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 22px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-head p {
  max-width: 660px;
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.metric {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 14px;
}

.metric strong {
  display: block;
  margin-bottom: 3px;
  font-size: 22px;
  line-height: 1.1;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.card:hover {
  border-color: var(--line-accent);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
  transform: translateY(-1px);
}

.card p {
  flex: 1 1 auto;
  color: var(--muted);
}

.card .tag {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.priority-card {
  border-color: var(--line-accent);
  background: var(--surface-accent-strong);
}

.card a {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: auto;
  border: 1px solid var(--line-accent);
  border-radius: 8px;
  padding: 0 13px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.card a:hover {
  border-color: var(--accent);
  background: var(--surface-accent);
}

.card a:active {
  transform: translateY(1px);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

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

.data-table th {
  color: var(--ink);
  background: var(--table-head);
  font-size: 13px;
}

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

.doc-shell .section > table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
  border-collapse: collapse;
  background: var(--surface);
}

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

.doc-shell .section > table th {
  color: var(--ink);
  background: var(--table-head);
  font-size: 13px;
}

.doc-shell .section > table tr:last-child td {
  border-bottom: 0;
}

.doc-shell pre,
body > main:not(.doc-shell) pre {
  margin: 12px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--pre-bg);
  color: var(--pre-ink);
  padding: 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 13px;
  line-height: 1.6;
}

pre code {
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: inherit;
}

.callout {
  border: 1px solid var(--line-accent);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--surface-accent-strong);
  padding: 16px 18px;
}

.download-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line-accent);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--surface-accent-strong);
  padding: 18px;
}

.download-card h3,
.download-card h4,
.download-card p {
  margin: 0;
}

.download-card h3,
.download-card h4 {
  margin-top: 4px;
}

.download-card p {
  margin-top: 8px;
  color: var(--muted);
}

.download-label {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.download-button {
  flex: 0 0 auto;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.download-button:hover {
  background: var(--accent-strong);
  color: #ffffff;
}

.warning {
  border-color: var(--amber);
  border-left-color: var(--amber);
  background: var(--surface-warning);
}

.reading-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.flow-step {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.flow-step::before {
  content: attr(data-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: 10px;
  border: 1px solid var(--line-accent);
  border-radius: 8px;
  background: var(--surface-accent);
  color: var(--accent-strong);
  font-weight: 800;
}

.flow-step strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.flow-step p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

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

.evidence-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.evidence-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 18px;
}

.evidence-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip.ok {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--surface-success);
  color: var(--green);
}

.status-chip.warn {
  border-color: rgba(180, 83, 9, 0.35);
  background: var(--surface-warning);
  color: var(--amber);
}

.status-chip.archive {
  border-color: var(--line);
  background: var(--surface-subtle);
  color: var(--muted);
}

.system-map {
  border: 1px solid #26364f;
  border-radius: 8px;
  background: var(--surface-strong);
  color: #e5eefc;
  padding: 22px;
}

.system-map h3,
.system-map p {
  color: inherit;
}

.system-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.05fr 0.9fr;
  gap: 14px;
  align-items: stretch;
}

.system-stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%;
  border: 1px solid #33445f;
  border-radius: 8px;
  background: #172033;
  padding: 16px;
}

.system-stage.output {
  background: #10251f;
  border-color: #1f6f5f;
}

.stage-title {
  color: #93c5fd;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.stage-copy {
  margin-top: 8px;
  color: #cbd5e1;
  font-size: 14px;
}

.node-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.node-list li {
  border: 1px solid #42536f;
  border-radius: 8px;
  background: #202b43;
  padding: 10px 12px;
  color: #f8fafc;
  font-size: 14px;
}

.node-list .muted-node {
  color: #d5deeb;
  background: #1b2539;
}

.node-list .success-node {
  border-color: #2a8c75;
  background: #12392f;
}

.flow-note {
  margin-top: 12px;
  color: #b6c3d8;
  font-size: 13px;
}

.read-order {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: read-step;
}

.read-order li {
  counter-increment: read-step;
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 16px 14px 52px;
}

.read-order li::before {
  content: counter(read-step);
  position: absolute;
  left: 16px;
  top: 14px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  text-align: center;
  line-height: 24px;
  font-size: 13px;
  font-weight: 800;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.evidence-card {
  margin: 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.evidence-card img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.evidence-card figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .metric-grid,
  .system-grid {
    grid-template-columns: 1fr 1fr;
  }

  .system-stage.output {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .doc-shell {
    width: min(1160px, calc(100% - 28px));
    padding-top: 24px;
  }

  .hero,
  .section-panel,
  .system-map {
    padding: 18px;
  }

  .top-nav,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 30px;
    line-height: 1.18;
  }

  .lead {
    font-size: 16px;
  }

  .card,
  .metric,
  .callout {
    padding: 16px;
  }

  .download-card {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .metric-grid,
  .system-grid {
    grid-template-columns: 1fr;
  }

  .system-stage.output {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .card:hover {
    transform: none;
  }
}

/* ===== Presentation summary framing ===== */
.story-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 980px) {
  .story-grid {
    grid-template-columns: 1fr 1fr;
  }
  .story-grid .story-card.full {
    grid-column: 1 / -1;
  }
}

.story-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
}

.story-card .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.story-card .card-head h3 {
  margin: 0;
  font-size: 17px;
}

.story-card .card-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.us-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #b9cdfd;
  border-radius: 999px;
  padding: 2px 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.ok {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.status-pill.partial {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.status-pill.plus {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
}

.field-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px 12px;
  background: #fbfdff;
}

.field-block + .field-block {
  margin-top: 8px;
}

.field-label {
  display: inline-block;
  margin-bottom: 6px;
  color: #1f2937;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.field-block.want {
  background: #f4f6fb;
}

.field-block.impl {
  background: #ffffff;
}

.field-block.verify {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.field-block.verify .field-label {
  color: #047857;
}

.field-block.before {
  background: #fef2f2;
  border-color: #fecaca;
}

.field-block.before .field-label {
  color: #b91c1c;
}

.field-block.after {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.field-block.after .field-label {
  color: #1d4ed8;
}

.field-block.why {
  background: #fffbeb;
  border-color: #fde68a;
}

.field-block.why .field-label {
  color: #b45309;
}

.field-block.impact {
  background: #f5f3ff;
  border-color: #ddd6fe;
}

.field-block.impact .field-label {
  color: #6d28d9;
}

.field-block ul,
.field-block ol {
  margin: 6px 0 0;
  padding-left: 18px;
}

.field-block li + li {
  margin-top: 4px;
}

.field-block p {
  margin: 0;
}

.field-block p + p {
  margin-top: 6px;
}

.win-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.win-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.win-card .win-tag {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #b9cdfd;
  border-radius: 999px;
  padding: 2px 10px;
}

.win-card h3 {
  margin: 0;
  font-size: 16px;
}

.win-card p {
  margin: 0;
  color: #394150;
  font-size: 14px;
}

/* ===== Compare card (변경 1~7) — uniform 2x2 inner grid ===== */
.story-card.compare {
  gap: 10px;
}

.story-card.compare .field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 10px;
  flex: 1 1 auto;
}

.story-card.compare .field-grid .field-block {
  margin: 0;
  min-height: 150px;
  display: flex;
  flex-direction: column;
}

.story-card.compare .field-grid .field-block ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.story-card.compare .field-grid .field-block li {
  font-size: 13.5px;
  line-height: 1.55;
}

.story-card.compare .field-grid .field-block p {
  font-size: 13.5px;
  line-height: 1.55;
}

@media (max-width: 720px) {
  .story-card.compare .field-grid {
    grid-template-columns: 1fr;
  }
  .story-card.compare .field-grid .field-block {
    min-height: 0;
  }
}

/* ===== Sprint presentation change section ===== */
.presentation-change-section {
  display: grid;
  gap: 16px;
}

.presentation-change-section > h2,
.presentation-change-section > .card-sub {
  margin-bottom: 0;
}

.change-brief {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 16px;
  border: 1px solid #b9cdfd;
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: #f7faff;
  padding: 18px;
}

.change-brief p {
  margin: 0;
  color: #1f2937;
}

.brief-stack {
  display: grid;
  gap: 8px;
}

.brief-stack span {
  display: block;
  border: 1px solid #d7deea;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
  color: #394150;
  font-size: 13px;
  line-height: 1.45;
}

.change-lanes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.lane-card {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 16px 16px 15px;
}

.lane-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #e8eef8;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.lane-card h3 {
  margin: 12px 0 6px;
  font-size: 16px;
}

.lane-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.lane-card strong {
  display: block;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: #111827;
  font-size: 13px;
  line-height: 1.45;
}

.change-matrix-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.change-matrix {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.change-matrix th,
.change-matrix td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
  font-size: 13.5px;
  line-height: 1.5;
}

.change-matrix th {
  position: relative;
  background: #edf4ff;
  color: #1f2937;
  font-size: 12px;
  letter-spacing: 0.2px;
}

.change-matrix th:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -10px;
  top: 50%;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  border: 1px solid #b9cdfd;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

span.flow-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.flow-title {
  display: inline-block;
  color: #111827;
  font-size: 13px;
  font-weight: 800;
}

.change-matrix th small {
  display: block;
  margin-top: 6px;
  margin-left: 36px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.change-matrix td:first-child {
  width: 22%;
  background: #fbfdff;
}

.change-matrix td:nth-child(2) {
  width: 24%;
}

.change-matrix td:nth-child(3) {
  width: 26%;
}

.change-matrix td:nth-child(4) {
  width: 28%;
  background: #f8fafc;
}

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

.decision-notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.decision-notes article {
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fffbeb;
  padding: 14px 16px;
}

.decision-notes p {
  margin: 0;
  color: #3f2f13;
  font-size: 14px;
}

@media (max-width: 980px) {
  .change-brief,
  .decision-notes {
    grid-template-columns: 1fr;
  }

  .change-lanes {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .change-lanes {
    grid-template-columns: 1fr;
  }

  .change-brief,
  .lane-card,
  .decision-notes article {
    border-radius: 8px;
  }
}


.prompt-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}

.prompt-toolbar button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.prompt-toolbar button:hover {
  background: #eff6ff;
  border-color: var(--accent);
  color: var(--accent-strong);
}

.prompt-toolbar button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.32);
  outline-offset: 2px;
}

.prompt-toolbar .copy-status {
  color: var(--muted);
  font-size: 13px;
}

.prompt-toolbar .copy-status.ok {
  color: var(--green);
}

.prompt-toolbar .copy-status.err {
  color: var(--red);
}

/* ===== Theme toggle and dark-mode visibility guardrails ===== */
.theme-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 104px;
  min-height: 44px;
  border: 1px solid var(--line-accent);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 0 15px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--surface-accent);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

.theme-toggle:focus-visible {
  outline: 3px solid rgba(96, 165, 250, 0.42);
  outline-offset: 3px;
}

.theme-toggle:active {
  transform: translateY(1px);
}

.theme-toggle-mark {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: transparent;
}

html[data-theme="dark"] .theme-toggle-mark {
  background: currentColor;
}

html[data-theme="dark"] .card:hover {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .download-button,
html[data-theme="dark"] .download-button:hover {
  color: #07111f;
}

html[data-theme="dark"] .system-map,
html[data-theme="dark"] .system-stage,
html[data-theme="dark"] .system-stage.output,
html[data-theme="dark"] .node-list li,
html[data-theme="dark"] .node-list .muted-node,
html[data-theme="dark"] .node-list .success-node {
  border-color: var(--line);
}

html[data-theme="dark"] .us-tag,
html[data-theme="dark"] .win-card .win-tag,
html[data-theme="dark"] .lane-number,
html[data-theme="dark"] .status-pill.plus,
html[data-theme="dark"] .field-block.after,
html[data-theme="dark"] .change-matrix th:not(:last-child)::after {
  border-color: var(--line-accent);
  background: var(--surface-accent);
  color: var(--accent-strong);
}

html[data-theme="dark"] .status-pill.ok,
html[data-theme="dark"] .field-block.verify {
  border-color: #2dd4bf;
  background: var(--surface-success);
  color: var(--green);
}

html[data-theme="dark"] .status-pill.partial,
html[data-theme="dark"] .field-block.why,
html[data-theme="dark"] .decision-notes article {
  border-color: var(--amber);
  background: var(--surface-warning);
  color: var(--amber);
}

html[data-theme="dark"] .field-block.before {
  border-color: var(--red);
  background: var(--surface-danger);
  color: var(--red);
}

html[data-theme="dark"] .field-block,
html[data-theme="dark"] .win-card,
html[data-theme="dark"] .lane-card,
html[data-theme="dark"] .change-matrix-wrap,
html[data-theme="dark"] .story-card,
html[data-theme="dark"] .result-panel,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .evidence-card,
html[data-theme="dark"] .paper-flow-card {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

html[data-theme="dark"] .change-brief,
html[data-theme="dark"] .brief-stack span,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .change-matrix td:first-child,
html[data-theme="dark"] .change-matrix td:nth-child(4) {
  border-color: var(--line);
  background: var(--surface-subtle);
  color: var(--ink);
}

html[data-theme="dark"] .field-block.want,
html[data-theme="dark"] .field-block.impl,
html[data-theme="dark"] .field-block.impact {
  border-color: var(--line);
  background: var(--surface-subtle);
  color: var(--ink);
}

html[data-theme="dark"] .field-label,
html[data-theme="dark"] .flow-title,
html[data-theme="dark"] .lane-card strong,
html[data-theme="dark"] .change-brief p,
html[data-theme="dark"] .win-card p,
html[data-theme="dark"] .decision-notes p,
html[data-theme="dark"] .paper-flow-card p {
  color: var(--ink);
}

html[data-theme="dark"] .paper-flow-card strong,
html[data-theme="dark"] .stage-title,
html[data-theme="dark"] .win-card .win-tag {
  color: var(--accent-strong);
}

html[data-theme="dark"] .result-hero,
html[data-theme="dark"] .svg-chart,
html[data-theme="dark"] .bar-track {
  border-color: var(--line);
  background: var(--surface-subtle);
}

html[data-theme="dark"] .bar-track {
  background: #263244;
}

html[data-theme="dark"] .presentation-change-section > .card-sub,
html[data-theme="dark"] .story-card .card-sub,
html[data-theme="dark"] .lane-card p,
html[data-theme="dark"] .mini-note,
html[data-theme="dark"] .legend,
html[data-theme="dark"] .evidence-card figcaption,
html[data-theme="dark"] .prompt-toolbar .copy-status {
  color: var(--muted);
}

html[data-theme="dark"] img,
html[data-theme="dark"] .evidence-card img {
  border-color: var(--line);
}

@media (max-width: 640px) {
  .theme-toggle {
    right: 14px;
    bottom: 14px;
    min-width: 92px;
  }
}
