:root {
  --bg: #111113; --panel: #17171a; --panel2: #1c1c20; --input: #202025; --hover: #26262c; --line: #2a2a31; --line2: #383842;
  --text: #f2f2f5; --soft: rgba(242,242,245,.68); --mute: rgba(242,242,245,.42);
  --accent: #8e28d1; --accent-solid: #6e1da5; --accent-lt: #b892ff; --ok: #34d399; --warn: #f5b942; --err: #ff5d5d;
  --hot: #ff8a5b; --cold: #4da3ff; --two: #2dd4bf;
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, Consolas, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
kbd { font: 10.5px var(--mono); padding: 1px 5px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; background: var(--panel2); color: var(--soft); }

#app { display: grid; height: 100vh; grid-template-rows: 54px 1fr 26px; grid-template-columns: 256px 1fr 372px; grid-template-areas: "top top top" "pal main side" "st st st"; }
#top { grid-area: top; display: flex; align-items: center; gap: 8px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0; }
#palette { grid-area: pal; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#canvas-holder { grid-area: main; position: relative; min-width: 0; min-height: 0; background: #0e0e10; overflow: hidden; }
#side { grid-area: side; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#status { grid-area: st; display: flex; align-items: center; gap: 18px; padding: 0 14px; background: var(--panel); border-top: 1px solid var(--line); color: var(--mute); font: 11px var(--mono); }
.grow { flex: 1; }
.engine { color: var(--mute); }

/* header */
.back { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--soft); text-decoration: none; }
.back:hover { background: var(--hover); color: var(--text); }
.brand { display: flex; align-items: center; gap: 10px; margin-right: 6px; }
.brand b { display: block; font-size: 14px; letter-spacing: .1px; white-space: nowrap; }
.brand small { display: block; color: var(--mute); font-size: 10.5px; margin-top: -1px; white-space: nowrap; }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: #fff; background: linear-gradient(140deg, #8e28d1, #5b1a9b); box-shadow: 0 2px 10px rgba(142,40,209,.4); }
.name-input { width: 190px; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 9px; font-weight: 600; min-width: 90px; }
.name-input:hover { border-color: var(--line2); background: var(--input); }
.name-input:focus { outline: none; border-color: var(--accent); background: var(--input); }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.btn, .ibtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel2); color: var(--text); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover, .ibtn:hover { background: var(--hover); border-color: #4a4a57; }
.btn:disabled, .ibtn:disabled { opacity: .35; cursor: default; }
.ibtn { width: 32px; padding: 0; justify-content: center; }
.btn.primary { background: linear-gradient(180deg, #8e28d1, #6e1da5); border-color: #a24be0; color: #fff; font-weight: 600; }
.btn.primary:hover { background: linear-gradient(180deg, #9b35df, #7a26b5); }
.btn.run { padding: 0 16px; }
.btn.danger { color: #ff9b9b; }
.btn.danger:hover { background: rgba(255,93,93,.12); border-color: rgba(255,93,93,.5); }
.caret { display: inline-flex; margin-left: -2px; opacity: .7; }
.menu-wrap { position: relative; }
.dropdown { position: absolute; top: 38px; left: 0; z-index: 50; width: 330px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgba(0,0,0,.55); }
.dropdown button { display: block; width: 100%; text-align: left; padding: 9px 11px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.dropdown button:hover { background: var(--hover); }
.dd-group { padding: 8px 11px 4px; font: 700 10px var(--font); letter-spacing: .09em; text-transform: uppercase; color: var(--mute); }
.dropdown { max-height: calc(100vh - 80px); overflow-y: auto; }
.dropdown b { display: block; font-size: 13px; } .dropdown small { display: block; color: var(--mute); font-size: 11.5px; margin-top: 2px; }
.sel-wrap { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 4px 0 11px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel2); }
.sel-wrap small { color: var(--mute); font-size: 11px; }
.sel-wrap select { border: 0; background: transparent; height: 30px; font-weight: 600; cursor: pointer; max-width: 128px; }
.sel-wrap select option { background: #202025; }
.check { display: flex; align-items: center; gap: 8px; color: var(--soft); cursor: pointer; }
.check.inline { padding: 0 6px; white-space: nowrap; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.pill { padding: 4px 11px; border-radius: 999px; font: 600 11px var(--mono); border: 1px solid var(--line2); color: var(--mute); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.08); }
.pill.busy { color: var(--accent-lt); border-color: rgba(184,146,255,.4); }
.pill.stale { color: var(--warn); border-color: rgba(245,185,66,.4); background: rgba(245,185,66,.08); }
.pill.err { color: var(--err); border-color: rgba(255,93,93,.4); background: rgba(255,93,93,.08); }

/* palette */
.pal-head { display: flex; gap: 8px; padding: 12px 12px 8px; }
#pal-search { flex: 1; min-width: 0; height: 32px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line2); background: var(--input); }
#pal-search:focus { outline: none; border-color: var(--accent); }
.seg2 { display: inline-flex; flex: none; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.seg2 button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; background: transparent; color: var(--mute); cursor: pointer; }
.seg2 button:hover { color: var(--text); background: var(--hover); }
.seg2 button.on { background: var(--accent-solid); color: #fff; }
.pal-sub { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 12px 8px 14px; color: var(--mute); font-size: 11px; white-space: nowrap; }
.pal-sub button { margin-left: 2px; border: 0; background: transparent; color: var(--mute); cursor: pointer; padding: 2px 5px; border-radius: 5px; font-size: 11px; }
.pal-sub button:hover { color: var(--text); background: var(--hover); }
#pal-list { flex: 1; overflow-y: auto; padding: 0 8px 14px; scrollbar-width: thin; scrollbar-color: #34343c transparent; }
.pal-group { margin-bottom: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); }
.pal-group.open { border-color: var(--line2); }
.pal-gh { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; width: 100%; padding: 9px 10px 9px 8px; border: 0; border-radius: 12px; background: var(--panel2); color: var(--text); cursor: pointer; text-align: left; font: 700 12px var(--font); }
.pal-gh:hover { background: var(--hover); }
.pal-gh:focus-visible, .pal-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pal-group.open .pal-gh { border-radius: 12px 12px 0 0; border-bottom: 1px solid var(--line); }
.pal-gh .chev { display: inline-flex; color: var(--mute); transition: transform .15s; }
.pal-group:not(.open) .chev { transform: rotate(-90deg); }
.pal-gh .gico { display: grid; place-items: center; width: 24px; height: 24px; flex: none; }
.pal-gh .gt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-gh .cnt { color: var(--mute); font: 600 10.5px var(--mono); }
.pal-body { display: none; padding: 8px; gap: 6px; }
.pal-group.open .pal-body { display: grid; }
.pal-body.grid { grid-template-columns: 1fr 1fr; }
.pal-item { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px; background: #141417; cursor: grab; user-select: none; transition: border-color .12s, background .12s; }
.pal-item:hover { border-color: var(--accent); background: var(--hover); }
.pal-item:active { cursor: grabbing; }
.pal-item.disabled { opacity: .4; cursor: default; }
.pal-item.disabled:hover { border-color: var(--line); background: #141417; }
.pal-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: #0f0f12; flex: none; }
.pal-ico.ghost { border: 1px dashed var(--line2); background: transparent; }
.pal-txt { min-width: 0; }
.pal-txt b { display: block; font-size: 12.5px; line-height: 1.25; }
.pal-txt small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 1px; color: var(--mute); font-size: 11px; line-height: 1.3; }
.pal-body.grid .pal-item { flex-direction: column; justify-content: flex-start; gap: 4px; padding: 9px 4px 8px; text-align: center; }
.pal-body.grid .pal-txt small { display: none; }
.pal-body.grid .pal-txt b { font-size: 11.5px; font-weight: 600; }
.pal-group.soon .gt { color: var(--mute); }

/* canvas */
#stage { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; user-select: none; touch-action: none; }
#canvas-holder.panning #stage { cursor: grabbing; }
.node { cursor: move; }
.node .body { fill: #17171b; stroke: #33333c; stroke-width: 1.4; transition: stroke .12s; }
.node:hover .body { stroke: #4a4a56; }
.node.sel .body { stroke: var(--accent); stroke-width: 2.2; filter: drop-shadow(0 0 9px rgba(142,40,209,.55)); }
.nname { fill: #f0f0f4; font: 600 12px var(--font); pointer-events: none; }
.nsub { fill: rgba(242,242,245,.5); font: 10.5px var(--mono); pointer-events: none; }
.node.t-bus:not(.sel) .body { fill: rgba(247,201,72,.035); stroke: transparent; }
.nbadge { fill: var(--accent-lt); font: 600 10.5px var(--mono); cursor: pointer; } .nbadge:hover { text-decoration: underline; }
.stale .nbadge { opacity: .4; }
.port { --kind: #b892ff; cursor: crosshair; }
.port.sec { --kind: #55c2ff; } .port.steam { --kind: #ffa46e; } .port.elec { --kind: #f7c948; } .port.wx { --kind: #7ec8a0; } .port.strm { --kind: #d9b26a; } .port.shaft { --kind: #a3a3ad; } .port.hw { --kind: #ff7b72; } .port.cd { --kind: #5fd6a0; } .port.cw { --kind: #5ad4f0; } .port.sig { --kind: #b0a8ff; } .port.h2 { --kind: #8ecbff; } .port.dig { --kind: #38d9c0; }
.port.sig .pdot { r: 4px; stroke-width: 1.7; } .port.sig:hover .pdot { r: 5.5px; }
.port .phit { fill: transparent; }
.port .pdot { fill: #111113; stroke: var(--kind); stroke-width: 2; transition: r .1s; }
.port.taken .pdot { fill: var(--kind); }
.port:hover .pdot { r: 7px; fill: var(--kind); }
.port .plabel { font: 600 9.5px var(--font); fill: rgba(242,242,245,.75); opacity: 0; pointer-events: none; paint-order: stroke; stroke: #0e0e10; stroke-width: 3px; }
.port:hover .plabel { opacity: 1; }
.port.target .pdot { fill: #fff; stroke: var(--kind); r: 7.5px; animation: pulse 1s ease-in-out infinite; }
.port.dim { opacity: .22; }
@keyframes pulse { 50% { r: 9px; } }
.edge .eline { fill: none; stroke-width: 2.7; stroke-linecap: round; stroke-linejoin: round; transition: stroke-width .1s; }
.edge.sec .eline { stroke-width: 2.2; stroke-dasharray: 8 5; }
.edge.wx .eline { stroke-width: 2; stroke-dasharray: 2 6; }
.edge.sig .eline { stroke-width: 1.7; stroke-dasharray: 3 4; }
.edge.hw .eline, .edge.cw .eline, .edge.cd .eline { stroke-width: 3; }
.edge.h2 .eline { stroke-width: 2.6; } .edge.dig .eline { stroke-width: 2.1; }
.edge.strm .eline { stroke-width: 3.2; }
.edge.shaft .eline { stroke-width: 5.5; stroke-linecap: butt; }
.edge.elec .eline { stroke-width: 2.4; }
.edge .ehit { fill: none; stroke: transparent; stroke-width: 16; cursor: pointer; }
.edge:hover .eline { stroke-width: 3.8; }
.edge.sel .eline { stroke-width: 4; filter: drop-shadow(0 0 6px rgba(255,255,255,.55)); }
.eflow { fill: none; stroke: rgba(255,255,255,.92); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: .1 15.9; animation: flow 1.1s linear infinite; pointer-events: none; }
@keyframes flow { to { stroke-dashoffset: -16; } }
.elabel { cursor: pointer; } .elabel:hover rect { fill: #1d1d24; }
.bh { cursor: move; } .bh.x { cursor: ew-resize; } .bh.y { cursor: ns-resize; }
.bh-hit { fill: transparent; } .bh-dot { fill: #17171b; stroke: var(--accent-lt); stroke-width: 2; transition: fill .1s; } .bh:hover .bh-dot { fill: var(--accent-lt); }
.nudge { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; } .nudge .btn { height: 30px; padding: 0; justify-content: center; font-size: 12px; } .nudge [data-act] { grid-column: 1 / -1; }
.elabel rect { fill: #0f0f12; stroke-width: 1.2; }
.elabel text { fill: #ececf1; font: 600 10px var(--mono); }
.twire { fill: none; stroke: var(--accent-lt); stroke-width: 2.4; stroke-dasharray: 6 4; pointer-events: none; }
.twire.sec { stroke: #55c2ff; } .twire.steam { stroke: #ffa46e; } .twire.elec { stroke: #f7c948; } .twire.wx { stroke: #7ec8a0; } .twire.hw { stroke: #ff7b72; } .twire.cd { stroke: #5fd6a0; } .twire.cw { stroke: #5ad4f0; } .twire.sig { stroke: #b0a8ff; } .twire.h2 { stroke: #8ecbff; } .twire.dig { stroke: #38d9c0; } .twire.strm { stroke: #e6b96a; } .twire.shaft { stroke: #a3a3ad; }
.marquee { fill: rgba(184,146,255,.08); stroke: var(--accent-lt); stroke-dasharray: 4 3; pointer-events: none; }

.empty-card { display: none; position: absolute; inset: 0; margin: auto; width: 520px; height: max-content; flex-direction: column; align-items: center; text-align: center; padding: 30px 28px; border: 1px solid var(--line); border-radius: 18px; background: rgba(23,23,26,.92); backdrop-filter: blur(6px); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
#canvas-holder.empty .empty-card { display: flex; }
.empty-card h2 { margin: 10px 0 6px; font-size: 20px; } .empty-card p { margin: 0 0 16px; color: var(--soft); }
.empty-ico { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 15px; background: linear-gradient(140deg, #8e28d1, #5b1a9b); color: #fff; }
.tpl-row { display: flex; gap: 10px; width: 100%; }
.tpl-card { flex: 1; text-align: left; padding: 11px 12px; border: 1px solid var(--line2); border-radius: 12px; background: var(--panel2); cursor: pointer; }
.tpl-card:hover { border-color: var(--accent); background: var(--hover); }
.tpl-card b { display: block; font-size: 12.5px; margin-bottom: 3px; } .tpl-card small { color: var(--mute); font-size: 11px; line-height: 1.35; display: block; }
.zoombar { position: absolute; left: 14px; bottom: 44px; display: flex; flex-direction: column; gap: 6px; }
.zoombar .ibtn { background: rgba(28,28,32,.92); }
.hintbar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 16px; justify-content: center; padding: 7px 10px; color: var(--mute); font-size: 11px; pointer-events: none; background: linear-gradient(0deg, rgba(14,14,16,.85), transparent); }
#canvas-holder:not(.empty) .hintbar span:nth-child(n+4) { display: none; }

/* side panel */
.tabs { display: flex; padding: 8px 8px 0; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 9px 8px 10px; border: 0; background: transparent; color: var(--mute); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--soft); } .tab.on { color: var(--text); border-bottom-color: var(--accent); }
.side-body { flex: 1; overflow-y: auto; padding: 12px; }
.side-body::-webkit-scrollbar, #pal-list::-webkit-scrollbar { width: 9px; }
.side-body::-webkit-scrollbar-thumb, #pal-list::-webkit-scrollbar-thumb { background: #34343c; border-radius: 9px; border: 2px solid var(--panel); }
.card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); padding: 13px 14px; margin-bottom: 12px; }
.card.err { border-color: rgba(255,93,93,.4); }
.card-h { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; font-weight: 700; font-size: 12.5px; letter-spacing: .02em; }
.h-ico { display: inline-flex; }
.fld { display: block; margin-bottom: 11px; }
.flab { display: block; margin-bottom: 5px; color: var(--soft); font-size: 11.5px; }
.flab em { margin-left: 6px; font-style: normal; padding: 0 6px; border-radius: 999px; background: rgba(85,194,255,.14); color: #7dd0ff; font-size: 10px; }
.fld input[type=text], .fld input[type=number], .fld select { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 8px; background: var(--input); }
.fld input:focus, .fld select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(142,40,209,.2); }
.fld input.bad { border-color: var(--err); box-shadow: 0 0 0 3px rgba(255,93,93,.18); }
.fld.via input { opacity: .55; }
.fld select option { background: #202025; }
.numwrap { position: relative; } .numwrap input { padding-right: 62px !important; font-family: var(--mono); }
.unit { position: absolute; right: 10px; top: 7px; color: var(--mute); font: 11px var(--mono); pointer-events: none; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; } .btn-row.pad { padding-bottom: 6px; }
.btn-row .btn { height: 30px; padding: 0 10px; font-size: 12px; }
.hint { margin: 10px 0 0; color: var(--mute); font-size: 11.5px; line-height: 1.5; } .hint.warn { color: var(--warn); }
.notes { margin: 0; padding-left: 17px; color: var(--soft); font-size: 12px; } .notes li { margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .chip { padding: 2px 8px; border-radius: 999px; background: var(--input); border: 1px solid var(--line2); color: var(--soft); font: 11px var(--mono); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--soft); font-size: 11.5px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; } .legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; }
.legend i.dash { background: repeating-linear-gradient(90deg, #55c2ff 0 5px, transparent 5px 8px) !important; }
.legend.seg { margin-top: 8px; }
.conn { margin: 0 0 12px; line-height: 1.7; } .conn span { color: var(--mute); font-size: 11.5px; }
.stale-tag { margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: rgba(245,185,66,.13); color: var(--warn); font: 600 10px var(--mono); }
.stale-banner, .warn-box { display: flex; flex-direction: column; gap: 5px; padding: 9px 12px; margin-bottom: 12px; border-radius: 10px; font-size: 12px; }
.stale-banner { flex-direction: row; align-items: center; gap: 8px; background: rgba(245,185,66,.1); border: 1px solid rgba(245,185,66,.3); color: #f7d38c; }
.warn-box { background: rgba(245,185,66,.08); border: 1px solid rgba(245,185,66,.25); color: #f0d08c; }
.warn-box div { display: flex; gap: 8px; align-items: flex-start; } .warn-box .ico { flex: none; margin-top: 2px; }
.errs { margin: 0; padding-left: 18px; color: #ffb3b3; } .errs li { margin-bottom: 7px; line-height: 1.45; } .errs li[data-node] { cursor: pointer; } .errs a { color: var(--accent-lt); text-decoration: underline; }
.placeholder { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 46px 18px; color: var(--mute); }
.placeholder b { color: var(--soft); font-size: 14px; } .placeholder p { margin: 0; line-height: 1.55; max-width: 290px; }
.empty-note { padding: 16px; color: var(--mute); text-align: center; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.kpi { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
.kpi small { display: block; color: var(--mute); font-size: 10.5px; letter-spacing: .03em; }
.kpi b { font: 600 20px var(--mono); letter-spacing: -.02em; } .kpi em { margin-left: 5px; font: normal 11px var(--mono); color: var(--mute); }
.kpi.cold b { color: var(--cold); } .kpi.hot b { color: var(--hot); } .kpi.acc b { color: var(--accent-lt); }
.tabs2 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 8px; }
.tabs2 select { flex: 1; height: 30px; padding: 0 9px; border: 1px solid var(--line2); border-radius: 8px; background: var(--input); font-weight: 600; }
.tabs2 button { height: 26px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 7px; background: transparent; color: var(--soft); font-weight: 600; cursor: pointer; }
.tabs2 button.on { background: var(--accent-solid); border-color: #a24be0; color: #fff; }
.ref-chip { margin-left: auto; white-space: nowrap; padding: 2px 9px; border-radius: 999px; background: var(--input); border: 1px solid var(--line2); font: 600 11px var(--mono); color: var(--accent-lt); }
.chart { width: 100%; height: auto; display: block; }
.chart .cg { stroke: rgba(255,255,255,.06); stroke-width: 1; } .chart .cf { fill: none; stroke: #3a3a44; }
.chart .ct { fill: rgba(242,242,245,.5); font: 10px var(--mono); } .chart .cl { fill: rgba(242,242,245,.7); font: 600 10.5px var(--font); }
.chart .dome { fill: none; stroke: #7d7d8c; stroke-width: 1.5; }
.chart .pt circle { fill: #111113; stroke: #fff; stroke-width: 1.6; } .chart .pt text { fill: #fff; font: 700 10px var(--mono); }
.tbl-wrap { overflow-x: auto; }
.mono { font-family: var(--mono); }
.sysd { margin-bottom: 14px; } .sysd > summary { cursor: pointer; list-style: none; padding: 9px 12px; margin-bottom: 10px; border: 1px solid var(--line2); border-radius: 10px; background: var(--panel2); font-weight: 700; font-size: 12.5px; }
.sysd > summary::-webkit-details-marker { display: none; } .sysd > summary::before { content: '▾'; display: inline-block; margin-right: 8px; color: var(--mute); transition: transform .12s; } .sysd:not([open]) > summary::before { transform: rotate(-90deg); }
.sysh { margin: 2px 2px 10px; font-weight: 700; font-size: 13px; }
.chart-tip { position: absolute; z-index: 5; min-width: 130px; max-width: 280px; padding: 7px 10px; border: 1px solid var(--line2); border-radius: 9px; background: rgba(15,15,18,.96); box-shadow: 0 8px 24px rgba(0,0,0,.5); font: 11px var(--mono); pointer-events: none; }
.chart-tip b { display: block; margin-bottom: 4px; color: var(--soft); font-weight: 600; }
.chart-tip div { display: flex; align-items: center; gap: 6px; white-space: nowrap; } .chart-tip i { width: 8px; height: 8px; border-radius: 2px; flex: none; } .chart-tip em { margin-left: auto; padding-left: 10px; font-style: normal; color: #fff; }
.chart-tip small { color: var(--mute); font-size: 10px; }
.band-note { margin-top: 8px; color: var(--mute); font-size: 11px; line-height: 1.5; }
.chart .hov line { stroke: rgba(255,255,255,.4); stroke-width: 1; stroke-dasharray: 3 3; }
table.grid { width: 100%; border-collapse: collapse; font: 11.5px var(--mono); }
table.grid th { text-align: right; padding: 5px 6px; color: var(--mute); font-weight: 600; border-bottom: 1px solid var(--line2); }
table.grid td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--line); }
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid tbody tr:hover { background: var(--hover); }
table.kv { width: 100%; border-collapse: collapse; } table.kv td { padding: 5px 0; border-bottom: 1px solid var(--line); } table.kv td:last-child { text-align: right; font: 12px var(--mono); }
.srow { padding: 9px 10px 4px; margin-bottom: 8px; border: 1px solid var(--line2); border-radius: 10px; background: var(--input); }
.sr-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 7px; font-weight: 600; font-size: 12px; line-height: 1.35; }
.sr-h em { font-style: normal; font-weight: 400; color: var(--mute); }
.iconx { flex: none; width: 22px; height: 22px; border: 0; border-radius: 6px; background: transparent; color: var(--mute); font-size: 17px; line-height: 1; cursor: pointer; }
.iconx:hover:not(:disabled) { background: rgba(255,93,93,.14); color: var(--err); } .iconx:disabled { opacity: .3; cursor: default; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .duo .fld { margin-bottom: 6px; }
.srow .fld input[type=number] { background: var(--panel2); }
.sr-base { margin-bottom: 3px; color: var(--mute); font-size: 10.5px; }
.seg3 { display: flex; gap: 4px; margin: 4px 0 9px; }
.seg3 button { flex: 1; height: 28px; padding: 0 4px; border: 1px solid var(--line2); border-radius: 8px; background: transparent; color: var(--soft); font-weight: 600; font-size: 11.5px; cursor: pointer; }
.seg3 button.on { background: var(--accent-solid); border-color: #a24be0; color: #fff; }
#s-add { color: var(--soft); }
.runs { align-self: center; margin-left: auto; color: var(--mute); font: 11px var(--mono); }
.progress { height: 6px; margin-top: 12px; border-radius: 99px; background: var(--input); overflow: hidden; }
.progress i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #8e28d1, #b892ff); transition: width .15s; }
.tbl-scroll { position: relative; max-height: 270px; overflow: auto; } .tbl-scroll table.grid th { position: sticky; top: 0; background: var(--panel2); }
table.heat th, table.heat td { text-align: center; } table.heat th:first-child { text-align: left; font-size: 10px; }
.trio { display: grid; grid-template-columns: 1fr 1fr 78px; gap: 8px; } .bad-t { color: var(--err); }

.pgroup { margin: 16px 0 9px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--accent-lt); font-weight: 700; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; }
.card-h + .pgroup { margin-top: 2px; padding-top: 0; border-top: 0; }

/* time-based study */
.kindsw { margin: 0 0 12px; } .kindsw button { height: 30px; font-size: 12px; }
.tset { display: grid; grid-template-columns: 1fr 1fr 84px; gap: 8px; } .tset .fld { margin-bottom: 8px; }
.srow textarea { width: 100%; min-height: 66px; padding: 7px 9px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel2); color: var(--text); font: 12px/1.5 var(--mono); resize: vertical; }
.srow textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(142,40,209,.2); }
.srow select { background: var(--panel2); }
.ochips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.ochip { display: inline-flex; align-items: center; gap: 7px; padding: 3px 4px 3px 9px; border: 1px solid var(--line2); border-radius: 999px; background: var(--input); color: var(--soft); font-size: 11.5px; }
.ochip i { width: 8px; height: 8px; border-radius: 2px; }
.ochip button { width: 18px; height: 18px; border: 0; border-radius: 50%; background: transparent; color: var(--mute); font-size: 14px; line-height: 1; cursor: pointer; }
.ochip button:hover { background: rgba(255,93,93,.16); color: var(--err); }
.pl-bar { position: sticky; top: -1px; z-index: 4; margin-bottom: 12px; padding: 8px 12px; border: 1px solid #5a2a86; border-radius: 12px; background: var(--panel2); box-shadow: 0 8px 20px rgba(0,0,0,.35); }
.pl-row { display: flex; align-items: center; gap: 8px; }
.pl-btn { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #a24be0; border-radius: 50%; background: var(--accent-solid); color: #fff; cursor: pointer; }
.pl-btn:hover { background: var(--accent); } .pl-btn.ghost { width: 28px; height: 28px; border-color: var(--line2); background: transparent; color: var(--soft); } .pl-btn.ghost:hover { background: var(--hover); }
.pl-scrub { flex: 1; min-width: 0; accent-color: #b892ff; }
.pl-time { flex: none; min-width: 78px; text-align: right; font: 600 12px var(--mono); }
.pl-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 0; color: var(--soft); font-size: 11.5px; }
.pl-opts select { height: 26px; padding: 0 6px; border: 1px solid var(--line2); border-radius: 7px; background: var(--input); color: var(--text); font-size: 11.5px; }
.pl-opts label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.now { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 11.5px; }
.now span { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--soft); } .now span i { flex: none; width: 8px; height: 8px; border-radius: 2px; }
.now b { font: 600 12px var(--mono); text-align: right; } .now b.dim { color: var(--mute); font-weight: 400; }
.tl-title { display: flex; justify-content: space-between; gap: 8px; margin: 10px 0 1px; color: var(--soft); font-size: 11.5px; } .tl-title:first-child { margin-top: 0; }
.tl-title em { font-style: normal; color: var(--mute); }
svg.chart.tl .thit { cursor: ew-resize; touch-action: none; }
svg.chart.tl .tcl { stroke: rgba(255,255,255,.6); stroke-width: 1.2; stroke-dasharray: 3 3; }
tr.now-row { background: rgba(142,40,209,.22); }
#tl-hud { position: absolute; top: 12px; left: 50%; z-index: 6; display: flex; align-items: center; gap: 9px; padding: 5px 6px 5px 13px; transform: translateX(-50%); border: 1px solid #a24be0; border-radius: 999px; background: rgba(24,14,34,.93); box-shadow: 0 8px 26px rgba(0,0,0,.5); font-size: 12px; white-space: nowrap; }
#tl-hud[hidden] { display: none; }
#tl-hud b { font: 600 12.5px var(--mono); } #tl-hud #tl-hud-sub { color: var(--soft); }
#tl-hud button { height: 24px; padding: 0 11px; border: 1px solid var(--line2); border-radius: 999px; background: transparent; color: var(--soft); font-size: 11.5px; cursor: pointer; } #tl-hud button:hover { background: var(--hover); color: #fff; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: #b892ff; } #tl-hud.play .tl-dot { animation: tlpulse 1.2s ease-out infinite; }
@keyframes tlpulse { 0% { box-shadow: 0 0 0 0 rgba(184,146,255,.75); } 100% { box-shadow: 0 0 0 9px rgba(184,146,255,0); } }

#toasts { position: fixed; right: 16px; bottom: 40px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast { max-width: 360px; padding: 11px 15px; border-radius: 10px; background: #26262c; border: 1px solid var(--line2); box-shadow: 0 10px 30px rgba(0,0,0,.5); transition: opacity .35s, transform .35s; }
.toast.warn { border-color: rgba(245,185,66,.5); } .toast.error { border-color: rgba(255,93,93,.55); } .toast.out { opacity: 0; transform: translateY(6px); }

/* narrower windows: keep Run and the status visible, collapse the palette to an icon rail */
@media (max-width: 1300px) {
  #app { grid-template-columns: 240px 1fr 344px; }
  .name-input { width: 130px; } .brand small { display: none; }
  #top .btn { padding: 0 9px; } .caret { display: none; }
  .sel-wrap small { display: none; } .check.inline { padding: 0 2px; font-size: 0; gap: 0; }
}
@media (max-width: 1080px) {
  #app { grid-template-columns: 64px 1fr 330px; }
  .brand div, #top .btn:not(.run):not(.primary) { font-size: 0; gap: 0; padding: 0 8px; }
  .brand div { display: none; } .name-input { width: 96px; }
  #top .btn .ico { margin: 0; }
  .pal-head, .pal-sub, .pal-gh, .pal-txt, .pal-group.soon { display: none; }
  .pal-group, .pal-group.open { margin: 0; padding: 6px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; }
  .pal-group:first-child { border-top: 0; }
  .pal-group .pal-body, .pal-group.open .pal-body { display: flex; flex-direction: column; padding: 0; gap: 6px; }
  .pal-item, .pal-body.grid .pal-item { justify-content: center; padding: 6px; }
  #pal-list { padding: 10px 8px; }
  .sel-wrap select { max-width: 92px; }
}
@media (max-width: 860px) { #app { grid-template-columns: 0 1fr 300px; } #palette { display: none; } .hintbar { display: none; } }

/* phones & small tablets: the canvas gets the whole width. The palette and the side panel become drawers
   opened from the toolbar (#btn-pal, #btn-side — app.js), and the toolbar scrolls sideways, with the
   drawer buttons and Run moved to its front so they are always in reach. */
.mob-only { display: none !important; }
#mob-scrim { display: none; }
@media (max-width: 860px) {
  #app { height: 100dvh; grid-template-columns: 1fr; grid-template-rows: 54px 1fr 26px; grid-template-areas: "top" "main" "st"; }
  .mob-only { display: inline-flex !important; }
  #top { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; gap: 6px; padding: 0 8px; }
  #top::-webkit-scrollbar { display: none; }
  #top > * { flex-shrink: 0; }
  #top .grow { display: none; }
  #top .back, #top .brand, #btn-pal, #btn-side, #btn-run, #pill { order: -1; }
  .dropdown { position: fixed; top: 58px; left: 8px; right: 8px; width: auto; }
  #palette, #side { position: fixed; top: 54px; bottom: 0; z-index: 70; display: none !important; box-shadow: 0 0 40px rgba(0, 0, 0, .6); }
  #palette { left: 0; width: min(88vw, 340px); }
  #side { right: 0; width: min(100vw, 400px); }
  #app.pal-open #palette, #app.side-open #side { display: flex !important; }
  #app.pal-open #mob-scrim, #app.side-open #mob-scrim { display: block; position: fixed; top: 54px; left: 0; right: 0; bottom: 0; z-index: 65; background: rgba(0, 0, 0, .5); }
  #app.pal-open #btn-pal, #app.side-open #btn-side { background: var(--accent-solid); border-color: var(--accent); color: #fff; }
  /* the drawer shows the full palette again (the narrower-window rules above shrink it to an icon rail) */
  .pal-head, .pal-sub, .pal-gh { display: flex; }
  .pal-txt, .pal-group.soon { display: block; }
  .pal-group, .pal-group.open { margin: 0 0 6px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); }
  .pal-group:first-child { border-top: 1px solid var(--line); }
  .pal-group .pal-body { display: none; }
  .pal-group.open .pal-body { display: grid; flex-direction: row; padding: 8px; gap: 6px; }
  .pal-item { justify-content: flex-start; padding: 7px 8px; }
  .pal-body.grid .pal-item { flex-direction: column; justify-content: flex-start; padding: 9px 4px 8px; }
  #pal-list { padding: 0 8px 14px; }
  #stat-xy, #status .engine { display: none; }
  .zoombar { left: 10px; bottom: 12px; }
  .empty-card { width: calc(100% - 28px); padding: 22px 16px; }
}

/* enlarge button in the corner of every chart, and the windows it opens */
.cx { position: absolute; top: 2px; right: 2px; z-index: 6; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 1px solid var(--line2); border-radius: 7px; background: rgba(28,28,32,.9); color: var(--soft); cursor: pointer; opacity: 0; transition: opacity .12s, background .12s; }
*:hover > .cx, .cx:focus-visible { opacity: 1; } .cx:hover { background: var(--hover); color: #fff; }
.chart .pt.hl circle { fill: var(--accent); stroke: #fff; stroke-width: 2.4; } .chart .pt.hl text { fill: #fff; }
.modal-back { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 3vh 3vw; background: rgba(6,6,8,.72); backdrop-filter: blur(3px); }
.modal { display: flex; flex-direction: column; width: min(720px, 100%); max-height: 100%; border: 1px solid var(--line2); border-radius: 16px; background: var(--panel); box-shadow: 0 30px 90px rgba(0,0,0,.65); overflow: hidden; }
.modal.big { width: min(1240px, 100%); height: min(760px, 100%); }
.modal header { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.modal header b { font-size: 14px; } .modal header small { color: var(--accent-lt); font: 600 11.5px var(--mono); }
.modal-body { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.bigchart { flex: 1; min-height: 0; } .bigchart .chart { max-height: 100%; }
.dcard { border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); padding: 10px 12px; }
.dcard .card-h { margin-bottom: 6px; font-weight: 600; color: var(--soft); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }
.kv > div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); } .kv span { color: var(--mute); } .kv b { font: 600 12px var(--mono); text-align: right; }
.links { display: flex; flex-wrap: wrap; gap: 8px; } .links button { display: flex; flex-direction: column; align-items: flex-start; padding: 7px 11px; border: 1px solid var(--line2); border-radius: 10px; background: var(--panel); cursor: pointer; } .links button:hover { border-color: var(--accent); background: var(--hover); }
.links b { font: 600 11.5px var(--mono); } .links small { color: var(--mute); font-size: 11px; }

/* timing diagram */
.chart.lg .lg-name { fill: rgba(242,242,245,.78); font: 600 10px var(--mono); }
.chart.lg .lg-base { stroke: rgba(255,255,255,.07); stroke-width: 1; }
.chart.lg .lg-line { fill: none; stroke: #38d9c0; stroke-width: 1.8; stroke-linejoin: round; }
.chart.lg .lg-hi { fill: rgba(56,217,192,.13); stroke: none; }
.chart.lg .lg-bus { fill: rgba(184,146,255,.14); stroke: #b892ff; stroke-width: 1.4; }
.chart.lg .lg-val { fill: #ececf1; font: 600 9.5px var(--mono); }

/* long calculations: training and optimisation */
.trainrow { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; } .trainrow .fld { margin: 0; flex: 1; min-width: 120px; } .trainrow .btn { height: 34px; }
.progress { height: 6px; margin: 10px 0 4px; border-radius: 999px; background: var(--input); overflow: hidden; } .progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8e28d1, #b892ff); transition: width .25s; }

/* optimizer card */
.osec { margin: 12px 0 6px; font: 700 10.5px var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.osec select { text-transform: none; letter-spacing: 0; font: 600 12px var(--font); }
.orow { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; } .orow .ol { flex: 1; min-width: 0; font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orow select, .orow input[type=number], #opt-card select { height: 30px; border: 1px solid var(--line2); border-radius: 8px; background: var(--input); padding: 0 8px; min-width: 0; }
.orow select { flex: 1; } .orow input[type=number] { width: 78px; } .orow span { color: var(--mute); } .oint { display: inline-flex; align-items: center; gap: 4px; color: var(--soft); font-size: 11px; }
.ox { width: 26px; height: 26px; font-size: 11px; } #opt-card > select { width: 100%; margin-top: 2px; }

.chart.bars .bl { fill: rgba(242,242,245,.8); font: 600 11px var(--font); } .chart.bars .bv { fill: #ececf1; font: 600 10.5px var(--mono); }

/* AI assistant tab */
.side-body { display: flex; flex-direction: column; }
.side-body > section { flex: 0 0 auto; }
#tab-assist { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.ast-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ast-head b { display: block; font-size: 14px; } .ast-head small { display: block; color: var(--mute); font-size: 11.5px; margin-top: 1px; }
.ast-head .btn { height: 28px; padding: 0 10px; font-size: 12px; }
.ast-off { padding: 9px 11px; border: 1px solid rgba(245,185,66,.45); border-radius: 10px; background: rgba(245,185,66,.08); color: var(--warn); font-size: 12px; }
.ast-log { flex: 1 1 auto; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px 2px 6px; scroll-behavior: smooth; }
.ast-log::-webkit-scrollbar { width: 9px; } .ast-log::-webkit-scrollbar-thumb { background: #34343c; border-radius: 9px; border: 2px solid var(--panel); }
.ast-msg { max-width: 94%; padding: 9px 12px; border-radius: 12px; line-height: 1.5; word-break: break-word; }
.ast-msg .ast-text { white-space: pre-wrap; }
.ast-msg.user { align-self: flex-end; background: var(--accent-solid); color: #fff; border-bottom-right-radius: 4px; }
.ast-msg.bot { align-self: flex-start; background: var(--panel2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ast-msg.bad { border-color: rgba(255,93,93,.5); background: rgba(255,93,93,.07); }
.ast-built { display: flex; align-items: center; gap: 7px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--ok); font-size: 12px; }
.ast-built .ico { flex: none; }
.ast-link { margin-left: auto; flex: none; white-space: nowrap; border: 0; background: transparent; color: var(--accent-lt); font: 600 12px var(--font); cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.ast-link:hover { background: var(--hover); text-decoration: underline; }
.ast-sys { margin-top: 8px; padding: 7px 9px; border-radius: 9px; background: var(--input); border: 1px solid var(--line); }
.ast-sys > b { display: block; font-size: 11.5px; color: var(--soft); margin-bottom: 3px; }
.ast-kpi { display: inline-block; margin: 1px 10px 1px 0; font-size: 12px; } .ast-kpi small { color: var(--mute); font-size: 11px; } .ast-kpi b { font-family: var(--mono); font-weight: 600; }
.ast-issue { margin-top: 8px; padding: 7px 10px; border-radius: 9px; border: 1px solid rgba(245,185,66,.4); background: rgba(245,185,66,.07); font-size: 12px; }
.ast-issue.err { border-color: rgba(255,93,93,.45); background: rgba(255,93,93,.07); }
.ast-issue ul, .ast-notes ul { margin: 4px 0 2px; padding-left: 18px; } .ast-issue .ast-link { margin: 2px 0 0; padding-left: 0; }
.ast-notes { margin-top: 8px; font-size: 11.5px; color: var(--mute); } .ast-notes summary { cursor: pointer; }
.ast-hello { margin: auto 0; text-align: center; padding: 10px 4px; }
.ast-hello b { display: block; font-size: 14px; margin: 6px 0 4px; } .ast-hello p { margin: 0 0 12px; color: var(--soft); font-size: 12.5px; }
.ast-ico { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: #fff; background: linear-gradient(140deg, #8e28d1, #5b1a9b); }
.ast-sug { display: flex; flex-direction: column; gap: 6px; }
.ast-sug button { text-align: start; padding: 8px 11px; border: 1px solid var(--line2); border-radius: 10px; background: var(--panel2); color: var(--soft); cursor: pointer; font-size: 12px; line-height: 1.4; }
.ast-sug button:hover { background: var(--hover); color: var(--text); border-color: var(--accent); }
.ast-status { color: var(--mute); font: 11px var(--mono); padding: 0 2px; }
.ast-form { display: flex; flex-direction: column; gap: 6px; }
.ast-form textarea { width: 100%; resize: none; padding: 9px 11px; border: 1px solid var(--line2); border-radius: 10px; background: var(--input); color: var(--text); font: 13px/1.45 var(--font); }
.ast-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(142,40,209,.2); }
.ast-form textarea:disabled { opacity: .5; }
.ast-actions { display: flex; align-items: center; gap: 8px; } .ast-actions small { flex: 1; color: var(--mute); font-size: 11px; }
.ast-actions .btn { height: 32px; }
.ast-dots { display: inline-flex; gap: 4px; padding: 4px 2px; } .ast-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-lt); opacity: .35; animation: astdot 1.1s infinite ease-in-out; }
.ast-dots i:nth-child(2) { animation-delay: .18s; } .ast-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes astdot { 0%, 80%, 100% { opacity: .3; transform: scale(.85); } 40% { opacity: 1; transform: scale(1.1); } }

/* Port guide (Properties tab) and the port tooltip on the canvas */
.card.pg { padding: 0; } .card.pg > summary { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 12px; cursor: pointer; list-style: none; }
.card.pg > summary::-webkit-details-marker { display: none; } .card.pg > summary .card-h { margin: 0; }
.card.pg > summary em { color: var(--mute); font-style: normal; font-size: 11px; white-space: nowrap; }
.card.pg > summary::before { content: '▸'; color: var(--mute); margin-right: 6px; transition: transform .12s; } .card.pg[open] > summary::before { transform: rotate(90deg); }
.pg-intro { margin: 0 12px 6px !important; }
.pg-row { padding: 9px 12px 10px; border-top: 1px solid var(--line); transition: background .12s; } .pg-row:hover { background: rgba(255,255,255,.025); }
.pg-row.need { box-shadow: inset 3px 0 0 var(--warn); }
.pg-head { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; } .pg-head b { font-size: 12.5px; margin-right: 2px; }
.pg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--k, #b892ff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--k, #b892ff) 22%, transparent); flex: none; }
.pg-tag { padding: 0 6px; border-radius: 999px; border: 1px solid var(--line2); color: var(--mute); font: 600 10px var(--font); line-height: 16px; }
.pg-tag.k { color: var(--k); border-color: color-mix(in srgb, var(--k) 45%, transparent); } .pg-tag.req { color: var(--warn); border-color: rgba(245,185,66,.5); }
.pg-story { margin: 6px 0 4px; color: var(--soft); font-size: 12px; line-height: 1.5; }
.pg-val { margin: 0 0 5px; color: var(--mute); font-size: 11.5px; } .pg-val em, .pg-lab { font-style: normal; font: 700 9.5px var(--font); letter-spacing: .07em; text-transform: uppercase; color: var(--mute); margin-right: 6px; }
.pg-to { margin-top: 6px; } .pg-to .pg-lab { display: block; margin: 0 0 3px; } .pg-now { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 6px; } .pg-now .pg-lab { flex: none; }
.pg-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.pg-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line2); background: var(--input); color: var(--soft); font: 11.5px var(--font); line-height: 1.5; }
.pg-chip i { font-style: normal; font-weight: 700; color: var(--accent-lt); }
button.pg-chip.add { cursor: pointer; } button.pg-chip.add:hover:not(:disabled) { border-color: var(--accent); background: rgba(142,40,209,.16); color: var(--text); }
button.pg-chip.off { opacity: .4; cursor: default; }
.pg-more, .pg-link { border: 0; background: transparent; color: var(--accent-lt); font: 600 11.5px var(--font); cursor: pointer; padding: 2px 4px; border-radius: 6px; } .pg-more:hover, .pg-link:hover { background: var(--hover); text-decoration: underline; }

.pg-state { font-size: 11.5px; } .pg-state.free { color: var(--mute); } .pg-state.ok { color: var(--ok); margin-right: 4px; }
.port.hl .pdot { r: 8.5px; fill: #fff; stroke: var(--kind); stroke-width: 3; } .port.hl .plabel { opacity: 1; }
.ptip { position: fixed; z-index: 90; max-width: 300px; padding: 9px 11px; border: 1px solid var(--line2); border-radius: 10px; background: #1f1f25; box-shadow: 0 12px 32px rgba(0,0,0,.55); pointer-events: none; font-size: 12px; line-height: 1.45; }
.ptip p { margin: 5px 0 0; color: var(--soft); } .ptip .ptip-v { color: var(--mute); font-size: 11.5px; } .ptip .ptip-v em { font-style: normal; font: 700 9.5px var(--font); letter-spacing: .07em; text-transform: uppercase; margin-right: 4px; }
.ptip .ptip-f { color: var(--mute); font-size: 11px; } .ptip-h { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; } .ptip-h b { font-size: 12.5px; }

/* which series a chart shows: tick boxes (also the legend), the custom chart, the download button and its menu */
.tabs2 { min-width: 0; } .tabs2 select { flex: 1 1 0; min-width: 0; width: 100%; max-width: 100%; text-overflow: ellipsis; }
.card { min-width: 0; } .chart-box { min-width: 0; max-width: 100%; }
.legend.tick { margin-top: 8px; gap: 5px 14px; align-items: center; }
.legend.tick .lt { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; line-height: 1.3; }
.legend.tick .lt input { margin: 0; accent-color: var(--accent); cursor: pointer; } .legend.tick .lt input:disabled { cursor: not-allowed; }
.legend.tick .lt.off span, .legend.tick .lt.off i { opacity: .38; } .legend.tick .lt i { flex: none; }
.lt-tools { display: inline-flex; gap: 9px; margin-right: 4px; } .lt-tools a { color: var(--accent-lt); font-size: 11px; font-weight: 600; cursor: pointer; } .lt-tools a:hover { text-decoration: underline; }
.legend.tick .lg-group { width: 100%; padding-top: 4px; border-top: 1px solid var(--line); } .legend.tick .lg-group:first-child { border-top: 0; padding-top: 0; }
.lg-h { display: flex; align-items: center; gap: 12px; margin: 2px 0 4px; } .lg-h b { color: var(--mute); font: 700 10px var(--font); letter-spacing: .07em; text-transform: uppercase; }
.lg-rows { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cx.dl { right: 30px; } .cx { opacity: .7; }
.cmenu { position: fixed; z-index: 200; min-width: 250px; padding: 5px; border: 1px solid var(--line2); border-radius: 11px; background: #1f1f25; box-shadow: 0 16px 44px rgba(0,0,0,.6); }
.cmenu button { display: block; width: 100%; padding: 8px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: 600 12.5px var(--font); text-align: left; cursor: pointer; }
.cmenu button:hover, .cmenu button:focus-visible { background: var(--hover); } .cmenu small { display: block; margin-top: 2px; color: var(--mute); font: 400 11px var(--font); }
.bigchart { overflow: auto; }
.bigchart.split { display: flex; align-items: flex-start; gap: 16px; } .bigchart.split > svg.chart { flex: 1 1 0; min-width: 0; height: auto; }
.bigchart.split .side-legend { flex: none; width: 314px; max-height: 100%; overflow-y: auto; padding-right: 6px; } .bigchart.split .side-legend .legend.tick { margin-top: 0; }
/* the two-part swatch for a series that has a shaded min/max band: a bright bar (the line/mean) over a soft bar (the band) */
.lt-sw { display: inline-flex; flex: none; flex-direction: column; gap: 2px; width: 16px; }
.lt-sw .lt-ln { height: 2.5px; border-radius: 1px; } .lt-sw .lt-bd { height: 6px; border-radius: 2px; opacity: .3; }
/* drag-to-select (or type a From/To) a range of the chart and read the exact min/mean/max of every shown line over it */
svg.chart.sel .selr { fill: rgba(255,255,255,.09); stroke: rgba(255,255,255,.3); stroke-width: 1; }
svg.chart.sel { cursor: crosshair; touch-action: none; user-select: none; }
.sel-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; color: var(--soft); font-size: 12px; }
.sel-bar input[type=number] { width: 84px; height: 26px; padding: 0 8px; border: 1px solid var(--line2); border-radius: 7px; background: var(--input); color: var(--text); font: 11.5px var(--mono); }
.sel-bar .btn { height: 26px; padding: 0 10px; font-size: 12px; }
.sel-info { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line2); border-radius: 10px; background: var(--panel2); }
.sel-hdr { margin-bottom: 4px; color: var(--soft); font: 600 11.5px var(--mono); }
.sel-cols { display: flex; justify-content: space-between; margin-bottom: 3px; color: var(--mute); font-size: 10.5px; } .sel-cols span:last-child { font: 600 10px var(--mono); }
.sel-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 12px; }
.sel-row i { width: 9px; height: 9px; border-radius: 3px; flex: none; } .sel-row b { margin-left: auto; font: 600 12px var(--mono); color: var(--text); }
