/* LinkShift dashboard. Tokens: surfaces < panel < raised. Status colours carry meaning (good / warning / critical)
   and always come with an icon or a word. Path A = blue, path B = orange everywhere (entity colours, validated for
   colour-vision deficiency in both themes). Brand violet is the accent for controls and for LS25 in comparisons. */
:root {
  --page: #f6f6f3; --surface: #fcfcfb; --raised: #ffffff; --sunken: #efeee9;
  --text: #0b0b0b; --text-2: #46453f; --muted: #66655f; --hair: #e1e0d9; --axis: #c3c2b7; --border: rgba(11,11,11,.12);
  --brand: #6233ea; --brand-2: #5126d6; --brand-ink: #ffffff; --brand-soft: rgba(98,51,234,.10); --accent-mark: #6250d6;
  --link: #4d22c9; --focus: #6233ea;
  --path-a: #2a78d6; --path-b: #eb6834;
  --good: #0ca30c; --good-ink: #006300; --warn: #fab219; --warn-ink: #7a5200; --crit: #d03b3b; --crit-ink: #a12424;
  --serious: #ec835a; --neutral-mark: #b8b6ad; --pending: #d5d3cb;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px -8px rgba(0,0,0,.12);
  --r: 12px; --r-sm: 8px; --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --page: #0d0d0d; --surface: #1a1a19; --raised: #222220; --sunken: #141413;
  --text: #f0efec; --text-2: #cfcec5; --muted: #a9a89f; --hair: #2c2c2a; --axis: #45453f; --border: rgba(255,255,255,.12);
  --brand: #8b6cff; --brand-2: #a08aff; --brand-ink: #0d0d0d; --brand-soft: rgba(139,108,255,.16); --accent-mark: #9085e9;
  --link: #b5a6ff; --focus: #b5a6ff;
  --path-a: #3987e5; --path-b: #d95926;
  --good: #0ca30c; --good-ink: #3ccf3c; --warn: #fab219; --warn-ink: #fab219; --crit: #d03b3b; --crit-ink: #ff8a8a;
  --neutral-mark: #5f5e58; --pending: #3a3a36;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 6px 20px -10px rgba(0,0,0,.7);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--page); scroll-padding-top: 150px; -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--text); background: var(--page); font: 16px/1.55 var(--font); }
a { color: var(--link); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--raised); color: var(--text); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
code { font-family: var(--mono); font-size: .92em; background: var(--sunken); padding: 1px 5px; border-radius: 5px; }
h1 { font-size: 1.75rem; line-height: 1.25; margin: 0 0 var(--s2); letter-spacing: -.01em; }
.h2 { font-size: 1.25rem; margin: var(--s6) 0 var(--s3); }
.h3 { font-size: 1.05rem; margin: 0; font-weight: 650; }
.h4 { font-size: .98rem; margin: var(--s3) 0 var(--s1); font-weight: 650; }
.lede { color: var(--text-2); max-width: 70ch; margin: 0; }
.hint { color: var(--muted); font-size: .9rem; margin: var(--s1) 0 0; }
.error { color: var(--crit-ink); font-weight: 600; min-height: 1.4em; }
.nowrap { white-space: normal; }
ul.plain { padding-left: 1.1em; margin: var(--s2) 0 0; }
ul.plain li { margin: 0 0 var(--s2); }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px); border-bottom: 1px solid var(--hair); }
.top-inner { max-width: 1320px; margin: 0 auto; padding: 10px var(--s4); display: flex; align-items: center; gap: var(--s4); }
.brand { display: flex; align-items: center; flex: 0 0 auto; }
.logo { height: 34px; width: auto; display: block; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.tabs { display: flex; gap: 2px; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 12px; border-radius: 999px; color: var(--text-2); text-decoration: none; font-weight: 550; white-space: nowrap; font-size: .95rem; }
.tabs a:hover { background: var(--sunken); color: var(--text); }
.tabs a[aria-current="page"] { background: var(--brand-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--brand); }
.top-tools { display: flex; align-items: center; gap: var(--s2); flex: 0 0 auto; }
.chip { font-size: .82rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.chip.ctl { border-color: var(--brand); color: var(--text); background: var(--brand-soft); font-weight: 600; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--raised); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.net { font-size: .78rem; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--warn); color: var(--text-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.net::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.net[hidden] { display: none; }
.conn { max-width: 1320px; margin: 0 auto 8px; padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: .92rem; }
.conn.warn { background: color-mix(in srgb, var(--warn) 22%, var(--surface)); color: var(--text); border: 1px solid var(--warn); }
.conn.bad { background: color-mix(in srgb, var(--crit) 16%, var(--surface)); color: var(--text); border: 1px solid var(--crit); }
.conn.ok { background: color-mix(in srgb, var(--good) 14%, var(--surface)); border: 1px solid var(--good); }
.devmode { text-align: center; font-size: .82rem; background: var(--sunken); color: var(--text-2); padding: 3px; }

main { max-width: 1320px; margin: 0 auto; padding: var(--s5) var(--s4) var(--s6); }
.view .intro { margin-bottom: var(--s5); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s4); box-shadow: var(--shadow); margin-bottom: var(--s4); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.two-col > .panel { margin-bottom: 0; }
.two-col { margin-bottom: var(--s4); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; padding: 3px 9px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge-live { color: var(--good-ink); border-color: var(--good); background: color-mix(in srgb, var(--good) 10%, transparent); }
.badge-live.off { color: var(--muted); border-color: var(--border); background: transparent; }
.badge-live.stale { color: var(--warn-ink); border-color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge-rec { color: var(--link); border-color: var(--brand); background: var(--brand-soft); }
.badge-ill { color: var(--text-2); border-color: var(--border); }

/* buttons */
.btn { font: inherit; font-weight: 600; font-size: .94rem; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--raised); color: var(--text); cursor: pointer; min-height: 40px; }
.btn { transition: border-color .15s, background-color .15s, box-shadow .15s, transform .08s; }
.btn:hover:not(:disabled) { border-color: var(--brand); background-color: color-mix(in srgb, var(--brand) 6%, var(--raised)); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.pending { cursor: progress; position: relative; color: transparent !important; }
.btn.pending::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--text-2); border-right-color: transparent; animation: ls-spin .7s linear infinite; }
@keyframes ls-spin { to { transform: rotate(360deg); } }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover:not(:disabled) { background: var(--brand-2); box-shadow: 0 4px 14px -6px var(--brand); }
.btn-danger:hover:not(:disabled) { border-color: var(--crit); background: color-mix(in srgb, var(--crit) 8%, var(--raised)); }
.btn-danger { border-color: var(--crit); color: var(--crit-ink); background: var(--raised); }
.btn-sm { padding: 6px 10px; min-height: 34px; font-size: .86rem; border-radius: 8px; }
.btn.active { box-shadow: inset 0 0 0 2px var(--crit); }
select, input[type="password"], input[type="text"] { font: inherit; font-size: .94rem; color: var(--text); background: var(--raised); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-height: 38px; max-width: 100%; }
/* one drawn arrow for every menu, inside the box, in both themes (native arrows differ per browser and could sit outside
   a stretched menu); a menu never grows past its container */
select { -webkit-appearance: none; appearance: none; min-width: 0; text-overflow: ellipsis; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2346453f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px; }
:root[data-theme="dark"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23cfcec5' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
select::-ms-expand { display: none; }
label { max-width: 100%; }                 /* a label never grows wider than its container because of a long option */
label > select { max-width: 100%; }
.adv-grid label { flex: 1 1 220px; min-width: 0; max-width: 100%; }
.adv-grid label.check { flex: 0 1 auto; }
.adv-grid select { width: 100%; }
.opt-desc { font-size: .78rem; font-weight: 500; color: var(--muted); }
.topo-svg .dir-label.compact { font-size: 11.5px; }
.topo-svg .dir-label .sub2 { font-size: 10.5px; font-weight: 600; }
label { display: inline-flex; flex-direction: column; gap: 4px; font-size: .86rem; color: var(--text-2); font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: 8px; }
label.check input { width: 18px; height: 18px; }

/* session bar and setup */
.session-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s2) var(--s3); flex-wrap: wrap; position: sticky; top: 58px; z-index: 10; padding: 8px 14px; }
.sb-left, .sb-right { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.phase { font-weight: 700; }
.sb-meta { color: var(--text-2); font-size: .84rem; }
.ctl-owner { font-size: .9rem; color: var(--text-2); }
.scenario-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s2); margin: var(--s3) 0; }
.scen { text-align: left; font: inherit; border: 1px solid var(--border); border-radius: 10px; background: var(--raised); color: var(--text); padding: 10px 12px; cursor: pointer; }
.scen:hover { border-color: var(--brand); }
.scen[aria-checked="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-soft); }
.scen b { display: block; font-size: .95rem; }
.scen span { display: block; font-size: .82rem; color: var(--text-2); margin-top: 2px; }
.advanced summary { cursor: pointer; font-weight: 600; color: var(--text-2); padding: 4px 0; }
.adv-grid { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: end; margin: var(--s2) 0; }
/* what is being demonstrated (operator and viewers) */
.scen-now { border-left: 4px solid var(--brand); padding-top: 12px; padding-bottom: 12px; }
.scen-now[data-phase="ended"], .scen-now[data-phase="failed"] { border-left-color: var(--axis); }
.sn-head { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
.sn-kicker { font-size: .74rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; color: var(--brand); }
.scen-now[data-phase="ended"] .sn-kicker, .scen-now[data-phase="failed"] .sn-kicker { color: var(--muted); }
.sn-head .h3 { font-size: 1.12rem; }
.sn-story { margin: 4px 0 8px; color: var(--text-2); font-size: .92rem; max-width: 110ch; }
.sn-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sn-facts li { display: inline-flex; gap: 6px; align-items: baseline; font-size: .82rem; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--raised); }
.sn-facts li span { color: var(--muted); font-weight: 600; }
.sn-facts li b { font-weight: 650; color: var(--text); }
.sn-steps-wrap { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.sn-steps-wrap[hidden] { display: none; }
.sn-steps-label { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sn-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: st; }
.sn-steps li { counter-increment: st; font-size: .84rem; padding: 3px 10px 3px 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); }
.sn-steps li::before { content: counter(st); display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px; border-radius: 50%;
  font-size: .72rem; font-weight: 700; background: var(--sunken); color: var(--text-2); }
.sn-steps li.done { color: var(--text); } .sn-steps li.done::before { content: "\2713"; background: color-mix(in srgb, var(--good) 22%, var(--raised)); color: var(--good-ink); }
.sn-steps li.next { border-color: var(--brand); color: var(--text); font-weight: 650; background: var(--brand-soft); }
.sn-steps li.next::before { background: var(--brand); color: var(--brand-ink); }
.sn-steps li.free::before { content: "\2026"; }
@media (max-width: 560px) {
  .sn-story { font-size: .86rem; }
  .sn-facts { gap: 4px; } .sn-facts li { font-size: .76rem; padding: 2px 8px; }
  .sn-steps li { font-size: .78rem; }
}
.scen-story { margin: 0 0 8px; padding: 8px 12px; font-size: .9rem; color: var(--text-2); max-width: 110ch; border-left: 3px solid var(--brand); background: var(--brand-soft); border-radius: 0 8px 8px 0; }
.scen-story:empty { display: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* confirmation dialog (Reset view) */
.dlg { border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px 18px; max-width: min(460px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 24px 60px -20px rgba(0,0,0,.45); }
.dlg::backdrop { background: rgba(10, 10, 12, .45); backdrop-filter: blur(2px); }
.dlg .h3 { margin-bottom: 8px; }
.dlg p { margin: 0 0 8px; font-size: .93rem; color: var(--text-2); }
.dlg .rd-keep { color: var(--text); font-weight: 600; }
.dlg .rd-keep span { font-weight: 400; color: var(--muted); font-family: var(--mono); font-size: .8rem; word-break: break-all; }
.rd-discard { margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--sunken);
  font-size: .86rem; font-weight: 500; color: var(--text-2); align-items: flex-start !important; cursor: pointer; }
.rd-discard[hidden] { display: none; }
.rd-discard input { margin-top: 2px; flex: 0 0 auto; accent-color: var(--crit); }
.rd-discard b { color: var(--text); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.dlg[open] { animation: ls-dlg .16s ease-out; }
@keyframes ls-dlg { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.setup-actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s3); }
.viewer-note p { margin: 0; }

/* live layout */
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s4); align-items: start; }
.live-grid > *, .two-col > *, .replay-pair > *, .cards > *, .kpis > *, .paths > *, .panel, .chart, figure { min-width: 0; }
.chart { overflow: hidden; }
.col-side { position: static; }

/* topology: lines in each path's identity colour; state shown by a labelled pill, a mark and the line style */
.topo-svg svg { width: 100%; height: auto; display: block; max-height: 290px; overflow: visible; }
.topo-svg .node rect { fill: var(--raised); stroke: var(--axis); stroke-width: 1.5; transition: stroke .25s; }
.topo-svg .node:hover rect { stroke: var(--brand); }
.topo-svg text { fill: var(--text); font: 600 13px var(--font); pointer-events: none; }
.topo-svg .sub { fill: var(--text-2); font-weight: 500; font-size: 11.5px; }
.topo-svg .path-line { fill: none; stroke-width: 4.5; stroke-linecap: round; transition: stroke-opacity .35s, stroke-width .5s, stroke .35s; }
.topo-svg .path-line { stroke-opacity: .62; }   /* lighter than the markers that travel on it */
.topo-svg .path-line.idle { stroke-opacity: .38; }
.topo-svg .path-line.degraded { stroke-dasharray: 12 6; }
.topo-svg .path-line.down { stroke: var(--crit); stroke-opacity: .5; stroke-dasharray: 3 9; stroke-width: 3; }
.topo-svg .path-glow { fill: none; stroke-width: 16; stroke-linecap: round; stroke-opacity: 0; transition: stroke-opacity .5s; }
.topo-svg .path-glow.on { stroke-opacity: .13; }
.topo-svg .pa { stroke: var(--path-a); } .topo-svg .pb { stroke: var(--path-b); }
/* packet markers: capsules in the path colour with a light rim, so they stand out from the line they travel on */
.topo-svg .dots rect { stroke: #fff; stroke-width: 2; stroke-opacity: .95; }
.topo-svg .tails path { fill: none; stroke-width: 7; stroke-linecap: round; }
.topo-svg .dots.da .tails path { stroke: var(--path-a); } .topo-svg .dots.db .tails path { stroke: var(--path-b); }
.topo-svg .dir-label { font-size: 12px; font-weight: 650; fill: var(--muted); letter-spacing: .01em; }
.topo-svg .dots.da rect { fill: var(--path-a); } .topo-svg .dots.db rect { fill: var(--path-b); }
.topo-svg .dots.da { filter: drop-shadow(0 0 4px color-mix(in srgb, var(--path-a) 75%, transparent)); }
.topo-svg .dots.db { filter: drop-shadow(0 0 4px color-mix(in srgb, var(--path-b) 75%, transparent)); }
.topo-svg .dots.s-degraded rect { stroke: var(--warn); stroke-width: 2.2; stroke-opacity: 1; }
.topo-svg .dots.s-restored rect { stroke: var(--good); stroke-width: 2.2; stroke-opacity: 1; }
:root[data-theme="dark"] .topo-svg .dots rect { stroke: #f4f3ee; }
.topo-legend { margin: 0 0 6px; text-align: center; font-size: .78rem; color: var(--muted); }
.final-note { margin: 0 0 var(--s3); padding: 9px 14px; border-radius: 10px; border: 1px dashed var(--axis); background: var(--sunken);
  color: var(--text); font-size: .9rem; font-weight: 600; }
.kpi.final { border-style: dashed; box-shadow: none; }
.kpi.final .label::after { content: "final"; font-size: .7rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; margin-left: auto; }
.topo-svg .pill rect { fill: var(--raised); stroke: var(--axis); stroke-width: 1.3; transition: fill .35s, stroke .35s; }
.topo-svg .pill text { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.topo-svg .pill.s-active rect { stroke: var(--good); fill: color-mix(in srgb, var(--good) 9%, var(--raised)); }
.topo-svg .pill.s-restored rect { stroke: var(--good); stroke-width: 2; fill: color-mix(in srgb, var(--good) 16%, var(--raised)); }
.topo-svg .pill.s-degraded rect { stroke: var(--warn); fill: color-mix(in srgb, var(--warn) 16%, var(--raised)); }
.topo-svg .pill.s-failed rect { stroke: var(--crit); fill: color-mix(in srgb, var(--crit) 13%, var(--raised)); }
.topo-svg .xmark, .topo-svg .wmark { transition: opacity .3s; }
.topo-svg .xmark circle { fill: var(--crit); } .topo-svg .xmark path { stroke: #fff; stroke-width: 2.4; stroke-linecap: round; }
.topo-svg .wmark circle { fill: var(--warn); } .topo-svg .wmark path { stroke: #1b1b1b; stroke-width: 2.6; stroke-linecap: round; }
.topo-cap { margin: 4px 0 6px; text-align: center; font-weight: 600; font-size: .92rem; color: var(--text-2); min-height: 1.5em; }
.pstate { margin-left: auto; font-size: .74rem; font-weight: 700; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.pstate:empty { display: none; }
.pstate.s-active, .pstate.s-restored { border-color: var(--good); color: var(--good-ink); background: color-mix(in srgb, var(--good) 9%, transparent); }
.pstate.s-degraded { border-color: var(--warn); color: var(--warn-ink); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.pstate.s-failed { border-color: var(--crit); color: var(--crit-ink); background: color-mix(in srgb, var(--crit) 10%, transparent); }
.pathcard { transition: border-color .3s, box-shadow .3s, transform .2s; }
.pathcard[data-state="failed"] { border-color: color-mix(in srgb, var(--crit) 60%, var(--border)); }
.pathcard[data-state="degraded"] { border-color: color-mix(in srgb, var(--warn) 70%, var(--border)); }
.pathcard[data-state="restored"] { border-color: color-mix(in srgb, var(--good) 60%, var(--border)); }
.pathcard.flash { animation: ls-flash 1.4s ease-out; }
@keyframes ls-flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 55%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
.cond .warnc { color: var(--warn-ink); font-weight: 700; }
.paths { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3); margin-top: var(--s2); }
.pathcard { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--raised); }
.pathcard h3 { margin: 0; font-size: .98rem; display: flex; align-items: center; gap: 8px; }
.key { display: inline-block; width: 18px; height: 4px; border-radius: 2px; flex: 0 0 auto; }
.pathcard .ptitle { flex: 1 1 auto; min-width: 0; }
.key-a { background: var(--path-a); } .key-b { background: var(--path-b); }
.pathcard .cond { margin: 4px 0 8px; font-size: .88rem; color: var(--text-2); }
.cond .tag { display: inline-block; font-size: .74rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); margin-left: 4px; color: var(--text-2); }
.cond .bad { color: var(--crit-ink); font-weight: 700; }
.cond .okc { color: var(--good-ink); font-weight: 700; }
.fault-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.fault-btns select { min-height: 34px; font-size: .86rem; padding: 5px 8px; }
.global-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--s3); align-items: center; }
.global-actions .sep { flex: 1; }
.next-step { margin: var(--s3) 0 0; padding: 8px 12px; border-left: 3px solid var(--brand); background: var(--brand-soft); border-radius: 0 8px 8px 0; font-size: .92rem; }
.next-step:empty { display: none; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); min-height: 112px; display: flex; flex-direction: column; }
.kpi .label { font-size: .84rem; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 1.75rem; font-weight: 650; line-height: 1.15; margin: 4px 0 2px; }
.kpi .value small { font-size: .9rem; font-weight: 600; color: var(--text-2); }
.kpi .def { font-size: .78rem; color: var(--muted); margin-top: auto; }
.kpi.stale .value, .kpi.stale .sub { opacity: .45; }
.kpi .sub { font-size: .84rem; color: var(--text-2); }
.st { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: .84rem; }
.st i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.st.good { color: var(--good-ink); } .st.good i { background: var(--good); }
.st.warn { color: var(--warn-ink); } .st.warn i { background: var(--warn); }
.st.crit { color: var(--crit-ink); } .st.crit i { background: var(--crit); }
.st.neutral { color: var(--text-2); } .st.neutral i { background: var(--neutral-mark); }

/* charts */
.chart { width: 100%; height: 260px; }
.chart-tall { height: 340px; }
.chart-sub { font-size: .86rem; color: var(--text-2); margin: 0 0 var(--s2); max-width: 80ch; }
.chart-panel .panel-head { margin-bottom: 2px; }
.chart.stale { opacity: .45; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.seg-btn { font: inherit; font-size: .84rem; padding: 6px 10px; border: 0; background: var(--raised); color: var(--text-2); cursor: pointer; }
.seg-btn.on { background: var(--brand-soft); color: var(--text); font-weight: 650; }
.table-view summary { cursor: pointer; font-size: .86rem; color: var(--text-2); margin-top: 4px; }
table.t { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; margin-top: 6px; }
table.t th, table.t td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--hair); vertical-align: top; }
table.t th { color: var(--text-2); font-weight: 650; }
table.t td.num, table.t th.num { text-align: right; }
table.t tr.hl td { background: var(--brand-soft); }
.tscroll { overflow: auto; max-height: 360px; }
.twrap { overflow-x: auto; }
.more summary { cursor: pointer; }
.chart-block { margin-top: var(--s3); }
.engine-view { margin-top: var(--s3); }

/* events */
.event-list { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow-y: auto; }
.event-list li { padding: 8px 2px; border-bottom: 1px solid var(--hair); font-size: .88rem; display: grid; grid-template-columns: 52px 1fr; gap: 6px; }
.event-list .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.event-list .k-action { font-weight: 650; }
.event-list .k-engine { color: var(--text-2); }
.event-list .k-system { color: var(--text-2); font-style: italic; }
.event-list .outcome { display: block; margin-top: 2px; font-weight: 600; color: var(--text); font-style: normal; }
.event-list .cls { display: inline-block; font-size: .72rem; border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; margin-left: 4px; color: var(--text-2); font-weight: 600; }
.ref-box h2 { margin-bottom: 4px; }
.ref-box table { margin-top: 6px; font-size: .82rem; }
.ref-box table th, .ref-box table td { padding: 5px 4px; }
/* one disclosure marker for every <details>, inside the panel, turning when opened */
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; display: inline-block; width: 0; height: 0; margin: 0 8px 2px 1px; vertical-align: middle;
  border-left: 6px solid currentColor; border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent;
  transition: transform .2s ease; opacity: .75; }
details[open] > summary::before { transform: rotate(90deg); }
.fault-btns[hidden], .global-actions[hidden] { display: none; }
.provenance dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; font-size: .84rem; margin: var(--s2) 0 0; }
.provenance dt { color: var(--text-2); font-weight: 650; }
.provenance dd { margin: 0; word-break: break-all; }
.provenance pre { font-family: var(--mono); font-size: .78rem; background: var(--sunken); padding: 8px; border-radius: 8px; overflow-x: auto; }
.limits-mini ul { padding-left: 1.1em; margin: 6px 0 8px; font-size: .9rem; }

/* evidence */
.status-strip { display: flex; gap: var(--s3); align-items: flex-start; flex-wrap: wrap; }
.status-strip p { margin: 0; flex: 1 1 360px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.card h3 { margin: 0; font-size: 1rem; }
.card .big { font-size: 1.6rem; font-weight: 650; line-height: 1.2; }
.card .big small { font-size: .9rem; color: var(--text-2); font-weight: 600; }
.card p { margin: 0; font-size: .9rem; color: var(--text-2); }
.card .src { font-size: .78rem; color: var(--muted); margin-top: auto; padding-top: 6px; border-top: 1px solid var(--hair); }
.card.limit { border-left: 4px solid var(--warn); }
.card.hero { grid-column: span 2; border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 7%, var(--surface)), var(--surface) 60%); }
.card.hero .big { font-size: 2.3rem; color: var(--text); }
.card.hero .big small { font-size: 1rem; }
@media (max-width: 660px) { .card.hero { grid-column: auto; } }
.minibars { display: grid; grid-template-columns: minmax(0, 13em) minmax(0, 1fr) max-content; align-items: center; gap: 8px 10px; margin: 4px 0 2px; font-size: .84rem; color: var(--text-2); }
.mb-row { display: contents; }
.mb-row.main > * { color: var(--text); font-weight: 650; }
.mb-track { position: relative; height: 12px; background: var(--sunken); border-radius: 6px; overflow: hidden; }
.mb-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--neutral-mark); border-radius: 6px; }
.mb-row.main .mb-bar { background: var(--accent-mark); min-width: 4px; }
.mb-rng { position: absolute; top: 3px; bottom: 3px; background: color-mix(in srgb, var(--neutral-mark) 55%, transparent); border-radius: 0 4px 4px 0; }
.mb-val { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--text); text-align: right; }
@media (max-width: 560px) { .minibars { grid-template-columns: minmax(0, 1fr); } .mb-row { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 4px 8px; } .mb-track { grid-column: 1 / -1; grid-row: 2; } }
.filters { display: flex; flex-wrap: wrap; gap: var(--s3); margin: var(--s2) 0 var(--s3); }
.filters label { flex: 1 1 220px; min-width: 0; max-width: 100%; }
.filters select { width: 100%; text-overflow: ellipsis; }
@media (min-width: 761px) { .filters label { flex: 0 1 auto; } .filters select { width: auto; max-width: 420px; } }
.replay-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.replay-pair figure { margin: 0; }
.replay-pair figcaption { font-size: .86rem; font-weight: 600; margin-bottom: 4px; }
.gate { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.gate.pass { color: var(--good-ink); } .gate.unresolved { color: var(--warn-ink); } .gate.fail { color: var(--crit-ink); }
.gate::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.gate.pass::before { background: var(--good); } .gate.unresolved::before { background: var(--warn); }
.g3 summary { cursor: pointer; font-weight: 600; margin-top: var(--s3); }
.g3 blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--axis); background: var(--sunken); border-radius: 0 8px 8px 0; font-size: .9rem; }
.foot-src { font-size: .8rem; color: var(--muted); }
.tech summary { cursor: pointer; }
/* engine comparison */
.ex-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); flex-wrap: wrap; margin: var(--s2) 0 var(--s1); }
.ex-take { margin: 0; font-size: .95rem; color: var(--text); flex: 1 1 380px; }
.ex-take strong { color: var(--text); }
.ex-take .take-up { color: var(--warn-ink); font-weight: 650; }
.ex-opts { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
label.check.small { font-size: .84rem; font-weight: 600; color: var(--text-2); }
label.check.small input { width: 16px; height: 16px; accent-color: var(--brand); }
label.check[hidden] { display: none; }
table.t .eng b { display: block; font-weight: 650; }
table.t .eng small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.35; margin-top: 1px; }
.tech code { word-break: break-all; font-size: .8rem; }
.tech .t td { padding: 4px 8px; }
/* architecture animation: the video is dark, so it sits in a dark "screen" frame in both themes */
.av { margin: var(--s2) 0 0; }
.av-frame { position: relative; background: #151614; border-radius: 12px; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--brand) 30%, #2a2a28); box-shadow: 0 10px 30px -18px rgba(0,0,0,.55); }
.av-frame video, .av-still { display: block; width: 100%; height: auto; aspect-ratio: 4 / 1; background: #151614; }
.av-still { display: none; }
.av.noplay video { display: none; }
.av.noplay .av-still { display: block; }
.av.noplay .av-bar, .av.noplay .av-progress { display: none; }
.av-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #1c1d1b; border-top: 1px solid #2c2d2a; }
.av-btn { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; border: 1px solid #3a3b37; background: #252623; color: #ecebe6;
  display: grid; place-items: center; cursor: pointer; transition: background-color .15s, border-color .15s, transform .08s; }
.av-btn svg { width: 18px; height: 18px; fill: currentColor; }
.av-btn:active { transform: translateY(1px); }
.av .i-pause { display: none; } .av.playing .i-pause { display: block; } .av.playing .i-play { display: none; }
.av-steps { flex: 1 1 auto; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.av-steps button { font: inherit; font-size: .8rem; font-weight: 600; white-space: nowrap; color: #c9c8c1; background: transparent;
  border: 1px solid #3a3b37; border-radius: 999px; padding: 5px 11px; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s; }
.av-steps button.on { background: color-mix(in srgb, #8b6cff 26%, #1c1d1b); border-color: #8b6cff; color: #fff; }
.av-progress { height: 3px; background: #2a2b28; }
.av-progress i { display: block; height: 100%; background: #8b6cff; transform-origin: left center; transform: scaleX(0); }
.av figcaption { font-size: .88rem; color: var(--text-2); margin: 10px 2px 0; max-width: 95ch; }
@media (hover: hover) and (pointer: fine) {
  .av-btn:hover { background: #30312d; border-color: #8b6cff; }
  .av-steps button:hover:not(.on) { color: #fff; border-color: #6d6c66; }
}
.arch-parts { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s2); }
.arch-parts li { transition: border-color .18s, transform .18s, box-shadow .18s; }
.arch-parts li { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; background: var(--raised); font-size: .84rem; color: var(--text-2); }
.arch-parts b { display: block; color: var(--text); font-size: .9rem; margin-bottom: 2px; }
.arch-parts li:nth-child(3), .arch-parts li:nth-child(4) { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); background: color-mix(in srgb, var(--brand) 5%, var(--raised)); }
@media (max-width: 1000px) { .arch-parts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .arch-parts li:nth-child(5) { grid-column: 1 / -1; } }
.av-steps .sm, .av-tip { display: none; }
@media (max-width: 560px) {
  .arch-parts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  .arch-parts li { padding: 8px 9px; font-size: .8rem; }
  .av-steps button { font-size: .76rem; padding: 5px 9px; }
  .av-steps .lg { display: none; } .av-steps .sm { display: inline; }
  .av-tip { display: block; font-size: .8rem; color: var(--muted); margin: 6px 2px 0; }
  .arch .panel-head .badge { white-space: normal; }
}
body.print .av video, body.print .av-bar, body.print .av-progress { display: none; }
body.print .av-still { display: block; }
@media print { .av video, .av-bar, .av-progress { display: none !important; } .av-still { display: block !important; } }
.faq details { border-bottom: 1px solid var(--hair); padding: 8px 0 8px 10px; border-left: 2px solid transparent; transition: border-color .2s; }
.faq details[open] { border-left-color: var(--brand); }
.cls-pill.own { border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); background: var(--brand-soft); color: var(--text); }
.faq summary { cursor: pointer; font-weight: 650; }
.faq p { margin: 6px 0 2px; color: var(--text-2); }
.cls-pill { font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; color: var(--text-2); }
.qr { margin: var(--s3) 0; }
pre.code, pre.log { font-family: var(--mono); font-size: .8rem; line-height: 1.45; background: var(--sunken); color: var(--text); padding: 12px; border-radius: 8px; overflow: auto; max-height: 520px; white-space: pre; }
.qr svg { width: 220px; height: 220px; background: #fff; padding: 6px; border-radius: 8px; }
.qr .url { font-family: var(--mono); font-size: .8rem; word-break: break-all; }
.row { display: flex; gap: var(--s3); align-items: end; flex-wrap: wrap; }

.foot { max-width: 1320px; margin: 0 auto; padding: var(--s4); color: var(--muted); font-size: .84rem; border-top: 1px solid var(--hair); }
.foot p { margin: 0 0 4px; }

/* recording mode (?rec=1): permanent label for the offline video */
.rec-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 10px 18px; background: rgba(12,12,12,.88); color: #fff; font-size: 15px; }
.rec-dot { font-weight: 800; letter-spacing: .04em; color: #ffb3b3; white-space: nowrap; }
.rec-dot::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #ff5a5a; margin-right: 8px; }
.rec-when { color: #d6d6d6; font-size: 13px; white-space: nowrap; }
.rec-cap { flex: 1 1 420px; font-weight: 600; font-size: 17px; }
body.rec { padding-bottom: 80px; }
body.rec #role-chip { visibility: hidden; }

/* print mode (?print=1) and printing */
.print-note { border: 2px solid var(--brand); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; background: var(--brand-soft); }
body.print .top { position: static; }
body.print .tabs, body.print .top-tools, body.print .table-view:not([open]), body.print .filters, body.print #replay .filters { display: none; }
body.print .view { margin-bottom: 28px; }
body.print .tscroll { max-height: none; overflow: visible; }
body.print #view-evidence { break-before: auto !important; }
@media print {
  .top { position: static; border: 0; }
  .tabs, .top-tools, .conn, .devmode, .skip, .seg, .rec-bar { display: none !important; }
  .panel, .card, .kpi { box-shadow: none; break-inside: avoid; }
  .cards { break-inside: auto; }
  main { padding-top: 0; }
  .view { break-before: page; }
  .view:first-of-type { break-before: auto; }
  a { color: inherit; text-decoration: none; }
}

/* responsive */
@media (max-width: 1100px) {
  .live-grid { grid-template-columns: minmax(0, 1fr); }
  .col-side { position: static; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  h1 { font-size: 1.35rem; }
  .top { position: static; }          /* a sticky two-row header would take a third of a phone screen */
  html { scroll-padding-top: 12px; }
  select, input[type="password"], input[type="text"], .fault-btns select { font-size: 16px; }   /* iPhone Safari zooms into smaller fields */
  .top-inner { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .logo { height: 28px; }
  .tabs { order: 3; flex-basis: 100%; flex-wrap: wrap; }
  .tabs a { padding: 6px 10px; font-size: .88rem; }
  main { padding: var(--s3) 12px var(--s5); }
  .session-bar { position: static; }
  .paths, .two-col, .replay-pair { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .kpi { min-height: 96px; }
  .kpi .value { font-size: 1.35rem; }
  .chart { height: 220px; }
  .chart-tall { height: 300px; }
  .cards { grid-template-columns: 1fr; }
  .event-list { max-height: 320px; }
}
/* interactive feedback: hover only on devices that hover; pressed states for touch; nothing moves with reduced motion */
.logo { transition: transform .25s ease, filter .25s ease; }
.tabs a { transition: background-color .15s, color .15s, box-shadow .15s; }
.icon-btn { transition: border-color .15s, background-color .15s, transform .08s; }
.icon-btn svg { transition: transform .35s ease; }
.icon-btn:active { transform: translateY(1px); }
.scen, .card, .kpi, .seg-btn, select { transition: border-color .18s, box-shadow .18s, transform .18s, background-color .18s; }
.scen:active { transform: scale(.99); }
summary { transition: color .15s; }
table.t tbody tr td { transition: background-color .12s; }
@media (hover: hover) and (pointer: fine) {
  .brand:hover .logo { transform: scale(1.035); filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--brand) 35%, transparent)); }
  .icon-btn:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--raised)); }
  .icon-btn:hover svg { transform: rotate(-18deg); }
  .scen:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
  .card:hover, .kpi:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 10px 26px -12px rgba(0,0,0,.22); }
  .pathcard:hover { box-shadow: var(--shadow); }
  .seg-btn:hover:not(.on) { background: var(--sunken); color: var(--text); }
  select:hover { border-color: var(--brand); }
  summary:hover { color: var(--link); }
  table.t tbody tr:hover td { background: color-mix(in srgb, var(--brand) 5%, transparent); }
  table.t tbody tr.hl:hover td { background: color-mix(in srgb, var(--brand) 16%, transparent); }
  .event-list li:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
  .arch-parts li:hover { border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); transform: translateY(-1px); box-shadow: var(--shadow); }
  .faq details:hover > summary { color: var(--link); }
  .chart:hover { cursor: crosshair; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .card:hover, .kpi:hover, .scen:hover, .brand:hover .logo, .icon-btn:hover svg { transform: none !important; }
  .btn.pending::after { border-right-color: var(--text-2); }
}
@media (forced-colors: active) { .badge::before, .st i, .gate::before { forced-color-adjust: none; } }
main:focus { outline: none; }
