:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #647184;
  --line: #d7dee8;
  --paper: #ffffff;
  --page: #f4f7fb;
  --blue: #17324d;
  --teal: #047481;
  --green: #22764a;
  --amber: #9a6812;
  --red: #a13d3d;
  --shadow: 0 18px 42px rgba(27, 42, 66, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.topbar {
  min-height: 128px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(18px, 5vw, 64px);
  background: var(--blue);
  color: #fff;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar .eyebrow {
  color: #8ee4d7;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(1.45rem, 2.8vw, 2.45rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  font-size: 1.05rem;
  letter-spacing: 0;
}

.target {
  flex: 0 0 auto;
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.target span {
  font-size: 0.78rem;
  color: #dce7f3;
}

.target strong {
  font-size: 1rem;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.decision {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(360px, 1.15fr);
  gap: 28px;
  align-items: stretch;
  padding: 34px 0 24px;
}

.decision-copy {
  padding: 24px 0;
}

.decision-copy p:last-child {
  color: var(--muted);
  font-size: 1.08rem;
}

.mode-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mode-card,
.section-block,
.runbook-grid article,
.rollback-grid article {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.mode-card {
  min-height: 224px;
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.mode-card h3 {
  margin: 16px 0 8px;
  font-size: 1.4rem;
}

.mode-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.status-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
}

.ready .status-dot {
  background: var(--green);
}

.prep .status-dot {
  background: var(--amber);
}

.blocked .status-dot {
  background: var(--red);
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  padding: 10px 0;
  background: rgba(244, 247, 251, 0.94);
  overflow-x: auto;
}

.tabs a {
  flex: 0 0 auto;
  color: var(--blue);
  text-decoration: none;
  font-weight: 800;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.section-block {
  margin: 18px 0;
  padding: clamp(18px, 3vw, 30px);
}

.section-heading {
  max-width: 820px;
  margin-bottom: 18px;
}

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

.checklist label {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.checklist label span {
  min-width: 0;
  overflow-wrap: anywhere;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  color: #0d4f57;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.gate-result {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #fff6df;
  color: #6a4705;
  font-weight: 800;
}

.gate-result.complete {
  background: #e6f6ec;
  color: #1d613b;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.timeline li {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  align-items: stretch;
}

.timeline time {
  display: grid;
  place-items: center;
  min-height: 64px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.timeline div {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.timeline strong,
.timeline span {
  display: block;
}

.timeline span {
  color: var(--muted);
}

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

.runbook-grid article,
.rollback-grid article {
  box-shadow: none;
  padding: 16px;
}

.runbook-grid span {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  height: 32px;
  padding: 0 8px;
  background: #e6f2f4;
  color: #075a65;
  border-radius: 8px;
  font-weight: 900;
}

.runbook-grid h3,
.rollback-grid h3 {
  margin: 12px 0 8px;
}

.runbook-grid p,
.rollback-grid p {
  color: var(--muted);
  margin-bottom: 0;
}

.step-guide,
.cutover-steps {
  display: grid;
  gap: 14px;
}

.step-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.step-number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.step-body h3,
.cutover-steps h3 {
  margin-bottom: 8px;
  color: var(--blue);
}

.step-body p,
.cutover-steps p {
  margin-bottom: 10px;
}

.step-body ul,
.step-body ol,
.cutover-steps ul,
.cutover-steps ol {
  margin-top: 0;
  padding-left: 20px;
}

.step-body li,
.cutover-steps li {
  margin-bottom: 5px;
}

pre {
  margin: 8px 0 12px;
  padding: 12px;
  border: 1px solid #c8d7e3;
  border-radius: 8px;
  background: #eef5f8;
  color: #123;
  overflow-x: auto;
}

pre code {
  color: inherit;
  font-size: 0.88rem;
}

.setup-guide .status-pill {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.setup-guide .status-pill.completed {
  background: #e5f6ec;
  color: var(--green);
}

.setup-guide a {
  color: var(--teal);
}

.setup-guide .tabs a.is-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 16px 0 8px;
}

.flow-step {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.flow-step:hover {
  border-color: var(--teal);
  box-shadow: var(--shadow);
}

.flow-step strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 0.9rem;
}

.flow-step span {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
}

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

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

.scenario-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.scenario-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.scenario-card a {
  font-weight: 800;
  text-decoration: none;
}

.done-when {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 4px solid var(--green);
  background: #f3fbf6;
  border-radius: 0 8px 8px 0;
}

.done-when strong {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
}

.simple-steps {
  margin: 12px 0 0;
  padding-left: 1.25rem;
}

.simple-steps li {
  margin-bottom: 10px;
}

.simple-steps li::marker {
  font-weight: 800;
  color: var(--blue);
}

.reference-block details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 10px;
}

.reference-block summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 800;
  color: var(--blue);
  list-style: none;
}

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

.reference-block details[open] summary {
  border-bottom: 1px solid var(--line);
}

.reference-block .details-body {
  padding: 14px 16px 16px;
}

.setup-result {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #eef3f8;
  font-weight: 700;
}

.setup-result.complete {
  background: #e6f6ec;
  color: #1d613b;
}

.section-block.is-step {
  border-left: 4px solid var(--teal);
}

.stop-note,
.success-note,
.inline-alert {
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 800;
}

.stop-note {
  background: #fbe8e8;
  color: #803030;
}

.success-note {
  background: #e6f6ec;
  color: #1d613b;
}

.inline-alert {
  background: #fff6df;
  color: #6a4705;
}

.mini-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 12px;
}

.mini-table div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mini-table span {
  color: var(--muted);
}

.cutover-steps article {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.cutover-steps time {
  display: grid;
  place-items: center;
  min-height: 52px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.test-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.test-table div {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  padding: 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.test-table div:last-child {
  border-bottom: 0;
}

.test-table strong {
  color: var(--blue);
}

.warn {
  border-color: #efcaca;
}

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

.evidence-list {
  margin: 0;
  padding-left: 20px;
  columns: 2;
}

.evidence-list li {
  break-inside: avoid;
  margin-bottom: 8px;
}

footer {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 42px;
  padding: 18px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
}

footer strong,
footer span {
  display: block;
}

footer span {
  color: #dce7f3;
  margin-top: 6px;
}

@media (max-width: 920px) {
  .topbar,
  .decision {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .target {
    width: 100%;
  }

  .mode-board,
  .checklist,
  .runbook-grid,
  .rollback-grid,
  .mini-table {
    grid-template-columns: 1fr;
  }

  .mode-card {
    min-height: 150px;
  }

  .evidence-list {
    columns: 1;
  }
}

@media (max-width: 560px) {
  main,
  footer {
    width: min(100% - 20px, 1180px);
  }

  h1 {
    font-size: 2rem;
  }

  .timeline li,
  .test-table div,
  .step-card,
  .cutover-steps article {
    grid-template-columns: 1fr;
  }

  .timeline time {
    min-height: 42px;
    place-items: center start;
    padding-left: 14px;
  }
}

@media print {
  body {
    background: #fff;
    color: #111;
  }

  .topbar,
  footer {
    background: #17324d !important;
    color: #fff !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .tabs {
    position: static;
    display: none;
  }

  main,
  footer {
    width: 100%;
  }

  .decision,
  .mode-board,
  .checklist,
  .runbook-grid,
  .rollback-grid {
    grid-template-columns: 1fr;
  }

  .section-block,
  .mode-card,
  .runbook-grid article,
  .rollback-grid article {
    box-shadow: none;
    break-inside: avoid;
  }

  .section-block {
    page-break-inside: avoid;
  }

  input[type="checkbox"] {
    appearance: none;
    border: 1px solid #333;
  }
}
