:root {
  --bg: #05080f;
  --surface: #090d18;
  --card: #0f1524;
  --card-hover: #141c30;
  --border: #1e283d;
  --border-strong: #2d3a54;
  --orange: #fc6d26;
  --purple: #7b58cf;
  --purple-soft: #a78bfa;
  --text: #f8fafc;
  --muted: #94a3b8;
  --dim: #8b98ad;
  --pass: #10b981;
  --fail: #f43f5e;
  --gate: #f59e0b;
  --run: #38bdf8;
  --radius: 12px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 8% 0%, rgba(123, 88, 207, 0.1) 0%, transparent 38%),
    radial-gradient(circle at 95% 100%, rgba(252, 109, 38, 0.08) 0%, transparent 40%),
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px, 28px 28px;
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

a { color: inherit; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
h1, h2 { margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 1rem; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.75rem 1.75rem;
  background: rgba(9, 13, 24, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.8rem; }
.brand-mark { border-radius: 10px; box-shadow: 0 4px 18px rgba(252, 109, 38, 0.3); }
.brand-name { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.brand-sub { color: var(--dim); font-size: 0.74rem; font-weight: 500; }
.topbar-pills { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.35rem 0.7rem; border-radius: 8px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--muted); font-size: 0.76rem; text-decoration: none; white-space: nowrap;
}
.pill strong { color: var(--text); font-weight: 700; }
a.pill:hover { border-color: var(--border-strong); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-pass { background: var(--pass); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.dot-fail { background: var(--fail); box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.18); }
.dot-gate { background: var(--gate); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.dot-run { background: var(--run); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18); animation: pulse 1.6s infinite; }
.dot-idle { background: var(--dim); }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .dot-run { animation: none; } }

main { max-width: 1240px; margin: 0 auto; padding: 1.5rem 1.75rem 3rem; display: grid; gap: 1.25rem; }

.notice {
  padding: 0.8rem 1rem; border-radius: var(--radius);
  border: 1px solid rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.08); color: #fde68a; font-size: 0.88rem;
}

/* Release gate banner */
.gate {
  position: relative; overflow: hidden;
  padding: 1.4rem 1.5rem; border-radius: 16px;
  background: linear-gradient(135deg, rgba(123, 88, 207, 0.16), rgba(252, 109, 38, 0.08) 60%, rgba(15, 21, 36, 0.6)), var(--card);
  border: 1px solid var(--border-strong);
}
.gate::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--gate-accent, var(--dim)); }
.gate[data-state='awaiting'] { --gate-accent: var(--gate); }
.gate[data-state='approved'] { --gate-accent: var(--pass); }
.gate[data-state='blocked'] { --gate-accent: var(--fail); }
.gate[data-state='running'], .gate[data-state='waiting'] { --gate-accent: var(--run); }
.gate-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.gate h1 { font-size: 1.55rem; font-weight: 800; margin: 0.25rem 0; }
.gate p { margin: 0; max-width: 62ch; font-size: 0.9rem; }
.eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--purple-soft); }
.gate-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.75rem; margin: 1.1rem 0 0; }
.gate-facts div { background: rgba(5, 8, 15, 0.45); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.75rem; min-width: 0; }
.gate-facts dt { font-size: 0.7rem; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.gate-facts dd { margin: 0.15rem 0 0; font-weight: 600; overflow-wrap: anywhere; }

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1rem; border-radius: 10px; font-weight: 700; font-size: 0.88rem; text-decoration: none;
  border: 1px solid var(--border-strong); background: var(--card);
}
.btn-primary { background: linear-gradient(135deg, var(--orange), #e24329); border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(252, 109, 38, 0.28); }
.btn:focus-visible, a:focus-visible { outline: 2px solid var(--purple-soft); outline-offset: 2px; }

/* Lifecycle strip */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.65rem; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 0.55rem; }
.stage {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem 0.7rem; display: flex; flex-direction: column; gap: 0.3rem; min-width: 0;
  border-top: 3px solid var(--stage-accent, var(--border));
}
.stage[data-tone='pass'] { --stage-accent: var(--pass); }
.stage[data-tone='fail'] { --stage-accent: var(--fail); }
.stage[data-tone='gate'] { --stage-accent: var(--gate); }
.stage[data-tone='run'] { --stage-accent: var(--run); }
.stage-num { font-family: var(--mono); font-size: 0.7rem; color: var(--dim); }
.stage-name { font-weight: 700; }
.stage-what { font-size: 0.72rem; color: var(--muted); line-height: 1.35; }
.stage-status { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-top: auto; }
.stage-detail { display: block; font-family: var(--mono); font-size: 0.66rem; color: var(--dim); overflow-wrap: anywhere; line-height: 1.5; min-height: 6em; }
.stage a { text-decoration: none; }
.stage a:hover .stage-detail { color: var(--muted); text-decoration: underline; }

/* Cards */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 1.1rem 1.2rem; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.card p { margin: 0 0 0.75rem; }
.tag { font-size: 0.7rem; font-weight: 700; padding: 0.18rem 0.55rem; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--muted); white-space: nowrap; }
.tag-pass { color: var(--pass); border-color: rgba(16, 185, 129, 0.45); background: rgba(16, 185, 129, 0.08); }
.tag-fail { color: var(--fail); border-color: rgba(244, 63, 94, 0.45); background: rgba(244, 63, 94, 0.08); }
.tag-gate { color: var(--gate); border-color: rgba(245, 158, 11, 0.45); background: rgba(245, 158, 11, 0.08); }
.tag-purple { color: var(--purple-soft); border-color: rgba(123, 88, 207, 0.5); background: rgba(123, 88, 207, 0.1); }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.45rem 1rem; margin: 0.25rem 0 0.9rem; font-size: 0.85rem; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.links { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.links a { font-size: 0.78rem; padding: 0.3rem 0.6rem; border-radius: 8px; border: 1px solid var(--border-strong); text-decoration: none; color: var(--muted); }
.links a:hover { color: var(--text); }

.mr-list, .finding-list, .probe-list, .release-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.mr { border: 1px solid var(--border); border-radius: 10px; padding: 0.7rem 0.8rem; background: var(--surface); }
.mr-title { font-weight: 600; text-decoration: none; }
.mr-title:hover { text-decoration: underline; }
.mr-meta { font-size: 0.75rem; color: var(--dim); margin-top: 0.15rem; }
.checks { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }
.check { font-family: var(--mono); font-size: 0.68rem; padding: 0.15rem 0.45rem; border-radius: 6px; border: 1px solid var(--border-strong); display: inline-flex; gap: 0.35rem; align-items: center; }
.proof { font-size: 0.78rem; margin-top: 0.45rem; color: var(--muted); }

.sev-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-bottom: 0.8rem; }
.sev { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 0.65rem; }
.sev b { display: block; font-size: 1.25rem; }
.sev span { font-size: 0.72rem; color: var(--dim); }
.finding { font-size: 0.8rem; display: grid; grid-template-columns: auto 1fr; gap: 0.5rem; align-items: start; }
.finding .loc { font-family: var(--mono); color: var(--dim); font-size: 0.72rem; }

.probe { display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.84rem; border-bottom: 1px dashed var(--border); padding-bottom: 0.45rem; }
.probe:last-child { border-bottom: 0; }

.table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.table th { text-align: left; color: var(--dim); font-weight: 600; padding: 0.35rem 0.4rem; border-bottom: 1px solid var(--border); }
.table td { padding: 0.45rem 0.4rem; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; align-items: center; gap: 0.35rem; }

.empty { color: var(--dim); font-size: 0.85rem; padding: 0.6rem 0; }
.skeleton { background: linear-gradient(90deg, var(--surface), var(--card-hover), var(--surface)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; height: 0.9rem; }
@keyframes shimmer { to { background-position: -200% 0; } }

.footer { max-width: 1240px; margin: 0 auto; padding: 0 1.75rem 2rem; color: var(--dim); font-size: 0.76rem; }

@media (max-width: 1100px) { .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .grid-2 { grid-template-columns: 1fr; }
  main { padding: 1rem; }
  .topbar { padding: 0.7rem 1rem; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
}
@media (max-width: 520px) {
  .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sev-row { grid-template-columns: repeat(2, 1fr); }
  .gate h1 { font-size: 1.3rem; }
}

.brand-sub a { color: var(--muted); }
.subhead { font-size: 0.8rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; margin: 0.9rem 0 0.5rem; }
.carbon-head { margin-top: 1.1rem; }

/* Watch: scheduled monitor + incidents */
.watch { margin: 1.25rem 0; border-color: rgba(252, 109, 38, 0.45); box-shadow: 0 0 0 1px rgba(252, 109, 38, 0.12) inset; }
.watch-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1.25rem; }
.watch-result { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 0.75rem; align-items: baseline; }
.watch-result b { font-size: 1.35rem; color: var(--pass); font-variant-numeric: tabular-nums; }
.watch-result span { color: var(--muted); font-size: 0.85rem; }
.watch-drift { grid-column: 1 / -1; font-family: var(--mono); font-size: 0.75rem; color: var(--fail); }
.runs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 0.4rem; }
.run { width: 18px; height: 26px; border-radius: 4px; background: var(--border-strong); display: block; }
.run[data-tone='pass'] { background: var(--pass); }
.run[data-tone='fail'] { background: var(--fail); }
.run[data-tone='run'] { background: var(--run); }
.run:hover { outline: 2px solid var(--text); }
.incident { border: 1px solid var(--border); border-radius: 10px; padding: 0.7rem 0.8rem; background: var(--surface); list-style: none; }
.incident-head { display: flex; gap: 0.5rem; align-items: baseline; }
@media (max-width: 820px) { .watch-grid { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
  .topbar { flex-wrap: wrap; gap: 0.5rem; }
  .brand-sub { font-size: 0.72rem; }
  .topbar-pills { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
}

.gate-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: flex-start; }
.story { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; }
.story-step { display: flex; gap: 0.6rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.65rem 0.75rem; }
.story-step[data-done='true'] { border-color: rgba(16, 185, 129, 0.4); }
.story-num { flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; background: var(--border-strong); }
.story-step[data-done='true'] .story-num { background: var(--pass); color: #04110b; }
.story-label { font-size: 0.84rem; font-weight: 600; color: var(--text); text-decoration: none; }
a.story-label:hover { text-decoration: underline; }
@media (max-width: 820px) { .story { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .story { grid-template-columns: 1fr; } }

[hidden] { display: none !important; }
