/* jev-router live view. Dark "mission control" by default, light through prefers-color-scheme. */

:root {
  color-scheme: dark;
  --bg: #07090d;
  --panel: rgb(15 20 28 / 0.82);
  --panel-solid: #0f141c;
  --panel-2: rgb(255 255 255 / 0.028);
  --line: rgb(148 163 184 / 0.13);
  --line-strong: rgb(148 163 184 / 0.26);
  --grid: rgb(148 163 184 / 0.05);
  --ink: #e7ecf3;
  --ink-2: #b6c0cf;
  --muted: #8591a3;
  --faint: #4b5565;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --fast: #43c1ab;
  --balanced: #8aa2ff;
  --frontier: #c39bff;
  --max: #ff8fc0;
  --side: #c7c46a;
  --trusted: #e6a24f;
  --neutral: #94a3b8;
  --glow-a: rgb(99 102 241 / 0.16);
  --glow-b: rgb(236 72 153 / 0.09);
  --shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset, 0 24px 48px -28px rgb(0 0 0 / 0.9);
  --radius: 14px;
  --dur-bar: 0.75s;
  --dur-grow: 0.5s;
  --sess-s: 72%;
  --sess-l: 64%;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f3f5f9;
    --panel: rgb(255 255 255 / 0.9);
    --panel-solid: #ffffff;
    --panel-2: rgb(15 23 42 / 0.028);
    --line: rgb(15 23 42 / 0.1);
    --line-strong: rgb(15 23 42 / 0.2);
    --grid: rgb(15 23 42 / 0.045);
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #556070;
    --faint: #94a3b8;
    --ok: #15803d;
    --warn: #b45309;
    --bad: #b91c1c;
    --fast: #0b6e62;
    --balanced: #3452b8;
    --frontier: #7b3fc4;
    --max: #b0306a;
    --side: #6b6f2a;
    --trusted: #9a5b0b;
    --neutral: #64748b;
    --glow-a: rgb(99 102 241 / 0.1);
    --glow-b: rgb(236 72 153 / 0.07);
    --shadow: 0 1px 2px rgb(15 23 42 / 0.05), 0 16px 36px -24px rgb(15 23 42 / 0.28);
    --sess-s: 62%;
    --sess-l: 42%;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100vh;
  font: 14px / 1.45 var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 12% -8%, var(--glow-a), transparent 62%),
    radial-gradient(900px 520px at 108% 4%, var(--glow-b), transparent 60%), var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 85% 65% at 50% 0%, #000 30%, transparent 78%);
}

.app {
  position: relative;
  max-width: 1600px;
  margin: 0 auto;
  padding: 18px 20px 48px;
}

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

.arrow {
  color: var(--faint);
}

/* Header */

.top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px 20px;
  align-items: center;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 36px;
  height: 36px;
  flex: none;
}

.logo .l-ring {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1.5;
}

.logo .l-in {
  stroke: var(--ink-2);
}

.logo .l-a {
  stroke: var(--fast);
}

.logo .l-b {
  stroke: var(--balanced);
}

.logo .l-c {
  stroke: var(--frontier);
}

.logo .l-d {
  stroke: var(--max);
}

.logo path {
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.logo circle.l-hub {
  fill: var(--ink);
}

h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.brand-sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font: 600 12px / 1 var(--font);
  color: var(--muted);
  --c: var(--muted);
}

.pill-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
}

.pill-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--c);
  border-radius: 50%;
  opacity: 0;
}

.pill[data-state="live"] {
  --c: var(--ok);
}

.pill[data-state="reconnecting"],
.pill[data-state="closed"] {
  --c: var(--warn);
}

.pill:not([data-state="connecting"]) {
  color: var(--c);
  border-color: color-mix(in srgb, var(--c) 42%, transparent);
  background: color-mix(in srgb, var(--c) 10%, transparent);
}

.pill[data-state="live"] .pill-dot::after,
.pill[data-state="connecting"] .pill-dot::after {
  animation: beacon 1.8s ease-out infinite;
}

.meta {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  font: 12px / 1 var(--mono);
  color: var(--ink-2);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta:empty {
  display: none;
}

.tiermap {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 26px;
}

.map-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border: 1px solid color-mix(in srgb, var(--c) 36%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 9%, transparent);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.map-chip b {
  color: var(--c);
  font-weight: 650;
}

.map-chip .arrow {
  color: var(--faint);
}

.map-note {
  align-self: center;
  font-size: 12px;
  color: var(--muted);
}

/* Layout: two stacked columns on wide screens, one column in a fixed order below 1180px */

.grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 16px;
  align-items: start;
}

.col {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

@media (max-width: 1180px) {
  .grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .col {
    display: contents;
  }

  .hero {
    order: 1;
  }

  .flow {
    order: 2;
  }

  .timeline {
    order: 3;
  }

  .sessions-panel {
    order: 4;
  }

  .totals-panel {
    order: 5;
  }
}

.panel {
  position: relative;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-note {
  font: 12px var(--mono);
  color: var(--muted);
  white-space: nowrap;
}

/* Hero: the latest Jev decision */

.hero {
  --c: var(--neutral);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -40% -30% auto auto;
  width: 70%;
  aspect-ratio: 1;
  pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 22%, transparent), transparent 62%);
  transition: background 0.6s;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-cat {
  min-width: 0;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.cat-name {
  font-size: clamp(34px, 3.6vw, 50px);
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.02;
  color: var(--c);
  text-shadow: 0 0 34px color-mix(in srgb, var(--c) 42%, transparent);
  overflow-wrap: anywhere;
  transition: color 0.4s;
}

.cat-conf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  margin-top: 6px;
  font: 13px var(--mono);
  color: var(--ink-2);
}

.cat-conf .ok {
  color: var(--ok);
}

.cat-conf .why {
  color: var(--warn);
}

.hero-route {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  font-size: 13px;
}

.hero-route .model {
  font-weight: 650;
  color: var(--ink);
}

.hero-route .client {
  color: var(--ink-2);
}

.hero-reason {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 4px;
}

.hero-reason p {
  margin: 0;
  color: var(--ink-2);
  font-size: 13.5px;
}

.hero-sections {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.sub-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.sub-head span:last-child {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.bars {
  display: grid;
  gap: 7px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(78px, 104px) minmax(0, 1fr) 46px;
  gap: 10px;
  align-items: center;
  font-size: 12.5px;
  --c: var(--neutral);
}

.bar-label {
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-value {
  font: 12px var(--mono);
  color: var(--muted);
  text-align: right;
}

.bar {
  position: relative;
  height: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 50%, transparent), var(--c));
  opacity: 0.4;
  transition:
    width var(--dur-bar) cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.4s;
}

.guard .bar-fill {
  opacity: 0.9;
}

.bar-row.chosen .bar-fill {
  opacity: 1;
  box-shadow: 0 0 14px color-mix(in srgb, var(--c) 55%, transparent);
}

.bar-row.chosen .bar-label {
  color: var(--c);
  font-weight: 650;
}

.bar-row.chosen .bar-value {
  color: var(--ink);
}

.tick {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--ink);
  opacity: 0.5;
}

.bar-row.below .bar-fill {
  background: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, var(--c) 70%, transparent) 0 4px,
    color-mix(in srgb, var(--c) 35%, transparent) 4px 8px
  );
}

.guards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}

.guard .bar-row {
  grid-template-columns: minmax(0, 1fr) 46px;
}

.guard-name {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--ink-2);
}

.guard-name em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}

.guard.hot {
  --c: var(--bad);
}

.guard.hot .guard-name {
  color: var(--bad);
  font-weight: 650;
}

.jevmeta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.jevmeta div {
  display: flex;
  gap: 6px;
}

.jevmeta dt {
  color: var(--muted);
}

.jevmeta dd {
  margin: 0;
  font-family: var(--mono);
  color: var(--ink-2);
}

.classifying {
  display: none;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--balanced) 35%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--balanced) 8%, transparent);
  font-size: 13px;
  color: var(--ink-2);
}

.hero[data-state="deciding"] .classifying {
  display: flex;
}

.scan {
  flex: none;
  width: 64px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--fast), var(--balanced), var(--frontier), var(--max), transparent);
  background-size: 220% 100%;
  animation: scan 1.1s linear infinite;
}

.hero[data-state="deciding"] .cat-name {
  background: linear-gradient(90deg, var(--ink-2) 20%, var(--ink) 40%, var(--ink-2) 60%);
  background-size: 250% 100%;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  animation: shimmer 1.4s linear infinite;
}

.hero[data-state="deciding"] .bars,
.hero[data-state="deciding"] .hero-route {
  opacity: 0.45;
  transition: opacity 0.3s;
}

.hero-empty {
  display: none;
  align-items: center;
  gap: 12px;
  margin: 18px 0 6px;
  font-size: 15px;
  color: var(--ink-2);
}

.hero[data-state="empty"] .hero-empty {
  display: flex;
}

.hero[data-state="empty"] .hero-body {
  display: none;
}

.beacon {
  position: relative;
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 50%;
  background: var(--fast);
}

.beacon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--fast);
  animation: beacon 1.6s ease-out infinite;
}

.hero.flash .cat-name {
  animation: pop 0.7s cubic-bezier(0.2, 0.9, 0.2, 1.2);
}

.hero.picked::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 60%, transparent);
}

.back-live {
  margin-left: auto;
  padding: 3px 10px;
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 12%, transparent);
  color: var(--ink);
  font: 600 11.5px var(--font);
  cursor: pointer;
}

.back-live:hover {
  background: color-mix(in srgb, var(--c) 24%, transparent);
}

.back-live:focus-visible {
  outline: 2px solid var(--c);
  outline-offset: 2px;
}

.hero.flash::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 70%, transparent);
  animation: fade-out 1.2s ease-out forwards;
}

@media (min-width: 721px) and (max-width: 1180px) {
  .hero-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
  }

  .guards,
  .jevmeta {
    grid-column: 1 / -1;
  }
}

/* Chips */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border: 1px solid color-mix(in srgb, var(--c) 42%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 11%, transparent);
  font: 600 11px / 1.6 var(--font);
  color: var(--c);
  white-space: nowrap;
  --c: var(--neutral);
}

.chip.reason {
  font-family: var(--mono);
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-reason .chip {
  flex: none;
  max-width: 55%;
}

.reason[data-kind="jev"] {
  --c: var(--balanced);
}

.reason[data-kind="up"] {
  --c: var(--frontier);
}

.reason[data-kind="keep"] {
  --c: var(--ink-2);
}

.reason[data-kind="guard"] {
  --c: var(--bad);
}

.reason[data-kind="fail"] {
  --c: var(--warn);
}

.reason[data-kind="manual"] {
  --c: var(--trusted);
}

.reason[data-kind="side"] {
  --c: var(--side);
}

.reason[data-kind="loop"] {
  --c: var(--muted);
}

/* Flow graph */

.flow-wrap {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.flow-svg {
  display: block;
  max-width: none;
}

.col-label {
  font: 650 10px var(--font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  fill: var(--muted);
}

.edge {
  fill: none;
  stroke: var(--c, var(--neutral));
  stroke-opacity: 0.32;
  stroke-width: 1.2;
  transition:
    stroke-opacity 0.35s,
    stroke-width 0.35s;
}

.edge.map {
  stroke-opacity: 0.45;
}

.edge.bypass {
  stroke-dasharray: 2 5;
  opacity: 0.7;
}

.edge.lit {
  stroke-opacity: 1;
  stroke-width: 2.6;
  filter: drop-shadow(0 0 4px var(--c));
}

.edge.ghost {
  stroke-opacity: 0.9;
  stroke-width: 2;
  stroke-dasharray: 5 4;
  animation: dash 0.8s linear infinite;
}

.edge.ghost.gone {
  opacity: 0;
}

/* The focused request's route: the selected request, or the newest one while following live. */
.flow-svg.focused .edge {
  stroke-opacity: 0.1;
}

.flow-svg.focused .edge.bypass {
  opacity: 0.4;
}

.flow-svg.focused .node:not(.on-path) {
  opacity: 0.5;
}

.flowline {
  fill: none;
  stroke: var(--c);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 8 8;
  filter: drop-shadow(0 0 3px var(--c));
  pointer-events: none;
  animation: flow 1.1s linear infinite;
}

.flowline.live {
  stroke-width: 3;
  animation-duration: 0.45s;
}

.jevbox {
  fill: color-mix(in srgb, var(--balanced) 5%, transparent);
  stroke: color-mix(in srgb, var(--balanced) 30%, transparent);
  stroke-dasharray: 4 4;
}

.jevbox.thinking {
  stroke: var(--balanced);
  stroke-width: 1.5;
  animation: dash 0.9s linear infinite;
}

.jevbox-label {
  font: 650 10px var(--mono);
  fill: var(--balanced);
}

.node {
  --c: var(--neutral);
}

.node .box {
  fill: var(--panel-solid);
  stroke: var(--c);
  stroke-opacity: 0.55;
  stroke-width: 1.2;
  transition:
    stroke-opacity 0.3s,
    stroke-width 0.3s;
}

.node .flash {
  fill: var(--c);
  opacity: 0;
  pointer-events: none;
}

.node .heat {
  fill: color-mix(in srgb, var(--c) 22%, transparent);
  transform-box: fill-box;
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  transition: transform var(--dur-bar) cubic-bezier(0.2, 0.8, 0.2, 1);
}

.node .thr {
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.55;
}

.node .label {
  font: 600 12.5px var(--font);
  fill: var(--ink);
}

.node .label.small {
  font-size: 11.5px;
}

.node .sub {
  font: 11px var(--mono);
  fill: var(--muted);
}

.node .num {
  font: 600 11px var(--mono);
  fill: var(--c);
}

.node.router .box,
.node.client .box {
  stroke: var(--line-strong);
}

.node.dim {
  opacity: 0.45;
}

.node.active .box {
  stroke-opacity: 1;
  stroke-width: 2;
}

.node.active .flash {
  opacity: 0.14;
}

.node.on-path .box {
  stroke-opacity: 1;
  stroke-width: 2;
}

/* The tier Jev picked, when the router passed it over. */
.node.passed .box {
  stroke: var(--warn);
  stroke-opacity: 0.95;
  stroke-dasharray: 4 3;
}

.node.passed .sub {
  fill: var(--warn);
}

.flow-svg.focused .node.passed {
  opacity: 1;
}

.node.hit .box {
  animation: hit 0.85s ease-out;
}

.node.hit .flash {
  animation: flash 0.85s ease-out;
}

.node.busy .box {
  stroke-opacity: 1;
  filter: drop-shadow(0 0 5px var(--c));
  animation: busy 1.3s ease-in-out infinite;
}

.entry-rail {
  stroke: var(--line-strong);
  stroke-width: 3;
  stroke-linecap: round;
}

.particle {
  --c: var(--neutral);
}

.particle .halo {
  fill: var(--c);
  opacity: 0.22;
}

.particle .core {
  fill: var(--c);
}

.particle.small .halo {
  opacity: 0.14;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 11.5px;
  color: var(--muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  display: inline-block;
  border-radius: 50%;
  background: var(--balanced);
}

.legend .lg-big {
  width: 9px;
  height: 9px;
  box-shadow: 0 0 8px var(--balanced);
}

.legend .lg-small {
  width: 6px;
  height: 6px;
  opacity: 0.7;
}

/* Timeline */

.feed {
  display: grid;
  gap: 8px;
  max-height: 640px;
  margin: 0;
  padding: 0 4px 0 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
}

.group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  overflow: hidden;
  --c: var(--neutral);
}

.group.enter,
.row.enter,
.lane.enter {
  animation: enter 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.row {
  display: grid;
  grid-template-columns: 62px 82px minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 8px 12px;
  font-size: 12.5px;
  --c: var(--neutral);
}

.row.head {
  border-left: 3px solid var(--c);
  padding-left: 10px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 13%, transparent), transparent 72%);
}

.row.head.orphan {
  border-left-color: var(--line-strong);
  background: none;
}

.row[data-req] {
  cursor: pointer;
  border-radius: 6px;
  transition:
    box-shadow 0.2s,
    background-color 0.2s;
}

.row[data-req]:hover {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent);
}

.row[data-req]:focus-visible {
  outline: 2px solid var(--c);
  outline-offset: -2px;
}

.row.selected,
.row.selected:hover {
  background-color: color-mix(in srgb, var(--c) 16%, transparent);
  box-shadow:
    inset 0 0 0 2px var(--c),
    0 0 18px -6px var(--c);
}

.row .t {
  font: 11.5px var(--mono);
  color: var(--muted);
}

.sess {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 11.5px var(--mono);
  color: var(--ink-2);
}

.dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: hsl(var(--h, 210) var(--sess-s) var(--sess-l));
}

.row-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}

.kind {
  font-size: 11.5px;
  color: var(--muted);
}

.row.head .kind {
  color: var(--ink);
  font-weight: 650;
}

.cat {
  font-weight: 650;
  color: var(--c);
}

.cat small {
  margin-left: 4px;
  font: 11px var(--mono);
  color: var(--muted);
}

.row .model {
  color: var(--ink);
  font-weight: 550;
  overflow-wrap: anywhere;
}

.res {
  font: 11.5px var(--mono);
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.res .cost {
  color: var(--ink-2);
}

.res .bad {
  color: var(--bad);
}

.res .streaming {
  color: var(--c);
}

.res .streaming::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--c);
  vertical-align: middle;
  animation: blink 1s ease-in-out infinite;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps .row {
  padding: 5px 12px 5px 26px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
}

.steps .row .t {
  font-size: 11px;
}

.more {
  padding: 4px 12px 6px 26px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--muted);
}

.ghost-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px dashed color-mix(in srgb, var(--balanced) 45%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--balanced) 6%, transparent);
  font-size: 12.5px;
  color: var(--ink-2);
}

.ghost-row .scan {
  width: 44px;
}

.empty {
  margin: 6px 0 2px;
  font-size: 13px;
  color: var(--muted);
}

.empty[hidden] {
  display: none;
}

/* Sessions */

.lanes {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lane {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  --c: var(--neutral);
}

.lane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 12.5px;
}

.lane-head .client {
  color: var(--muted);
  font-size: 11.5px;
}

.lane-head .model {
  font-weight: 600;
}

.lane-head .spend {
  margin-left: auto;
  font: 12px var(--mono);
  color: var(--ink-2);
}

.stairs {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 42px;
  margin-top: 9px;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.stair {
  flex: none;
  width: 14px;
  height: var(--hgt, 30%);
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(180deg, var(--c), color-mix(in srgb, var(--c) 55%, transparent));
  transition: height var(--dur-grow);
  --c: var(--neutral);
}

.stair.new {
  animation: grow 0.6s cubic-bezier(0.2, 0.9, 0.2, 1.15);
  transform-origin: bottom;
}

.lane-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 5px;
  font: 11px var(--mono);
  color: var(--muted);
}

/* Totals */

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tile {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}

.tile .k {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.tile .v {
  margin-top: 3px;
  font: 650 20px / 1.15 var(--mono);
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile .s {
  font: 11px var(--mono);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile.good .v {
  color: var(--ok);
}

.tile.bad .v {
  color: var(--warn);
}

.tile.bump .v {
  animation: bump 0.5s ease-out;
}

.mbars {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.mbars .bar-row {
  grid-template-columns: minmax(84px, 120px) minmax(0, 1fr) 64px;
}

/* Toasts */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--c);
  border-radius: 12px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--ink-2);
  animation: toast-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  --c: var(--balanced);
}

.toast.warn {
  --c: var(--warn);
}

.toast.error {
  --c: var(--bad);
}

.toast.out {
  animation: toast-out 0.3s ease-in forwards;
}

.foot {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* Narrow screens */

@media (max-width: 720px) {
  .app {
    padding: 14px 12px 40px;
  }

  .top {
    grid-template-columns: minmax(0, 1fr);
  }

  .status {
    justify-content: flex-start;
  }

  .panel {
    padding: 14px;
  }

  .row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .row .row-main,
  .row .res {
    grid-column: 1 / -1;
  }

  .row .res {
    text-align: left;
    white-space: normal;
  }

  .guards {
    grid-template-columns: minmax(0, 1fr);
  }

  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-route {
    width: 100%;
  }
}

/* Motion */

@keyframes beacon {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

@keyframes scan {
  0% {
    background-position: 110% 0;
  }
  100% {
    background-position: -110% 0;
  }
}

@keyframes shimmer {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

@keyframes pop {
  0% {
    transform: translateY(6px) scale(0.96);
    opacity: 0.3;
    filter: blur(2px);
  }
  100% {
    transform: none;
    opacity: 1;
    filter: none;
  }
}

@keyframes fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes dash {
  to {
    stroke-dashoffset: -18;
  }
}

@keyframes flow {
  to {
    stroke-dashoffset: -32;
  }
}

@keyframes hit {
  0% {
    stroke-opacity: 1;
    stroke-width: 2.6;
  }
}

@keyframes busy {
  50% {
    stroke-width: 2.8;
    stroke-opacity: 0.6;
  }
}

@keyframes flash {
  0% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
  }
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes grow {
  from {
    transform: scaleY(0.1);
    opacity: 0.2;
  }
}

@keyframes blink {
  50% {
    opacity: 0.2;
  }
}

@keyframes bump {
  40% {
    transform: translateY(-2px);
    color: var(--ink);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-bar: 0s;
    --dur-grow: 0s;
  }

  .pill[data-state="live"] .pill-dot::after,
  .pill[data-state="connecting"] .pill-dot::after,
  .beacon::after,
  .scan,
  .hero[data-state="deciding"] .cat-name,
  .hero.flash .cat-name,
  .hero.flash::after,
  .edge.ghost,
  .flowline,
  .jevbox.thinking,
  .node.hit .box,
  .node.hit .flash,
  .node.busy .box,
  .group.enter,
  .row.enter,
  .lane.enter,
  .stair.new,
  .tile.bump .v,
  .toast,
  .toast.out,
  .res .streaming::after {
    animation: none;
  }
}
