/*
 * api-dr-runner dashboard — design tokens and components.
 *
 * Colour comes from the validated data-viz palette (see docs/dashboard.md). Two rules here
 * are load-bearing for the product's honesty model, not for taste:
 *
 *  1. INCONCLUSIVE and NEVER-RUN have NO status hue. They are rendered in neutral ink on a
 *     hatched / dotted chip, because they mean "we did not observe this", which is a
 *     different thing from a bad result and must not read as a shade of failure.
 *  2. Every status is carried by glyph + word as well as colour. #fab219 (warning) and
 *     #ec835a (serious) measure only 13.6 normal-vision deltaE apart, so hue alone cannot
 *     be trusted to separate them — and roughly 1 in 12 men cannot use hue here at all.
 */

:root {
  color-scheme: light;

  /* Surfaces & ink — light */
  --surface-1: #fcfcfb;
  --surface-2: #f4f4f1;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --border-strong: rgba(11, 11, 11, 0.22);
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.06), 0 8px 24px rgba(11, 11, 11, 0.06);

  /* Status — fixed, never themed */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --success-text: #006300;

  /* Accent / single-series sequential hue — brand teal, matching the platform guide
     (pages.git.autodesk.com/.../api-resilience-orchestrator). Darkened for light-mode
     contrast; the vivid guide teal (#00f5d4) is reserved for dark mode below. This is brand
     colour, not status colour — it never carries a verdict, so retheming it does not touch
     the accessibility-validated palette. */
  --accent: #00897a;
  --accent-strong: #006b5f;
  --accent-2: #6a4fd6;
  --accent-soft: #cdf3ec;

  /* Ordinal tier ramp — one hue, monotone lightness, validated --ordinal */
  --tier-0: #86b6ef;
  --tier-1: #5598e7;
  --tier-2: #2a78d6;
  --tier-3: #1c5cab;

  --radius: 10px;
  --radius-sm: 6px;
  --focus: 0 0 0 2px var(--surface-1), 0 0 0 4px var(--accent);
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --motion: 160ms cubic-bezier(0.2, 0, 0, 1);
  /* No glass effect in light mode — blur reads as murky on a bright background, and the
     guide's glass-panel look is a dark-mode-only aesthetic; see the dark blocks below. */
  --glow: none;
  --panel-blur: none;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    /* Same deep-panel, glass-card treatment as the platform guide (docs/index.html):
       near-black page, translucent blurred surfaces, teal/violet brand accent. Status and
       tier-ladder colours below are untouched — see the file header. */
    --surface-1: rgba(18, 26, 38, 0.82);
    --surface-2: rgba(24, 34, 48, 0.9);
    --page: #05070d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #8b9bb8;
    --gridline: #2c2c2a;
    --baseline: #383835;
    --border: rgba(120, 170, 255, 0.16);
    --border-strong: rgba(120, 170, 255, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 32px rgba(0, 0, 0, 0.5), var(--glow);
    --success-text: #0ca30c;
    --accent: #00d9bb;
    --accent-strong: #00f5d4;
    --accent-2: #7b61ff;
    --accent-soft: #184f95;
    --tier-0: #6da7ec;
    --tier-1: #3987e5;
    --tier-2: #256abf;
    --tier-3: #184f95;
    --glow: 0 0 32px rgba(0, 245, 212, 0.08);
    --panel-blur: blur(14px);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: rgba(18, 26, 38, 0.82);
  --surface-2: rgba(24, 34, 48, 0.9);
  --page: #05070d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #8b9bb8;
  --gridline: #2c2c2a;
  --baseline: #383835;
  --border: rgba(120, 170, 255, 0.16);
  --border-strong: rgba(120, 170, 255, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 32px rgba(0, 0, 0, 0.5), var(--glow);
  --success-text: #0ca30c;
  --accent: #00d9bb;
  --accent-strong: #00f5d4;
  --accent-2: #7b61ff;
  --accent-soft: #184f95;
  --tier-0: #6da7ec;
  --tier-1: #3987e5;
  --tier-2: #256abf;
  --tier-3: #184f95;
  --glow: 0 0 32px rgba(0, 245, 212, 0.08);
  --panel-blur: blur(14px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--page);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* A static echo of the platform guide's background wash — deliberately not animated: this
   page's job is to be read accurately under real incidents, not to look alive. */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) body {
    background:
      radial-gradient(circle at 15% -10%, rgba(0, 245, 212, 0.06), transparent 45%),
      radial-gradient(circle at 100% 0%, rgba(123, 97, 255, 0.05), transparent 40%),
      var(--page);
    background-attachment: fixed;
  }
}
:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 15% -10%, rgba(0, 245, 212, 0.06), transparent 45%),
    radial-gradient(circle at 100% 0%, rgba(123, 97, 255, 0.05), transparent 40%),
    var(--page);
  background-attachment: fixed;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
}

:is(a, button, input, select, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius-sm);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 60;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  transition: top var(--motion);
}
.skip-link:focus {
  top: 12px;
}

/* ---------------------------------------------------------------- app frame */

.app-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 20px;
  background: color-mix(in oklab, var(--surface-1) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-right: auto;
}

.brand__mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2, var(--accent-strong)));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.brand__word {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Matches the platform guide's wordmark treatment (docs/index.html .logo span). */
.brand__accent {
  color: var(--accent);
  font-weight: 700;
}

main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 20px 96px;
  container-type: inline-size;
  container-name: page;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--surface-1);
  backdrop-filter: var(--panel-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card__title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 650;
  margin-bottom: 12px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.spacer {
  flex: 1;
}

.muted {
  color: var(--text-muted);
}

.secondary {
  color: var(--text-secondary);
}

.small {
  font-size: 12.5px;
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- controls */

.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition:
    background var(--motion),
    border-color var(--motion),
    transform var(--motion);
}
.btn:hover {
  background: var(--surface-2);
}
.btn:active {
  transform: translateY(1px);
}
.btn[aria-pressed="true"],
.btn.is-active {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 12%, var(--surface-1));
}
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--primary:hover {
  background: var(--accent-strong);
}
.btn--ghost {
  border-color: transparent;
  background: transparent;
}
.btn--ghost:hover {
  background: var(--surface-2);
}

/* A native <details>/<summary> dropdown — no JS needed to open/close. Used where an action
   (e.g. "Download report") has more than one reasonable target format. */
.menu {
  position: relative;
  display: inline-block;
}
.menu > summary {
  list-style: none;
}
.menu > summary::-webkit-details-marker {
  display: none;
}
.menu[open] > summary {
  border-color: var(--accent);
}
.menu__list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 160px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.menu__list button {
  font: inherit;
  font-size: 13px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  cursor: pointer;
  color: var(--text-primary);
}
.menu__list button:hover {
  background: var(--surface-2);
}
.menu__list .small {
  padding: 4px 10px 2px;
}

.input,
.select {
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 220px;
  flex: 1 1 220px;
}
.search .input {
  width: 100%;
  padding-left: 30px;
}
.search::before {
  content: "⌕";
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

.kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--text-secondary);
  background: var(--surface-1);
}

/* ------------------------------------------------------------ status chips */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-primary);
  white-space: nowrap;
}

.chip__glyph {
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
}

/* Text always wears an ink token; the glyph carries the hue. */
.chip--pass {
  border-color: color-mix(in oklab, var(--status-good) 55%, transparent);
  background: color-mix(in oklab, var(--status-good) 12%, var(--surface-1));
}
.chip--pass .chip__glyph {
  color: var(--success-text);
}

.chip--fail {
  border-color: color-mix(in oklab, var(--status-critical) 60%, transparent);
  background: color-mix(in oklab, var(--status-critical) 12%, var(--surface-1));
}
.chip--fail .chip__glyph {
  color: var(--status-critical);
}

.chip--partial {
  border-color: color-mix(in oklab, var(--status-warning) 65%, transparent);
  background: color-mix(in oklab, var(--status-warning) 16%, var(--surface-1));
}
.chip--partial .chip__glyph {
  color: color-mix(in oklab, var(--status-warning) 82%, var(--text-primary));
}

.chip--blocked {
  border-color: color-mix(in oklab, var(--status-serious) 65%, transparent);
  background: color-mix(in oklab, var(--status-serious) 16%, var(--surface-1));
}
.chip--blocked .chip__glyph {
  color: color-mix(in oklab, var(--status-serious) 82%, var(--text-primary));
}

.chip--running {
  border-color: color-mix(in oklab, var(--accent) 55%, transparent);
  background: color-mix(in oklab, var(--accent) 12%, var(--surface-1));
}
.chip--running .chip__glyph {
  color: var(--accent);
}
.live-dot {
  display: inline-block;
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot {
    animation: none;
  }
}

/*
 * No hue. "We could not observe this" is not a grade on a pass/fail scale, and the hatch
 * reads as missing data rather than as a weak result.
 */
.chip--inconclusive,
.chip--unknown {
  border-style: dashed;
  border-color: var(--border-strong);
  background-color: var(--surface-1);
  background-image: repeating-linear-gradient(
    135deg,
    color-mix(in oklab, var(--text-muted) 16%, transparent) 0 2px,
    transparent 2px 6px
  );
  color: var(--text-primary);
}
.chip--inconclusive .chip__glyph,
.chip--unknown .chip__glyph {
  color: var(--text-secondary);
}

.chip--never {
  border-style: dotted;
  border-color: var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 550;
}
.chip--never .chip__glyph {
  color: var(--text-muted);
}

.chip--sm {
  font-size: 11.5px;
  padding: 1px 7px;
}

/* Provenance badge: measured / derived / unknown */
.prov {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--surface-2);
}
.prov--measured {
  border-color: color-mix(in oklab, var(--status-good) 45%, transparent);
}
.prov--derived {
  border-style: dashed;
}
.prov--unknown {
  border-style: dashed;
  background-image: repeating-linear-gradient(
    135deg,
    color-mix(in oklab, var(--text-muted) 16%, transparent) 0 2px,
    transparent 2px 6px
  );
}

/* --------------------------------------------------------------- callouts */

.callout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border-strong);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  background: var(--surface-1);
  font-size: 13.5px;
}
.callout__glyph {
  font-size: 14px;
  line-height: 1.4;
  font-weight: 800;
}
.callout__title {
  font-weight: 700;
  display: block;
}
.callout--critical {
  border-left-color: var(--status-critical);
  background: color-mix(in oklab, var(--status-critical) 8%, var(--surface-1));
}
.callout--critical .callout__glyph {
  color: var(--status-critical);
}
.callout--warning {
  border-left-color: var(--status-warning);
  background: color-mix(in oklab, var(--status-warning) 10%, var(--surface-1));
}
.callout--warning .callout__glyph {
  color: color-mix(in oklab, var(--status-warning) 80%, var(--text-primary));
}
.callout--neutral {
  border-left-color: var(--baseline);
  background: var(--surface-1);
  background-image: repeating-linear-gradient(
    135deg,
    color-mix(in oklab, var(--text-muted) 10%, transparent) 0 2px,
    transparent 2px 7px
  );
}
.callout--neutral .callout__glyph {
  color: var(--text-secondary);
}
.callout--info {
  border-left-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 8%, var(--surface-1));
}
.callout--info .callout__glyph {
  color: var(--accent);
}
.callout[hidden] {
  display: none;
}

/* ------------------------------------------------------------- hero / KPIs */

.hero {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.4fr);
  align-items: stretch;
}
@container page (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

.hero__figure {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.hero__figure small {
  font-size: 22px;
  font-weight: 500;
  color: var(--text-muted);
}

.hero__caption {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-secondary);
  max-width: 44ch;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 12px;
}

.kpi {
  text-align: left;
  font: inherit;
  cursor: pointer;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 4px solid var(--baseline);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition:
    transform var(--motion),
    border-color var(--motion);
}
.kpi:hover {
  transform: translateY(-1px);
}
.kpi__value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}
.kpi__label {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.kpi--critical {
  border-left-color: var(--status-critical);
}
.kpi--warning {
  border-left-color: var(--status-warning);
}
.kpi--neutral {
  border-left-color: var(--baseline);
}
.kpi--good {
  border-left-color: var(--status-good);
}
.kpi[hidden] {
  display: none;
}

/* ---------------------------------------------------------------- ribbon */

.ribbon {
  display: flex;
  gap: 2px; /* 2px surface gap between stacked segments */
  height: 30px;
  width: 100%;
}
.ribbon__seg {
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 3px;
  position: relative;
  min-width: 4px;
  transition: filter var(--motion);
}
.ribbon__seg:hover {
  filter: brightness(1.06);
}
.ribbon__seg[aria-pressed="true"] {
  outline: 2px solid var(--text-primary);
  outline-offset: 1px;
}
.ribbon__seg--pass {
  background: var(--status-good);
}
.ribbon__seg--fail {
  background: var(--status-critical);
}
.ribbon__seg--partial {
  background: var(--status-warning);
}
.ribbon__seg--blocked {
  background: var(--status-serious);
}
.ribbon__seg--running {
  background: var(--accent);
}
.ribbon__seg--inconclusive,
.ribbon__seg--unknown,
.ribbon__seg--never {
  background-color: var(--surface-2);
  border: 1px dashed var(--border-strong);
  background-image: repeating-linear-gradient(
    135deg,
    color-mix(in oklab, var(--text-muted) 38%, transparent) 0 3px,
    transparent 3px 7px
  );
}

/*
 * "Never drilled" is a different absence from "could not be observed", and side by side in
 * the ribbon one hatch could not be told from the other. Mirror the fill to 45deg and drop
 * the density: same texture family, unmistakably two bands.
 */
.ribbon__seg--never {
  border-style: dotted;
  background-image: repeating-linear-gradient(
    45deg,
    color-mix(in oklab, var(--text-muted) 24%, transparent) 0 2px,
    transparent 2px 9px
  );
}

.ribbon-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* ----------------------------------------------------------------- table */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
}

table.fleet {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

table.fleet th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 650;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gridline);
  background: var(--surface-1);
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}

table.fleet th button {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
table.fleet th button:focus-visible {
  box-shadow: var(--focus);
}

table.fleet td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--gridline);
  vertical-align: top;
}

table.fleet tbody tr {
  transition: background var(--motion);
}
table.fleet tbody tr:hover {
  background: var(--surface-2);
}
table.fleet tbody tr:has(a.rowlink:focus-visible) {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--accent);
}

@container page (min-width: 761px) {
  table.fleet td:first-child {
    min-width: 190px;
  }
  table.fleet td:nth-child(8) {
    min-width: 230px;
  }
}
table.fleet td:first-child .mono {
  overflow-wrap: anywhere;
}

a.rowlink {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 620;
}
a.rowlink:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------- meter */

.meter {
  min-width: 110px;
}
.meter__track {
  position: relative;
  height: 7px;
  border-radius: 4px;
  background: var(--gridline);
  overflow: visible;
}
.meter__fill {
  position: absolute;
  inset-block: 0;
  left: 0;
  border-radius: 4px;
  background: var(--accent);
}
.meter__fill--over {
  background: var(--status-critical);
}
.meter__limit {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--text-primary);
  border-radius: 1px;
}
.meter__caption {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---------------------------------------------------------- tier ladder */

.ladder {
  display: grid;
  gap: 12px;
}

.tier {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-1);
}
.tier--locked {
  background-image: repeating-linear-gradient(
    135deg,
    color-mix(in oklab, var(--text-muted) 7%, transparent) 0 3px,
    transparent 3px 9px
  );
}
.tier__badge {
  display: grid;
  place-items: center;
  height: 46px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 15px;
  color: #fff;
}
.tier__badge--0 {
  background: var(--tier-0);
  color: #0b0b0b;
}
.tier__badge--1 {
  background: var(--tier-1);
  color: #0b0b0b;
}
.tier__badge--2 {
  background: var(--tier-2);
}
.tier__badge--3 {
  background: var(--tier-3);
}
.tier__badge--locked {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px dashed var(--border-strong);
}
.tier__title {
  font-weight: 680;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.tier__proves {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.tier__blockers {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tier__blockers li {
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 2px 7px;
  background: var(--surface-2);
}

.cmd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 7px 8px 7px 11px;
}
.cmd code {
  font-family: var(--mono);
  font-size: 12.5px;
  overflow-x: auto;
  white-space: pre;
  flex: 1;
  color: var(--text-primary);
}

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

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 22px;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--gridline);
}
.timeline li {
  position: relative;
  padding: 0 0 16px;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface-1);
}
.timeline__event {
  font-weight: 640;
}
.timeline__time {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ metric grid */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.metric {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  background: var(--surface-1);
}
.metric--unknown {
  background-image: repeating-linear-gradient(
    135deg,
    color-mix(in oklab, var(--text-muted) 8%, transparent) 0 3px,
    transparent 3px 9px
  );
}
.metric__label {
  font-size: 12px;
  color: var(--text-secondary);
}
.metric__value {
  font-size: 23px;
  font-weight: 680;
  line-height: 1.2;
  margin: 2px 0 6px;
}
.metric__value--unknown {
  font-size: 15px;
  font-weight: 620;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------- definitions */

.term {
  border-bottom: 1px dotted var(--text-muted);
  cursor: help;
  text-decoration: none;
}
.term:focus-visible {
  box-shadow: var(--focus);
}

#tip {
  position: fixed;
  z-index: 70;
  max-width: 340px;
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  pointer-events: none;
}
#tip[hidden] {
  display: none;
}
#tip b {
  display: block;
  margin-bottom: 3px;
}

/* ---------------------------------------------------------- action dialogs */

.action-dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  width: min(480px, 92vw);
  background: var(--surface-1);
  backdrop-filter: var(--panel-blur);
  color: var(--text-primary);
}
.action-dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(2px);
}
.action-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.action-dialog__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}
.action-dialog__close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}
.action-dialog__close:hover {
  color: var(--text-primary);
  background: var(--surface-2);
}
.action-dialog__close:focus-visible {
  box-shadow: var(--focus);
  outline: none;
}
.action-dialog__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.action-dialog__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.action-dialog__field--full {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.action-dialog__static {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13.5px;
}
.action-dialog__footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}
.dialog-alert {
  border: 1px solid var(--status-critical);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--status-critical) 10%, var(--surface-1));
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 13.5px;
  margin-bottom: 14px;
}
.dialog-alert[hidden] {
  display: none;
}

/* ------------------------------------------------------------ welcome dialog */
/* Shown once, ever (localStorage-gated in main.mjs), so it can afford to be a
   little more expressive than the rest of this page — everywhere else, motion
   and glow are deliberately absent because this page has to be read accurately
   during a real incident (see docs/dashboard.md). A first-time visitor is not
   mid-incident, so this is the one place that gets to look like the platform
   guide it matches. */

.welcome-dialog {
  position: relative;
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 32px 34px 26px;
  background:
    radial-gradient(
      circle at 15% -10%,
      color-mix(in oklab, var(--accent) 16%, transparent),
      transparent 60%
    ),
    var(--surface-1);
  backdrop-filter: var(--panel-blur);
  box-shadow: var(--shadow), 0 0 0 1px color-mix(in oklab, var(--accent) 25%, transparent);
  color: var(--text-primary);
}
.welcome-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
}
.welcome-dialog__close {
  position: absolute;
  top: 14px;
  right: 14px;
}
.welcome-dialog__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.welcome-dialog__mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 15px;
  box-shadow: var(--glow);
}
.welcome-dialog__title {
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}
.welcome-dialog__lede {
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0 0 22px;
}
.welcome-dialog__features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
}
.welcome-dialog__features li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.welcome-dialog__features li > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.welcome-dialog__features strong {
  font-size: 13.5px;
}
.welcome-dialog__features span {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}
.welcome-dialog__glyph {
  color: var(--accent);
  font-size: 16px;
  line-height: 1.4;
  flex-shrink: 0;
}
.welcome-dialog__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

@media (max-width: 560px) {
  .welcome-dialog {
    padding: 26px 20px 20px;
  }
  .welcome-dialog__title {
    font-size: 20px;
  }
  .welcome-dialog__features {
    grid-template-columns: 1fr;
  }
  .welcome-dialog__footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }
}

/* --------------------------------------------------------------- palette */

#palette {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
  width: min(560px, 92vw);
  background: var(--surface-1);
  backdrop-filter: var(--panel-blur);
  color: var(--text-primary);
}
#palette::backdrop {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(2px);
}
#palette .input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 14px 16px;
  font-size: 15px;
}
#palette .input:focus-visible {
  box-shadow: none;
  outline: none;
}
.palette__list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 48vh;
  overflow-y: auto;
}
.palette__list li button {
  all: unset;
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
}
.palette__list li[aria-selected="true"] button,
.palette__list li button:hover {
  background: color-mix(in oklab, var(--accent) 14%, var(--surface-1));
}
.palette__hint {
  border-top: 1px solid var(--border);
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
}

/* ------------------------------------------------------------- skeletons */

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    color-mix(in oklab, var(--surface-2) 60%, var(--gridline)) 37%,
    var(--surface-2) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  height: 16px;
}
@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
}
.empty__glyph {
  font-size: 34px;
  opacity: 0.5;
}

/* ------------------------------------------------------------------ chart */

.chart figcaption {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 8px;
}
.chart svg {
  width: 100%;
  /* The viewBox is 720 units wide; letting it stretch across a 1200px card scaled the
     axis labels up with it. Cap it so one SVG unit stays one CSS pixel. */
  max-width: 720px;
  height: auto;
  overflow: visible;
}
.chart .grid line {
  stroke: var(--gridline);
  stroke-width: 1;
}
.chart .axis text {
  fill: var(--text-muted);
  font-size: 10.5px;
  font-family: var(--font);
}
.chart .series {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart .limit {
  stroke: var(--text-primary);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}
.chart .pt {
  stroke: var(--surface-1);
  stroke-width: 2;
}
.chart .pt--measured {
  fill: var(--accent);
}
.chart .pt--unmeasured {
  fill: var(--surface-1);
  stroke: var(--text-muted);
  stroke-width: 2;
}
.chart .riser {
  stroke: var(--text-muted);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
}
.chart .hit {
  fill: transparent;
  cursor: pointer;
}

/* --------------------------------------------------------------- mobile */

@container page (max-width: 760px) {
  table.fleet thead {
    display: none;
  }
  table.fleet,
  table.fleet tbody,
  table.fleet tr,
  table.fleet td {
    display: block;
    width: 100%;
  }
  table.fleet tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 6px 2px;
  }
  table.fleet td {
    border-bottom: 0;
    display: grid;
    grid-template-columns: 42% 1fr;
    gap: 10px;
    padding: 7px 12px;
  }
  table.fleet td::before {
    content: attr(data-label);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 650;
  }
  .hero__figure {
    font-size: 42px;
  }
}

/* Phones: nothing may push the page wider than the viewport — a dashboard opened from a
   Slack link on a phone that scrolls sideways is a dashboard nobody reads. */
@media (max-width: 560px) {
  .app-bar {
    padding: 8px 12px;
    gap: 8px;
  }
  .brand__word {
    font-size: 13.5px;
  }
  main {
    padding: 16px 12px 72px;
  }
  .kpis {
    grid-template-columns: 1fr 1fr;
  }
  .kpi__value {
    font-size: 22px;
  }
  .card {
    padding: 14px;
  }
  .tier {
    grid-template-columns: 44px 1fr;
    gap: 10px;
  }
  .search {
    min-width: 0;
  }
  table.fleet td {
    grid-template-columns: 38% 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (forced-colors: active) {
  .chip,
  .callout,
  .tier,
  .metric,
  .card {
    border: 1px solid CanvasText;
  }
  .ribbon__seg {
    border: 1px solid CanvasText;
  }
}
