:root {
  color-scheme: dark light;
  --bg: #0b0d10;
  --panel: #14181d;
  --panel-border: #232a32;
  --text: #e7ecf1;
  --muted: #97a2ad;
  --accent: #4f8cff;
  --accent-hover: #6ea2ff;
  --ok: #4ade80;
  --warn: #fbbf24;
  --error: #f87171;
  --code-bg: #0f141a;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --panel-border: #e3e6ea;
    --text: #0e1116;
    --muted: #5b6470;
    --code-bg: #f0f2f5;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}

.skip-link:focus,
.skip-link:focus-visible {
  left: 16px;
  top: 16px;
  outline: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus:not(:focus-visible) {
  outline: none;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

main > section.panel {
  margin-bottom: 28px;
}

main > section.panel[id^="step-"],
main > section.panel#policy-catalog {
  scroll-margin-top: 72px;
}

.policy-table-wrap {
  margin-top: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.policy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.policy-table thead th {
  text-align: left;
  background: var(--code-bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
}

.policy-table tbody th,
.policy-table tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--panel-border);
  vertical-align: top;
  text-align: left;
}

.policy-table tbody tr:last-child th,
.policy-table tbody tr:last-child td {
  border-bottom: none;
}

.policy-table tbody tr:nth-child(odd) {
  background: rgba(127, 127, 127, 0.04);
}

.policy-table tbody th {
  font-weight: 600;
  font-family: var(--mono);
  font-size: 0.85rem;
  white-space: nowrap;
}

.policy-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  white-space: nowrap;
}

.policy-pill--critical {
  border-color: rgba(248, 113, 113, 0.5);
  color: var(--error);
  background: rgba(248, 113, 113, 0.08);
}

.policy-pill--recommended {
  border-color: rgba(79, 140, 255, 0.5);
  color: var(--accent);
  background: rgba(79, 140, 255, 0.08);
}

.policy-pill--optional {
  border-color: rgba(151, 162, 173, 0.5);
  color: var(--muted);
  background: rgba(151, 162, 173, 0.08);
}

.step-rail {
  display: flex;
  gap: 6px;
  margin: 0 0 22px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.step-rail a {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.step-rail a:hover,
.step-rail a:focus-visible {
  color: var(--text);
  background: rgba(79, 140, 255, 0.1);
  text-decoration: none;
}

.step-rail .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(79, 140, 255, 0.18);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
}

.step-rail .lbl {
  font-size: 0.92rem;
  font-weight: 500;
}

@media (max-width: 720px) {
  .step-rail {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--panel);
    box-shadow: 0 6px 12px -8px rgba(0, 0, 0, 0.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  .step-rail a {
    transition: none;
  }
}

.section-intro {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.panel.after-deploy {
  border-color: rgba(79, 140, 255, 0.35);
}

.bullets.compact li {
  margin: 6px 0;
}

.masthead {
  border-bottom: 1px solid var(--panel-border);
  padding: 28px 24px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
  max-width: 880px;
  margin: 0 auto;
}

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), #2b5fcc);
  color: white;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
}

h1 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.masthead .catalog-nav {
  margin: 12px 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.masthead .catalog-nav span[aria-hidden="true"] {
  margin: 0 6px;
  opacity: 0.55;
}

h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  letter-spacing: -0.005em;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.panel.small p, .panel.small li { font-size: 0.92rem; }

.bullets {
  margin: 8px 0 0;
  padding-left: 20px;
}

.bullets li { margin: 4px 0; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

button {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  min-height: 44px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 600;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.dry-run {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  user-select: none;
}

.meta { color: var(--muted); font-size: 0.88rem; margin-top: 10px; }

.status {
  margin: 12px 0 4px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.92rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
}

.status[data-kind="ok"]    { color: var(--ok);    border-color: rgba(74,222,128,0.35); }
.status[data-kind="warn"]  { color: var(--warn);  border-color: rgba(251,191,36,0.35); }
.status[data-kind="error"] { color: var(--error); border-color: rgba(248,113,113,0.45); }

.summary {
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--muted);
  margin: 6px 0 0;
}

.log {
  background: var(--code-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
  min-height: 280px;
  height: 320px;
  resize: vertical;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.log-line { padding: 1px 0; }
.log-info  { color: var(--muted); }
.log-ok    { color: var(--ok); }
.log-warn  { color: var(--warn); }
.log-error { color: var(--error); }

footer {
  border-top: 1px solid var(--panel-border);
  padding: 18px 24px 32px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

footer a:focus-visible {
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }

  button:active:not(:disabled) {
    transform: none;
  }
}
