/* PdM engine dashboard in the look of reactive/html/index.html (author, 3 Nov 2026): the same tokens, sizes, radii
   and shadows. One background colour; depth from paired dark/light shadows; raised controls that press in when
   active. body.night switches to the reference's dark palette between site sunset and sunrise (app.js). */
:root {
  --bg: #e6e9ef;
  --shadow-dark: #b8bcc4;
  --shadow-light: #ffffff;
  --text: #3a3f4b;
  --muted: #7b8394;
  --active: #2f9e44;
  --review: #2f9e44;
  --suspected: #e6b800;
  --confirmed: #d94848;
  --missed: #d94848;
  --unknown: #9aa1ad;
  --series: #2f6fb0;
  --line: rgba(128,128,128,0.15);
  --font: 'Segoe UI', system-ui, sans-serif;
}
body.night {
  --bg: #1b1d24;
  --shadow-dark: #101116;
  --shadow-light: #262933;
  --text: #dfe3ea;
  --muted: #7d8494;
  --series: #6fa3dc;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  padding: 32px 24px;
  transition: background 0.6s ease, color 0.6s ease;
  accent-color: var(--active);
  caret-color: var(--text);
}
body.night { color-scheme: dark; }
::selection { background: var(--active); color: #fff; }
h1, h2, h3, p, ol, ul { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; }
a { color: var(--active); }
:focus-visible { outline: 2px solid var(--active); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* header */
.top { display: flex; align-items: center; gap: 14px; max-width: 1100px; margin: 0 auto 16px; flex-wrap: wrap; }
.brand { font-size: 22px; font-weight: 700; }
.brand span { color: var(--active); }
.daynight {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 20px; background: var(--bg);
  box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
  font-size: 13px; color: var(--muted); cursor: default; user-select: none; margin-left: auto;
}
.daynight .ico { width: 14px; height: 14px; stroke: var(--suspected); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.night .daynight .ico { stroke: var(--muted); }
.signout {
  padding: 8px 16px; border-radius: 20px; background: var(--bg); color: var(--muted); font-size: 13px; text-decoration: none;
  box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
}
.signout:active { box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light); }

/* tabs */
.tabs { max-width: 1100px; margin: 0 auto 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.tabs a {
  border: none; cursor: pointer; padding: 10px 20px; border-radius: 14px; background: var(--bg); color: var(--muted);
  font-size: 13px; font-weight: 600; text-decoration: none;
  box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light); transition: box-shadow 0.2s, color 0.2s;
}
.tabs a[aria-current="page"] { color: var(--active); box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light); }

.canvas { max-width: 1100px; margin: 0 auto; }
.testbanner {
  margin: 0 0 24px; padding: 8px 10px; border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 12px; line-height: 1.5;
  box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
}

/* panels and cards */
.panel {
  max-width: 1100px; margin: 0 auto 24px; background: var(--bg); border-radius: 20px; padding: 22px 26px;
  box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light); transition: background 0.6s ease;
}
.panel h2, .title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.panel .sub { font-size: 12.5px; color: var(--muted); margin: -4px 0 14px; }
.panel h3, .well h3 { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); margin-bottom: 8px; }
.card {
  background: var(--bg); border-radius: 20px; padding: 22px; min-width: 0;
  box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light); transition: box-shadow 0.2s, background 0.6s ease;
}
.card h2 { font-size: 15px; font-weight: 700; }
.cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.meta { color: var(--muted); font-size: 12px; }
.panel > .meta { margin-top: 14px; }
.well {
  background: var(--bg); border-radius: 14px; padding: 14px; min-width: 0;
  box-shadow: inset 2px 2px 6px var(--shadow-dark), inset -2px -2px 6px var(--shadow-light);
}

/* overview header */
.lead-panel .title { margin-bottom: 6px; }
.titlerow { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; }
.finding { font-size: 13px; color: var(--text); line-height: 1.6; max-width: 80ch; }
.stamp { color: var(--muted); font-size: 12px; }
.unack { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.unack .pill { white-space: normal; }

/* presets and controls: the reference's panel-controls buttons */
.rangebox { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.presets { display: flex; gap: 12px; }
.preset, .controls button, .snow {
  border: none; cursor: pointer; padding: 8px 16px; border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 12.5px;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}
.preset[aria-pressed="true"] { color: var(--active); box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light); }
.preset:active, .controls button:active, .snow:active { box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light); }
.snow[disabled] { opacity: 0.6; cursor: default; }
.presetsel { display: none; }
.custom { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 14px; }
.custom label { margin: 0; align-self: center; }
.custom .err { margin: 0; min-height: 0; }
.hist {
  margin-top: 14px; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 10px; border-radius: 10px;
  font-size: 12px; color: var(--muted); box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
}
.linkbtn { background: none; border: 0; color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; padding: 0 2px; }

/* time slider: an inset groove with a raised thumb */
.slider { margin-top: 14px; }
.srow { display: flex; align-items: flex-start; gap: 16px; }
.scol { flex: 1; min-width: 0; }
.strack { position: relative; height: 46px; cursor: pointer; touch-action: none; border-radius: 8px; }
.sline { position: absolute; left: 0; right: 0; bottom: 11px; height: 8px; border-radius: 4px; box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light); }
.stick { position: absolute; bottom: 10px; width: 2px; height: 10px; margin-left: -1px; background: var(--muted); }
.stick.f { background: var(--confirmed); }
.stick::before { content: ""; position: absolute; left: -5px; right: -5px; top: -8px; bottom: -8px; }
.sthumb { position: absolute; bottom: 5px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: var(--bg); pointer-events: none;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light); }
.sthumb::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--active); }
.slabel { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; color: var(--text); font-weight: 600; }
.slabel.l { left: 0; transform: none; }
.slabel.r { left: auto; right: 0; transform: none; }
.sdays { position: relative; height: 22px; color: var(--muted); font-size: 12px; }
.sdays span { position: absolute; top: 2px; transform: translateX(-50%); white-space: nowrap; }
.sdays .dot { top: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--confirmed); transform: translateX(-3px); }
.sdays .lab { top: 4px; }
.sdays .lab.l { left: 0; transform: none; }
.sdays .lab.r { right: 0; transform: none; }
.snow { margin-top: 10px; }
.notice {
  margin-top: 14px; padding: 8px 10px; border-radius: 10px; color: var(--confirmed); font-size: 12px; line-height: 1.5;
  box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
}

/* inverter cards: the reference card (name, status badge, detail rows) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 24px; margin-bottom: 24px; }
.tile { display: flex; flex-direction: column; cursor: pointer; text-align: left; }
.tile.sel { box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light); }
.tile.unacked { box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light), inset 0 0 0 2px var(--confirmed); }
.tile.sel.unacked { box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light), inset 0 0 0 2px var(--confirmed); }
.inverter-name { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.inverter-name .r { color: var(--muted); font-weight: 400; font-size: 13px; }
.status-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; font-size: 13px; font-weight: 600;
  box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light); margin-bottom: 12px; align-self: flex-start;
}
.status-badge .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.b-pos { color: var(--active); }
.b-neg { color: var(--confirmed); }
.b-warn { color: var(--suspected); }
.b-neu { color: var(--unknown); }
.detail-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); padding: 5px 0; border-top: 1px solid var(--line); }
.detail-row:first-of-type { border-top: none; margin-top: 4px; }
.detail-row b { color: var(--text); font-weight: 600; text-align: right; }
.detail-row b.neg { color: var(--confirmed); }
.detail-row b .u { color: var(--muted); font-weight: 400; margin-left: 2px; }
.explain-text { margin-top: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.explain-text b { color: var(--text); font-weight: 600; }
.explain-text.stale { color: var(--suspected); }
.tile .actrow { margin-top: auto; padding-top: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.tile .status { color: var(--muted); font-size: 12px; }

/* buttons: the reference's explain button; primary keeps the shape with the green ink */
.btn {
  border: none; cursor: pointer; padding: 6px 12px; border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 12px;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light); flex: none;
}
.btn:active { box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light); }
.btn:disabled, .btn[disabled] { opacity: 0.6; cursor: default; }
.btn-primary { color: var(--active); font-weight: 600; }
.btn-primary[aria-busy="true"] { opacity: 0.6; cursor: progress; }

/* pills: the status badge; inside tables and lists, the coloured text of the reference's fault table */
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; white-space: nowrap;
  box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light); color: var(--unknown); }
.pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
td .pill, .events .pill { padding: 0; box-shadow: none; font-size: 12.5px; gap: 6px; }
td .pill::before, .events .pill::before { width: 8px; height: 8px; }
.typecounts .pill { padding: 6px 12px; border-radius: 10px; color: var(--muted); font-size: 12px; }
.p-pos { color: var(--active); }
.p-neg { color: var(--confirmed); }
.p-warn { color: var(--suspected); }
.p-neu { color: var(--unknown); }
.dash { color: var(--muted); }

/* analysis */
.grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; margin-bottom: 24px; align-items: stretch; }
.col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
#events { display: flex; flex-direction: column; }
#events.fill { flex: 1; }
#events .evfoot { margin-top: auto; padding-top: 8px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
#tableCard { margin-bottom: 24px; }
.lead { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 4px 0 10px; }
.lead .fig { font-size: 15px; font-weight: 600; color: var(--text); }
.lead .lbl { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.lead .u { color: var(--muted); font-size: 12px; margin-left: 2px; font-weight: 400; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.legend i { display: inline-block; width: 14px; height: 0; vertical-align: 3px; margin-right: 6px; }
.chartbox { background: var(--bg); border-radius: 14px; padding: 14px; box-shadow: inset 2px 2px 6px var(--shadow-dark), inset -2px -2px 6px var(--shadow-light); }
.chartbox svg { display: block; width: 100%; height: auto; overflow: visible; }
.invs { display: flex; gap: 8px; flex-wrap: wrap; }
.inv { border: none; cursor: pointer; padding: 6px 12px; border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 12px;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light); }
.inv[aria-pressed="true"] { color: var(--active); font-weight: 600; box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light); }

.trace { list-style: none; padding: 0; }
.trace li { display: grid; grid-template-columns: 104px minmax(0,1fr); gap: 10px; font-size: 12.5px; color: var(--muted); padding: 5px 0; border-top: 1px solid var(--line); }
.trace li:first-child { border-top: 0; }
.trace .v b { color: var(--text); font-weight: 600; }
.trace .v .s { display: block; color: var(--muted); font-size: 12px; }

/* daily ratio board */
.boardwrap { overflow-x: auto; padding: 6px 6px 10px; }
.board { display: grid; gap: 8px; }
.board .h { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.4px; text-align: center; padding-bottom: 2px; }
.board .h.on { color: var(--text); font-weight: 700; }
.board .rowname { display: flex; flex-direction: column; justify-content: center; padding-right: 8px; font-size: 12.5px; }
.board .rowname span { color: var(--muted); font-size: 11px; }
.cell { height: 50px; border: none; border-radius: 10px; background: var(--bg); cursor: pointer; font-size: 12.5px; color: var(--muted); position: relative; padding: 2px; line-height: 1.3;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light); }
.cell:active { box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light); }
.cell.k-out { color: var(--confirmed); font-weight: 600; }
.cell.k-flt { color: var(--suspected); font-weight: 600; }
.cell.k-data { color: var(--unknown); font-size: 11px; }
.cell.k-off { cursor: default; box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light); }
.cell.sel { color: var(--active); font-weight: 700; box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light); }
.cell.tot { cursor: default; display: grid; place-items: center; color: var(--text); font-weight: 600; box-shadow: inset 2px 2px 6px var(--shadow-dark), inset -2px -2px 6px var(--shadow-light); }
.boardkey { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.boardkey i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

/* events and warnings lists */
.events { list-style: none; padding: 0; }
.events li { padding: 8px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 10px; align-items: center; font-size: 12.5px; }
.events li:first-child { border-top: 0; }
.events .t { font-weight: 600; color: var(--text); }
.events .w { color: var(--muted); font-size: 12px; grid-column: 1 / -1; }
.events .empty { color: var(--muted); display: block; }

/* tables: the reference's fault table */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 720px; }
th { text-align: left; color: var(--muted); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; padding: 8px 10px; border-bottom: 1px solid rgba(128,128,128,0.25); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid rgba(128,128,128,0.12); color: var(--text); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }
td .s { color: var(--muted); }
tr[aria-current="true"] td:first-child b { color: var(--active); }
.logtable td.d { font-variant-numeric: tabular-nums; }
.logtable.small { min-width: 0; }
.logtable .excl td { color: var(--muted); }

/* view controls: the reference's panel-controls */
.controls { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.controls label { font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; margin: 0; }
.controls button { align-self: flex-end; }
.controls .err { align-self: flex-end; margin: 0 0 8px; min-height: 0; }
.typecounts { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }

/* alarm performance: the reference's KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--bg); border-radius: 14px; padding: 16px 18px; box-shadow: inset 2px 2px 6px var(--shadow-dark), inset -2px -2px 6px var(--shadow-light); }
.kpi .v { font-size: 24px; font-weight: 700; color: var(--text); }
.kpi .v .u { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.kpi .l { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 4px; }
.kpi .s { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.apgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; margin-bottom: 20px; }

/* how it works: the reference's rationale text in inset steps */
.steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: 14px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 2px 14px; background: var(--bg); border-radius: 14px; padding: 14px 18px;
  box-shadow: inset 2px 2px 6px var(--shadow-dark), inset -2px -2px 6px var(--shadow-light); }
.steps li::before { content: counter(step); grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 700; color: var(--muted);
  box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light); }
.steps h3 { font-size: 13px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0 0 2px; }
.steps p { font-size: 13px; color: var(--muted); line-height: 1.6; }
.steps b { color: var(--text); }

/* how it works: fault simulator and flowchart (simulation only; nothing is sent) */
.simbtns { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 12px; }
.simbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px; font-size: 12.5px; text-align: left; }
.simbtn b { color: var(--text); font-size: 13px; }
.simbtn .r { color: var(--muted); font-size: 12px; }
.simbtn .go { color: var(--active); font-weight: 600; font-size: 12px; }
.simbtn[aria-pressed="true"] { box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light); }
.simnote { font-size: 12px; color: var(--muted); margin: 2px 0 14px; }
.how-caption { min-height: 46px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; color: var(--text);
  background: var(--bg); border-radius: 12px; padding: 12px 20px; margin-bottom: 16px;
  box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light); }
.flowwrap { padding: 4px 0 8px; }
.flow { position: relative; width: 100%; }   /* zig-zag rows laid out by app.js */
.flowlines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
/* flowchart: thin right-angle connectors with square ends; compact uppercase step labels; outcomes in corner
   brackets; the current step filled green; locked steps carry an amber lock badge (after a branching-story chart,
   drawn with this dashboard's tokens) */
.fedge { fill: none; stroke: rgba(128,128,128,0.45); stroke-width: 1; }
.fedge.on { stroke: var(--active); stroke-width: 2; }
.fedge.new { stroke-dasharray: 600; stroke-dashoffset: 0; animation: fdraw 0.9s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes fdraw { from { stroke-dashoffset: 600; } }
.fnode { position: absolute; transform: translateY(-50%); min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border-radius: 4px; background: var(--bg); color: var(--muted); font-size: 10.5px; font-weight: 600; line-height: 1.3;
  text-transform: uppercase; letter-spacing: 0.4px; box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
  transition: box-shadow 0.3s, color 0.3s, background 0.3s, opacity 0.4s; }
.fnode .ico { width: 10px; height: 10px; flex: none; fill: currentColor; }
.fnode .badge { display: none; width: 18px; height: 18px; place-items: center; flex: none; }
.fnode .lock { width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fnode.on { color: var(--text); box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light), inset 3px 0 0 var(--active); }
.fnode.cur { background: var(--active); color: #fff; box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light); }
.fnode.off { opacity: 0.45; box-shadow: none; outline: 1px solid rgba(128,128,128,0.35); outline-offset: -1px; }
.fnode.locked { box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light); }
.fnode.locked .t, .fnode.locked .ico { display: none; }
.fnode.locked .badge { display: grid; }
.fnode.locked.off { outline: none; opacity: 1; }
.fnode.unlock .t { animation: funlock 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes funlock { from { opacity: 0; filter: blur(4px); } }
/* outcomes: bigger uppercase text inside corner brackets in the outcome's colour */
.fnode.end { --oc: var(--muted); flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 48px; padding: 8px 14px;
  font-size: 12.5px; letter-spacing: 0.5px; color: var(--text); border-radius: 2px;
  background:
    linear-gradient(var(--oc), var(--oc)) top left / 12px 2px no-repeat, linear-gradient(var(--oc), var(--oc)) top left / 2px 12px no-repeat,
    linear-gradient(var(--oc), var(--oc)) top right / 12px 2px no-repeat, linear-gradient(var(--oc), var(--oc)) top right / 2px 12px no-repeat,
    linear-gradient(var(--oc), var(--oc)) bottom left / 12px 2px no-repeat, linear-gradient(var(--oc), var(--oc)) bottom left / 2px 12px no-repeat,
    linear-gradient(var(--oc), var(--oc)) bottom right / 12px 2px no-repeat, linear-gradient(var(--oc), var(--oc)) bottom right / 2px 12px no-repeat,
    var(--bg); }
.fnode.o-pos { --oc: var(--active); } .fnode.o-neg { --oc: var(--confirmed); } .fnode.o-warn { --oc: var(--suspected); } .fnode.o-neu { --oc: var(--unknown); }
.fnode .olab { display: inline-flex; align-items: center; gap: 5px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.5px; color: var(--oc); }
.fnode .olab i { width: 7px; height: 7px; border-radius: 1px; background: var(--oc); }
.fnode.end.locked { flex-direction: row; align-items: center; }
.fnode.end.on { box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light), inset 0 0 0 2px var(--oc); }
.fnode.end.cur { background-color: var(--oc); color: #fff; }
.fnode.end.cur .olab { color: #fff; } .fnode.end.cur .olab i { background: #fff; }
.fnode.end.off { opacity: 0.7; }
@media (prefers-reduced-motion: reduce) { .fedge.new, .fnode.unlock .t { animation: none; } }
/* how it works: guide tables and the key */
.guide { display: grid; gap: 16px; margin-bottom: 20px; }
.guidetable { min-width: 760px; }
.guidetable td { vertical-align: top; }
.guidetable td.wrap { white-space: normal; color: var(--muted); font-size: 12.5px; line-height: 1.5; padding-block: 9px; }
.guidetable td .pill { white-space: nowrap; }
.guide .meta { margin-top: 8px; }
/* how it works: the assistant's workflow as a hub: the bot in the middle, steps fanning out from it; app.js places
   the nodes, draws the links and plays the cases */
.aiflow { position: relative; height: 540px; margin: 6px 0 10px; }
.aiflow .flowlines { transition: opacity 0.6s 0.45s; }
.aiflow.folded .flowlines { opacity: 0; transition: none; }
.anode { position: absolute; z-index: 1; width: 168px; padding: 9px 11px; border-radius: 4px; background: var(--bg); color: var(--muted);
  transform: translate(-50%, -50%); box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
  transition: transform 0.75s cubic-bezier(0.16, 1, 0.3, 1) calc(var(--i) * 55ms), opacity 0.5s calc(var(--i) * 55ms),
    box-shadow 0.3s, color 0.3s, background 0.3s; }
.aiflow.folded .anode { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(0.2); opacity: 0; transition: none; }
.anode b { display: block; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.anode span { display: block; margin-top: 4px; font-size: 11px; line-height: 1.35; }
.anode .dbico { width: 13px; height: 13px; margin-right: 5px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.anode.ai { box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light), inset 0 0 0 1px var(--series); }
.anode.on { color: var(--text); box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light), inset 3px 0 0 var(--active); }
.anode.cur { background: var(--active); color: #fff; transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 5px 5px 10px var(--shadow-dark), -4px -4px 8px var(--shadow-light); }
.anode.ai.cur { background: var(--series); }
.anode.hub { z-index: 2; width: 128px; height: 128px; padding: 0; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; color: var(--text);
  box-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light), inset 0 0 0 0 var(--active); }
.anode.hub b { font-size: 10px; }
.aiflow.folded .anode.hub { transform: translate(-50%, -50%) scale(0.6); opacity: 1; }
.anode.hub.cur { background: var(--bg); color: var(--text); transform: translate(-50%, -50%) scale(1.06);
  box-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light), inset 0 0 0 3px var(--active); }
.anode.hub::before, .anode.hub::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--active);
  opacity: 0; pointer-events: none; }
.aiflow.playing .anode.hub::before { animation: aiwave 2.4s ease-out infinite; }
.aiflow.playing .anode.hub::after { animation: aiwave 2.4s ease-out 1.2s infinite; }
@keyframes aiwave { from { transform: scale(1); opacity: 0.5; } to { transform: scale(1.9); opacity: 0; } }
.aiedge { stroke-width: 1.2; }
.aiedge.par { stroke-dasharray: 5 5; }
.aiedge.on { stroke-width: 2; }
.aiarrow { fill: rgba(128,128,128,0.6); } .aiarrow.on { fill: var(--active); }
.aikey { margin: -2px 0 6px; }
.aikey .k-seq, .aikey .k-par { width: 26px; height: 0; border-top: 2px solid var(--muted); vertical-align: middle; }
.aikey .k-par { border-top-style: dashed; }
.apulse { fill: var(--active); stroke: var(--bg); stroke-width: 2; filter: drop-shadow(0 0 4px var(--active)); }
.aictl { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; }
@media (max-width: 640px) { .anode { width: 132px; } .anode.hub { width: 104px; height: 104px; } .anode.hub img { width: 52px; height: 52px; } }
@media (prefers-reduced-motion: reduce) { .anode, .aiflow .flowlines { transition: none; } .aiflow.playing .anode.hub::before, .aiflow.playing .anode.hub::after { animation: none; } }
.flowkey { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); font-size: 12px; }
.flowkey i { display: inline-block; width: 22px; height: 14px; vertical-align: -2px; margin-right: 8px; }
.flowkey .k-end { --kc: var(--muted); border-radius: 2px; background: linear-gradient(var(--kc), var(--kc)) top left / 7px 2px no-repeat, linear-gradient(var(--kc), var(--kc)) top left / 2px 7px no-repeat, linear-gradient(var(--kc), var(--kc)) top right / 7px 2px no-repeat, linear-gradient(var(--kc), var(--kc)) top right / 2px 7px no-repeat, linear-gradient(var(--kc), var(--kc)) bottom left / 7px 2px no-repeat, linear-gradient(var(--kc), var(--kc)) bottom left / 2px 7px no-repeat, linear-gradient(var(--kc), var(--kc)) bottom right / 7px 2px no-repeat, linear-gradient(var(--kc), var(--kc)) bottom right / 2px 7px no-repeat, var(--bg); box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light); }
.flowkey b { color: var(--text); font-weight: 600; }
/* drop-downs (the two guide tables, the steps in full): the chevron sits right after the title and turns when open */
details.drop > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: flex-start; gap: 10px; }
details.drop > summary::-webkit-details-marker { display: none; }
details.drop > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-2px) rotate(45deg); transition: transform 0.2s; flex: none; }
details.drop[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
details.drop > summary h2, details.drop > summary h3 { margin: 0; }
details.drop[open] > summary { margin-bottom: 10px; }
details.panel.drop[open] > summary { margin-bottom: 16px; }
details.drop > summary:focus-visible { outline: 2px solid var(--active); outline-offset: 4px; border-radius: 6px; }
.explored { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.simout { font-size: 12.5px; color: var(--text); font-weight: 600; margin-top: 8px; min-height: 18px; }
@media (prefers-reduced-motion: reduce) { .fedge.new { animation: none; } }

/* loading, errors, foot */
.skel { display: block; border-radius: 10px; background: var(--bg); box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light); }
.skel-chart { height: 280px; }
.skel-rows .skel { height: 14px; margin: 12px 0; }
.skel-rows .skel:nth-child(2n) { width: 70%; }
.skel-board { height: 340px; }
.foot { color: var(--muted); font-size: 12px; line-height: 1.6; max-width: 110ch; }
.blockerr { color: var(--muted); }
.blockerr button { background: none; border: 0; color: var(--text); text-decoration: underline; cursor: pointer; padding: 0 4px; }
.err { color: var(--confirmed); min-height: 18px; margin-top: 8px; font-size: 12.5px; }

/* forms: the reference's inset selects and inputs */
label { color: var(--muted); font-size: 11px; }
input, select, textarea {
  border: none; padding: 8px 12px; border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 12.5px;
  box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
}
textarea { min-height: 76px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); }
.loginwrap { max-width: 440px; margin: 0 auto; }
.login { display: flex; flex-direction: column; gap: 6px; }
.login label { margin-top: 6px; }
.login .btn { align-self: flex-start; margin-top: 8px; padding: 8px 16px; font-size: 12.5px; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.25); display: flex; justify-content: flex-end; z-index: 20; }
.sheetin { width: min(440px, 100%); height: 100%; overflow-y: auto; background: var(--bg); padding: 22px 26px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: -8px 0 16px var(--shadow-dark); }
.sheetin h2 { font-size: 15px; font-weight: 700; }
.sheetin form { display: flex; flex-direction: column; gap: 6px; }
.sheetin form label { margin-top: 6px; }
.sheetin .row { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.mapcard { margin-bottom: 24px; }
.maptable { min-width: 820px; }
.maptable tr.past td, .maptable tr.past td b { color: var(--muted); font-weight: 400; }
.maptable tr.grp td { border-top: 1px solid rgba(128,128,128,0.25); }
.maptable .eid, .maptable td.dt { font-variant-numeric: tabular-nums; }
.maptable .was { color: var(--muted); font-size: 12px; }
.maptable td.note { white-space: normal; color: var(--muted); font-size: 12px; max-width: 34ch; }

/* assistant: a raised round button bottom-right; a panel above it; a spotlight that dims the rest of the page */
.botbtn { position: fixed; right: 24px; bottom: 24px; z-index: 40; width: 68px; height: 68px; border-radius: 50%; border: none; cursor: pointer; padding: 0;
  background: var(--bg); display: grid; place-items: center; box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light); }
.botbtn img { width: 52px; height: 52px; }
.botbtn[aria-expanded="true"] { box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light); }
.botcatch { position: fixed; inset: 0; z-index: 36; cursor: pointer; }
.botspot { position: fixed; z-index: 37; border-radius: 16px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(20,24,32,0.42), 0 0 0 3px var(--active);
  transition: top 0.35s cubic-bezier(0.16, 1, 0.3, 1), left 0.35s cubic-bezier(0.16, 1, 0.3, 1), width 0.35s cubic-bezier(0.16, 1, 0.3, 1), height 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
.botbox { position: fixed; right: 24px; bottom: 106px; z-index: 39; width: min(400px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 140px));
  display: flex; flex-direction: column; gap: 10px; background: var(--bg); border-radius: 20px; padding: 18px 20px;
  box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light); }
.bothead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.bothead b { font-size: 15px; }
.botmsgs { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.botmsg { font-size: 13px; line-height: 1.6; color: var(--text); white-space: pre-wrap; }
.botmsg h4 { margin: 0 0 4px; font-size: 13px; color: var(--active); }
.botmsg.me { align-self: flex-end; max-width: 85%; padding: 8px 12px; border-radius: 12px; color: var(--text);
  box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light); }
.botmsg.wait { color: var(--muted); }
.botmsg.err { color: var(--confirmed); }
.bothint { font-size: 12px; color: var(--muted); margin: 0; }
.bottools { display: flex; gap: 14px; margin-top: -4px; }
.bottools .linkbtn { font-size: 12px; font-weight: 400; color: var(--muted); padding: 0; }
.botmsg.earlier { color: var(--muted); }
.botform { display: flex; gap: 8px; }
.botform input { flex: 1; min-width: 0; }
@media (max-width: 720px) { .botbtn { right: 16px; bottom: 16px; width: 58px; height: 58px; } .botbtn img { width: 44px; height: 44px; } .botbox { right: 16px; bottom: 86px; } }
@media (prefers-reduced-motion: reduce) { .botspot { transition: none; } }

@media (max-width: 1100px) {
  .grid, .apgrid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  body { padding: 20px 16px; }
  .panel { padding: 18px 16px; }
  .card { padding: 18px; }
  .daynight { margin-left: 0; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; padding: 4px 4px 12px; margin-inline: -4px; scrollbar-width: none; }
  .tabs a { flex: none; }
  .presets { display: none; }
  .presetsel { display: block; }
  .trace li { grid-template-columns: 90px minmax(0,1fr); }
  .steps li { grid-template-columns: 1fr; }
  .steps li::before { grid-row: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
