:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --panel2: #f6f8fa;
  --line: #d6dbe2;
  --text: #1d2430;
  --muted: #677385;
  --accent: #1f6feb;
  --accent-soft: #e3edff;
  --danger: #c92a2a;
  --sel: #1f6feb;
  --canvas: #c9ced6;
  font: 13px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161a20; --panel: #1f242c; --panel2: #262c35; --line: #353c47; --text: #e4e8ee; --muted: #93a0b2;
    --accent: #5b9bff; --accent-soft: #24344f; --canvas: #2a3038;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 4px 9px; cursor: pointer; white-space: nowrap;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); }
button.icon { padding: 2px 7px; }
button.link { background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }
button.active { background: var(--accent-soft); border-color: var(--accent); }
input[type=text], input[type=number], input[type=search], input[type=date], input:not([type]), select, textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=color] { width: 100%; height: 28px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }

#app { display: flex; flex-direction: column; height: 100vh; }
#top {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px;
  padding-top: max(6px, env(safe-area-inset-top));
  padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 4px; }
.brand .logo { width: 22px; height: 22px; }
.install { background: var(--accent); border-color: var(--accent); color: #fff; }
.projname { font-weight: 600; background: none; border-color: transparent; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.menu { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; flex: 1; }
.sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; display: inline-block; }
.savestate { color: var(--muted); font-size: 12px; margin-left: 6px; }
.savestate.dirty { color: #c77d00; }
.savestate.error { color: var(--danger); }

main { flex: 1; display: grid; grid-template-columns: 250px minmax(0, 1fr) 280px; grid-template-rows: minmax(0, 1fr); min-height: 0; }
aside { background: var(--panel); min-height: 0; display: flex; flex-direction: column; }
#left { border-right: 1px solid var(--line); }
#right { border-left: 1px solid var(--line); }
.panel { overflow: auto; flex: 1; padding: 8px; min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { border-radius: 5px 5px 0 0; border-bottom: none; background: none; }
.tabs button.active { background: var(--accent-soft); }
.panel-tools { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 12px; }
.hint.keys { line-height: 1.6; }
.warn { color: #c77d00; margin: 4px 0; }

#center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#toolbar { display: flex; gap: 4px; align-items: center; padding: 5px 8px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#toolbar .tool { min-width: 32px; }
#toolbar select { width: auto; max-width: 190px; }
.grow { flex: 1; }
#canvas { flex: 1; position: relative; overflow: hidden; background: var(--canvas); min-height: 0; }
#status { display: flex; gap: 16px; padding: 3px 10px; background: var(--panel); border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.check { display: flex; align-items: center; gap: 6px; cursor: pointer; margin: 4px 0; }
.check input { width: auto; margin: 0; }
.check.small { font-size: 12px; color: var(--muted); }

/* ---------- canvas ---------- */
svg.canvas { width: 100%; height: 100%; display: block; user-select: none; touch-action: none; }
svg.canvas[data-tool=wire], svg.canvas[data-tool=place], svg.canvas[data-tool=text], svg.canvas[data-tool=box] { cursor: crosshair; }
svg.canvas[data-tool=pan] { cursor: grab; }
.sheet { fill: #fff; filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .25)); }
.gridfill { fill: url(#gp); }
.frame line, .frame rect { stroke: #000; stroke-width: .25; fill: none; }
.frame .fr-outer { stroke-width: .5; }
.ink line, .ink rect, .ink circle, .ink path, .ink polyline { stroke: #000; stroke-width: .3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ink .fi { fill: #000; }
.ink circle.fi { stroke: none; }
.ink .fw { fill: #fff; }
svg text { font-family: Arial, Helvetica, sans-serif; dominant-baseline: central; fill: #000; stroke: none; }
.tb-b, .tag, .rail-l { font-weight: bold; }
.tb-l { fill: #666; }
.xref, .mirror, .wno { fill: #333; }
.tag.dup { fill: #d00; }
.rail .rl { stroke-width: .5; }
.ink .hit { stroke: transparent; fill: transparent; stroke-width: 2.2; }
.ink rect.hit { fill: transparent; stroke: none; }
.ink .box rect.hit.edge { fill: none; stroke: transparent; stroke-width: 2; }
.ink polyline.hit { fill: none; }
.comp:hover .hit, .text:hover .hit { fill: rgba(31, 111, 235, .06); }
.wire:hover .wl, .rail:hover .rl { stroke: #4b8af0; }
.sel line, .sel rect:not(.hit):not(.handle), .sel circle:not(.openpin), .sel path, .sel polyline.wl, .sel .rl { stroke: var(--sel) !important; }
.sel text { fill: var(--sel); }
.comp.sel .hit { fill: rgba(31, 111, 235, .08); stroke: var(--sel); stroke-width: .2; stroke-dasharray: 1 .6; }
.ink .handle { fill: #fff; stroke: var(--sel); stroke-width: .25; cursor: move; }
.ink .openpin { fill: none; stroke: #d33; stroke-width: .2; }
.overlay .ghost line, .overlay .ghost rect, .overlay .ghost circle, .overlay .ghost path { stroke: var(--sel); stroke-width: .3; fill: none; opacity: .75; }
.overlay .ghostwire { stroke: var(--sel); stroke-width: .3; fill: none; stroke-dasharray: 1 .6; }
.overlay .cursor { fill: none; stroke: var(--sel); stroke-width: .2; }
.overlay .band { fill: rgba(31, 111, 235, .08); stroke: var(--sel); stroke-width: .2; stroke-dasharray: 1 .6; }
.overlay .ghostbox { fill: none; stroke: var(--sel); stroke-width: .3; stroke-dasharray: 4 1 1 1; }

/* ---------- library ---------- */
.search { margin-bottom: 6px; }
.libstatus { margin: 0 0 6px; font-size: 12px; }
.tree .folder { cursor: pointer; padding: 3px 0; font-weight: 600; user-select: none; }
.tree .folder:hover { color: var(--accent); }
.caret { display: inline-block; width: 10px; color: var(--muted); }
.symgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 4px; margin: 2px 0 6px; }
.sym {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; border: 1px solid transparent;
  border-radius: 6px; cursor: pointer; text-align: center; font-size: 11px; background: var(--panel2);
}
.sym:hover { border-color: var(--accent); }
.sym.active { background: var(--accent-soft); border-color: var(--accent); }
.sym span { line-height: 1.15; word-break: break-word; }
.sym .more { position: absolute; top: 1px; right: 1px; padding: 0 4px; font-size: 11px; display: none; border: none; background: none; }
.sym:hover .more { display: block; }
.symsvg { background: #fff; border-radius: 4px; }
.symsvg .ink line, .symsvg .ink rect, .symsvg .ink circle, .symsvg .ink path { stroke-width: .5; }
.popup { position: fixed; z-index: 1000; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); display: flex; flex-direction: column; padding: 4px; min-width: 160px; }
.popup button { border: none; background: none; text-align: left; }
.popup button:hover { background: var(--accent-soft); }

/* ---------- pages ---------- */
.pagelist { list-style: none; margin: 0; padding: 0; }
.pagelist li { display: flex; gap: 8px; padding: 5px 6px; border-radius: 5px; cursor: pointer; }
.pagelist li:hover { background: var(--panel2); }
.pagelist li.active { background: var(--accent-soft); font-weight: 600; }
.pagelist .no { width: 22px; text-align: right; color: var(--muted); }

/* ---------- properties ---------- */
.psec { border-bottom: 1px solid var(--line); padding: 6px 0 10px; }
.psec h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 4px 0 8px; }
.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.field > span { font-size: 12px; color: var(--muted); }
.field small { color: var(--muted); font-size: 11px; }
.ro { padding: 4px 0; font-weight: 600; }
.comphead { display: flex; gap: 8px; align-items: center; padding: 4px 0 8px; border-bottom: 1px solid var(--line); }
.comphead div { display: flex; flex-direction: column; }
.comphead small { color: var(--muted); }
.btnrow { display: flex; gap: 4px; flex-wrap: wrap; }
.chips { display: flex; gap: 3px; flex-wrap: wrap; margin: 4px 0; }
.chips button { padding: 2px 6px; font-size: 12px; }
.railrow { display: grid; grid-template-columns: 28px 1fr 60px auto; gap: 4px; align-items: center; margin-bottom: 4px; }
.pingrid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.pingrid label { display: flex; align-items: center; gap: 4px; }
.pingrid label span { color: var(--muted); font-size: 11px; min-width: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 6px; }
.linked { margin: 0; padding-left: 16px; }
.reflist { margin: 6px 0; font-size: 12px; }

/* ---------- modals ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 15, 25, .45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--panel); border-radius: 10px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); width: min(460px, 94vw); max-height: 92vh; display: flex; flex-direction: column; }
.modal.wide { width: min(980px, 96vw); }
.modal.full { width: 96vw; height: 94vh; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 15px; margin: 0; }
.modal-head button { border: none; background: none; }
.modal-body { padding: 14px; overflow: auto; flex: 1; min-height: 0; }
.modal.full .modal-body { display: flex; padding: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line); }
.modal p { margin: 0 0 8px; }
.form h3 { font-size: 13px; margin: 6px 0 8px; }
.form.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.logoprev { height: 70px; border: 1px dashed var(--line); border-radius: 6px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; background: #fff; color: #888; }
.logoprev img { max-height: 64px; max-width: 100%; }
.tablewrap { max-height: 60vh; overflow: auto; margin-top: 8px; }
table.list { border-collapse: collapse; width: 100%; font-size: 12px; }
table.list th, table.list td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: top; }
table.list th { position: sticky; top: 0; background: var(--panel2); }
table.list tbody tr:hover { background: var(--accent-soft); cursor: pointer; }
table.list tr.current td { font-weight: 600; }
td.empty { color: var(--muted); text-align: center; padding: 20px; }
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px); background: #222b38; color: #fff; padding: 8px 16px; border-radius: 6px; opacity: 0; transition: .2s; pointer-events: none; z-index: 2000; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- symbol editor ---------- */
.symeditor { display: grid; grid-template-columns: 56px 1fr 280px; width: 100%; min-height: 0; }
.se-tools { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-right: 1px solid var(--line); overflow: auto; }
.se-tools button { padding: 6px 0; font-size: 15px; }
.se-tools select { font-size: 11px; padding: 2px; }
.se-tools hr { width: 100%; border: none; border-top: 1px solid var(--line); }
.se-canvas { position: relative; min-height: 0; min-width: 0; background: #fff; }
.symcanvas { width: 100%; height: 100%; display: block; user-select: none; cursor: crosshair; }
.symcanvas .g1 { stroke: #eef0f3; stroke-width: .05; }
.symcanvas .g5 { stroke: #d5dae1; stroke-width: .08; }
.symcanvas .origin { stroke: #e55; stroke-width: .12; }
.symcanvas .ink line, .symcanvas .ink rect, .symcanvas .ink circle, .symcanvas .ink path, .symcanvas .ink polyline { stroke-width: .3; }
.symcanvas .sel line, .symcanvas .sel rect:not(.hit), .symcanvas .sel circle:not(.hit), .symcanvas .sel path { stroke: var(--sel); }
.symcanvas .hit.hit.hit { stroke: transparent !important; fill: transparent !important; stroke-width: 1.5 !important; }
.symcanvas .pinmark circle { fill: #e33; stroke: none; }
.symcanvas .pinmark.sel circle:not(.hit) { fill: var(--sel); }
.symcanvas .pinlbl { fill: #e33; }
.symcanvas .taglbl { fill: #2a8; font-weight: bold; cursor: move; }
.symcanvas .pv { stroke: var(--sel); stroke-width: .25; fill: none; stroke-dasharray: .8 .5; }
.symcanvas .cursor { fill: var(--sel); }
.coords { position: absolute; bottom: 6px; left: 8px; font-size: 11px; color: #789; background: rgba(255, 255, 255, .8); padding: 1px 5px; border-radius: 4px; }
.se-side { border-left: 1px solid var(--line); padding: 10px; overflow: auto; }
.se-side h3 { font-size: 12px; text-transform: uppercase; color: var(--muted); margin: 8px 0; }
.openlist { min-height: 100px; }

/* ---------- print ---------- */
#print-root { display: none; }
@media print {
  @page { size: A3 landscape; margin: 0; }
  body { background: #fff; }
  #app, .modal-back, .toast { display: none !important; }
  #print-root { display: block; }
  .print-page { width: 420mm; height: 297mm; page-break-after: always; break-after: page; overflow: hidden; }
  .print-page:last-child { page-break-after: auto; break-after: auto; }
  .print-page svg { width: 420mm; height: 297mm; display: block; }
}

/* ---------- wire colours ---------- */
.railrow input[type=color] { height: 24px; padding: 0 1px; }
.chips.colors { gap: 4px; align-items: center; }
.cchip { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 2px solid var(--line); font-size: 10px; font-weight: 700; color: #fff; }
.cchip.auto { background: var(--panel2); color: var(--text); }
.cchip.gnye { background: repeating-linear-gradient(45deg, #2e9e3e 0 4px, #e0c000 4px 8px) !important; }
.cchip.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.colorpick input[type=color] { width: 30px; height: 24px; padding: 0 1px; }

/* ---------- project kinds and views ---------- */
body[data-kind=schematic] .kind-building, body[data-kind=building] .kind-schematic { display: none !important; }
body[data-kind=building] #left-tabs, body[data-kind=building] #library, body[data-kind=building] #pages { display: none !important; }
body[data-mode=schematic] .view-plan, body[data-mode=building] .view-sheet { display: none !important; }
body[data-mode=schematic] svg.plancanvas, body[data-mode=building] svg.canvas:not(.plancanvas) { display: none; }
.tgroup { display: contents; }
#building-left { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#building-left .tabs.inner { padding-top: 6px; }
.kindbadge { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 2px 8px; white-space: nowrap; }
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.kind { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px; text-align: left; white-space: normal; border-radius: 8px; }
.kind small { color: var(--muted); }
.kind .kicon { font-size: 22px; }
.kind.active { background: var(--accent-soft); border-color: var(--accent); }
.pagelist h4 { margin: 10px 0 4px; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }

/* ---------- plan ---------- */
.plancanvas[data-tool=wall], .plancanvas[data-tool=opening], .plancanvas[data-tool=stair], .plancanvas[data-tool=text], .plancanvas[data-tool=place], .plancanvas[data-tool=link] { cursor: crosshair; }
.plangrid { fill: url(#pgp); }
.plan .wall { fill: #3d3d3d; stroke: none; }
.plan .wall.inner { fill: #7a7a7a; }
.plan .wall:hover { fill: #2f5fbf; }
.plan .wall.sel { fill: var(--sel) !important; }
.plan .gap { fill: #fff; stroke: none; }
.plan .stairbox { fill: #fff; }
.plan .plink { fill: none; }
.plan .opening:hover line, .plan .opening:hover path { stroke: #4b8af0; }
.plan .psym:hover .hit { fill: rgba(31, 111, 235, .1); }
.plan .psym.sel .hit { fill: rgba(31, 111, 235, .15); stroke: var(--sel); stroke-width: .3; }
.plan .psym.sel line, .plan .psym.sel circle:not(.hit), .plan .psym.sel path, .plan .psym.sel rect { stroke: var(--sel) !important; }
.plan .plink.sel { stroke: var(--sel) !important; }
.plan path.hit { fill: none; stroke: transparent; }
.room { font-weight: bold; }
.clabel { font-weight: bold; fill: #c2410c; }
.croom { fill: #555; }
.overlay .ghostwall { fill: rgba(31, 111, 235, .35); stroke: none; }
.overlay .ghostopen { fill: rgba(31, 111, 235, .35); stroke: none; }
.overlay .measure { fill: var(--sel); font-weight: bold; }
.overlay .ghost line, .overlay .ghost circle, .overlay .ghost path, .overlay .ghost rect { stroke: var(--sel); stroke-width: .3; fill: none; }
.overlay .ghost text { fill: var(--sel); }

/* ---------- AREI checks ---------- */
.chk { font-size: 12px; color: var(--muted); }
.chk.error { color: var(--danger); }
.chk.warn { color: #c77d00; }
.ink rect.tbox { stroke-width: .2; fill: none; }
.dialwrap { display: flex; justify-content: center; margin: 4px 0 8px; }
svg.dial { width: 120px; height: 120px; }
svg.dial .ring { fill: none; stroke: var(--line); stroke-width: 1.5; }
svg.dial .hand { stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
svg.dial .hub { fill: var(--accent); }
svg.dial .dot { fill: var(--panel2); stroke: var(--muted); stroke-width: 1; cursor: pointer; }
svg.dial .dot:hover { fill: var(--accent-soft); stroke: var(--accent); }
svg.dial .dot.on { fill: var(--accent); stroke: var(--accent); }
svg.dial .deg { font-size: 11px; fill: var(--muted); font-family: system-ui, sans-serif; dominant-baseline: central; }
#toolbar select.pagesel { max-width: 240px; min-width: 150px; text-align: center; }

/* ---------- touch / narrow screens ---------- */
.paneltoggle { display: none; }
@media (max-width: 900px) {
  main { grid-template-columns: minmax(0, 1fr); position: relative; }
  #left, #right {
    position: absolute; top: 0; bottom: 0; z-index: 20; width: min(300px, 85vw);
    box-shadow: 0 0 24px rgba(0, 0, 0, .25); transform: translateX(-105%); transition: transform .2s;
  }
  #left { left: 0; }
  #right { right: 0; transform: translateX(105%); }
  body.show-left #left, body.show-right #right { transform: none; }
  .paneltoggle { display: inline-block; font-size: 16px; min-width: 36px; }
  #top { gap: 6px; }
  .menu button { padding: 6px 8px; }
  #status .hint { display: none; }
}
@media (pointer: coarse) {
  #toolbar button, #toolbar select, .menu button { min-height: 36px; }
  #toolbar .tool { min-width: 40px; }
}
.menutoggle { display: none; }
@media (max-width: 900px) {
  .menutoggle { display: inline-block; margin-left: auto; }
  #top .menu { display: none; order: 10; flex-basis: 100%; }
  body.show-menu #top .menu { display: flex; }
  #top .menu .sep { display: none; }
  .projname { max-width: 140px; }
  .install { order: 5; }
}
/* ---------- distribution tree (circuits dialog) ---------- */
.modal:has(.circuits.tree) { width: min(1180px, 97vw); }
.circuits.tree .trow { border-bottom: 1px solid var(--line); padding: 6px 4px; }
.circuits.tree .trow.t-board { background: var(--panel2); }
.circuits.tree .trow.err { background: rgba(201, 42, 42, .06); }
.circuits.tree .thead { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 8px; }
.circuits.tree .caretbtn { display: inline-block; width: 26px; height: 26px; padding: 0; align-self: center; font-size: 18px; line-height: 1; color: var(--accent); border: 1px solid var(--line); border-radius: 6px; background: var(--panel); cursor: pointer; }
.circuits.tree span.caretbtn { border-color: transparent; background: none; }
.circuits.tree button.caretbtn:hover { border-color: var(--accent); }
.circuits.tree .ticon { width: 16px; text-align: center; font-weight: 700; color: var(--accent); align-self: center; }
.circuits.tree .tf { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); }
.circuits.tree .tf input, .circuits.tree .tf select { width: 70px; max-width: 170px; font-size: 12px; padding: 2px 4px; color: var(--text); }
.circuits.tree .tf select { width: auto; min-width: 0; }
.circuits.tree .tf input.tname { font-weight: 700; }
.circuits.tree .tf input.tname.t-circuit { width: 52px; text-align: center; }
.circuits.tree .tf input.tname.t-rcd, .circuits.tree .tf input.tname.t-board { width: 170px; }
.circuits.tree .tf input.tdesc { width: 150px; }
.circuits.tree .tf input.tcable { width: 64px; }
.circuits.tree .tact { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin: 5px 0 0 58px; }
.circuits.tree .tact button { padding: 2px 7px; font-size: 12px; }
.circuits.tree .tact select { width: auto; max-width: 180px; font-size: 12px; padding: 2px; }
.circuits.tree .tact .pts { margin-left: auto; padding-right: 6px; font-size: 12px; color: var(--muted); }
.circuits.tree .twarn { margin: 4px 0 0 58px; }

/* ---------- start screen ---------- */
.modal.start { width: min(640px, 94vw); }
.startbig { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.startbig button { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border-radius: 10px; text-align: left; white-space: normal; }
.startbig button .kicon { font-size: 24px; }
.startbig button small { opacity: .8; }
.startscreen h3 { font-size: 13px; margin: 16px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.recent { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow: auto; }
.recentitem { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; }
.recentitem .rname { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.recentitem small { color: var(--muted); }
@media (max-width: 520px) { .startbig { grid-template-columns: 1fr; } }

/* ---------- donate ---------- */
.donatebtn { color: #d6336c; }
.startscreen .donate { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.startscreen .donate a { color: #d6336c; font-weight: 600; text-decoration: none; }
.startscreen .donate a:hover { text-decoration: underline; }
