/* Dexova Monitoring — dark, near-monochrome, elegant. Color only for status. */
:root {
  color-scheme: dark;
  --bg: oklch(0.17 0.015 250);
  --surface: oklch(0.21 0.012 250);
  --surface-2: oklch(0.25 0.012 250);
  --hairline: oklch(1 0 0 / 0.08);
  --text: oklch(0.96 0 0);
  --text-2: oklch(0.74 0.01 250);
  --muted: oklch(0.56 0.01 250);
  --accent: oklch(0.80 0.07 220);
  --ok: oklch(0.78 0.15 150);
  --warn: oklch(0.82 0.14 80);
  --crit: oklch(0.66 0.19 25);
  --radius: 10px;
  --gap: 16px;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.num { text-align: right; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--hairline); position: sticky; top: 0; background: oklch(0.17 0.015 250 / 0.9); backdrop-filter: blur(8px); z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 600; letter-spacing: -0.01em; }
.topbar-meta { display: flex; align-items: center; gap: 16px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 oklch(0.78 0.15 150 / 0.5); } 70% { box-shadow: 0 0 0 7px oklch(0.78 0.15 150 / 0); } 100% { box-shadow: 0 0 0 0 oklch(0.78 0.15 150 / 0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--hairline); border-radius: 8px; padding: 7px 14px; font: inherit; cursor: pointer; min-height: 36px; }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.logout { margin: 0; }

.page { max-width: 1200px; margin: 0 auto; padding: 28px 24px 64px; }
.block { margin-top: 36px; }
.block:first-child { margin-top: 8px; }
.block-head { display: flex; align-items: center; justify-content: space-between; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--gap); }
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 16px; }
.card-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-title { font-weight: 600; }
.tag { margin-left: auto; font-size: 12px; color: var(--text-2); background: var(--surface-2); padding: 2px 8px; border-radius: 6px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 0; }
.kv dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.kv dd { margin: 0; font-size: 14px; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.dot-success, .dot-health-ok, .dot-health-healthy { background: var(--ok); }
.dot-building, .dot-queued, .dot-health-warn, .dot-health-degraded { background: var(--warn); }
.dot-error, .dot-crashed, .dot-canceled, .dot-health-crit, .dot-health-critical { background: var(--crit); }

.cluster { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 14px 16px; }
.tile-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); display: block; }
.tile-value { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; margin-top: 6px; display: block; }
.tile-unit { font-size: 13px; color: var(--muted); margin-left: 3px; }
.health { color: var(--text-2); display: flex; align-items: center; gap: 8px; margin-top: 12px; }

.ranges { display: flex; flex-wrap: wrap; gap: 4px; }
.range-btn { background: var(--surface); color: var(--text-2); border: 1px solid var(--hairline); border-radius: 8px; padding: 6px 12px; font: inherit; font-family: var(--mono); cursor: pointer; min-height: 36px; min-width: 44px; }
.range-btn:hover { color: var(--text); }
.range-btn.is-active { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.range-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.chart-card { margin: 0; background: linear-gradient(180deg, oklch(0.235 0.012 250), oklch(0.205 0.012 250)); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 14px 16px; }
.chart-title { font-size: 12px; color: var(--text-2); margin: 0 0 8px; font-weight: 500; }
.chart-holder { width: 100%; height: 210px; position: relative; }
/* Horizontal-bar charts (slow endpoints / queries / N+1 / Redis cmds). Height is
   set inline per render (≈30px per bar + axis padding) so a 3-bar chart isn't a
   tall void and a 10-bar chart isn't cramped; min-height keeps the empty-state
   note centred. */
.bar-holder { width: 100%; min-height: 120px; position: relative; }
.bar-holder .empty { display: flex; align-items: center; min-height: 120px; }
/* Bar-chart tooltip body (a DOM node ECharts appends — never innerHTML-with-data,
   so a route/SQL value can't inject markup). Title = the long label, full and
   wrapped; lines = the exact metric values. */
.bar-tip { display: flex; flex-direction: column; gap: 3px; max-width: 320px; }
.bar-tip-title { color: var(--text); font-size: 12px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.bar-tip-line { color: var(--text-2); font-size: 11px; }

/* --- APM (ClickHouse) section ------------------------------------------------ */
.apm-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.apm-select-wrap { display: inline-flex; }
.apm-select { background: var(--surface); color: var(--text); border: 1px solid var(--hairline); border-radius: 8px; padding: 6px 30px 6px 12px; font: inherit; font-family: var(--mono); min-height: 36px; cursor: pointer; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: right 13px center, right 8px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.apm-select:hover { border-color: var(--muted); }
.apm-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.apm-select:disabled { opacity: 0.5; cursor: not-allowed; }
.apm .block-head { margin-bottom: 18px; }
.apm-cluster { margin-top: 4px; margin-bottom: 18px; }
.apm-charts { margin-bottom: 24px; }
.apm-slow { margin-top: 8px; }
.apm-slow .chart-title { margin-bottom: 10px; }
.apm-db { margin-top: 28px; display: flex; flex-direction: column; gap: 24px; }
.apm-db-title { margin: 0; }  /* let the .apm-db flex gap own the spacing */
.apm-db-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.apm-db-block .chart-title { margin-bottom: 10px; }
@media (max-width: 760px) { .apm-db-grid { grid-template-columns: 1fr; } }
.is-unavailable .apm-cluster, .is-unavailable .apm-charts, .is-unavailable .apm-slow, .is-unavailable .apm-db { display: none; }
.table-scroll { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--radius); }
.table-scroll .data { margin: 0; }
.table-scroll .data th, .table-scroll .data td { padding-left: 14px; padding-right: 14px; }
.table-scroll .data td:first-child { max-width: 0; min-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.tile-value { text-shadow: 0 0 18px oklch(0.80 0.07 220 / 0.16); }
.tile { background: linear-gradient(180deg, oklch(0.225 0.012 250), oklch(0.205 0.012 250)); transition: border-color 0.2s ease; }
.tile:hover { border-color: oklch(0.40 0.02 250); }
@media (prefers-reduced-motion: reduce) { .tile-value { text-shadow: none; } }

.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--hairline); }
.data th.num { text-align: right; }
.data td { padding: 9px 12px; border-bottom: 1px solid var(--hairline); }
.data tr:hover td { background: var(--surface); }

.empty { color: var(--muted); background: var(--surface); border: 1px dashed var(--hairline); border-radius: var(--radius); padding: 16px; }

.feed-status::before { content: "●"; margin-right: 6px; color: var(--muted); }
.feed { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); max-height: 360px; overflow-y: auto; }
.feed-empty { padding: 16px; }
.feed-row { display: grid; grid-template-columns: 72px 180px 1fr; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--hairline); font-size: 13px; align-items: baseline; }
.feed-row:last-child { border-bottom: none; }
.feed-time { color: var(--muted); }
.feed-src { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-msg { color: var(--text); }
.feed-warning .feed-msg { color: var(--warn); }
.feed-error .feed-msg { color: var(--crit); }

@media (max-width: 760px) {
  .page { padding: 20px 14px 48px; }
  .kv { grid-template-columns: 1fr; }
  .block-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .chart-grid { grid-template-columns: 1fr; }
  .apm-controls { width: 100%; }
  .apm-select { flex: 1; }
}

.stack { display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
.stack label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.stack input, .stack select { background: var(--surface); color: var(--text); border: 1px solid var(--hairline); border-radius: 8px; padding: 9px 12px; font: inherit; min-height: 40px; }
.stack input:focus-visible, .stack select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.discover { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.discover-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.row-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.row-actions form { margin: 0; }
.btn-ghost.danger { color: var(--crit); border-color: transparent; }
.btn-ghost.danger:hover { border-color: var(--crit); }
a.btn-ghost { text-decoration: none; display: inline-flex; align-items: center; }
a.range-btn { text-decoration: none; display: inline-flex; align-items: center; }

/* --- Auth (3D modern login) ------------------------------------------------- */
:root { --grid-line: oklch(0.82 0.10 220 / 0.20); }

.auth-body { min-height: 100dvh; margin: 0; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }

/* Decorative 3D scene: receding perspective grid + drifting aurora orbs */
.auth-scene { position: fixed; inset: 0; z-index: 0; overflow: hidden; perspective: 700px; pointer-events: none; }
.auth-grid {
  position: absolute; left: 50%; bottom: -28%; width: 260%; height: 150%;
  translate: -50% 0; transform: rotateX(76deg); transform-origin: 50% 100%;
  background:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px) 0 0 / 60px 60px,
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px) 0 0 / 60px 60px;
  -webkit-mask-image: radial-gradient(ellipse 78% 92% at 50% 100%, #000 14%, transparent 74%);
          mask-image: radial-gradient(ellipse 78% 92% at 50% 100%, #000 14%, transparent 74%);
  animation: auth-grid-scroll 9s linear infinite;
}
@keyframes auth-grid-scroll { to { background-position: 0 60px, 0 60px; } }

.auth-orb { position: absolute; border-radius: 50%; filter: blur(64px); opacity: 0.62; will-change: transform; }
.auth-orb-1 { width: 480px; height: 480px; top: -140px; left: -100px; background: radial-gradient(circle, oklch(0.80 0.12 220 / 0.62), transparent 70%); animation: auth-drift-1 19s ease-in-out infinite; }
.auth-orb-2 { width: 400px; height: 400px; bottom: -120px; right: -80px; background: radial-gradient(circle, oklch(0.78 0.16 150 / 0.48), transparent 70%); animation: auth-drift-2 23s ease-in-out infinite; }
.auth-orb-3 { width: 320px; height: 320px; top: 24%; right: 14%; background: radial-gradient(circle, oklch(0.62 0.17 290 / 0.44), transparent 70%); animation: auth-drift-3 27s ease-in-out infinite; }
@keyframes auth-drift-1 { 50% { transform: translate(60px, 44px) scale(1.1); } }
@keyframes auth-drift-2 { 50% { transform: translate(-52px, -32px) scale(1.08); } }
@keyframes auth-drift-3 { 50% { transform: translate(-34px, 52px) scale(1.12); } }

/* Card lives in 3D space; JS feeds --rx/--ry for parallax tilt */
.auth-main { position: relative; z-index: 1; width: 100%; max-width: 400px; perspective: 1200px; }
.auth-main::after { content: ""; position: absolute; inset: -50px -20px -40px; z-index: -1; background: radial-gradient(ellipse 72% 62% at 50% 52%, oklch(0.80 0.10 220 / 0.20), transparent 70%); filter: blur(24px); pointer-events: none; }
.auth-card {
  --rx: 0deg; --ry: 0deg;
  position: relative; border-radius: 18px; padding: 1px;
  background: linear-gradient(150deg, oklch(0.80 0.07 220 / 0.40), oklch(1 0 0 / 0.05) 42%, oklch(0.62 0.16 290 / 0.26));
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d; transition: transform 0.25s ease;
  box-shadow: 0 34px 80px -22px oklch(0 0 0 / 0.72);
}
.auth-card-inner {
  position: relative; border-radius: 17px; padding: 34px 32px 26px;
  background: linear-gradient(180deg, oklch(0.235 0.013 250 / 0.93), oklch(0.185 0.012 250 / 0.95));
  backdrop-filter: blur(16px); transform: translateZ(42px); transform-style: preserve-3d;
}
.auth-card-inner::before { content: ""; position: absolute; inset: 0; border-radius: 17px; background: linear-gradient(142deg, oklch(1 0 0 / 0.09), transparent 38%); pointer-events: none; }

.auth-brand { display: flex; align-items: center; gap: 12px; transform: translateZ(32px); }
.auth-logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; border: 1px solid var(--hairline); background: linear-gradient(160deg, var(--surface-2), oklch(0.17 0.015 250)); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.12), 0 7px 18px -7px oklch(0 0 0 / 0.6); }
.auth-brand-text { display: flex; flex-direction: column; gap: 2px; }
.auth-eyebrow { font-size: 10px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.auth-wordmark { font-weight: 600; letter-spacing: -0.01em; color: var(--text); font-size: 15px; }

.auth-title { margin: 24px 0 4px; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; transform: translateZ(26px); }
.auth-sub { margin: 0 0 20px; color: var(--text-2); font-size: 13.5px; transform: translateZ(22px); }

.auth-alert { margin: 0 0 16px; padding: 10px 12px; border-radius: 9px; font-size: 13px; color: oklch(0.86 0.10 25); background: oklch(0.66 0.19 25 / 0.13); border: 1px solid oklch(0.66 0.19 25 / 0.42); transform: translateZ(18px); }

.auth-form { display: flex; flex-direction: column; gap: 15px; transform: translateZ(16px); }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.auth-field input { width: 100%; background: oklch(0.155 0.012 250 / 0.85); color: var(--text); border: 1px solid var(--hairline); border-radius: 10px; padding: 11px 13px; font: inherit; min-height: 44px; transition: border-color 0.18s ease, box-shadow 0.18s ease; }
.auth-field input:hover { border-color: var(--muted); }
.auth-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px oklch(0.80 0.07 220 / 0.25); }
.auth-input-wrap { position: relative; display: flex; }
.auth-input-wrap input { padding-right: 44px; }
.auth-reveal { position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 34px; height: 34px; display: grid; place-items: center; background: transparent; border: 0; border-radius: 8px; color: var(--muted); cursor: pointer; }
.auth-reveal:hover { color: var(--text-2); background: var(--surface-2); }
.auth-reveal:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-reveal svg { width: 18px; height: 18px; }
.auth-reveal .icon-off { display: none; }
.auth-reveal.is-on .icon-on { display: none; }
.auth-reveal.is-on .icon-off { display: block; }

.auth-submit { margin-top: 6px; width: 100%; min-height: 46px; border: 0; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; color: oklch(0.17 0.015 250); background: linear-gradient(180deg, oklch(0.86 0.08 220), oklch(0.78 0.08 220)); box-shadow: 0 8px 20px -8px oklch(0.80 0.07 220 / 0.7), inset 0 1px 0 oklch(1 0 0 / 0.3); transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.18s ease; }
.auth-submit:hover { filter: brightness(1.05); box-shadow: 0 12px 26px -8px oklch(0.80 0.07 220 / 0.8), inset 0 1px 0 oklch(1 0 0 / 0.35); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.auth-foot { margin: 18px 0 0; text-align: center; font-size: 11px; color: var(--muted); letter-spacing: 0.02em; transform: translateZ(10px); }

@media (max-width: 480px) {
  .auth-card-inner { padding: 28px 22px 22px; }
  .auth-orb { filter: blur(54px); }
  .auth-title { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-grid, .auth-orb { animation: none; }
  .auth-card { transition: none; }
}

/* --- APM: 2×2 metric grid, per-service strip, clickable errors, detail drawer --- */
.svc-strip { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.svc-card { padding: 14px 16px; }
.svc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.svc-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.svc-name { font-weight: 600; font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.svc-kpi { display: flex; flex-direction: column; gap: 2px; }
.svc-kpi-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.svc-kpi-value { font-size: 17px; font-weight: 500; letter-spacing: -0.01em; }

/* error feed rows are <button>s for keyboard + screen-reader access */
.feed-row { width: 100%; background: transparent; color: inherit; border: 0; border-bottom: 1px solid var(--hairline); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.feed li:last-child .feed-row { border-bottom: none; }
.feed-row:hover:not(:disabled) { background: var(--surface-2); }
.feed-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.feed-row:disabled { cursor: default; }
.feed li { list-style: none; }

.err-dialog { width: min(640px, calc(100vw - 32px)); max-height: min(80vh, 720px); padding: 0; border: 1px solid var(--hairline); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 30px 70px -20px oklch(0 0 0 / 0.7); }
.err-dialog::backdrop { background: oklch(0.12 0.01 250 / 0.6); backdrop-filter: blur(2px); }
.err-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; margin: 0; border-bottom: 1px solid var(--hairline); position: sticky; top: 0; background: var(--surface); }
.err-dialog-head .chart-title { margin: 0; }
.err-detail-body { padding: 16px 18px 20px; overflow-y: auto; }
.err-cause { background: oklch(0.66 0.19 25 / 0.10); border: 1px solid oklch(0.66 0.19 25 / 0.32); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 4px; }
.err-cause-type { font-size: 12px; color: oklch(0.80 0.12 25); letter-spacing: 0.02em; }
.err-cause-msg { font-size: 14px; color: var(--text); line-height: 1.45; }
.err-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 0; }
.err-kv > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.err-kv dt { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.err-kv dd { margin: 0; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.err-stack { margin: 16px 0 0; padding: 12px 14px; background: oklch(0.15 0.01 250); border: 1px solid var(--hairline); border-radius: 10px; font-size: 12px; line-height: 1.5; color: var(--text-2); overflow-x: auto; white-space: pre-wrap; word-break: break-word; max-height: 280px; overflow-y: auto; }

@media (max-width: 760px) {
  .err-kv { grid-template-columns: 1fr; }
  .svc-kpis { gap: 6px; }
  .wf-row, .wf-scale { grid-template-columns: minmax(76px, 110px) 1fr; }
  .wf-label { font-size: 11px; }
}

.range-live { display: inline-flex; align-items: center; gap: 5px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: oklch(0.78 0.17 25); }
.range-live.is-active .live-dot { box-shadow: 0 0 0 0 oklch(0.78 0.17 25 / 0.6); animation: live-pulse 1.8s ease-out infinite; }
@keyframes live-pulse { to { box-shadow: 0 0 0 6px oklch(0.78 0.17 25 / 0); } }
@media (prefers-reduced-motion: reduce) { .range-live.is-active .live-dot { animation: none; } }

/* --- Error detail: richer span-chain + bodies + attrs (Task 7) -------------- */
.err-section-title { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 14px 0 6px; }
.err-cause-src { color: var(--text-2); margin-left: 6px; font-size: 12px; }
.err-chain { margin-top: 6px; }
.chain-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: baseline; padding: 4px 6px; border-radius: 6px; font-size: 12px; }
.chain-row.is-error { background: oklch(0.30 0.08 25 / 0.35); }
.chain-row.is-clicked { outline: 1px solid var(--muted); }
.chain-svc { color: var(--text-2); }
.chain-dur, .chain-status { color: var(--muted); }
/* On the reddish error row, --muted/--text-2 lose contrast — lift svc + dur +
   status to --text (oklch 0.96) for WCAG-AA. Row background stays unchanged. */
.chain-row.is-error .chain-dur,
.chain-row.is-error .chain-status,
.chain-row.is-error .chain-svc { color: var(--text); }
.err-body { max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border-radius: 8px; padding: 10px; font-size: 12px; }
.err-attrs { margin-top: 4px; }

/* --- trace waterfall + Chain/Waterfall toggle (Feature B) ------------------- */
.wf-toggle { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 9px; padding: 3px; margin-bottom: 10px; }
.wf-toggle-btn { background: transparent; color: var(--text-2); border: 0; border-radius: 6px; padding: 5px 12px; font: inherit; font-family: var(--mono); font-size: 13px; cursor: pointer; min-height: 30px; }
.wf-toggle-btn:hover:not(:disabled) { color: var(--text); }
.wf-toggle-btn.is-active { color: var(--bg); background: var(--accent); }
.wf-toggle-btn:disabled { color: var(--muted); cursor: default; opacity: 0.6; }
.wf-toggle-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.err-waterfall { margin-top: 2px; }
.wf-scale { display: grid; grid-template-columns: minmax(120px, 220px) 1fr; font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.wf-scale .wf-tick { grid-column: 2; justify-self: start; }
.wf-scale .wf-tick-mid { justify-self: center; }
.wf-scale .wf-tick-end { justify-self: end; }
.wf-scale .wf-tick:first-child { grid-column: 1; justify-self: start; }
.wf-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr; gap: 10px; align-items: center; padding: 3px 0; }
.wf-label { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-track { position: relative; width: 100%; height: 16px; background: var(--surface-2); border-radius: 5px; display: flex; align-items: center; }
.wf-bar { position: absolute; top: 0; height: 100%; min-width: 2px; border-radius: 5px; }
.wf-bar-http { background: var(--accent); }
.wf-bar-pg { background: var(--ok); }
.wf-bar-redis { background: var(--warn); }
.wf-bar-other { background: var(--muted); }
.wf-bar.is-error { background: var(--crit); }
.wf-bar.is-clicked { outline: 1px solid var(--text); outline-offset: 1px; }
.wf-dur { position: relative; margin-left: auto; padding-right: 4px; font-size: 11px; color: var(--muted); z-index: 1; }
/* On an error row the label sits over the red bar — --muted (oklch 0.56) fails
   WCAG-AA on red; --text (oklch 0.96) clears it. Bar colour stays unchanged. */
.wf-track.is-error .wf-dur { color: var(--text); font-weight: 500; }

/* --- Endpoint detail: clickable route cells in slow table (Task 10) --------- */
.link-btn { background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; padding: 0; text-align: left; }
.link-btn:hover { color: oklch(0.82 0.11 220); text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
