:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --band: #eceef2;
  --line: #d9dde4;
  --ink: #141b2a;
  --ink-2: #3c4555;
  --muted: #6b7280;
  --accent: #c8552f;
  --accent-ink: #ffffff;
  --accent-soft: #fbe9e2;
  --hero: #141b2a;
  --hero-ink: #ffffff;
  --ok: #1f7a4d;
  --ok-soft: #e3f3ea;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --warn: #9a6200;
  --warn-soft: #fdf2d8;
  --info: #2457a6;
  --info-soft: #e5edf9;
  --shadow: 0 1px 2px rgba(20, 27, 42, .06), 0 4px 16px rgba(20, 27, 42, .06);
  --radius: 10px;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1218;
    --surface: #181d26;
    --band: #141921;
    --line: #2a313d;
    --ink: #e6e9ef;
    --ink-2: #c2c8d2;
    --muted: #8b93a1;
    --accent: #e0693f;
    --accent-soft: #3a2119;
    --hero: #232b3a;
    --hero-ink: #ffffff;
    --ok: #4cc38a;
    --ok-soft: #15291f;
    --bad: #f0715f;
    --bad-soft: #33181a;
    --warn: #e2b04a;
    --warn-soft: #2f2613;
    --info: #79a6f0;
    --info-soft: #182338;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1218;
  --surface: #181d26;
  --band: #141921;
  --line: #2a313d;
  --ink: #e6e9ef;
  --ink-2: #c2c8d2;
  --muted: #8b93a1;
  --accent: #e0693f;
  --accent-soft: #3a2119;
  --hero: #232b3a;
  --hero-ink: #ffffff;
  --ok: #4cc38a;
  --ok-soft: #15291f;
  --bad: #f0715f;
  --bad-soft: #33181a;
  --warn: #e2b04a;
  --warn-soft: #2f2613;
  --info: #79a6f0;
  --info-soft: #182338;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Lato", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
code, .mono { font-family: var(--mono); font-size: .88em; }
button, select, input { font: inherit; color: inherit; }

/* header */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; letter-spacing: -.01em; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); position: relative; }
.brand-mark::after {
  content: ""; position: absolute; left: 7px; top: 4px; width: 6px; height: 10px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; }
.nav a:hover { background: var(--band); }
.nav a.active { background: var(--hero); color: var(--hero-ink); }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

main { max-width: 1120px; margin: 0 auto; padding: 32px 24px 80px; outline: none; }

/* buttons, pills, form */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent; border-radius: 8px;
  padding: 9px 16px; font-weight: 700; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--band); }
.btn.dark { background: var(--hero); color: var(--hero-ink); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.pill {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 4px 12px 4px 10px; font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.ok::before { background: var(--ok); }
.pill.bad::before { background: var(--bad); }
.pill.warn::before { background: var(--warn); }
.pill.run::before { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }

label.field { display: grid; gap: 6px; font-weight: 700; font-size: 13px; color: var(--ink-2); }
label.field small { font-weight: 400; color: var(--muted); }
select, input[type="text"] {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface);
}
select:focus, input:focus, .btn:focus-visible, .pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }

/* page heading */
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 800; color: var(--accent); }
.page-title { font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 8px; }
.lede { color: var(--ink-2); max-width: 68ch; margin: 0 0 24px; }

/* lifecycle bands (the slide) */
.bands { display: grid; gap: 12px; }
.band {
  display: grid; grid-template-columns: 240px 1fr; align-items: center; gap: 16px;
  background: var(--band); border-radius: var(--radius); padding: 14px 20px;
  transition: background .3s, color .3s, transform .3s;
}
.band-title { display: flex; align-items: baseline; gap: 10px; font-size: 18px; font-weight: 800; }
.band-num { font-variant-numeric: tabular-nums; }
.band-sub { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.band.hot { background: var(--hero); color: var(--hero-ink); }
.band.hot .band-sub { color: color-mix(in srgb, var(--hero-ink) 65%, transparent); }
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.chip {
  position: relative; min-height: 50px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px 8px 30px; font-size: 14px; font-weight: 600;
  transition: background .3s, border-color .3s, color .3s;
}
.chip small { font-size: 12px; font-weight: 500; color: var(--muted); overflow-wrap: anywhere; }
.chip::before {
  content: ""; position: absolute; left: 11px; top: 50%; margin-top: -5px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--line);
}
.chip.nw { background: transparent; border-style: dashed; color: var(--muted); }
.band.hot .chip.nw { color: color-mix(in srgb, var(--hero-ink) 55%, transparent); border-color: color-mix(in srgb, var(--hero-ink) 25%, transparent); }
.chip.nw::before { background: transparent; border: 1.5px dashed var(--muted); }
.chip.nw small { color: inherit; }
.chip.idle::before { background: var(--muted); opacity: .5; }
.chip.running { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.chip.running small { color: color-mix(in srgb, var(--accent-ink) 80%, transparent); }
.chip.running::before { background: var(--accent-ink); animation: pulse 1.1s ease-in-out infinite; }
.chip.succeeded::before { background: var(--ok); }
.chip.failed { border-color: var(--bad); }
.chip.failed::before { background: var(--bad); }
.chip.skipped::before { background: transparent; border: 1.5px solid var(--muted); }
.chip.skipped { color: var(--muted); }

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.8); } }

.legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 14px 0 0; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--muted); }
.legend i.ok { background: var(--ok); }
.legend i.run { background: var(--accent); }
.legend i.bad { background: var(--bad); }
.legend i.nw { background: transparent; border: 1.5px dashed var(--muted); }

.run-bar {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.run-bar select { width: auto; min-width: 280px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card h2 { font-size: 18px; margin-bottom: 4px; }
.card h3 { font-size: 15px; margin: 18px 0 8px; }

/* verdict badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  border-radius: 6px; padding: 3px 8px; white-space: nowrap;
  background: var(--band); color: var(--ink-2);
}
.badge.REMEDIATED, .badge.ISOLATED { background: var(--ok-soft); color: var(--ok); }
.badge.NOT_REMEDIATED, .badge.ERROR, .badge.LEAKED, .badge.failed { background: var(--bad-soft); color: var(--bad); }
.badge.INCONCLUSIVE { background: var(--warn-soft); color: var(--warn); }
.badge.INVENTORY { background: var(--info-soft); color: var(--info); }
.badge.running, .badge.pending { background: var(--accent-soft); color: var(--accent); }
.sev { font-size: 11px; font-weight: 800; border-radius: 4px; padding: 2px 6px; letter-spacing: .03em; }
.sev.CRITICAL { background: var(--bad); color: #fff; }
.sev.HIGH { background: var(--bad-soft); color: var(--bad); }
.sev.MEDIUM { background: var(--warn-soft); color: var(--warn); }
.sev.LOW, .sev.UNKNOWN { background: var(--band); color: var(--muted); }

/* wizard */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step; display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 8px; background: var(--band); color: var(--muted); font-weight: 700; font-size: 14px;
}
.steps li::before {
  content: counter(step); width: 24px; height: 24px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; background: var(--surface); border: 1px solid var(--line);
}
.steps li.now { background: var(--hero); color: var(--hero-ink); }
.steps li.now::before { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps li.done { color: var(--ink); }
.steps li.done::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: #fff; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.aside h3 { margin-top: 0; }
.aside ol { padding-left: 18px; margin: 8px 0 0; color: var(--ink-2); font-size: 14px; }
.aside li + li { margin-top: 6px; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.tile { border-radius: var(--radius); padding: 14px 16px; background: var(--band); }
.tile b { display: block; font-size: 32px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile span { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.tile.ok { background: var(--ok-soft); } .tile.ok b { color: var(--ok); }
.tile.bad { background: var(--bad-soft); } .tile.bad b { color: var(--bad); }
.tile.warn { background: var(--warn-soft); } .tile.warn b { color: var(--warn); }
.tile.info { background: var(--info-soft); } .tile.info b { color: var(--info); }

.sev-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--band); margin: 8px 0 4px; }
.sev-bar i { display: block; height: 100%; }
.sev-bar i.CRITICAL { background: var(--bad); }
.sev-bar i.HIGH { background: color-mix(in srgb, var(--bad) 55%, var(--warn)); }
.sev-bar i.MEDIUM { background: var(--warn); }
.sev-bar i.LOW, .sev-bar i.UNKNOWN { background: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 800; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--band); }
td .sub { display: block; color: var(--muted); font-size: 12px; }
td.num { font-variant-numeric: tabular-nums; }

details.group { border-top: 1px solid var(--line); padding: 4px 0; }
details.group summary { cursor: pointer; padding: 10px 0; font-weight: 800; display: flex; align-items: center; gap: 10px; list-style: none; }
details.group summary::-webkit-details-marker { display: none; }
details.group summary::before { content: "▸"; color: var(--muted); transition: transform .2s; }
details.group[open] summary::before { transform: rotate(90deg); }

.timeline { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; }
.timeline button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px;
  font-size: 13px; font-weight: 700; cursor: pointer; display: inline-flex; gap: 6px; align-items: center;
}
.timeline button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.timeline button.succeeded::before { background: var(--ok); }
.timeline button.failed::before { background: var(--bad); }
.timeline button.running::before { background: var(--accent); animation: pulse 1.1s infinite; }
.timeline button.skipped, .timeline button.not-run { color: var(--muted); }

.notice { border-radius: 8px; padding: 12px 14px; font-size: 14px; background: var(--info-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.notice.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice + .notice, .notice + .card, .card + .notice { margin-top: 12px; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 8px; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* modal */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(10, 14, 20, .55); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; width: min(960px, 100%); max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal header h2 { font-size: 16px; }
.modal .body { overflow: auto; padding: 0 18px 18px; }
.log { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--band); border-radius: 8px; padding: 12px; margin: 0; }
.log-head { font-weight: 800; font-size: 13px; margin: 16px 0 6px; }

/* tour */
.tour-back { position: fixed; inset: 0; z-index: 60; background: rgba(10, 14, 20, .58); }
.tour-focus { position: relative; z-index: 61; box-shadow: 0 0 0 4px var(--accent), 0 0 0 9999px rgba(10, 14, 20, .58); border-radius: var(--radius); }
.tour-card {
  position: fixed; z-index: 62; width: min(420px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); border-radius: 12px; padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.tour-card.center { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.tour-card h3 { font-size: 18px; margin: 4px 0 8px; }
.tour-card p { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.tour-dots { display: flex; gap: 6px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.tour-dots i.on { background: var(--accent); }

.fade-in { animation: fade .35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 860px) {
  .band { grid-template-columns: 1fr; gap: 10px; }
  .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .top { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  main { padding: 20px 16px 64px; }
  .page-title { font-size: 26px; }
  .grid-2 { grid-template-columns: 1fr; }
  .run-bar select { min-width: 0; width: 100%; }
  .chips { grid-template-columns: 1fr; }
}
.actions { margin-top: 18px; }
.split > .card + .card { margin-top: 0; }
.editor { margin: 12px 0 0; padding: 14px 16px; box-shadow: none; background: var(--bg); }
.editor summary { cursor: pointer; }
.editor > * + * { margin-top: 12px; }
textarea { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); resize: vertical; }
[hidden] { display: none !important; }
form.card > * + *, .card > .editor + .field { margin-top: 14px; }
