/*
 * Sleekmeeter base styles: each channel is a raised module in a recessed
 * bay, meters are wells of LEDs, faders ride in slots with machined caps, and buttons light up
 * when they're on. Every theme overrides these colour and material tokens in themes.css.
 *
 * Performance: meters and fader caps only ever change `transform` (see app.js), so they are
 * composited on the GPU and never trigger layout or repaint.
 */
@font-face { font-family: "Saira SC"; src: url("fonts/SairaSemiCondensed-Regular.woff") format("woff"); font-weight: 400; font-display: block; }
@font-face { font-family: "Saira SC"; src: url("fonts/SairaSemiCondensed-Medium.woff") format("woff"); font-weight: 500; font-display: block; }
@font-face { font-family: "Saira SC"; src: url("fonts/SairaSemiCondensed-SemiBold.woff") format("woff"); font-weight: 600; font-display: block; }
@font-face { font-family: "Saira SC"; src: url("fonts/SairaSemiCondensed-Bold.woff") format("woff"); font-weight: 700; font-display: block; }

/* ---------- tokens ---------- */
/* Base tokens. Every theme in themes.css overrides these; a theme can be set
   on any element (the theme picker's preview cards use that). */
:root {
  --bg: #111114;
  --bay: #0b0b0e;                 /* recessed sections the modules sit in */
  --bay-edge: rgba(255, 255, 255, .035);
  --mod-a: #202027;               /* channel module, top */
  --mod-b: #18181d;               /* channel module, bottom */
  --mod-edge: rgba(255, 255, 255, .07);
  --mod-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 8px 18px rgba(0, 0, 0, .35);
  --key: #25252c;                 /* unlit hardware key */
  --key-hi: #2e2e36;
  --key-edge: rgba(255, 255, 255, .06);
  --key-ink: #a5a4af;
  --well: #070709;
  --flyout: #1b1b21;
  --line: #2a2a31;
  --ink: #eeedf2;
  --ink-2: #b6b5bf;
  --muted: #7f7e89;
  --amber: #f2b443;               /* hardware outputs, primary action */
  --cyan: #46c6ec;                /* virtual outputs */
  --red: #ff5a5a;                 /* mute */
  --solo: #a58cff;
  --on-ink: #121212;
  --led-g: #46e07a; --led-y: #ffd34d; --led-r: #ff5a5a;
  --led-g-off: #11261a; --led-y-off: #2c2712; --led-r-off: #2c1414;
  --glow: 1;                      /* 0 turns off light bloom (OLED) */
  --focus: #ffd27a;
  --panel-hi: #2a2a32;            /* brand mark */
  --track: #0d0d10;
  --cap-h: 38px;                  /* vertical fader cap height */
  --cap-w: 32px;                  /* vertical fader cap width */
  /* channel colors */
  --c-slate: #a3a2ad; --c-amber: #f2b443; --c-coral: #f58a5c; --c-rose: #f46b9c;
  --c-violet: #a58cff; --c-blue: #6ea0ff; --c-cyan: #46c6ec; --c-green: #49d17d;

  --font: "Saira SC", "Segoe UI", system-ui, sans-serif;
  --s-1: 12px; --s0: 14px; --s1: 16px; --s2: 20px; --s3: 28px;
  color-scheme: dark;
}
/* Materials built from the colours, so every theme gets them (themes may replace them). */
body, [data-theme] {
  --bay-shadow: inset 0 2px 8px rgba(0, 0, 0, .6);
  --key-shadow: 0 1px 0 rgba(0, 0, 0, .55);
  --pop-shadow: var(--pop-shadow);
  --scroll: #2c2c34; --scroll-hi: #3b3b45;
  --field: var(--well);           /* text boxes */
  --rail: var(--well);            /* slider tracks */
  --switch: var(--well);          /* toggle switches, off */
  --cap-metal: linear-gradient(180deg, #f6f6f8, #c4c4cb 46%, #93939b 52%, #d8d8de);
  --cap-ridge: rgba(0, 0, 0, .16);
  --cap-shadow: 0 10px 16px rgba(0, 0, 0, .55), 0 2px 3px rgba(0, 0, 0, .5), inset 0 1px 0 #fff, 0 0 0 1px rgba(0, 0, 0, .55);
  --cap-ink: #18181c;
}
/* OLED black: black surfaces, light only where there's information */
[data-theme="oled"] {
  --bg: #000; --bay: #000; --bay-edge: transparent; --bay-shadow: none;
  --mod-a: #000; --mod-b: #000; --mod-edge: transparent; --mod-shadow: 0 0 0 1px #1a1a1f;
  --key: #0c0c0f; --key-hi: #16161a; --key-edge: transparent;
  --well: #000; --flyout: #000; --line: #1c1c21; --track: #000; --panel-hi: #111;
  --led-g-off: #06100a; --led-y-off: #0e0c05; --led-r-off: #0f0606;
  --ink: #eeedf2; --ink-2: #b6b5bf; --muted: #7f7e89; --key-ink: #a5a4af; --on-ink: #121212;
  --glow: .6; color-scheme: dark;
}
[data-color="slate"] { --acc: var(--c-slate); }
[data-color="amber"] { --acc: var(--c-amber); }
[data-color="coral"] { --acc: var(--c-coral); }
[data-color="rose"] { --acc: var(--c-rose); }
[data-color="violet"] { --acc: var(--c-violet); }
[data-color="blue"] { --acc: var(--c-blue); }
[data-color="cyan"] { --acc: var(--c-cyan); }
[data-color="green"] { --acc: var(--c-green); }
[data-color="lemon"] { --acc: #ffe46c; }
[data-color="lime"] { --acc: #b8e866; }
[data-color="mint"] { --acc: #9af3cd; }
[data-color="teal"] { --acc: #28c1b2; }
[data-color="indigo"] { --acc: #8e94ff; }
[data-color="magenta"] { --acc: #ed71f7; }
[data-color="ruby"] { --acc: #fa616c; }
[data-color="copper"] { --acc: #cb996f; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  --acc: var(--c-slate);
  margin: 0; color: var(--ink); background: var(--bg);
  font-family: var(--font); font-size: var(--s0); line-height: 20px; letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  display: flex; flex-direction: column; overflow: hidden;
  user-select: none; cursor: default;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: default; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 6px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hi); border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- hardware keys ---------- */
.btn, .route, .tog, .keys, .icon-pick, select, .scene-list .load {
  border: 0; border-radius: 6px; background: var(--key); color: var(--key-ink);
  box-shadow: inset 0 1px 0 var(--key-edge), var(--key-shadow);
  transition: background-color .08s, color .08s, box-shadow .12s;
}
.btn:hover, .route:hover, .tog:hover, .keys:hover, .icon-pick:hover, select:hover, .scene-list .load:hover { background: var(--key-hi); color: var(--ink); }
.btn:active, .route:active, .tog:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5); }
.btn { height: 32px; padding: 0 14px; font-weight: 500; white-space: nowrap; }
.bar .btn, .bar .menu-wrap { flex: none; }
.route, .tog { white-space: nowrap; overflow: hidden; }
.btn.icon { width: 32px; padding: 0; display: grid; place-items: center; }
/* a key that is lit: amber backlight with a soft bloom */
.btn.primary, .btn[aria-pressed="true"], .update-btn {
  background: var(--amber); color: var(--on-ink); font-weight: 600;
  box-shadow: 0 0 calc(14px * var(--glow)) color-mix(in srgb, var(--amber) 45%, transparent), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.btn.primary:hover, .btn[aria-pressed="true"]:hover, .update-btn:hover { background: color-mix(in srgb, var(--amber) 88%, #fff); color: var(--on-ink); }
.linkish { border: 0; background: none; padding: 0; color: var(--amber); font-size: var(--s-1); }
.linkish:hover { text-decoration: underline; }
a[data-setup-page] { color: var(--amber); text-decoration: underline; text-underline-offset: 0.15em; overflow-wrap: anywhere; }
a[data-setup-page]:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---------- top bar ---------- */
.bar { display: flex; align-items: center; gap: 8px; padding: 12px 18px 10px; flex: none; }
body:not(.is-mini, .is-panel) .bar { flex-wrap: wrap; }
.bar-utilities { display: flex; align-items: center; gap: 5px; flex: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-name { font-size: var(--s2); font-weight: 700; letter-spacing: .02em; line-height: 28px; }
.status { display: inline-flex; align-items: center; gap: 9px; color: var(--ink-2); font-size: var(--s-1); margin-left: 10px; min-width: 0; }
.bar .status { min-height: 28px; padding: 3px 8px; border: 1px solid transparent; border-radius: 7px; background: none; }
.bar .status:hover, .bar .status:focus-visible { border-color: var(--line); background: var(--key); color: var(--ink); }
.status[data-audio-warning="true"] .dot { background: var(--led-y); box-shadow: 0 0 8px var(--led-y); }
.status[data-audio-warning="true"] .dot::after { display: none; }
.bar-group, .bar-pins { display: flex; align-items: center; gap: 4px; flex: none; }
.bar-group { padding-inline: 2px; }
.bar-pins:empty, .bar-pins:not(:has(.btn:not([hidden]):not([data-unpinned]))) { display: none; }
.bar-pins [data-unpinned] { display: none !important; }
.no-streamer #streamGroup:not(:has(> button:not([hidden]))) { display: none; }
.stream-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px; }
#streamMenu .stream-item > button { white-space: normal; overflow-wrap: anywhere; }
.stream-item label { display: flex; align-items: center; gap: 4px; padding: 6px; color: var(--ink-2); font-size: var(--s-1); }
.stream-item input { accent-color: var(--amber); margin: 0; }
/* Header status chips (Recording, BRB, stream loudness) are theme buttons with a status dot, so
   each theme gives them its own shape, material and font instead of a fixed outlined box. */
.bar .stream-badge.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  font-size: var(--s-1); font-weight: 600; font-variant-numeric: tabular-nums;
}
.stream-badge { --dot: var(--muted); }
.bar .stream-badge.btn::before {
  content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--dot);
  box-shadow: 0 0 calc(6px * var(--glow)) color-mix(in srgb, var(--dot) 70%, transparent);
}
#recordingBadge { --dot: var(--red); }
#awayBadge { --dot: var(--amber); }
.bar .loud-badge.btn { min-width: 96px; justify-content: center; }
.loud-badge .loud-unit { font-size: 10px; font-weight: 500; letter-spacing: .06em; opacity: .7; }
.loud-badge[data-state="ok"] { --dot: var(--led-g); }
.loud-badge[data-state="warn"] { --dot: var(--amber); }
.loud-badge[data-state="bad"] { --dot: var(--red); }
/* When the header would wrap, app.js (fitHeader) compacts it a step at a time: tight-1 hides the
   status text and pinned-button labels and folds the badges to their dot (their title and label
   still say what they are); tight-2 also drops the brand name and the loudness unit. */
.bar.tight-1 #statusText, .bar.tight-1 #streamPins :is(#recLabel, .brb-label), .bar.tight-1 #streamPins #goLiveBtn span { display: none; }
.bar.tight-1 .stream-badge.btn:not(.loud-badge) { width: 26px; padding: 0; gap: 0; justify-content: center; }
.bar.tight-1 .stream-badge:not(.loud-badge) .badge-text { display: none; }
.bar.tight-1 .loud-badge.btn { min-width: 0; padding: 0 9px; }
.bar.tight-2 .brand-name, .bar.tight-2 .scene-now, .bar.tight-2 .loud-badge .loud-unit { display: none; }
.bar.tight-2 .live-tag { padding: 0 7px; letter-spacing: .06em; margin-left: 4px; }
@media (max-width: 1300px) {
  .bar #statusText, #streamPins :is(#recLabel, .brb-label), #streamPins #goLiveBtn span { display: none; }
  .bar .status { margin-left: 0; }
}
@media (max-width: 940px) {
  body:not(.is-panel) .bar .brand-name, .bar .scene-now { display: none; }
}
.status .dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status[data-state="online"] .dot { background: var(--led-g); box-shadow: 0 0 calc(8px * var(--glow)) var(--led-g); }
/* The slow pulse only runs with Theme motion on Full: a looping animation here would keep the
   window drawing frames all day just for a status light. */
body[data-theme-motion="full"] .status[data-state="online"] .dot { animation: breathe 2.6s ease-in-out infinite; }
body[data-theme-motion="full"] .status[data-state="online"] .dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--led-g);
  animation: ring 2.6s ease-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .65; } }
@keyframes ring { 0% { transform: scale(1); opacity: .5; } 70%, 100% { transform: scale(2.8); opacity: 0; } }
.status[data-state="offline"] .dot { background: var(--red); box-shadow: 0 0 calc(8px * var(--glow)) var(--red); }
#statusText { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
/* ---------- window buttons (the app draws its own title bar, so it matches the theme) ---------- */
.winctl { display: flex; align-self: flex-start; margin: -12px 0 0 8px; flex: none; }
.winctl[hidden] { display: none; }
.custom-chrome .bar { padding-right: 0; }
.custom-chrome:not(.is-mini, .is-panel) .bar { position: relative; padding-right: 146px; }
.custom-chrome:not(.is-mini, .is-panel) .winctl { position: absolute; top: 0; right: 0; margin: 0; }
.custom-chrome.is-mini .bar { padding-right: 0; }
.is-mini .winctl { margin-top: -9px; }
.wc {
  display: grid; place-items: center; width: 46px; height: 34px; padding: 0; border: 0; border-radius: 0;
  background: none; color: var(--ink-2); box-shadow: none; cursor: default;
}
.wc:hover { background: var(--key-hi); color: var(--ink); }
.wc:active { background: var(--key); }
.wc.close:hover { background: #e5384a; color: #fff; }
.wc.close:active { background: #c62a3b; color: #fff; }
.wc:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
#wcMax .to-restore { display: none; }
.maxed #wcMax .to-max { display: none; }
.maxed #wcMax .to-restore { display: block; }
.is-mini #wcMax { display: none; }
.custom-chrome .bar { -webkit-user-select: none; user-select: none; }
.scene-now { color: var(--ink-2); font-size: var(--s-1); margin-right: 4px; }
.scene-now b { color: var(--amber); font-weight: 600; }
#miniBtn .to-full { display: none; }
.is-mini #miniBtn .to-mini { display: none; }
.is-mini #miniBtn .to-full { display: block; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 230px;
  background: var(--flyout); border-radius: 10px; padding: 5px;
  box-shadow: 0 0 0 1px var(--line), var(--pop-shadow);
}
.menu button { display: block; width: 100%; text-align: left; white-space: nowrap; padding: 7px 12px; border: 0; border-radius: 6px; background: none; color: var(--ink); }
.menu button:hover, .menu button:focus-visible { background: var(--key); }
#moreMenu hr { height: 1px; border: 0; background: var(--line); margin: 5px 8px; }
#moreMenu { max-height: calc(100vh - 70px); overflow-y: auto; }
#moreMenu .menu-label { color: var(--muted); padding: 5px 12px 2px; font-size: var(--s-1); font-weight: 700; }
#moreMenu button { position: relative; padding-left: 29px; }
#moreMenu button[aria-checked="true"]::before { content: "✓"; position: absolute; left: 10px; color: var(--amber); }

/* ---------- desk: recessed bays that hug their modules and stay centred ---------- */
.desk {
  flex: 1; min-height: 0; display: flex; gap: 12px; justify-content: safe center;
  padding: 0 14px 14px; overflow-x: auto;
}
.group {
  flex: 0 0 auto; display: flex; flex-direction: column; min-height: 0;
  background: var(--bay); border-radius: 14px; padding: 10px 10px 10px;
  box-shadow: var(--bay-shadow), 0 1px 0 var(--bay-edge);
}
.group-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 6px 9px; gap: 12px; min-height: 20px; }
.group h2 { margin: 0; font-size: var(--s-1); font-weight: 600; color: var(--muted); letter-spacing: .06em; }
.strips { flex: 1; min-height: 0; display: flex; gap: 8px; }

/* ---------- channel chip: a backlit icon key ---------- */
.chip {
  width: 28px; height: 28px; flex: none; border-radius: 7px; padding: 0; border: 0;
  display: grid; place-items: center; color: var(--acc);
  background: color-mix(in srgb, var(--acc) 14%, var(--key));
  box-shadow: inset 0 1px 0 var(--key-edge), 0 0 calc(12px * var(--glow)) color-mix(in srgb, var(--acc) 22%, transparent);
}
button.chip:hover { background: color-mix(in srgb, var(--acc) 24%, var(--key)); }
.chip.big { width: 40px; height: 40px; border-radius: 9px; }
.chip.small { width: 24px; height: 24px; border-radius: 6px; }

/* ---------- channel module ---------- */
.strip {
  flex: 0 0 var(--w, 136px); width: var(--w, 136px); min-height: 0;
  display: flex; flex-direction: column; gap: 10px; padding: 12px 11px;
  background: linear-gradient(180deg, var(--mod-a), var(--mod-b)); border-radius: 10px;
  box-shadow: inset 0 1px 0 var(--mod-edge), var(--mod-shadow);
}
.strip.is-hidden > :not(.head) { opacity: .35; }
.strip.is-hidden .titles::after { content: "Hidden"; font-size: var(--s-1); color: var(--muted); }
.head { display: flex; gap: 8px; align-items: center; height: 38px; min-width: 0; }
.titles { display: flex; flex-direction: column; min-width: 0; width: 0; flex: 1; }
.name {
  border: 0; background: none; padding: 0; text-align: left; color: var(--ink);
  font-size: 15px; font-weight: 600; line-height: 20px; letter-spacing: .015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.name-edit {
  width: 100%; font-size: var(--s0); font-weight: 600; padding: 0 6px; height: 24px; border: 0;
  border-radius: 5px; background: var(--field); box-shadow: inset 0 0 0 1px var(--amber); user-select: text; cursor: text;
}
.sub { font-size: var(--s-1); line-height: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bus .bus-tag { color: var(--busc); font-weight: 600; }
.bus[data-kind="hw"] { --busc: var(--amber); }
.bus[data-kind="virt"] { --busc: var(--cyan); }

/* routing keys: amber backlight for hardware outs, cyan for virtual */
.routes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; align-content: start; }
.route, .tog { height: 25px; padding: 0; min-width: 0; font-size: var(--s-1); font-weight: 600; letter-spacing: .03em; }
.route.a { --c: var(--amber); }
.route.b { --c: var(--cyan); }
.route.first-b { grid-column: 1; }
.mix-help { padding: 0 2px 4px; color: var(--ink-2); }
.mix-help p { margin: 0 0 10px; }
.mix-help ul { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 6px; }
.mix-help b { color: var(--ink); }
/* Output names on the routing buttons: two to a row, cut short with "…" (hover for the full name). */
.route-names .strip-routes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.route-names .strip-routes .route { padding: 0 3px; text-overflow: ellipsis; letter-spacing: 0; font-size: 11px; }
body:not(.show-extra-buses) .route.extra:not([aria-pressed="true"]) { display: none; }
.route-expand { display: none; }
.focused-mixer .strip .strip-routes .route:not([aria-pressed="true"]) { display: none; }
.focused-mixer .strip .strip-routes:not(.expanded) .route { grid-column: auto; }
.focused-mixer .strip .strip-routes.expanded .route { display: block; }
.focused-mixer .strip .strip-routes { min-height: 53px; }
.focused-mixer .strip .route-expand { display: block; grid-column: 1 / -1; min-height: 23px; height: auto; padding: 2px 5px; font-size: var(--s-1); white-space: normal; }
.drawer-routes .route.extra { display: block !important; }
.route[aria-pressed="true"], .modes .tog[aria-pressed="true"], .tog.mono[aria-pressed="true"] {
  background: var(--c, var(--amber)); color: var(--on-ink);
  box-shadow: 0 0 calc(14px * var(--glow)) color-mix(in srgb, var(--c, var(--amber)) 50%, transparent), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.route[aria-pressed="true"]:hover { background: color-mix(in srgb, var(--c) 88%, #fff); color: var(--on-ink); }
.modes { grid-template-columns: repeat(2, minmax(0, 1fr)); height: 55px; }

.toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; flex: none; }
.toggles .tog { height: 28px; }
.toggles .tog.mute, .tog.wide { grid-column: 1 / -1; height: 32px; font-size: var(--s0); }
/* Solo, Mono and EQ can be hidden; one that's switched on stays visible so it can be switched off.
   The output row keeps its space so the faders stay lined up with the inputs. */
body.hide-solo-mono .toggles .tog:is(.solo, .mono):not([aria-pressed="true"]) { display: none; }
body.hide-solo-mono .strip .modes .tog:not([aria-pressed="true"]) { visibility: hidden; }
.drawer-togs { height: auto; }
.tog.mute[aria-pressed="true"] {
  background: var(--red); color: #260c16;
  box-shadow: 0 0 calc(16px * var(--glow)) color-mix(in srgb, var(--red) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35);
}
/* Muted on some outputs only (right-click Mute): red outline and which outputs, under the word. */
.tog.mute.part:not([aria-pressed="true"]) {
  color: var(--red); box-shadow: inset 0 0 0 1.5px var(--red);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1.05;
}
.tog.mute.part:not([aria-pressed="true"])::after { content: attr(data-part); font-size: .72em; font-weight: 600; opacity: .9; }
.route.part-muted { box-shadow: inset 0 0 0 1.5px var(--red); color: var(--red); text-decoration: line-through; }
.mute-menu { position: fixed; right: auto; top: 0; left: 0; z-index: 60; min-width: 200px; }
.mute-menu .menu-head { padding: 6px 12px 4px; font-size: var(--s0); color: var(--ink-2, var(--ink)); opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.mute-menu hr { height: 1px; border: 0; background: var(--line); margin: 5px 8px; }
.mute-menu button { position: relative; padding-left: 29px; }
.mute-menu button[aria-checked="true"]::before { content: "✓"; position: absolute; left: 10px; color: var(--red); }
.mute-menu .menu-note { margin: 4px 12px 6px; max-width: 220px; white-space: normal; font-size: var(--s0); opacity: .75; }
.tog.solo[aria-pressed="true"] {
  background: var(--solo); color: #fff;
  box-shadow: 0 0 calc(14px * var(--glow)) color-mix(in srgb, var(--solo) 50%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35);
}

/* ---------- meter well + fader slot ---------- */
.fader {
  flex: 1; min-height: 150px; position: relative;
  display: grid; grid-template-columns: 30px 20px 40px; gap: 5px; justify-content: center;
  touch-action: none; border-radius: 8px;
}
.well {
  position: relative; border-radius: 6px; background: var(--well);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .85), 0 1px 0 var(--mod-edge);
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
  /* the LEDs cover exactly the fader's travel, so the scale lines up with both */
  padding: calc(var(--cap-h) / 2) 5px;
}
/* one meter = unlit LEDs + lit LEDs scaled from the bottom + a peak line; masked into segments */
.meter {
  position: relative; overflow: hidden; border-radius: 2px;
  -webkit-mask: repeating-linear-gradient(to top, #000 0 3px, transparent 3px 5px);
  mask: repeating-linear-gradient(to top, #000 0 3px, transparent 3px 5px);
}
.meter .unlit, .meter .lit, .meter .lit b { position: absolute; inset: 0; }
.meter .unlit {
  background: linear-gradient(to top, var(--led-g-off) 0, var(--led-g-off) var(--p-yellow), var(--led-y-off) var(--p-yellow), var(--led-y-off) var(--p-zero), var(--led-r-off) var(--p-zero));
}
 /* the lit LEDs stay put; a window slides up over them (two opposite translates, GPU only) */
.meter .lit { overflow: hidden; transform: translateY(100%); will-change: transform; }
.meter .lit b {
  transform: translateY(-100%); will-change: transform;
  background: linear-gradient(to top, var(--led-g) 0, var(--led-g) var(--p-yellow), var(--led-y) var(--p-yellow), var(--led-y) var(--p-zero), var(--led-r) var(--p-zero));
}
.meter .pk { position: absolute; inset: 0; transform: translateY(100%); opacity: 0; will-change: transform; }
.meter .pk i { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: #fff; }
/* Muted meters are greyed on the lit LEDs themselves (.lit b), which never change, so the
   graphics card can reuse the result. On .lit, whose child slides every frame, it had to be
   worked out again on every frame. Themes below grey theirs the same way. */
.muted .meter .lit b { filter: saturate(0) brightness(.75); }
/* A soft glow just past the lit edge, for themes that switch it on (themes.css sets --glow-c and
   --glow-r). It moves with the lit window, transform only, so it is drawn once. A drop-shadow
   filter on .lit had the GPU blur every meter again on every frame. */
.meter .glow { position: absolute; inset: 0; display: none; transform: translateY(100%); opacity: 0; will-change: transform; pointer-events: none; }
.meter .glow::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: calc(var(--glow-r, 4px) * 1.5); opacity: .5;
  /* the falloff of the drop-shadow it replaces: strong at the edge, gone about a radius out */
  background: linear-gradient(to top, var(--glow-c, transparent), color-mix(in srgb, var(--glow-c, transparent) 50%, transparent) 15%, color-mix(in srgb, var(--glow-c, transparent) 20%, transparent) 50%, transparent);
}
.fader.h .meter .glow { transform: translateX(-100%); }
.fader.h .meter .glow::before {
  left: 100%; right: auto; top: 0; bottom: 0; width: calc(var(--glow-r, 4px) * 1.5); height: auto; opacity: .5;
  background: linear-gradient(to right, var(--glow-c, transparent), color-mix(in srgb, var(--glow-c, transparent) 50%, transparent) 15%, color-mix(in srgb, var(--glow-c, transparent) 20%, transparent) 50%, transparent);
}
[data-theme="oled"] .groove, [data-theme="oled"] .well, [data-theme="oled"] .fader.h .track { box-shadow: inset 0 0 0 1px #1d1d22; }
[data-theme="oled"] .check input:not(:checked), [data-theme="oled"] .gain-row input, [data-theme="oled"] .scene-save input, [data-theme="oled"] .rule input { box-shadow: inset 0 0 0 1px #2c2c33; }
[data-theme="oled"] input[type="range"]::-webkit-slider-runnable-track { box-shadow: inset 0 0 0 1px #2c2c33; }

.scale { position: relative; }
.scale span { position: absolute; right: 0; transform: translateY(50%); font-size: 11px; color: var(--muted); line-height: 1; letter-spacing: 0; }
.scale span.zero { color: var(--ink); font-weight: 600; }

/* `overflow: clip` keeps the sliding cap layer from adding scrollbars; the margin leaves room for the cap's shadow */
.slot { position: relative; cursor: ns-resize; overflow: clip; overflow-clip-margin: 14px; }
.groove {
  position: absolute; left: 50%; top: 4px; bottom: 4px; width: 6px; margin-left: -3px; border-radius: 3px;
  background: var(--well); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .9), 0 1px 0 var(--mod-edge);
}
.unity {
  position: absolute; left: 4px; right: 4px; height: 1px; background: var(--muted); opacity: .5;
  bottom: calc(var(--cap-h) / 2 + (100% - var(--cap-h)) * var(--p-zero-f));
}
.travel { position: absolute; left: 0; right: 0; top: calc(var(--cap-h) / 2); bottom: calc(var(--cap-h) / 2); pointer-events: none; }
.carrier { position: absolute; left: 0; right: 0; top: 0; height: 100%; transform: translateY(16%); will-change: transform; }
/* the machined cap: brushed metal with grip ridges and a colored index line */
.thumb {
  position: absolute; left: 50%; width: var(--cap-w); margin-left: calc(var(--cap-w) / -2); top: calc(var(--cap-h) / -2); height: var(--cap-h); border-radius: 5px; pointer-events: auto;
  background:
    repeating-linear-gradient(180deg, var(--cap-ridge) 0 1px, transparent 1px 4px),
    var(--cap-metal);
  box-shadow: var(--cap-shadow);
}
.thumb::after {
  content: ""; position: absolute; left: 5px; right: 5px; top: calc(50% - 1px); height: 2px; border-radius: 1px;
  background: var(--acc); box-shadow: 0 0 calc(8px * var(--glow)) var(--acc);
}
.fader:focus-visible { outline-offset: 4px; }
/* typed levels and double-click to 0 dB glide (Voicemeeter fades at the same time) */
.carrier.glide { transition: transform .3s cubic-bezier(.25, .8, .3, 1); }

/* talk-over ducking: the channel is turned down while the mic talks */
.duck-tag {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 2; pointer-events: none;
  padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; line-height: 16px;
  color: var(--on-ink); background: var(--amber); box-shadow: 0 0 calc(10px * var(--glow)) color-mix(in srgb, var(--amber) 55%, transparent);
  opacity: 0; transition: opacity .15s;
}
.ducked .duck-tag { opacity: 1; }
.ducked .readout { color: var(--amber); }
.mini-row.ducked .fader.h .track { box-shadow: inset 0 2px 5px rgba(0, 0, 0, .85), inset 0 0 0 1px var(--amber); }
.fader.dragging .thumb { box-shadow: 0 0 0 2px var(--amber), 0 12px 20px rgba(0, 0, 0, .6), inset 0 1px 0 #fff; }

.readout {
  height: 30px; border: 0; border-radius: 6px; padding: 0; background: transparent; color: var(--ink);
  font-size: var(--s2); font-weight: 600; letter-spacing: .02em; text-align: center;
}
.readout:hover { background: var(--key); }
.muted .readout { color: var(--muted); }

/* ---------- horizontal fader (mini mode and the tray panel) ---------- */
.fader.h { display: block; min-height: 0; height: 30px; flex: 1; min-width: 180px; --cap-w: 46px; overflow: clip; overflow-clip-margin: 8px; }
.fader.h .track {
  position: absolute; inset: 0; cursor: ew-resize; border-radius: 6px; background: var(--well);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .85), 0 1px 0 var(--mod-edge);
}
.fader.h .meter {
  position: absolute; left: 6px; right: 6px; height: 7px;
  -webkit-mask: repeating-linear-gradient(to right, #000 0 3px, transparent 3px 5px);
  mask: repeating-linear-gradient(to right, #000 0 3px, transparent 3px 5px);
}
.fader.h .meter.l { top: 7px; } .fader.h .meter.r { bottom: 7px; }
.fader.h .meter .unlit { background: linear-gradient(to right, var(--led-g-off) 0, var(--led-g-off) var(--p-yellow), var(--led-y-off) var(--p-yellow), var(--led-y-off) var(--p-zero), var(--led-r-off) var(--p-zero)); }
.fader.h .meter .lit { transform: translateX(-100%); }
.fader.h .meter .lit b { transform: translateX(100%); background: linear-gradient(to right, var(--led-g) 0, var(--led-g) var(--p-yellow), var(--led-y) var(--p-yellow), var(--led-y) var(--p-zero), var(--led-r) var(--p-zero)); }
.fader.h .meter .pk { transform: translateX(0); }
.fader.h .meter .pk i { left: 0; top: 0; bottom: 0; right: auto; width: 3px; height: auto; }
.fader.h .unity { top: 3px; bottom: 3px; left: calc(var(--cap-w) / 2 + (100% - var(--cap-w)) * var(--p-zero-f)); right: auto; width: 1px; height: auto; }
.fader.h .travel { top: 0; bottom: 0; left: calc(var(--cap-w) / 2); right: calc(var(--cap-w) / 2); }
.fader.h .carrier { top: 0; left: 0; width: 100%; height: 100%; transform: translateX(84%); }
.fader.h .thumb {
  top: -3px; bottom: -3px; height: auto; left: calc(var(--cap-w) / -2); right: auto; width: var(--cap-w); margin-left: 0;
  display: grid; place-items: center; color: var(--cap-ink);
  background:
    repeating-linear-gradient(90deg, var(--cap-ridge) 0 1px, transparent 1px 4px),
    var(--cap-metal);
}
.fader.h .thumb::after { display: none; }
.fader.h .db { font-size: 12px; font-weight: 700; padding: 0 3px; border-radius: 3px; background: rgba(255, 255, 255, .55); }

/* ---------- mini mode ---------- */
.mini-view { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.mini-list {
  display: flex; flex-direction: column; gap: 4px; padding: 6px;
  background: var(--bay); border-radius: 12px; box-shadow: var(--bay-shadow), 0 1px 0 var(--bay-edge);
}
.mini-list:empty { display: none; }
.mini-row {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 6px; border-radius: 8px;
  background: linear-gradient(180deg, var(--mod-a), var(--mod-b)); box-shadow: inset 0 1px 0 var(--mod-edge), var(--mod-shadow);
}
.mini-name { width: var(--mini-name, 96px); flex: none; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row .tog.mute { width: 54px; height: 28px; flex: none; }
.is-mini .full-only, .is-mini .scene-now, .is-mini .brand-name { display: none; }
.is-mini .bar { padding: 9px 12px; }

/* ---------- recorder ---------- */
/* A small key while stopped; it grows to show the clock while it records or plays. */
.rec-btn:is([data-state="recording"], [data-state="playing"], [data-state="paused"]) {
  display: inline-flex; align-items: center; gap: 8px; width: auto; padding: 0 12px;
}
.rec-btn #recLabel:empty { display: none; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); opacity: .55; flex: none; }
.rec-btn[data-state="recording"] { color: var(--ink); background: color-mix(in srgb, var(--red) 18%, var(--key)); }
.rec-btn[data-state="recording"] .rec-dot, .rec-key[aria-pressed="true"] .rec-dot { opacity: 1; box-shadow: 0 0 calc(8px * var(--glow)) var(--red); animation: breathe 1.2s ease-in-out infinite; }
.rec-btn[data-state="playing"] .rec-dot { background: var(--led-g); opacity: 1; border-radius: 1px; clip-path: polygon(15% 0, 100% 50%, 15% 100%); }
.rec-btn[data-state="paused"] .rec-dot { background: var(--amber); opacity: 1; }
.dlg.recorder { width: min(520px, calc(100vw - 32px)); }
.deck {
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4px 12px; padding: 14px 16px 16px; margin: 4px 0 6px;
  border-radius: 12px; background: var(--bay); box-shadow: var(--bay-shadow), 0 1px 0 var(--bay-edge);
}
.clock { font-size: 40px; font-weight: 600; line-height: 44px; letter-spacing: .04em; color: var(--ink-2); }
.recorder[data-state="recording"] .clock { color: var(--red); text-shadow: 0 0 calc(14px * var(--glow)) color-mix(in srgb, var(--red) 50%, transparent); }
.recorder[data-state="playing"] .clock { color: var(--led-g); }
.recorder[data-state="paused"] .clock { color: var(--amber); }
.deck-state { color: var(--muted); font-size: var(--s-1); text-align: right; letter-spacing: .06em; padding-bottom: 6px; }
.rec-level { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 6px 8px 6px 9px; border-radius: 6px; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); }
.rec-meter {
  position: relative; flex: 1; height: 8px; overflow: hidden; border-radius: 2px;
  -webkit-mask: repeating-linear-gradient(to right, #000 0 3px, transparent 3px 5px); mask: repeating-linear-gradient(to right, #000 0 3px, transparent 3px 5px);
}
.rec-meter .unlit, .rec-meter .lit, .rec-meter .lit b { position: absolute; inset: 0; }
.rec-meter .unlit { background: linear-gradient(to right, var(--led-g-off) 0, var(--led-g-off) var(--p-yellow), var(--led-y-off) var(--p-yellow), var(--led-y-off) var(--p-zero), var(--led-r-off) var(--p-zero)); }
.rec-meter .lit { overflow: hidden; transform: translateX(-100%); will-change: transform; }
.rec-meter .lit b { transform: translateX(100%); will-change: transform; background: linear-gradient(to right, var(--led-g) 0, var(--led-g) var(--p-yellow), var(--led-y) var(--p-yellow), var(--led-y) var(--p-zero), var(--led-r) var(--p-zero)); }
.rec-level-db { width: 52px; text-align: right; font-size: var(--s-1); font-weight: 600; color: var(--ink); }
.rec-level.over .rec-level-db { color: var(--red); }
.rec-warn { grid-column: 1 / -1; margin: 6px 0 0; font-size: var(--s-1); line-height: 17px; color: var(--muted); min-height: 0; }
.rec-warn:empty { display: none; }
.rec-warn.over { color: var(--red); font-weight: 600; }
.transport { grid-column: 1 / -1; display: flex; gap: 6px; margin-top: 10px; }
.transport .btn.icon { width: 44px; height: 38px; }
.transport .btn[aria-pressed="true"]:not(.rec-key) { background: var(--led-g); color: var(--on-ink); box-shadow: 0 0 calc(12px * var(--glow)) color-mix(in srgb, var(--led-g) 45%, transparent); }
.transport [data-rec="pause"][aria-pressed="true"] { background: var(--amber); box-shadow: 0 0 calc(12px * var(--glow)) color-mix(in srgb, var(--amber) 45%, transparent); }
.rec-key { margin-left: auto; height: 38px; display: inline-flex; align-items: center; gap: 9px; padding: 0 18px; }
.rec-key .rec-dot { opacity: 1; }
.rec-key[aria-pressed="true"] { background: var(--red); color: #fff; box-shadow: 0 0 calc(16px * var(--glow)) color-mix(in srgb, var(--red) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35); }
.rec-key[aria-pressed="true"] .rec-dot { background: #fff; box-shadow: none; }
.rec-sec { padding: 14px 0 4px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); margin-top: 12px; }
.rec-sec h3 { margin: 0; font-size: var(--s0); font-weight: 600; color: var(--ink-2); letter-spacing: .04em; }
.rec-sec .hint { margin: 0; font-size: var(--s-1); color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; max-width: 260px; }
.seg .tog { height: 30px; font-size: var(--s0); }
.seg .tog[aria-pressed="true"], .tog.arm[aria-pressed="true"] {
  background: var(--amber); color: var(--on-ink);
  box-shadow: 0 0 calc(12px * var(--glow)) color-mix(in srgb, var(--amber) 45%, transparent), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.arm-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tog.arm { height: 30px; padding: 0 12px; font-size: var(--s0); font-weight: 500; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tog.arm[aria-pressed="true"] { font-weight: 600; }
.rec-file { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rec-file-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rec-file-name.loaded { color: var(--ink); font-weight: 600; }
.recorder .field, .settings-body .field.wide { grid-template-columns: 110px 1fr 64px; width: 100%; }
.recorder .field select, .settings-body .field select { grid-column: 2 / -1; }
.rec-out { grid-column: 2 / -1; }
.rec-out .route.first-b { grid-column: auto; }

/* ---------- settings: theme picker (each card renders in its own theme's tokens) ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; }
.theme-card {
  display: flex; flex-direction: column; gap: 3px; padding: 8px 8px 10px; border: 0; border-radius: 10px; text-align: left;
  background: var(--bg); color: var(--ink); box-shadow: 0 0 0 1px var(--line);
  transition: box-shadow .12s, transform .12s;
}
.theme-card:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--muted); }
.theme-card[aria-checked="true"] { box-shadow: 0 0 0 2px var(--amber), 0 0 calc(14px * var(--glow)) color-mix(in srgb, var(--amber) 35%, transparent); }
.tc-desk { display: flex; gap: 5px; height: 78px; padding: 5px; margin-bottom: 5px; border-radius: 7px; background: var(--bay); box-shadow: var(--bay-shadow), 0 1px 0 var(--bay-edge); }
.tc-mod {
  flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 4px; border-radius: 5px;
  background: linear-gradient(180deg, var(--mod-a), var(--mod-b)); box-shadow: inset 0 1px 0 var(--mod-edge), var(--mod-shadow);
}
.tc-keys { display: flex; gap: 3px; }
.tc-keys i, .tc-mute { display: block; height: 7px; flex: 1; border-radius: 2px; background: var(--key); box-shadow: inset 0 1px 0 var(--key-edge); }
.tc-keys i.on.a { background: var(--amber); box-shadow: 0 0 calc(6px * var(--glow)) color-mix(in srgb, var(--amber) 50%, transparent); }
.tc-keys i.on.b { background: var(--cyan); box-shadow: 0 0 calc(6px * var(--glow)) color-mix(in srgb, var(--cyan) 50%, transparent); }
.tc-fader { flex: 1; display: flex; gap: 4px; min-height: 0; }
.tc-well { position: relative; width: 9px; border-radius: 2px; background: var(--well); overflow: hidden; }
.tc-well b { position: absolute; left: 2px; right: 2px; bottom: 2px; border-radius: 1px; background: linear-gradient(to top, var(--led-g) 0 70%, var(--led-y) 70% 90%, var(--led-r) 90%); }
.tc-slot { position: relative; flex: 1; }
.tc-slot::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--well); }
.tc-cap { position: absolute; left: 50%; width: 16px; height: 9px; margin-left: -8px; border-radius: 2px; background: var(--cap-metal); box-shadow: 0 2px 3px rgba(0, 0, 0, .4); }
.tc-mute { flex: none; }
.tc-mute.on { background: var(--red); box-shadow: 0 0 calc(6px * var(--glow)) color-mix(in srgb, var(--red) 50%, transparent); }
.tc-name { font-weight: 600; font-size: var(--s0); line-height: 18px; }
.tc-about { font-size: 11px; line-height: 14px; color: var(--muted); }

/* ---------- settings: about ---------- */
.about-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 11px 14px; border-radius: 8px;
  background: linear-gradient(180deg, var(--mod-a), var(--mod-b)); box-shadow: inset 0 1px 0 var(--mod-edge), var(--mod-shadow);
}
.about-text { display: flex; flex-direction: column; min-width: 0; }
.about-version { font-weight: 600; font-size: var(--s1); }
.about-vm { color: var(--muted); font-size: var(--s-1); }
.about .hint b { color: var(--ink); font-weight: 600; }

/* ---------- settings: fades and ducking ---------- */
.settings-body .field.top { align-items: start; }
.settings-body .field.top label { padding-top: 5px; }
.settings-body .field .arm-list { grid-column: 2 / -1; }
.settings-body .field.off { opacity: .4; pointer-events: none; }
.duck-opts { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.settings-body .field-hint { margin: -2px 0 2px 120px; font-size: var(--s-1); color: var(--muted); }
.level-range::-webkit-slider-runnable-track { transition: none; }

/* ---------- tray volume panel ---------- */
body:not(.is-panel) .panel-only { display: none !important; }
.is-panel #pinBtn, .is-panel #miniBtn { display: none; }
.is-panel #dockBtn[aria-pressed="true"] { color: var(--amber); }
.is-panel.undocked .bar { cursor: grab; }
body.is-panel { box-shadow: inset 0 0 0 1px var(--line); }
.is-panel .bar { padding: 10px 12px 8px; }
.is-panel #statusText { max-width: 170px; }
/* Tray panel options (Settings → Tray volume panel). */
body.is-panel { opacity: var(--panel-opacity, 1); }
/* Without a background of its own, the page hands the body's background to the window, where opacity can't reach it. */
html:has(> body.is-panel) { background: rgba(0, 0, 0, .004); }
.is-panel.panel-no-icons .mini-row .chip, .is-panel.panel-no-mute .mini-row .tog.mute, .is-panel.panel-no-meters .mini-row .meter { display: none; }
/* Columns: one vertical fader per channel, side by side. */
.is-panel.panel-columns .mini-view { flex-direction: row; align-items: flex-start; overflow: hidden; }
.is-panel .mini-list { flex: none; }
.is-panel .mini-list:not(:has(> .mini-row:not([hidden]))) { display: none; }
.is-panel.panel-columns .mini-list { flex-direction: row; width: max-content; gap: 4px; }
.is-panel.panel-columns .mini-row { flex-direction: column; justify-content: flex-start; width: 104px; height: auto; padding: 8px 4px; gap: 6px; }
.is-panel.panel-columns .mini-name { width: 100%; text-align: center; font-size: 12px; }
.is-panel.panel-columns .mini-row .fader { flex: none; height: 200px; min-height: 0; width: 100%; }
.is-panel.panel-columns .mini-db { font-size: 12px; font-weight: 600; color: var(--ink-2); line-height: 16px; }
.is-panel.panel-columns .mini-row .tog.mute { width: 84px; }
.is-panel.panel-columns.panel-no-meters .mini-row .fader { grid-template-columns: 40px; }
.is-panel.panel-columns.panel-no-meters .mini-row :is(.well, .scale) { display: none; }
.panel-discord {
  display: flex; flex: none; align-items: center; gap: 8px;
  margin: 0 12px 8px; padding: 4px 8px; min-width: 0;
  border-radius: 6px; background: var(--bay); font-size: var(--s-1);
}
.panel-discord b { flex: none; color: var(--amber); }
.panel-discord span { min-width: 0; color: var(--ink-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.panel-mic span { flex: 1; }
.panel-mic .btn { flex: none; padding: 2px 8px; font-size: var(--s-1); }
.panel-mic .btn[hidden] { display: none; }
.panel-channel-settings { margin: 8px 0; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
#panelChannelChoices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#panelChannelChoices label { display: flex; gap: 7px; align-items: flex-start; padding: 2px 0; }
#panelChannelChoices input { flex: none; accent-color: var(--amber); }
#panelChannelChoices label:has(input:disabled) { opacity: .5; }
.panel-preview-frame { max-width: 100%; overflow: auto; padding: 10px; border-radius: 8px; background: var(--field); }
#panelPreview { display: flex; flex-direction: column; gap: 4px; width: max-content; max-height: 220px; overflow: auto; }
#panelPreview.columns { flex-direction: row; }
.panel-preview-channel { display: flex; align-items: center; gap: 6px; width: 360px; min-height: 30px; padding: 5px 8px; border-radius: 5px; background: var(--key); }
.panel-preview-channel svg { color: var(--acc); vertical-align: middle; }
.panel-preview-name { min-width: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-preview-fader { display: block; flex: 1; height: 5px; border-radius: 3px; background: linear-gradient(to right, var(--acc) 65%, var(--rail) 65%); }
.panel-preview-fader.with-meter { box-shadow: 0 3px 0 var(--well); }
.panel-preview-mute { font-size: var(--s-1); color: var(--ink-2); }
#panelPreview.columns .panel-preview-channel { flex: none; flex-direction: column; width: 104px; }
#panelPreview.columns .panel-preview-name { max-width: 100%; }
#panelPreview.columns .panel-preview-fader { flex: none; width: 5px; height: 110px; background: linear-gradient(to top, var(--acc) 65%, var(--rail) 65%); }
#panelPreview.columns .panel-preview-fader.with-meter { box-shadow: 3px 0 0 var(--well); }

/* ---------- type-a-value box ---------- */
.gain-edit {
  position: fixed; z-index: 45; width: 188px; padding: 12px;
  background: var(--flyout); border-radius: 10px; box-shadow: 0 0 0 1px var(--line), 0 16px 34px rgba(0, 0, 0, .55);
  display: flex; flex-direction: column; gap: 6px;
}
.gain-edit label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gain-row { display: flex; align-items: center; gap: 8px; }
.gain-row .unit { color: var(--ink-2); }
.gain-hint { font-size: var(--s-1); color: var(--muted); }
.gain-edit.invalid .gain-hint { color: var(--red); }
.gain-edit.invalid input { box-shadow: inset 0 0 0 1px var(--red); }

/* text fields: a recessed well with an amber edge when focused */
.gain-row input, .scene-save input, .rule input {
  flex: 1; min-width: 0; height: 34px; padding: 0 10px; border: 0; border-radius: 6px;
  background: var(--field); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .8), 0 1px 0 var(--mod-edge);
  user-select: text; cursor: text;
}
.gain-row input { font-size: var(--s1); font-weight: 600; }
.gain-row input:focus, .scene-save input:focus, .rule input:focus { box-shadow: inset 0 0 0 1px var(--amber), 0 0 calc(10px * var(--glow)) color-mix(in srgb, var(--amber) 25%, transparent); }
.gain-row input:focus-visible, .scene-save input:focus-visible, .rule input:focus-visible { outline: none; }

/* ---------- channel panel ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 100vw); z-index: 25;
  background: var(--flyout); box-shadow: -1px 0 0 var(--line), -18px 0 40px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column;
  animation: slide-in .18s cubic-bezier(.2, .9, .3, 1);
}
@keyframes slide-in { from { transform: translateX(28px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.ui-tabs { display: flex; flex-wrap: wrap; gap: 5px; padding-bottom: 6px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.ui-tabs .btn { min-height: 32px; height: auto; padding: 5px 10px; white-space: normal; overflow-wrap: anywhere; }
.ui-tabs .btn[aria-selected="true"] { color: var(--ink); background: var(--key-hi); box-shadow: inset 0 -3px var(--amber); }
.drawer > .ui-tabs { padding: 8px 12px; margin-bottom: 0; }
.drawer-body [role="tabpanel"] { overflow-wrap: anywhere; }
.input-fx-warning { position: absolute; right: 4px; top: 4px; z-index: 2; min-width: 20px; min-height: 20px; padding: 0 4px; border: 1px solid var(--amber); border-radius: 5px; background: var(--well); color: var(--amber); font-weight: 700; }
.strip:has(.app-stack:not([hidden])) .input-fx-warning { right: 34px; }
.drawer-apps { list-style: none; margin: 0; padding: 0; }
.drawer-apps li { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.drawer-sources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.drawer-sources .btn { height: auto; min-height: 32px; padding: 5px 8px; white-space: normal; overflow-wrap: anywhere; }
#outputDevices li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#outputDevices span { display: block; color: var(--ink-2); }
.drawer-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.drawer-titles h2 { margin: 0; font-size: var(--s2); font-weight: 700; line-height: 26px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 16px 20px; }
.drawer-body section { padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.drawer-body section:last-child { border-bottom: 0; }
.drawer-body h3, .settings-body h3, .rules h3 { margin: 0; font-size: var(--s0); font-weight: 600; color: var(--ink-2); letter-spacing: .04em; }
.field { display: grid; grid-template-columns: 84px 1fr 48px; align-items: center; gap: 10px; }
.field label { color: var(--ink-2); }
.field output { text-align: right; font-weight: 600; }
.swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; padding: 0;
  background: var(--acc); box-shadow: inset 0 0 0 2px var(--flyout), 0 0 calc(8px * var(--glow)) color-mix(in srgb, var(--acc) 40%, transparent);
}
.swatch[aria-pressed="true"] { border-color: var(--ink); }
.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.icon-pick { height: 36px; display: grid; place-items: center; }
.icon-pick[aria-pressed="true"] { color: var(--acc); background: color-mix(in srgb, var(--acc) 16%, var(--key)); box-shadow: inset 0 0 0 1px var(--acc), 0 0 calc(10px * var(--glow)) color-mix(in srgb, var(--acc) 30%, transparent); }

select {
  -webkit-appearance: none; appearance: none;
  height: 34px; padding: 0 30px 0 10px; width: 100%; min-width: 0; color: var(--ink);
  background: var(--key) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23b6b5bf' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 12px 12px;
}
select option, select optgroup { background: var(--flyout); color: var(--ink); }

/* channel-panel sliders: a groove with a small metal knob */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--track-bg, var(--rail)); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .8); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 22px; border-radius: 4px; margin-top: -8px;
  background: repeating-linear-gradient(180deg, var(--cap-ridge) 0 1px, transparent 1px 3px), var(--cap-metal);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .6), 0 0 0 1px rgba(0, 0, 0, .5);
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--track-bg, var(--rail)); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 22px; border: 0; border-radius: 4px; background: #d8d8de; }

/* settings rows: text on the left, a lit toggle switch on the right */
.check {
  display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: center; gap: 16px;
  width: 100%; padding: 11px 14px; border-radius: 8px; line-height: 20px;
  background: linear-gradient(180deg, var(--mod-a), var(--mod-b)); box-shadow: inset 0 1px 0 var(--mod-edge), var(--mod-shadow);
}
.check span { flex: 1; max-width: 60ch; }
.check input {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0;
  width: 42px; height: 22px; border-radius: 11px; background: var(--switch); position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .9), 0 1px 0 var(--mod-edge); transition: background-color .15s, box-shadow .15s;
}
.check input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(180deg, #f2f2f4, #a9a9b0); box-shadow: 0 1px 3px rgba(0, 0, 0, .6);
  transition: transform .16s cubic-bezier(.2, .9, .3, 1);
}
.check input:checked { background: var(--amber); box-shadow: 0 0 calc(12px * var(--glow)) color-mix(in srgb, var(--amber) 45%, transparent); }
.check input:checked::after { transform: translateX(20px); }
.check.indent { width: calc(100% - 24px); margin-left: 24px; }
.check.disabled { opacity: .45; }

/* ---------- offline ---------- */
.offline {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
}
.offline-card {
  max-width: 420px; text-align: center; padding: 28px 28px 24px; border-radius: 14px;
  background: linear-gradient(180deg, var(--mod-a), var(--mod-b)); box-shadow: inset 0 1px 0 var(--mod-edge), 0 0 0 1px var(--line), 0 24px 48px rgba(0, 0, 0, .55);
}
.offline-card h1 { margin: 0 0 8px; font-size: var(--s3); font-weight: 700; line-height: 34px; letter-spacing: .01em; text-wrap: balance; }
.offline-card p { margin: 0 0 20px; color: var(--ink-2); }
.offline-card .btn { height: 36px; padding: 0 20px; }

/* ---------- dialogs ---------- */
.dlg {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 22px 24px 24px;
  background: var(--flyout); color: var(--ink); border: 0; border-radius: 14px;
  box-shadow: 0 0 0 1px var(--line), 0 30px 60px rgba(0, 0, 0, .6);
}
.dlg[open] { animation: pop .16s cubic-bezier(.2, .9, .3, 1); }
@keyframes pop { from { transform: scale(1.03); opacity: 0; } }
.dlg.settings { width: min(900px, calc(100vw - 32px)); display: none; flex-direction: column; overflow: hidden; }
.dlg.settings[open] { display: flex; }
.dlg::backdrop { background: rgba(0, 0, 0, .55); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; }
.dlg-head h2 { margin: 0; font-size: var(--s2); font-weight: 700; line-height: 28px; letter-spacing: .02em; }
.hint { margin: 0 0 14px; color: var(--ink-2); max-width: 60ch; }
.settings-search { display: flex; gap: 8px; margin: 4px 0 16px; }
.settings-search input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--ink); font: inherit; }
.settings-layout { display: grid; grid-template-columns: clamp(170px, 24%, 212px) minmax(0, 1fr); gap: 20px; min-height: 0; height: min(610px, 68vh); }
.settings-nav { display: grid; align-content: start; grid-template-columns: minmax(0, 1fr); gap: 5px; overflow: auto; padding: 5px; }
.settings-nav .btn { min-height: 32px; height: auto; padding: 6px 12px; line-height: 1.25; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.settings-nav .btn[aria-current] { color: var(--ink); background: var(--key-hi); box-shadow: inset 3px 0 var(--amber); }
.settings-body { overflow: auto; padding: 3px 8px 8px 3px; overflow-wrap: anywhere; }
.settings-intro { padding: 0 0 10px; }
.settings-intro h3 { font-size: var(--s2); color: var(--ink); }
.settings-body section { padding: 14px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--mod-a) 52%, transparent); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.settings-body .settings-filtered { display: none !important; }
.settings-body .btn-row .btn:not(.icon) { min-height: 32px; height: auto; padding-block: 5px; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; }
#faderGroupList { width: 100%; }
#faderGroupList fieldset { min-inline-size: 0; margin-inline: 0; }
#faderGroupList legend { max-inline-size: 100%; }
.balance-scale { display: flex; align-items: center; gap: 10px; margin: 16px 0 6px; }
.balance-scale input { flex: 1; min-width: 0; }
#balanceMixer { height: 24px; padding-inline: 8px; font-size: var(--s-1); }
#balanceRoute:empty { display: none; }
.balance-pin { margin: 0 6px 9px; max-width: 390px; }
.balance-pin .btn { height: 24px; padding-inline: 8px; }
#balanceApplied:empty, #balanceSetupStatus:empty, #balanceSignal:empty { display: none; }
.mx-role { display: block; font-size: var(--s-1); color: var(--muted); }
.mix-paired .mx-sl { width: 45px; }
#guidedAudio h4 { margin-bottom: 4px; }
@media (max-width: 680px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 8px; }
  .settings-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 460px) {
  .settings-nav, .settings-body .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.settings-body section h3 { margin-bottom: 2px; }
.settings-body .hint { margin: 0 0 4px; }
.hotkeys { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.hotkey { display: grid; grid-template-columns: 1.1fr 1fr 1fr 32px; gap: 6px; align-items: center; }
.midi-maps .hotkey { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1fr) 32px; }
.midi-control { font-size: var(--s-1); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.midi-control small { color: var(--muted); }
.midi-control.learning { color: var(--amber); }
.midi-status .bad { color: var(--red); }
.hotkey select:disabled { visibility: hidden; }
.keys { height: 34px; font-weight: 600; padding: 0 8px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.keys.recording { background: var(--amber); color: var(--on-ink); box-shadow: 0 0 calc(12px * var(--glow)) color-mix(in srgb, var(--amber) 45%, transparent); }
.keys.empty { color: var(--muted); font-weight: 400; }
.problems { margin: 0; color: var(--red); }
.scene-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.scene-list li { display: flex; align-items: center; gap: 6px; }
.scene-list .load { flex: 1; text-align: left; height: 40px; padding: 0 14px; font-weight: 600; color: var(--ink); font-size: var(--s1); }
.scene-list .del { color: var(--ink-2); }
.scene-list .empty { color: var(--ink-2); padding: 10px 0; }
.inspect-panel { margin: 10px 0; padding: 10px 12px; border-radius: 8px; background: var(--bay); box-shadow: inset 0 0 0 1px var(--line); }
.inspect-panel h3 { margin: 0 0 8px; font-size: var(--s1); }
.inspect-panel :is(ul, ol) { margin: 8px 0; padding-left: 23px; max-height: 180px; overflow: auto; }
.inspect-panel li { padding: 2px 0; overflow-wrap: anywhere; }
.inspect-panel .route-warning { color: var(--red); font-weight: 600; }
.inspect-panel .route-issue { color: var(--red); }
.route-inspect-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.route-inspect-controls select { flex: 1 1 140px; min-width: 0; padding: 0 8px; }
#appAssignName { min-width: 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); }
#appAssignList li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
#appAssignList li[data-warn] { color: var(--amber); }
.cutout { display: grid; gap: 8px; margin: 4px 0 12px; }
.cutout > .btn { justify-self: start; }
#cutOutResult { display: grid; gap: 8px; }
#cutOutResult[hidden] { display: none; }
#cutOutResult p { margin: 0; }
#cutOutResult ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dev-badge { font-size: 10px; font-weight: 800; letter-spacing: .08em; line-height: 1; padding: 3px 6px; border-radius: 6px;
  color: var(--bg, #111114); background: var(--amber); cursor: default; }
.is-mini .dev-badge { display: none; }
#audioFlowScroll { max-height: 370px; overflow: auto; margin: 8px 0; }
#audioFlowGraph { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 5vw, 55px); min-width: 470px; padding: 4px; }
#audioFlowPaths { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
#audioFlowPaths path { fill: none; stroke: var(--cyan); stroke-width: 1.5px; opacity: .6; }
#audioFlowPaths path.issue { stroke: var(--amber); stroke-dasharray: 3 4; }
#audioFlowPaths path.dim { opacity: .13; }
.flow-column { position: relative; }
.flow-column h4 { margin: 0 0 8px; color: var(--ink-2); font-size: var(--s-1); }
.flow-node { display: block; width: 100%; min-height: 40px; height: auto; margin: 0 0 6px; padding: 5px 8px; text-align: left; white-space: normal; overflow-wrap: anywhere; line-height: 1.2; }
.flow-node span { display: block; color: var(--muted); font-size: var(--s-1); margin-top: 2px; }
.flow-node.issue span { color: var(--amber); }
.flow-node.dim { opacity: .48; }
#vstRecovery select { max-width: 100%; }
.scene-save { display: flex; gap: 8px; }
/* Potato output select: the input faders set one output's mix. */
.mix-for { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; white-space: nowrap; font-size: var(--s-1); color: var(--muted); }
.mix-for select { height: 24px; padding: 0 6px; font-size: var(--s-1); }
body.mixing-output .mix-for select { box-shadow: 0 0 0 1px var(--amber); color: var(--amber); }
body.mixing-output #inputs .strip { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 55%, transparent), var(--mod-shadow); }
.sub-h { margin: 14px 0 4px; font-size: var(--s0); font-weight: 600; }
.backup-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow-y: auto; }
.backup-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--key); }
.backup-list li.empty { color: var(--ink-2); background: none; padding-left: 0; }
.backup-list .btn { height: 26px; padding: 0 10px; }
.dlg.streamdeck-dlg { width: min(440px, calc(100vw - 32px)); }
.dlg.whatsnew-dlg { width: min(620px, calc(100vw - 32px)); }
.whatsnew-dlg[open] { display: flex; flex-direction: column; }
.whatsnew { overflow-y: auto; min-height: 0; margin: 0 -24px 14px; padding: 0 24px; }
.whatsnew h3 { margin: 12px 0 6px; font-size: var(--s1); color: var(--acc); }
.whatsnew h3:first-child { margin-top: 2px; }
.whatsnew h4 { margin: 12px 0 6px; font-size: var(--s0); font-weight: 700; color: var(--ink); }
.whatsnew p { margin: 0 0 6px; color: var(--ink-2); }
.whatsnew ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.whatsnew li { line-height: 1.45; color: var(--ink-2); }
.whatsnew li strong { color: var(--ink); font-weight: 600; }
.whatsnew code { font-size: .92em; padding: 0 4px; border-radius: 4px; background: var(--key); }
.dlg.scenes { width: min(620px, calc(100vw - 32px)); }

/* ---------- output profiles ---------- */
/* Output mix: every input's gain layers (Potato), one column per input. */
.dlg.mixview-dlg { width: min(1520px, calc(100vw - 32px)); }
.dlg-tools { display: flex; gap: 6px; }
/* Popped out into its own window: the Output mix is the whole page, and the sliders grow with it. */
body.is-mixwin > :not(#mixViewDlg, #mixMonitorDlg) { display: none !important; }
#mixMonitorDlg .btn-row { margin-top: 12px; }
body.is-mixwin { overflow: hidden; }
body.is-mixwin #mixViewDlg {
  position: fixed; inset: 0; width: auto; max-width: none; height: auto; max-height: none; margin: 0;
  display: flex; flex-direction: column; border-radius: 0; box-shadow: inset 0 0 0 1px var(--line); animation: none;
  padding: 10px 14px 12px;
}
body.is-mixwin #mixViewDlg .dlg-head { cursor: default; user-select: none; }
body.is-mixwin #mixViewHint { display: none; }
body.is-mixwin .mixview { flex: 1; min-height: 0; }
body.is-mixwin .mx-col, body.is-mixwin .mx-row, body.is-mixwin .mx-sl { min-height: 0; }
body.is-mixwin .mx-row, body.is-mixwin .mx-sl { flex: 1; }
body.is-mixwin .mx-track { flex: 1; height: auto; min-height: 80px; }
.mixview { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; }
.mx-col { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 10px 8px 8px; border-radius: 12px; background: linear-gradient(180deg, var(--mod-a), var(--mod-b)); box-shadow: inset 0 1px 0 var(--mod-edge), var(--mod-shadow); }
.mx-head { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; }
.mx-head .chip { flex: none; }
.mx-head span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-row { display: flex; gap: 3px; }
.mx-sl { width: 26px; display: flex; flex-direction: column; align-items: center; gap: 4px; outline: none; border-radius: 6px; }
.mx-sl:focus-visible { box-shadow: 0 0 0 2px var(--focus); }
.mx-val { font-size: 10px; line-height: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mx-track { position: relative; width: 8px; height: 150px; border-radius: 4px; background: var(--well); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .8); cursor: ns-resize; touch-action: none; }
.mx-fill { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 4px; background: var(--acc); opacity: .85; }
.mx-thumb { position: absolute; left: 50%; width: 22px; height: 12px; margin: 0 0 -6px -11px; border-radius: 4px; background: var(--cap-metal); box-shadow: var(--cap-shadow); pointer-events: none; }
.mx-unity { position: absolute; left: -4px; right: -4px; height: 1px; background: var(--muted); opacity: .6; }
.mx-sl .route { width: 26px; height: 22px; padding: 0; font-size: 10px; }
.mx-sl.off .mx-track { opacity: .35; }
.mx-sl.off .mx-val { opacity: .5; }
.mx-sl.picked .mx-val { color: var(--amber); font-weight: 700; }
.dlg.outputs-dlg { width: min(640px, calc(100vw - 32px)); }
.profile-list li { gap: 6px; }
.profile-list .load { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; height: 54px; min-width: 0; padding-right: 74px; }
.profile-list .pf-name { font-size: var(--s1); font-weight: 600; }
.profile-list .pf-devices { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--s-1); font-weight: 400; color: var(--ink-2); }
.profile-list .pf-live { display: none; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: var(--s-1); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--amber); }
.profile-list li.live .pf-live { display: block; }
.profile-list li.live .load { box-shadow: inset 0 0 0 1px var(--amber), 0 0 calc(12px * var(--glow)) color-mix(in srgb, var(--amber) 28%, transparent); }
.profile-list .tog.auto-pf { width: 56px; height: 40px; flex: none; }
.profile-list .tog.auto-pf[aria-pressed="true"] { background: var(--amber); color: var(--on-ink); }
.field-note { margin: 12px 0 0; font-size: var(--s-1); color: var(--muted); }
#outputsBtn[data-live="1"]::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-radius: 50%; vertical-align: 1px; background: var(--amber); box-shadow: 0 0 calc(6px * var(--glow)) var(--amber); }

/* ---------- volume per app ---------- */
.dlg.apps-dlg { width: min(780px, calc(100vw - 32px)); }
.dlg.apps-dlg[open] { display: flex; flex-direction: column; overflow: hidden; }
.apps-dlg > :is(.dlg-head, .ui-tabs) { flex: none; }
.apps-dlg > [role="tabpanel"] { min-height: 0; overflow: auto; padding: 3px; }
.apps-volume-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.apps-volume-head .hint { margin: 0; }
.app-vols { display: flex; flex-direction: column; gap: 2px; max-height: min(56vh, 460px); overflow-y: auto; margin: 0 -8px; padding: 0 8px; }
.app-row { display: grid; grid-template-columns: minmax(100px, 140px) 1fr 44px 62px minmax(130px, 200px); gap: 12px; align-items: center; padding: 5px 0; }
.app-name { display: flex; align-items: center; gap: 9px; min-width: 0; font-weight: 600; }
.app-name .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-name .live { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--rail); }
.app-name .live.on { background: var(--led-g); box-shadow: 0 0 calc(8px * var(--glow)) var(--led-g); }
.app-row output { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.app-row .tog.mute { height: 28px; width: 62px; }
.app-route { min-width: 0; }
.app-route .route { width: 100%; }
.app-route-status { display: block; color: var(--ink-2); overflow-wrap: anywhere; font-size: var(--s-1); line-height: 1.3; margin-top: 4px; }
#appRouteNotice { display: none; position: static; transform: none; max-width: none; margin: 0 0 8px; }
#appRouteNotice.show { display: flex; }
.app-row.muted .app-name, .app-row.muted output { opacity: .5; }
.empty-note { margin: 10px 0 0; }

.rules { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.rules .hint { margin: 0; }
.rule-head, .rule { display: grid; grid-template-columns: 1.25fr 1fr 1fr 32px; gap: 6px; width: 100%; align-items: center; }
.rule-head { font-size: var(--s-1); color: var(--muted); }
.rule-list { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.fix-audio-btn { height: 32px; padding: 0 14px; border: 0; border-radius: 6px; background: var(--red); color: #fff; }
.fix-audio-btn:hover { background: color-mix(in srgb, var(--red) 88%, #fff); color: #fff; }
.health-list .btn { margin-top: 8px; }
.update-btn { height: 32px; padding: 0 14px; border: 0; border-radius: 6px; }
.update-menu { width: 270px; padding: 12px 6px 6px; }
.update-menu p { margin: 0 8px 8px; color: var(--ink-2); }
.update-menu button:first-of-type { font-weight: 600; color: var(--amber); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 12px); z-index: 40;
  background: var(--flyout); color: var(--ink); padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 0 0 1px var(--line), var(--pop-shadow);
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .2s cubic-bezier(.2, .9, .3, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast { display: flex; align-items: center; gap: 12px; max-width: calc(100% - 24px); }
.toast.show .toast-action { pointer-events: auto; }
body:has(#appTray:not([hidden])) .toast { bottom: 58px; }

/* ---------- dense layout for Potato's 16 channels ---------- */
.dense { --cap-h: 34px; --cap-w: 28px; }
.dense .strips { gap: 6px; }
.dense .strip { padding: 10px 8px; gap: 8px; }
.dense .fader { grid-template-columns: 24px 18px 34px; gap: 4px; }
.dense .head { gap: 6px; }
.dense .chip:not(.small):not(.big) { width: 26px; height: 26px; }
.dense .name { font-size: var(--s0); }
.dense .route { font-size: 11px; }
.dense .readout { font-size: var(--s1); }
.dense .strip .sub, .is-mini .mini-row .mini-name { color: var(--ink-2); }
.dense .strip .route[aria-pressed="true"] {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.dense .strip :is(.route, .tog, .chip, .name):focus-visible,
.is-mini .mini-row :is(.fader, .chip, .tog):focus-visible { outline-offset: -2px; }
@media (max-width: 480px) {
  body.is-mini:not(.panel-columns) .mini-row .fader.h { min-width: 0; }
  body.is-mini:not(.panel-columns) .mini-name { width: min(var(--mini-name, 96px), 24vw); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* the theme picker shows three themes and expands on request */
.theme-more {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 34px; margin-top: 10px;
  border: 0; border-radius: 8px; background: var(--key); color: var(--amber); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line);
}
.theme-more:hover { background: var(--key-hi); color: var(--ink); }
.theme-more svg { transition: transform .15s; }
.theme-more[aria-expanded="true"] svg { transform: rotate(180deg); }

/* ---------- collapsible settings groups ---------- */
.fold details { width: 100%; }
.fold summary { display: flex; align-items: center; gap: 10px; list-style: none; padding: 2px 0; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary h3 { margin: 0; }
.fold summary::after {
  content: ""; margin-left: auto; width: 7px; height: 7px; flex: none; margin-right: 4px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform .15s;
}
.fold details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.fold summary:hover h3 { color: var(--ink); }
.fold-note { font-size: var(--s-1); color: var(--muted); }
.fold-note[data-ok="1"] { color: var(--led-g); }
.fold-body { display: flex; flex-direction: column; gap: 8px; width: 100%; padding-top: 10px; }
.fold-body .hint { margin: 0; }
.fold-body .fold-body { padding-top: 0; }
.fold-body .fold-body[hidden] { display: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pair { display: grid; grid-template-columns: 1fr 84px; gap: 6px; grid-column: 2 / -1; }
.field input[type="text"], .field input[type="password"], .field input[type="number"] {
  height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: var(--field); color: var(--ink); min-width: 0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .55);
}
.field input[type="password"] { grid-column: 2 / -1; }
.field select { grid-column: 2 / -1; height: 32px; }
.field input:focus { box-shadow: inset 0 0 0 1px var(--amber); }
.obs-status { color: var(--muted); }
.obs-status[data-ok="1"] { color: color-mix(in srgb, var(--led-g) 70%, var(--ink)); }
.obs-status[data-warn="1"] { color: var(--amber); }
.rule-head.obs-head, .obs-rule { grid-template-columns: 1.25fr 1fr 1fr 32px; }
.obs-rule { display: grid; gap: 6px; width: 100%; align-items: center; color: var(--ink-2); }
.obs-rule select, .rule select { min-width: 0; }
.rule-wrap { display: flex; flex-direction: column; gap: 4px; width: 100%; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.rule-wrap:last-child { border-bottom: 0; }
.rule-extra { display: grid; grid-template-columns: 1.25fr 1fr 1fr 32px; gap: 6px; align-items: center; color: var(--muted); font-size: var(--s-1); }
.rule-extra select { min-width: 0; }

/* ---------- header: Be right back and LIVE ---------- */
/* A small key; while you're away it widens to say "Back live" so the way back is obvious. */
.brb-btn { font-weight: 600; letter-spacing: .06em; }
.brb-btn .brb-label { display: none; }
.brb-btn[aria-pressed="true"] { display: inline-flex; align-items: center; gap: 7px; width: auto; padding: 0 12px; }
.brb-btn[aria-pressed="true"] .brb-label { display: inline; }
.brb-btn[aria-pressed="true"] {
  background: var(--red); color: #fff;
  box-shadow: 0 0 calc(16px * var(--glow)) color-mix(in srgb, var(--red) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35);
  animation: brb-pulse 2s ease-in-out infinite;
}
@keyframes brb-pulse { 50% { opacity: .78; } }
.live-tag {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border: 0; border-radius: 6px; margin-left: 8px; cursor: pointer;
  font-size: 11px; font-weight: 700; letter-spacing: .12em; color: #fff; background: var(--red);
  box-shadow: 0 0 calc(10px * var(--glow)) color-mix(in srgb, var(--red) 55%, transparent);
}

/* ---------- header: going live, music off stream ---------- */
.golive-btn { display: inline-flex; align-items: center; gap: 6px; }
/* The music key gets a line through it, and turns amber, while music is kept off the stream. */
.music-btn .slash { display: none; }
.music-btn[aria-pressed="true"] { color: var(--amber); }
.music-btn[aria-pressed="true"] .slash { display: inline; }
.settings-body h4 { margin: 10px 0 0; font-size: var(--s-1); font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
#goLiveList .btn { display: block; }
.golive-sum { margin: 0 0 10px; font-weight: 600; color: var(--ink); }
.golive-sum[data-ok="1"] { color: var(--led-g); }
.golive-sum:empty { display: none; }
.learn-note { margin: 0; align-self: center; }

/* ---------- setup check ---------- */
.dlg.health-dlg, .dlg.mic-dlg { width: min(540px, calc(100vw - 32px)); }
#crackleCapturedReport pre { max-height: 12rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.dlg.quick-dlg, .dlg.events-dlg { width: min(630px, calc(100vw - 32px)); }
.tool-search { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--ink); }
#quickResults, #audioEventList { list-style: none; margin: 10px 0; padding: 3px; display: grid; gap: 4px; }
#quickResults { max-height: min(410px, 50vh); overflow-y: auto; }
#quickResults li, .audio-event { padding: 7px 10px; border-radius: 6px; background: var(--key); color: var(--ink); overflow-wrap: anywhere; }
#quickResults li { display: flex; justify-content: space-between; gap: 8px; cursor: default; }
#quickResults li[aria-selected="true"] { box-shadow: inset 3px 0 var(--amber); background: var(--key-hi); }
#quickResults small, .audio-event small, .audio-event time { color: var(--ink-2); }
.quick-keys, #audioEventStatus { margin: 8px 0 0; }
.audio-event { display: grid; gap: 2px; width: 100%; border: 0; text-align: left; }
.audio-event:hover { background: var(--key-hi); }
.audio-event time { font-size: var(--s-1); }
#audioEventFilter { width: auto; max-width: 100%; }
#audioEventConfirm { margin-top: 8px; align-items: center; }
.mic-tune-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; padding: 0; }
.mic-tune-steps li { padding: 4px 9px; border-radius: 6px; background: var(--key); color: var(--ink-2); }
.mic-tune-steps li[aria-current] { color: var(--ink); box-shadow: inset 0 -2px var(--amber); }
#micTuneReadings { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; margin: 12px 0; }
#micTuneReadings dd { margin: 0; color: var(--ink-2); }
#micTuneOptions .check { margin-bottom: 6px; }
.health-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.health-list li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 8px; background: var(--key); }
.health-list .mark { width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--on-ink); background: var(--led-g); }
.health-list li[data-state="warn"] .mark { background: var(--led-y); }
.health-list li[data-state="bad"] .mark { background: var(--red); color: #fff; }
.health-list b { display: block; }
.health-list span.detail { color: var(--ink-2); }
.health-list .busy { grid-template-columns: 1fr; color: var(--ink-2); background: none; padding-left: 0; }

/* ---------- performance ---------- */
.perf-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 0 0 12px; }
.perf-summary div { padding: 8px 10px; border-radius: 8px; background: var(--key); }
.perf-summary dt { font-size: 11px; color: var(--ink-2); }
.perf-summary dd { margin: 2px 0 0; font-size: 16px; font-variant-numeric: tabular-nums; }
.perf-loop { margin: 0 0 12px; }
.perf-loop h3 { margin: 0 0 4px; font-size: 13px; }
.perf-loop h3 span { font-weight: 400; color: var(--ink-2); }
.perf-loop table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.perf-loop th, .perf-loop td { padding: 3px 6px; text-align: right; }
.perf-loop th:first-child, .perf-loop td:first-child { text-align: left; }
.perf-loop th { font-weight: 500; color: var(--ink-2); }
.perf-loop tr.total td { border-top: 1px solid var(--line, rgba(127, 127, 127, .3)); font-weight: 600; }
.perf-loop td.slow { color: var(--red); }

/* ---------- mic level check ---------- */
.mic-meter { position: relative; height: 22px; margin: 6px 0 2px; border-radius: 6px; background: var(--well); box-shadow: inset 0 2px 5px rgba(0, 0, 0, .6); overflow: hidden; }
#crackleList .btn, #coachTips .btn { display: flex; width: fit-content; }
.mic-fill.coach-fill { background: var(--led-g); transition: transform .3s ease-out; }
.mic-fill { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0); background: linear-gradient(to right, var(--led-g) 0, var(--led-g) 70%, var(--led-y) 70%, var(--led-y) 90%, var(--led-r) 90%); will-change: transform; }
.mic-zone { position: absolute; top: 0; bottom: 0; left: 75%; width: 15%; border-left: 2px solid var(--amber); border-right: 2px solid var(--amber); opacity: .8; }
.mic-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.mic-result { min-height: 44px; margin: 0 0 12px; color: var(--ink); }
.mic-result b { font-weight: 700; }
.strip.clipped .readout, .mini-row.clipped .db { color: var(--red); }
.strip.clipped .well { box-shadow: inset 0 2px 6px rgba(0, 0, 0, .85), 0 0 0 1px var(--red); }
.offline-card .linkish { display: block; margin: 14px auto 0; }
.fold-body > .btn, .fold-body > .btn-row { align-self: flex-start; }

/* ---------- soundboard, Twitch, Sleekmeeter Remote, level history ---------- */
.dlg.sounds-dlg, .dlg.history-dlg { width: min(640px, calc(100vw - 32px)); }
.sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.sound-tile { position: relative; --sc: var(--amber); }
.sound-tile[data-n="1"] { --sc: var(--cyan); } .sound-tile[data-n="2"] { --sc: var(--rose, var(--red)); }
.sound-tile[data-n="3"] { --sc: var(--violet, var(--amber)); } .sound-tile[data-n="4"] { --sc: var(--green, var(--cyan)); }
.sound-tile[data-n="5"] { --sc: var(--coral, var(--amber)); }
.sound-play { width: 100%; min-height: 56px; padding: 8px 10px; border-radius: var(--r, 8px); background: var(--key); color: var(--ink);
  border: 1px solid var(--line, rgba(255,255,255,.12)); box-shadow: inset 0 -3px 0 var(--sc); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.sound-play:hover { filter: brightness(1.12); }
.sound-tile.hit .sound-play { background: var(--sc); color: var(--on-ink, #111); }
.sound-name { width: 100%; min-height: 56px; }
.sound-del { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--red); color: #fff; border: 0; padding: 0; }
.remote-url { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.remote-url a { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 6px; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); font: var(--s-1) monospace; }
.twitch-head, .twitch-rule { grid-template-columns: .8fr 1.2fr 1fr 32px; }
/* Mic plugins: on, name (and why it didn't load), editor, move up/down, remove. */
.vst-rule { grid-template-columns: 22px minmax(0, 1fr) auto 32px 32px 32px; }
.vst-rule input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--amber); }
.vst-name { display: flex; flex-direction: column; min-width: 0; }
.vst-name b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vst-name small { color: var(--muted); font-size: var(--s-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vst-name small.err { color: var(--red); white-space: normal; }
.vst-rule .btn { height: 30px; }
.vst-rule .btn:not(.icon) { padding: 0 12px; }
.vst-pick { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; width: 100%; }
.vst-pick select { min-width: 0; }
.vst-rule.with-presets { grid-template-columns: 22px minmax(0, 1fr) minmax(0, 110px) auto 32px 32px 32px; }
.vst-rule select { min-width: 0; height: 30px; }
/* One tab per mic, and a button to add another. */
.mic-tabs { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.mic-tabs .btn { height: 30px; padding: 0 12px; }
.mic-tabs .btn[aria-selected="true"] { border-color: var(--amber); color: var(--ink); box-shadow: inset 0 -2px 0 var(--amber); }
.mic-tabs .btn .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--muted); vertical-align: middle; }
.mic-tabs .btn .dot.on { background: var(--led-g); }
.mic-off { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--ink); font-size: var(--s-1); }
.mic-off[hidden] { display: none; }
#micFxListen[aria-pressed="true"] { border-color: var(--led-g); color: var(--led-g); }
#micFxCompare:active, #micFxCompare.held { border-color: var(--amber); color: var(--amber); }
.hist-bar { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.hist-seg { display: flex; gap: 5px; }
.hist-seg .tog { height: 30px; padding: 0 12px; font-size: var(--s0); }
#histCanvas { width: 100%; height: 240px; display: block; border-radius: 8px; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); }
.hist-keys { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.hist-key { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: var(--s-1);
  background: var(--key); color: var(--ink); border: 1px solid var(--line, rgba(255,255,255,.12)); }
.hist-key::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--k); }
.hist-key[aria-pressed="false"] { opacity: .45; }
.hist-key[aria-pressed="false"]::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--k); }
.hist-table { display: flex; flex-direction: column; margin: 4px 0 10px; }
.hist-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 8px; padding: 5px 4px; border-top: 1px solid var(--rail); font-variant-numeric: tabular-nums; }
.hist-row.head { color: var(--ink-2); font-size: var(--s-1); border-top: 0; }
.hist-sub { margin: 16px 0 6px; font-size: var(--s0, 14px); }
.hist-row[data-clip="1"] span:nth-child(2), .hist-row[data-clip="1"] span:nth-child(3) { color: var(--red); font-weight: 600; }
@media (max-width: 700px) { .app-row { grid-template-columns: minmax(90px, 1fr) 1fr 44px 62px; } .app-row .app-route { grid-column: 1 / -1; } }
.sounds-dlg .field { margin-top: 10px; }
.sounds-dlg .btn-row { margin: 6px 0; }
.sounds-dlg .hint { margin-top: 12px; }

/* Mic chain dialog */
.chain-presets { margin: 4px 0 8px; flex-wrap: wrap; }
.chain-knobs { display: grid; gap: 6px; margin-bottom: 8px; }
.chain-row { display: grid; grid-template-columns: 130px 1fr 64px; align-items: center; gap: 10px; }
.chain-row output { text-align: right; color: var(--ink-dim, var(--muted)); font-variant-numeric: tabular-nums; }
.chain-row input[type=range] { width: 100%; }

/* Stream loudness */
.loud-big { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 2px; }
.loud-big output { font-size: 44px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.loud-big span { color: var(--muted); font-weight: 600; }
.loud-big[data-state="ok"] output { color: var(--led-g); }
.loud-big[data-state="warn"] output { color: var(--amber); }
.loud-big[data-state="bad"] output { color: var(--red); }
.loud-verdict { margin: 4px 0 12px; color: var(--ink-2); min-height: 1.4em; max-width: 60ch; }
.loud-scale { position: relative; height: 14px; border-radius: 7px; background: var(--well); box-shadow: inset 0 2px 5px rgba(0, 0, 0, .5); overflow: hidden; }
.loud-bar { position: absolute; inset: 0; clip-path: inset(0 100% 0 0); background: linear-gradient(to right, var(--led-g) 0 72%, var(--led-y) 72% 88%, var(--led-r) 88%); transition: clip-path .12s linear; }
.loud-target { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--ink); }
.loud-ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin: 3px 0 12px; font-variant-numeric: tabular-nums; }
.loud-rows { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0 0 16px; align-items: center; }
.loud-rows dt { color: var(--ink-2); }
.loud-rows dt small { color: var(--muted); }
.loud-rows dd { margin: 0; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.loud-rows .btn.small { padding: 2px 8px; font-size: var(--s-1); }
@media (prefers-reduced-motion: reduce) { .loud-bar { transition: none; } }

/* Setup guide */
.dlg.setup-dlg { width: min(520px, calc(100vw - 32px)); }
.setup-steps { list-style: none; display: flex; gap: 4px; margin: 2px 0 16px; padding: 0; counter-reset: step; }
.setup-steps li { flex: 1; min-width: 0; counter-increment: step; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 7px; border-top: 3px solid var(--line); }
.setup-steps li.done { border-top-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.setup-steps li.now { border-top-color: var(--amber); color: var(--ink); }
.setup-page { min-height: 150px; }
.setup-lead { margin: 0 0 12px; max-width: 60ch; }
.setup-meter-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; color: var(--ink-2); margin: 8px 0 6px; }
.setup-meter-row .mic-meter { margin: 0; }
.setup-todo { margin: 0 0 14px; padding-left: 18px; display: grid; gap: 6px; }
.setup-nav { margin-top: 16px; align-items: center; justify-content: flex-end; }
.setup-nav .setup-skip { margin-right: auto; background: none; box-shadow: none; color: var(--muted); padding-inline: 4px; }
.setup-nav .setup-skip:hover { color: var(--ink); background: none; }
.setup-choices { display: grid; gap: 8px; margin: 6px 0 10px; }
.setup-choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm, 8px); background: var(--field); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.setup-choice small { display: block; color: var(--muted); margin-top: 2px; }
.setup-plan { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.setup-plan b { color: var(--ink); font-weight: 600; }
.setup-plan .warn { color: var(--warn, #e0a030); }

/* Soundboard groups, hotkeys, packs */
.sound-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.sound-tab { border: 0; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 12px; background: var(--key); color: var(--key-ink); cursor: pointer; }
.sound-tab[aria-selected="true"] { background: var(--accent, #5aa9ff); color: var(--accent-ink, #04121f); }
.sound-key { display: block; font-size: 10px; opacity: .7; margin-top: 2px; }
.sound-extra { display: flex; gap: 4px; margin-top: 4px; }
.sound-extra .sound-tabname { flex: 1; min-width: 0; font: inherit; font-size: 11px; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line, transparent); background: var(--field); color: var(--ink); }
.sound-extra .keys { font-size: 11px; padding: 3px 8px; }

/* Voicemeeter options */
.opt-body { display: grid; gap: 8px; margin: 8px 0 4px; }
.opt-body h3 { margin: 10px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.opt-body input[type=number] { width: 110px; }
.rec-format input[type=text] { width: 90px; }

/* ---------- apps tray: drag an app onto a channel ---------- */
.app-tray { display: flex; align-items: center; gap: 10px; flex: none; margin: 0 14px 12px; padding: 8px 10px; border-radius: 12px; background: var(--key); box-shadow: inset 0 1px 0 var(--key-edge); min-height: 30px; }
.app-tray[hidden] { display: none; }
.tray-title { font-size: var(--s-1); font-weight: 600; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.tray-apps { flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; scrollbar-width: thin; }
.tray-empty { flex: 1; font-size: var(--s0); color: var(--muted); }
.app-chip { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px 0 4px; border: 0; border-radius: 999px; background: var(--mod-a); color: var(--ink); box-shadow: 0 0 0 1px var(--line); font: inherit; font-size: var(--s0); font-weight: 600; cursor: grab; touch-action: none; }
.app-chip:hover { box-shadow: 0 0 0 1px var(--muted); }
.app-chip.idle { opacity: .6; }
.app-chip.fixed { cursor: default; }
.app-chip .av { position: relative; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: hsl(var(--hue, 210) 55% 48%); color: #fff; font-size: 12px; font-weight: 700; line-height: 1; }
.app-chip .av i { position: absolute; right: -1px; bottom: -1px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-green, #4c8); box-shadow: 0 0 0 2px var(--mod-a); display: none; }
.app-chip.on .av i { display: block; }
.app-chip .to { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); }
.menu.tray-chip-menu { position: fixed; inset: auto; margin: 0; border: 0; color: var(--ink); }
.app-ghost { position: fixed; left: 0; top: 0; z-index: 10000; pointer-events: none; opacity: .95; box-shadow: var(--pop-shadow); }
body.app-dragging, body.app-dragging * { cursor: grabbing !important; }
.strip.drop-ok { outline: 2px dashed var(--cyan); outline-offset: -3px; }
.strip.drop-no { outline: 2px dashed var(--red); outline-offset: -3px; }
.app-tray.drop-home { outline: 2px dashed var(--cyan); outline-offset: -3px; }
/* Hovering a channel opens its app list beside it, so the button that pins the list open stays out
   of sight until then: it appears on hover or keyboard focus, inside the corner, never on its edge. */
.strip { position: relative; }
.app-stack {
  position: absolute; top: 4px; right: 12px; z-index: 2; display: inline-flex; align-items: center;
  width: 18px; height: 18px; justify-content: center; padding: 0; border: 0; border-radius: 5px; cursor: pointer;
  background: transparent; color: var(--muted);
  opacity: 0; transition: opacity .12s, color .12s, background-color .12s;
}
.strip:is(:hover, :focus-within, .app-list-open) .app-stack { opacity: 1; }
.strip.app-list-open .app-stack { color: var(--acc); background: color-mix(in srgb, var(--acc) 16%, transparent); }
.app-stack:empty { display: none; }
.app-stack::before { content: ""; position: absolute; inset: -4px; }
.app-stack:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 10%, transparent); }
.app-stack svg { width: 12px; height: 12px; }
body.no-streamer .streamer { display: none !important; }
/* In the list, each app takes the channel's colour. */
.app-chips .sa-chip .av { background: color-mix(in srgb, var(--acc) 70%, #000); }
.app-chips {
  position: fixed; inset: auto; margin: 0; border: 0; color: var(--ink);
  flex-direction: column; align-items: stretch; gap: 4px; padding: 6px; max-height: min(180px, calc(100vh - 16px)); overflow-y: auto;
  background: var(--flyout); border-radius: 9px; box-shadow: 0 0 0 1px var(--line), var(--pop-shadow);
}
.app-chips:popover-open { display: flex; }
.app-chips .sa-chip { height: 22px; }
.app-chips .sa-chip { cursor: default; padding-right: 2px; }
.app-chips .sa-chip:hover { background: color-mix(in srgb, var(--acc) 18%, var(--key)); }
.app-chips .sa-chip .t { flex: 1; }
.sa-remove { flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); font: 17px/1 var(--font); cursor: pointer; }
.sa-remove:hover, .sa-remove:focus-visible { background: var(--red); color: #fff; }
body.reorder-active .app-chips { display: none !important; }
.sa-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; height: 20px; padding: 0 7px 0 3px; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--acc) 18%, var(--key)); color: var(--ink); font: inherit; font-size: 11px; font-weight: 600; line-height: 1; cursor: pointer; }
.sa-chip:hover { background: color-mix(in srgb, var(--red) 28%, var(--key)); }
.sa-chip .av { width: 14px; height: 14px; border-radius: 50%; display: grid; place-items: center; background: hsl(var(--hue, 210) 55% 48%); color: #fff; font-size: 9px; font-weight: 700; flex: none; }
.sa-chip .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sa-chip.idle { opacity: .55; }

/* ---------- channel order and the device line ---------- */
.strip .head { cursor: grab; }
body.arrangement-locked .strip .head { cursor: default; }
.strip.sub-off .sub { display: none; }
.strip.reordering { z-index: 2; opacity: .92; outline: 2px solid var(--amber); outline-offset: -2px; }
body.reorder-active, body.reorder-active * { cursor: grabbing !important; }

/* channel names centred in the strip header */
.strip .head { justify-content: center; }
.strip .titles { flex: 0 1 auto; width: auto; align-items: center; text-align: center; }
.strip .name, .strip .sub { text-align: center; max-width: 100%; }

/* ---------- 0.22 beta 4: spectrum analyzer, VBAN, setup templates, Discord, webhooks ---------- */
.dlg.spectrum-dlg { width: min(980px, calc(100vw - 32px)); }
.dlg.vban-dlg { width: min(860px, calc(100vw - 32px)); }
.dlg.templates-dlg { width: min(680px, calc(100vw - 32px)); }
.spectrum-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 10px; }
.spectrum-bar .field { flex: 1 1 320px; margin: 0; }
.spectrum-bar .check { margin: 0; }
.spectrum-wrap { position: relative; background: var(--well); border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
#spectrumCanvas { display: block; width: 100%; height: clamp(200px, 42vh, 380px); cursor: crosshair; }
.spectrum-readout { position: absolute; top: 10px; right: 14px; font-size: var(--s-1); color: var(--ink-2); font-variant-numeric: tabular-nums; pointer-events: none; }
.vban-table { display: flex; flex-direction: column; gap: 4px; width: 100%; overflow-x: auto; }
.vban-row { display: grid; grid-template-columns: 34px 1fr 1fr 82px 1.3fr 96px; gap: 6px; align-items: center; min-width: 620px; }
.vban-row input[type="text"], .vban-row input[type="number"], .vban-row select { min-width: 0; width: 100%; }
.vban-row input[type="checkbox"] { justify-self: center; }
.vban-head { font-size: var(--s-1); color: var(--muted); }
.rule.vban-remote { grid-template-columns: 1.2fr 1fr 80px 1fr 32px; }
.rule.vban-command { grid-template-columns: 1fr .8fr 1.4fr auto 32px; }
.rule.hook-rule { grid-template-columns: 2fr 1fr 1.2fr 32px; }
.rule input { min-width: 0; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 12px 0; }
.template-card { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--key); color: var(--ink); cursor: pointer; font: inherit; }
.template-card span { color: var(--ink-2); font-size: var(--s-1); line-height: 1.35; }
.template-card small { color: var(--muted); }
.template-card:hover:not(:disabled), .template-card:focus-visible { border-color: var(--amber); background: var(--key-hi); }
.template-card:disabled { opacity: .5; cursor: default; }
.template-changes { margin: 6px 0 10px; padding-left: 20px; color: var(--ink-2); max-height: 220px; overflow: auto; }
.template-changes li { margin: 2px 0; }
#templateRoles .field { grid-template-columns: minmax(180px, 38%) 1fr; }
.discord-live { padding: 8px 10px; border-radius: 8px; background: var(--well); border: 1px solid var(--line); color: var(--ink-2); font-size: var(--s-1); }
.discord-badge { --dot: #8b8ff8; }
/* Clear all solos: in the header only while an input is soloed, in the Solo colour. */
#clearSolosBtn::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--solo); box-shadow: 0 0 0 1px var(--line); vertical-align: 0; }
.history-dlg .hist-on { margin: 0 0 12px; }

/* Settings → Tools: a button and what it does, one per row. The rows share the list's two
   columns (the button column a fixed width), so every description on the page starts at the
   same place and the buttons are one width. A longer translation wraps inside its button. */
.tool-list { display: grid; grid-template-columns: 14em 1fr; gap: 6px 14px; align-items: center; }
.tool-row { display: contents; }
.tool-row[hidden] { display: none; }
.tool-row .btn { justify-self: stretch; text-align: left; white-space: normal; }
.tool-row .hint { margin: 0; }
.sound-check select { flex: 1 1 160px; min-width: 0; }
