/* =============================================================
   status — AI tool status radar
   Dark instrument panel. Data is monospace; only anomalies glow.
   ============================================================= */

:root {
  --bg: #0b0e14;
  --panel: #11151f;
  --panel-2: #151a26;
  --line: #1e2430;
  --line-soft: #171c27;

  --fg: #e6e9f0;
  --fg-dim: #8b95a8;
  --fg-faint: #565f75;

  /* Cell scale: healthy stays dim, anomalies light up. */
  --c-nodata: #171d29;
  --c-op: #1b6e33;
  --c-watch: #1f6feb;
  --c-maint: #8957e5;
  --c-degraded: #bb8009;
  --c-partial: #db6d28;
  --c-major: #da3633;

  /* Text-weight variants of the same scale. */
  --t-op: #3fb950;
  --t-watch: #58a6ff;
  --t-maint: #a371f7;
  --t-degraded: #d29922;
  --t-partial: #f0883e;
  --t-major: #f85149;

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;

  /* Preferred cell pitch. JS shrinks it per range only as far as needed to
     keep the wall inside the viewport; short ranges always keep this size. */
  --cell-w: 14px;
  --cell-gap: 3px;
  --label-w: 172px;

  --r: 8px;
  --maxw: 1140px;
  --gut: clamp(16px, 4vw, 32px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(1000px 420px at 50% -200px, rgba(63, 185, 80, 0.08), transparent 70%);
  background-repeat: no-repeat;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible {
  outline: 2px solid var(--t-watch);
  outline-offset: 2px;
  border-radius: 4px;
}

main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gut) 72px; }

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--r);
  color: var(--fg-faint);
  font-size: 13px;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px var(--gut);
  background: rgba(11, 14, 20, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--t-op);
  box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.5);
  animation: beat 2.8s ease-out infinite;
}

@keyframes beat {
  0% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.45); }
  70% { box-shadow: 0 0 0 9px rgba(63, 185, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}

.topbar nav {
  display: flex;
  gap: 16px;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
}
.topbar nav a { color: var(--fg-dim); }
.topbar nav a:hover { color: var(--fg); text-decoration: none; }

.stamp {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-faint);
  white-space: nowrap;
}

@media (max-width: 620px) {
  .topbar nav { display: none; }
}

/* Give the cells more room before they are forced to shrink. */
@media (max-width: 820px) {
  :root { --label-w: 124px; }
}

@media (max-width: 520px) {
  :root { --label-w: 92px; }
}

/* ---------- Verdict banner ---------- */

.verdict {
  position: relative;
  overflow: hidden;
  margin: 26px 0 30px;
  padding: 26px 26px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #121826, #0d1119);
}

.verdict::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--verdict-color, var(--t-op));
}

.verdict::after {
  content: "";
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(120, 160, 255, 0.09), transparent);
  animation: sweep 1.15s ease-out 0.15s 1 both;
}

@keyframes sweep {
  from { left: -40%; }
  to { left: 115%; }
}

.verdict h1 {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: clamp(21px, 3.6vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.verdict .lede {
  margin: 10px 0 0;
  max-width: 62ch;
  color: var(--fg-dim);
  font-size: 13.5px;
}

.verdict-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 12px;
}

.verdict-counts b {
  font-size: 17px;
  font-weight: 600;
  margin-right: 6px;
  letter-spacing: -0.01em;
}

.verdict-counts span { color: var(--fg-faint); }

/* ---------- Section frame ---------- */

.section { margin: 0 0 44px; }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.section-heading h2 {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-note {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--fg-faint);
}

.text-link { font-family: var(--mono); font-size: 12px; }

/* =============================================================
   CORRELATION WALL — the signature element.
   Rows are services, columns are days. A vertical band of colour
   means one upstream failure hit several tools on the same day.
   ============================================================= */

.wall-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 16px 18px 12px;
}

.wall-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.wall-vendor {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.wall-vendor select {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fg);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
}
.wall-vendor select:hover { border-color: #2c3545; }

.wall-readout {
  margin: 14px 0 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  min-height: 18px;
}
.wall-readout b { color: var(--fg); font-weight: 600; }

.range-group { display: flex; gap: 6px; }

.range-button,
.filter-button {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--fg-dim);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 11px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.range-button:hover,
.filter-button:hover { color: var(--fg); border-color: #2c3545; }

.range-button.is-active,
.filter-button.is-active {
  color: var(--fg);
  border-color: #33507d;
  background: rgba(31, 111, 235, 0.16);
}

.wall-scroll { overflow-x: auto; }

.wall {
  display: grid;
  grid-template-columns: var(--label-w) max-content;
  gap: var(--cell-gap) 14px;
  align-items: center;
  justify-content: start;
  width: max-content;
}

.wall-axis {
  grid-column: 2;
  display: grid;
  gap: var(--cell-gap);
  height: 15px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-faint);
}
.wall-axis span { grid-row: 1; white-space: nowrap; }

.wall-label.is-upstream b { color: var(--fg-dim); font-weight: 400; }
.wall-label.is-upstream { opacity: 0.82; }

.wall-label {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--fg-dim);
}

.wall-label b {
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wall-label i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-faint);
  flex: none;
}

.wall-row {
  grid-column: 2;
  display: grid;
  gap: var(--cell-gap);
  height: var(--cell-w);
}

.wall-row.is-dim { opacity: 0.28; }

.cell {
  height: 100%;
  min-height: 8px;
  border-radius: 2px;
  background: var(--c-nodata);
  transition: transform 0.1s ease, filter 0.1s ease;
}

.cell[data-state="operational"] { background: var(--c-op); }
.cell[data-state="watch"] { background: var(--c-watch); }
.cell[data-state="maintenance"] { background: var(--c-maint); }
.cell[data-state="degraded"] { background: var(--c-degraded); }
.cell[data-state="partial_outage"] { background: var(--c-partial); }
.cell[data-state="major_outage"] {
  background: var(--c-major);
  box-shadow: 0 0 6px rgba(218, 54, 51, 0.45);
}
.cell[data-state="unknown"] {
  background: var(--c-nodata);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.cell.is-col {
  filter: brightness(1.65);
  transform: scaleY(1.25);
}

.cell.is-now { box-shadow: inset 0 0 0 1px rgba(230, 233, 240, 0.6); }

/* Hairline down the whole wall: the day tracking started. */
.cell.is-start { box-shadow: inset 2px 0 0 rgba(230, 233, 240, 0.32); }

.wall-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-faint);
}

.wall-legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--c-nodata);
}
.wall-legend .swatch + span { margin-right: 8px; }

.wall-foot {
  margin: 10px 0 2px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-faint);
}

/* ---------- Controls ---------- */

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

#service-search {
  flex: 1 1 220px;
  min-width: 180px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--fg);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
}
#service-search::placeholder { color: var(--fg-faint); }

.filter-group { display: flex; gap: 6px; }

/* ---------- Service cards ---------- */

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.service-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 15px 16px;
  transition: border-color 0.15s, background 0.15s;
}

.service-card:hover { border-color: #2c3545; background: var(--panel-2); }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.provider-name {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.service-card h3 {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 500;
}

.service-card p {
  margin: 0;
  font-size: 12.5px;
  color: var(--fg-dim);
}

.spark {
  display: grid;
  gap: 2px;
  height: 20px;
}
.spark .cell { height: 100%; border-radius: 1px; }

.spark-caption {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-faint);
}

.component-list,
.dependency-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.component-list span,
.dependency-list span {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}

.dependency-list span {
  color: var(--fg-faint);
  border-style: dashed;
}

/* ---------- Status pills ---------- */

.pill {
  flex: none;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.pill.operational { color: var(--t-op); background: rgba(63, 185, 80, 0.1); border-color: rgba(63, 185, 80, 0.28); }
.pill.watch { color: var(--t-watch); background: rgba(88, 166, 255, 0.1); border-color: rgba(88, 166, 255, 0.28); }
.pill.maintenance { color: var(--t-maint); background: rgba(163, 113, 247, 0.1); border-color: rgba(163, 113, 247, 0.28); }
.pill.degraded { color: var(--t-degraded); background: rgba(210, 153, 34, 0.1); border-color: rgba(210, 153, 34, 0.3); }
.pill.partial_outage { color: var(--t-partial); background: rgba(240, 136, 62, 0.1); border-color: rgba(240, 136, 62, 0.3); }
.pill.major_outage { color: var(--t-major); background: rgba(248, 81, 73, 0.1); border-color: rgba(248, 81, 73, 0.3); }
.pill.unknown { color: var(--fg-faint); background: rgba(139, 149, 168, 0.08); border-color: var(--line); }

/* ---------- Incidents + insights ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-left: 1px solid var(--line);
  padding-left: 18px;
  margin-left: 5px;
}

.incident-item {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 14px 16px;
}

.incident-item::before {
  content: "";
  position: absolute;
  left: -23px;
  top: 20px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-faint);
  outline: 3px solid var(--bg);
}

.incident-item.is-active::before { background: var(--t-major); }

.incident-item h3 { margin: 0; font-size: 14px; font-weight: 500; }

.incident-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
  font-family: var(--mono);
  font-size: 10.5px;
}

.incident-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--fg-dim);
}

.incident-item p { margin: 0 0 8px; font-size: 12.5px; color: var(--fg-dim); }
.incident-item p strong { color: var(--fg); font-weight: 600; }
.incident-item a { font-family: var(--mono); font-size: 11.5px; }

.insight-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 16px 18px;
}

.insight-panel h2 {
  margin: 4px 0 12px;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
}

.insight {
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
}
.insight:first-of-type { border-top: 0; padding-top: 0; }

.insight strong { display: block; font-size: 13px; font-weight: 500; }
.insight p { margin: 4px 0 0; font-size: 12.5px; color: var(--fg-dim); }

/* ---------- Diagnose ---------- */

.diagnose {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--panel), #0e1219);
  padding: 20px 22px;
}

.diagnose > div > p {
  margin: 8px 0 0;
  max-width: 62ch;
  color: var(--fg-dim);
  font-size: 13px;
}

.diagnose h2 {
  margin: 4px 0 0;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.diagnose-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  align-items: end;
  margin: 18px 0 0;
}

.diagnose-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.diagnose-form select {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--fg);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  text-transform: none;
  letter-spacing: 0;
}

.diagnose-form button {
  font-family: var(--mono);
  font-size: 12.5px;
  color: #06110a;
  background: var(--t-op);
  border: 0;
  border-radius: 7px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}
.diagnose-form button:hover { filter: brightness(1.12); }

.diagnose-result {
  display: block;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--t-watch);
  border-radius: 8px;
  background: rgba(31, 111, 235, 0.07);
  font-size: 13px;
  color: var(--fg-dim);
}

.diagnose-result strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  color: var(--fg);
  font-weight: 600;
}

/* ---------- Footer + tooltip ---------- */

footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px var(--gut) 40px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-faint);
}

#tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -128%);
  background: #1b2130;
  border: 1px solid #2c3545;
  border-radius: 7px;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--fg);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  transition: opacity 0.1s;
}

#tip.on { opacity: 1; }
#tip u { display: block; text-decoration: none; color: var(--fg-faint); }

noscript {
  display: block;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px var(--gut);
  color: var(--t-degraded);
  font-size: 13px;
}

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