[hidden] { display: none !important; }
:root {
  --bg: #0f1115;
  --panel: #171a21;
  --card: #1e222b;
  --line: #2c323d;
  --text: #e8eaee;
  --dim: #9aa3b2;
  --accent: #ffb000;
  --accent-text: #1a1200;
  --on: #2d6cdf;
  --bad: #ff5a5a;
  --ok: #3ccf7a;
  --radius: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { display: flex; flex-direction: column; height: 100vh; }
.loading { padding: 2rem; color: var(--dim); }
h2 { font-size: 15px; margin: 0; }
h3 { font-size: 13px; margin: 0 0 8px; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; }
button, select, input { font: inherit; color: inherit; }
button {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer;
}
button:hover:not(:disabled) { border-color: #4a5260; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--bad); }
button.icon { padding: 2px 8px; background: none; border-color: transparent; font-size: 16px; line-height: 1; }
button.big { padding: 10px 16px; width: 100%; }
button:focus-visible, input:focus-visible, select:focus-visible, .xypad:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input, select { background: #0c0e12; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.hint { color: var(--dim); font-size: 13px; }
.error { color: var(--bad); margin: 0; }
.error:empty { display: none; }
.bad { color: var(--bad); }
.empty { padding: 32px 16px; text-align: center; color: var(--dim); }
.empty p:first-child { color: var(--text); font-size: 15px; }

/* Top bar */
.top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; display: flex; gap: 6px; align-items: center; font-size: 16px; }
.logo { width: 22px; height: 22px; display: inline-flex; filter: drop-shadow(0 0 4px rgba(255, 176, 0, .45)); }
.logo svg { width: 100%; height: 100%; }
.startbrand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; }
.startbrand .logo { width: 34px; height: 34px; }
.showname { width: 150px; min-width: 60px; flex-shrink: 1; background: transparent; border-color: transparent; font-weight: 600; }
.showname:hover, .showname:focus { border-color: var(--line); }
.tabs { display: flex; gap: 2px; background: #0c0e12; border-radius: 8px; padding: 3px; }
.tabs button { border: 0; background: none; padding: 6px 14px; color: var(--dim); white-space: nowrap; }
.top > button, .files button { white-space: nowrap; }
.tabs button.on { background: var(--card); color: var(--text); }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Steps: Fixtures → Stage → Looks → Cues → Connect → Run (like VenuCable's) */
.flowsteps { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.flowstep { border: 0; background: none; padding: 6px 8px; border-radius: 6px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; }
.flowstep.st-ok { color: var(--ok); }
.flowstep.st-warn { color: var(--accent); }
.flowstep.st-bad { color: var(--bad); }
.flowstep.st-skip { color: #6b7380; }
.flowstep.st-go { color: var(--text); }
.flowstep.st-next { border-bottom-color: var(--accent); }
.flowstep.on { background: var(--card); }
.flowstep.extra { margin-left: auto; font-weight: 500; letter-spacing: .04em; }
.st-sep { width: 12px; height: 1px; background: var(--line); }
.stephint { flex-basis: 100%; margin: 0; padding: 0 8px 2px; font-size: 13px; color: var(--dim); }
.stephint:empty { display: none; }

/* Run: the show, big. GO and Back at the bottom, under the thumb. */
main.tab-run { display: block; padding: 0; }
.run { max-width: 760px; margin: 0 auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; min-height: 100%; height: 100%; }
.runtop { display: flex; align-items: center; gap: 10px; }
.runtop h2 { flex: 1; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.runlock { display: flex; align-items: center; gap: 6px; min-height: 40px; }
.runstage { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 8px; }
.runscene { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.runscene:empty { display: none; }
.runnow { font-size: 28px; font-weight: 800; line-height: 1.15; }
.runstage .progress { height: 6px; border-radius: 3px; }
.runstatus { color: var(--dim); font-size: 13px; min-height: 18px; }
.runnext { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border: 1px dashed #3a4250; border-radius: 14px; }
.runlabel { font-size: 12px; color: var(--dim); letter-spacing: .08em; text-transform: uppercase; }
.runnextname { flex: 1; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.runnextfade { font-size: 12px; color: var(--dim); }
.runlistwrap { flex: 1; min-height: 120px; display: flex; flex-direction: column; }
.runlistwrap h3 { margin-bottom: 6px; }
.runlist { flex: 1; display: flex; flex-direction: column; gap: 4px; overflow: auto; position: relative; min-height: 0; }
.runcue { flex: none; display: flex; gap: 12px; align-items: center; text-align: left; min-height: 48px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
.runcue b { min-width: 34px; color: var(--dim); }
.runcue i { margin-left: auto; font-style: normal; font-size: 12px; color: var(--dim); }
.runcue.done { color: var(--dim); }
.runcue.current { border: 2px solid var(--ok); background: rgba(60, 207, 122, .12); }
.runcue.current b { color: var(--ok); }
.runcue.next { border-color: #1d6b40; }
.runheading { margin-top: 8px; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.runbottom { display: grid; gap: 10px; position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 calc(6px + env(safe-area-inset-bottom)); }
.runmaster .slider { flex: 1; }
.runrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.runrow button { min-height: 46px; font-size: 15px; font-weight: 600; }
.runblack.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.runbuttons { display: grid; grid-template-columns: 1fr 2.2fr; gap: 10px; }
.runbuttons button { min-height: 84px; font-size: 20px; font-weight: 800; border-radius: 16px; }
.rungo { background: var(--ok); border-color: var(--ok); color: #04210f; letter-spacing: .1em; font-size: 34px !important; }
.run.locked .runbuttons, .run.locked .runrow, .run.locked .runmaster, .run.locked .runlist { opacity: .35; }
.rununlock { min-height: 52px; font-weight: 700; border-color: var(--accent); color: var(--accent); background: linear-gradient(90deg, rgba(255,176,0,.25) 0 0, transparent 0) no-repeat; background-size: 0 100%; }
.rununlock.holding { background-size: 100% 100%; transition: background-size .8s linear; }
.files { display: flex; gap: 4px; }
.output { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.output .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); }
.output[data-state=on] .dot { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.output[data-state=sim] .dot { background: var(--accent); }
.output[data-state=lost] .dot, .output[data-state=error] .dot { background: var(--bad); }
.output[data-state=lost], .output[data-state=error] { border-color: var(--bad); }
.output[data-state=off] { border-color: var(--accent); }
.master { display: flex; align-items: center; gap: 6px; color: var(--dim); }
.gm { width: 110px; accent-color: var(--accent); }
.gmtext { width: 38px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.blackout { font-weight: 600; }
.menu { position: relative; }
.menubtn { display: flex; align-items: center; justify-content: center; width: 40px; height: 34px; padding: 0; }
.menulist { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 260px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.5); display: grid; gap: 2px; }
.menulist button { display: flex; justify-content: space-between; gap: 16px; border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 6px; }
.menulist button:hover { background: #2a2f3a; }
.menulist kbd { font: inherit; font-size: 12px; color: var(--dim); }
.menulist hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.blackout.on { background: var(--bad); border-color: var(--bad); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .7; } }

/* Playback bar */
.playbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #13161c; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.playbar .go { background: var(--ok); border-color: var(--ok); color: #04210f; font-weight: 800; font-size: 18px; padding: 8px 26px; letter-spacing: .05em; }
.playbar .go:disabled { background: var(--card); border-color: var(--line); color: var(--dim); }
.cuenow { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 3px; }
.cuetext { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nexttext { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress .fill { height: 100%; width: 0; background: var(--dim); }
.progress.fading .fill { background: var(--ok); }
.pbactions { display: flex; gap: 6px; }
.pbmore { display: none; }
.progtabs { display: none; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: #0c0e12; padding: 3px; border-radius: 10px; position: sticky; top: 0; z-index: 2; margin-bottom: 4px; }
.progtabs button { border: 0; background: none; color: var(--dim); height: 36px; padding: 0 4px; font-size: 13px; font-weight: 600; }
.progtabs button.on { background: #2a2f3a; color: var(--text); }
button.record { color: #ff7a7a; }
.livechanges { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; padding: 4px 4px 4px 10px; border-radius: 8px; background: rgba(255, 176, 0, .1); border: 1px solid #5a4410; }
.livechanges b { color: #ffc840; }
.livechanges .livedot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.livechanges button { border-color: #5a4410; color: #ffc840; background: none; padding: 4px 10px; }
.livechanges:empty { display: none; }
.darkwarn { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 4px 4px 10px; border-radius: 8px; background: rgba(255, 90, 90, .12); border: 1px solid #7a2a2a; }
.darkwarn b { color: #ff8a8a; }
.darkwarn .darkdot { width: 8px; height: 8px; border-radius: 50%; background: #ff5a5a; flex: none; }
.darkwarn button { border-color: #7a2a2a; color: #ff8a8a; background: none; padding: 4px 10px; }
.darkwarn:empty { display: none; }
.tile.held::after { content: ""; position: absolute; bottom: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* Cues */
table.cuelist { width: 100%; border-collapse: collapse; }
table.cuelist th { text-align: left; color: var(--dim); font-weight: 500; font-size: 12px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.cuelist td { padding: 4px 6px; border-bottom: 1px solid #22262f; }
table.cuelist .name { width: 100%; }
table.cuelist tr.current { background: linear-gradient(90deg, rgba(60, 207, 122, .16) calc(var(--p, 1) * 100%), rgba(60, 207, 122, .05) 0); }
table.cuelist tr.next .cuego { border-color: var(--ok); }
.cuego { min-width: 64px; font-weight: 700; font-variant-numeric: tabular-nums; }
.secs { white-space: nowrap; color: var(--dim); }
input.secs { width: 70px; color: var(--text); }
td.actions { white-space: nowrap; text-align: right; }

/* Tempo & sound */
.tempo { display: flex; gap: 6px; margin-left: auto; }
.tap { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; min-width: 96px; font-variant-numeric: tabular-nums; }
.beatdot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); opacity: .15; }
.tempo.active .tap { border-color: var(--accent); }
.soundbtn.on { border-color: var(--accent); color: var(--accent); }
.soundpanel { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; padding: 12px; background: #13161c; border-bottom: 1px solid var(--line); }
.sgroup { display: flex; flex-direction: column; gap: 8px; }
.sgroup h3 { margin: 0; }
.sgroup .row { flex-wrap: wrap; }
.choice.small { padding: 4px 8px; align-items: center; font-size: 13px; }
.meter { height: 8px; background: #0c0e12; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.meterfill { height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), var(--accent) 70%, var(--bad)); }
select.unit { margin-left: 4px; padding: 4px; }

/* Layout */
main { flex: 1; min-height: 0; display: grid; gap: 10px; padding: 10px; }
main.tab-control { grid-template-columns: minmax(280px, 1fr) minmax(360px, 520px); }
main.tab-patch { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); grid-template-rows: minmax(0, 1fr); }
main.tab-channels, main.tab-cues { grid-template-columns: 1fr; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-height: 0; min-width: 0; overflow: auto; padding: 12px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.count { color: var(--dim); }

/* Patch */
.universe .map { display: grid; grid-template-columns: repeat(32, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.universe .cell { height: 10px; background: #0c0e12; cursor: default; }
.universe .cell.used { cursor: pointer; }
.universe .cell.clash { background: var(--bad); }
.universe .hint { margin: 6px 0 12px; }
.tablewrap { overflow-x: auto; }
table.patch { width: 100%; border-collapse: collapse; }
table.patch th { text-align: left; color: var(--dim); font-weight: 500; font-size: 12px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.patch td { padding: 4px 6px; border-bottom: 1px solid #22262f; vertical-align: middle; }
table.patch tr.has-problem td { background: rgba(255, 90, 90, .07); }
table.patch .fid { width: 56px; }
table.patch .name { width: 100%; min-width: 120px; }
table.patch .type { white-space: nowrap; color: var(--dim); }
table.patch .addr { white-space: nowrap; }
table.patch .addr input { width: 64px; }
table.patch .range { color: var(--dim); margin-left: 4px; font-variant-numeric: tabular-nums; }
table.patch .flags label { display: block; font-size: 12px; color: var(--dim); white-space: nowrap; }
table.patch .problem { font-size: 12px; max-width: 220px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px; background: var(--card); border-radius: 6px; margin-bottom: 8px; }
.searchrow { display: flex; gap: 6px; }
.search { flex: 1; min-width: 0; }
.results { margin: 8px 0; max-height: 40vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.result { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; text-align: left; background: none; border-color: transparent; padding: 6px 8px; }
.result:hover { background: var(--card); }
.result.on { background: var(--card); border-color: var(--accent); }
.result .maker { color: var(--dim); }
.result .fname { font-weight: 600; }
.result .cats { grid-column: 1 / -1; color: var(--dim); font-size: 12px; }
.detail { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.detail:empty { display: none; }
.results[hidden] { display: none; }
.pickedhead { display: flex; align-items: center; gap: 8px; }
.pickedhead h3 { flex: 1; }
.panel.adder { display: flex; flex-direction: column; overflow: hidden; }
.add { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.addscroll { flex: 1; min-height: 0; overflow: auto; margin: 0 -12px; padding: 0 12px; }
.addbar { flex: none; display: flex; flex-direction: column; gap: 8px; margin: 0 -12px -12px; padding: 10px 12px 12px; background: var(--panel); border-top: 1px solid var(--line); }
.addbar[hidden] { display: none; }
/* Narrow screens: the page scrolls, so the bar sits just above the playbar instead. */
@media (max-width: 860px) {
  .panel.adder, .addscroll { overflow: visible; }
  .addbar { position: sticky; bottom: var(--playbar-h, 0px); z-index: 4; }
}
.addbar > button { width: 100%; }
.detail h3 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 15px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; color: var(--dim); font-size: 13px; flex: 1; }
.field input, .field select { color: var(--text); }
.fields { display: flex; gap: 8px; flex-wrap: wrap; }
.fields .field { min-width: 0; flex: 1 1 80px; }
.field input { min-width: 0; width: 100%; }
.other-ways { display: flex; gap: 6px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* Control: fixtures */
.selbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.selbuttons, .groups { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.chip.on { border-color: var(--accent); color: var(--accent); }
.chip.user { border-style: dashed; }
.chip.add { color: var(--dim); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px; min-height: 104px; background: var(--card); text-align: center; }
.tile.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tile .fid { position: absolute; top: 4px; left: 6px; font-size: 12px; color: var(--dim); font-weight: 600; }
.tile .lamp { width: 34px; height: 34px; border-radius: 50%; background: #111; border: 2px solid #000; transition: background .08s; }
.tile .tname { font-size: 12px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile .level { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.tile .pt { position: absolute; top: 6px; right: 6px; width: 16px; height: 16px; border: 1px solid var(--line); border-radius: 3px; }
.tile .ptdot { position: absolute; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: var(--accent); }

/* Control: programmer */
.programmer { display: flex; flex-direction: column; gap: 10px; }
.prog-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.prog-head h2 { flex: 1 1 160px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog-head .btns { display: flex; gap: 6px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.sliderrow { display: flex; align-items: center; gap: 10px; }
.slider { flex: 1; min-width: 0; accent-color: var(--accent); height: 28px; }
.value { width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.value.small { width: auto; max-width: 45%; font-size: 12px; color: var(--dim); text-align: right; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.quick button { flex: 1; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 6px; }
.sw { height: 34px; border-radius: 6px; border: 1px solid rgba(255,255,255,.2); padding: 0; }
.sw.custom { display: flex; align-items: center; justify-content: center; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); position: relative; font-weight: 700; color: #000; cursor: pointer; }
.sw.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.emitters { margin-top: 10px; }
.elabel { width: 86px; display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 13px; }
.elabel i { width: 10px; height: 10px; border-radius: 50%; }
.position { display: grid; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr); gap: 12px; align-items: start; }
.xypad { position: relative; aspect-ratio: 1; background: #0c0e12; border: 1px solid var(--line); border-radius: 6px; touch-action: none; cursor: crosshair;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 25% 25%; background-position: -1px -1px; }
.xycross { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; border: 1px solid var(--dim); border-radius: 50%; }
.padshape { position: absolute; border: 1px solid rgba(255,176,0,.45); background: rgba(255,176,0,.06); pointer-events: none; }
.xydot { position: absolute; width: 16px; height: 16px; margin: -8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); pointer-events: none; }
.ptcontrols { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.position > .hint { grid-column: 1 / -1; margin: 0; }
.ptcontrols .elabel { width: 34px; }
.channel { padding: 6px 0; border-top: 1px solid var(--line); }
.channel:first-of-type { border-top: 0; }
.chhead { display: flex; justify-content: space-between; margin-bottom: 4px; }
.chname { font-weight: 600; }
.dmx { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.caps { display: flex; flex-wrap: wrap; gap: 4px; }
.cap { padding: 3px 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.cap.on { border-color: var(--accent); color: var(--accent); }
.capsw { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); }
.channel select { width: 100%; }
details.card summary { cursor: pointer; list-style: none; }
details.card summary h3 { display: inline; }
details.card summary::before { content: "▸ "; color: var(--dim); }
details[open].card summary::before { content: "▾ "; }

/* DMX channels */
.dmxgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 3px; }
.dmxcell { --level: 0; position: relative; padding: 3px 2px; min-height: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; background: #0c0e12; border-radius: 4px; font-variant-numeric: tabular-nums; }
.dmxcell::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--level) * 100%); background: rgba(255, 176, 0, .28); }
.dmxcell.used { background: var(--card); }
.dmxcell.first { border-left: 2px solid var(--accent); }
.dmxcell.forced { border-color: var(--bad); }
.dmxcell .ch { font-size: 10px; color: var(--dim); position: relative; }
.dmxcell .v { font-size: 13px; position: relative; }

/* Dialogs */
dialog.modal { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog.modal.wide { width: min(680px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .6); }
dialog header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
dialog .stack { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); }
.choice p { margin: 2px 0 0; color: var(--dim); font-size: 13px; }
.row { display: flex; align-items: center; gap: 6px; }
.buttons { display: flex; gap: 8px; justify-content: flex-end; }
dialog details { color: var(--dim); font-size: 13px; }
dialog details ul { padding-left: 18px; }
.builder-rows { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; max-height: 45vh; overflow: auto; }
.builder-rows li { display: flex; gap: 6px; align-items: center; }
.builder-rows select { flex: 1; }
.builder-rows input { flex: 1; min-width: 0; }
.chno { width: 26px; text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; }

#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--card); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 10; max-width: calc(100vw - 32px); }
#toast.error { border-color: var(--bad); }

/* Narrow screens (tablet portrait, phone) */
@media (max-width: 1180px) {
  .top { flex-wrap: wrap; }
  .mlabel { display: none; }
  .showname { width: 100px; }
  .tabs button { padding: 6px 10px; }
  .gm { width: 80px; }
}
@media (max-width: 860px) {
  .top { flex-wrap: wrap; }
  #app { height: auto; min-height: 100vh; }
  main.tab-control, main.tab-patch { grid-template-columns: 1fr; }
  .panel { overflow: visible; }
  .top { gap: 6px; }
  .showname { width: 120px; }
  .gm { width: 80px; }
  .position { grid-template-columns: 1fr; }
  .xypad { max-width: 280px; }

  /* Phone: the fixture controls in tabs */
  .progtabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: #0c0e12; padding: 3px; border-radius: 10px; position: sticky; top: 0; z-index: 2; }
  .progtabs button { border: 0; background: none; color: var(--dim); height: 36px; padding: 0 4px; font-size: 13px; font-weight: 600; }
  .progtabs button.on { background: #2a2f3a; color: var(--text); }
  .programmer .away { display: none; }

  /* Phone: the playback bar at the bottom, under the thumb */
  .top { padding: 8px 12px; }
  .top .output { padding: 6px 10px; font-size: 13px; }
  .master, #surface, .savebtn { display: none; }
  .top .showname { flex: 1; width: auto; }
  .brand { font-size: 0; gap: 0; }
  .top { flex-wrap: nowrap; }
  .top .showname { min-width: 40px; }
  .top .blackout { padding: 6px 10px; }
  main { order: 5; }
  .pbwrap { order: 10; position: sticky; bottom: 0; z-index: 5; }
  .playbar { display: grid; grid-template-columns: 1fr 1.7fr 1.3fr 48px; gap: 8px; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-bottom: 0; }
  .playbar .cuenow, .playbar .livechanges, .playbar .darkwarn, .playbar .building { grid-column: 1 / -1; order: -1; min-width: 0; }
  .playbar .livechanges:empty, .playbar .building:empty { display: none; }
  .playbar > button { height: 50px; font-weight: 700; }
  .playbar .go { font-size: 20px; padding: 0; }
  .playbar .wide, .top .wide { display: none; }
  .pbmore { display: block; font-size: 20px; padding: 0; }
  .playbar .pbactions, .playbar .tempo { display: none; grid-column: 1 / -1; }
  .playbar.open .pbactions, .playbar.open .tempo { display: flex; flex-wrap: wrap; }
  .playbar.open .pbactions button, .playbar.open .tempo button { flex: 1; min-height: 44px; }

  /* Steps: one row that scrolls sideways */
  .flowsteps { flex-wrap: nowrap; overflow-x: auto; padding: 6px 10px; scrollbar-width: none; }
  .flowsteps .st-sep { display: none; }
  .flowstep { flex: none; border-radius: 16px; border-bottom: 0; padding: 7px 11px; font-size: 12px; }
  .flowstep.st-next { box-shadow: inset 0 -2px 0 var(--accent); }
  .flowstep.on { background: var(--accent); color: var(--accent-text); }
  .stephint { display: none; }
}

/* Scene headings in the cue list */
table.cuelist tr.heading td { padding: 14px 6px 4px; border-bottom: 1px solid var(--accent); }
.headingrow { display: flex; gap: 6px; align-items: center; }
.headingrow input { flex: 1; background: transparent; border-color: transparent; font-weight: 700; font-size: 15px; color: var(--accent); padding-left: 0; }
.headingrow input:hover, .headingrow input:focus { border-color: var(--line); padding-left: 8px; }
.jumpscene { margin-left: auto; }

/* Chases */
.namecell { display: flex; gap: 6px; align-items: center; }
.chasetag { white-space: nowrap; font-size: 12px; padding: 4px 10px; border-color: #6b4fd8; color: #b9a6ff; }
.chasetag.on { background: rgba(107, 79, 216, .2); }
.fxtag { white-space: nowrap; font-size: 12px; padding: 4px 10px; border-color: #1f8a8a; color: #7fe0e0; }
tr.chaseedit td { border-bottom: 1px solid var(--line); }
.chasebox { background: var(--card); border: 1px solid #3a2f73; border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.chasesettings { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.chasesettings .field { flex: 0 1 auto; min-width: 140px; }
.chasesettings .loop { color: var(--dim); font-size: 13px; padding-bottom: 6px; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.step { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px 2px 8px; }
.stepno { font-size: 12px; margin-right: 4px; font-weight: 600; }
.step button:not(.icon) { padding: 2px 8px; font-size: 12px; }
.building { display: flex; align-items: center; gap: 8px; color: #b9a6ff; }
.building:empty { display: none; }

/* Controller */
.output[data-state=waiting] .dot { background: var(--bad); }
.output[data-state=waiting] { border-color: var(--bad); }
#surface[data-state=off] { border-color: var(--line); }
table.cheat { border-collapse: collapse; width: 100%; font-size: 13px; }
table.cheat th { text-align: left; white-space: nowrap; padding: 4px 10px 4px 0; vertical-align: top; color: var(--text); font-weight: 600; }
table.cheat td { padding: 4px 0; color: var(--dim); }
table.cheat tr + tr { border-top: 1px solid var(--line); }
.tiles .empty { grid-column: 1 / -1; }

/* Stage */
main.tab-stage { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
.stage-plan { padding: 0; overflow: hidden; position: relative; }
.stage-empty { grid-column: 1 / -1; }
.buttons.center { justify-content: center; }
.planwrap { position: relative; width: 100%; height: 100%; min-height: 360px; }
svg.plan { width: 100%; height: 100%; display: block; background: #0c0e12; touch-action: none; cursor: crosshair; user-select: none; }
svg.plan .venuebox { fill: #11141a; stroke: var(--line); stroke-width: 0.05; }
/* The light on the floor drawn on the graphics card (ui/lightgl.js): a canvas just under
   the plan's drawing, which then leaves the floor to it. */
canvas.planlight { position: absolute; pointer-events: none; display: block; }
svg.plan.gl { position: relative; background: transparent; }
svg.plan.gl .venuebox { fill: none; }
svg.plan.gl .venueimg { display: none; }
/* The grid over the light: it shows on the dark floor and fades where the floor's lit. */
svg.plan.gl .grid { mix-blend-mode: screen; stroke: #0b0c0f; }   /* screened on the floor: the same lines as without */
svg.plan.gl .grid.major { stroke: #15181d; }
svg.plan .grid { stroke: #1b1f27; stroke-width: 0.02; }
svg.plan .grid.major { stroke: #252a34; stroke-width: 0.04; }
svg.plan .sh { fill: rgba(154, 163, 178, 0.06); stroke: #5a6272; stroke-width: 0.06; }
svg.plan .sh-room { fill: none; stroke: #8a93a3; stroke-width: 0.12; }
svg.plan .sh-stage, svg.plan .sh-riser { fill: rgba(255, 176, 0, 0.08); stroke: #8a6d2a; }
svg.plan .sh-truss { fill: rgba(200, 200, 200, 0.18); stroke: #a0a7b4; }
svg.plan .shlabel { fill: #6c7484; font-size: 0.45px; }
svg.plan .ghost circle { fill: none; stroke: #5a6272; stroke-width: 0.05; stroke-dasharray: 0.12 0.08; }
svg.plan .ghost text { fill: #5a6272; font-size: 0.4px; }
svg.plan .spot { cursor: pointer; }
svg.plan .spot circle { fill: rgba(60, 207, 122, 0.15); stroke: var(--ok); stroke-width: 0.05; }
svg.plan .spot .spotdot { fill: var(--ok); }
svg.plan .spot text { fill: var(--ok); font-size: 0.42px; font-weight: 600; }
svg.plan .pools { mix-blend-mode: screen; pointer-events: none; }
/* Where pools overlap their light adds up, as real light does: red and green make yellow, all three white. */
svg.plan .pools > * { mix-blend-mode: plus-lighter; }
svg.plan .beamlines { pointer-events: none; }
svg.plan .fx { cursor: pointer; }
/* Lights can be dragged on the Stage plan and the Looks plan. */
svg.plan:not(.planview) .fx, .centreplanbox svg.plan .fx { cursor: grab; }
svg.plan .aimhandle { fill: #ffb000; fill-opacity: .35; stroke: #ffb000; stroke-width: 0.06; cursor: move; }
svg.plan.dragging, svg.plan.dragging * { cursor: grabbing !important; }
svg.plan .fx .hit { fill: transparent; }
svg.plan .fx .body { fill: #1e222b; stroke: #8a93a3; stroke-width: 0.05; }
svg.plan .fx .lamp { stroke: #8a93a3; stroke-width: 0.04; }
svg.plan .fx .trim { fill: none; stroke: #8a93a3; stroke-width: 0.04; stroke-linecap: round; }
svg.plan .fx.on .body, svg.plan .fx.on .lamp, svg.plan .fx.on .trim { stroke: var(--accent); stroke-width: 0.09; }
svg.plan .cone { fill: none; stroke: #8a93a3; stroke-opacity: .28; stroke-width: 0.03; stroke-dasharray: 0.12 0.08; }
svg.plan .cone.lit { stroke-opacity: .45; stroke-dasharray: none; }
svg.plan .fxauto { fill: #ffb000; font-size: 0.32px; font-weight: 800; letter-spacing: 0.02px; paint-order: stroke; stroke: #0c0e12; stroke-width: 0.08px; }
svg.plan .fxlabel { fill: var(--text); font-size: 0.42px; font-weight: 700; paint-order: stroke; stroke: #0c0e12; stroke-width: 0.1px; }
.zoom { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 4px; }
.zoom button { min-width: 36px; }
.stage-side { display: flex; flex-direction: column; gap: 10px; }
.seg { display: flex; gap: 2px; background: #0c0e12; border-radius: 8px; padding: 3px; }
.seg button { flex: 1; border: 0; background: none; color: var(--dim); }
.seg button.on { background: var(--card); color: var(--text); }
.spots { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.spotrow { display: flex; align-items: center; gap: 6px; }
.spotrow > button:first-child { flex: 1; text-align: left; border-color: #2c6b48; }
.unplaced { display: flex; flex-wrap: wrap; gap: 4px; }
.hangs { padding-top: 18px; }
.calpanel { display: flex; flex-direction: column; gap: 8px; }
.calpanel .steps { margin: 0; padding-left: 18px; color: var(--dim); font-size: 13px; }
.calpanel .samples { margin: 0; padding-left: 18px; font-size: 13px; }
p.ok { color: var(--ok); margin: 0; }
.calpanel .warnline { color: var(--accent); margin: 0; font-size: 13px; }
.calpanel .samples li.error { color: var(--bad); }
.card > button + button { margin-left: 6px; }
.card > button { margin-top: 6px; }

/* VenuCable import */
table.vclights { width: 100%; border-collapse: collapse; font-size: 13px; }
table.vclights th { text-align: left; color: var(--dim); font-weight: 500; padding: 4px; border-bottom: 1px solid var(--line); }
table.vclights td { padding: 4px; border-bottom: 1px solid #22262f; }
table.vclights select { width: 100%; }
.patchrow { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.patchrow p { margin: 0; }
.miniresults { display: flex; flex-direction: column; gap: 2px; }
.result.small { padding: 4px 8px; }
@media (max-width: 860px) { main.tab-stage { grid-template-columns: 1fr; } .planwrap { height: 60vh; } }
svg.plan .beams { pointer-events: none; }
.planned { border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.planned p { margin: 0; flex: 1; min-width: 220px; }

/* Controllers dialog */
dialog .stack > h3 { margin: 6px 0 0; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 15px; }
section.deck { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
section.deck h3 { margin: 0; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 15px; }
ol.setup { margin: 0; padding-left: 20px; color: var(--dim); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
ol.setup a { color: var(--accent); }

/* Effects card (Control tab) */
.fxstart { display: grid; gap: 6px; }
.fxrow { display: flex; align-items: flex-start; gap: 6px; }
.fxrow .elabel { flex: none; padding-top: 7px; }
.fxbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.fx { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; display: grid; gap: 6px; }
.fxhead { display: flex; align-items: center; gap: 8px; }
.fxhead button { margin-left: auto; }
.fxgrid { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.fxgrid label { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 13px; }
.fxgrid input[type=color] { width: 32px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; }

/* Desk: faders on screen */
main.tab-desk { display: block; padding: 0; }
.desk { display: flex; gap: 12px; padding: 12px; height: 100%; min-height: 380px; }
.deskleft { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.deskbar { display: flex; align-items: center; gap: 8px; }
.deskbar > button { min-width: 44px; min-height: 36px; }
.desksrc { display: flex; gap: 3px; background: #0c0e12; padding: 3px; border-radius: 10px; }
.desksrc button { border: 0; background: none; color: var(--dim); padding: 6px 14px; font-weight: 600; }
.desksrc button.on { background: #2a2f3a; color: var(--text); }
.deskpage { flex: 1; color: var(--dim); font-size: 13px; }
.deskstrips { flex: 1; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; min-height: 0; }
.deskstrip { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.deskstrip.picked { border-color: var(--accent); }
.deskstrip.flashing { background: #2a2410; }
.desklamp { width: 20px; height: 20px; border-radius: 50%; background: #000; border: 1px solid var(--line); flex: none; }
.deskname { font-size: 12px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deskfader { flex: 1; min-height: 120px; width: 44px; margin: 0; }
.vfader { --v: 0; position: relative; touch-action: none; cursor: ns-resize; border-radius: 8px; }
.vfader:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vtrack { position: absolute; left: 50%; top: 14px; bottom: 14px; width: 6px; transform: translateX(-50%); background: #0c0e12; border: 1px solid var(--line); border-radius: 3px; }
.vfill { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--v) * 100%); background: var(--accent); border-radius: 3px; }
.vcap { position: absolute; left: 50%; width: 36px; height: 28px; bottom: calc(var(--v) * (100% - 28px)); transform: translateX(-50%); border-radius: 6px; background: linear-gradient(#e4e7ee, #9aa1ad); box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.vcap::after { content: ""; position: absolute; left: 6px; right: 6px; top: 50%; height: 2px; margin-top: -1px; background: #1a1d24; }
.pblook { font-size: 11px; color: var(--dim); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 14px; }
.pbgo { font-weight: 800; }
.pbgostop { display: flex; gap: 3px; width: 100%; }
.pbgostop .desksel { flex: 1; min-width: 0; }
.deskval { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.deskflash, .desksel { width: 100%; min-height: 40px; padding: 0 2px; font-size: 12px; font-weight: 700; touch-action: none; }
.deskflash:active, .deskstrip.flashing .deskflash { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.desksel.on { border-color: var(--accent); color: var(--accent); }
.deskright { width: 210px; display: flex; flex-direction: column; gap: 8px; }
.deskcue { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.desknow { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desknext { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deskmain { flex: 1; display: flex; gap: 8px; min-height: 0; }
.deskstrip.master { flex: none; width: 64px; }
.deskgo { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.deskgo button { flex: 1; min-height: 44px; font-weight: 700; }
.deskgo .rungo { flex: 2; font-size: 26px !important; border-radius: 12px; }
.deskblack.on { background: var(--bad); border-color: var(--bad); color: #fff; }
@media (max-width: 860px) {
  .desk { min-height: calc(100vh - 120px); }
}
@media (max-width: 600px) {
  .desk { flex-direction: column; }
  .deskstrips { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .deskright { width: auto; }
  .deskmain { min-height: 200px; }
}

/* Small plan (Looks, Run) and the pop-out window */
.miniplan { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.miniplan summary { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; color: var(--dim); font-size: 13px; font-weight: 600; list-style: none; }
.miniplan summary::before { content: "▸"; }
.miniplan[open] summary::before { content: "▾"; }
.miniplan summary span { flex: 1; }
.miniplanbox { height: 300px; }
svg.planview { cursor: default; touch-action: auto; }
.runwrap { display: grid; grid-template-columns: minmax(0, 1fr); height: 100%; }
.runplan { display: none; }
@media (min-width: 1100px) {
  .runwrap { grid-template-columns: minmax(380px, 560px) minmax(0, 1fr); }
  .runwrap .run { margin: 0; max-width: none; }
  .runplan { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 12px 0; min-height: 0; }
  .runplanhead { display: flex; align-items: center; gap: 8px; }
  .runplanhead h3 { flex: 1; }
  .followbtn.on { background: var(--accent); color: #1a1200; border-color: var(--accent); }
  .followbar { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--accent); border-radius: 10px; background: rgba(255, 176, 0, .06); }
  .followbar[hidden] { display: none; }
  .followheads, .followopts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .followz { display: flex; align-items: center; gap: 4px; }
  .followz b { min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
  .followz button { min-width: 32px; }
  .followdone { margin-left: auto; font-weight: 700; }
  .followbar .hint { margin: 0; }
  .runplan svg.following { cursor: crosshair; touch-action: none; border-color: var(--accent); }
  .runplan svg { flex: 1; border: 1px solid var(--line); border-radius: 12px; }
}
body.popout { display: flex; flex-direction: column; height: 100vh; margin: 0; }
.poptop { display: flex; align-items: center; gap: 16px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.popnow { font-weight: 700; color: var(--ok); }
.popnext { flex: 1; color: var(--dim); }
.popplan { flex: 1; min-height: 0; display: block; padding: 0; }
.popplan svg { width: 100%; height: 100%; }

/* Palettes (Looks: Colour and Position) */
.palettes { display: grid; gap: 6px; margin-bottom: 10px; }
.palhead { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--dim); }
.palhead span { flex: 1; }
button.link { border: 0; background: none; padding: 4px 0; color: var(--accent); font-size: 13px; }
.palchips { display: flex; flex-wrap: wrap; gap: 6px; }
.palchip { display: flex; align-items: center; gap: 6px; min-height: 36px; }
.palchip i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); font-style: normal; }
.palchip i.pos { border: 0; width: auto; height: auto; color: var(--dim); }
.palchip.on { border-color: var(--accent); color: var(--accent); }
.paledit { display: flex; align-items: center; gap: 6px; width: 100%; }
.paledit span { flex: 1; }

/* Universes */
.unitabs { display: flex; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.unitabs button { padding: 4px 10px; font-size: 12px; }
.unitabs button.on { border-color: var(--accent); color: var(--accent); }
td.uni input { width: 52px; }
.unirows { display: grid; gap: 8px; }
.unirow { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.unirow > div { flex: 1; }

/* Phone remote: the dialog on the laptop */
.remotedlg { max-width: 560px; }
.remoterow { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.remoterow .stack { padding: 0; flex: 1; min-width: 200px; }
.qr { width: 180px; height: 180px; background: #fff; border-radius: 8px; padding: 4px; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.remotelink { word-break: break-all; }
.hint.ok { color: var(--ok); }

/* Phone remote: the phone's page */
body.remote #app { height: auto; min-height: 100vh; }
.rtop { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; }
.rtop > div:nth-child(2) { flex: 1; min-width: 0; }
.rtop h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rdot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); flex: none; }
.rdot.on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.rtabs { display: flex; gap: 3px; background: #0c0e12; padding: 3px; border-radius: 10px; }
.rtabs button { border: 0; background: none; color: var(--dim); padding: 7px 12px; font-weight: 600; }
.rtabs button.on { background: #2a2f3a; color: var(--text); }
.rrun { height: auto; min-height: 0; padding-bottom: 0; width: 100%; flex: 1; }
.rrun .runlist { max-height: 42vh; }
.rdesk { min-height: 52vh; height: auto; flex: 1; width: 100%; }
.rdesk .deskright { display: none; }
.rbottom { padding: 8px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); width: 100%; max-width: 760px; margin: 0 auto; }
.deskflash.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* Venue size */
.blankplan { display: flex; gap: 8px; align-items: flex-end; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.blankplan .field { width: 100px; }
.venuesize summary { cursor: pointer; list-style: none; }
.venuesize summary h3 { margin: 0; }
.venuesize[open] summary h3 { margin-bottom: 8px; }

/* Drawing the venue */
svg.plan .static [data-shape] { cursor: move; }
svg.plan .static .picked { stroke: var(--accent); stroke-width: 0.12; }
svg.plan .drawing { fill: rgba(255, 176, 0, 0.12); stroke: var(--accent); stroke-width: 0.06; stroke-dasharray: 0.2 0.1; pointer-events: none; }
.drawkinds { display: flex; flex-wrap: wrap; gap: 6px; }

/* Adding fixtures: pick the mode, see the addresses */
.modehead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.modes { display: grid; gap: 6px; }
.modecard { display: grid; gap: 6px; text-align: left; padding: 8px 10px; border-radius: 10px; }
.modecard.on { border: 2px solid var(--accent); background: rgba(255, 176, 0, .08); }
.modetop { display: flex; align-items: center; gap: 8px; }
.modetop b { flex: 0 1 auto; }
.modetop .tag { margin-left: auto; font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.tag.good { background: rgba(60, 207, 122, .15); color: #7fe0a8; }
.tag.warn { background: rgba(255, 176, 0, .12); color: #ffc840; }
.chans { display: flex; flex-wrap: wrap; gap: 4px; }
.chans i { font-style: normal; font-size: 12px; padding: 2px 6px; border-radius: 5px; background: #0c0e12; color: #c4cad4; }
.setto { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: #12261b; border: 1px solid #1d6b40; }
.setto b { color: #7fe0a8; }
.setto .addrs { font-family: ui-monospace, monospace; font-size: 16px; font-weight: 700; }

/* Looks with the plan in the middle */
main.tab-control.withplan { grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(340px, 400px); }
.centreplan { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.centreplan .panel-head { flex-wrap: wrap; }
.centreplan .panel-head .hint { flex: 1; }
.centreplanbox { flex: 1; min-height: 360px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.centreplanbox svg { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.tiles.list { display: flex; flex-direction: column; gap: 3px; }
.tiles.list .tile { flex-direction: row; min-height: 0; height: 38px; padding: 0 10px; gap: 10px; text-align: left; justify-content: flex-start; }
.tiles.list .tile .fid { position: static; width: 22px; flex: none; }
.tiles.list .tile .lamp { width: 16px; height: 16px; border-width: 1px; order: -1; flex: none; }
.tiles.list .tile .tname { flex: 1; -webkit-line-clamp: 1; font-size: 13px; }
.tiles.list .tile .pt { display: none; }
.tiles.list .tile.held::after { position: static; margin-left: 4px; }
main.withplan .progtabs { display: grid; }
main.withplan .programmer .away { display: none; }
@media (max-width: 1100px) {
  main.tab-control.withplan { grid-template-columns: minmax(220px, 260px) minmax(0, 1fr); }
  main.tab-control.withplan .prog { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  main.tab-control.withplan { grid-template-columns: 1fr; }
  .centreplanbox { min-height: 50vh; }
}

/* Start screen */
main.tab-start { display: block; overflow: auto; }
.start { max-width: 1000px; margin: 0 auto; padding: 40px 20px; display: grid; gap: 28px; }
.starthead h1 { margin: 0 0 8px; font-size: 34px; line-height: 1.15; }
.starthead p { margin: 0; color: var(--dim); max-width: 620px; font-size: 15px; line-height: 1.5; }
.startcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.startcard { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; padding: 18px; min-height: 180px; border-radius: 14px; background: var(--panel); }
.startcard svg { color: #c4cad4; }
.startcard b { font-size: 16px; }
.startcard span { color: var(--dim); font-size: 13px; line-height: 1.45; }
.startcard .go { margin-top: auto; color: #c4cad4; font-weight: 700; }
.startcard.primary { border: 2px solid var(--accent); background: var(--card); }
.startcard.primary svg, .startcard.primary .go { color: var(--accent); }
.startsteps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.startsteps li { padding: 14px 16px; display: grid; gap: 4px; border-right: 1px solid var(--line); }
.startsteps li:last-child { border-right: 0; }
.startsteps b { font-size: 12px; letter-spacing: .08em; color: #c4cad4; }
.startsteps span { color: var(--dim); font-size: 13px; }

/* Quick setup */
.qs { max-width: 720px; }
.qsrow { display: grid; grid-template-columns: minmax(150px, 1fr) 90px minmax(200px, 2fr); gap: 10px; align-items: end; padding: 8px 0; border-top: 1px solid var(--line); }
.qsrow input.bad { border-color: var(--bad); }
@media (max-width: 640px) { .qsrow { grid-template-columns: 1fr 1fr; } .qsrow > div:first-child { grid-column: 1 / -1; } }

/* Routes for moving heads */
svg.plan .route { fill: none; stroke: #7fe0e0; stroke-width: 0.08; stroke-dasharray: 0.3 0.15; opacity: .7; }
svg.plan .route.editing { stroke: var(--accent); opacity: 1; stroke-width: 0.1; }
svg.plan .routept { fill: var(--accent); stroke: #0c0e12; stroke-width: 0.06; cursor: grab; }
.stage-side .seg { flex-wrap: wrap; }

/* Stage: lock the rig */
.rigswitch { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rigswitch button { display: inline-flex; align-items: center; gap: 6px; }
.rigswitch.on button { background: var(--accent); color: #1a1200; border-color: var(--accent); font-weight: 700; }
.rigswitch .hint { flex: 1; min-width: 160px; }
.card.riglocked { opacity: .55; }

/* ☰ menu: whether VenuLight works offline */
.menunote { margin: 6px 10px 4px; font-size: 12px; color: var(--dim); max-width: 260px; }
.menunote.ok::before { content: "✓ "; color: #3ccf7a; font-weight: 700; }

/* Cues tab: the main cues and the playbacks */
.cueswrap { display: flex; flex-direction: column; gap: 8px; min-height: 0; height: 100%; }
.listtabs { display: flex; flex-wrap: wrap; gap: 4px; }
.listtabs button { border-radius: 16px; padding: 6px 14px; }
.listtabs button.on { background: var(--accent); color: #1a1200; border-color: var(--accent); font-weight: 700; }
.listtabs .addlist { border-style: dashed; color: var(--dim); }
.plname { font-size: 18px; font-weight: 700; max-width: 260px; }
.namecell .hint { white-space: nowrap; }
/* Run: the playbacks */
.runpbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.runpbs[hidden] { display: none; }
.runpb { display: inline-flex; gap: 8px; align-items: center; min-height: 40px; }
.runpb.on { background: var(--accent); color: #1a1200; border-color: var(--accent); font-weight: 700; }
.runpb i { font-style: normal; font-size: 12px; opacity: .8; }
/* Phone remote: room for three Desk tabs and the page arrows */
@media (max-width: 440px) { .rdesk .deskpage { display: none; } .rdesk .desksrc button { padding: 6px 10px; } }

/* Stage → Arrange: the picked shape's handles */
svg.plan .handles .corner { fill: #fff; stroke: var(--accent); stroke-width: 0.05; cursor: nwse-resize; }
svg.plan .handles .turn { fill: var(--accent); stroke: #0c0e12; stroke-width: 0.05; cursor: grab; }
svg.plan .handles .turnline { stroke: var(--accent); stroke-width: 0.04; stroke-dasharray: 0.1 0.08; }
svg.plan .handles .move { cursor: move; }
svg.plan .handles .move circle { fill: var(--accent); stroke: #0c0e12; stroke-width: 0.05; }
svg.plan .handles .move path { stroke: #0c0e12; stroke-width: 0.06; stroke-linecap: round; }
.drawkinds.pieces .chip.on { border-color: var(--accent); color: var(--accent); }

/* Stage: a light's barn doors */
details.doors { border-top: 1px solid var(--line); padding-top: 6px; }
.outputfield { display: flex; flex-direction: column; gap: 4px; }
.outputfield .hint { margin: 0; }
details.fromlux summary { cursor: pointer; font-size: 13px; color: var(--dim); }
details.fromlux[open] { display: flex; flex-direction: column; gap: 6px; }
details.doors summary { cursor: pointer; font-weight: 600; font-size: 13px; }
details.doors .sliderrow .elabel { width: 52px; }

/* Layers: what the plans show (ui/layers.js) */
.layersbtn { position: relative; }
.layersbtn .lbdot { display: none; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.layersbtn.changed .lbdot { display: block; }
.layerspanel { position: fixed; z-index: 60; width: 290px; max-width: calc(100vw - 16px); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); display: flex; flex-direction: column; gap: 6px; }
.layerspanel .lhead { margin: 0 0 2px; color: var(--dim); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.layerspanel .lrow { display: flex; flex-direction: column; gap: 2px; }
.layerspanel .lrow label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; min-height: 30px; }
.layerspanel .lstrength { display: flex; align-items: center; gap: 8px; padding-left: 26px; }
.layerspanel .lstrength em { font-style: normal; color: var(--dim); font-size: 12px; width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.layerspanel .lstrength .slider:disabled { opacity: .35; }
.layerspanel .lreset { margin-top: 4px; }

/* The show lock (Run → Lock, showlock.js): recording is off everywhere, so its buttons look it. */
body.showlocked button.record, body.showlocked .playbar .pbactions button:not(:last-child), body.showlocked .livechanges button { opacity: .35; }
.fx .fxhead button.on { border-color: var(--accent); color: var(--accent); }
.fx .routedraw { display: flex; flex-direction: column; gap: 6px; padding: 6px 8px; border: 1px dashed var(--accent); border-radius: 8px; }
.fx .routedraw .hint { margin: 0; }
