/* Timestamp object — execution explorer.
   Light theme only. Chart marks use the two leading categorical slots
   (blue #2a78d6, orange #eb6834), validated for CVD separation and
   contrast against the #ffffff card surface. */

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

:root {
  color-scheme: light;

  /* chrome */
  --bg: #f7f7f8;
  --surface: #ffffff;
  --fg: #1c1c1e;
  --fg-muted: #6a6a70;
  --border: #e3e3e6;
  --border-strong: #cfcfd4;
  --accent: #2b5cc4;
  --accent-soft: #eaf1fe;
  --radius: 10px;

  /* chart ink */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --muted-ink: #898781;
  --band: rgba(42, 120, 214, 0.08);
  --faint: rgba(28, 28, 30, 0.16);

  /* status */
  --good: #0ca30c;
  --critical: #d03b3b;

  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ---------- masthead ---------- */
.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.brand {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.tagline {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--fg-muted);
  max-width: 78ch;
}

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  margin-bottom: 16px;
}
.panel-title {
  margin: 0 0 2px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}
.panel-note {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--fg-muted);
}
.panel-note code,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
}

/* ---------- controls ---------- */
.ctl-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}
.ctl {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ctl > span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
}
.ctl input,
.ctl select {
  font-family: inherit;
  font-size: 14px;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 9px;
}
.ctl input[type="number"] {
  width: 92px;
}
.ctl input:focus,
.ctl select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43, 92, 196, 0.18);
}
.ctl-view {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  padding-left: 18px;
  border-left: 1px solid var(--border);
}

.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}
.btn:hover {
  background: var(--bg);
  border-color: var(--fg-muted);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent);
  filter: brightness(1.08);
  border-color: var(--accent);
}
.btn-sm {
  font-size: 12px;
  padding: 5px 10px;
}

.hint {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--fg-muted);
}

/* ---------- stat tiles ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.tile .k {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}
.tile .v {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-top: 2px;
}
.tile .sub {
  font-size: 12px;
  color: var(--fg-muted);
}
.tile.ok .v {
  color: var(--good);
}
.tile.bad .v {
  color: var(--critical);
}

/* ---------- charts ---------- */
.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--fg-muted);
}
.legend .item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.swatch {
  width: 12px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}
.swatch.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.sw-1 {
  background: var(--series-1);
}
.sw-2 {
  background: var(--series-2);
}
.sw-band {
  background: var(--band);
  height: 10px;
  width: 14px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
}
.sw-faint {
  background: var(--faint);
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.grid line {
  stroke: var(--grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}
.axis path,
.axis line {
  stroke: var(--axis);
  shape-rendering: crispEdges;
}
.axis text {
  fill: var(--muted-ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.axis-label {
  fill: var(--fg-muted);
  font-size: 11.5px;
}
.line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.s-1 {
  stroke: var(--series-1);
}
.s-2 {
  stroke: var(--series-2);
}
.dot-1 {
  fill: var(--series-1);
  stroke: var(--surface);
  stroke-width: 2;
}
.dot-2 {
  fill: var(--series-2);
  stroke: var(--surface);
  stroke-width: 2;
}
.band {
  fill: var(--band);
}
.crosshair {
  stroke: var(--fg-muted);
  stroke-width: 1;
  opacity: 0.55;
}
.pin {
  fill: var(--accent);
  opacity: 0.22;
}
.endlabel {
  font-size: 11.5px;
  font-weight: 600;
  fill: var(--fg);
}

.tooltip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  padding: 9px 11px;
  font-size: 12.5px;
  line-height: 1.5;
  max-width: 330px;
  opacity: 0;
  transition: opacity 0.08s;
}
.tooltip .tt-h {
  font-weight: 650;
  margin-bottom: 3px;
}
.tooltip .tt-r {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-variant-numeric: tabular-nums;
}
.tooltip .tt-r span:first-child {
  color: var(--fg-muted);
}

/* ---------- space-time diagram ---------- */
.st-wrap {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.scroller {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.scroller svg {
  display: block;
}
.lane {
  stroke: var(--grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}
.lane-label {
  fill: var(--fg-muted);
  font-size: 11.5px;
  font-weight: 600;
}
.msg {
  stroke: var(--faint);
  stroke-width: 1;
  fill: none;
}
.msg.req {
  stroke: var(--series-1);
  stroke-width: 1.75;
}
.msg.reply {
  stroke: var(--series-2);
  stroke-width: 1.75;
}
.msg.dropped {
  stroke: var(--muted-ink);
  stroke-width: 1.25;
  opacity: 0.55;
}
.ev-invoke {
  fill: var(--series-1);
}
.ev-return {
  fill: var(--surface);
  stroke: var(--series-1);
  stroke-width: 2;
}
.ev-other {
  fill: var(--faint);
}
.ev-label {
  font-size: 11px;
  font-weight: 600;
  fill: var(--fg);
  font-variant-numeric: tabular-nums;
}

/* ---------- trace ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 10px;
}
.toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--fg);
  cursor: pointer;
}
.toolbar input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}
.toolbar input[type="search"],
.toolbar input[type="text"] {
  font-family: inherit;
  font-size: 13px;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 9px;
  min-width: 190px;
}
.spacer {
  flex: 1;
}

.trace {
  position: relative;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.65;
  padding: 8px 0;
}
.trace .row {
  padding: 0 12px;
  white-space: pre;
  cursor: pointer;
}
.trace .row:hover {
  background: var(--accent-soft);
}
.trace .row.sel {
  background: var(--accent-soft);
}
.trace .row.dim {
  color: var(--fg-muted);
}
.trace .row.ret {
  font-weight: 650;
}
.trace .tm {
  color: var(--muted-ink);
}
.trace .op {
  color: var(--accent);
  font-weight: 600;
}
.trace .hl {
  color: var(--series-2);
  font-weight: 600;
}

/* ---------- table ---------- */
.tablewrap {
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
  text-align: right;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  white-space: nowrap;
}
thead th:first-child,
tbody td:first-child {
  text-align: left;
}
tbody td {
  padding: 5px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr:hover {
  background: var(--bg);
}
tbody tr.sel {
  background: var(--accent-soft);
}
tbody tr {
  cursor: pointer;
}

details.card > summary {
  cursor: pointer;
  list-style: none;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}
details.card > summary::-webkit-details-marker {
  display: none;
}
details.card > summary::before {
  content: "▸ ";
}
details.card[open] > summary::before {
  content: "▾ ";
}
details.card[open] > summary {
  margin-bottom: 12px;
}

.problems {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--critical);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--fg);
}
.problems ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.footnote {
  font-size: 12.5px;
  color: var(--fg-muted);
  margin: 0;
}
.footnote code {
  color: var(--fg);
}
