/* Palette + mark-spec choices follow the project's dataviz skill: fixed categorical order (only
   slot 1 "blue" is used here -- a single series never needs more), status colors reserved for
   pass/fail state, delta colors for trend deltas, thin marks (<=24px bars) with rounded data-ends
   anchored to a baseline. Light theme by default; dark follows prefers-color-scheme, same ramps
   re-stepped. */
:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --surface-2: #f4f3f0;
  --page-plane: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.09);
  --shadow: rgba(20, 20, 15, 0.06);
  --series-1: #2a78d6;
  --series-1-wash: rgba(42, 120, 214, 0.08);
  --status-good: #0ca30c;
  --status-good-wash: rgba(12, 163, 12, 0.12);
  --status-critical: #d03b3b;
  --status-critical-wash: rgba(208, 59, 59, 0.12);
  --delta-good: #006300;
  --delta-bad: #d03b3b;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --surface-2: #212120;
    --page-plane: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.09);
    --shadow: rgba(0, 0, 0, 0.35);
    --series-1: #3987e5;
    --series-1-wash: rgba(57, 135, 229, 0.12);
    --status-good: #0ca30c;
    --status-good-wash: rgba(12, 163, 12, 0.16);
    --status-critical: #e66767;
    --status-critical-wash: rgba(230, 103, 103, 0.16);
    --delta-good: #0ca30c;
    --delta-bad: #e66767;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page-plane);
  color: var(--text-primary);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--series-1); text-decoration: none; }
a:hover { text-decoration: underline; }

/* -- Header ---------------------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  position: relative;
}
.site-header::before {
  /* a single quiet touch of brand color -- not a banner, just a hairline */
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--series-1), color-mix(in srgb, var(--series-1) 40%, transparent));
}
.site-header .inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.site-header .brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.site-header .brand svg { flex: none; }
.site-header .tagline { color: var(--text-muted); font-size: 13px; }

/* -- Layout ------------------------------------------------------------------------------------ */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.breadcrumb {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--series-1); }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px var(--shadow), 0 1px 1px var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

/* -- Overview strip (list page) ----------------------------------------------------------------- */

.overview-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}
.overview-strip .stat-tile {
  background: var(--surface-1);
  padding: 18px 20px;
  margin: 0;
}

/* -- Stat tiles (shared) ------------------------------------------------------------------------ */

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.stat-tile { background: var(--surface-1); padding: 16px 18px; }
.stat-tile .label { color: var(--text-muted); font-size: 12.5px; }
.stat-tile .value { font-size: 25px; font-weight: 600; margin-top: 3px; letter-spacing: -0.01em; }
.stat-tile .value small { font-size: 13px; font-weight: 500; color: var(--text-secondary); }

/* -- Filters -------------------------------------------------------------------------------------- */

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.filters label { color: var(--text-muted); font-size: 13.5px; }
.filters select {
  font: inherit;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
}
.filters select:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }

/* -- Table ------------------------------------------------------------------------------------------ */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gridline);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }

tr.run-row { border-left: 3px solid transparent; }
tr.run-row.status-good { border-left-color: var(--status-good); }
tr.run-row.status-critical { border-left-color: var(--status-critical); }
tr.run-row:hover td { background: var(--surface-2); }
tr.run-row td:first-child { font-weight: 600; }

.run-time .relative { color: var(--text-primary); }
.run-time .absolute { display: block; color: var(--text-muted); font-size: 12px; margin-top: 1px; }

/* -- Badges ------------------------------------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.good { color: var(--status-good); background: var(--status-good-wash); }
.badge.critical { color: var(--status-critical); background: var(--status-critical-wash); }

/* -- Delta -------------------------------------------------------------------------------------------- */

.delta { font-size: 13px; font-weight: 600; }
.delta.better { color: var(--delta-good); }
.delta.worse { color: var(--delta-bad); }
.delta.flat { color: var(--text-muted); }

/* -- Latency percentile bar chart -- single series (categorical slot 1), thin marks (<=24px),
   rounded data-ends anchored to the baseline, native hover tooltip via title attr ------------------ */

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 28px;
  height: 150px;
  padding: 8px 8px 0;
  border-bottom: 2px solid var(--baseline);
}
.bar-chart .bar-col {
  flex: 1;
  max-width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.bar-chart .bar {
  width: 22px;
  min-height: 3px;
  background: var(--series-1);
  border-radius: 4px 4px 0 0;
}
.bar-chart .bar-value { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.bar-chart .bar-label { font-size: 12.5px; color: var(--text-muted); margin-top: 8px; }
.chart-caption { margin-top: 12px; color: var(--text-muted); font-size: 13px; }
.chart-caption b { color: var(--text-secondary); font-weight: 600; }

/* -- Inline magnitude bar used in the per-endpoint table --------------------------------------------- */

.mini-bar-track { background: var(--gridline); border-radius: 4px; height: 8px; width: 100%; min-width: 80px; }
.mini-bar-fill { background: var(--series-1); border-radius: 4px; height: 100%; }

/* -- Misc ------------------------------------------------------------------------------------------------- */

.pagination { display: flex; gap: 12px; margin-top: 16px; font-size: 13.5px; color: var(--text-muted); }
.empty-state { color: var(--text-muted); padding: 32px 0; text-align: center; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.icon-btn svg { flex: none; }
