/* DMX Console: its own dark console look, unaffected by the site's light/dark setting. */
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('../barlow-semi-condensed-800.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #1c1e20;
  --surface: #25282b;
  --surface-2: #2d3134;
  --well: #141617;
  --line: #3a3f43;
  --ink: #e8eaeb;
  --muted: #9aa1a6;
  --accent: #3fb8a0;          /* site teal, lifted for a dark desk */
  --accent-deep: #215859;     /* the site's header teal */
  --cap-channel: #2f6fed;
  --cap-channel-hi: #6f9cff;
  --cap-playback: #e5383b;
  --cap-playback-hi: #ff7a7c;
  --cap-gm: #d9a520;
  --cap-gm-hi: #ffd76a;
  --danger: #ff6b6b;
  --display: 'Barlow Semi Condensed', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.console { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 560px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  flex: none; height: 48px; padding: 0 14px;
  background: #17191a; border-bottom: 1px solid var(--line);
}
.home { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 13px; }
.home span { color: var(--accent); }
.home:hover { color: var(--ink); }
.topbar h1 { margin: 0 8px 0 0; font: 800 20px/1 var(--display); letter-spacing: .02em; text-transform: uppercase; }

.seg { display: flex; padding: 3px; gap: 3px; border-radius: 8px; background: var(--well); border: 1px solid var(--line); }
.seg-btn {
  padding: 4px 12px; border: 0; border-radius: 5px; background: transparent;
  color: var(--muted); font-weight: 600; cursor: pointer;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.seg-btn[data-mode="channels"][aria-pressed="true"] { box-shadow: inset 0 -2px 0 var(--cap-channel); }
.seg-btn[data-mode="playbacks"][aria-pressed="true"] { box-shadow: inset 0 -2px 0 var(--cap-playback); }

.status {
  margin-left: auto; display: flex; align-items: center; gap: 8px; max-width: 46%;
  padding: 5px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--well);
  color: var(--muted); font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status:hover { border-color: var(--accent); color: var(--ink); }
.status #status-text { overflow: hidden; text-overflow: ellipsis; }
.status .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #e0a526; box-shadow: 0 0 6px #e0a52699; }
.status.live { color: var(--ink); }
.status.live .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.status.connecting .dot { background: var(--accent); animation: blink 1s steps(2) infinite; }
.status.lost .dot, .status.error .dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); animation: blink 1s steps(2) infinite; }
.status.lost, .status.error { color: #ffb4b4; }

.pop {
  position: fixed; z-index: 10; padding: 14px;
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line);
  box-shadow: 0 12px 32px #000a;
}
.usb-pop { top: 54px; right: 12px; width: 330px; }
.pop h3 { margin: 0 0 10px; font: 800 16px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.usb-types { margin: 0 0 4px; padding: 0; border: 0; }
.usb-types legend { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.usb-types .row { margin-bottom: 8px; }
.usb-types input { accent-color: var(--accent); }
.tag { padding: 1px 6px; border-radius: 4px; background: #4a3a14; color: #f0c45a; font-size: 11px; font-weight: 600; }
.usb-info { margin: 6px 0 12px; padding: 8px 10px; border-radius: 6px; background: var(--well); font-size: 13px; }
.usb-pop .hint { margin: 12px 0 0; }

/* ---------- Desk ---------- */
.desk { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; }

.faders {
  display: grid;
  grid-template-columns: 78px repeat(10, minmax(54px, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 8px 6px;
  padding: 10px;
  min-width: 0; min-height: 0;
  overflow: auto;
}

.fader {
  display: flex; flex-direction: column; align-items: stretch; gap: 5px;
  min-height: 230px; padding: 5px;
  border-radius: 8px; background: var(--surface); border: 1px solid var(--line);
  user-select: none; -webkit-user-select: none;
}
.fader.gm { grid-row: 1 / span 2; grid-column: 1; background: #24272a; }

/* Scribble strip */
.strip {
  position: relative; flex: none; height: 34px; padding: 0 4px;
  border: 1px solid #00000066; border-radius: 4px;
  background: #34393d; color: var(--ink);
  font: 800 15px/32px var(--display); letter-spacing: .03em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; cursor: pointer;
}
.strip .num { position: absolute; top: 1px; left: 3px; font: 600 9px/1 system-ui, sans-serif; opacity: .75; letter-spacing: 0; }
.strip .txt { display: block; padding-top: 5px; line-height: 26px; }
.strip.empty .txt { opacity: .35; }
.strip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fader.gm .strip { background: var(--well); color: var(--cap-gm-hi); cursor: default; }
.fader.selected .strip { box-shadow: 0 0 0 2px var(--accent); }

.readout {
  flex: none; height: 16px; text-align: center;
  font: 600 12px/16px ui-monospace, 'SF Mono', Menlo, monospace; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.readout.on { color: var(--ink); }

/* Track and cap */
.track {
  position: relative; flex: 1; min-height: 90px;
  margin: 0 auto; width: 100%; max-width: 64px;
  cursor: ns-resize; touch-action: none;
  --cap-h: 26px;
}
.track::before { /* scale marks */
  content: ''; position: absolute; left: 8%; right: 8%;
  top: calc(var(--cap-h) / 2); bottom: calc(var(--cap-h) / 2);
  background: repeating-linear-gradient(to top, #ffffff26 0 1px, transparent 1px 10%);
  -webkit-mask: linear-gradient(90deg, #000 0 26%, transparent 26% 74%, #000 74%);
  mask: linear-gradient(90deg, #000 0 26%, transparent 26% 74%, #000 74%);
}
.slot {
  position: absolute; left: 50%; width: 6px; margin-left: -3px;
  top: calc(var(--cap-h) / 2); bottom: calc(var(--cap-h) / 2);
  border-radius: 3px; background: #0b0c0d; box-shadow: inset 0 1px 2px #000;
  overflow: hidden;
}
.fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--pos, 0) * 100%);
  background: var(--fill, var(--cap-channel)); opacity: .55;
}
.cap {
  position: absolute; left: 50%; width: 44px; margin-left: -22px; height: var(--cap-h);
  bottom: calc(var(--pos, 0) * (100% - var(--cap-h)));
  border-radius: 4px;
  background: linear-gradient(#ffffff40, transparent 45%, #00000040), var(--cap, var(--cap-channel));
  box-shadow: 0 2px 4px #000a, inset 0 1px 0 #ffffff55;
}
.cap::after { content: ''; position: absolute; left: 4px; right: 4px; top: 50%; height: 2px; margin-top: -1px; background: #ffffffcc; border-radius: 1px; }
.fader.gm .track { max-width: 70px; --cap-h: 30px; }
.fader.gm .cap { width: 54px; margin-left: -27px; }

.desk[data-mode="channels"] .fader:not(.gm) { --cap: var(--cap-channel); --fill: var(--cap-channel-hi); }
.desk[data-mode="playbacks"] .fader:not(.gm) { --cap: var(--cap-playback); --fill: var(--cap-playback-hi); }
.fader.gm { --cap: var(--cap-gm); --fill: var(--cap-gm-hi); }

.keyhint { flex: none; height: 13px; text-align: center; font: 600 10px/13px ui-monospace, Menlo, monospace; color: #7d858a; letter-spacing: .05em; }
.desk.no-keys .keyhint { visibility: hidden; }

/* Fader button */
.fbtn {
  flex: none; height: 30px; border-radius: 5px; cursor: pointer;
  border: 1px solid #00000080; background: linear-gradient(#3c4145, #2c3033);
  color: var(--muted); font: 800 12px/1 var(--display); letter-spacing: .08em;
  box-shadow: inset 0 1px 0 #ffffff1a, 0 1px 2px #0008;
}
.fbtn:hover { color: var(--ink); }
.fbtn:active, .fbtn.pressed { transform: translateY(1px); background: #2a2e31; }
.fader.selected .fbtn { background: linear-gradient(#4fd1b6, var(--accent)); color: #0b2a24; box-shadow: 0 0 10px #3fb8a080, inset 0 1px 0 #ffffff60; }
.desk[data-mode="playbacks"] .fbtn.flash { background: linear-gradient(#ff8a8c, var(--cap-playback)); color: #2a0606; }
.fader.gm .fbtn.on { background: linear-gradient(#ff8a8c, #c62828); color: #fff; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { filter: brightness(.6); } }
.fbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Right panel ---------- */
.panel {
  display: flex; flex-direction: column; min-height: 0; overflow: auto;
  border-left: 1px solid var(--line); background: #202325;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; padding: 10px 14px 0; }
.panel h2 { margin: 0; font: 800 15px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; }

.stage {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 8px 6px;
  margin: 10px 14px 12px; padding: 12px 10px 8px;
  border-radius: 8px; background: radial-gradient(ellipse at 50% 120%, #2a2f33, #0d0e0f 70%);
  border: 1px solid var(--line);
}
.stage:empty::after { content: 'Nothing patched'; color: var(--muted); font-size: 12px; grid-column: 1 / -1; text-align: center; }
.lamp { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0; border: 0; background: none; cursor: pointer; }
.lamp .bulb {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #3a3f43; background: #111;
}
.lamp .lnum { font: 600 10px/1 system-ui, sans-serif; color: var(--muted); }
.lamp.unpatched .bulb { border-style: dashed; border-color: #2f3437; background: transparent; }
.lamp.unpatched .lnum { opacity: .55; }
.lamp.selected .bulb { border-color: var(--accent); }
.stage-range { margin-left: 6px; font: 600 12px/1 system-ui, sans-serif; letter-spacing: 0; text-transform: none; color: #7d858a; }
.lamp.selected .lnum { color: var(--accent); }

.tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 8px 10px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--muted); font-weight: 600; cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab-panel { padding: 12px 14px 16px; }

.selection { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-weight: 600; }
.small-btn {
  padding: 5px 10px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); font-size: 13px;
}
.small-btn:hover { border-color: var(--accent); }
.small-btn:disabled { opacity: .45; cursor: default; border-color: var(--line); }
.small-btn.primary { background: var(--accent-deep); border-color: var(--accent); }
.small-btn.danger { color: var(--danger); }
.small-btn.danger:hover { border-color: var(--danger); }

.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.swatch {
  position: relative; height: 46px; padding: 0; border-radius: 6px; cursor: pointer;
  border: 1px solid #0008; background: var(--c);
  box-shadow: inset 0 1px 0 #ffffff40;
}
.swatch span { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px; border-radius: 0 0 5px 5px; background: #000a; color: #fff; font-size: 10px; font-weight: 600; }
.swatch:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.swatch.current { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatches.disabled .swatch { opacity: .4; cursor: default; outline: none; }
.picker-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
#picker { width: 0; height: 0; padding: 0; border: 0; opacity: 0; position: absolute; }
#colour-hint { flex-basis: 100%; }

.monitor {
  display: grid; grid-template-columns: repeat(16, 1fr); gap: 1px;
  font: 9px/16px ui-monospace, Menlo, monospace; text-align: center; font-variant-numeric: tabular-nums;
}
.monitor div { background: var(--well); color: #5c6468; border-radius: 2px; }
.monitor div.on { background: #1d3f39; color: #bff3e6; }
.monitor div.mine { box-shadow: inset 0 0 0 1px var(--accent); color: var(--ink); }

.row { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; cursor: pointer; }
.row.col { flex-direction: column; align-items: stretch; }
.row input[type="checkbox"], .row input[type="range"] { accent-color: var(--accent); }
.panel hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 12px; }
.keys dt { font: 600 12px/1.5 ui-monospace, Menlo, monospace; color: var(--accent); white-space: nowrap; }
.keys dd { margin: 0; color: var(--ink); font-size: 13px; }

/* ---------- Scribble strip editor ---------- */
.strip-editor {
  position: fixed; z-index: 10; width: 236px; padding: 12px;
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line);
  box-shadow: 0 12px 32px #000a;
}
.se-label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.se-label input {
  padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--well); color: var(--ink);
  font: 800 18px/1 var(--display); text-transform: uppercase; letter-spacing: .04em;
}
.se-label input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.se-colours { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin: 10px 0; }
.se-colour { height: 22px; padding: 0; border-radius: 4px; border: 1px solid #0008; background: var(--c); cursor: pointer; }
.se-colour[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.se-actions { display: flex; justify-content: space-between; }

.toast {
  position: fixed; left: 50%; bottom: 18px; z-index: 20; transform: translate(-50%, 20px);
  padding: 8px 14px; border-radius: 8px; background: #000d; border: 1px solid var(--line);
  color: var(--ink); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Colour extras and swatch editing ---------- */
.sub-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.small-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.swatches.editing .swatch { outline: 1px dashed #ffffff55; outline-offset: 2px; }
.swatch.add { background: transparent; border: 1px dashed var(--line); color: var(--muted); box-shadow: none; }
.swatch.add span { position: static; background: none; color: var(--muted); font-size: 13px; }
.extras { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.extra { display: grid; grid-template-columns: 52px 64px 1fr 44px; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 13px; }
.extra input[type="range"] { width: 100%; accent-color: var(--accent); }
.extra input[type="range"]:disabled { opacity: .4; }
.extra output { text-align: right; font: 600 12px ui-monospace, Menlo, monospace; color: var(--muted); }
.x-auto { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; cursor: pointer; }
.x-auto input { accent-color: var(--accent); }
.swatch-pop { width: 240px; }
.swatch-pop .wide { margin: 10px 0; }
.wide { width: 100%; }

/* ---------- Patch ---------- */
.patch-btn { border: 1px solid var(--line); background: var(--well); padding: 6px 14px; border-radius: 8px; }
.patch-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.console { position: relative; }
.patch {
  position: absolute; z-index: 5; top: 48px; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) 360px; background: var(--bg);
}
.patch-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.patch-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.patch-bar h2 { margin: 0; font: 800 18px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.patch-problems { color: var(--danger); font-size: 12px; font-weight: 600; }
.spacer { flex: 1; }
.patch-table-wrap { flex: 1; overflow: auto; }
.patch-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.patch-table th { position: sticky; top: 0; z-index: 1; padding: 6px 10px; background: #17191a; color: var(--muted); font-size: 11px; font-weight: 600; text-align: left; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); }
.patch-table td { padding: 3px 10px; border-bottom: 1px solid #2a2e31; vertical-align: middle; }
.patch-table tbody tr { cursor: pointer; user-select: none; }
.patch-table tbody tr:hover { background: #24282b; }
.patch-table tr.selected { background: #1b3a35 !important; box-shadow: inset 3px 0 0 var(--accent); }
.patch-table tr.problem .c-note { color: var(--danger); font-weight: 600; }
.patch-table tr.problem .c-addr input { border-color: var(--danger); }
.c-ch { width: 44px; font: 600 13px ui-monospace, Menlo, monospace; color: var(--muted); }
.c-name { width: 96px; }
.c-name input, .c-addr input {
  width: 100%; padding: 4px 6px; border-radius: 5px; border: 1px solid transparent; background: transparent; color: var(--ink);
  font: inherit;
}
.c-name input { font: 800 15px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.c-name input:hover, .c-addr input:hover:not(:disabled) { border-color: var(--line); }
.c-name input:focus, .c-addr input:focus { outline: none; border-color: var(--accent); background: var(--well); }
.c-addr { width: 90px; }
.c-addr input { font-family: ui-monospace, Menlo, monospace; }
.c-addr input:disabled { opacity: 0; }
.c-fix .fx-name { display: block; }
.c-fix .fx-mode { display: block; color: var(--muted); font-size: 11px; }
tr:not(.selected) .c-fix .fx-name:only-child, .c-fix .fx-name:empty + .fx-mode { color: var(--muted); }
.c-chs { width: 100px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.c-note { font-size: 12px; }

.patch-lib { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 12px 14px; border-left: 1px solid var(--line); background: #202325; overflow: auto; }
#lib-search { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--well); color: var(--ink); font: inherit; }
#lib-search:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.lib-results { flex: 1 1 200px; min-height: 140px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--well); }
.lib-head { padding: 8px 10px 4px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.lib-item { display: block; width: 100%; padding: 6px 10px; border: 0; border-top: 1px solid #1f2224; background: none; text-align: left; cursor: pointer; }
.lib-item:hover { background: #22272a; }
.lib-item.active { background: #1b3a35; box-shadow: inset 3px 0 0 var(--accent); }
.li-name { display: block; font-weight: 600; }
.li-sub { display: block; color: var(--muted); font-size: 12px; }
.lib-detail, .custom-form { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.lib-detail h3, .custom-form h3 { margin: 0; font-size: 15px; }
.lib-detail .hint { margin: 2px 0 10px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.field select, .field input { padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--well); color: var(--ink); font: inherit; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.chip { min-width: 24px; padding: 2px 6px; border-radius: 4px; background: #34393d; font: 600 11px/16px ui-monospace, Menlo, monospace; text-align: center; }
.chip.fixed { background: transparent; border: 1px dashed #3f4549; color: #7d858a; }
.chip.role-dim { background: #e8eaeb; color: #111; }
.chip.role-r { background: #c62828; } .chip.role-g { background: #2e7d32; } .chip.role-b { background: #1e4fd8; }
.chip.role-w, .chip.role-ww, .chip.role-cw { background: #f2f2f2; color: #111; }
.chip.role-a { background: #ff9f1a; color: #111; } .chip.role-uv { background: #6a1fd0; }
.chip.role-c { background: #00acc1; color: #111; } .chip.role-m { background: #d81b9a; } .chip.role-y { background: #fdd835; color: #111; }
.chip.role-l { background: #9ccc2a; color: #111; } .chip.role-i { background: #3f2fbf; }
.lib-detail .wide + .wide { margin-top: 6px; }
.lib-foot { display: flex; flex-direction: column; gap: 6px; }
.lib-foot .hint { margin: 0; }
.lib-foot a { color: var(--accent); }
.cf-channels { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; max-height: 280px; overflow: auto; }
.cf-row { display: grid; grid-template-columns: 22px 1fr 64px 26px; gap: 6px; align-items: center; }
.cf-row select, .cf-row input { padding: 4px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--well); color: var(--ink); font: inherit; font-size: 13px; }
.cf-row input[hidden] { display: block !important; visibility: hidden; }
.cf-num { color: var(--muted); font: 600 12px ui-monospace, Menlo, monospace; text-align: right; }
.icon-btn { width: 26px; height: 26px; padding: 0; border-radius: 5px; border: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--danger); border-color: var(--danger); }
.custom-form .se-actions { gap: 6px; margin-top: 12px; }
.custom-form h3 { margin-bottom: 10px; }
.cf-names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cf-names .field { min-width: 0; }
.cf-names select, .cf-names input { width: 100%; min-width: 0; }

/* ---------- Playbacks ---------- */
.rec-btn { border: 1px solid var(--line); background: var(--well); padding: 6px 12px; border-radius: 8px; color: #ff8a8c; letter-spacing: .06em; }
.rec-btn[aria-pressed="true"] { background: #c62828; border-color: #ff6b6b; color: #fff; animation: blink 1s steps(2) infinite; }
.desk.recording .fader:not(.gm) .fbtn { background: linear-gradient(#ff6b6b, #b71c1c); color: #fff; animation: blink .8s steps(2) infinite; }
.small-btn.rec { color: #ff8a8c; }
.small-btn.rec:hover { border-color: #ff6b6b; }
.cue-head { display: flex; align-items: center; gap: 8px; }
.cue-head b { flex: 1; text-align: center; font-size: 15px; }
.cue-state { margin: 6px 0 10px; text-align: center; }
.cue-actions { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 6px; margin-bottom: 10px; }
.cue-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cue-table th { padding: 4px; color: var(--muted); font-size: 10px; font-weight: 600; text-align: left; text-transform: uppercase; letter-spacing: .05em; }
.cue-table td { padding: 3px 2px; border-top: 1px solid #2a2e31; }
.cue-table tr.live td { background: #1b3a35; }
.cue-table tr.live .q-go { background: var(--accent); color: #0b2a24; }
.q-go { width: 30px; height: 26px; padding: 0; border-radius: 5px; border: 1px solid var(--line); background: var(--surface-2); font: 600 12px ui-monospace, Menlo, monospace; cursor: pointer; }
.q-go:hover { border-color: var(--accent); }
.cue-table input { width: 100%; min-width: 0; padding: 4px 5px; border-radius: 5px; border: 1px solid transparent; background: transparent; color: var(--ink); font: inherit; }
.cue-table input:hover { border-color: var(--line); }
.cue-table input:focus { outline: none; border-color: var(--accent); background: var(--well); }
.cue-table input[type="number"] { width: 54px; font-family: ui-monospace, Menlo, monospace; }
.q-acts { white-space: nowrap; }
.q-acts .icon-btn { width: 24px; height: 24px; }
.q-update:hover { color: var(--accent); border-color: var(--accent); }
#clear-channels { margin-bottom: 8px; }

/* ---------- Phone remote panel ---------- */
.phone-btn { position: relative; border: 1px solid var(--line); background: var(--well); padding: 6px 12px; border-radius: 8px; }
.phone-btn.on { border-color: var(--accent); }
.phone-btn .count:not(:empty) { margin-left: 6px; padding: 0 6px; border-radius: 9px; background: var(--accent); color: #0b2a24; font-size: 11px; font-weight: 700; }
.phone-pop { top: 54px; right: 12px; width: 360px; }
.phone-pair { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; margin: 4px 0 10px; }
.qr { width: 150px; height: 150px; border-radius: 6px; overflow: hidden; background: #fff; }
.qr svg { display: block; width: 100%; height: 100%; }
.phone-code-box { display: flex; flex-direction: column; gap: 4px; }
.phone-url { font-size: 13px; word-break: break-all; }
.phone-code { font: 800 34px/1 var(--display); letter-spacing: .08em; color: var(--accent); }
.phone-status { margin: 0 0 10px; font-weight: 600; }
.phone-status.error { color: var(--danger); }
.phone-pop .hint { margin: 10px 0 0; }
.phone-dev { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.phone-dev summary { cursor: pointer; font-size: 12px; color: var(--muted, #9aa); }
.phone-dev .row { margin-top: 8px; }

/* ---------- Phone splash ---------- */
.mobile-splash { display: none; }
.on-phone:not(.phone-desktop) .mobile-splash {
  display: flex; position: fixed; inset: 0; z-index: 50; align-items: center; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); overflow: auto;
  background: var(--bg);
}
.on-phone:not(.phone-desktop) .console { display: none; } /* out of the layout, or its width widens the page */
.ms-box { width: 100%; max-width: 380px; text-align: center; }
.ms-box img { display: block; margin: 0 auto 16px; border-radius: 16px; }
.ms-box h2 { margin: 0 0 10px; font: 800 28px/1.1 var(--display); letter-spacing: .03em; text-transform: uppercase; }
.ms-box p { margin: 0 0 20px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.ms-box p b { color: var(--ink); }
.ms-primary, .ms-secondary, .ms-ghost {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-bottom: 10px;
  padding: 14px; border-radius: 12px; font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.ms-primary { border: 0; background: var(--accent); color: #0b2a24; }
.ms-primary svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ms-secondary { border: 1px solid var(--accent); background: transparent; color: var(--accent); }
.ms-ghost { border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600; }
.ms-help { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-align: left; font-size: 14px; }
.ms-help ol { margin: 0 0 8px; padding-left: 20px; }
.ms-help li { margin-bottom: 6px; }
.ms-help p { margin: 0; font-size: 14px; }

/* ---------- Smaller screens ---------- */
@media (max-width: 1100px) {
  .desk { grid-template-columns: minmax(0, 1fr) 280px; }
  .topbar h1 { display: none; }
}
@media (max-width: 860px) {
  .console { height: auto; }
  .desk { grid-template-columns: 1fr; }
  .faders { grid-template-columns: 70px repeat(10, 62px); height: 600px; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .patch { position: fixed; grid-template-columns: 1fr; overflow: auto; }
  .patch-lib { border-left: 0; border-top: 1px solid var(--line); }
  .status #status-text { display: none; }
  .home { display: none; }
}

/* ---------- Shows ---------- */
.shows-btn { display: inline-flex; align-items: center; gap: 7px; max-width: 200px; border: 1px solid var(--line); background: var(--well); padding: 6px 12px; border-radius: 8px; }
.shows-btn #shows-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .5; }
.shows-btn[data-status="saved"] .save-dot { background: var(--accent); opacity: 1; }
.shows-btn[data-status="saving"] .save-dot, .shows-btn[data-status="unsaved"] .save-dot { background: #f0c45a; opacity: 1; }
.shows-btn[data-status="offline"] .save-dot, .shows-btn[data-status="signedOut"] .save-dot, .shows-btn[data-status="error"] .save-dot { background: var(--danger); opacity: 1; }
.shows-pop { top: 54px; left: 50%; transform: translateX(-50%); width: 380px; max-height: calc(100vh - 80px); overflow: auto; }
.shows-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.shows-status { font-size: 12px; color: var(--muted); text-align: right; }
.shows-status.bad { color: var(--danger); }
.shows-pop .hint { margin: 0 0 10px; }
.se-actions.left { justify-content: flex-start; gap: 6px; flex-wrap: wrap; }
.shows-signin { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.shows-signin .hint { margin: 8px 0 0; }
.google-btn { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.google-btn svg { width: 16px; height: 16px; }
.shows-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow: auto; }
.shows-list li { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 0; border-radius: 6px; }
.shows-list li.open { background: var(--well); outline: 1px solid var(--accent); }
.shows-list .open-btn { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 4px 8px; border: 0; background: none; color: var(--ink); text-align: left; cursor: pointer; border-radius: 6px; }
.shows-list .open-btn:hover { background: var(--surface); }
.shows-list .open-btn b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.shows-list .open-btn span { font-size: 11px; color: var(--muted); }
.shows-list .icon-btn { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.shows-list .icon-btn:hover { border-color: var(--line); color: var(--ink); }
.shows-list .icon-btn.del:hover { color: var(--danger); border-color: var(--danger); }
.shows-list svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shows-who { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.settings-who { margin: 0 0 12px; padding: 8px 10px; border-radius: 6px; background: var(--well); font-size: 12px; color: var(--muted); }
.settings-who b { display: block; margin-bottom: 2px; color: var(--ink); font: 800 13px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; }

.lib-dialog { width: min(420px, calc(100vw - 32px)); padding: 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); box-shadow: 0 16px 40px #000c; }
.lib-dialog::backdrop { background: #0009; }
.lib-dialog h3 { margin: 0 0 8px; font: 800 17px/1.2 var(--display); letter-spacing: .04em; }
.lib-dialog p { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.lib-dialog input { width: 100%; margin: 0 0 14px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--well); color: var(--ink); font: inherit; }
.lib-dialog input:focus { outline: none; border-color: var(--accent); }
.lib-dialog .se-actions { justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ---------- MIDI controllers ---------- */
.set-h { margin: 4px 0 8px; font: 800 13px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.set-sub { margin: 12px 0 6px; font-size: 12px; color: var(--muted); }
.midi-box .hint { margin: 6px 0 0; }
.midi-box .hint.bad { color: var(--danger); }
.midi-devs, .midi-profiles { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.midi-dev { padding: 8px 10px; border-radius: 8px; background: var(--well); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.midi-dev b { font-size: 13px; word-break: break-word; }
.midi-dev label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.midi-dev label span { width: 48px; flex: none; }
.midi-dev select, .midi-box select, .midi-box input[type="text"] { flex: 1; min-width: 0; padding: 5px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; }
.midi-box input[type="text"] { width: 100%; margin: 8px 0; padding: 7px 8px; font-size: 13px; }
.midi-profiles li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.midi-profiles li > span { flex: 1; min-width: 0; }
.link-btn.danger { color: var(--danger); }
.midi-help { margin-top: 10px; }
.midi-help summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.learn-note { margin: 0 0 8px; font-size: 13px; line-height: 1.45; }
.learn-last { margin: 0 0 8px; padding: 8px 10px; border-radius: 6px; background: var(--well); border: 1px solid var(--accent); font-size: 13px; }
.learn-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.learn-extra select { flex: 0 0 auto; }
.desk.learning .fader .track, .desk.learning .fader .fbtn, .desk.learning ~ * [data-page] { outline: 1px dashed var(--accent); outline-offset: 2px; cursor: crosshair; }

/* Page buttons past 5 pages: ◀ 41–60 ▶ */
.seg-label { display: inline-flex; align-items: center; padding: 0 10px; min-width: 64px; justify-content: center; font-weight: 600; font-size: 13px; }
.seg-btn:disabled { opacity: .35; cursor: default; }
.size-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.size-pick select { padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--well); color: var(--ink); font: inherit; }

/* ---------- Output: lights or FLX S remote ---------- */
.out-mode { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.out-mode .row { margin-bottom: 6px; }
.out-mode .row .hint { margin: 0; font-size: 12px; }
.out-mode input { accent-color: var(--accent); }
.flx-box { margin-top: 8px; padding: 10px; border-radius: 8px; background: var(--well); border: 1px solid var(--line); }
.flx-status { margin: 0 0 10px; font-size: 13px; padding-left: 16px; position: relative; }
.flx-status::before { content: ''; position: absolute; left: 0; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.flx-status.ok::before { background: var(--accent); }
.flx-status.warn::before { background: #f0c45a; }
.flx-box a.small-btn { text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; }
.flx-help { margin-top: 10px; }
.flx-help summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.flx-help .hint { margin: 8px 0 0; }
.status.flx-off .dot { background: #f0c45a; box-shadow: 0 0 8px #f0c45a; }
.flx-sheet { width: min(560px, calc(100vw - 32px)); }
.flx-tables { max-height: 55vh; overflow: auto; margin-bottom: 12px; }
.flx-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; }
.flx-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.flx-table td { padding: 4px 6px; border-bottom: 1px solid #ffffff10; }
.flx-table td b { color: var(--accent); }
.phone-list { list-style: none; margin: -4px 0 10px; padding: 0; font-size: 12px; color: var(--muted); }
.phone-list li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid #ffffff10; }

/* Add fixtures (FLX S style) */
.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 8px 0 4px; }
.add-grid .field { margin: 0; }
.add-grid input { width: 100%; }
.add-grid input[readonly] { opacity: .6; }
.add-summary { margin: 4px 0 8px; font-size: 12px; color: var(--muted); }
.add-summary.bad { color: var(--danger); }

/* ---------- Patch: a patched fixture's details ---------- */
.fx-info { display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.fx-head h3 { margin: 0 0 2px; font: 800 18px/1.2 var(--display); }
.fx-sub { margin: 10px 0 2px; font: 800 12px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fx-table th, .fx-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #ffffff10; vertical-align: top; }
.fx-table th { width: 42%; font-weight: 600; color: var(--muted); }
.fx-chans thead th { width: auto; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.fx-chans td:first-child, .fx-chans td:nth-child(2) { width: 56px; font-variant-numeric: tabular-nums; }
.fx-role { margin-left: 4px; padding: 0 5px; border-radius: 4px; background: var(--accent-deep); color: #cfeee7; font-size: 11px; }
.dip { display: inline-block; align-self: flex-start; padding: 6px 8px 4px; border-radius: 4px; background: #1f5fd1; color: #fff; }
.dip-top { display: flex; justify-content: space-between; font: 600 11px/1 var(--display); letter-spacing: .06em; margin-bottom: 4px; }
.dip-row { display: flex; gap: 5px; }
.dip-sw { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.dip-sw i { position: relative; display: block; width: 12px; height: 28px; background: #3b3f45; }
.dip-sw i::after { content: ''; position: absolute; left: 0; right: 0; height: 12px; bottom: 0; background: #fff; }
.dip-sw.on i::after { top: 0; bottom: auto; }
.dip-sw b { font: 500 10px/1 var(--display); }
.dip-note { margin: 0; font-size: 11px; }
.fx-actions { margin-top: 10px; }
.fx-credit { margin: 10px 0 0; font-size: 11px; color: var(--muted); }
.fx-credit a { color: var(--accent); }
.phone-hl { margin: 0 0 10px; padding: 6px 8px; border-radius: 6px; background: #ffffff14; font-size: 12px; }

/* Trigger: straight to 100% */
.tbtn {
  flex: none; height: 24px; margin-top: 3px; border-radius: 5px; cursor: pointer;
  border: 1px solid #00000080; background: linear-gradient(#34383c, #26292c);
  color: #f0c45a; font: 800 11px/1 var(--display); letter-spacing: .08em;
  box-shadow: inset 0 1px 0 #ffffff14, 0 1px 2px #0008;
}
.tbtn:hover { color: #ffd76a; }
.tbtn:active { transform: translateY(1px); background: linear-gradient(#f0c45a, #c9971e); color: #2a1e02; }
.desk.no-trig .tbtn { display: none; }
