/*
  style.css
  The look of the page: a "control room" style, like the monitoring tools on-call engineers
  use. Calm colours; only a problem glows, so the eye goes to what's broken. Colours are
  defined once at the top as variables, so the whole page changes together. There is a light
  and a dark version: the sun/moon button in the header switches between them
  (app.js sets data-theme="light" or "dark" on <html>).
*/

/* ---------- Colours: light theme ---------- */

:root {
  color-scheme: light;  /* scrollbars and form fields follow the theme too */
  --bg: #f3f6fb;
  --grid: rgba(15, 23, 42, 0.035);      /* the faint grid lines behind everything */
  --bar-bg: rgba(243, 246, 251, 0.82);  /* the header bar, see-through */
  --panel: #ffffff;
  --inset: #f6f8fc;                     /* boxes inside a panel: cards, code, messages */
  --text: #0f172a;
  --muted: #5f6b7d;
  --line: #e2e8f0;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --accent: #2563eb;
  --on-accent: #ffffff;                 /* text on an accent-coloured button */
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

/* ---------- Colours: dark theme ---------- */

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b11;
  --grid: rgba(148, 163, 184, 0.05);
  --bar-bg: rgba(7, 11, 17, 0.78);
  --panel: #0d131b;
  --inset: #0a0f16;
  --text: #e2e8f0;
  --muted: #8b98aa;
  --line: #1c2735;
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.13);
  --accent: #60a5fa;
  --on-accent: #06121f;  /* the accent is light here, so dark text reads better on it */
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 12px 32px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

/* The "hidden" attribute must always win, even over a display rule further down. */
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  /* A faint grid, like graph paper on a monitoring screen. */
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  min-height: 100vh;
}

/* Switching themes fades the colours instead of jumping. */
body, .panel, .card, .option, .alert, button, input {
  transition: background-color 0.25s, border-color 0.25s, color 0.25s;
}

/* A column, so a section can be moved up for one step with "order" (Result above the server on step 4). */
main { max-width: 1100px; margin: 0 auto; padding: 0 16px 64px; display: flex; flex-direction: column; }

/* ---------- One step at a time ---------- */

/* Every section belongs to one or more steps (classes s1 to s4) and only shows on those. */
.view { display: none; }
main[data-step="1"] .s1,
main[data-step="2"] .s2,
main[data-step="3"] .s3,
main[data-step="4"] .s4 { display: block; animation: step-in 0.3s ease; }
/* On steps 2 and 3 the full server is hidden behind the status strip; a click shows it. */
main.show-server[data-step="2"] #server-panel,
main.show-server[data-step="3"] #server-panel { display: block; animation: step-in 0.3s ease; }
main[data-step="4"] #result-panel { order: -1; }
.stepper { order: -2; }
.strip { order: -1; }
main[data-step="4"] .strip { order: -2; }

/* A new step slides in gently instead of jumping. */
@keyframes step-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* The step tabs. They stick under the header bar, so the way back is always in sight. */
.stepper {
  position: sticky; top: 66px; z-index: 9;  /* just under the header bar (58px high) */
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin-top: 20px; padding: 6px;
  background: var(--bar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stepper button {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 8px; border-radius: 10px;
  background: transparent; color: var(--muted); border: 1px solid transparent;
  font-weight: 650;
}
.stepper button:hover:not(:disabled) { background: var(--inset); color: var(--text); filter: none; }
.stepper .num {
  display: inline-grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 8px;
  background: var(--inset); border: 1px solid var(--line);
  font-size: 0.8rem;
}
/* The step on screen. */
.stepper button.active { background: var(--panel); color: var(--text); border-color: var(--line); }
.stepper button.active .num { background: var(--accent); color: var(--on-accent); border-color: transparent; }
/* A finished step: a green tick. */
.stepper button.done .num { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
/* The next step is ready (e.g. the agent finished): it pulses to say "over here". */
.stepper button.ready { color: var(--accent); animation: ready-pulse 1.6s ease-in-out infinite; }
@keyframes ready-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
}
/* Not reached yet: locked. */
.stepper button:disabled { opacity: 0.4; }

/* The status strip on steps 2 and 3: the server in one line. */
.strip {
  width: 100%; margin-top: 12px; padding: 10px 14px; text-align: left;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 12px;
  font-weight: 500; box-shadow: var(--shadow);
}
.strip.bad { border-left-color: var(--bad); }
.strip.bad strong { color: var(--bad); }
.strip.ok strong { color: var(--ok); }
.strip:hover:not(:disabled) { border-color: var(--accent); filter: none; }
.strip-inner { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.lights { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.strip-text { flex: 1 1 260px; font-size: 0.9rem; }
.strip-toggle { color: var(--accent); font-size: 0.85rem; font-weight: 650; white-space: nowrap; }
/* One light per container; a broken one glows. */
.light {
  display: inline-block; width: 8px; height: 8px; margin-left: 4px; border-radius: 50%;
  background: var(--ok);
}
/* The container the agent is checking right now gets a pulsing ring. */
.light.focus { animation: focus-ring 1.2s ease-in-out infinite; }
.light:first-child { margin-left: 0; }
.light.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.light.bad { background: var(--bad); box-shadow: 0 0 8px var(--bad); }

/* "Start the investigation ->" and "Choose a fix ->": the way to the next step. */
.next {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 16px; padding: 14px 16px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  animation: step-in 0.3s ease;
}
.next span { font-weight: 550; }

#again { margin-top: 4px; }

/* ---------- Phone: the step tabs become a tab bar at the bottom, like an app ---------- */

/* The icons only show on a phone; on a laptop the tabs keep their numbers. */
.tab-icon { display: none; }

@media (max-width: 640px) {
  /* Fixed to the bottom edge and full width, like Instagram's tab bar: easy to reach with a thumb.
     env(safe-area-inset-bottom) keeps it above the home bar on iPhones without a home button. */
  .stepper {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 20;
    margin: 0; padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    gap: 0;
    border-width: 1px 0 0; border-radius: 0;
    box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.08);
  }
  .stepper button {
    position: relative;
    flex-direction: column; gap: 2px;
    padding: 6px 2px 5px;
    font-size: 0.68rem; font-weight: 600;
  }
  .stepper .tab-icon { display: block; width: 24px; height: 24px; }
  /* The open step: icon and label in blue with a short line on top, no box around it. */
  .stepper button.active { background: transparent; border-color: transparent; color: var(--accent); }
  .stepper button.active::before {
    content: ""; position: absolute; top: -4px; left: 30%; right: 30%; height: 3px;
    border-radius: 0 0 3px 3px; background: var(--accent);
  }
  /* No numbers on a phone: a finished step gets a small green tick on its icon instead. */
  .stepper .num { display: none; }
  .stepper button.done .num {
    display: grid; position: absolute; top: 2px; left: calc(50% + 6px);
    width: 16px; height: 16px; border-radius: 50%;
    font-size: 0.6rem; border: 2px solid var(--panel);
  }
  /* The page ends above the tab bar, so nothing hides behind it. */
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  /* The headline's line break is placed for a laptop; on a phone it left "3 a.m.," alone on a line. */
  .hero h1 br { display: none; }
  .next button { width: 100%; }
}

/* ---------- Header ---------- */

/* The bar stays at the top while scrolling; things behind it are blurred. */
.top-bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-bar-inner {
  max-width: 1100px; margin: 0 auto; padding: 10px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 750; letter-spacing: -0.01em; }
/* "Lifeguard-Agent" stays on one line: a narrow phone would otherwise break it at the hyphen. */
.nowrap { white-space: nowrap; }

/* The life buoy (an SVG drawing in index.html). */
.logo { width: 26px; height: 26px; flex: none; }

/* The sun/moon button: only one of the two icons shows, depending on the theme. */
.icon-button {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; padding: 0;
  border-radius: 10px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
}
.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); filter: none; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

.hero { max-width: 1100px; margin: 0 auto; padding: 40px 16px 12px; }
.hero h1 {
  margin: 0; font-size: clamp(1.6rem, 4.6vw, 2.4rem); line-height: 1.2; letter-spacing: -0.02em;
}
.tagline { margin: 12px 0 0; color: var(--muted); max-width: 680px; font-size: 1.05rem; }
/* What it runs on: one quiet line, written as a sentence. */
.built-with {
  margin: 18px 0 0; padding-left: 10px; max-width: 680px;
  border-left: 3px solid var(--line);
  color: var(--muted); font-size: 0.85rem;
}

/* The server's name next to "The demo shop", like a hostname in a terminal. */
.host {
  margin-left: 10px; padding: 1px 8px; border-radius: 6px;
  background: var(--inset); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 0.78rem; font-weight: 500; color: var(--muted);
}

.footer {
  max-width: 1100px; margin: 0 auto; padding: 8px 16px 40px;
  color: var(--muted); font-size: 0.85rem; text-align: center;
}

/* ---------- Alert banner ---------- */

.alert {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--bad-soft);
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  border-left: 4px solid var(--bad);
}
.alert strong { color: var(--bad); }
/* After a fix that worked, the same banner turns green: the complaint is answered. */
.alert.resolved {
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
  border-left-color: var(--ok);
}
.alert.resolved strong { color: var(--ok); }
/* Extra lines under a fixed banner: what's still wrong, what to watch. */
.alert .detail { display: block; margin-top: 4px; font-size: 0.875rem; }
.alert .detail.warn { color: var(--warn); }

/* ---------- Panels ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-top: 20px;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
h2 { margin: 0 0 8px; font-size: 1.2rem; letter-spacing: -0.01em; display: flex; align-items: center; }
.panel-head h2 { margin-bottom: 0; }
h3 { margin: 20px 0 8px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.muted { color: var(--muted); font-size: 0.875rem; }

/* ---------- The map: customers -> web -> api -> database and cache ---------- */

/* One row on a laptop, read left to right like a request travelling through the shop. */
.map {
  display: flex; align-items: center; justify-content: center;
  margin: 4px 0 8px; padding: 22px 18px;
  background: var(--inset); border: 1px solid var(--line); border-radius: 12px;
  overflow-x: auto;
}
.map-node {
  position: relative; flex: none;
  display: flex; flex-direction: column; gap: 1px;
  min-width: 112px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--ok);
  border-radius: 10px;
}
.map-node.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.map-node.bad { border-left-color: var(--bad); background: var(--bad-soft); box-shadow: 0 0 14px color-mix(in srgb, var(--bad) 30%, transparent); }
.map-name { font-family: var(--mono); font-weight: 700; }
.map-role { font-size: 0.75rem; color: var(--muted); }
.map-note { font-size: 0.8rem; font-weight: 650; color: var(--ok); }
.map-node.warn .map-note { color: var(--warn); }
.map-node.bad .map-note { color: var(--bad); }

/* The part the agent is checking right now: a pulsing blue ring and a small label. */
.map-node.focus { outline: 2px solid var(--accent); outline-offset: 3px; animation: focus-ring 1.2s ease-in-out infinite; }
.map-node.focus::after {
  content: "agent checking"; position: absolute; top: -11px; right: 8px;
  padding: 0 6px; border-radius: 6px;
  background: var(--accent); color: var(--on-accent);
  font-size: 0.65rem; font-weight: 700; line-height: 18px;
}
@keyframes focus-ring {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 30%, transparent); }
}

/* The lines between the boxes. A healthy line has dots moving along it: requests flowing.
   A broken one is a red dashed line that stands still: nothing gets through. */
.map-line { flex: 1 1 24px; min-width: 20px; max-width: 120px; height: 2px; position: relative; background: var(--ok); }
.map-line.ok::after {
  content: ""; position: absolute; top: -2px; left: 0; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); animation: flow 1.6s linear infinite;
}
@keyframes flow { from { left: 0; } to { left: calc(100% - 6px); } }
.map-line.warn { background: var(--warn); }
.map-line.bad { background: repeating-linear-gradient(90deg, var(--bad) 0 6px, transparent 6px 11px); }

/* The api uses both the database and the cache: one line in, splitting into two. */
.map-fork { flex: none; width: 40px; align-self: stretch; position: relative; }
.map-fork span { position: absolute; border-color: var(--ok); border-style: solid; border-width: 0; }
.map-fork .fork-in { left: 0; top: 50%; width: 50%; border-top-width: 2px; }
.map-fork .fork-db { left: 50%; top: 25%; width: 50%; height: 25%; border-top-width: 2px; border-left-width: 2px; }
.map-fork .fork-cache { left: 50%; top: 50%; width: 50%; height: 25%; border-bottom-width: 2px; border-left-width: 2px; }
.map-fork .warn { border-color: var(--warn); }
.map-fork .bad { border-color: var(--bad); border-style: dashed; }
.map-pair { display: flex; flex-direction: column; gap: 12px; flex: none; }

/* On a phone the map turns to run top to bottom, and the database and cache sit side by side. */
@media (max-width: 640px) {
  .map { flex-direction: column; align-items: stretch; padding: 16px; }
  .map-node { min-width: 0; }
  .map-line { flex: none; align-self: center; width: 2px; height: 22px; min-width: 0; }
  .map-line.ok::after { top: 0; left: -2px; animation-name: flow-down; }
  .map-line.bad { background: repeating-linear-gradient(180deg, var(--bad) 0 6px, transparent 6px 11px); }
  .map-fork { width: auto; height: 34px; align-self: stretch; }
  .map-fork .fork-in { left: 50%; top: 0; width: 0; height: 50%; border-top-width: 0; border-left-width: 2px; }
  .map-fork .fork-db { left: 25%; top: 50%; width: 25%; height: 50%; border-width: 2px 0 0 2px; }
  .map-fork .fork-cache { left: 50%; top: 50%; width: 25%; height: 50%; border-width: 2px 2px 0 0; }
  .map-pair { flex-direction: row; }
  .map-pair .map-node { flex: 1 1 0; }
}
@keyframes flow-down { from { top: 0; } to { top: calc(100% - 6px); } }

/* ---------- Container cards ---------- */

/* As many cards per row as fit, each at least 210px wide: 4 on a laptop, 1 on a phone. */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }

.card {
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.card.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-soft); }
.card.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: var(--bad-soft); }

.card-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 650; font-family: var(--mono); }
/* What's wrong with a part that is still "Running", e.g. "disk 100%": the reason for the card's colour. */
.card-problem { margin-top: 6px; font-size: 0.85rem; font-weight: 650; }
.card-problem.warn { color: var(--warn); }
.card-problem.bad { color: var(--bad); }
.role { color: var(--muted); font-size: 0.85rem; }
.image { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); margin-top: 8px; }

/* The small coloured label: Running / Restarting / Stopped, with a status light. */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.72rem; font-weight: 650;
  padding: 2px 9px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
/* Only a problem glows: the eye should go to what's broken, not to what's fine. */
.badge.warn::before, .badge.bad::before { box-shadow: 0 0 8px currentColor; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

.facts { margin-top: 8px; font-size: 0.85rem; }

/* ---------- Bars (memory, disk) ---------- */

.bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--ok); transition: width 0.6s ease; }
.bar.warn > span { background: var(--warn); }
.bar.bad > span { background: var(--bad); box-shadow: 0 0 10px var(--bad); }

/* ---------- Health checks, disks, jobs ---------- */

/* Three columns on a laptop, stacked on a phone. */
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 28px; }
.rows { display: grid; gap: 10px; }
.row { font-size: 0.9rem; }
.row-line { display: flex; justify-content: space-between; gap: 8px; }
.ok-text { color: var(--ok); font-weight: 650; }
.warn-text { color: var(--warn); font-weight: 650; }
.bad-text { color: var(--bad); font-weight: 650; }

/* ---------- Step numbers in the headings ---------- */

.step {
  display: inline-grid; place-items: center; flex: none;
  width: 28px; height: 28px; margin-right: 10px;
  border-radius: 8px;
  background: var(--accent); color: var(--on-accent);
  font-size: 0.9rem; font-weight: 750;
}

/* ---------- Buttons and the custom fault box ---------- */

button {
  font: inherit; font-size: 0.9rem; font-weight: 650;
  padding: 9px 16px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent); color: var(--on-accent);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.2s, background-color 0.25s, border-color 0.25s, color 0.25s;
}
button:hover:not(:disabled) { filter: brightness(1.08); }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.secondary { background: transparent; color: var(--accent); }
/* Greyed out while it can't be used, e.g. while the server is already broken. */
button:disabled { opacity: 0.4; cursor: not-allowed; }

.buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.buttons button { background: var(--inset); color: var(--text); border-color: var(--line); font-weight: 550; }
.buttons button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); filter: none; }

.custom { display: flex; gap: 8px; flex-wrap: wrap; }
.custom input {
  flex: 1 1 260px;
  font: inherit; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--inset); color: var(--text);
}
.custom input::placeholder { color: var(--muted); }

/* ---------- Messages under the break panel ---------- */

.message { margin-top: 14px; padding: 11px 14px; border-radius: 10px; background: var(--inset); border: 1px solid var(--line); }
.message.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.message.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }

/* ---------- Agent timeline ---------- */

.timeline { list-style: none; margin: 18px 0 0; padding: 0 0 0 20px; border-left: 2px solid var(--line); }
.timeline:empty { display: none; }
.timeline li { position: relative; margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; }
.timeline li:hover { background: var(--inset); }
/* The dot on the line in front of each step. */
.timeline li::before {
  content: ""; position: absolute; left: -28px; top: 14px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--accent);
}
.timeline li.warn::before { border-color: var(--warn); background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.timeline li.bad::before { border-color: var(--bad); background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.timeline li.ok::before { border-color: var(--ok); background: var(--ok); }

.step-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.step-time { color: var(--muted); font-family: var(--mono); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.step-title { font-weight: 650; }
.code { font-family: var(--mono); font-size: 0.84rem; overflow-wrap: anywhere; }

/* Which Nemotron model did this step. */
.model { font-size: 0.68rem; font-weight: 750; letter-spacing: 0.03em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; color: #fff; }
.model.nano { background: #5f9600; }   /* NVIDIA green, a bit darker so white text reads */
.model.super { background: #2563eb; }
.model.ultra { background: #7c3aed; }
.model.guardrail { background: #64748b; }  /* our own code, not a model: neutral grey */
.model[title] { cursor: help; }             /* hover to read what the badge means */

/* Long tool outputs and reports fold away; click to open. */
details { margin-top: 6px; }
summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; width: fit-content; }
summary:hover { color: var(--accent); }
pre {
  margin: 6px 0 0; padding: 12px; max-height: 320px; overflow: auto;
  background: var(--inset); border: 1px solid var(--line); border-radius: 10px;
  font-family: var(--mono); font-size: 0.8rem; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.step-text { margin-top: 4px; white-space: pre-wrap; }

#investigate { margin-top: 8px; }

/* ---------- 3. You decide: option cards ---------- */

.root-cause { padding: 14px 16px; border-radius: 12px; background: var(--inset); border: 1px solid var(--line); margin-bottom: 16px; }
.root-cause p { margin: 6px 0 0; }

.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.option {
  background: var(--inset); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.option.recommended { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.option.blocked { opacity: 0.6; border-style: dashed; }
.option.chosen { border-color: var(--ok); background: var(--ok-soft); box-shadow: 0 0 0 1px var(--ok); }
.option h4 { margin: 0; font-size: 1rem; }
.option ul { margin: 0; padding-left: 18px; font-size: 0.9rem; }
.option .pros li::marker { content: "✓  "; color: var(--ok); }
.option .cons li::marker { content: "✗  "; color: var(--bad); }
/* overflow-wrap: long file paths break onto the next line instead of running into the next card. */
.option .steps { margin: 0; padding-left: 20px; font-family: var(--mono); font-size: 0.8rem; overflow-wrap: anywhere; }
.option .label { font-size: 0.72rem; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.option button { margin-top: auto; }
/* The second click: "Click again to apply" stands out so nobody applies a fix by accident. */
button.armed { background: var(--warn); border-color: var(--warn); color: #1a1205; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 0.72rem; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag.accent { background: var(--accent); color: var(--on-accent); border-color: transparent; }

.decide-actions { margin-top: 14px; }

/* ---------- 4. Result ---------- */

.verdict {
  font-size: clamp(1.8rem, 6vw, 2.4rem); font-weight: 850; letter-spacing: -0.01em;
  padding: 18px 20px; border-radius: 12px; border: 1px solid transparent;
}
.verdict.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.verdict.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.verdict small { display: block; font-size: 0.95rem; font-weight: 500; color: var(--text); margin-top: 6px; text-shadow: none; letter-spacing: 0; }
.verdict-details pre { max-height: none; }
/* "Proof from the server": the new log lines, a tick in front of each request that worked. */
.proof { margin-top: 12px; padding: 12px 16px; border-radius: 12px; background: var(--inset); border: 1px solid var(--line); }
.proof .label { font-size: 0.72rem; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.proof ul { margin: 8px 0 0; padding-left: 20px; font-family: var(--mono); font-size: 0.85rem; }
.proof li { color: var(--muted); }
.proof li.success { color: var(--ok); font-weight: 650; }
.proof li.success::marker { content: "✓  "; }
.links { display: flex; gap: 10px; flex-wrap: wrap; }
/* The postmortem links look like buttons: they're the last thing a visitor does. */
.links a {
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--inset); text-decoration: none; font-weight: 600; font-size: 0.9rem;
}
.links a:hover { border-color: var(--accent); }
a { color: var(--accent); }

/* A small spinning circle next to "Building your fault...". */
.spinner {
  display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* People who asked their computer for less motion get no sliding or fading. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; }
}
