* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; font: 13px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: #e5e7eb; background: #0b1220; }
#view { position: fixed; inset: 0 0 0 330px; }
#view canvas { display: block; }
#loading { position: fixed; inset: 0 0 0 330px; display: grid; place-items: center; background: #0b1220; z-index: 5; }
#loading > div { width: 260px; text-align: center; } #loading .bar { margin-top: 10px; height: 10px; }

#hud { position: fixed; top: 10px; left: 340px; right: 10px; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.chip { background: rgba(15, 23, 42, .82); border: 1px solid #334155; padding: 4px 10px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.chip.el { color: #fde047; } .chip.wa { color: #7dd3fc; }
.chip.bad { color: #fca5a5; border-color: #b91c1c; }

#panel { position: fixed; top: 0; left: 0; bottom: 0; width: 330px; background: rgba(15, 23, 42, .93); border-right: 1px solid #334155; padding: 12px 14px 30px; overflow-y: auto; }
h1 { font-size: 17px; margin: 0 0 10px; } #design { margin-bottom: 10px; } #design button { padding: 6px 2px; font-size: 12px; } h1 small { display: block; font-size: 11px; font-weight: 400; color: #94a3b8; }
h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; margin: 16px 0 6px; }
#tabs { display: flex; gap: 2px; border-bottom: 1px solid #334155; }
#tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; color: #94a3b8; padding: 7px 2px; cursor: pointer; font: inherit; }
#tabs button.on { color: #fff; border-color: #38bdf8; }
.tab { display: none; } .tab.on { display: block; }

button, select { font: inherit; color: #e5e7eb; background: #1e293b; border: 1px solid #475569; border-radius: 6px; padding: 5px 9px; cursor: pointer; }
button:hover { background: #334155; }
.btns { display: flex; flex-wrap: wrap; gap: 5px; }
.wide { width: 100%; margin: 6px 0; }
.seg { display: flex; } .seg button { flex: 1; border-radius: 0; padding: 9px 2px; font-weight: 600; }
.seg button:first-child { border-radius: 6px 0 0 6px; } .seg button:last-child { border-radius: 0 6px 6px 0; }
.seg button.on { background: #f59e0b; color: #111; border-color: #f59e0b; }
.seg button:disabled { opacity: .6; cursor: default; }
.row { display: grid; grid-template-columns: 96px 1fr 58px; align-items: center; gap: 6px; margin: 5px 0; }
.row select, .row input[type=color] { grid-column: 2 / 4; width: 100%; }
.row output { text-align: right; font-variant-numeric: tabular-nums; color: #cbd5e1; }
input[type=range] { width: 100%; accent-color: #38bdf8; }
.chk { display: flex; gap: 7px; align-items: flex-start; margin: 5px 0; cursor: pointer; }
.chk input { margin-top: 2px; accent-color: #38bdf8; } .chk b { margin-left: auto; color: #cbd5e1; font-weight: 500; white-space: nowrap; }
.dot { width: 22px; height: 8px; border-radius: 4px; margin-top: 5px; flex: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
ol, ul { margin: 4px 0; padding-left: 20px; } li { margin: 3px 0; }
.note { color: #94a3b8; font-size: 12px; margin: 6px 0; }
.warn { background: #7f1d1d; border: 1px solid #dc2626; color: #fee2e2; padding: 6px 8px; border-radius: 6px; margin: 8px 0; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
td { padding: 3px 0; border-bottom: 1px solid #1e293b; } td:last-child { text-align: right; }
tr.sum td { font-weight: 600; border-top: 1px solid #475569; } .ok { color: #86efac; } .no { color: #fca5a5; }
.bar { position: relative; height: 22px; background: #1e293b; border: 1px solid #475569; border-radius: 6px; overflow: hidden; }
.bar div { height: 100%; background: #0ea5e9; width: 60%; } .bar span { position: absolute; inset: 0; text-align: center; line-height: 20px; }

#sld { width: 100%; margin-top: 8px; background: #0b1220; border: 1px solid #334155; border-radius: 6px; }
#sld .ln path { fill: none; stroke: #475569; stroke-width: 3; }
#sld .ln path.on { stroke: #fde047; stroke-dasharray: 6 4; animation: dash .6s linear infinite; }
#sld .ln path.on.pln { stroke: #ff5a3c; }
@keyframes dash { to { stroke-dashoffset: -10; } }
#sld rect { fill: #1e293b; stroke: #64748b; } #sld rect.cos { fill: #f59e0b; }
#sld text { fill: #e5e7eb; font-size: 9px; text-anchor: middle; } #sld text.sm { fill: #94a3b8; font-size: 8px; }
#sld #sld-cos { fill: #111; font-weight: 700; font-size: 12px; }

#info { position: fixed; right: 12px; bottom: 44px; width: 340px; max-width: calc(100vw - 24px); background: rgba(15, 23, 42, .95); border: 1px solid #475569; border-radius: 10px; padding: 12px 14px; }
#info h3 { margin: 0 24px 6px 0; font-size: 14px; color: #fde68a; } #info p { margin: 0; }
#info-x { position: absolute; top: 6px; right: 6px; border: 0; background: none; font-size: 18px; padding: 0 6px; }
#hint { position: fixed; bottom: 10px; left: 340px; right: 0; text-align: center; color: #cbd5e1; font-size: 12px; pointer-events: none; text-shadow: 0 1px 3px #000; }
#toast { position: fixed; top: 52px; left: calc(50% + 165px); transform: translateX(-50%); background: #f59e0b; color: #111; padding: 6px 14px; border-radius: 8px; font-weight: 600; }

.lbl { pointer-events: none; white-space: nowrap; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(15, 23, 42, .72); color: #fff; }
.lbl.room { background: rgba(255, 255, 255, .85); color: #111; font-weight: 600; }
.lbl.el { background: rgba(161, 98, 7, .9); } .lbl.wa { background: rgba(3, 105, 161, .9); } .lbl.ws { background: rgba(120, 53, 15, .9); }

dialog { background: #0f172a; color: #e5e7eb; border: 1px solid #475569; border-radius: 12px; max-width: 580px; width: calc(100vw - 30px); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h3 { margin: 0 0 8px; } dialog svg { width: 100%; background: #f1f5f9; border-radius: 8px; } dialog svg .t { font-size: 13px; fill: #111; }
dialog form { text-align: right; }

@media (max-width: 760px) {
  #panel { top: auto; right: 0; width: auto; height: 42vh; border-right: 0; border-top: 1px solid #334155; }
  #view { inset: 0 0 42vh 0; }
  #hud { left: 8px; } #hint { display: none; } #info { bottom: calc(42vh + 8px); } #toast { left: 50%; }
}
