/*
 * Components. Pill everything; cards 28px, inner tiles 10-12px, dark card 24px.
 * No boxes inside boxes: content sits directly on the card.
 */

/* ---------- Icons (inline lucide paths, see js/icons.js) ---------- */
[data-icon] {
  display: inline-grid;
  place-items: center;
  flex: none;
}

[data-icon] svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

/* ---------- Card ---------- */
.card {
  position: relative;
  min-width: 0;
  padding: var(--card-pad);
  border-radius: var(--r-card);
  background: var(--card-fill);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

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

.card-head .t-caption {
  margin-top: 4px;
  max-width: 60ch;
}

.card-head .t-card-title .t-metric-md {
  margin-left: 6px;
  vertical-align: -2px;
}

code {
  font-size: 0.92em;
}

/* ---------- Buttons ---------- */
.round-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink-08);
  background: var(--white);
  color: var(--ink);
  transition: transform 0.15s ease;
}

.round-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.round-btn [data-icon] svg {
  width: 15px;
  height: 15px;
}

.round-btn-dark {
  border: none;
  background: var(--ink);
  color: var(--white);
}

.round-btn-dark [data-icon] svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.round-btn-sm {
  width: 32px;
  height: 32px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink-08);
  background: var(--white);
  font-size: 13px;
  white-space: nowrap;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.pill-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.pill-btn:disabled {
  opacity: 0.7;
}

.pill-btn-dark {
  border: none;
  background: var(--ink);
  color: var(--white);
}

.pill-btn-dark [data-icon] svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  font-size: 12px;
  color: var(--ink-70);
}

.text-btn:hover {
  background: var(--white);
  color: var(--ink);
}

.text-btn [data-icon] svg {
  width: 13px;
  height: 13px;
}

.outline-pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink-40);
  font-size: 11.5px;
  white-space: nowrap;
}

/* ---------- Brand pill ---------- */
.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 20px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink-30);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

/* Official nostavia wordmark, drawn as a mask so it takes the ink colour. */
.brand-logo {
  display: block;
  flex: none;
  height: 18px;
  aspect-ratio: 1106 / 199;
  background: currentColor;
  -webkit-mask: url("/static/img/nostavia-wordmark.png") center / contain no-repeat;
  mask: url("/static/img/nostavia-wordmark.png") center / contain no-repeat;
}

.brand-product {
  padding-left: 12px;
  border-left: 1px solid var(--ink-20);
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-60);
}

/* ---------- Nav group (also the signal selector) ---------- */
.nav-group,
.signal-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border-radius: var(--r-pill);
  background: var(--chrome-fill);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-group::-webkit-scrollbar,
.signal-group::-webkit-scrollbar {
  display: none;
}

.nav-item,
.signal-pill {
  flex: none;
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-80);
  font-size: 13px;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover,
.signal-pill:hover {
  background: rgba(255, 255, 255, 0.7);
}

.nav-item[aria-current="page"],
.signal-pill[aria-selected="true"] {
  background: var(--ink);
  color: var(--white);
}

.signal-pill {
  height: 30px;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.panel-card > .signal-group {
  align-self: flex-start;
  margin-top: 14px;
}

/* ---------- Header chrome ---------- */
.chrome-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 16px;
  border: none;
  border-radius: var(--r-pill);
  background: var(--chrome-fill);
  font-size: 13px;
  white-space: nowrap;
}

.chrome-btn [data-icon] svg {
  stroke-width: 1.7;
}

.chrome-btn[data-state="ok"] [data-icon] {
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--hi);
}

.chrome-btn[data-state="ok"] [data-icon] svg {
  width: 13px;
  height: 13px;
}

.chrome-btn[data-state="fail"] {
  background: var(--ink);
  color: var(--white);
}

.avatar-chip {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: var(--chrome-fill);
}

.avatar-initials {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: var(--r-pill);
  background: #E9D8C4;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---------- Controls rail ---------- */
.rail-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.rail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.step-num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--white);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.scenario-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
}

.scenario-opt {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0 10px;
  width: 100%;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  text-align: left;
  transition: background-color 0.15s ease;
}

.scenario-opt:hover {
  background: rgba(255, 255, 255, 0.7);
}

.scenario-opt[aria-checked="true"] {
  background: var(--ink);
  color: var(--white);
}

.scenario-opt-title {
  font-size: 13px;
  line-height: 1.25;
}

.scenario-opt-sub {
  grid-column: 1 / -1;
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink-55);
}

.scenario-opt[aria-checked="false"] .scenario-opt-sub {
  display: none;
}

.scenario-opt[aria-checked="true"] .scenario-opt-sub {
  margin-top: 2px;
  color: var(--on-dark-55);
}

.scenario-opt-num {
  font-size: 10.5px;
  color: var(--ink-50);
  font-variant-numeric: tabular-nums;
}

.scenario-opt[aria-checked="true"] .scenario-opt-num {
  color: var(--hi);
}

/* ---------- Knobs ---------- */
.knobs {
  margin-top: 14px;
}

.knob-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.knob[data-changed="true"] .knob-head label::after,
.knob[data-changed="true"] .knob-name::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: var(--r-pill);
  background: var(--hi);
  box-shadow: 0 0 0 1px var(--ink-30);
  vertical-align: 2px;
}

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

.knob-head label,
.knob-head .knob-name {
  font-size: 12.5px;
  color: var(--ink-70);
}

.knob-value {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.knob-hint {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink-55);
}

input[type="range"] {
  --fill: 50%;
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--r-pill);
  background: linear-gradient(to right, var(--ink) var(--fill), var(--ink-12) var(--fill));
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: var(--r-pill);
  background: linear-gradient(to right, var(--ink) var(--fill), var(--ink-12) var(--fill));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: var(--r-pill);
  background: var(--white);
  border: 1px solid var(--ink-14);
  box-shadow: 0 4px 10px -4px rgba(var(--ink-rgb), 0.45);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: var(--r-pill);
  background: var(--white);
  border: 1px solid var(--ink-14);
  box-shadow: 0 4px 10px -4px rgba(var(--ink-rgb), 0.45);
}

.choice-group {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: var(--chrome-fill);
  max-width: 100%;
}

.choice-group label {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  color: var(--ink-80);
  white-space: nowrap;
  cursor: pointer;
}

.choice-group input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-group label:has(input:checked) {
  background: var(--ink);
  color: var(--white);
}

.choice-group label:has(input:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 12.5px;
  color: var(--ink-70);
  cursor: pointer;
}

.switch-inline {
  flex: none;
  gap: 8px;
}

.switch input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  margin: 0;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink-40);
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: var(--r-pill);
  background: var(--ink-45);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.switch input:checked {
  border-color: var(--ink);
  background: var(--ink);
}

.switch input:checked::after {
  transform: translateX(16px);
  background: var(--hi);
}

/* ---------- Scene head ---------- */
.scene-title {
  margin-top: 6px;
  font-family: var(--font-serif);
  font-size: 36px;
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.scene-title em {
  font-style: italic;
}

.scene-sub {
  margin-top: 8px;
  max-width: 80ch;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-70);
}

/* ---------- KPI stat ---------- */
.kpi {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.kpi-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi-chip {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-pill);
  background: var(--chip-fill);
}

.kpi-chip.is-hi {
  background: var(--hi);
}

.kpi-chip [data-icon] svg {
  width: 12px;
  height: 12px;
}

.kpi-label {
  font-size: 11.5px;
  color: var(--ink-60);
  white-space: nowrap;
}

.kpi .t-kpi {
  font-size: 42px;
}

.kpi-unit {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-55);
  margin-left: 4px;
}

.kpi-delta {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-55);
  line-height: 1;
  white-space: nowrap;
}

/* ---------- Segmented progress (four data states) ---------- */
.segmented {
  display: flex;
  gap: 6px;
  width: 100%;
}

.segment {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.segment-label {
  margin-bottom: 6px;
  font-size: 11.5px;
  color: var(--ink-70);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.segment-bar {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}

.fill-dark {
  background: var(--ink);
  color: var(--white);
}

.fill-hi {
  background: var(--hi);
  color: var(--ink);
}

.fill-hatch {
  background: var(--hatch);
  color: var(--ink-60);
}

.fill-outline {
  background: transparent;
  border: 1px solid var(--ink-40);
  color: var(--ink);
}

.fill-grey {
  background: var(--ink-45);
  color: var(--white);
}

/* ---------- Chart ---------- */
.chart-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px 20px;
}

.chart-head-text .t-caption {
  margin-top: 4px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-top: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 10px 0 8px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: transparent;
  font-size: 11.5px;
  color: var(--ink-70);
}

button.legend-item:hover {
  background: rgba(255, 255, 255, 0.7);
}

.legend-item[aria-pressed="false"] {
  border-color: var(--ink-14);
  border-style: dashed;
  color: var(--ink-40);
}

.legend-item[aria-pressed="false"] svg {
  opacity: 0.35;
}

.legend-item svg {
  flex: none;
}

.chart-wrap {
  position: relative;
  margin-top: 6px;
}

.chart-svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  font-family: var(--font-sans);
}

.chart-svg .axis-label {
  font-size: 11px;
  fill: var(--ink-55);
  font-variant-numeric: tabular-nums;
}

.chart-svg .hit {
  fill: transparent;
  cursor: crosshair;
}

.chart-tip {
  position: absolute;
  z-index: 5;
  min-width: 200px;
  max-width: 300px;
  padding: 10px 12px;
  border-radius: var(--r-tile);
  background: var(--ink);
  color: var(--white);
  font-size: 11.5px;
  box-shadow: var(--shadow-dark);
  pointer-events: none;
}

.chart-tip-date {
  margin-bottom: 6px;
  font-size: 10.5px;
  color: var(--on-dark-55);
}

.chart-tip-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 0;
}

.chart-tip-row span:first-child {
  width: 10px;
  color: var(--on-dark-55);
}

.chart-tip-row span:nth-child(2) {
  flex: 1;
  color: var(--on-dark-70);
}

.chart-tip-row strong {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chart-tip-flags {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--on-dark-55);
  overflow-wrap: anywhere;
}

.chart-empty {
  display: grid;
  place-items: center;
  height: 100%;
  text-align: center;
}

.chart-cat {
  position: absolute;
  inset: 0;
  overflow: auto;
}

.chart-foot {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--ink-14);
}

.chart-foot-label {
  flex: none;
  width: 90px;
  padding-bottom: 6px;
  line-height: 1.3;
}

/* ---------- Chips ---------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-row-flat {
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink-40);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: nowrap;
}

.chip strong {
  font-family: var(--font-sans);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.chip-hatch {
  border-color: transparent;
  background: var(--hatch);
}

.chip-hi {
  border-color: transparent;
  background: var(--hi);
}

button.chip {
  cursor: pointer;
}

button.chip:hover {
  background: var(--white);
}

/* ---------- Guided demo ---------- */
.guide-score {
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--hi);
  font-size: 12px;
}

.guide-score:empty {
  display: none;
}

.guide-lede {
  margin-top: 2px;
}

.guide-sub {
  margin: 16px 0 8px;
  padding-top: 14px;
  border-top: 1px dashed var(--ink-14);
  font-size: 12.5px;
  color: var(--ink-70);
}

.checks,
.experiments {
  margin: 0;
  padding: 0;
  list-style: none;
}

.checks {
  margin-top: 10px;
}

.check {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  padding: 6px 0;
}

.check-mark {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink-30);
}

.check-mark [data-icon] svg {
  width: 11px;
  height: 11px;
  stroke-width: 3;
}

.check[data-state="pass"] .check-mark {
  border-color: transparent;
  background: var(--hi);
}

.check[data-state="fail"] .check-mark {
  border-color: transparent;
  background: var(--hatch);
}

.check-text {
  font-size: 12.5px;
  line-height: 1.35;
}

.check-evidence {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--ink-55);
}

.experiment {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  padding: 8px 0;
}

.experiment + .experiment {
  border-top: 1px dashed var(--ink-14);
}

.experiment-title {
  font-size: 12.5px;
  line-height: 1.3;
}

.experiment-note {
  grid-column: 1;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-55);
}

.experiment .round-btn {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.experiment[data-active="true"] .experiment-title::before {
  content: "Running now";
  display: inline-block;
  margin-right: 8px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--white);
  font-size: 10px;
  vertical-align: 1px;
}

/* ---------- Merge outcome ---------- */
.stackbar {
  display: flex;
  gap: 3px;
  height: 14px;
  margin-top: 14px;
  border-radius: var(--r-pill);
  overflow: hidden;
}

.stackbar span {
  min-width: 4px;
}

.stack-legend {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.stack-legend li {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 12px;
}

.stack-legend .sw {
  width: 10px;
  height: 10px;
  border-radius: var(--r-pill);
}

.stack-legend .lbl {
  font-family: var(--font-mono);
  font-size: 11px;
}

.stack-legend .n {
  font-variant-numeric: tabular-nums;
}

.stack-legend .pct {
  width: 38px;
  text-align: right;
  color: var(--ink-55);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Dark card (events) ---------- */
.dark-card {
  position: relative;
  padding: 16px 20px 12px;
  border-radius: var(--r-dark-card);
  background: var(--ink);
  color: var(--on-dark);
}

.dark-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.dark-meta {
  margin-top: 4px;
  color: var(--on-dark-40);
}

.dark-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.dark-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}

.dark-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  background: var(--on-dark-08);
  color: var(--white);
}

.dark-icon.is-open {
  background: var(--white);
  color: var(--ink);
}

.dark-icon [data-icon] svg {
  width: 14px;
  height: 14px;
}

.dark-row-text {
  flex: 1;
  min-width: 0;
}

.dark-row-title {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dark-row.is-done .dark-row-title {
  color: var(--on-dark-45);
}

.dark-row-meta {
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--on-dark-40);
}

.badge-check {
  display: grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: var(--r-pill);
  background: var(--hi);
  color: var(--ink);
}

.badge-check [data-icon] svg {
  width: 11px;
  height: 11px;
  stroke-width: 3;
}

.badge-flag {
  flex: none;
  min-width: 22px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--hi);
  color: var(--ink);
  font-size: 10.5px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.badge-dot {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: var(--r-pill);
  background: var(--on-dark-25);
}

.dark-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 0;
  border: none;
  background: transparent;
  color: var(--on-dark-70);
  font-size: 11.5px;
}

.dark-link [data-icon] svg {
  width: 13px;
  height: 13px;
}

.dark-link:hover {
  color: var(--white);
}

/* ---------- Records table ---------- */
.records-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.table-scroll {
  margin-top: 14px;
  overflow: auto;
}

.records {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.records th,
.records td {
  padding: 9px 12px 9px 0;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px dashed var(--ink-14);
  white-space: nowrap;
}

.records thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: 4px;
  background: rgba(247, 245, 240, 0.96);
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-55);
}

.records tbody th {
  font-weight: 400;
}

.records .num-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.records tbody tr:last-child > * {
  border-bottom: none;
}

.records tbody tr:hover {
  background: rgba(255, 255, 255, 0.55);
}

.records .is-merged .series-cell::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: var(--r-pill);
  background: var(--ink);
  vertical-align: 1px;
}

.records .is-device {
  color: var(--ink-70);
}

.records .muted {
  color: var(--ink-55);
}

.records .chip-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  white-space: normal;
  min-width: 340px;
}

.rev-tag {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--hi);
  font-size: 10px;
}

/* ---------- Event stream ---------- */
.event-stream {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.event-row {
  display: grid;
  grid-template-columns: 56px minmax(160px, 220px) 1fr;
  gap: 4px 16px;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px dashed var(--ink-14);
}

.event-row:last-child {
  border-bottom: none;
}

.event-seq {
  font-size: 11px;
  color: var(--ink-55);
  font-variant-numeric: tabular-nums;
}

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

.event-dates {
  font-size: 11.5px;
  color: var(--ink-70);
}

.event-detail {
  grid-column: 2 / -1;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-55);
  overflow-wrap: anywhere;
}

/* ---------- Run log ---------- */
.dark-card-lg {
  padding: 22px 24px;
  border-radius: var(--r-card);
}

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

.log-step {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 4px 12px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.log-step-num {
  font-size: 11px;
  color: var(--on-dark-40);
  font-variant-numeric: tabular-nums;
}

.log-step-name {
  font-size: 13px;
}

.log-step-exit {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--hi);
  color: var(--ink);
}

.log-step-exit.is-bad {
  background: var(--white);
}

.log-step-cmd {
  grid-column: 2 / -1;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--on-dark-55);
  overflow-wrap: anywhere;
}

.log-verify-title {
  margin-top: 18px;
}

.verify-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px 20px;
  margin: 10px 0 0;
}

.verify-grid div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
  font-size: 12px;
}

.verify-grid dt {
  color: var(--on-dark-55);
  font-family: var(--font-mono);
  font-size: 11px;
}

.verify-grid dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.log-build {
  margin-top: 16px;
}

/* ---------- Explain dialog ---------- */
.explain {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  padding: 0;
  border: none;
  border-radius: var(--r-frame);
  color: var(--ink);
  background:
    radial-gradient(70% 85% at 100% 100%, var(--wash) 0%, transparent 70%),
    linear-gradient(135deg, var(--neutral-a) 0%, var(--neutral-b) 60%);
  box-shadow: var(--shadow-dialog);
  overflow: hidden;
}

.explain[open] {
  display: flex;
  flex-direction: column;
}

.explain::backdrop {
  background: rgba(var(--ink-rgb), 0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.explain-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 26px 16px;
}

.explain-head .t-card-title {
  margin-top: 4px;
}

.explain-head .t-micro {
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.explain-body {
  padding: 0 26px 26px;
  overflow-y: auto;
}

.explain-summary {
  padding: 14px 18px;
  border-radius: var(--r-tile);
  background: var(--hi);
  font-size: 13.5px;
  line-height: 1.4;
}

.explain-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 12px;
}

.explain-path .chip {
  height: 26px;
}

.explain-path .arrow {
  color: var(--ink-40);
}

.explain-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--ink-14);
}

.explain-section h3 {
  margin-bottom: 10px;
  font-size: 14px;
}

.explain-raw-id {
  margin: 10px 0 6px;
  font-size: 11px;
  color: var(--ink-60);
  overflow-wrap: anywhere;
}

.code {
  margin: 0;
  padding: 14px 16px;
  max-height: 320px;
  overflow: auto;
  border-radius: 16px;
  background: var(--ink);
  color: var(--on-dark-70);
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--white);
  font-size: 12.5px;
  box-shadow: var(--shadow-dark);
}
