:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-hover: #f3f4f6;
  --border: #e5e7eb;
  --border-strong: #cfd3da;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-text: #3730a3;
  --accent-ring: rgba(79, 70, 229, 0.25);
  --on-accent: #ffffff;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --success-text: #166534;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fee2e2;
  --danger-text: #991b1b;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --warning-text: #92400e;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --info-text: #1e40af;
  --neutral-soft: #eef0f3;
  --neutral-text: #374151;
  --chart-ok: #4f46e5;
  --chart-fail: #dc2626;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, 0.18);
  --radius: 10px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1c2029;
  --surface-hover: #1f2330;
  --border: #262b36;
  --border-strong: #363c4a;
  --text: #e7e9ee;
  --text-2: #b4bac6;
  --muted: #8b93a3;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(129, 140, 248, 0.14);
  --accent-text: #c7d2fe;
  --accent-ring: rgba(129, 140, 248, 0.35);
  --on-accent: #0f1115;
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.14);
  --success-text: #86efac;
  --danger: #f87171;
  --danger-hover: #fca5a5;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --danger-text: #fca5a5;
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --warning-text: #fcd34d;
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.14);
  --info-text: #93c5fd;
  --neutral-soft: #232835;
  --neutral-text: #c3c9d4;
  --chart-ok: #818cf8;
  --chart-fail: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1c2029;
    --surface-hover: #1f2330;
    --border: #262b36;
    --border-strong: #363c4a;
    --text: #e7e9ee;
    --text-2: #b4bac6;
    --muted: #8b93a3;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: rgba(129, 140, 248, 0.14);
    --accent-text: #c7d2fe;
    --accent-ring: rgba(129, 140, 248, 0.35);
    --on-accent: #0f1115;
    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, 0.14);
    --success-text: #86efac;
    --danger: #f87171;
    --danger-hover: #fca5a5;
    --danger-soft: rgba(248, 113, 113, 0.14);
    --danger-text: #fca5a5;
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.14);
    --warning-text: #fcd34d;
    --info: #60a5fa;
    --info-soft: rgba(96, 165, 250, 0.14);
    --info-text: #93c5fd;
    --neutral-soft: #232835;
    --neutral-text: #c3c9d4;
    --chart-ok: #818cf8;
    --chart-fail: #f87171;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  overflow-x: clip;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- layout */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 0 24px; height: 58px; display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: var(--text); margin-right: 14px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: 0 0 auto; }
.brand-mark svg { width: 18px; height: 18px; }
.nav { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; white-space: nowrap;
}
.nav a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav a svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: 0.85; }
.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: 0 0 auto; }
.main { flex: 1 1 auto; min-width: 0; padding: 28px 24px 40px; }
.main-inner { max-width: 1180px; margin: 0 auto; }
.info-wrap { position: relative; }
.info-pop {
  position: absolute; top: calc(100% + 8px); right: 0; width: 250px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 10px 14px; font-size: 13px; animation: rise 0.14s ease-out;
}
.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.info-row + .info-row { border-top: 1px solid var(--border); }
.info-row span { color: var(--muted); white-space: nowrap; }
.info-row b { font-weight: 500; text-align: right; min-width: 0; }
.icon-btn.active { background: var(--accent-soft); color: var(--accent-text); }

@media (max-width: 880px) {
  .topbar-inner { padding: 0 12px; height: 54px; }
  .brand { margin-right: 6px; min-width: 40px; min-height: 40px; justify-content: center; }
  .topbar-actions .btn { min-width: 40px; justify-content: center; }
  .brand-text { display: none; }
  .main { padding: 18px 16px 32px; }
}
@media (max-width: 520px) {
  .nav a { padding: 8px 9px; }
  .nav a .nav-label { display: none; }
  .nav a svg { width: 19px; height: 19px; opacity: 1; }
  .hide-narrow { display: none; }
}

.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

/* ---------------------------------------------------------------- page header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.page-head .subtitle { color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.breadcrumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.breadcrumb svg { width: 14px; height: 14px; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 > * { min-width: 0; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- stat tiles */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpis > * { min-width: 0; }
@media (max-width: 880px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.kpi .label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; }
.kpi .sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* --------------------------------------------------------------- capacity */
.cap-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 24px; margin-bottom: 18px; }
.cap-stats > * { min-width: 0; }
.cap-stats .kpi { padding: 0; }
.cap-stats .kpi .value { font-size: 22px; }
.cap-stats .kpi .sub { display: block; line-height: 1.5; }
.cap-stats .kpi .of-limit { font-size: 0.6em; color: var(--muted); font-weight: 500; }
.cap-stats .kpi .sub .dot { margin-right: 6px; vertical-align: baseline; }
@media (max-width: 880px) { .cap-stats { grid-template-columns: 1fr; } }
/* the daily chart sits under an hourly one with the same colours; say which is which */
.cap-chart-title { font-size: 13.5px; font-weight: 600; margin-bottom: 10px; }
.cap-chart-title .muted { font-weight: 400; color: var(--muted); }

/* inline "what is this?" explainer, used on the capacity stats */
.tip-wrap { position: relative; display: inline-flex; vertical-align: middle; margin-left: 5px; }
.tip-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
}
/* the dot stays small; the tap target does not */
.tip-btn::after { content: ''; position: absolute; inset: -9px; }
.tip-btn:hover, .tip-btn.active { background: var(--accent-soft); color: var(--accent-text); }
.tip-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tip-pop {
  position: absolute; top: calc(100% + 8px); left: -8px; z-index: 30;
  width: max-content; max-width: min(300px, calc(100vw - 48px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 12px 14px;
  font-size: 12.5px; font-weight: 400; line-height: 1.55; color: var(--text-2);
  text-align: left; white-space: normal; animation: rise 0.14s ease-out;
}
.tip-pop p { margin: 0; }
.tip-pop p + p { margin-top: 8px; }
.tip-pop b { color: var(--text); font-weight: 600; }
.tip-pop code { font-size: 11.5px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
/* the rightmost stat would push its popover past the card edge */
.cap-stats > :last-child .tip-pop { left: auto; right: -8px; }

/* On a phone a popover anchored to the little icon runs off the screen. Anchor
   it to the whole stat block instead, so it always spans the available width. */
@media (max-width: 880px) {
  .cap-stats .kpi, .cap-chart-title { position: relative; }
  .cap-stats .tip-wrap, .cap-chart-title .tip-wrap { position: static; }
  .cap-stats .tip-pop, .cap-stats > :last-child .tip-pop, .cap-chart-title .tip-pop {
    left: 0; right: 0; width: auto; max-width: none; top: calc(100% + 8px);
  }
}
/* the range picker must wrap under the title rather than run off the card */
.cap-head { flex-wrap: wrap; }
.cap-head .seg { margin-left: auto; }

/* ---------------------------------------------------------------- chart */
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; overflow: visible; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis-text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-label { fill: var(--text-2); font-size: 11px; font-weight: 600; font-family: var(--font); }
.chart-bar-ok { fill: var(--chart-ok); }
.chart-bar-fail { fill: var(--chart-fail); }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chart-col.hover .chart-bar-ok, .chart-col.hover .chart-bar-fail { opacity: 0.75; }
/* today is still filling up; show it as provisional so the dip is not read as a drop */
.chart-col.partial .chart-bar-ok, .chart-col.partial .chart-bar-fail { opacity: 0.45; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--text); color: var(--bg);
  padding: 8px 10px; border-radius: 6px; font-size: 12px; line-height: 1.4;
  box-shadow: var(--shadow-lg); max-width: 100%; box-sizing: border-box;
}
.chart-tip .tip-title { opacity: 0.75; margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.chart-tip .tip-row b { font-weight: 600; min-width: 24px; }
.chart-tip .key { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.legend { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--text-2); }
.legend .swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.chart-empty { padding: 36px 0; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 500; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; line-height: 1.3; transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-sm { padding: 5px 9px; font-size: 12.5px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger-text); }
.icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 6px; align-items: center; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.field label, .field .label { font-size: 13px; font-weight: 500; color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .error { font-size: 12px; color: var(--danger-text); }
.input, .select, .textarea {
  width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 13.5px; transition: border-color 0.12s, box-shadow 0.12s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 0.8; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input.mono { font-family: var(--mono); font-size: 12.5px; }
.input.invalid { border-color: var(--danger); }
.textarea { min-height: 72px; resize: vertical; }
.select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; cursor: pointer; }
.select.sm, .input.sm { padding: 6px 9px; font-size: 13px; }
.select.sm { padding-right: 28px; }
.input-group { display: flex; align-items: center; }
.input-group .prefix { padding: 8px 10px; border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--surface-2); color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.input-group .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row .field + .field { margin-top: 0; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } .form-row .field + .field { margin-top: 14px; } }
.form-error { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger-text); font-size: 13px; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start; }
.form-error svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
.form-error span { min-width: 0; overflow-wrap: anywhere; }
.headers-editor { display: flex; flex-direction: column; gap: 6px; }
.headers-editor .hrow { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; align-items: center; }

/* switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background 0.15s; flex: 0 0 auto; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 0.15s; }
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .track { opacity: 0.5; }
.switch.disabled { cursor: not-allowed; }

.checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 10px; border-radius: var(--radius-sm); }
.checkbox:hover { background: var(--surface-hover); }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; }

/* ---------------------------------------------------------------- pills & tags */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.pill svg { width: 11px; height: 11px; }
.pill-success { background: var(--success-soft); color: var(--success-text); }
.pill-danger { background: var(--danger-soft); color: var(--danger-text); }
.pill-warning { background: var(--warning-soft); color: var(--warning-text); }
.pill-info { background: var(--info-soft); color: var(--info-text); }
.pill-neutral { background: var(--neutral-soft); color: var(--neutral-text); }
.pill-accent { background: var(--accent-soft); color: var(--accent-text); }
.pill .pulse { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.method { display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.03em; padding: 1px 6px; border-radius: 4px; background: var(--neutral-soft); color: var(--neutral-text); }
.method-POST { background: var(--accent-soft); color: var(--accent-text); }
.method-GET { background: var(--success-soft); color: var(--success-text); }
.method-PUT, .method-PATCH { background: var(--warning-soft); color: var(--warning-text); }
.method-DELETE { background: var(--danger-soft); color: var(--danger-text); }
.code-pill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; padding: 3px 8px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); max-width: 100%; }
.code-pill .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-pill .icon-btn { flex: 0 0 auto; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.danger-text { color: var(--danger-text); }
.success-text { color: var(--success-text); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-hover); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .tight { width: 1%; white-space: nowrap; }
/* flexible columns: content truncates instead of widening the table past its container */
.table td.shrink { max-width: 0; }
.table .w-30 { width: 30%; min-width: 170px; }
.table .w-40 { width: 40%; min-width: 230px; }
.table td.shrink .code-pill { max-width: 100%; }
.table td.col-endpoint { min-width: 160px; }
.table.compact td, .table.compact th { padding: 8px 10px; }
.table.compact td:first-child, .table.compact th:first-child { padding-left: 14px; }
.table .row-title { font-weight: 500; color: var(--text); }
.table .row-sub { font-size: 12px; color: var(--muted); }
.table-foot { display: flex; justify-content: center; padding: 12px; border-top: 1px solid var(--border); }

/* ---------------------------------------------------------------- list rows (targets, deliveries) */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1 1 auto; min-width: 0; }
.list-row .title { font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-row .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; min-width: 0; }
.list-row .meta code { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.list-row.off .title, .list-row.off .meta { opacity: 0.6; }
.list-row .row-actions { display: flex; gap: 4px; align-items: center; flex: 0 0 auto; }

/* ---------------------------------------------------------------- key/value + code blocks */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }
.headers-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
.headers-table td { padding: 5px 0; border-bottom: 1px solid var(--border); vertical-align: top; word-break: break-all; }
.headers-table tr:last-child td { border-bottom: 0; }
.headers-table td:first-child { color: var(--text-2); padding-right: 16px; white-space: nowrap; width: 1%; }
.codeblock { position: relative; }
.codeblock pre { margin: 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: var(--mono); font-size: 12.5px; line-height: 1.55; overflow: auto; max-height: 480px; white-space: pre-wrap; word-break: break-word; }
.codeblock .code-tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { padding: 4px 10px; border: 0; background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 12px; font-weight: 500; }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.active { background: var(--accent-soft); color: var(--accent-text); }
.seg button:hover:not(.active) { background: var(--surface-hover); }
.url-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.url-box code { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

/* deliveries */
.delivery { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.delivery + .delivery { margin-top: 10px; }
.delivery-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; background: var(--surface); }
.delivery-head:hover { background: var(--surface-hover); }
.delivery-head .grow { flex: 1 1 auto; min-width: 0; }
.delivery-head .meta { min-width: 0; font-size: 12px; color: var(--muted); margin-top: 2px; }
.delivery-head .meta code { display: block; max-width: 100%; }
.delivery-head .chev { transition: transform 0.15s; color: var(--muted); }
.delivery-head .chev svg { width: 16px; height: 16px; }
.delivery.open .delivery-head .chev { transform: rotate(90deg); }
.delivery-body { padding: 14px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 14px; }
.delivery-body .codeblock pre { background: var(--surface); }
.attempts { display: flex; flex-direction: column; gap: 6px; }
.attempt { display: flex; gap: 10px; align-items: center; font-size: 12.5px; flex-wrap: wrap; }
.attempt > span:not(.n) { min-width: 0; overflow-wrap: anywhere; }
.attempt .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; background: var(--neutral-soft); color: var(--neutral-text); flex: 0 0 auto; }
.attempt.ok .n { background: var(--success-soft); color: var(--success-text); }
.attempt.bad .n { background: var(--danger-soft); color: var(--danger-text); }
.section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 8px; }

/* ---------------------------------------------------------------- filter bar */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters .select { width: auto; max-width: 220px; }
.filters .search { position: relative; flex: 1 1 200px; max-width: 320px; min-width: 160px; }
.filters .search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); }
.filters .search .input { padding-left: 30px; }
.filters .spacer { flex: 1 1 auto; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); display: inline-block; animation: pulse 1.4s ease-in-out infinite; }

/* ---------------------------------------------------------------- empty / loading */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--neutral-soft); display: grid; place-items: center; color: var(--muted); margin-bottom: 4px; }
.empty .icon svg { width: 22px; height: 22px; }
.empty h2 { color: var(--text); font-size: 15px; }
.empty .btn { margin-top: 8px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
.spinner.sm { width: 13px; height: 13px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row { padding: 28px; display: flex; justify-content: center; }
.skeleton { background: linear-gradient(90deg, var(--neutral-soft) 25%, var(--surface-hover) 50%, var(--neutral-soft) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 4px; height: 14px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.refreshing { opacity: 0.7; transition: opacity 0.2s; }
.error-box { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger-text); display: flex; gap: 10px; align-items: center; }
.error-box svg { width: 16px; height: 16px; flex: 0 0 auto; }
.error-box span, .error-box > :not(svg):not(button) { min-width: 0; overflow-wrap: anywhere; }
.banner { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--info-text); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.banner svg { width: 15px; height: 15px; flex: 0 0 auto; }
.banner span { min-width: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(9, 11, 16, 0.55); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; z-index: 100; overflow-y: auto; backdrop-filter: blur(2px); }
.modal { width: 100%; max-width: 520px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: rise 0.16s ease-out; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 4px 20px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 12px 12px; }
.modal-foot .left { margin-right: auto; }
.modal p.lead { color: var(--text-2); line-height: 1.55; }
body.modal-open { overflow: hidden; }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; pointer-events: none; }
.toast { pointer-events: auto; overflow-wrap: anywhere; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--text); color: var(--bg); font-size: 13px; box-shadow: var(--shadow-lg); animation: rise 0.18s ease-out; max-width: 360px; }
.toast svg { width: 15px; height: 15px; flex: 0 0 auto; }
.toast-success svg { color: var(--success); }
.toast-error svg { color: var(--danger); }
@media (max-width: 600px) { .toasts { left: 16px; right: 16px; bottom: 16px; } .toast { max-width: none; } }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; padding: 32px 28px 28px; }
.login-card .brand { padding: 0; margin: 0 0 20px; }
.login-card .brand-text { display: block; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .lead { color: var(--muted); margin-bottom: 20px; }
.login-card .btn { width: 100%; margin-top: 16px; padding: 9px; }

/* ---------------------------------------------------------------- misc */
.inline-list { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hr { height: 1px; background: var(--border); margin: 14px 0; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.copy-ok { color: var(--success) !important; }

/* ---------------------------------------------------------------- touch targets (small screens) */
@media (max-width: 880px) {
  .btn, .nav a, .switch, .input, .select, .seg button, .breadcrumb { min-height: 40px; }
  .nav a { min-width: 40px; justify-content: center; }
  .icon-btn { width: 40px; height: 40px; }
  .seg button { min-width: 44px; }
  .switch { min-width: 44px; }
  .checkbox { min-height: 44px; }
  .checkbox input { width: 20px; height: 20px; }
  .breadcrumb { padding: 8px 0; margin-bottom: 0; }
  .codeblock .code-tools { position: static; justify-content: flex-end; margin-bottom: 6px; }
}
@media (max-width: 600px) {
  /* delivery rows: status pills drop under the title instead of squeezing it */
  .delivery-head { flex-wrap: wrap; row-gap: 6px; }
  .delivery-head .inline-list { flex-basis: 100%; padding-left: 28px; white-space: normal; }
}
