/* Keystone remote console. Palette and type: docs/console-design.md. No external fonts, no images. */
:root {
  --ink: #14212d;        /* sidebar, headings */
  --ink-2: #2d3d4c;
  --paper: #eef1f4;      /* page */
  --surface: #ffffff;
  --line: #d3dae1;
  --line-2: #e5eaef;
  --muted: #5a6773;
  --titano: #1a5a86;     /* primary: San Marino azure, deepened for contrast */
  --titano-d: #124566;
  --sky: #7cc4ea;        /* flag azure: accents on dark */
  --brass: #c9952f;      /* badges */
  --ok: #1e7a4c;   --ok-bg: #e2f2e9;   --ok-ln: #a9d5bd;
  --warn: #8f5600; --warn-bg: #fdefd6; --warn-ln: #e8c27a;
  --bad: #b42318;  --bad-bg: #fce8e6;  --bad-ln: #ecb3ad;
  --off: #55616c;  --off-bg: #e8ecef;  --off-ln: #c5cdd4;
  --busy: #1a5a86; --busy-bg: #e1edf6; --busy-ln: #a8c7de;
  --new: #5a3f9e;  --new-bg: #eee9f8;  --new-ln: #c9bce9;
  --wait: #475a70; --wait-bg: #e7ecf2; --wait-ln: #bcc8d5;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;
  --radius: 4px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45; -webkit-text-size-adjust: 100%;
}
a { color: var(--titano); text-underline-offset: 2px; }
a:hover { color: var(--titano-d); }
h1, h2, h3 { line-height: 1.2; color: var(--ink); }
h1 { font-size: 1.62rem; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 1.12rem; font-weight: 650; margin: 0 0 .25rem; }
h3 { font-size: 1rem; font-weight: 650; margin: 0 0 .2rem; }
p { margin: .3rem 0; }
code, .mono { font-family: var(--mono); font-size: .86em; }
:focus-visible { outline: 3px solid var(--titano); outline-offset: 2px; border-radius: 2px; }
.side :focus-visible { outline-color: var(--sky); }
.skip { position: absolute; left: -9999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.muted, .sub { color: var(--muted); }
.sub { display: block; font-size: .84rem; font-weight: 400; }
[hidden] { display: none !important; }

/* ---- frame ---- */
.testbar {
  background: repeating-linear-gradient(135deg, #a3200f 0 12px, #b42318 12px 24px);
  color: #fff; font-size: .8rem; padding: 3px 14px; letter-spacing: .01em;
}
.testbar strong { font-weight: 700; margin-right: .4em; }
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 24px);
  background: linear-gradient(to right, var(--ink) 250px, var(--paper) 250px); }
body.no-side .shell { grid-template-columns: 1fr; background: none; }
.side {
  background: var(--ink); color: #cfdbe6; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; padding-bottom: 14px; border-left: 4px solid transparent;
  border-image: linear-gradient(to bottom, #fff 0 50%, var(--sky) 50% 100%) 1;
}
.brand { padding: 16px 16px 12px; }
.brand-link { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-link:hover { color: #fff; }
.mark { fill: var(--sky); flex: none; }
.brand-name { font-size: 1.18rem; font-weight: 700; letter-spacing: .01em; display: flex; flex-direction: column; line-height: 1.1; }
.brand-name small { font-size: .74rem; font-weight: 400; color: #9fb4c6; letter-spacing: 0; }
.mainnav ul { list-style: none; margin: 4px 0; padding: 0; }
.mainnav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px 8px 13px;
  color: #c9d6e2; text-decoration: none; border-left: 3px solid transparent; font-size: .95rem;
}
.mainnav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.mainnav a[aria-current] { color: #fff; background: rgba(124,196,234,.13); border-left-color: var(--sky); font-weight: 600; }
.badge { background: var(--brass); color: var(--ink); font-size: .74rem; font-weight: 700; border-radius: 9px; padding: 0 7px; min-width: 20px; text-align: center; }
.who { margin-top: auto; padding: 14px 16px 6px; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: 1px; font-size: .84rem; }
.who-name { color: #fff; font-weight: 600; font-size: .92rem; }
.who-org, .who-roles { color: #9fb4c6; }
.linkish { background: none; border: 0; padding: 0; margin-top: 6px; color: var(--sky); text-decoration: underline; cursor: pointer; font: inherit; }
.langs { display: flex; gap: 10px; padding: 6px 16px; font-size: .84rem; }
.langs a { color: #9fb4c6; }
.langs [aria-current] { color: #fff; font-weight: 600; }
main { padding: 22px 34px 64px; max-width: 1320px; width: 100%; }
main:focus { outline: none; }
.pagehead { margin-bottom: 14px; }
.pagehead-row { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-actions form { margin: 0; }
.lead { color: var(--muted); margin: .4rem 0 0; max-width: 78ch; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.crumbs ol { list-style: none; margin: 0 0 6px; padding: 0; display: flex; gap: 6px; font-size: .86rem; }
.crumbs li::after { content: "/"; margin-left: 6px; color: var(--muted); }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius); margin: 0 0 16px; border: 1px solid; border-left-width: 5px; }
.flash.is-ok { background: var(--ok-bg); border-color: var(--ok-ln); border-left-color: var(--ok); }
.flash.is-bad { background: var(--bad-bg); border-color: var(--bad-ln); border-left-color: var(--bad); }
.flash .ic { margin-top: 4px; flex: none; }

/* ---- sections ---- */
.block { margin: 24px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.pagehead + .block, .tabs + .block, .tabs + section.block, .filters + div > .block { border-top: 0; padding-top: 0; }
.block.subtle { border-top-style: dashed; }
.help { color: var(--muted); font-size: .92rem; margin: .15rem 0 .8rem; max-width: 82ch; }
.lead-help { margin-top: 4px; }
.note { color: var(--ink-2); font-size: .9rem; display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.empty { background: var(--surface); border: 1px dashed #b5c1cc; border-radius: var(--radius); padding: 26px; text-align: center; color: var(--ink-2); }
.empty p { margin: .4rem auto; max-width: 60ch; }
.empty-inline { color: var(--muted); display: flex; gap: 8px; align-items: center; }
.more { margin: 10px 0 0; font-size: .92rem; }
.todo { font-weight: 600; margin: 6px 0; }

/* ---- status ---- */
.ic { flex: none; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px 1px 7px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; white-space: nowrap; border: 1px solid; line-height: 1.5; vertical-align: middle;
}
.pill.is-ok, .pill.is-done { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-ln); }
.pill.is-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-ln); }
.pill.is-bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-ln); }
.pill.is-off { color: var(--off); background: var(--off-bg); border-color: var(--off-ln); }
.pill.is-busy { color: var(--busy); background: var(--busy-bg); border-color: var(--busy-ln); }
.pill.is-new { color: var(--new); background: var(--new-bg); border-color: var(--new-ln); }
.pill.is-wait { color: var(--wait); background: var(--wait-bg); border-color: var(--wait-ln); }
.say { display: flex; gap: 10px; align-items: flex-start; font-size: 1.05rem; padding: 12px 14px; border-radius: var(--radius); border-left: 5px solid; margin: 0 0 12px; background: var(--surface); }
.say .ic { margin-top: 6px; }
.say.is-ok, .say.is-done { border-color: var(--ok); color: var(--ink); } .say.is-ok .ic, .say.is-done .ic { color: var(--ok); }
.say.is-warn { border-color: var(--warn); background: var(--warn-bg); } .say.is-warn .ic { color: var(--warn); }
.say.is-bad { border-color: var(--bad); background: var(--bad-bg); } .say.is-bad .ic { color: var(--bad); }
.say.is-off { border-color: var(--off); background: var(--off-bg); } .say.is-off .ic { color: var(--off); }
.say.is-busy { border-color: var(--busy); background: var(--busy-bg); } .say.is-busy .ic { color: var(--busy); }
.say.is-new { border-color: var(--new); background: var(--new-bg); } .say.is-new .ic { color: var(--new); }
.say.is-wait { border-color: var(--wait); background: var(--wait-bg); } .say.is-wait .ic { color: var(--wait); }

/* ---- home ---- */
.headline { display: flex; gap: 10px; align-items: center; font-size: 1.3rem; font-weight: 600; margin: 4px 0 14px; }
.headline .ic { width: 16px; height: 16px; }
.headline.is-ok .ic { color: var(--ok); } .headline.is-warn .ic { color: var(--warn); } .headline.is-bad .ic { color: var(--bad); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 16px 14px; background: var(--surface);
  border: 1px solid var(--line); border-left: 6px solid; border-radius: var(--radius); color: var(--ink); text-decoration: none;
}
.tile:hover { border-color: #9fb0bf; color: var(--ink); background: #fbfcfd; }
.tile.is-ok { border-left-color: var(--ok); } .tile.is-off { border-left-color: var(--off); }
.tile.is-warn { border-left-color: var(--warn); } .tile.is-bad { border-left-color: var(--bad); } .tile.is-new { border-left-color: var(--new); }
.tile-n { font-size: 2.3rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile-label { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink-2); }
.tile.is-ok .ic { color: var(--ok); } .tile.is-off .ic { color: var(--off); } .tile.is-warn .ic { color: var(--warn); }
.tile.is-bad .ic { color: var(--bad); } .tile.is-new .ic { color: var(--new); }
.quick ul { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.action {
  display: flex; flex-direction: column; gap: 3px; height: 100%; padding: 13px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink);
}
.action b { color: var(--titano); font-size: 1.04rem; }
.action span { color: var(--muted); font-size: .88rem; }
.action:hover { border-color: var(--titano); color: var(--ink); }
.action.primary { background: var(--titano); border-color: var(--titano); }
.action.primary b { color: #fff; } .action.primary span { color: #d3e5f2; }
.action.primary:hover { background: var(--titano-d); }
.items { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.items > li + li { border-top: 1px solid var(--line-2); }
.items a { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 14px; color: var(--ink); text-decoration: none; }
.items a:hover { background: #f5f8fb; }
.item-text { font-weight: 600; }
.item-meta { color: var(--muted); font-size: .88rem; }
.items .segbar { flex-basis: 100%; }
a.serial { white-space: nowrap; }
::placeholder { color: #8b97a2; opacity: 1; }
.filters label.grow { max-width: 560px; }
.action-row:has(form.stack) { align-items: start; }
.ro-item a { display: block; }
.ro-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 8px; }
.firstrun { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
ol.steps { list-style: none; counter-reset: step; margin: 6px 0 0; padding: 0; }
ol.steps > li { counter-increment: step; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-2); }
ol.steps > li::before { content: counter(step); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; background: var(--titano); color: #fff; font-weight: 700; display: grid; place-items: center; }
ol.steps > li > span { grid-column: 2; color: var(--muted); font-size: .92rem; }
ol.steps > li > .btn { grid-column: 3; grid-row: 1 / span 2; }
ol.steps.small > li { grid-template-columns: 34px minmax(0, 1fr); }

/* ---- tables ---- */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.list { width: 100%; border-collapse: collapse; font-size: .94rem; }
table.list th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--muted); background: #f5f7f9; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.list tbody tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover td { background: #f8fafc; }
table.list td a b { font-weight: 650; }
table.list.compact td { padding: 6px 10px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.sel, td.sel { width: 34px; }
table.kv { border-collapse: collapse; font-size: .88rem; width: 100%; }
table.kv th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 12px 4px 0; vertical-align: top; white-space: nowrap; width: 1%; }
table.kv td { padding: 4px 0; font-family: var(--mono); font-size: .82rem; word-break: break-all; }
pre.json { background: #f5f7f9; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; font-family: var(--mono); font-size: .8rem; max-height: 360px; overflow: auto; white-space: pre-wrap; }
ul.plain { list-style: none; padding: 0; margin: 4px 0; }
ul.plain li { padding: 5px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---- controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; min-height: 36px;
  border: 1px solid #b4c0cb; background: var(--surface); color: var(--ink); border-radius: var(--radius);
  font: inherit; font-weight: 600; font-size: .94rem; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f1f4f7; border-color: #8ea0af; color: var(--ink); }
.btn.primary { background: var(--titano); border-color: var(--titano); color: #fff; }
.btn.primary:hover { background: var(--titano-d); border-color: var(--titano-d); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { background: #911b12; }
.btn.danger-ghost { color: var(--bad); border-color: var(--bad-ln); }
.btn.danger-ghost:hover { background: var(--bad-bg); color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--titano); }
.btn.ghost:hover { background: #e4ecf3; }
.btn.small { padding: 3px 10px; min-height: 30px; font-size: .86rem; }
.btn.big { padding: 11px 22px; font-size: 1.04rem; }
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.btnrow form { margin: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .86rem; font-weight: 600; color: var(--ink-2); }
input, select, textarea {
  font: inherit; font-size: .95rem; font-weight: 400; color: var(--ink); background: #fff; border: 1px solid #a9b6c2;
  border-radius: var(--radius); padding: 6px 9px; min-height: 36px; max-width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--titano); outline-offset: 1px; border-color: var(--titano); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 17px; height: 17px; accent-color: var(--titano); margin: 0; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); font-size: .92rem; }
label.check .sub { display: inline; margin-left: 4px; }
.big-input { font-size: 1.15rem; letter-spacing: .03em; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.stack.narrow { max-width: 460px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 16px; align-items: end; }
.grid-form .wide { grid-column: 1 / -1; }
.grow { flex: 1 1 220px; }
.filters {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px;
}
fieldset.checks { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px 10px; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; }
fieldset.checks legend { font-size: .86rem; font-weight: 600; color: var(--ink-2); padding: 0 4px; }
fieldset.roles { flex-direction: column; }
.roles-inline { gap: 6px 14px; align-items: center; }
.bulkbar {
  position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end;
  background: #f7f9fb; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px;
}
.bulk-count { font-weight: 600; align-self: center; margin-right: auto; }
.pickhint { flex-basis: 100%; margin: 0; display: flex; gap: 8px; align-items: center; color: var(--busy); font-weight: 600; }
details.tech { border: 1px dashed #b5c1cc; border-radius: var(--radius); margin: 18px 0; background: rgba(255,255,255,.5); }
details.tech > summary { padding: 9px 12px; cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: .92rem; }
details.tech .details-body { padding: 2px 12px 12px; }
details.tech.mini { margin: 0; border: 0; background: none; }
details.tech.mini > summary { padding: 0; font-size: .84rem; color: var(--titano); }
details.tech.mini .details-body { padding: 6px 0 0; min-width: 320px; }
details.tech h3 { margin-top: 14px; }

/* ---- tabs ---- */
.tabs ul { list-style: none; display: flex; flex-wrap: wrap; gap: 2px; margin: 0 0 16px; padding: 0; border-bottom: 2px solid var(--line); }
.tabs a { display: block; padding: 9px 15px; color: var(--ink-2); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; font-weight: 500; }
.tabs a:hover { color: var(--titano); }
.tabs a[aria-current] { color: var(--titano); border-bottom-color: var(--titano); font-weight: 650; }

/* ---- cabinet page ---- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 18px; margin: 4px 0 0; }
.facts div { min-width: 0; }
.facts dt { color: var(--muted); font-size: .82rem; }
.facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.facts.compact { grid-template-columns: 60px 1fr; gap: 4px 10px; }
.facts.compact div { display: contents; }
.facts.compact dt { font-family: var(--mono); font-weight: 700; color: var(--ink); }
.actions { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; }
.action-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 22px; padding: 14px 0; border-bottom: 1px solid var(--line-2); align-items: center; }
.actions > .action-row:last-of-type, .maker > .action-row:last-child { border-bottom: 0; }
.action-text p { color: var(--muted); font-size: .9rem; max-width: 62ch; margin: 2px 0 0; }
.action-row.is-primary h3 { color: var(--titano); }
.action-row.is-danger h3 { color: var(--bad); }
.action-ctl form { margin: 0; }
.maker { background: #f8f6fb; border: 1px solid var(--new-ln); border-radius: var(--radius); padding: 14px 16px; }
.maker > h2 { color: var(--new); }
.actions .note { padding: 4px 0 12px; }

/* gauges and charts */
.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.gauge { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--ok); border-radius: var(--radius); padding: 12px 14px; }
.gauge.is-warn { border-top-color: var(--warn); } .gauge.is-bad { border-top-color: var(--bad); }
.gauge-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.gauge-v { font-size: 1.28rem; font-weight: 650; font-variant-numeric: tabular-nums; margin: 4px 0 6px; }
.gauge .help { margin: 6px 0 0; font-size: .84rem; }
svg.level { width: 100%; height: 14px; display: block; }
svg .track { fill: #e1e6eb; }
.lv-ok { fill: var(--ok); } .lv-warn { fill: var(--warn); } .lv-bad { fill: var(--bad); }
.mark-warn, .mark-bad { stroke-width: 2.5px; vector-effect: non-scaling-stroke; }
.mark-warn { stroke: var(--warn); } .mark-bad { stroke: var(--bad); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: .82rem; color: var(--muted); margin-top: 6px; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 5px 0 12px; }
.legend .lg:first-child { margin-left: 0; }
.lg-ok { background: var(--ok); } .lg-busy { background: var(--titano); } .lg-bad { background: var(--bad); }
.lg-gone { background: #97a3ae; } .lg-track { background: #e1e6eb; border: 1px solid #c5ced6; } .lg-warn { background: var(--warn); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 12px; }
figure.chart { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 6px; position: relative; }
figure.chart figcaption { font-weight: 600; font-size: .92rem; margin-bottom: 2px; }
svg.hist { width: 100%; height: auto; display: block; overflow: visible; }
svg.hist .grid { stroke: #d3dae1; stroke-width: 1; }
svg.hist .grid.faint { stroke-dasharray: 2 4; }
svg.hist .ax { fill: var(--muted); font-size: 12px; }
svg.hist .area { fill: rgba(26, 90, 134, .10); }
svg.hist .line { fill: none; stroke: var(--titano); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.hist .last { fill: var(--titano); stroke: #fff; stroke-width: 2; }
svg.hist line.thr { stroke-width: 1.5; stroke-dasharray: 6 4; }
svg.hist line.thr-warn { stroke: var(--warn); } svg.hist line.thr-bad { stroke: var(--bad); }
svg.hist text.thr-label { font-size: 12px; font-weight: 600; }
svg.hist text.thr-warn { fill: var(--warn); } svg.hist text.thr-bad { fill: var(--bad); }
svg.hist .cross { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
svg.hist .dot { fill: var(--titano); stroke: #fff; stroke-width: 2; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: .8rem; padding: 4px 8px; border-radius: 3px; white-space: nowrap; transform: translate(-50%, -110%); }

/* waves */
ol.waves { list-style: none; display: flex; gap: 8px; margin: 6px 0 0; padding: 0; flex-wrap: wrap; }
li.wave { flex: 1 1 0; min-width: 96px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px 9px; position: relative; }
li.wave + li.wave::before { content: ""; position: absolute; left: -9px; top: 50%; width: 8px; border-top: 2px solid var(--line); }
li.wave.is-current { border-color: var(--titano); box-shadow: inset 0 3px 0 var(--titano); }
li.wave.is-past { background: #f8fafb; }
.wave-title { font-weight: 650; font-size: .86rem; }
.wave-n { float: right; color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; }
svg.segbar { width: 100%; height: 8px; display: block; margin-top: 6px; }
.seg-ok { fill: var(--ok); } .seg-busy { fill: var(--titano); } .seg-bad { fill: var(--bad); } .seg-gone { fill: #97a3ae; }
.prog { display: inline-block; width: 180px; vertical-align: middle; margin-right: 8px; }
.prog svg { width: 100%; height: 6px; display: block; }
.prog .fill { fill: var(--ok); }
.ro-progress { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; font-weight: 600; }
.ro-progress .prog { width: 280px; }
.ro-list .segbar { margin-top: 2px; }
ol.timeline { margin: 0; padding-left: 18px; font-size: .88rem; }
ol.timeline li { margin: 3px 0; }

/* game order */
ol.order { list-style: none; margin: 0 0 12px; padding: 0; max-width: 760px; }
li.order-item { display: grid; grid-template-columns: 18px 30px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 7px 10px; background: var(--surface); border: 1px solid var(--line); margin-top: -1px; }
li.order-item:first-child { border-radius: var(--radius) var(--radius) 0 0; }
li.order-item:last-child { border-radius: 0 0 var(--radius) var(--radius); }
li.order-item[draggable=true] .grip { cursor: grab; }
.grip { color: #9aa7b3; letter-spacing: -2px; user-select: none; }
.pos { font-weight: 700; color: var(--titano); font-variant-numeric: tabular-nums; text-align: right; }
.oname { font-weight: 600; }
.oname .sub { display: inline; }
.updown { display: flex; gap: 2px; }
li.order-item.dragging { opacity: .45; }
li.order-item.drop-before { box-shadow: inset 0 3px 0 var(--titano); }
li.order-item.drop-after { box-shadow: inset 0 -3px 0 var(--titano); }
.pin { font-size: .86rem; }

/* wizard */
.stepper { list-style: none; display: none; margin: 0 0 18px; padding: 0; gap: 4px; counter-reset: st; flex-wrap: wrap; }
.wizard.js .stepper { display: flex; }
.stepper li { counter-increment: st; flex: 1 1 0; min-width: 110px; }
.stepper button { width: 100%; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-bottom: 4px solid var(--line); padding: 8px 10px; font: inherit; font-size: .9rem; color: var(--muted); cursor: pointer; text-align: left; }
.stepper button::before { content: counter(st); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--off-bg); color: var(--ink-2); font-weight: 700; font-size: .8rem; flex: none; }
.stepper button.is-done { color: var(--ink-2); border-bottom-color: var(--ok); }
.stepper button.is-done::before { background: var(--ok); color: #fff; }
.stepper button[aria-current] { color: var(--ink); font-weight: 650; border-bottom-color: var(--titano); }
.stepper button[aria-current]::before { background: var(--titano); color: #fff; }
.step { border: 0; padding: 0; margin: 0 0 26px; min-width: 0; }
.step > legend { font-size: 1.22rem; font-weight: 650; padding: 0; margin-bottom: 4px; }
.wizard.js .step { display: none; }
.wizard.js .step.is-active { display: block; }
.step > label, .step > .when-action label, .step .when-window label, .when-custom { margin-top: 12px; max-width: 520px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin: 10px 0; }
.choices.row { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.choice { flex-direction: row; align-items: flex-start; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; font-weight: 400; color: var(--ink); }
.choice:hover { border-color: #8ea0af; }
.choice:has(input:checked) { border-color: var(--titano); background: #edf4fa; box-shadow: inset 0 0 0 1px var(--titano); }
.choice input { margin-top: 3px; flex: none; }
.choice > span { display: flex; flex-direction: column; gap: 2px; }
.choice b { font-size: .98rem; }
.choice span span { color: var(--muted); font-size: .86rem; }
.venue-block h3 { margin: 16px 0 6px; }
.venue-block h3 label { font-size: 1rem; font-weight: 650; color: var(--ink); }
.preview, .review { margin-top: 14px; }
.review { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--titano); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px; }
.review .r-what { font-size: 1.12rem; font-weight: 650; margin: 0 0 8px; }
.review ul { margin: 6px 0 12px; padding-left: 18px; }
.review li { margin: 3px 0; }
.wiz-nav { display: none; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.wizard.js .wiz-nav { display: flex; }
.canary-count { font-weight: 600; }
.when-window { margin-top: 10px; }

/* approvals inbox */
.inbox { list-style: none; margin: 0; padding: 0; }
.inbox-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--wait); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.inbox-item h3 { font-size: 1.05rem; }
.inbox-item h3 a { color: var(--ink); text-decoration: none; }
.inbox-item h3 a:hover { color: var(--titano); text-decoration: underline; }
.inbox-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.decide { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; max-width: 640px; }

/* OTP */
.warnbox { display: flex; gap: 12px; align-items: flex-start; background: var(--warn-bg); border: 1px solid var(--warn-ln); border-left: 6px solid var(--warn); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.warnbox > .ic { width: 18px; height: 18px; color: var(--warn); margin-top: 2px; }
.warnbox p { max-width: 80ch; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; }
.two > .block { border-top: 0; padding-top: 0; margin-top: 0; }
.otp-result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; max-width: 640px; }
.otp-for { font-size: 1.05rem; margin: 0 0 12px; }
.otp-code { font-family: var(--mono); font-size: 3rem; font-weight: 700; letter-spacing: .12em; display: inline-block; padding: 12px 26px; border: 2px solid var(--ink); border-radius: 6px; margin: 4px 0 16px; background: #fbfcfd; user-select: all; }
.otp-code.small { font-size: 1.5rem; padding: 8px 16px; }
.checks-list li { gap: 8px; }
.checks-list .ic { color: var(--warn); }

/* misc */
.pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.login { max-width: 400px; margin: 30px auto; background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--titano); border-radius: var(--radius); padding: 24px 26px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-brand .mark { fill: var(--titano); width: 44px; height: 32px; }
.login-brand b { display: block; font-size: 1.3rem; }
.login-brand span { color: var(--muted); font-size: .9rem; }
.login .stack { max-width: none; }
.login .hint { color: var(--muted); font-size: .84rem; margin-top: 14px; }
.login .langs { padding: 10px 0 0; }
.login .langs a { color: var(--titano); }
.login .langs [aria-current] { color: var(--ink); }
body.no-side .pagehead { max-width: 400px; margin: 20px auto 0; }
dialog.confirm { border: 1px solid var(--line); border-top: 5px solid var(--titano); border-radius: 6px; padding: 20px 22px; max-width: 520px; width: calc(100% - 32px); color: var(--ink); box-shadow: 0 18px 48px rgba(20, 33, 45, .28); }
dialog.confirm.is-danger { border-top-color: var(--bad); }
dialog.confirm::backdrop { background: rgba(20, 33, 45, .45); }
dialog.confirm h2 { margin-bottom: 8px; }
dialog.confirm p { font-size: 1.02rem; margin: 0 0 18px; }
dialog.confirm .btnrow { justify-content: flex-end; }
.session-gone { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 4px; z-index: 20; }

/* ---- tablet and narrower ---- */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-left: 0; border-top: 4px solid; border-image: linear-gradient(to right, #fff 0 50%, var(--sky) 50% 100%) 1; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0 8px 6px; }
  .brand { padding: 10px 8px; }
  .mainnav { flex: 1 1 100%; order: 3; overflow-x: auto; }
  .mainnav ul { display: flex; gap: 2px; }
  .mainnav a { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 10px; white-space: nowrap; }
  .mainnav a[aria-current] { border-bottom-color: var(--sky); }
  .who { margin: 0 0 0 auto; border: 0; padding: 6px 8px; flex-direction: row; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
  .who-roles { display: none; }
  .linkish { margin: 0; }
  .langs { padding: 6px 8px; }
  main { padding: 18px 18px 48px; }
  .action-row { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
  .inbox-item { grid-template-columns: 1fr; }
  .inbox-side { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 600px) {
  html { font-size: 14px; }
  .otp-code { font-size: 2rem; }
  li.order-item { grid-template-columns: 14px 24px minmax(0, 1fr); }
  li.order-item .pin, li.order-item .updown { grid-column: 3; }
}
@media (forced-colors: active) {
  .pill, .tile, .gauge { border: 1px solid CanvasText; }
}
