/* Onair: neutral graphite chrome so the screens' own colours stand out. Tally red is reserved for
   what is live on air (now-line, Live, the zone playing); ink blue is for actions. */
@font-face {
  font-family: 'Plex Sans'; font-style: normal; font-weight: 100 700; font-display: swap;
  src: url(../fonts/plex-sans-latin.woff2) format('woff2-variations'), url(../fonts/plex-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Plex Sans'; font-style: normal; font-weight: 100 700; font-display: swap;
  src: url(../fonts/plex-sans-latin-ext.woff2) format('woff2-variations'), url(../fonts/plex-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
:root {
  --bg: #f2f1ee; --panel: #ffffff; --panel-2: #f7f6f3; --border: #e0ddd6; --border-strong: #c9c5bc; --text: #1c1b19; --muted: #6e6a63;
  --primary: #1f3a5f; --primary-ink: #ffffff; --primary-soft: #e4e9f0; --link: #1f3a5f; --focus: #1f3a5f;
  --tally: #e0362c; --tally-soft: #fbe6e4;
  --ok: #2e7d4f; --ok-soft: #e2efe6; --off: #a8a49b; --off-soft: #ebe9e4; --danger: #a8281f; --warn: #8f5a00; --warn-soft: #f5ebd7;
  --sidebar: #1c1b19; --sidebar-ink: #dcd9d2; --sidebar-muted: #a7a399; --sidebar-active: #2e2c29; --sidebar-line: #33312d;
  --screen: #0d0d0c; --bezel: #1c1b19; --bezel-hover: #3a3833; --radius: 6px; --radius-screen: 2px; --shadow: none;
  --font: 'Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121110; --panel: #1b1a18; --panel-2: #22211e; --border: #33312d; --border-strong: #46433e; --text: #ecebe6; --muted: #a7a399;
    --primary: #3a6597; --primary-soft: #23303e; --link: #a7c3e6; --focus: #a7c3e6;
    --tally: #ef4a3f; --tally-soft: #3a1d1a;
    --ok: #6cbf8b; --ok-soft: #1e3326; --off: #6b675f; --off-soft: #2a2825; --danger: #ef6b5f; --warn: #e0ad4f; --warn-soft: #3a2f18;
    --sidebar: #0e0d0c; --sidebar-active: #24221f; --sidebar-line: #26241f; --bezel: #34322d; --bezel-hover: #4a4741;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 17px; margin: 0; }
h3 { font-size: 14px; margin: 0 0 12px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.error { color: var(--danger); min-height: 1em; margin: 6px 0; }
[hidden] { display: none !important; }
.icon { flex-shrink: 0; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-ink); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -.01em; color: #fff; padding: 4px 10px 18px; }
.brand.big { color: var(--text); font-size: 22px; justify-content: center; }
/* The Onair lamp: a lit tally light. */
.logo { width: 12px; height: 12px; border-radius: 50%; background: var(--tally); box-shadow: 0 0 0 3px rgba(224, 54, 44, .22), 0 0 10px rgba(224, 54, 44, .55); display: inline-block; flex-shrink: 0; margin: 0 3px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--sidebar-ink); padding: 8px 10px; border-radius: 4px; font-weight: 500; }
@media (hover: hover) { .nav a:hover { background: var(--sidebar-active); text-decoration: none; color: #fff; } }
.nav a.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 2px 0 0 #fff; }
.nav-section { font-size: 12px; font-weight: 500; color: var(--sidebar-muted); padding: 16px 10px 4px; }
.user-box { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--sidebar-line); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sidebar-active); color: #fff; display: grid; place-items: center; font-weight: 700; }
.user-meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.user-meta b { color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--sidebar-muted); }
.user-box .icon-btn { color: var(--sidebar-ink); }
.content { padding: 24px 28px 60px; min-width: 0; }
.content.dragging { outline: 3px dashed var(--primary); outline-offset: -12px; }

/* Grid/flex children must be allowed to shrink below their content's width, or one wide row
   (a table, a long name) stretches the whole page past the screen. */
.shell > *, .stack, .grid-2 > *, .editor-2 > *, .editor-layout > * { min-width: 0; }
.topbar, .scrim, .sidebar .drawer-close { display: none; }

/* ---------- page ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: table; font-size: 13px; margin-bottom: 6px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow-x: auto; }
.card .pad { padding: 16px 16px 0; }
.stack { display: flex; flex-direction: column; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-2 > * { min-width: 0; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; } /* labels line up even when only one field has a hint */
.row > .field { flex: 1; min-width: 120px; }
/* Publishing */
.publish-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -4px 0 16px; padding: 8px 10px 8px 14px; border: 1px solid var(--warn); border-radius: var(--radius); background: var(--warn-soft); color: var(--text); }
.publish-bar .publish-text { flex: 1; min-width: 180px; font-weight: 600; }
.publish-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); flex: none; }
.publish-compact { display: inline-flex; align-items: center; gap: 6px; }
.publish-compact .publish-text { font-weight: 600; font-size: 13px; }
.publish-compact .btn { padding: 4px 10px; }
button.publish-pill { border: 0; cursor: pointer; font: inherit; font-size: 12px; }
.publish-changes { list-style: none; margin: 0 0 8px; padding: 0; max-height: 50vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.publish-changes li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); }
.publish-changes li:first-child { border-top: 0; }
.publish-changes b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.publish-kind { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; width: 160px; flex: none; }
.pill.change-added { background: var(--ok-soft); color: var(--ok); }
.pill.change-changed { background: var(--warn-soft); color: var(--warn); }
.pill.change-removed { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.publish-auto { align-items: flex-start; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
@media (max-width: 640px) { .publish-kind { width: auto; } .publish-bar .publish-text { flex-basis: 100%; } }
.keep-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.keep-row select { width: auto; }
.row > .field + .check { margin-top: 31px; } /* a checkbox beside a field sits level with its input */
.row.inline { align-items: flex-end; margin-top: 8px; }
.row.inline > .field { flex: 0 1 auto; margin: 0; }
.row.tight { gap: 4px; flex-wrap: nowrap; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); background: var(--panel); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty p { margin: 0 0 14px; }
.banner { background: var(--primary-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field-hint { font-size: 12px; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border-strong); border-radius: 4px; padding: 8px 10px; min-width: 0;
}
input[type="color"] { padding: 2px; height: 36px; width: 56px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
input:disabled, select:disabled, textarea:disabled { opacity: .7; }
textarea { resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 4px 14px 12px 0; cursor: pointer; }
.search { width: 220px; }
.title-input { font-size: 20px; font-weight: 600; border-color: transparent; background: transparent; padding: 4px 6px; margin-left: -6px; width: 100%; max-width: 560px; }
.title-input:hover { border-color: var(--border); }
.code-input { font-family: ui-monospace, Consolas, monospace; font-size: 26px; letter-spacing: .2em; text-transform: uppercase; text-align: center; }
.form .btn[type="submit"] { margin-top: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text); border-radius: 4px; padding: 7px 12px; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.15); border-color: var(--primary); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--panel-2); border-color: var(--border); }
.btn.danger.ghost { color: var(--danger); background: transparent; }
.btn.block { width: 100%; justify-content: center; padding: 10px; }
.btn.pulse { box-shadow: 0 0 0 3px var(--primary-soft); }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 4px; display: inline-grid; place-items: center; font: inherit; }
.icon-btn:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table.hover tbody tr { cursor: pointer; }
.table.hover tbody tr:hover { background: var(--panel-2); }
.table tr.disabled td { opacity: .55; }
.card .table { margin: 0; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 3px; background: var(--off-soft); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.tiny { font-size: 11px; padding: 0 6px; margin-left: 6px; }
/* On air: the one place the tally red appears. */
.pill.live { background: var(--tally); color: #fff; font-weight: 600; }
.pill.live .dot { background: #fff; box-shadow: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--off); margin-right: 2px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

/* ---------- dashboard: screens first ---------- */
.screen-group { margin-bottom: 26px; }
.screen-group > h2 { display: flex; align-items: baseline; gap: 10px; font-size: 16px; font-weight: 600; margin: 0 0 10px; }
.screen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px 16px; }
.screen-tile { display: flex; flex-direction: column; gap: 8px; color: var(--text); min-width: 0; }
.screen-tile:hover { text-decoration: none; }
/* A screen: 16:9, near-square corners, a thin bezel. */
.screen { position: relative; aspect-ratio: 16 / 9; background: var(--screen); border-radius: var(--radius-screen); overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25), 0 0 0 4px var(--bezel); margin: 4px; }
.screen-tile:hover .screen { box-shadow: 0 0 0 1px rgba(0, 0, 0, .25), 0 0 0 4px var(--bezel-hover); }
.screen img { width: 100%; height: 100%; object-fit: cover; display: block; }
.screen-plan { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px; }
.screen-plan .layout-mini { height: 100%; max-height: none; box-shadow: none; }
.screen-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; color: #8d8981; font-size: 12px; }
.on-air { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 6px; border-radius: 2px;
  background: rgba(14, 13, 12, .78); color: #fff; font-size: 11.5px; font-weight: 600; }
.tally { width: 8px; height: 8px; border-radius: 50%; background: var(--tally); box-shadow: 0 0 6px var(--tally); }
.off-air { position: absolute; inset: auto 0 0 0; padding: 4px 8px; background: rgba(14, 13, 12, .85); color: #d8d5ce; font-size: 12px; font-weight: 600; }
.screen-tile.is-off .screen > img, .screen-tile.is-off .screen-plan { opacity: .32; filter: grayscale(1); }
.screen-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 0 4px; }
.screen-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen-meta .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.offline-note { color: var(--text); font-weight: 500; }
.counts { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.counts a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.counts a:hover { text-decoration-color: var(--text); }
/* setup checklist */
.setup-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.setup-head h2 { font-size: 16px; font-weight: 600; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; align-items: baseline; gap: 10px; }
.check-mark { width: 18px; height: 18px; flex-shrink: 0; border: 1.5px solid var(--border-strong); border-radius: 50%; display: inline-grid; place-items: center; transform: translateY(4px); }
.checklist li.done { color: var(--muted); }
.checklist li.done span:nth-child(2) { text-decoration: line-through; text-decoration-color: var(--border-strong); }
.checklist li.done .check-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.steps { margin: 0; padding-left: 20px; line-height: 2; }

/* ---------- media ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { font: inherit; font-weight: 600; background: none; border: 1px solid transparent; color: var(--muted); padding: 6px 12px; border-radius: 4px; cursor: pointer; }
.tab.active { background: var(--panel); border-color: var(--border); color: var(--text); }
.tab .count { margin-left: 6px; font-size: 11px; background: var(--off-soft); padding: 1px 6px; border-radius: 4px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.media-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; overflow: hidden; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.media-card:hover { border-color: var(--border-strong); }
.media-info { padding: 10px 12px; }
.media-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.thumb { position: relative; background: var(--screen); display: grid; place-items: center; color: #8d8981; overflow: hidden; flex-shrink: 0; border-radius: var(--radius-screen); }
.thumb.md { aspect-ratio: 16 / 9; width: 100%; }
.thumb.sm { width: 64px; height: 36px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.placeholder.t-html { background: #3a2f27; color: #e9dccd; }
.html-preview { aspect-ratio: 16 / 9; height: auto; border: 0; }
.thumb.placeholder.t-web { background: #243341; color: #d5e2ee; }
.badge-play { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .6); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.uploads:empty { display: none; }
.uploads { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.upload-row { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 8px 12px; }
.upload-row > span:first-child { flex: 0 0 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { flex: 1; height: 6px; background: var(--off-soft); border-radius: 3px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.upload-row.failed .progress .bar { background: var(--danger); }
.media-detail { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; }
.media-detail:has(> form:only-child) { grid-template-columns: 1fr; }
.preview { width: 100%; border-radius: var(--radius-screen); background: #000; max-height: 60vh; object-fit: contain; }
@media (max-width: 800px) { .media-detail { grid-template-columns: 1fr; } }

/* ---------- playlist editor ---------- */
.editor-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .editor-2 { grid-template-columns: 1fr; } }
.pl-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pl-item { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2); }
.pl-item.dragging { opacity: .4; }
.pl-item.drop { border-color: var(--primary); box-shadow: inset 0 2px 0 var(--primary); }
.grip { color: var(--muted); cursor: grab; display: grid; }
.idx { width: 20px; text-align: center; color: var(--muted); font-weight: 600; font-size: 12px; }
.dur-wrap { display: flex; align-items: center; gap: 4px; }
.dur { width: 72px; }
.item-actions { display: flex; }
.lib-list { display: flex; flex-direction: column; gap: 4px; max-height: 65vh; overflow-y: auto; margin-top: 10px; }
.lib-item { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid transparent; border-radius: 4px; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.lib-item:hover:not(:disabled) { border-color: var(--border); background: var(--panel-2); }
.lib-item .icon { color: var(--link); }
.lib-list .search, .card > .search { width: 100%; }

/* ---------- layouts ---------- */
.layout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.layout-card { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.layout-card > a { display: grid; place-items: center; padding: 14px; background: var(--panel-2); height: 180px; }
.layout-card-foot { padding: 10px 14px 12px; min-width: 0; }
.layout-card-foot .grow > * { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layout-card-foot .layout-name .swatch { vertical-align: -1px; margin-right: 6px; }
/* Actions: a small toolbar in the preview's top-right corner (always visible, so it works on touch). */
.layout-card-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; padding: 2px; border-radius: var(--radius); background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--border); }
.layout-card-tools .btn { padding: 5px 7px; }
.layout-mini { position: relative; max-width: 100%; max-height: 150px; height: 150px; border-radius: var(--radius-screen); overflow: hidden; box-shadow: 0 0 0 1px var(--border); }
.mini-zone { position: absolute; border: 1.5px solid; border-radius: 2px; }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .editor-layout { grid-template-columns: 1fr; } }
.canvas-wrap { background: repeating-conic-gradient(var(--panel-2) 0 25%, var(--bg) 0 50%) 0 0 / 20px 20px; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; display: grid; place-items: center; }
.canvas { position: relative; width: 100%; box-shadow: 0 0 0 1px var(--border-strong); touch-action: none; user-select: none; }
.canvas.portrait { width: auto; height: 70vh; }
.zone-box { position: absolute; border: 2px solid; cursor: move; overflow: hidden; }
.zone-box.selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--focus); z-index: 100 !important; }
.zone-content { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.zone-content.thumb { aspect-ratio: auto; border-radius: 0; }
/* The label is a tag in the corner: name, playlist and size sit on one line and wrap only when the zone is
   narrow, so short zones such as a ticker keep everything visible. */
.zone-label { position: absolute; left: 4px; top: 4px; max-width: calc(100% - 8px); max-height: calc(100% - 8px); padding: 2px 6px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; font-size: 12px; line-height: 1.35; color: #fff; background: rgba(28, 27, 25, .78); border-radius: 2px; pointer-events: none; overflow: hidden; }
.zone-label .dim { opacity: .75; font-size: 11px; }
.layout-name { display: flex; align-items: center; gap: 8px; }
.layout-name .swatch { flex-shrink: 0; }
.handle { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid var(--focus); border-radius: 2px; display: none; z-index: 2; }
.zone-box.selected .handle { display: block; }
.handle.nw { left: -1px; top: -1px; cursor: nwse-resize; }
.handle.ne { right: -1px; top: -1px; cursor: nesw-resize; }
.handle.sw { left: -1px; bottom: -1px; cursor: nesw-resize; }
.handle.se { right: -1px; bottom: -1px; cursor: nwse-resize; }
.zone-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.zone-chip { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: 4px; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; }
.zone-chip.active { border-color: var(--text); background: var(--panel-2); }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------- schedules ---------- */
.timeline { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
.tl-day { text-align: center; font-weight: 600; font-size: 12px; color: var(--muted); height: 22px; }
.tl-body { position: relative; height: 420px; background: repeating-linear-gradient(to bottom, var(--panel-2) 0, var(--panel-2) calc(100% / 8 - 1px), var(--border) calc(100% / 8 - 1px), var(--border) calc(100% / 8)); border-radius: 6px; }
.tl-hours .tl-body { background: none; }
.tl-hours span { position: absolute; right: 4px; font-size: 10px; color: var(--muted); transform: translateY(-50%); }
.tl-hours span:first-child { transform: none; }
.tl-block { position: absolute; border: 0; border-radius: 3px; color: #fff; font: inherit; font-size: 11px; padding: 3px 5px; text-align: left; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.tl-block span { opacity: .85; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.day { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px solid var(--border); border-radius: 4px; padding: 6px 8px; cursor: pointer; font-size: 12px; }

/* ---------- players ---------- */
.cmd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.btn.cmd { justify-content: flex-start; }
.player-screen { max-width: 960px; margin: 0 0 22px; }
.player-screen .screen { margin: 4px 4px 0; }
.screen-picture, .screen-picture img { position: absolute; inset: 0; width: 100%; height: 100%; }
.screen-picture img { object-fit: contain; background: #000; }
.screen-refresh { position: absolute; right: 10px; top: 10px; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 3px;
  padding: 6px 10px; background: rgba(14, 13, 12, .78); color: #fff; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.screen-refresh:hover:not(:disabled) { background: rgba(14, 13, 12, .95); }
.screen-refresh:disabled { opacity: .6; cursor: progress; }
.screen-caption { margin: 10px 4px 0; }
.cmd-heading { font-size: 12.5px; font-weight: 500; color: var(--muted); margin: 16px 0 8px; }
.btn.cmd-risky { color: var(--danger); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12px; font-weight: 600; }
.kv dd { margin: 0; word-break: break-word; }

/* ---------- reports ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 18px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar-fill { width: 100%; max-width: 48px; background: var(--primary); border-radius: 2px 2px 0 0; min-height: 2px; }
.bar-val { font-size: 11px; color: var(--muted); }
.bar-lbl { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---------- modal & toast ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(20, 19, 17, .55); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel); border-radius: 8px; width: min(480px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 24px 48px rgba(0, 0, 0, .28); border: 1px solid var(--border); }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.modal-body { padding: 8px 18px; overflow-y: auto; }
.modal-body p { margin-top: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px 16px; border-top: 1px solid var(--border); margin-top: 8px; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #1c1b19; color: #fff; padding: 10px 14px; border-radius: 4px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: 380px; transition: opacity .3s, transform .3s; border-left: 3px solid #6cbf8b; }
.toast.err { border-left-color: #ef6b5f; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 28px; width: min(380px, 100%); }
.login-card h1 { margin: 6px 0 18px; font-size: 20px; justify-content: center; }

/* ---------- tenants ---------- */
.tenant-box { margin: 0 4px 14px; padding: 8px 10px; border-radius: 4px; background: var(--sidebar-active); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tenant-box small { color: var(--sidebar-muted); font-size: 12px; }
.tenant-box b { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tenant-select { background: transparent; color: #fff; border: 0; padding: 0; font-weight: 700; width: 100%; cursor: pointer; }
.tenant-select:focus { outline: 2px solid #fff; }
.tenant-select option { color: #1c1b19; }
.progress.full .bar { background: var(--danger); }
td .progress { margin-top: 6px; max-width: 140px; }


/* ---------- rotations ---------- */
.rotation-mini { display: flex; align-items: center; gap: 6px; max-width: 100%; }
.rotation-mini .rot-step { width: 64px; display: grid; place-items: center; }
.rotation-mini .rot-step .layout-mini { height: auto; width: 100%; max-height: 90px; }
.rot-arrow, .rot-more { color: var(--muted); font-weight: 700; }
.rotation-mini.empty-rot { flex-direction: column; color: var(--muted); }
.rot-thumb { width: 72px; flex-shrink: 0; }
.rot-thumb .layout-mini { height: auto; width: 100%; }
.rot-steps select { width: 100%; max-width: 320px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; text-decoration: underline; }

/* ---------- downloads ---------- */
.download-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.download-card { display: flex; flex-direction: column; gap: 10px; margin-bottom: 0; }
.download-card h3 { margin: 0; }
.download-card .btn { align-self: flex-start; }
.download-grid + .card { margin-top: 16px; }
.dl-head { display: flex; gap: 12px; align-items: center; }
.steps.small { line-height: 1.6; margin: 0; }
.copy-wrap { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; }
.copy-code { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 12px; word-break: break-all; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.update-card p { margin: 4px 0 0; }
.update-card .check { margin-bottom: 4px; }

/* ---------- plugins ---------- */
.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.plugin-card { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.plugin-card.disabled { opacity: .6; }
.plugin-card p { margin: 0 0 6px; flex: 1; }
.plugin-head { display: flex; align-items: center; gap: 12px; }
.plugin-head h3 { margin: 0; }
.plugin-head .check { margin: 0; }
.plugin-icon { width: 46px; height: 46px; border-radius: 4px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); display: grid; place-items: center; flex-shrink: 0; }
.plugin-emoji { line-height: 1; }
.plugin-pick { display: flex; flex-direction: column; gap: 8px; }
.plugin-option { display: flex; gap: 12px; align-items: center; text-align: left; padding: 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); color: inherit; font: inherit; cursor: pointer; }
.plugin-option:hover { border-color: var(--primary); }
/* Large work-area dialog (plugin editors). The body fills the height; its content scrolls inside. */
.modal.xl { width: min(1600px, 100%); height: calc(100vh - 32px); height: calc(100dvh - 32px); max-height: none; }
.modal.xl .modal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.modal-overlay.full { padding: 0; }
.modal-overlay.full .modal.xl { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; border: 0; }
.modal-head .spacer { flex: 1; }
.modal-full-btn { margin-right: 2px; }

.plugin-dialog { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 30%, 520px); gap: 18px; }
.plugin-dialog .plugin-settings { min-width: 0; min-height: 0; overflow-y: auto; padding-right: 4px; }
.plugin-dialog.has-editor .plugin-settings { overflow: hidden; display: flex; flex-direction: column; padding-right: 0; }
/* A plugin's quick page (#/quick/…): full height, no menu, made for phones. */
.shell.bare { display: block; min-height: 100vh; min-height: 100dvh; }
.content.bare { padding: 0; max-width: none; display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.quick-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--panel); flex: none; }
.quick-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.quick-titles b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-status { text-align: right; max-width: 45%; }
.quick-status[data-kind="ok"] { color: var(--ok, inherit); }
.quick-status[data-kind="bad"] { color: var(--danger, #c62828); }
.quick-frame { flex: 1; width: 100%; border: 0; display: block; background: var(--bg); }
.plugin-editor { width: 100%; flex: 1; min-height: 420px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); display: block; }
.plugin-dialog .plugin-side { min-width: 0; min-height: 0; overflow-y: auto; }
.plugin-dialog .plugin-side .row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 10px; }
.plugin-dialog.no-preview { grid-template-columns: minmax(0, 1fr) clamp(240px, 22%, 320px); }
.plugin-dialog.no-preview .plugin-side .row { grid-template-columns: 1fr; }
.duration-row { display: flex; align-items: center; gap: 8px; }
.duration-row input { width: 90px; flex: none; }
.duration-text { white-space: nowrap; }
.duration-hint { margin: -6px 0 12px; }
.preview-box > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; margin-bottom: 6px; }
.preview-box > summary::-webkit-details-marker { display: none; }
.preview-box > summary::before { content: '▸'; color: var(--muted); font-size: 11px; transition: transform .15s; }
.preview-box[open] > summary::before { transform: rotate(90deg); }
.preview-box > summary .btn { padding: 2px 8px; font-size: 12px; }
.fetch-note { margin: 8px 0 0; padding: 8px 10px; border-radius: 4px; background: var(--warn-soft); color: var(--warn); }
/* The generated settings form: groups with headings, short fields side by side. */
.settings-form .sf-group { margin-bottom: 18px; }
.settings-form .sf-group > h3 { margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.settings-form .sf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 14px; align-items: end; }
.settings-form .sf-cell.wide { grid-column: 1 / -1; }
.settings-form .sf-cell .field { margin-bottom: 12px; }
.settings-form .sf-cell .check { margin: 0 0 18px; }
.settings-form .sf-cell input[type="number"] { max-width: 140px; }
.settings-form .sf-cell.wide input:not([type]), .settings-form .sf-cell.wide input[type="text"], .settings-form .sf-cell.wide input[type="url"] { max-width: 640px; width: 100%; }
/* Choosing a playlist after adding something. */
.pick-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; max-height: 45vh; overflow: auto; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.pick-row:hover { border-color: var(--text); }
.pick-row b { flex: 1; font-weight: 600; }
.plugin-preview { width: 100%; aspect-ratio: var(--ar, 16 / 9); border: 0; border-radius: 4px; background: #000; display: block; }
/* Tall shapes (portrait, side strips): limit the height and centre them. */
.plugin-preview.tall { width: min(100%, calc(420px * var(--arn, 1))); margin: 0 auto; }
.plugin-preview.plugin-preview-large { width: min(100%, calc((100dvh - 180px) * var(--arn, 1.7778))); margin: 0 auto; }
.preview-shape { font-size: 12px; padding: 2px 6px; max-width: 180px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.preview-head .btn { padding: 2px 8px; font-size: 12px; }
@media (max-width: 1000px) {
  .plugin-dialog { grid-template-columns: 1fr; overflow-y: auto; }
  .plugin-dialog .plugin-settings, .plugin-dialog.has-editor .plugin-settings { overflow: visible; }
  /* Narrow windows: name and time first (compact), then the editor, then the preview. */
  .plugin-dialog .plugin-side { display: contents; }
  .plugin-dialog .plugin-meta { order: -1; }
  .plugin-dialog .preview-box, .plugin-dialog .plugin-side > .quick-link { order: 1; }
  /* The sheet scrolls as a whole: rows take their content's height (the editor frame has its own). */
  .plugin-dialog { flex: none; min-height: auto; display: flex; flex-direction: column; gap: 12px; }
  .plugin-dialog .plugin-settings { min-height: auto; }
  .plugin-editor { flex: none; height: 70vh; height: 70dvh; min-height: 360px; }
}

/* ---------- API tokens / MCP ---------- */
.code-wrap { position: relative; margin: 10px 0; }
.code-block { background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; padding: 10px 12px; padding-right: 84px; margin: 4px 0 0;
  font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; }
.copy-btn { position: absolute; right: 6px; bottom: 6px; padding: 4px 8px; font-size: 12px; }
.connect h3 { margin-top: 18px; }

/* ==========================================================================
   Phones and small tablets
   ========================================================================== */
p, li, dd, td { overflow-wrap: anywhere; }

.plugin-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.plugin-foot .actions { margin-left: auto; display: flex; gap: 4px; }
.timeline-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px 4px; }
.timeline-scroll .timeline { min-width: 560px; }

@media (max-width: 860px) {
  .shell { display: block; }
  /* top bar */
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40;
    background: var(--sidebar); color: #fff; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
  }
  .topbar-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-tenant { margin-left: auto; font-size: 12px; color: var(--sidebar-ink); opacity: .8; max-width: 40%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .menu-btn { color: #fff; width: 44px; height: 44px; margin: -6px 0 -6px -6px; }
  /* drawer */
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(300px, 86vw); height: 100dvh;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .4);
    padding-bottom: max(18px, env(safe-area-inset-bottom)); overflow-y: auto;
  }
  .nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(20, 19, 17, .5); opacity: 0; pointer-events: none; transition: opacity .22s; }
  .nav-open .scrim { opacity: 1; pointer-events: auto; }
  .sidebar .drawer-close { display: inline-grid; margin-left: auto; color: var(--sidebar-ink); width: 40px; height: 40px; }
  .nav a { padding: 12px 10px; }
  .content { padding: 16px 16px max(40px, env(safe-area-inset-bottom)); }

  /* page header: title, then actions; search fields take the full width */
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-actions { width: 100%; }
  .page-actions .search, .page-actions > select { flex: 1 1 100%; width: 100%; }
  .page-actions .btn { flex: 1 1 auto; justify-content: center; }
  h1 { font-size: 20px; }
  .title-input { font-size: 18px; max-width: 100%; }

  /* forms */
  .row.inline > .field { flex: 1 1 140px; }
  .card.row.inline { align-items: stretch; }
  .search { width: 100%; }

  /* cards & grids */
  .card { padding: 14px; }
  .screen-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 10px; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .layout-grid, .plugin-grid, .download-grid { grid-template-columns: 1fr; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; }

  /* editors */
  .canvas-wrap { padding: 10px; }
  .canvas.portrait { height: 60vh; }
  .pl-item { flex-wrap: wrap; }
  .pl-item .grow { min-width: 120px; }
  .uploads .upload-row > span:first-child { flex-basis: 40%; }

  /* modals become bottom sheets */
  .modal-overlay { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; max-height: 94dvh; border-radius: 8px 8px 0 0; }
  .modal.xl { height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .modal-full-btn { display: none; }
  .modal-body { padding: 8px 16px; }
  .modal-actions { flex-wrap: wrap; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .modal-actions .btn { flex: 1 1 auto; justify-content: center; }
  .modal-actions .spacer { display: none; }
  .plugin-editor { height: 72dvh; }
  .duration-hint { display: none; }
  .plugin-dialog .plugin-meta .field { margin-bottom: 0; }
  .plugin-dialog .plugin-side .row { grid-template-columns: minmax(0, 1fr) 110px; }
  .duration-row input { width: 100%; }
  .duration-text { display: none; }
  .plugin-dialog .plugin-settings { max-height: none; overflow: visible; padding-right: 0; } /* the sheet scrolls, not the form */

  /* Unsaved changes in an editor: Save floats at the bottom so it's reachable after scrolling down. */
  .page-actions .btn.primary.pulse {
    position: fixed; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 30;
    padding: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  }
  .content:has(.btn.primary.pulse) { padding-bottom: 90px; }
  #toasts { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
}

/* Tables become one card per row, each value labelled with its column (labels set by main.js). */
@media (max-width: 700px) {
  .card.flush { overflow: visible; background: transparent; border: 0; box-shadow: none; }
  .card.flush > h3.pad { padding: 0 0 8px; }
  .table thead { display: none; }
  .table, .table tbody { display: block; }
  .table colgroup { display: none; }
  .table tr { display: block; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; margin-bottom: 10px; }
  .table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); text-align: right; }
  .table tr td:last-child { border-bottom: 0; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; flex-shrink: 0; }
  .table td[data-label=""]::before, .table td:not([data-label])::before { content: none; }
  .table td[data-label=""] { justify-content: flex-end; }
  .table td:first-child { font-size: 15px; }
  .table td:empty { display: none; }
  .table .td-v { min-width: 0; text-align: right; }
  .table td[data-label=""] .td-v { display: flex; gap: 4px; justify-content: flex-end; }
  .table.hover tbody tr:active { background: var(--panel-2); }
}

/* Touch screens: finger-sized controls; 16px inputs stop iOS zooming in on focus. */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  input, select, textarea { font-size: 16px; min-height: 40px; }
  input[type="checkbox"] { min-height: 0; width: 20px; height: 20px; }
  input[type="color"] { min-height: 40px; }
  .handle { width: 22px; height: 22px; }
  .handle.nw { left: -4px; top: -4px; } .handle.ne { right: -4px; top: -4px; }
  .handle.sw { left: -4px; bottom: -4px; } .handle.se { right: -4px; bottom: -4px; }
  .tab { padding: 8px 14px; }
}
body.no-scroll { overflow: hidden; }

/* ---------------------------------------------------------------- workspace */

/* collapsed menu (icon rail) for extra room in the workspace */
@media (min-width: 861px) {
  .shell.rail { grid-template-columns: 64px 1fr; }
  .shell.rail .sidebar { padding: 18px 8px; }
  .shell.rail .brand { justify-content: center; padding: 8px 0 22px; }
  .shell.rail .brand-name, .shell.rail .tenant-box, .shell.rail .nav a span, .shell.rail .user-meta { display: none; }
  .shell.rail .nav-section { font-size: 0; padding: 0; margin: 10px 12px; border-top: 1px solid var(--sidebar-line); }
  .shell.rail .nav a { justify-content: center; padding: 10px 0; }
  .shell.rail .user-box { flex-direction: column; gap: 6px; }
}

.shell.is-workspace .content { padding: 14px 16px 16px; }
.ws-root { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 861px) { .ws-root { height: calc(100vh - 30px); } }
.ws-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ws-toolbar h1 { font-size: 19px; }
.ws-tabs { display: none; }
/* Screens down the left; Content right next to Playlists (short drags, + adds to the playlist beside it);
   the schedule of the selected screen across the bottom. */
.ws-grid { flex: 1; min-height: 0; display: grid; gap: 10px;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1.35fr) minmax(300px, 1fr);
  grid-template-rows: minmax(0, 1.35fr) minmax(0, 1fr);
  grid-template-areas: "screens content playlists" "screens schedule schedule"; }
.ws-grid [data-panel="players"] { grid-area: screens; }
.ws-grid [data-panel="content"] { grid-area: content; }
.ws-grid [data-panel="playlists"] { grid-area: playlists; }
.ws-grid [data-panel="schedule"] { grid-area: schedule; }
.ws-panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; box-shadow: var(--shadow); }
.ws-panel.drop { outline: 3px dashed var(--primary); outline-offset: -4px; }
.ws-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px 9px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; min-height: 48px; }
.ws-head h2 { font-size: 14px; font-weight: 600; color: var(--text); }
.ws-head .btn { padding: 6px 8px; }
.ws-counts { display: flex; gap: 4px; flex-wrap: wrap; }
.ws-search { flex: 1 1 140px; min-width: 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2); color: var(--text); font: inherit; }
.ws-body { flex: 1; min-height: 0; overflow: auto; padding: 8px; }
.ws-empty { padding: 16px 8px; text-align: center; }

/* screens tree */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 0; }
.tree-group.collapsed > ul { display: none; }
.tree-head { display: flex; align-items: center; gap: 2px; min-width: 0; }
.tree-head > .tree-row { flex: 1; }
.tree-row { display: flex; align-items: center; gap: 4px; border-radius: 4px; min-width: 0; padding-right: 4px; }
.tree-row:hover { background: var(--panel-2); }
.tree-row.is-focus { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--text); }
.tree-row.is-focus .tree-label { font-weight: 600; }
.tree-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; padding: 6px 6px; cursor: pointer; border-radius: 4px; }
.tree-open { opacity: 0; padding: 3px; }
.tree-row:hover .tree-open, .tree-row.is-focus .tree-open, .tree-open:focus-visible { opacity: 1; }
.tree ul .tree-row { margin-left: 18px; }
.tree-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.tree-extra { display: inline-flex; align-items: center; gap: 4px; }
.ws-sync { border: 0; background: none; color: var(--muted); opacity: .45; padding: 3px; border-radius: 6px; display: inline-grid; cursor: pointer; }
.ws-sync.on { color: var(--ok); background: var(--ok-soft); opacity: 1; }
.ws-sync:disabled { cursor: default; }
@media (hover: hover) { .ws-sync:not(:disabled):hover { opacity: 1; background: var(--panel-2); } .ws-sync.on:not(:disabled):hover { background: var(--ok-soft); } }
.tree-toggle { width: 18px; flex-shrink: 0; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; font-size: 12px; }

/* content library */
.ws-content { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: start; }
.ws-folders { display: flex; flex-direction: column; gap: 1px; position: sticky; top: 0; }
.ws-folder-title { font-size: 12px; color: var(--muted); padding: 8px 8px 4px; }
.ws-folder { display: flex; align-items: center; gap: 7px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; padding: 6px 8px; border-radius: 4px; cursor: pointer; min-width: 0; }
.ws-folder span:not(.count) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-folder .count { font-size: 11px; color: var(--muted); }
.ws-folder:hover { background: var(--panel-2); }
.ws-folder.active { background: var(--panel-2); color: var(--text); font-weight: 600; box-shadow: inset 2px 0 0 var(--text); }
.ws-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.ws-card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); overflow: hidden; min-width: 0; }
.ws-card-open { display: flex; flex-direction: column; text-align: left; padding: 0; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; min-width: 0; }
/* + adds the item to the playlist marked "Adding here" */
.ws-add { position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 3px;
  background: var(--primary); color: #fff; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
.ws-add:hover { filter: brightness(1.2); }
@media (hover: hover) { .ws-card .ws-add { opacity: 0; } .ws-card:hover .ws-add, .ws-add:focus-visible { opacity: 1; } }
.ws-card[draggable="true"] { cursor: grab; }
.ws-card:hover { border-color: var(--border-strong); }
.ws-card .thumb { border-radius: 0; }
.ws-card-meta { padding: 6px 8px; display: flex; flex-direction: column; min-width: 0; }
.ws-card-meta b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* playlists */
.ws-playlists { padding: 10px; }
.ws-pl-section + .ws-pl-section { margin-top: 14px; }
.ws-section-title { font-size: 12.5px; font-weight: 500; color: var(--muted); margin: 0 0 6px; }
.ws-pl { border: 1px solid var(--border); border-radius: 4px; margin-bottom: 6px; background: var(--panel); }
.ws-pl.is-active { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }
.ws-pl.drop, .dragging-media .ws-pl:hover { box-shadow: 0 0 0 2px var(--primary); }
.ws-pl-head { display: flex; align-items: center; gap: 4px; padding: 2px 4px 2px 0; flex-wrap: wrap; }
.ws-pl-toggle { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; padding: 7px 4px; cursor: pointer; }
.ws-pl-toggle .grow { display: flex; flex-direction: column; min-width: 0; }
.ws-pl-name { display: flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-adding { font-size: 11.5px; font-weight: 600; color: var(--primary); background: var(--primary-soft); padding: 1px 6px; border-radius: 3px; white-space: nowrap; }
.ws-show-on { padding: 4px 8px; font-size: 12.5px; color: var(--link); }
/* What the focused screen shows right now */
.ws-now-card { display: flex; gap: 12px; align-items: flex-start; padding: 10px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2); }
.ws-now-card.empty { flex-direction: column; align-items: flex-start; gap: 10px; }
.ws-now-card.empty p { margin: 2px 0 0; }
.ws-now-mini { width: 96px; flex-shrink: 0; display: grid; place-items: center; color: var(--muted); }
.ws-now-mini .layout-mini { height: auto; width: 100%; }
.ws-now-title { display: flex; align-items: center; gap: 7px; }
.ws-zone-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; }
.zone-link { border: 0; background: none; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.zone-link:hover { color: var(--text); }
.ws-now-actions { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.ws-now-actions .btn { padding: 4px 8px; font-size: 12.5px; }
/* layout editor in a dialog, and the template picker */
.layout-dialog { flex: 1; min-height: 0; overflow: auto; padding-right: 4px; }
.layout-dialog .page-head { margin-bottom: 12px; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.template { display: flex; flex-direction: column; gap: 6px; align-items: stretch; padding: 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.template .layout-mini { height: auto; width: 100%; max-height: none; }
.template.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--primary-soft); }
@media (max-width: 1180px) { .ws-now-card { flex-wrap: wrap; } .ws-now-actions { flex-direction: row; } }
.ws-new-group { margin: 8px 0 4px 2px; padding: 5px 8px; font-size: 13px; color: var(--link); }
[data-panel="players"] .ws-head { flex-wrap: nowrap; }
.pick-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: 4px; padding: 4px; }
.check.pick { margin: 0; padding: 6px 8px; border-radius: 3px; gap: 8px; }
.check.pick:hover { background: var(--panel-2); }
.check.pick .muted { margin-left: auto; }
.choice-list { display: flex; flex-direction: column; gap: 6px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice input { margin-top: 3px; }
.choice > span { display: flex; flex-direction: column; gap: 2px; }
.toast { display: flex; align-items: center; gap: 14px; }
.toast-action { margin-left: auto; border: 0; background: none; color: #fff; font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 2px 0; }
.ws-items { list-style: none; margin: 0; padding: 0 6px 6px; display: flex; flex-direction: column; gap: 3px; }
.ws-item { display: flex; align-items: center; gap: 7px; padding: 4px; border-radius: 4px; background: var(--panel-2); min-width: 0; }
.ws-item[draggable="true"] { cursor: grab; }
.ws-item .grip { color: var(--muted); display: inline-grid; }
.ws-item.drop-before { box-shadow: inset 0 3px 0 var(--primary); }
.ws-item-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-item .thumb.sm { width: 48px; height: 27px; }

/* schedule */
.ws-days { display: flex; gap: 2px; overflow-x: auto; flex: 1 1 auto; min-width: 0; scrollbar-width: none; }
.ws-day { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; padding: 5px 8px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.ws-day.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--text); }
.ws-schedule { padding: 0; }
.ws-timeline { min-width: 560px; }
.ws-ruler, .ws-srow { display: grid; grid-template-columns: 130px 1fr; }
.ws-ruler { position: sticky; top: 0; z-index: 2; background: var(--panel); border-bottom: 1px solid var(--border); }
.ws-ruler .ws-lane-area { height: 24px; }
.ws-ruler span { position: absolute; top: 5px; font-size: 10.5px; color: var(--muted); transform: translateX(-50%); }

.ws-srow { border-bottom: 1px solid var(--border); }
.ws-row-label { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px 6px 12px; border-right: 1px solid var(--border); min-width: 0; position: relative; }
.ws-row-label b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 24px; }
.ws-row-label .icon-btn { position: absolute; top: 4px; right: 4px; padding: 3px; }
.ws-lane-area { position: relative; background-image: repeating-linear-gradient(to right, var(--border) 0 1px, transparent 1px calc(100% / 8)); }
.ws-default { position: absolute; left: 0; right: 0; top: 2px; height: 16px; border: 1px dashed transparent; border-radius: 2px; font: inherit; font-size: 10.5px; line-height: 14px; color: var(--muted); padding: 0 6px; overflow: hidden; white-space: nowrap; text-align: left; background: none; }
button.ws-default { cursor: pointer; }
button.ws-default:hover { color: var(--text); border-color: var(--border-strong); }
.ws-srow.is-member .ws-row-label b { font-weight: 500; }
.ws-same { padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
.ws-default.none { font-style: italic; }
.ws-bar { position: absolute; height: 23px; border: 0; border-radius: 3px; color: #fff; font: inherit; font-size: 11px; text-align: left; padding: 2px 6px; overflow: hidden; white-space: nowrap; display: flex; gap: 6px; align-items: center; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); min-width: 4px; }
.ws-bar span { opacity: .85; }
.ws-bar.inherited { opacity: .55; }
.ws-bar.off { background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .35) 0 6px, transparent 6px 12px) !important; opacity: .5; }
.ws-bar:hover { filter: brightness(1.1); z-index: 1; }
.ws-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--tally); z-index: 1; pointer-events: none; }
.ws-now::before { content: ''; position: absolute; top: -1px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--tally); }
.ws-legend { padding: 8px 12px; margin: 0; }

@media (max-width: 1180px) and (min-width: 861px) {
  .ws-grid { grid-template-columns: minmax(170px, 200px) minmax(0, 1fr) minmax(270px, 1fr); }
  .ws-content { grid-template-columns: 1fr; }
  .ws-folders { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .ws-folder-title { display: none; }
}
/* phones and small tablets: one panel at a time, switched with tabs */
@media (max-width: 860px) {
  .ws-hint, .ws-toolbar .btn { display: none; }
  .ws-tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 3px; position: sticky; top: 56px; z-index: 30; }
  .ws-tab { flex: 1; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; padding: 9px 4px; border-radius: 4px; }
  .ws-tab[aria-selected="true"] { background: var(--text); color: var(--panel); }
  .ws-grid { display: block; }
  .ws-grid .ws-panel { display: none; }
  .ws-grid[data-tab="players"] [data-panel="players"], .ws-grid[data-tab="content"] [data-panel="content"],
  .ws-grid[data-tab="playlists"] [data-panel="playlists"], .ws-grid[data-tab="schedule"] [data-panel="schedule"] { display: flex; }
  .ws-body { overflow: visible; }
  .ws-schedule { overflow-x: auto; }
  .ws-content { grid-template-columns: 1fr; }
  .ws-folders { position: static; flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .ws-folder-title { display: none; }
  .ws-folder { flex-shrink: 0; border: 1px solid var(--border); border-radius: 4px; padding: 6px 12px; }
  .ws-cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .tree-pick { padding: 10px 6px; }
  .tree-open { opacity: 1; }
  .ws-ruler { position: static; }
}

/* video wall setup (group dialog) */
.wall-box { border: 1px solid var(--border); border-radius: 4px; padding: 12px; margin: 4px 0 8px; background: var(--panel-2); }
.wall-box .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.wall-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0 8px; flex-wrap: wrap; }
.wall-grid { display: grid; gap: 6px; max-width: 560px; margin: 0 auto; }
.wall-cell { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px dashed var(--border); border-radius: 4px; background: var(--panel); aspect-ratio: 16 / 9; justify-content: center; min-width: 0; }
.wall-cell.set { border-style: solid; border-color: var(--primary); }
.wall-cell select { width: 100%; min-width: 0; }
@media (max-width: 700px) { .wall-cell { aspect-ratio: auto; } }

/* media picker (plugin editors) */
.picker { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.picker-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.picker-bar .search { flex: 1 1 220px; min-width: 0; }
.picker-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.picker-filters .chip { border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 4px; cursor: pointer; }
.picker-filters .chip.active { background: var(--text); border-color: var(--text); color: var(--panel); font-weight: 600; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.picker-card { display: flex; flex-direction: column; padding: 0; text-align: left; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); color: var(--text); font: inherit; cursor: pointer; overflow: hidden; min-width: 0; }
.picker-card:hover { border-color: var(--border-strong); }
.picker-card .thumb { border-radius: 0; }
.picker-meta { padding: 7px 9px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.picker-meta b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-empty { grid-column: 1 / -1; text-align: center; padding: 24px 8px; }
@media (max-width: 700px) { .picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* plugins page: official plugins + skill */
.official { margin-top: 18px; }
.official-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 6px; flex-wrap: wrap; }
.official-head h3 { margin: 0; }
.official-head p { margin: 2px 0 0; }
.official-name { display: flex; gap: 10px; align-items: flex-start; }
.official-name .muted { max-width: 520px; }
.plugin-icon.sm { width: 28px; height: 28px; flex-shrink: 0; }
.skill-card { margin-top: 18px; }
.skill-card summary { cursor: pointer; list-style: none; }
.skill-card summary::-webkit-details-marker { display: none; }
.skill-card summary::before { content: '▸ '; color: var(--muted); }
.skill-card[open] summary::before { content: '▾ '; }
.skill-card[open] summary { margin-bottom: 10px; }
.skill-steps { padding-left: 20px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.skill-card code { background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: 12.5px; }
@media (max-width: 700px) {
  .official .table td:first-child { display: block; }
  .official .table td:first-child::before { display: none; }
  .official .table td:first-child .td-v { text-align: left; }
}

/* ---------------------------------------------------------------- keyboard focus & motion */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: -1px; }
.sidebar :focus-visible, .topbar :focus-visible { outline-color: #fff; }
.table tr[tabindex]:focus-visible { outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------- content previews */
.thumb.md { container-type: inline-size; }
.thumb-text { padding: 8% 9%; font-weight: 600; line-height: 1.15; text-align: center; font-size: clamp(11px, 10cqi, 22px);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.thumb-badge { position: absolute; left: 6px; top: 6px; display: inline-flex; align-items: center; gap: 4px; max-width: calc(100% - 12px);
  font-size: 10.5px; font-weight: 500; padding: 1px 6px 1px 4px; border-radius: 2px; background: rgba(0, 0, 0, .45); color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-badge .plugin-emoji { font-size: 12px !important; }
.media-thumb-wrap { position: relative; }
.validity { position: absolute; right: 6px; bottom: 6px; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 2px; background: rgba(28, 27, 25, .82); color: #fff; }
.validity.soon { background: #8f5a00; }
.validity.expired { background: #f2f1ee; color: #1c1b19; }
.validity.upcoming { background: var(--primary); }
.media-card.is-expired .thumb, .ws-card .media-thumb-wrap:has(.validity.expired) .thumb { opacity: .45; filter: grayscale(1); }

/* takeovers */
.section-title { font-size: 14px; font-weight: 600; margin: 22px 0 8px; }
.layout-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: 0; }
.row-actions { text-align: right; white-space: nowrap; }
.takeover-lives { display: flex; flex-direction: column; gap: 10px; }
.takeover-live { display: flex; align-items: center; gap: 16px; border-left: 4px solid var(--tally); flex-wrap: wrap; }
.takeover-live-main { flex: 1; min-width: 240px; }
.takeover-live-main h3 { margin: 8px 0 4px; font-size: 18px; }
.takeover-live-main p { margin: 2px 0; }
.takeover-live-actions { display: flex; gap: 8px; }
.takeover-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.takeover-head .search { max-width: 220px; }
.takeover-targets { display: flex; flex-direction: column; max-height: 34vh; overflow: auto; border: 1px solid var(--border); border-radius: 4px; padding: 4px 10px; }
.takeover-target { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--border); width: 100%; }
.takeover-target:last-child { border-bottom: 0; }
.takeover-target.via { color: var(--muted); }
.takeover-target .dot { margin-left: auto; }
.takeover-inline { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.takeover-mode { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.takeover-mode input { margin-top: 3px; }
.takeover-mode > span { display: flex; flex-direction: column; gap: 2px; }
.takeover-mode input, .check input[type="radio"] { width: 16px; height: 16px; flex: none; }
.takeover-inline.dim { opacity: .55; }
.takeover-repeat { align-items: center; }

/* products */
.prod-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); }
.products-table td { vertical-align: middle; }
.products-table { table-layout: fixed; width: 100%; }
.products-table col.c-pick { width: 44px; }
.products-table col.c-price { width: 150px; }
.products-table col.c-menus { width: 190px; }
.products-table col.c-sold { width: 84px; }
.products-table col.c-actions { width: 110px; }
.products-table td { overflow-wrap: anywhere; }
.products-table .prod-name > div { min-width: 0; overflow-wrap: break-word; word-break: normal; }
.products-table .prod-name b { overflow-wrap: break-word; }
.prod-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.prod-tags .pill.tiny { margin-left: 0; }
@media (max-width: 1250px) {
  .products-table col.c-price { width: 115px; }
  .products-table col.c-menus { width: 130px; }
  .products-table col.c-sold { width: 70px; }
  .products-table col.c-actions { width: 92px; }
}
.products-table tr.sold td:not(.pick):not(.row-actions) { opacity: .55; }
.prod-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.prod-photo { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; flex: none; background: var(--off-soft); }
.prod-photo.none { display: inline-grid; place-items: center; color: var(--muted); }
.prod-photo.big { width: 72px; height: 72px; }
.prod-photo-edit { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nowrap { white-space: nowrap; }
.chip-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-pick { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 13px; }
.chip-pick:has(input:checked) { border-color: var(--text); background: var(--off-soft); font-weight: 600; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background .15s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--danger); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus, var(--text)); outline-offset: 2px; }

/* menu boards */
.menu-boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.menu-board-card { display: flex; flex-direction: column; gap: 10px; }
.menu-board-main h3 { margin: 0 0 4px; font-size: 17px; }
.menu-board-main p { margin: 2px 0; }
.menu-board-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.linklike:hover { text-decoration: underline; }

/* menu board previews: the board as it plays, in its zone's shape */
.mb-thumb { position: relative; display: grid; place-items: center; height: 240px; margin: -4px 0 2px; padding: 0; border: 1px solid var(--border); border-radius: 4px; background: #000; overflow: hidden; cursor: pointer; }
.mb-thumb.snapthumb img.snap { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .25s; }
.mb-thumb.snap-on img.snap { opacity: 1; }
.mb-thumb .mb-shape { position: absolute; right: 6px; bottom: 6px; font-size: 11px; padding: 1px 6px; border-radius: 3px; background: rgba(0,0,0,.6); color: #fff; z-index: 1; }
.mb-thumb:hover { border-color: var(--text); }

/* snapshot thumbnails (plugin items, HTML): the stored picture, letterboxed to the zone's shape */
.thumb.snapthumb { position: relative; overflow: hidden; }
.thumb.snapthumb img.snap { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .25s; }
.thumb.snapthumb.snap-on { background: #000 !important; }
.thumb.snapthumb.snap-on > :not(img.snap) { visibility: hidden; }
.thumb.snapthumb.snap-on img.snap { opacity: 1; }

/* takeovers: different content on different screens */
.takeover-pieces { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 2px; }
.takeover-piece { display: flex; align-items: center; gap: 8px; }
.takeover-piece select { flex: 1; min-width: 0; }
.piece-tag { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 4px; background: var(--primary); color: var(--primary-ink); font-weight: 700; flex: none; }
.takeover-target .piece-pick { width: auto; max-width: 190px; padding: 3px 6px; font-size: 13px; }
.takeover-piece-list { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.takeover-piece-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.takeover-piece-list .piece-tag { width: 20px; height: 20px; font-size: 12px; }
