/* airtime desktop: the S1's studio palette and type, on a computer screen.
   The font metrics are overridden: Brown's own (ascent 1110, descent 250) put
   the line box's centre well above the capitals' and text sat low in buttons. */
@font-face { font-family: "Brown"; src: url("assets/fonts/brown_regular.otf") format("opentype"); ascent-override: 95%; descent-override: 25%; line-gap-override: 0%; font-weight: 400; }
@font-face { font-family: "Brown"; src: url("assets/fonts/brown_bold.otf") format("opentype"); ascent-override: 95%; descent-override: 25%; line-gap-override: 0%; font-weight: 700; }
@font-face { font-family: "Brown"; src: url("assets/fonts/brown_light.otf") format("opentype"); ascent-override: 95%; descent-override: 25%; line-gap-override: 0%; font-weight: 300; }

:root {
  --bg: #0B0B0D;
  --surface: #16161A;
  --surface-high: #232329;
  --surface-higher: #2C2C33;
  --line: rgba(255, 255, 255, 0.08);
  --text: #FFFFFF;
  --dim: #8A9098;
  --accent: #12B5CB;
  --ok: #30D158;
  --warn: #FF9F0A;
  --record: #FF3B30;
  --font: "Brown", "Segoe UI", system-ui, sans-serif;
  --radius: 18px;
  /* Tag colours: one ring of eight hues, shared with pod.cam, the web app and the S1. */
  --tag-blue: oklch(72% 0.14 258);
  --tag-green: oklch(76% 0.15 152);
  --tag-amber: oklch(80% 0.15 68);
  --tag-magenta: oklch(72% 0.17 330);
  --tag-cyan: oklch(78% 0.12 205);
  --tag-red: oklch(68% 0.19 22);
  --tag-lime: oklch(84% 0.16 118);
  --tag-violet: oklch(70% 0.15 290);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px;
  display: grid; grid-template-columns: 232px 1fr; overflow: hidden;
  -webkit-font-smoothing: antialiased; user-select: none;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg.i { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* ---- Rail ---------------------------------------------------------------- */
.rail { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 12px 12px; gap: 18px; min-height: 0; }
.wordmark { width: 120px; margin: 0 0 0 14px; }
.rail-scroll { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -6px; padding: 0 6px; display: grid; align-content: start; grid-auto-rows: max-content; gap: 18px; }
.rail-section { display: grid; gap: 2px; align-content: start; grid-auto-rows: max-content; }
.rail-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); padding: 0 12px 6px; display: flex; justify-content: space-between; align-items: center; }
.rail-label button { border: 0; background: none; color: var(--dim); cursor: pointer; padding: 2px; border-radius: 6px; display: grid; }
.rail-label button:hover { color: var(--text); background: var(--surface-high); }
.rail-label button svg { width: 16px; height: 16px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 0; background: none; cursor: pointer; color: var(--dim); font-size: 15px; text-align: left; width: 100%; min-width: 0; position: relative; }
.nav .i { width: 18px; height: 18px; }
.nav .label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav .count { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.nav:hover { background: var(--surface-high); color: var(--text); }
.nav[aria-current="page"] { background: var(--surface-high); color: var(--text); }
.nav.drop-target { background: rgba(18, 181, 203, 0.18); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--accent); }
.nav .twisty { width: 16px; height: 16px; border: 0; background: none; padding: 0; color: var(--dim); display: grid; place-items: center; cursor: pointer; margin-left: -4px; }
.nav .twisty svg { width: 12px; height: 12px; }
.nav .twisty.leaf { visibility: hidden; }
.tag-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin: 0 4px; }
.badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #002A30; font-size: 12px; font-weight: 700; text-align: center; }
.rail-foot { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.account-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; border: 0; background: none; cursor: pointer; text-align: left; color: var(--text); }
.account-chip:hover { background: var(--surface-high); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-higher); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; color: var(--text); }
.avatar.signed-in { background: var(--accent); color: #00262B; }
.avatar .i { width: 18px; height: 18px; color: var(--dim); }
.account-chip .who { min-width: 0; display: grid; }
.account-chip .who b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-chip .who span { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-btn { width: 38px; height: 38px; border-radius: 10px; border: 0; background: none; color: var(--dim); cursor: pointer; display: grid; place-items: center; flex: none; }
.foot-btn:hover, .foot-btn[aria-current="page"] { background: var(--surface-high); color: var(--text); }
.foot-btn .i { width: 20px; height: 20px; }

/* ---- Main ------------------------------------------------------------------ */
main { overflow-y: auto; padding: 22px 40px 140px; position: relative; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 4px; color: var(--dim); font-size: 13px; margin-bottom: 4px; flex-wrap: wrap; }
.crumbs button { border: 0; background: none; color: var(--dim); cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.crumbs button:hover { color: var(--text); background: var(--surface-high); }
.crumbs svg { width: 12px; height: 12px; }
h1 { font-size: 32px; font-weight: 700; margin: 0; letter-spacing: -0.01em; display: flex; align-items: center; gap: 12px; }
h1 .i { width: 28px; height: 28px; }
h2 { font-size: 22px; font-weight: 700; margin: 0; }
h3 { font-size: 17px; font-weight: 700; margin: 0; }
.sub { color: var(--dim); margin: 6px 0 0; font-size: 15px; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn { border: 0; background: var(--surface-high); padding: 11px 18px; border-radius: 999px; cursor: pointer; font-size: 15px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.btn .i { width: 18px; height: 18px; }
.btn:hover { filter: brightness(1.2); }
.btn.primary { background: var(--accent); color: #00262B; font-weight: 700; }
.btn.danger { background: transparent; color: var(--dim); }
.btn.danger:hover { color: var(--record); }
.btn.destroy { background: var(--record); color: #fff; font-weight: 700; }
.btn.quiet { background: transparent; color: var(--dim); }
.btn.quiet:hover { color: var(--text); background: var(--surface-high); filter: none; }
.btn.small { padding: 7px 13px; font-size: 14px; }
.btn:disabled { opacity: 0.45; cursor: default; filter: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-high); cursor: pointer; display: grid; place-items: center; flex: none; color: var(--text); }
.icon-btn .i { width: 20px; height: 20px; }
.icon-btn:hover { filter: brightness(1.2); }
.icon-btn.ghost { background: transparent; color: var(--dim); }
.icon-btn.ghost:hover { background: var(--surface-high); color: var(--text); }
.icon-btn.ghost.danger:hover { color: var(--record); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 15px; outline: none; }
input:focus, select:focus { border-color: rgba(18, 181, 203, 0.6); }
/* Our own arrow, with room around it: the native one sits against the edge. */
select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='none' stroke='%23FFFFFF' stroke-width='24' stroke-linecap='round' stroke-linejoin='round' d='M208 96l-80 80-80-80'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 12px; }
select option { background: var(--surface); color: var(--text); }
.search { position: relative; }
.search .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--dim); pointer-events: none; }
.search input { padding-left: 38px; width: 240px; border-radius: 999px; background: var(--surface-high); border-color: transparent; }
.select { border-radius: 999px; background-color: var(--surface-high); border-color: transparent; padding: 10px 42px 10px 18px; cursor: pointer; }

/* ---- Filter chips ------------------------------------------------------------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; min-height: 36px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; color: var(--text); }
.chip .i { width: 16px; height: 16px; color: var(--c); }
.chip .n { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.chip:hover { border-color: color-mix(in oklch, var(--c) 60%, transparent); }
.chip.on { background: color-mix(in oklch, var(--c) 22%, transparent); border-color: var(--c); }
.chip.suggested { border-style: dashed; color: var(--dim); background: transparent; }
.chip.suggested:hover { color: var(--text); border-color: var(--c); }
.chip .x { width: 14px; height: 14px; margin-left: 2px; color: var(--dim); }
.chip .x:hover { color: var(--text); }
.match { font-size: 13px; color: var(--dim); border: 0; background: none; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.match:hover { color: var(--text); background: var(--surface-high); }

/* ---- Grid ------------------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.folder-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; display: flex; align-items: center; gap: 14px; cursor: pointer; }
.folder-tile .i { width: 30px; height: 30px; color: var(--accent); }
.folder-tile b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-tile span { color: var(--dim); font-size: 13px; }
.folder-tile:hover { border-color: rgba(18, 181, 203, 0.5); }
.folder-tile.drop-target { box-shadow: inset 0 0 0 2px var(--accent); }
.folder-tile > div { min-width: 0; }
.card { background: var(--surface); border-radius: var(--radius); overflow: hidden; cursor: pointer; border: 1px solid var(--line); transition: transform 0.15s ease, border-color 0.15s ease; position: relative; }
.card:hover { transform: translateY(-2px); border-color: rgba(18, 181, 203, 0.5); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.poster { aspect-ratio: 16 / 9; background: var(--surface-high) center / cover no-repeat; position: relative; }
.poster.blank { display: grid; place-items: center; }
.poster.blank > .i { width: 40px; height: 40px; color: rgba(255, 255, 255, 0.28); }
.poster .dur { position: absolute; right: 10px; bottom: 10px; background: rgba(0, 0, 0, 0.72); padding: 3px 8px; border-radius: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.poster .new { position: absolute; left: 46px; top: 12px; background: var(--accent); color: #00262B; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.card-meta-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; min-width: 0; }
.card-meta-row .card-meta { flex: 1; min-width: 0; margin-top: 0; }
.card-meta-row .badges { display: flex; gap: 7px; flex: none; }
.card-meta-row .tag-badge { width: 14px; height: 14px; background: none; box-shadow: none; }
.card-meta-row .tag-badge .i { width: 14px; height: 14px; }
.card-meta-row .tag-badge.more { width: auto; font-size: 11px; }
.tag-badge { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-high); display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px var(--c); }
.tag-badge .i { width: 15px; height: 15px; color: var(--c); }
.tag-badge.more { box-shadow: none; font-size: 11px; color: var(--dim); }
.select-box { position: absolute; left: 10px; top: 10px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.85); background: rgba(0, 0, 0, 0.35); display: grid; place-items: center; opacity: 0; transition: opacity 0.12s; cursor: pointer; padding: 0; }
.select-box .i { width: 15px; height: 15px; color: #00262B; opacity: 0; }
.card:hover .select-box, .grid.selecting .select-box { opacity: 1; }
.card.selected .select-box { opacity: 1; background: var(--accent); border-color: var(--accent); }
.card.selected .select-box .i { opacity: 1; }
.card-more { position: absolute; right: 10px; top: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.62); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity 0.15s; color: #fff; }
.card-more .i { width: 18px; height: 18px; }
.card:hover .card-more, .card:focus-within .card-more, .card-more[aria-expanded="true"] { opacity: 1; }
.card-more:hover { background: rgba(0, 0, 0, 0.85); }
.card-body { padding: 12px 14px 14px; display: flex; gap: 8px; align-items: flex-start; }
.card-body > div { flex: 1; min-width: 0; }
.card-title { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { color: var(--dim); font-size: 13px; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.cloud .poster { filter: saturate(0.6); }
.cloud-badge { position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 6px; background: rgba(0, 0, 0, 0.72); padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 12px; }
.cloud-badge .i { width: 15px; height: 15px; color: var(--accent); }
.card.cloud .select-box { display: none; }
.card-body { position: relative; }
.card-title { padding-right: 28px; }
/* Floats top right on hover, so it takes no room from the tags below it. */
.drag-out { position: absolute; top: 9px; right: 9px; border: 0; background: none; color: var(--dim); cursor: grab; padding: 4px; border-radius: 8px; display: grid; opacity: 0; }
.drag-out .i { width: 17px; height: 17px; }
.card:hover .drag-out { opacity: 1; }
.drag-out:hover { color: var(--text); background: var(--surface-high); }

/* ---- Selection bar ---------------------------------------------------------- */
.selection-bar { position: fixed; left: calc(50% + 116px); bottom: 26px; transform: translateX(-50%); background: var(--surface-higher); border: 1px solid var(--line); border-radius: 999px; padding: 6px 6px 6px 20px; display: flex; align-items: center; gap: 4px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55); z-index: 6; }
.selection-bar b { margin-right: 10px; font-variant-numeric: tabular-nums; }
.selection-bar .btn { padding: 9px 14px; background: transparent; }
.selection-bar .btn:hover { background: rgba(255, 255, 255, 0.08); filter: none; }
.selection-bar .btn.danger:hover { color: var(--record); }

/* ---- Studios --------------------------------------------------------------- */
.studios { display: grid; gap: 14px; max-width: 900px; }
.studio { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; grid-template-columns: 52px 1fr auto; gap: 18px; align-items: center; }
.studio-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--surface-high); display: grid; place-items: center; }
.studio-icon img { width: 26px; }
.studio-name { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.studio-name .icon-btn { width: 30px; height: 30px; }
.studio-name .icon-btn .i { width: 15px; height: 15px; }
.studio-meta { color: var(--dim); font-size: 14px; margin-top: 3px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pill { font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid currentColor; }
.pill.online { color: var(--ok); }
.pill.offline { color: var(--dim); }
.pill.available { color: var(--accent); }
.studio-actions { display: flex; gap: 10px; align-items: center; }
.toggle { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 14px; cursor: pointer; }
.toggle input { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--surface-high); position: relative; cursor: pointer; transition: background 0.15s; padding: 0; border: 0; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--dim); transition: transform 0.15s, background 0.15s; }
.toggle input:checked { background: rgba(18, 181, 203, 0.35); }
.toggle input:checked::after { transform: translateX(18px); background: var(--accent); }
.add { margin-top: 30px; max-width: 900px; }
.add label { color: var(--dim); font-size: 14px; display: block; margin-bottom: 8px; }
.add-row { display: flex; gap: 10px; }
#add-address { width: 260px; }

/* ---- Settings ---------------------------------------------------------------- */
.settings { display: grid; gap: 28px; max-width: 900px; }
.settings section { display: grid; gap: 10px; }
.settings .section-title { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); padding-left: 4px; }
.setting { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.setting .i.lead { width: 26px; height: 26px; color: var(--dim); }
.setting .what b { display: block; font-size: 16px; }
.setting .what span { color: var(--dim); font-size: 14px; display: block; margin-top: 3px; line-height: 1.45; word-break: break-word; }
.setting .act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.light { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; vertical-align: 1px; }
.light.ok { background: var(--ok); box-shadow: 0 0 10px rgba(48, 209, 88, 0.6); }
.light.warn { background: var(--warn); box-shadow: 0 0 10px rgba(255, 159, 10, 0.55); }
.light.off { background: var(--dim); }

/* ---- Media Player ------------------------------------------------------------ */
.boards-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.board-tab { border: 1px solid var(--line); background: var(--surface); padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 14px; }
.board-tab[aria-current="true"] { background: var(--surface-high); border-color: var(--accent); }
.pads { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; max-width: 1100px; }
.pad { width: 100%; aspect-ratio: 16 / 11; border-radius: 18px; background: var(--surface) center / cover no-repeat; border: 1px solid var(--line); position: relative; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; text-align: left; padding: 0; color: var(--text); }
.pad::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.1) 60%); }
.pad.vacant { border: 1.5px dashed rgba(255, 255, 255, 0.16); background: transparent; justify-content: center; align-items: center; color: var(--dim); gap: 6px; font-size: 14px; }
.pad.vacant::before { display: none; }
.pad.vacant:hover { border-color: var(--accent); color: var(--text); }
.pad .strip { position: absolute; left: 0; top: 0; right: 0; height: 5px; background: var(--c); }
.pad .pad-body { position: relative; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.pad .pad-icon { width: 34px; height: 34px; border-radius: 10px; background: color-mix(in oklch, var(--c) 30%, rgba(0,0,0,0.5)); display: grid; place-items: center; flex: none; }
.pad .pad-icon .i { width: 19px; height: 19px; color: var(--c); }
.pad .pad-label { font-weight: 700; font-size: 15px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.pad .slot { position: absolute; right: 12px; top: 14px; font-size: 12px; color: rgba(255, 255, 255, 0.7); background: rgba(0, 0, 0, 0.5); padding: 2px 7px; border-radius: 6px; }
.pad .mode { position: absolute; left: 12px; top: 14px; display: flex; gap: 4px; }
.pad .mode .i { width: 16px; height: 16px; color: rgba(255, 255, 255, 0.85); }
.pad:not(.vacant):hover { border-color: var(--c); }
.pad.missing { opacity: 0.55; }
.pad.sound { background: color-mix(in oklch, var(--c) 16%, var(--surface)); }
.pad.sound .wave { position: absolute; inset: 18px 18px 58px; display: grid; place-items: center; }
.pad.sound .wave .i { width: 64px; height: 64px; color: var(--c); opacity: 0.85; }
.pad .plays { font-size: 12px; color: rgba(255, 255, 255, 0.78); white-space: nowrap; }
.pad .pad-text { flex: 1; min-width: 0; display: grid; gap: 2px; }

/* ---- Empty states ------------------------------------------------------------ */
.empty-state { text-align: center; max-width: 460px; margin: 10vh auto 0; display: grid; gap: 12px; justify-items: center; }
.empty-state.compact { margin-top: 24px; text-align: left; justify-items: start; max-width: 900px; }
.empty-state p { color: var(--dim); margin: 0; line-height: 1.5; }
.empty-mark { width: 84px; height: 84px; border-radius: 24px; background: var(--surface); display: grid; place-items: center; margin-bottom: 6px; }
.empty-mark img, .empty-mark .i { width: 40px; height: 40px; opacity: 0.9; }

/* ---- Overlays and sheets ------------------------------------------------------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); display: grid; place-items: center; z-index: 10; padding: 24px; }
.overlay.top { z-index: 12; }
.sheet { background: var(--surface); border-radius: 28px; padding: 26px 28px 28px; width: min(980px, 100%); max-height: 100%; overflow: auto; display: grid; gap: 18px; border: 1px solid var(--line); }
.sheet-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.player-sheet video { width: 100%; border-radius: 14px; background: #000; aspect-ratio: 16 / 9; display: block; }
.player-sheet audio { width: 100%; }
.sheet-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sheet-actions.end { justify-content: flex-end; }
.sheet-actions .left { display: flex; gap: 4px; flex-wrap: wrap; }
.send { display: flex; gap: 10px; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pair-sheet { width: min(560px, 100%); }
.dialog-sheet { width: min(540px, 100%); }
.dialog-sheet.wide { width: min(760px, 100%); }
.dialog-sheet .sub { line-height: 1.5; }
.dialog-sheet input[type="text"], .dialog-sheet input:not([type]), .dialog-sheet input[type="email"], .dialog-sheet input[type="password"] { width: 100%; font-size: 17px; padding: 13px 16px; }
.field { display: grid; gap: 8px; }
.field > label, .field > .label { color: var(--dim); font-size: 13px; letter-spacing: 0.04em; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 2px rgba(0,0,0,0.2); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, 44px); gap: 8px; }
.icon-choice { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-high); display: grid; place-items: center; cursor: pointer; color: var(--dim); }
.icon-choice .i { width: 21px; height: 21px; }
.icon-choice:hover { color: var(--text); }
.icon-choice[aria-checked="true"] { color: var(--c, var(--accent)); border-color: var(--c, var(--accent)); background: color-mix(in oklch, var(--c, var(--accent)) 18%, transparent); }
.segmented { display: inline-flex; background: var(--surface-high); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: none; padding: 8px 14px; border-radius: 999px; cursor: pointer; color: var(--dim); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.segmented button .i { width: 16px; height: 16px; }
.segmented button[aria-checked="true"] { background: var(--surface-higher); color: var(--text); }
input[type="range"] { appearance: none; height: 6px; border-radius: 999px; background: var(--surface-high); padding: 0; border: 0; width: 100%; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); cursor: pointer; }
.list { display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-high); border: 0; cursor: pointer; text-align: left; width: 100%; color: var(--text); }
.list-row:hover { background: var(--surface-higher); }
.list-row[aria-checked="true"] { box-shadow: inset 0 0 0 1.5px var(--accent); }
.list-row .grow { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .n { color: var(--dim); font-size: 13px; }
.list-row .i { width: 18px; height: 18px; }
.list-row .i.c { color: var(--c); }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.picker-grid .card-body { padding: 8px 10px 10px; }
.picker-grid .card-title { font-size: 14px; }
.code { display: flex; gap: 10px; justify-content: center; }
.code input { width: 58px; height: 72px; font-size: 34px; font-weight: 700; text-align: center; border-radius: 14px; color: var(--accent); padding: 0; }
.code .gap { width: 14px; }
.error { color: var(--warn); margin: 0; }

/* ---- Popover menus ------------------------------------------------------------ */
.menu { position: fixed; z-index: 30; min-width: 210px; max-width: 320px; background: var(--surface-high); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5); display: grid; max-height: 70vh; overflow-y: auto; }
.menu button { border: 0; background: none; text-align: left; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 15px; display: flex; gap: 10px; align-items: center; color: var(--text); }
.menu button .i { width: 18px; height: 18px; color: var(--dim); }
.menu button .i.c { color: var(--c); }
.menu button:hover, .menu button:focus-visible { background: rgba(255, 255, 255, 0.07); outline: none; }
.menu button.destroy, .menu button.destroy .i { color: var(--record); }
.menu button .check { margin-left: auto; color: var(--accent); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu input { margin: 2px 2px 6px; padding: 9px 12px; font-size: 14px; }
.menu .hint { color: var(--dim); font-size: 13px; padding: 6px 12px; }

/* ---- Drop overlay, transfers, toasts ------------------------------------------ */
.drop { position: fixed; inset: 12px; border: 2px dashed var(--accent); border-radius: 24px; background: rgba(11, 11, 13, 0.88); display: grid; place-items: center; z-index: 40; pointer-events: none; }
.drop div { text-align: center; display: grid; gap: 8px; }
.drop strong { font-size: 26px; }
.drop span { color: var(--dim); }
.transfers { position: fixed; right: 24px; bottom: 24px; width: 340px; display: grid; gap: 10px; z-index: 5; }
.transfer { background: var(--surface-high); border-radius: 16px; padding: 14px 16px; border: 1px solid var(--line); box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4); }
.transfer-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.transfer-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transfer-pct { color: var(--dim); font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.25s ease; }
.toasts { position: fixed; top: 22px; left: calc(50% + 116px); transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--surface-high); border: 1px solid var(--line); border-radius: 999px; padding: 11px 20px; box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45); font-size: 15px; }
.toast.ok { border-color: rgba(48, 209, 88, 0.5); }
.toast.warn { border-color: rgba(255, 159, 10, 0.6); }

/* Scroll bars: a thin rounded thumb, shown only while the pointer is over
   what scrolls; no track, no arrows. */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; min-height: 40px; }
:hover::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.16); }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.32); }
::-webkit-scrollbar-thumb:active { background-color: var(--accent); }

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


/* ---- The desktop window's title bar: the page draws it -------------------------------------
   The logo sits halfway between the window's top edge and the LIBRARY label,
   and every page's title row (and the editor's top bar) shares the logo's
   centre line. The page starts 5 px inside the window (the resize edge),
   so the centre line is at 44 px in the window, 39 px in the page. */
.desktop { --line-y: 39px; }
.desktop.maximized { --line-y: 44px; }
.desktop .caption { position: fixed; top: 0; right: 0; z-index: 60; display: flex; app-region: no-drag; }
.desktop .caption button { width: 46px; height: 34px; border: 0; background: transparent; color: var(--dim); font: 10px "Segoe Fluent Icons", "Segoe MDL2 Assets"; cursor: default; }
.desktop .caption button:hover { background: var(--surface-high); color: var(--text); }
.desktop .caption button.close:hover { background: #C42B1C; color: #fff; }
.desktop .drag-top { position: fixed; top: 0; left: 0; right: 0; height: 14px; z-index: 55; app-region: drag; }
.desktop .rail { padding-top: 0; gap: 0; }
.desktop .brand-row { height: calc(var(--line-y) * 2); display: flex; align-items: center; padding: 0 0 0 14px; app-region: drag; flex: none; }
.desktop .brand-row .wordmark { width: 140px; margin: 0; }
.desktop .rail-scroll { margin-top: 0; }
.desktop main { padding-top: calc(var(--line-y) - 22px); }
.desktop .head { align-items: flex-start; app-region: drag; margin-right: 110px; }
.desktop .head h1 { min-height: 44px; line-height: 44px; }
.desktop .head .head-actions { min-height: 44px; }
.desktop .head :is(button, input, select, a, label, .segmented) { app-region: no-drag; }
.desktop :is(.ed-top, .ps-top) { min-height: calc(var(--line-y) * 2 - 1px); padding-right: 152px; app-region: drag; }
.desktop :is(.ed-top, .ps-top) :is(button, input) { app-region: no-drag; }

/* ---- Live selling (js/live, shared with the web app) -------------------------------- */
/* Live: a show on air glows red; the new-show sheet. */
.light.live { background: #E5484D; box-shadow: 0 0 10px rgba(229, 72, 77, 0.7); }
.form-stack { display: grid; gap: 14px; }
.form-stack input:not([type="checkbox"]) { width: 100%; }
.picks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; cursor: pointer; }

/* Running a show (the cockpit): the numbers on top; offers, the stream and the chat side by side. */
.live-run { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.run-top { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.run-top h1 { font-size: 20px; margin: 0; flex: 1 1 160px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-top .light { margin: 0; }
.kpis { display: flex; gap: 18px; flex-wrap: wrap; }
.kpi { display: grid; line-height: 1.15; }
.kpi b { font-size: 20px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--dim); }
.live-run { container-type: inline-size; }
.run-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr) minmax(280px, 340px); grid-template-areas: "offers stage chat"; }
.run-offers { grid-area: offers; }
.run-stage { grid-area: stage; }
.run-chat { grid-area: chat; }
.run-grid > section { min-height: 0; overflow-y: auto; padding: 14px 16px; }
.run-grid h2 { font-size: 15px; margin: 0 0 10px; color: var(--dim); font-weight: 500; }
.run-offers { border-right: 1px solid var(--line); }
.run-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.run-head h2 { margin: 0; }
.drop-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.drop-pick .chip { padding: 5px 12px; }
.drop-pick .chip[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in oklch, var(--accent) 22%, transparent); }
.offer-list { display: grid; gap: 10px; margin-top: 12px; }
.offer { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 6px 12px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.offer.on-air { border-color: #E5484D; box-shadow: 0 0 0 1px #E5484D inset; }
.offer .thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: var(--surface-high); grid-row: span 2; }
.offer .info { display: grid; gap: 2px; min-width: 0; font-size: 14px; }
.offer .info b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offer .dim { color: var(--dim); font-size: 13px; }
.offer .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.run-stage { display: flex; flex-direction: column; gap: 12px; }
.run-stage video { width: 100%; aspect-ratio: 16 / 9; max-height: 42vh; background: #000; border-radius: 14px; }
.run-now { display: grid; gap: 8px; font-size: 15px; }
.run-now .drop-time { color: var(--warn); font-variant-numeric: tabular-nums; }
.run-now .pinned { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 8px 10px; border-radius: 12px; background: var(--surface-high); }
.run-chat { display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.chat-list { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 120px; overflow-y: auto; display: grid; align-content: start; gap: 6px; font-size: 14px; }
.chat-list li { position: relative; padding: 4px 64px 4px 0; overflow-wrap: anywhere; }
.chat-list li.host b { color: var(--accent); }
.chat-list .msg-acts { position: absolute; right: 0; top: 0; display: flex; opacity: 0.5; }
.chat-list li:hover .msg-acts, .chat-list .msg-acts:focus-within { opacity: 1; }
.chat-list .msg-acts .icon-btn { width: 30px; height: 30px; }
.run-chat .say { display: flex; gap: 8px; padding-top: 10px; }
.run-chat .say input { flex: 1; min-width: 0; }
.offers-edit { display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.offer-edit { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(70px, 1fr)) minmax(90px, 1.4fr); gap: 6px; align-items: center; }
.offer-edit .name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offer-edit input:not([type="checkbox"]) { width: 100%; min-width: 0; }
/* A laptop beside the sidebar: the stream above the offers, the chat beside both. */
@container (max-width: 1240px) {
  .run-grid { grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "stage chat" "offers chat"; }
  .run-stage { padding-bottom: 4px; }
  .run-offers { border-right: 0; border-top: 1px solid var(--line); }
  .run-offers .offer-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}
@media (max-width: 760px) {
  .run-grid { display: flex; flex-direction: column; }
  .run-offers { border-top: 0; }
  .run-grid > section { overflow: visible; }
  .run-stage { order: -1; }
  .run-offers { border-right: 0; border-bottom: 1px solid var(--line); }
  .run-chat { max-height: none; }
  .chat-list { max-height: 50vh; }
  .run-top { padding: 10px 16px; }
  .kpis { gap: 14px; width: 100%; order: 5; }
  .offer-edit { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .offer-edit .name { grid-column: 1 / -1; }
}

/* The rundown in the cockpit: now (with its clock), next, the list. */
.rundown { display: grid; gap: 8px; margin-bottom: 18px; }
.seg-now { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; background: var(--surface-high); border-left: 4px solid var(--ok); }
.seg-now.soon { border-left-color: var(--warn); }
.seg-now.over { border-left-color: #E5484D; }
.seg-now .clock { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; }
.seg-now.over .clock { color: #E5484D; }
.seg-now.soon .clock { color: var(--warn); }
.seg-now .points { margin: 6px 0 0; padding-left: 18px; font-size: 14px; color: var(--dim); display: grid; gap: 2px; }
.seg-moves { display: flex; gap: 8px; }
.seg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.seg-list .seg { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 10px; }
.seg-list .seg .info { display: grid; min-width: 0; font-size: 14px; }
.seg-list .seg .info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg-list .seg .dim { color: var(--dim); font-size: 12px; }
.seg-list .seg.now { background: color-mix(in oklch, var(--ok) 18%, transparent); }
.seg-list .seg.next { outline: 1px dashed var(--line); }
.seg-list .seg.done { opacity: 0.55; }
.rundown-edit { display: grid; gap: 10px; max-height: 64vh; overflow-y: auto; }
.seg-edit { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 0; }
.seg-edit-line { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.6fr) 70px 90px 90px auto; gap: 6px; }
.seg-edit input, .seg-edit select, .seg-edit textarea { width: 100%; min-width: 0; }
.chat-list li.hot { border-left: 3px solid var(--warn); padding-left: 8px; }
.chat-list li.hot-3 { border-left-color: #E5484D; background: color-mix(in oklch, #E5484D 10%, transparent); border-radius: 6px; }
@media (max-width: 760px) { .seg-edit-line { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* A settings title with its status light (the add-on row). */
.light-title { display: inline-flex; align-items: center; }

/* The Live view's cockpit fills the window, like the editor. */
main.live-running { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
main.live-running #view-live { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* The cockpit's top bar clears the window's own buttons (top right). */
main.live-running .run-top { padding-right: 150px; }
