/* homeiq wizard — tokens lifted from homeiq.pl */
:root {
  --bg: #080c10; --surf: #111820; --surf2: #161d1e; --surf3: #20282a;
  --line: rgba(255,255,255,.075); --line-strong: rgba(1,190,223,.24); --line-ui: rgba(255,255,255,.12);
  --text: #dde4e6; --muted: #bac9cd; --dim: #829196;
  --cyan: #01bedf; --cyan-soft: #86e8f7; --cyan-deep: #005464; --cyan-ink: #00363e;
  --purple: #a855f7; --amber: #ffb238; --danger: #ff8f84;
  --font-head: "Bricolage Grotesque", "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-body: "Hanken Grotesk", "Helvetica Neue", Arial, system-ui, sans-serif;
  --rail-w: 264px; --panel-w: 320px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--cyan); text-decoration: none; } a:hover { color: var(--cyan-soft); }
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; letter-spacing: -0.01em; font-weight: 800; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
svg { flex-shrink: 0; }
[hidden] { display: none !important; }
.boot { display: flex; align-items: center; justify-content: center; height: 100vh; color: var(--dim); }

/* ---------- shell ---------- */
.app { display: flex; height: 100vh; min-width: 1180px; overflow: hidden; }
.rail { width: var(--rail-w); flex-shrink: 0; background: var(--surf); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.logo { display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.logo .word { font-family: var(--font-head); font-weight: 800; font-size: 22px; letter-spacing: -.02em; }
.logo .word b { color: var(--cyan); font-weight: 800; }
.rail-steps { padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; overflow: auto; }
.step { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 6px; color: var(--muted); font-size: 14px; font-weight: 600; width: 100%; text-align: left; }
.step:hover:not(:disabled) { background: var(--surf3); color: var(--text); }
.step:disabled { color: var(--dim); }
.step .n { width: 26px; height: 26px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; background: var(--surf3); color: var(--dim); flex-shrink: 0; }
.step.active { background: rgba(1,190,223,.08); color: var(--text); } .step.active .n { background: var(--cyan); color: var(--cyan-ink); }
.step.done .n { background: var(--cyan-deep); color: var(--cyan-soft); }
.step .warn-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 4px; background: var(--amber); }
.step .err-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 4px; background: var(--danger); }
.sub { display: flex; align-items: center; gap: 10px; height: 30px; padding-left: 50px; font-size: 13px; color: var(--dim); width: 100%; text-align: left; }
.sub:hover { color: var(--muted); }
.sub .dot { width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.18); flex-shrink: 0; }
.sub.active { color: var(--cyan-soft); font-weight: 600; } .sub.active .dot { background: var(--cyan); }
.sub.done { color: var(--muted); } .sub.done .dot { background: var(--cyan-deep); }
.rail-project { margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.device-list { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.device-row { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border-radius: 6px; font-size: 12px; color: var(--muted); text-align: left; width: 100%; }
.device-row:hover { background: var(--surf3); color: var(--text); }
.device-row.active { background: rgba(1,190,223,.08); color: var(--cyan-soft); font-weight: 600; }
.device-row.add { color: var(--dim); } .device-row.add:hover { color: var(--cyan); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 0 32px; border-bottom: 1px solid var(--line); }
.topbar .status { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 13px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; }
.content { flex: 1; overflow: auto; padding: 32px 40px 24px; display: flex; gap: 32px; align-items: flex-start; min-height: 0; }
.content > .col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content.centered { justify-content: center; }
.bottombar { height: 76px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 0 40px; border-top: 1px solid var(--line); background: var(--surf); }
.bottombar .extra { display: flex; align-items: center; gap: 10px; margin-left: 16px; color: var(--dim); font-size: 13px; flex-wrap: wrap; }
.bottombar .spacer { margin-left: auto; }

/* ---------- typography bits ---------- */
.eyebrow { color: var(--cyan); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.heading { display: flex; flex-direction: column; gap: 8px; margin-bottom: 28px; }
.heading h1 { font-size: 34px; line-height: 1.1; }
.heading .sub-text { color: var(--muted); font-size: 15px; max-width: 680px; }
.heading .heading-right { position: absolute; right: 0; top: 24px; }
.heading.has-right { position: relative; padding-right: 260px; }
.label { font-size: 12px; font-weight: 600; color: var(--muted); }
.hint { font-size: 12px; color: var(--dim); }
.hint.amber { color: var(--amber); } .hint.danger { color: var(--danger); } .hint.cyan { color: var(--cyan-soft); }
.b { font-weight: 700; color: var(--text); }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.stack { display: flex; flex-direction: column; } .stack-4 { gap: 4px; } .stack-6 { gap: 6px; } .stack-8 { gap: 8px; } .stack-12 { gap: 12px; } .stack-16 { gap: 16px; } .stack-20 { gap: 20px; } .stack-28 { gap: 28px; }
.row { display: flex; align-items: center; } .row-8 { gap: 8px; } .row-10 { gap: 10px; } .row-12 { gap: 12px; } .row-16 { gap: 16px; }
.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .ml-auto { margin-left: auto; } .ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 6px; font-weight: 800; font-size: 13px; letter-spacing: .01em; border: 1px solid transparent; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.btn-primary { background: var(--cyan); color: var(--cyan-ink); } .btn-primary:hover:not(:disabled) { background: var(--cyan-soft); }
.btn-primary:disabled { background: var(--cyan-deep); color: rgba(134,232,247,.6); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line-ui); } .btn-ghost:hover:not(:disabled) { color: var(--text); border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.03); }
.btn-ghost:disabled { color: var(--dim); border-color: rgba(255,255,255,.06); }
.btn-soft { background: rgba(1,190,223,.12); color: var(--cyan-soft); border-color: var(--line-strong); } .btn-soft:hover:not(:disabled) { background: rgba(1,190,223,.2); }
.btn-danger { background: rgba(255,143,132,.12); color: var(--danger); border-color: rgba(255,143,132,.3); }
.btn-sm { height: 36px; padding: 0 14px; } .btn-xs { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-link { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px; color: var(--cyan); font-weight: 700; font-size: 13px; border-radius: 6px; }
.btn-link:hover { background: rgba(1,190,223,.06); color: var(--cyan-soft); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 6px; color: var(--dim); flex-shrink: 0; }
.icon-btn:hover { background: var(--surf3); color: var(--text); }
.icon-btn.on { color: var(--cyan); background: rgba(1,190,223,.1); }
.icon-btn.danger:hover { color: var(--danger); background: rgba(255,143,132,.1); }

/* ---------- cards / chips ---------- */
.card { background: var(--surf); border: 1px solid var(--line); border-radius: 8px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 16px; font-weight: 700; }
.card-body { padding: 16px 20px; }
.card-row { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.card-row:last-child { border-bottom: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 6px; background: var(--surf3); color: var(--muted); font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.chip-cyan { background: rgba(1,190,223,.08); color: var(--cyan-soft); border-color: var(--line-strong); }
.chip-amber { background: rgba(255,178,56,.1); color: var(--amber); border-color: rgba(255,178,56,.3); }
.chip-purple { background: rgba(168,85,247,.1); color: var(--purple); border-color: rgba(168,85,247,.3); }
.chip-danger { background: rgba(255,143,132,.1); color: var(--danger); border-color: rgba(255,143,132,.3); }
.chip-dim { color: var(--dim); }
.chip-sm { height: 24px; font-size: 11px; padding: 0 8px; }
button.chip:hover { border-color: rgba(255,255,255,.2); color: var(--text); }
button.chip.chip-cyan:hover { color: var(--cyan-soft); }
.chip .count { font-weight: 800; color: var(--text); } .chip-cyan .count { color: var(--cyan-soft); }
.chip.locked { cursor: default; }
.badge { display: inline-flex; align-items: center; justify-content: center; height: 24px; min-width: 42px; padding: 0 8px; border-radius: 5px; font-size: 11px; font-weight: 800; letter-spacing: .04em; flex-shrink: 0; }
.badge-relay { background: rgba(1,190,223,.12); color: var(--cyan-soft); }
.badge-pwm { background: rgba(168,85,247,.14); color: #d4b3ff; }
.badge-in { background: rgba(255,178,56,.14); color: var(--amber); }
.badge-dim { background: var(--surf3); color: var(--dim); }
.info-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 6px; background: rgba(1,190,223,.06); border: 1px solid var(--line-strong); color: var(--muted); font-size: 13px; }
.info-bar.amber { background: rgba(255,178,56,.06); border-color: rgba(255,178,56,.3); }
.info-bar.danger { background: rgba(255,143,132,.06); border-color: rgba(255,143,132,.3); }
.stat { flex: 1; padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat .num { font-family: var(--font-head); font-size: 34px; font-weight: 800; color: var(--cyan-soft); line-height: 1; }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.field .msg { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--danger); }
.input, .select, textarea.input { height: 40px; width: 100%; padding: 0 12px; border-radius: 6px; background: var(--surf3); border: 1px solid rgba(255,255,255,.1); color: var(--text); font-size: 14px; outline: none; transition: border-color .12s, box-shadow .12s; }
.input::placeholder { color: var(--dim); }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(1,190,223,.18); }
.input.error, .select.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255,143,132,.16); }
.input.warn, .select.warn { border-color: rgba(255,178,56,.6); }
.input:disabled, .select:disabled { opacity: .5; }
.input-sm, .select-sm { height: 32px; font-size: 13px; padding: 0 10px; }
.select { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23829196' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; cursor: pointer; }
.select option { background: #161d1e; color: var(--text); }
.select.ghost { background-color: transparent; border-color: transparent; }
.select.ghost:hover { background-color: var(--surf3); border-color: rgba(255,255,255,.1); }
.input.ghost { background: transparent; border-color: transparent; } .input.ghost:hover { background: var(--surf3); border-color: rgba(255,255,255,.1); }
textarea.input { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
.input-wrap { position: relative; display: flex; align-items: center; } .input-wrap .input { padding-right: 36px; } .input-wrap .right { position: absolute; right: 10px; color: var(--dim); display: flex; }
.cable-wrap { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; }
.cable-wrap .prefix { position: absolute; left: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--dim); pointer-events: none; }
.cable-wrap .input.ghost + .prefix { color: var(--dim); }
.seg { display: inline-flex; border: 1px solid var(--line-ui); border-radius: 6px; overflow: hidden; }
.seg > button { height: 40px; padding: 0 16px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); border-right: 1px solid rgba(255,255,255,.08); }
.seg > button:last-child { border-right: 0; }
.seg > button:hover:not(:disabled) { background: rgba(255,255,255,.04); color: var(--text); }
.seg > button.on { background: rgba(1,190,223,.12); color: var(--cyan-soft); }
.seg > button:disabled { color: var(--dim); }
.seg-sm > button { height: 32px; padding: 0 12px; font-size: 12px; }
.toggle { width: 40px; height: 22px; border-radius: 11px; background: var(--surf3); position: relative; flex-shrink: 0; transition: background .12s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 8px; background: var(--dim); transition: left .12s, background .12s; }
.toggle.on { background: var(--cyan); } .toggle.on::after { left: 21px; background: var(--cyan-ink); }
.toggle:disabled { opacity: .5; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-ui); border-radius: 6px; overflow: hidden; height: 36px; }
.stepper > button { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.stepper > button:hover:not(:disabled) { background: rgba(255,255,255,.05); color: var(--text); }
.stepper > button:disabled { color: rgba(255,255,255,.15); }
.stepper .val { width: 40px; height: 34px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; color: var(--text); border-left: 1px solid rgba(255,255,255,.08); border-right: 1px solid rgba(255,255,255,.08); font-family: var(--font-head); }
.checkbox { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(255,255,255,.25); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: transparent; }
.checkbox.on { background: var(--cyan); border-color: var(--cyan); }
.check-row { display: flex; align-items: center; gap: 8px; height: 30px; font-size: 13px; color: var(--muted); text-align: left; width: 100%; }
.check-row.on { color: var(--text); }
.kv { display: flex; flex-direction: column; gap: 6px; }
.kv-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv-line .v { font-weight: 600; text-align: right; }
.kv-line .v.warn { color: var(--amber); }

/* ---------- tiles (Bryła) ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 8px; background: var(--surf2); border: 1px solid var(--line); position: relative; min-height: 116px; text-align: left; color: var(--muted); transition: border-color .12s; }
.tile:hover { border-color: rgba(255,255,255,.18); }
.tile.on { background: rgba(1,190,223,.06); border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset; color: var(--cyan); }
.tile .t { font-weight: 700; font-size: 15px; color: var(--text); } .tile .h { margin-top: 2px; }
.tile .mark { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 11px; background: var(--cyan); display: flex; align-items: center; justify-content: center; }

/* ---------- side panel ---------- */
.panel { width: var(--panel-w); flex-shrink: 0; align-self: flex-start; display: flex; flex-direction: column; position: sticky; top: 0; max-height: calc(100vh - 64px - 76px - 56px); overflow: auto; }
.panel-336 { width: 336px; }
.panel .card-head { padding: 16px 20px 12px; }
.panel .card-head h3 { font-size: 15px; }
.panel-section { padding: 12px 20px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.panel-section:last-child { border-bottom: 0; }
.panel .input, .panel .select { height: 36px; } .panel .seg > button { height: 34px; }
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter .bar { height: 6px; border-radius: 3px; background: var(--surf3); overflow: hidden; } .meter .bar > div { height: 6px; border-radius: 3px; }
.struct-level { display: flex; flex-direction: column; gap: 6px; padding: 10px 10px 12px; border-radius: 6px; background: var(--surf2); }

/* ---------- house matrix / levels ---------- */
.matrix-row { display: grid; align-items: center; min-height: 48px; border-bottom: 1px solid var(--line); padding: 0 8px 0 16px; }
.matrix-row:last-child { border-bottom: 0; }
.matrix-head { min-height: 48px; }
.matrix-cell { display: flex; justify-content: center; }
.lvl-col { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--surf); border: 1px solid var(--line); border-radius: 8px; }
.lvl-head { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); }
.lvl-body { padding: 8px; display: flex; flex-direction: column; gap: 2px; min-height: 60px; }
.lvl-col.drop-target { border-color: var(--cyan); }
.row-room { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 6px 0 6px; border-radius: 6px; border: 1px solid transparent; }
.row-room:hover { background: var(--surf3); }
.row-room .acts { display: none; gap: 2px; } .row-room:hover .acts { display: flex; }
.row-room .kind { font-size: 12px; color: var(--dim); } .row-room:hover .kind { display: none; }
.row-room.dup { border-color: rgba(255,178,56,.4); }
.row-room.dragging { opacity: .35; }
.row-room .grip { color: var(--dim); cursor: grab; display: flex; }
.row-room .name-btn { flex: 1; min-width: 0; text-align: left; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-room .input { height: 32px; padding: 0 10px; }
.add-level { width: 160px; flex-shrink: 0; height: 120px; border: 1px dashed rgba(255,255,255,.16); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); }
.add-level:hover { border-color: var(--cyan); color: var(--text); }

/* ---------- lists (outputs / inputs) ---------- */
.list-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.list-toolbar .search { margin-left: auto; width: 220px; }
.list { display: flex; flex-direction: column; }
.list-head { display: grid; align-items: center; height: 34px; padding: 0 10px 0 8px; border-bottom: 1px solid var(--line); }
.list-head .label { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.list-group { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.list-group .bar { flex: 1; height: 4px; border-radius: 2px; background: var(--surf3); overflow: hidden; } .list-group .bar > div { height: 4px; }
.lrow { display: grid; align-items: center; min-height: 44px; padding: 0 6px 0 8px; border-radius: 6px; border-left: 2px solid transparent; gap: 8px; }
.lrow:hover { background: rgba(255,255,255,.025); }
.lrow.selected { background: rgba(1,190,223,.06); border-left-color: var(--cyan); }
.lrow.selected.pwm { background: rgba(168,85,247,.07); border-left-color: var(--purple); }
.lrow.selected.in { background: rgba(255,178,56,.06); border-left-color: var(--amber); }
.lrow.follower { opacity: .6; }
.lrow .select, .lrow .input { height: 32px; font-size: 13px; }
.lrow .select.ghost { padding-left: 8px; } .lrow .input.ghost { padding-left: 8px; }
.lrow .name-hint { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .miss { color: var(--amber); font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.linker { width: 14px; display: flex; justify-content: center; color: var(--dim); }
.wire-dot { width: 12px; height: 12px; border-radius: 6px; border: 1px solid rgba(255,255,255,.25); flex-shrink: 0; display: inline-block; }
.wire-dot.half { background: linear-gradient(135deg, var(--c1) 50%, var(--c2) 50%); }
.wire-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 5px; background: var(--surf3); font-size: 11px; font-weight: 700; color: var(--muted); }
.pair-bracket { width: 8px; align-self: stretch; border: 1px solid var(--line-ui); border-right: 0; border-radius: 4px 0 0 4px; margin: 6px 0; }
.flags { display: flex; gap: 4px; }
.flag { width: 22px; height: 22px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; color: var(--dim); background: transparent; border: 1px solid transparent; }
.flag.on { color: var(--amber); background: rgba(255,178,56,.12); border-color: rgba(255,178,56,.3); }
.flag.on.cyan { color: var(--cyan-soft); background: rgba(1,190,223,.12); border-color: var(--line-strong); }
.flag:hover { border-color: rgba(255,255,255,.2); }

/* rooms view */
.room-card { display: flex; flex-direction: column; }
.room-card .rc-head { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.dev-row { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 14px; border-bottom: 1px solid var(--line); }
.dev-row:last-child { border-bottom: 0; }
.level-head { display: flex; align-items: center; gap: 10px; height: 36px; margin: 12px 0 8px; font-weight: 700; }
.popover { position: absolute; z-index: 30; background: var(--surf2); border: 1px solid var(--line-ui); border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.5); padding: 6px; min-width: 240px; }
.popover button { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border-radius: 6px; text-align: left; font-size: 13px; color: var(--text); }
.popover button:hover:not(:disabled) { background: var(--surf3); } .popover button:disabled { color: var(--dim); }
.popover button .hint { margin-left: auto; }

/* ---------- switch face (control point editor) ---------- */
.slot-preset { width: 44px; height: 44px; border-radius: 6px; border: 1px solid var(--line-ui); display: flex; align-items: center; justify-content: center; background: var(--surf3); }
.slot-preset.on { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset; }
.face { display: flex; gap: 8px; padding: 12px; border-radius: 10px; background: #0d1216; border: 1px solid var(--line-ui); }
.face .slot { display: grid; gap: 4px; border-radius: 6px; background: var(--surf3); padding: 4px; }
.face .key { border-radius: 4px; background: var(--surf2); border: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 800; color: var(--muted); min-width: 0; }
.face .key.on { border-color: var(--amber); color: var(--amber); background: rgba(255,178,56,.08); }
.face .key .in { font-size: 10px; font-weight: 600; color: var(--dim); }
.face .slot.blank { background: transparent; border: 1px dashed rgba(255,255,255,.1); }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--surf); border: 1px solid var(--line-ui); border-radius: 10px; box-shadow: 0 24px 80px rgba(0,0,0,.6); width: 960px; max-width: calc(100vw - 48px); max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 20px; }
.modal-body { padding: 20px 24px; overflow: auto; display: flex; gap: 24px; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surf2); }
.modal.sm { width: 520px; }

/* ---------- misc ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { text-align: left; font-weight: 600; color: var(--dim); padding: 6px 8px; border-bottom: 1px solid var(--line); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.table td { padding: 7px 8px; border-bottom: 1px solid var(--line); color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.log { background: #0a0f13; border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.5; color: var(--muted); height: 220px; overflow: auto; white-space: pre-wrap; }
.log .ok { color: var(--cyan-soft); } .log .err { color: var(--danger); } .log .warn { color: var(--amber); }
.pipeline { display: flex; align-items: center; gap: 8px; }
.pipeline .pstep { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 6px; background: var(--surf2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--dim); }
.pipeline .pstep.done { color: var(--cyan-soft); border-color: var(--line-strong); }
.pipeline .pstep.run { color: var(--text); border-color: var(--cyan); }
.pipeline .pstep.fail { color: var(--danger); border-color: rgba(255,143,132,.4); }
.pipeline .arrow { color: var(--dim); }
.spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 96px; right: 40px; z-index: 200; background: var(--surf2); border: 1px solid var(--line-ui); border-radius: 8px; padding: 12px 16px; box-shadow: 0 12px 40px rgba(0,0,0,.5); font-size: 13px; max-width: 420px; display: flex; gap: 10px; align-items: flex-start; }
.toast.err { border-color: rgba(255,143,132,.4); } .toast.ok { border-color: var(--line-strong); }
.recent-row { display: flex; align-items: center; gap: 14px; height: 56px; padding: 0 16px; border-top: 1px solid var(--line); }
.check-item { display: flex; align-items: flex-start; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.check-item:last-child { border-bottom: 0; }
.check-item .chip { white-space: normal; height: auto; min-height: 24px; padding: 3px 8px; line-height: 1.3; }
.dropzone { border: 1px dashed rgba(255,255,255,.2); border-radius: 8px; padding: 20px; text-align: center; color: var(--dim); }
.dropzone.over { border-color: var(--cyan); color: var(--cyan-soft); background: rgba(1,190,223,.05); }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 5px; border: 2px solid var(--bg); } ::-webkit-scrollbar-track { background: transparent; }

/* ---------- controllers: accordion (step 2) and tabs (steps 3–7) ---------- */
.accordion { display: flex; flex-direction: column; gap: 8px; }
.acc-head { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 16px; border-radius: 8px; background: var(--surf); border: 1px solid var(--line); text-align: left; color: var(--text); }
.acc-head:hover { border-color: rgba(255,255,255,.2); background: var(--surf2); }
.acc-head.active { border-radius: 8px 8px 0 0; border-color: var(--line-strong); background: rgba(1,190,223,.06); }
.acc-head.active:hover { background: rgba(1,190,223,.06); }
.acc-idx { width: 26px; height: 26px; border-radius: 13px; background: var(--surf3); color: var(--dim); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.acc-idx.on { background: var(--cyan); color: var(--cyan-ink); }
.acc-open { border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surf2); overflow: hidden; }
.acc-open .acc-head { border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0; }
.acc-add { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 16px; border-radius: 8px; border: 1px dashed rgba(255,255,255,.18); color: var(--muted); text-align: left; }
.acc-add:hover { border-color: var(--cyan); color: var(--text); }
.device-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -8px 0 16px; padding: 6px 8px; border-radius: 8px; background: var(--surf); border: 1px solid var(--line); }
.dtab { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--muted); border: 1px solid transparent; max-width: 260px; }
.dtab:hover { background: var(--surf3); color: var(--text); }
.dtab.active { background: rgba(1,190,223,.12); color: var(--cyan-soft); border-color: var(--line-strong); }
.dtab.add { color: var(--dim); font-size: 12px; } .dtab.add:hover { color: var(--cyan); }
.dtab-idx { width: 18px; height: 18px; border-radius: 9px; background: var(--surf3); color: var(--dim); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
.dtab.active .dtab-idx { background: var(--cyan); color: var(--cyan-ink); }

/* downloads list (step 7 side panel) */
.dl-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.dl-item:last-child { border-bottom: 0; }
.dl-item > svg { margin-top: 2px; }
.dl-sub { white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.dl-state { flex-shrink: 0; display: flex; align-items: center; height: 20px; margin-top: 1px; }
a.dl-item:hover .grow > div:first-child { color: var(--cyan-soft); }
