/* ComputerWorld console, in the exocortex type and palette (Inter Tight, near-white frame,
   black type, round-ended buttons). The sidebar sits on the frame and the work on a white
   sheet; nothing on the sheet is boxed. Parts of a page are told apart by space and a small
   heading, rows by a hairline. Borders stay on controls, screens and what floats. */
:root {
  --frame: #f5f5f3;      /* the sidebar */
  --frame-2: #e9e8e4;    /* the active nav item */
  --sheet: #ffffff;
  --raised: #f5f5f3;     /* hover and selected rows, field fills */
  --line: #e6e5e0;       /* control edges, toolbar rules */
  --line-2: #efeeea;     /* row rules */
  --control: #d3d1ca;    /* control borders */
  --ink: #111111;
  --ink-2: #3a3a3a;
  --muted: #67655f;      /* meta text, 5.6:1 on white */
  --faint: #8a8882;      /* only for large or decorative text */
  --ok: #2b8a56; --warn: #9a6500; --bad: #b3261e;
  --ok-tint: #e7f3ec; --warn-tint: #faf3e3; --bad-tint: #f9e6e4;
  --code-bg: #141414; --code-base: #d6d5cf; --code-key: #ffffff; --code-str: #a9c7a0; --code-lit: #e9b77a; --code-com: #7a7873; --code-pun: #9b9a94;
  /* the swarm palette from scripts/procedures/swarm.py: validated categorical slots and a context grey */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #8d5bd1; --context: #c9c7c0;
  --f: "Inter Tight", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --pad: 28px;           /* the sheet's side margin */
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--frame); color: var(--ink); font: 400 14px/1.5 var(--f); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd, pre, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
::selection { background: var(--ink); color: #fff; }
.mono, code, pre { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--frame); position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; gap: 20px; padding: 18px 10px 10px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 12px; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; text-decoration: none; }
.mark { flex: none; width: 18px; height: 18px; border-radius: 5px; background: var(--ink); position: relative; }
.mark::after { content: ""; position: absolute; inset: 4.5px 4.5px 7px; border-radius: 1.5px; background: var(--frame); }
.side nav { display: grid; gap: 18px; }
.side nav a { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; transition: background-color 120ms ease, color 120ms ease; }
.side nav a svg { flex: none; opacity: 0.65; }
.side nav a:hover { color: var(--ink); background: rgba(0, 0, 0, 0.035); }
.side nav a[aria-current="page"] { background: var(--frame-2); color: var(--ink); font-weight: 500; }
.side nav a[aria-current="page"] svg { opacity: 1; }
.side__foot { margin-top: auto; }

.me { position: relative; }
.me__btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: none; border: 0; cursor: pointer; text-align: left; transition: background-color 120ms ease; }
.me__btn:hover, .me__btn[aria-expanded="true"] { background: var(--frame-2); }
.avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; font: 500 11px/1 var(--f); }
.me__who { min-width: 0; flex: 1; line-height: 1.3; }
.me__who b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me__who span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me__menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); background: var(--sheet); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 32px -16px rgba(0, 0, 0, 0.25); padding: 5px; z-index: 30; }
.me__menu a, .me__menu button { display: flex; width: 100%; justify-content: space-between; align-items: center; height: 32px; padding: 0 10px; border-radius: 6px; background: none; border: 0; text-align: left; color: var(--ink); text-decoration: none; cursor: pointer; }
.me__menu a:hover, .me__menu button:hover { background: var(--raised); }

.topbar { display: none; }
main { background: var(--sheet); padding: 18px var(--pad) 72px; min-width: 0; min-height: 100svh; }
/* A page that is one tool (the topology editor) fills the sheet edge to edge. */
main.full { padding: 0; height: 100svh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ---------- page parts ---------- */
.bar { display: flex; align-items: center; gap: 8px 16px; min-height: 36px; margin-bottom: 14px; flex-wrap: wrap; }
.bar h1 { font-size: 18px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.2; }
.bar .meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.bar .meta b { font-weight: 400; color: var(--ink-2); }
.bar__t { flex: 1 1 320px; min-width: 0; display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
.bar__acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; margin-left: auto; }
.sec + .sec, .bar + .sec.spaced { margin-top: 36px; }
.sec__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; margin-bottom: 2px; flex-wrap: wrap; }
.sec__head h2 { font-size: 14px; font-weight: 500; letter-spacing: -0.005em; }
.sec__head .muted { font-size: 13px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 48px; align-items: start; }
.cols > .sec + .sec { margin-top: 0; }
.cols + .sec, .sec + .cols { margin-top: 36px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border: 1px solid var(--control); border-radius: 999px; background: var(--sheet); color: var(--ink); cursor: pointer; font-size: 13.5px; font-weight: 500; white-space: nowrap; text-decoration: none; transition: background-color 120ms ease, border-color 120ms ease, transform 100ms ease; }
.btn:hover { border-color: var(--ink-2); background: var(--raised); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #333; border-color: #333; }
.btn.danger { color: var(--bad); }
.btn.danger.armed { background: var(--bad-tint); border-color: #e3a9a3; }
.btn.sm { height: 28px; padding: 0 11px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--raised); border-color: transparent; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:disabled:hover { background: var(--sheet); border-color: var(--control); }
.btn.primary:disabled:hover { background: var(--ink); border-color: var(--ink); }
/* a button that reads as a link: Edit and Save on settings rows */
.lnk { background: none; border: 0; padding: 4px 0; font: 500 14px var(--f); color: var(--ink); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: var(--control); }
.lnk:hover { text-decoration-color: currentColor; }
.lnk:disabled { opacity: 0.45; cursor: default; }
.field { height: 32px; padding: 0 10px; border: 1px solid var(--control); border-radius: 8px; background: var(--sheet); color: var(--ink); min-width: 0; transition: border-color 120ms ease; }
.field::placeholder { color: var(--faint); }
textarea.field { height: auto; padding: 9px 10px; resize: vertical; width: 100%; font: 12px/1.6 var(--mono); }
select.field { padding-right: 6px; }
.field:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
.field.bad { border-color: var(--bad); }
label.lbl, span.lbl { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .field, .stack > div > .field, .modal .field { width: 100%; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stack { display: grid; gap: 14px; align-content: start; }
.tw { overflow-x: auto; }

/* Tables: rules and alignment. The first and last columns sit on the page's edges. */
table { width: 100%; border-collapse: collapse; }
th { font-weight: 500; font-size: 12px; color: var(--muted); text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
th.num, td.num { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--raised); }
tbody tr.click:hover td:first-child { box-shadow: -8px 0 0 var(--raised); }
tbody tr.click:hover td:last-child { box-shadow: 8px 0 0 var(--raised); }
tr.none td { color: var(--muted); padding: 14px 0; }
.sub { display: block; font: 400 11.5px/1.5 var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.desc { display: block; color: var(--muted); font-size: 13px; max-width: min(72ch, 58vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td .name { font-weight: 500; text-decoration: none; }
td .acts { display: flex; gap: 6px; justify-content: flex-end; }

/* status: a dot and a word */
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--muted); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); }
.tag { display: inline-block; font: 500 11.5px/20px var(--f); padding: 0 8px; border-radius: 999px; background: var(--raised); color: var(--ink-2); white-space: nowrap; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }

pre.code { background: var(--code-bg); color: var(--code-base); padding: 14px 16px; border-radius: 10px; overflow: auto; font: 400 12px/1.65 var(--mono); tab-size: 2; }
.tk-key { color: var(--code-key); } .tk-str { color: var(--code-str); } .tk-lit { color: var(--code-lit); } .tk-com { color: var(--code-com); } .tk-pun { color: var(--code-pun); }

.skel { height: 14px; border-radius: 4px; background: var(--raised); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
.err-line { color: var(--bad); font-size: 13.5px; }
.err-line:empty { display: none; }
.note { padding: 10px 12px; border-radius: 8px; background: var(--raised); font-size: 13px; color: var(--ink-2); }

.seg { display: inline-flex; border: 1px solid var(--control); border-radius: 999px; padding: 2px; gap: 2px; background: var(--sheet); }
.seg button { background: none; border: 0; padding: 0 11px; height: 26px; border-radius: 999px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; transition: background-color 120ms ease; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- a secret shown once ---------- */
.secret { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 10px; background: var(--code-bg); color: #fff; }
.secret code { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.secret .btn { background: #fff; border-color: #fff; color: var(--ink); }

/* ---------- the modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(17, 17, 17, 0.3); z-index: 40; display: grid; place-items: center; padding: 16px; animation: fade 160ms ease; }
.modal { width: min(440px, 100%); max-height: calc(100svh - 32px); background: var(--sheet); border-radius: 14px; box-shadow: 0 24px 64px -24px rgba(0, 0, 0, 0.45); display: flex; flex-direction: column; animation: rise 200ms cubic-bezier(.22,1,.36,1); }
.modal.wide { width: min(560px, 100%); }
.modal > h2 { font-size: 18px; font-weight: 500; letter-spacing: -0.02em; padding: 20px 22px 0; }
.modal__body { padding: 14px 22px 18px; overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.modal__foot { padding: 0 22px 20px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.choices { display: grid; }
.choice { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 9px 10px; margin: 0 -10px; border-radius: 8px; cursor: pointer; transition: background-color 120ms ease; }
.choice:hover, .choice:has(input:checked) { background: var(--raised); }
.choice input { margin: 3px 0 0; accent-color: var(--ink); }
.choice b { font-weight: 500; display: block; }
.choice span { color: var(--muted); font-size: 13px; display: block; }
.choices.scroll { max-height: 280px; overflow-y: auto; padding: 0 10px; margin: 0 -10px; }

#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; min-width: 220px; max-width: 380px; box-shadow: 0 16px 32px -16px rgba(0, 0, 0, 0.5); animation: rise 200ms ease; }
.toast.err { background: var(--bad); }

.devices { display: inline-flex; gap: 3px; color: var(--ink-2); vertical-align: middle; }

/* ---------- settings: one row per thing, a hairline between ---------- */
.rows { max-width: 720px; }
.rows .row { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; align-items: center; gap: 16px; min-height: 54px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.rows .row:last-child { border-bottom: 0; }
.rows dt { color: var(--muted); }
.rows dd { min-width: 0; overflow-wrap: anywhere; }
.rows dd .field { width: min(340px, 100%); height: 34px; }
.rows dd .err-line { margin-top: 4px; }
.rows .act { display: flex; gap: 14px; align-items: center; justify-content: flex-end; }

/* ---------- usage ---------- */
.meters { display: grid; gap: 16px; padding-top: 10px; }
.meter-row__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; gap: 12px; }
.meter-row__top b { font-weight: 500; font-variant-numeric: tabular-nums; }
.meter { height: 4px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ink); border-radius: 2px; }
.meter.high i { background: var(--bad); }
.figures { display: flex; gap: 40px; flex-wrap: wrap; padding-top: 8px; }
.figures div span { display: block; font-size: 13px; color: var(--muted); }
.figures div b { display: block; font-size: 24px; font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.2; }

/* ---------- live screens ---------- */
.screens { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px 20px; }
.screens.one { grid-template-columns: minmax(0, 1fr); }
.screens.two { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.screen { min-width: 0; }
.screen__bar { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; font-size: 13px; min-height: 36px; }
.screen__bar b { font-weight: 500; }
.screen__bar .sub { display: inline; }
.screen__bar .acts { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.screen__bar select.field { height: 28px; font-size: 13px; max-width: 130px; }
.screen__view { position: relative; background: #1b1b1b; aspect-ratio: 16 / 10; outline: none; cursor: crosshair; border-radius: 8px; overflow: hidden; }
.screen__view.phone { aspect-ratio: 390 / 844; max-height: 70vh; margin: 0 auto; }
.screen__view img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.screen__view:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }
.screen__view .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #aaa; font-size: 13px; text-align: center; padding: 20px; }
.screen__view .focus { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 11.5px; pointer-events: none; }
.screen__type { display: flex; gap: 6px; padding-top: 8px; }
.screen__type .field { flex: 1; }
.screens.one .screen__view { max-height: calc(100svh - 190px); aspect-ratio: auto; height: min(calc(100svh - 190px), calc((100vw - 216px - 2 * var(--pad)) * 10 / 16)); }
.screens.one .screen__view.phone { aspect-ratio: 390 / 844; height: auto; max-height: 78vh; }

/* ---------- topology editor: toolbar, canvas and inspector fill the sheet ---------- */
.topo { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto minmax(0, 1fr); }
.topo__tools { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; padding: 10px 16px 10px 20px; border-bottom: 1px solid var(--line); min-width: 0; }
.topo__tools .name { height: 32px; width: 200px; padding: 0 8px; margin-left: -8px; border: 1px solid transparent; border-radius: 8px; background: none; font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.topo__tools .name:hover { border-color: var(--line); }
.topo__tools .name:focus { outline: none; border-color: var(--ink); }
.topo__tools .sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; flex: none; }
.topo__tools .status { font-size: 13px; margin: 0 6px; white-space: nowrap; }
.palette { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.palette button { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 8px; border: 0; border-radius: 8px; background: none; cursor: pointer; font-size: 13px; white-space: nowrap; color: var(--ink-2); transition: background-color 120ms ease; }
.palette button:hover { background: var(--raised); color: var(--ink); }
.palette button svg { opacity: 0.8; }
.stage { position: relative; min-width: 0; min-height: 0; }
.canvas { position: absolute; inset: 0; overflow: auto; background: radial-gradient(circle, #dddbd5 1px, transparent 1.2px) 0 0 / 24px 24px, #fafaf8; }
.canvas svg { display: block; }
.view-ctl { position: absolute; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--sheet); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 8px 20px -14px rgba(0, 0, 0, 0.35); }
.view-ctl .btn { height: 26px; padding: 0 9px; }
.view-ctl .zoom-label { font-size: 12px; color: var(--muted); min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; }
.node { touch-action: none; cursor: grab; }
.node:active { cursor: grabbing; }
.node .box { fill: var(--sheet); stroke: var(--control); stroke-width: 1; }
.node.svc-host .box { fill: #fbfbfa; stroke-dasharray: 3 3; }
.node.net .box { fill: #f7f7f5; }
.node.sel .box { stroke: var(--ink); stroke-width: 2; }
.node.bad .box { stroke: var(--bad); stroke-width: 2; }
.node text { font: 500 12px var(--f); fill: var(--ink); }
.node text.k { font: 400 11px var(--f); fill: var(--muted); }
.node .ico { stroke: var(--ink); fill: none; stroke-width: 1.4; stroke-linejoin: round; }
.node .port { fill: var(--sheet); stroke: var(--ink-2); stroke-width: 1.2; cursor: crosshair; opacity: 0; transition: opacity 120ms ease; }
.node:hover .port, .node.sel .port, .canvas.linking .port { opacity: 1; }
.chip { cursor: pointer; }
.chip-box { fill: var(--raised); stroke: var(--line); }
.chip-box.sel { stroke: var(--series-1); stroke-width: 2; }
.chip-box.bad { stroke: var(--bad); }
.chip-t { font: 500 11px var(--f) !important; fill: var(--ink-2) !important; }
.link { stroke: var(--ink-2); stroke-width: 1.5; fill: none; cursor: pointer; }
.link.lossy { stroke-dasharray: 5 4; }
.link.sel { stroke: var(--series-1); stroke-width: 3; }
.link.bad { stroke: var(--bad); }
.link-hit { stroke: transparent; stroke-width: 12; fill: none; cursor: pointer; }
.link-label { font: 500 10.5px var(--f); fill: var(--muted); paint-order: stroke; stroke: #fafaf8; stroke-width: 4px; pointer-events: none; }
.rubber { stroke: var(--series-1); stroke-width: 1.5; stroke-dasharray: 4 3; fill: none; pointer-events: none; }
.inspector { border-left: 1px solid var(--line); min-width: 0; min-height: 0; overflow-y: auto; padding: 16px 18px 24px; display: grid; gap: 14px; align-content: start; }
.inspector > h2 { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.inspector .field { width: 100%; }
.switchrow { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.switchrow input { margin: 2px 0 0; accent-color: var(--ink); }
.applist { display: flex; flex-wrap: wrap; gap: 4px; }
.applist label { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; cursor: pointer; }
.applist label:has(input:checked) { border-color: var(--ink); background: var(--raised); }
.applist input { margin: 0; accent-color: var(--ink); }
.problems { display: grid; gap: 6px; }
.problems li { font-size: 12.5px; color: var(--bad); }
.problems li.warn { color: var(--warn); }
.links-list { display: grid; gap: 4px; }
.links-list button { display: flex; justify-content: space-between; gap: 8px; width: 100%; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--raised); cursor: pointer; font-size: 13px; }
.links-list button:hover { background: var(--frame-2); }
.presets { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.chart .axis-label { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.chart-h { font-size: 13px; font-weight: 500; margin: 14px 0 2px; }
.strip { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: center; margin-top: 6px; font-size: 12.5px; }
.strip__k { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip__cells { display: flex; gap: 3px; flex-wrap: wrap; }
.strip__cells i { width: 14px; height: 14px; border-radius: 3px; border: 1.5px solid var(--ink-2); }
.strip__cells i.same { background: var(--ink-2); }
.chart .axis text { font: 400 11px var(--f); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .grid line { stroke: var(--line-2); }
.chart .base { stroke: var(--control); }
.chart .tip { position: absolute; pointer-events: none; background: var(--sheet); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.3); color: var(--muted); z-index: 5; }
.chart .tip b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.chart .tip .row { display: flex; align-items: center; gap: 6px; }
.chart .tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin: 6px 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px 32px; }
.multiples figure { min-width: 0; }
.multiples h3 { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.multiples p { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
details.table { margin-top: 16px; }
details.table summary { cursor: pointer; color: var(--muted); padding: 6px 0; font-size: 13px; }
details.table summary:hover { color: var(--ink); }
.waiting { background: var(--warn-tint); border-radius: 10px; padding: 14px 16px; margin-bottom: 28px; display: grid; gap: 10px; }
.waiting h2 { font-size: 14px; font-weight: 500; }
.waiting summary { cursor: pointer; font-size: 13px; padding: 2px 0; }
.waiting summary b { font-weight: 500; }
.waiting .acts { display: flex; gap: 6px; flex-wrap: wrap; }

@media (max-width: 1180px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .cols > .sec + .sec { margin-top: 36px; }
  .topo { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 820px) {
  :root { --pad: 16px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar { display: flex; position: sticky; top: 0; z-index: 35; height: 52px; align-items: center; justify-content: space-between; padding: 0 16px; background: var(--frame); }
  .topbar .brand { padding: 0; }
  .side { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform 220ms cubic-bezier(.22,1,.36,1); }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(17, 17, 17, .3); }
  main { padding: 14px var(--pad) 64px; min-height: calc(100svh - 52px); }
  main.full { height: auto; min-height: calc(100svh - 52px); overflow: visible; }
  .hide-sm { display: none; }
  .bar__t + .bar__acts { justify-content: flex-start; margin-left: 0; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .screens, .screens.two { grid-template-columns: minmax(0, 1fr); }
  .screens.one .screen__view { height: auto; aspect-ratio: 16 / 10; }
  td, th { padding: 9px 8px; }
  .rows .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "k a" "v v"; gap: 2px 12px; padding: 12px 0; }
  .rows dt { grid-area: k; font-size: 13px; }
  .rows dd { grid-area: v; }
  .rows .act { grid-area: a; }
  .topo { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 62svh auto; }
  .topo__tools { flex-wrap: wrap; padding: 10px 16px; row-gap: 8px; }
  .topo__tools > * { order: 2; }
  .topo__tools .name { order: 0; flex: 1 1 120px; width: auto; }
  .topo__tools .btn.primary { order: 1; }
  .topo__tools .status { margin-left: -8px; margin-right: auto; }
  .topo__tools .palette { order: 3; flex-basis: 100%; flex-wrap: wrap; margin: 0 -8px; }
  .topo__tools .sep, .topo__tools .grow { display: none; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); overflow: visible; padding: 16px; }
  .figures { gap: 24px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.screens ~ .cols, .screens ~ .bar + .cols { margin-top: 36px; }
