:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #63b3ed;
  --border: #2d3a4d;
  font-family: "IBM Plex Sans", system-ui, -apple-system, Segoe UI, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 80% at 20% 0%, #1a2f45 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.6;
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 1rem;
}

.lead {
  color: var(--muted);
  margin: 0 0 2rem;
  font-size: 1.05rem;
}

code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.9em;
  background: rgba(99, 179, 237, 0.12);
  color: var(--accent);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.hint {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.metrics {
  margin: 0;
}

.metrics > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1.5rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--border);
}

.metrics > div:first-of-type {
  border-top: none;
  padding-top: 0;
}

.metrics dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.metrics dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  text-align: right;
}

.status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.status.ok {
  color: #68d391;
}

.status.warn {
  color: #f6ad55;
}

.probe-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.probe-label {
  font-size: 0.875rem;
  color: var(--muted);
}

.probe-input {
  width: 4.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.probe-btn {
  font: inherit;
  font-weight: 600;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: rgba(99, 179, 237, 0.18);
  color: var(--accent);
  cursor: pointer;
}

.probe-btn:hover:not(:disabled) {
  background: rgba(99, 179, 237, 0.28);
}

.probe-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sample-status {
  margin: 0 0 1rem;
  min-height: 1.35em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem 1.25rem;
  margin: 0 0 1.25rem;
}

@media (min-width: 30rem) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stats-grid > div {
  margin: 0;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}

.stats-grid dt {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats-grid dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.95rem;
}

.chart-wrap {
  margin-top: 0.25rem;
}

.chart-label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.legend-bar {
  width: 12px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), #4299e1);
}

.legend-avg {
  width: 14px;
  height: 0;
  border-top: 2px dashed #b794f4;
}

.chart-area {
  position: relative;
  height: 160px;
  padding: 0 2px 6px;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-left: 2px;
}

.chart-bars {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  display: flex;
  align-items: flex-end;
  justify-content: stretch;
  gap: 3px;
}

.chart-bar {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, rgba(99, 179, 237, 0.95), rgba(66, 153, 225, 0.5));
  min-height: 2px;
  transition: opacity 0.15s ease;
}

.chart-bar:hover {
  opacity: 0.85;
}

.chart-bar--fail {
  background: rgba(139, 156, 179, 0.35);
  min-height: 4px;
  flex-grow: 0.6;
}

.chart-bar--fail:hover {
  opacity: 1;
}

.chart-avg-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px dashed #b794f4;
  pointer-events: none;
  z-index: 1;
}

.chart-x-label {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.delivery-summary {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
}

.delivery-summary.defer {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
}

.delivery-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.delivery-stack li {
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(99, 179, 237, 0.1);
  color: var(--text);
}

.delivery-stack .role {
  color: var(--muted);
  font-weight: 500;
  margin-right: 0.3rem;
}

.delivery-signals > div:first-of-type {
  border-top: none;
  padding-top: 0;
}

.delivery-signals dd {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delivery-details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

.delivery-headers-raw {
  margin: 0.6rem 0 0;
  padding: 0.75rem;
  max-height: 14rem;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
}
