/* Electrikz UI. Light, compact, hairline borders, one navy accent, gold only for selection accents. */
:root {
  --bg: #F4F6FA; --panel: #FFFFFF; --side: #FDFEFF; --line: #E0E6EF; --edge: #D7DFEB;
  --ink: #20304C; --row: #344054; --muted: #718098; --icon: #5B6B82;
  --blue: #002676; --blue2: #15418C; --gold: #FDB515; --acc: #2A6FDB;
  --hover: #EEF3FC; --sel: #E5EDFB; --teal: #16857A; --red: #BD4254;
  --r: 5px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 12px/1.35 "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); overflow: hidden; user-select: none; -webkit-user-select: none; }
#app { display: grid; grid-template-columns: 216px 1fr 236px; height: 100vh; }
aside { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
#left { border-right: 1px solid var(--line); background: var(--side); padding: 10px 10px 0; }
#right { border-left: 1px solid var(--line); }
.grow { flex: 1; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 12px 2px 5px; }

/* brand */
.brand { display: flex; align-items: center; gap: 8px; }
.logo { display: inline-flex; }
.bname { font-size: 16px; font-weight: 700; letter-spacing: .2px; color: var(--blue); }
.docname { margin-top: 8px; width: 100%; border: 1px solid transparent; border-radius: var(--r); background: transparent; font: inherit; font-weight: 600; color: var(--row); padding: 3px 5px; }
.docname:hover { border-color: var(--edge); } .docname:focus { outline: none; border-color: #476EA6; background: #F7FAFF; }

/* icon buttons */
.icons { display: flex; gap: 1px; align-items: center; }
.ib { width: 24px; height: 24px; border: 1px solid transparent; border-radius: var(--r); background: transparent; color: var(--icon); display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.ib svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.ib:hover { background: var(--hover); color: var(--blue); }
.ib.on { background: var(--sel); color: var(--blue); border-color: #BFD0EE; }
.ib:disabled { color: #C2CAD6; cursor: default; background: transparent; }
.sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }

/* tools */
.toolgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.toolgrid .ib { width: 100%; height: 26px; }
.toolgrid .ib.on { box-shadow: inset 0 -2px 0 var(--gold); }

/* library */
.field { width: 100%; height: 26px; border: 1px solid var(--edge); border-radius: var(--r); padding: 0 8px; font: inherit; color: var(--ink); background: #fff; }
.field:focus, .num:focus, select:focus, textarea:focus { outline: none; border-color: #476EA6; background: #F7FAFF; }
#lib { flex: 1; overflow-y: auto; margin: 8px -10px 0; padding: 0 8px 12px 10px; }
#lib::-webkit-scrollbar, #insp::-webkit-scrollbar { width: 8px; } #lib::-webkit-scrollbar-thumb, #insp::-webkit-scrollbar-thumb { background: #C6D0DF; border-radius: 4px; border: 2px solid var(--side); }
.cat { display: flex; align-items: center; gap: 4px; font-weight: 600; color: var(--row); padding: 5px 2px 3px; cursor: pointer; }
.cat svg { width: 10px; height: 10px; stroke: var(--muted); fill: none; stroke-width: 1.6; transition: transform .12s; }
.cat.closed svg { transform: rotate(-90deg); }
.cat .cnt { color: var(--muted); font-weight: 400; font-size: 11px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-bottom: 4px; }
.tile { position: relative; border: 1px solid transparent; border-radius: var(--r); padding: 3px 0 2px; text-align: center; cursor: grab; transition: background .12s, border-color .12s; touch-action: none; }
.tile:hover { background: var(--hover); border-color: #C9D8F0; }
.tile svg { display: block; margin: 0 auto; pointer-events: none; }
.tile .nm { font-size: 9.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.tile .st { position: absolute; top: 1px; right: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); opacity: .9; }
.empty { color: var(--muted); padding: 8px 2px; }
.linkish { color: var(--blue2); cursor: pointer; font-size: 11px; padding: 4px 2px; display: inline-block; }
.linkish:hover { text-decoration: underline; }

/* canvas */
#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--bg); }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; outline: none; touch-action: none; display: block; }
#cv.tool-select { cursor: default; } #cv.tool-wire, #cv.tool-rect, #cv.tool-rrect, #cv.tool-ell, #cv.tool-line, #cv.tool-arrow, #cv.tool-poly, #cv.tool-axes { cursor: crosshair; }
#cv.tool-text { cursor: text; } #cv.tool-place { cursor: copy; } #cv.panning, #cv.grab { cursor: grabbing; }
#cv .hd { fill: #fff; stroke: #2A6FDB; stroke-width: 1.2; vector-effect: non-scaling-stroke; cursor: move; }
#cv text { pointer-events: none; }
.txed { position: absolute; z-index: 5; font: 12px/1.4 Consolas, "Cascadia Mono", monospace; color: var(--ink); background: #fff; border: 1px solid #476EA6; border-radius: var(--r); padding: 4px 7px; resize: none; outline: none; box-shadow: 0 2px 10px rgba(32, 48, 76, .12); user-select: text; -webkit-user-select: text; }

/* bottom bar */
#bottombar { height: 30px; display: flex; align-items: center; gap: 8px; background: var(--panel); border-top: 1px solid var(--line); padding: 0 8px 0 4px; }
#tabs { display: flex; align-items: stretch; height: 100%; min-width: 0; overflow: hidden; }
.tab { position: relative; display: flex; align-items: center; padding: 0 12px; color: var(--muted); cursor: pointer; white-space: nowrap; border-right: 1px solid transparent; transition: color .12s; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--blue); font-weight: 600; box-shadow: inset 0 -2px 0 var(--gold); }
.tab.drag { z-index: 3; background: #fff; box-shadow: 0 1px 8px rgba(32, 48, 76, .18), inset 0 -2px 0 var(--gold); border-radius: 4px; cursor: grabbing; transition: none; }
.tab.shift { transition: transform .13s ease-out; }
.tab input { font: inherit; width: 90px; border: 1px solid #476EA6; border-radius: 3px; padding: 1px 4px; outline: none; }
#status { color: var(--muted); max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: opacity .25s; }
#status.msg { color: var(--teal); font-weight: 600; }
#coords { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }
#zoomer .zv { min-width: 44px; text-align: center; color: var(--row); cursor: pointer; border-radius: var(--r); padding: 3px 0; font-variant-numeric: tabular-nums; }
#zoomer .zv:hover { background: var(--hover); }

/* right panel */
#actions { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.btn { height: 26px; border: 1px solid var(--edge); border-radius: var(--r); background: #fff; color: var(--row); font: inherit; font-weight: 600; padding: 0 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { background: var(--hover); border-color: #9BB3D5; }
.btn.pri { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.pri:hover { background: var(--blue2); }
.btn.sm { height: 22px; padding: 0 7px; font-weight: 500; }
.btn.on { background: var(--sel); border-color: #BFD0EE; color: var(--blue); }
#insp { flex: 1; overflow-y: auto; padding: 2px 10px 14px; }
.ihead { font-size: 13px; font-weight: 650; margin: 10px 2px 2px; }
.isub { color: var(--muted); margin: 0 2px 4px; }
.row { display: flex; align-items: center; gap: 6px; margin: 5px 0; min-height: 24px; }
.row > label, .lbl { color: var(--muted); width: 58px; flex: none; }
.num { width: 54px; height: 24px; border: 1px solid var(--edge); border-radius: var(--r); padding: 0 6px; font: inherit; color: var(--ink); background: #fff; }
select.sel { height: 24px; border: 1px solid var(--edge); border-radius: var(--r); font: inherit; color: var(--ink); background: #fff; padding: 0 4px; flex: 1; min-width: 0; }
textarea.ta { width: 100%; min-height: 44px; border: 1px solid var(--edge); border-radius: var(--r); font: 12px/1.4 Consolas, monospace; color: var(--ink); padding: 5px 7px; resize: vertical; user-select: text; -webkit-user-select: text; }
input, textarea { user-select: text; -webkit-user-select: text; }
.seg { display: inline-flex; border: 1px solid var(--edge); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: #fff; font: inherit; color: var(--muted); padding: 0 8px; height: 22px; cursor: pointer; border-right: 1px solid var(--edge); display: inline-flex; align-items: center; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--hover); }
.seg button.on { color: var(--blue); font-weight: 700; background: var(--sel); }
.seg button svg { width: 22px; height: 10px; stroke: currentColor; fill: none; stroke-width: 1.4; }
input[type=range] { flex: 1; min-width: 0; accent-color: var(--blue); height: 14px; }
.val { width: 34px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--row); cursor: pointer; }
.chk input { accent-color: var(--blue); width: 13px; height: 13px; margin: 0; }
.arr { display: flex; flex-wrap: wrap; gap: 0; align-items: center; margin: 4px 0; }
.arr .ib { width: 22px; height: 22px; }
.arr .sep { margin: 0 3px; }

/* colour palette */
.pal { margin: 2px 0 6px; }
.pal .pr { display: flex; align-items: center; gap: 2px; margin: 3px 0; }
.pal .pn { width: 42px; flex: none; font-size: 9.5px; color: var(--muted); letter-spacing: .3px; }
.sw { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(32, 48, 76, .22); cursor: pointer; padding: 0; flex: none; transition: transform .1s; }
.sw:hover { transform: scale(1.25); }
.sw.on { outline: 2px solid var(--gold); outline-offset: 1px; }
.sw.none { background: linear-gradient(135deg, #fff 44%, #BD4254 45%, #BD4254 55%, #fff 56%); }
.hex { width: 70px; height: 22px; border: 1px solid var(--edge); border-radius: var(--r); padding: 0 6px; font: 11px Consolas, monospace; color: var(--ink); }
.cur { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(32, 48, 76, .25); flex: none; }

/* layers */
.lay { display: flex; align-items: center; gap: 2px; padding: 1px 0 1px 6px; border-radius: var(--r); color: var(--row); }
.lay:hover { background: #F2F5FA; }
.lay .ln { flex: 1; }
details.more { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; }
details.more summary { cursor: pointer; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary:hover { color: var(--blue); }
.keys { color: var(--row); line-height: 1.75; margin-top: 4px; }
.keys b { display: inline-block; min-width: 92px; font-weight: 600; color: var(--blue2); font-size: 11px; }

/* floating: quick-add palette and menus */
#palette, #menu { position: fixed; z-index: 30; background: #fff; border: 1px solid var(--edge); border-radius: 7px; box-shadow: 0 6px 24px rgba(32, 48, 76, .16); }
#palette { width: 250px; padding: 6px; }
#palq { width: 100%; height: 28px; border: 1px solid #476EA6; border-radius: var(--r); padding: 0 8px; font: inherit; font-size: 13px; outline: none; background: #F7FAFF; }
#pall { margin-top: 5px; max-height: 262px; overflow-y: auto; }
.pi { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: var(--r); cursor: pointer; }
.pi.on { background: var(--sel); }
.pi .pn2 { flex: 1; color: var(--ink); font-weight: 500; }
.pi .pc { color: var(--muted); font-size: 10.5px; }
.pi svg { flex: none; }
.pi .ti { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; color: var(--icon); }
.pi .ti svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
#menu { min-width: 190px; padding: 4px; }
.mi { display: flex; align-items: center; gap: 8px; padding: 4px 9px; border-radius: 4px; cursor: pointer; color: var(--row); }
.mi:hover { background: var(--hover); color: var(--blue); }
.mi .k { margin-left: auto; padding-left: 18px; color: var(--muted); font-size: 10.5px; }
.mi.dis { color: #B4BDCB; pointer-events: none; }
.mi svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.msep { height: 1px; background: var(--line); margin: 4px 2px; }
