/* XDlab Signage CMS - design system */

:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #edf2f8;
  --border: #dce4ee;
  --border-strong: #b9c7d9;
  --text: #0f172a;
  --text-muted: #52637b;
  --text-subtle: #60728c;

  --sidebar-bg: #0c1a2f;
  --sidebar-bg-2: #122543;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-border: #1e3355;

  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: #eff6ff;
  --brand-border: #bfdbfe;

  --ok: #15803d;
  --ok-soft: #dcfce7;
  --ok-border: #bbf7d0;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --warn-border: #fde68a;
  --danger: #b91c1c;
  --danger-hover: #991b1b;
  --danger-soft: #fee2e2;
  --danger-border: #fecaca;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --info-border: #bfdbfe;
  --neutral: #475569;
  --neutral-soft: #f1f5f9;
  --neutral-border: #e2e8f0;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .035), 0 8px 24px -18px rgba(15, 23, 42, .2);
  --shadow: 0 3px 10px rgba(15, 23, 42, .07), 0 18px 38px -24px rgba(15, 23, 42, .25);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .35);
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --font: "Segoe UI Variable", "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "SF Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1220;
    --surface: #111a2b;
    --surface-2: #162033;
    --surface-3: #1b2740;
    --border: #23304a;
    --border-strong: #33415c;
    --text: #e6edf7;
    --text-muted: #a7b6cd;
    --text-subtle: #92a4bf;
    --sidebar-bg: #080f1c;
    --sidebar-bg-2: #0e1829;
    --sidebar-border: #1c2942;
    --brand: #3b82f6;
    --brand-hover: #60a5fa;
    --brand-soft: #172554;
    --brand-border: #1e3a8a;
    --ok: #4ade80; --ok-soft: #062f1b; --ok-border: #14532d;
    --warn: #fbbf24; --warn-soft: #3b2506; --warn-border: #78350f;
    --danger: #f87171; --danger-soft: #3f1212; --danger-border: #7f1d1d;
    --info: #93c5fd; --info-soft: #172554; --info-border: #1e3a8a;
    --neutral: #cbd5e1; --neutral-soft: #1b2740; --neutral-border: #23304a;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 8px 24px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--brand); }
img { max-width: 100%; }
[hidden] { display: none !important; }

.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; transition: grid-template-columns .2s ease; }

.sidebar {
  background: linear-gradient(180deg, var(--sidebar-bg-2), var(--sidebar-bg));
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

/* Sidebar scrollbar: slim, dark, and only prominent on hover. */
.sidebar { scrollbar-width: thin; scrollbar-color: #2a4370 transparent; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #1e3355; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.sidebar:hover::-webkit-scrollbar-thumb { background: #2f5089; background-clip: padding-box; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #3b82f6; background-clip: padding-box; }

.brand {
  display: flex;
  align-items: center;
  padding: 0 18px;
  height: var(--topbar-h);
  flex: 0 0 auto;
  border-bottom: 1px solid var(--sidebar-border);
  background: var(--sidebar-bg);
  text-decoration: none;
}
.brand-logo { display: block; width: 180px; height: 48px; object-fit: contain; filter: brightness(0) invert(1); }
/* The symbol cut from the full logo, shown alone when the sidebar is collapsed. */
.brand-logo-compact { display: none; width: 42px; height: 38px; object-fit: contain; filter: brightness(0) invert(1); }
.brand-mark {
  width: 38px; height: 32px; flex: 0 0 auto;
  border-radius: 9px;
  background: linear-gradient(140deg, #3b82f6, #1d4ed8);
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .45);
}
.brand-mark svg { width: 30px; height: 25px; fill: none; stroke: #fff; stroke-width: 2.8; stroke-linejoin: round; }
.brand-text { font-weight: 700; font-size: 15px; letter-spacing: -.01em; line-height: 1.15; }
.brand-text small { display: block; font-weight: 500; font-size: 11px; color: #64748b; letter-spacing: .04em; text-transform: uppercase; }

.nav { padding: 16px 12px 24px; flex: 1 1 auto; }
.nav-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: #475569; padding: 16px 10px 7px;
}
.nav-group-label:first-child { padding-top: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; margin: 1px 0;
  color: var(--sidebar-text); text-decoration: none;
  border-radius: 8px; font-size: 13.5px; font-weight: 500;
  transition: background .13s, color .13s;
}
.nav a svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: .75; }
.nav a:hover { background: rgba(255, 255, 255, .055); color: #e2e8f0; }
.nav a.active {
  background: rgba(59, 130, 246, .17);
  color: var(--sidebar-text-active);
  box-shadow: inset 2px 0 0 var(--brand);
}
.nav a.active svg { opacity: 1; color: #60a5fa; }
.nav a.is-locked { opacity: .38; pointer-events: none; cursor: not-allowed; }

.sidebar-foot { padding: 14px 18px 18px; border-top: 1px solid var(--sidebar-border); color: #475569; font-size: 11.5px; }

.main { display: flex; flex-direction: column; min-width: 0; }

/* ---------- topbar ---------- */

.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topbar-context { display: flex; align-items: center; gap: 8px; min-width: 0; }
.context-chip {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-subtle);
}
.topbar-spacer { flex: 1 1 auto; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid var(--brand-border);
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px;
  text-transform: uppercase; flex: 0 0 auto;
}
.topbar-user .who { line-height: 1.25; min-width: 0; }
.topbar-user .who b { display: block; font-size: 13px; font-weight: 600; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user .who span { font-size: 11px; color: var(--text-muted); }

.sidebar-toggle { display: inline-flex; flex: 0 0 auto; }

/* ---------- page ---------- */

.page { padding: 24px 26px 48px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .grow { flex: 1 1 320px; min-width: 0; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-subtle); margin-bottom: 5px; }
.page-head p { color: var(--text-muted); margin-top: 6px; max-width: 70ch; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* ---------- cards / panels ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 14px; }
.settings-form + .card { margin-top: 14px; }
.card-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-head .grow { flex: 1 1 200px; min-width: 0; }
.card-head p { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 14px 20px; }
.card-foot { padding: 13px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.grid { display: grid; gap: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(198px, 1fr)); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 15px 16px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 3px;
}
.stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.stat-label svg { width: 15px; height: 15px; opacity: .7; }
.stat-value { font-size: 29px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-value.is-loading { color: var(--text-subtle); }
.stat-note { font-size: 12px; color: var(--text-subtle); }
.stat.accent-ok .stat-value { color: var(--ok); }
.stat.accent-warn .stat-value { color: var(--warn); }
.stat.accent-danger .stat-value { color: var(--danger); }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; min-height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .13s, border-color .13s, box-shadow .13s, opacity .13s;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--surface-3); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, .3); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { background: var(--surface); border-color: var(--danger-border); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.btn-icon { padding: 6px; min-height: 30px; width: 30px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12px; color: var(--text-muted); }

input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="datetime-local"], input[type="date"], input[type="time"],
input[type="url"], select, textarea {
  width: 100%;
  padding: 8px 11px; min-height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 13.5px;
  transition: border-color .13s, box-shadow .13s;
}
select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 15px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
}
input:disabled, select:disabled { background: var(--surface-3); color: var(--text-muted); cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }

.detail-disclosure-card { overflow: hidden; }
.detail-disclosure-summary { display: flex; align-items: center; gap: 12px; padding: 17px 20px; cursor: pointer; list-style: none; }
.detail-disclosure-summary::-webkit-details-marker { display: none; }
.detail-disclosure-summary:hover { background: var(--surface-2); }
.detail-disclosure-summary .grow { display: flex; flex-direction: column; gap: 3px; }
.detail-disclosure-summary b { color: var(--text); font-size: 14px; }
.detail-disclosure-summary .grow > span { color: var(--text-muted); font-size: 12.5px; }
.detail-disclosure-chevron { width: 9px; height: 9px; border-right: 2px solid var(--text-subtle); border-bottom: 2px solid var(--text-subtle); transform: rotate(-45deg); transition: transform .15s ease; }
.detail-disclosure-card details[open] .detail-disclosure-chevron { transform: rotate(45deg); }
.detail-disclosure-body { border-top: 1px solid var(--border); }
.detail-disclosure-body .card-head.compact { padding-top: 14px; padding-bottom: 14px; }
.detail-disclosure-body .card-head h3 { margin: 0 0 3px; font-size: 14px; }

/* Flatpickr follows the CMS controls while keeping native pickers on mobile. */
.flatpickr-input[readonly] { cursor: pointer; background: var(--surface); }
.flatpickr-calendar { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 14px 36px rgba(15,23,42,.18); font-family: inherit; overflow: hidden; }
.flatpickr-calendar.arrowTop::before { border-bottom-color: var(--border); }
.flatpickr-calendar.arrowTop::after { border-bottom-color: var(--surface); }
.flatpickr-months { padding: 6px 4px 2px; background: var(--surface); }
.flatpickr-months .flatpickr-month, .flatpickr-current-month .flatpickr-monthDropdown-months { color: var(--text); fill: var(--text); }
.flatpickr-current-month input.cur-year, .flatpickr-current-month .flatpickr-monthDropdown-months { font-weight: 650; }
.flatpickr-weekdays, .flatpickr-weekday { background: var(--surface) !important; color: var(--text-muted) !important; }
.flatpickr-day { border-radius: 7px; color: var(--text); }
.flatpickr-day:hover, .flatpickr-day:focus { border-color: var(--brand-soft); background: var(--brand-soft); }
.flatpickr-day.today { border-color: var(--brand); color: var(--brand); font-weight: 700; }
.flatpickr-day.selected, .flatpickr-day.selected:hover, .flatpickr-day.selected:focus { border-color: var(--brand); background: var(--brand); color: #fff; }
.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { color: var(--text-subtle); }
.flatpickr-time { border-top-color: var(--border); }
.flatpickr-time input, .flatpickr-time .flatpickr-am-pm { color: var(--text); font-weight: 650; }
.flatpickr-time input:hover, .flatpickr-time .flatpickr-am-pm:hover { background: var(--surface-3); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 15px; }
.form-grid .span-2 { grid-column: span 2; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }

.search { position: relative; flex: 0 1 280px; min-width: 190px; }
.search input { padding-left: 33px; }
.search svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-subtle); pointer-events: none;
}

.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 7px 12px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--brand-soft); color: var(--brand); }

/* ---------- table ---------- */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); background: var(--surface-2);
  padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data th.right, table.data td.right { text-align: center; font-variant-numeric: tabular-nums; }
table.data td.col-actions, table.data th.col-actions { text-align: right; white-space: nowrap; width: 1%; }
.row-actions { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.schedule-card .row-actions { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
table.data .cell-primary { font-weight: 600; }
table.data .cell-sub { font-size: 12px; color: var(--text-muted); }
/* Rename and Delete sit beside a row's name as small icon buttons. */
.name-actions { display: flex; gap: 6px; margin-top: 6px; }
.name-action { width: 30px; min-width: 30px; min-height: 28px; padding: 0; color: var(--brand); background: var(--surface); border-color: var(--brand-border); }
.name-action:hover { background: var(--brand-soft); border-color: var(--brand); }
.name-action.danger { color: var(--danger); border-color: var(--danger-border); }
.name-action.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.name-action svg { width: 14px; height: 14px; }
.player-screen-summary { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.player-screen-map { position: relative; width: 152px; height: 66px; overflow: hidden; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-3); }
.player-screen-shape { position: absolute; box-sizing: border-box; border: 2px solid var(--brand); border-radius: 3px; background: var(--brand-soft); }
.player-screen-shape::after { content: ''; position: absolute; left: 50%; bottom: -4px; width: 24%; height: 3px; min-width: 4px; transform: translateX(-50%); border-radius: 0 0 2px 2px; background: var(--brand); }
.player-screen-shape.primary { box-shadow: 0 0 0 2px var(--surface),0 0 0 3px var(--brand); }
.player-screen-shape.planned { border-style: dashed; border-color: var(--text-subtle); background: transparent; }
.player-screen-shape.planned::after { background: var(--text-subtle); }
/* A key to the page's graphics: one labelled row per graphic, swatches only, no paragraphs. */
.visual-legend { display: grid; gap: 7px; margin: 12px 14px 2px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-size: 12px; color: var(--text-muted); }
.visual-legend-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 12px; }
.visual-legend-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-subtle); }
.visual-legend-keys { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 16px; min-width: 0; }
.visual-legend-note { color: var(--text-subtle); }
.visual-key-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
@media (max-width: 560px) {
  .visual-legend-row { grid-template-columns: 1fr; gap: 4px; }
}
.visual-key-item i { display: inline-block; width: 16px; height: 11px; box-sizing: border-box; border-radius: 2px; background: var(--surface); }
.visual-key-primary { border: 2px solid var(--brand); box-shadow: 0 0 0 1px var(--surface),0 0 0 2px var(--brand); }
.visual-key-planned { border: 2px dashed var(--text-subtle); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable[data-dir="asc"]::after { content: " \25B2"; font-size: 8px; }
th.sortable[data-dir="desc"]::after { content: " \25BC"; font-size: 8px; }

.thumb {
  width: 84px; height: 48px; border-radius: var(--radius-sm);
  object-fit: cover; background: var(--surface-3);
  border: 1px solid var(--border); display: block;
}
.thumb-fallback {
  width: 84px; height: 48px; border-radius: var(--radius-sm);
  background: var(--surface-3); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--text-subtle);
}
.thumb-fallback svg { width: 19px; height: 19px; }
.video-thumb-wrap { position: relative; display: block; width: 84px; height: 48px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-3); }
.video-thumb-wrap .thumb { width: 100%; height: 100%; }
.video-thumb-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(15,23,42,.18); pointer-events: none; }
.video-thumb-play svg { filter: drop-shadow(0 1px 2px rgba(0,0,0,.55)); }

/* ---------- badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; line-height: 1.5;
  background: var(--neutral-soft); color: var(--neutral); border: 1px solid var(--neutral-border);
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.badge.info { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }
.badge.pulse .dot { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.code-pill {
  font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: .12em;
  background: var(--surface-3); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: var(--radius-sm); color: var(--text);
}

/* ---------- empty / loading ---------- */

.empty { padding: 48px 24px; text-align: center; }
.empty-icon {
  width: 46px; height: 46px; margin: 0 auto 14px;
  border-radius: 13px; background: var(--surface-3); color: var(--text-subtle);
  display: grid; place-items: center;
}
.empty-icon svg { width: 22px; height: 22px; }
.empty h3 { margin-bottom: 5px; }
.empty p { color: var(--text-muted); max-width: 46ch; margin: 0 auto 16px; font-size: 13.5px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: var(--radius-sm);
  height: 13px;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.notice {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--radius);
  background: var(--warn-soft); border: 1px solid var(--warn-border); color: var(--warn);
  font-size: 13.5px;
}
.notice svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.notice.info { background: var(--info-soft); border-color: var(--info-border); color: var(--info); }
.notice.danger { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.notice b { font-weight: 650; }
.notice a { color: inherit; }

/* ---------- toast ---------- */

#toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px; max-width: min(380px, calc(100vw - 36px));
}
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: 13.5px;
  animation: toast-in .18s ease-out;
}
.toast svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.toast.ok svg { color: var(--ok); }
.toast.error svg { color: var(--danger); }
.toast.info svg { color: var(--brand); }
.toast .grow { flex: 1 1 auto; min-width: 0; }
.toast button { border: 0; background: transparent; color: var(--text-subtle); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(15, 23, 42, .5);
  display: grid; place-items: center;
  padding: 20px;
  animation: fade-in .13s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: min(560px, 100%); max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  animation: modal-in .17s cubic-bezier(.2, .9, .3, 1);
}
.modal.wide { width: min(880px, 100%); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.modal-head p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1 1 auto; }
.modal-body .field + .field { margin-top: 15px; }
.modal-body .form-grid .field + .field { margin-top: 0; }
.modal-head h2 { font-size: 18px; }
.field .hint { line-height: 1.45; }
input[type="file"] { width: 100%; font: inherit; font-size: 13px; }
select:hover, input:not([type]):hover, input[type="text"]:hover, input[type="email"]:hover, input[type="password"]:hover, input[type="number"]:hover, textarea:hover { border-color: var(--text-subtle); }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.modal-foot .grow { flex: 1 1 auto; }

/* ---------- playlist builder ---------- */

/* ---------- help and onboarding ---------- */

.help-page { display: flex; flex-direction: column; gap: 14px; }
.help-hero { display: flex; align-items: center; gap: 16px; padding: 22px 24px; border: 1px solid #bfdbfe; border-radius: var(--radius-lg); background: linear-gradient(120deg,#eff6ff 0%,#f8fafc 62%,#eef2ff 100%); }
.help-hero-mark { display: grid; place-items: center; width: 50px; height: 50px; flex: 0 0 auto; border-radius: 15px; color: #fff; background: linear-gradient(145deg,var(--brand),#4f46e5); box-shadow: 0 8px 18px rgba(37,99,235,.2); }
.help-hero .eyebrow { color: var(--brand); }
.help-hero h2 { margin-top: 2px; font-size: 22px; letter-spacing: -.02em; }
.help-hero p { margin-top: 4px; color: var(--text-muted); font-size: 13.5px; }
.help-hero .btn { flex: 0 0 auto; }
.help-card { overflow: hidden; display: flex; flex-direction: column; }
.help-card > .card-head { flex: 0 0 auto; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
/* the grid gap already spaces these; the .card + .card margin would offset the second column. */
.help-grid > .card + .card { margin-top: 0; }
.help-links, .glossary { flex: 1 1 auto; padding: 6px 20px 14px; }
.help-links a { display: flex; align-items: center; gap: 11px; padding: 13px 0; color: var(--text); border-bottom: 1px solid var(--border); text-decoration: none; }
.help-links a:last-child { border-bottom: 0; }
.help-links a:hover { color: var(--text); }
.help-link-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 9px; color: var(--brand); background: var(--brand-soft); }
.help-link-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.help-link-copy b { min-width: 0; font-size: 13px; }
.help-link-copy small { color: var(--text-muted); font-size: 11.5px; }
.help-link-arrow { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); white-space: nowrap; font-size: 12px; }
.help-link-arrow svg { transition: transform .15s; }
.help-link-open { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border: 1px solid var(--brand-border); border-radius: 8px; color: var(--brand); background: var(--surface); }
.help-link-open:hover { color: #fff; background: var(--brand); border-color: var(--brand); }
.help-troubleshoot { display: flex; align-items: flex-start; gap: 9px; }
.help-troubleshoot > div { display: flex; flex-direction: column; gap: 3px; }
.help-troubleshoot > div span { color: var(--text-muted); }
.glossary { margin: 0; }
.glossary div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.glossary div:last-child { border-bottom: 0; }
.glossary dt { font-weight: 700; }
.glossary dd { margin: 0; color: var(--text-muted); }
/* The five setup steps, rendered by Setup::steps() on both the Dashboard and Help.
   Base is the Dashboard's compact guide; .is-detailed is the roomier Help variant. */
.setup-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 14px 18px 18px; gap: 8px; }
.setup-steps a { display: flex; align-items: center; gap: 9px; padding: 10px; border-radius: var(--radius); color: var(--text); text-decoration: none; background: var(--surface-2); border: 1px solid transparent; }
.setup-steps a:hover { border-color: var(--brand); }
.setup-steps a > div { min-width: 0; }
.setup-steps b, .setup-steps small { display: block; }
.setup-steps b { font-size: 12.5px; }
.setup-steps small { color: var(--text-subtle); margin-top: 2px; }
.setup-check { width: 24px; height: 24px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--text-muted); font-size: 11px; font-weight: 750; }
.setup-steps .is-complete { opacity: .72; }
.setup-steps .is-complete .setup-check { background: var(--ok-soft); color: var(--ok); }

.setup-steps.is-detailed { padding: 18px 20px 20px; gap: 12px; }
.setup-steps.is-detailed a { align-items: flex-start; gap: 10px; padding: 14px; background: var(--surface); border-color: var(--border); transition: border-color .14s, box-shadow .14s, transform .14s; }
.setup-steps.is-detailed a:hover { border-color: var(--brand); box-shadow: 0 5px 16px rgba(15,23,42,.07); transform: translateY(-1px); }
.setup-steps.is-detailed .setup-check { background: var(--brand-soft); color: var(--brand); font-size: 12px; }
.setup-steps.is-detailed b { font-size: 13px; line-height: 24px; margin-bottom: 2px; }
.setup-steps.is-detailed small { color: var(--text-muted); line-height: 1.45; margin-top: 0; }
.setup-guide.is-finished .card-head p::after { content: ' Everything is ready.'; color: var(--ok); font-weight: 650; }
.explain { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.explain summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; color: var(--text-muted); font-weight: 650; }
.explain summary:hover { color: var(--text); }
.explain p { margin: 0; padding: 0 14px 14px 39px; color: var(--text-muted); }

.builder { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 14px; align-items: start; }
.builder .card { margin: 0; }
.library-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.library-toolbar .search { min-width: 0; }
.library-toolbar .content-tag-filter { width: 100%; min-width: 0; }
.library-list { max-height: 560px; overflow-y: auto; padding: 4px 14px 10px; display: flex; flex-direction: column; }
.media-row {
  display: flex; gap: 11px; align-items: center;
  border-bottom: 1px solid var(--border); padding: 10px 2px; background: transparent;
}
.media-row:last-child { border-bottom: 0; }
.media-row:hover { background: transparent; }
.media-row .grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.timeline-item .grow { display: flex; flex-direction: column; gap: 2px; }
.media-row .name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlist-media-meta { font-size: 11px; line-height: 1.25; color: var(--text-subtle); }
.playlist-media-tags { max-width: 100%; gap: 4px; }
.playlist-media-tags .badge { font-size: 10.5px; padding: 2px 7px; }
.media-row .thumb, .media-row .thumb-fallback, .media-row .video-thumb-wrap { width: 72px; height: 44px; flex: 0 0 auto; }
.media-row > .btn { background: var(--brand); border-color: var(--brand); color: #fff; }
.media-row > .btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

.timeline-list { padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 140px; }
/* A tiny screen showing what each picture size does; used on the playlist's picture size choices. */
.scale-preview { position: relative; display: grid; place-items: center; flex: 0 0 auto; width: 78px; height: 46px; overflow: hidden; border: 2px solid #334155; border-radius: 5px; background: #0f172a; }
.scale-art { position: relative; display: block; background: linear-gradient(145deg,#60a5fa 0 50%,#fbbf24 50% 100%); }
.scale-art::after { content: ''; position: absolute; width: 13px; height: 13px; border: 3px solid #fff; border-radius: 50%; left: 50%; top: 50%; transform: translate(-50%,-50%); }
.scale-preview-fit .scale-art { width: 34px; height: 42px; }
.scale-preview-fill .scale-art { width: 76px; height: 66px; }
.scale-preview-stretch .scale-art { width: 76px; height: 44px; }
.scale-preview-stretch .scale-art::after { width: 28px; }
.scale-preview-center .scale-art { width: 30px; height: 20px; }
.scale-preview-center .scale-art::after { width: 9px; height: 9px; border-width: 2px; }
/* Timeline rows live with the rest of the playlist page styles, under "playlists" further down. */

/* ---------- drop zone ---------- */

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 34px 20px; text-align: center; color: var(--text-muted);
  cursor: pointer; background: var(--surface-2);
  transition: border-color .13s, background .13s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.dropzone svg { width: 26px; height: 26px; margin-bottom: 8px; opacity: .75; }
.dropzone b { display: block; color: var(--text); font-size: 14px; margin-bottom: 3px; }
.dropzone.is-over b { color: var(--brand); }
.upload-source-tabs { margin-bottom: 16px; }
.content-tag-filter { width: 150px; min-width: 120px; }
.media-tag-list { display: flex; flex-wrap: wrap; gap: 4px; max-width: 240px; }
.media-tag-list .badge { font-size: 10.5px; padding: 2px 7px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 11px; border-radius: var(--radius-sm);
  background: var(--surface-3); border: 1px solid var(--border); font-size: 13px;
}
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }

/* ---------- schedule ---------- */

.schedule-card {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 15px; background: var(--surface);
}
.schedule-card + .schedule-card { margin-top: 9px; }
.schedule-card.is-disabled { opacity: .62; }
.schedule-card .grow { flex: 1 1 260px; min-width: 0; }
.schedule-card .route { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.schedule-card .route svg { width: 14px; height: 14px; color: var(--text-subtle); }
.schedule-card .meta { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sep { color: var(--text-subtle); }

/* ---------- grid picker (screen groups) ---------- */


/* ---------- login ---------- */

.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1100px 620px at 12% -10%, rgba(37, 99, 235, .32), transparent 60%),
    radial-gradient(900px 520px at 100% 108%, rgba(14, 165, 233, .22), transparent 58%),
    #0a1425;
}
.auth-card {
  width: min(388px, 100%);
  background: #fff; color: #0f172a;
  border-radius: 16px; padding: 28px 28px 30px;
  box-shadow: 0 30px 70px -20px rgba(2, 6, 23, .7);
}
.login-logo-panel { width: 94%; margin: 0 auto 16px; }
.login-logo-image { display: block; width: 100%; height: auto; object-fit: contain; }
.auth-card h1 { font-size: 21px; }
.auth-card .sub { color: #64748b; margin: 0 0 22px; font-size: 13.5px; text-align: center; }
.auth-card .field + .field { margin-top: 15px; }
.auth-card .btn { margin-top: 22px; }
.auth-card input { background: #fff; color: #0f172a; border-color: #cbd5e1; }
.auth-card label { color: #0f172a; }
.auth-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid #e2e8f0; font-size: 12px; color: #94a3b8; text-align: center; }
.auth-error {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 11px 13px; border-radius: 8px; margin-bottom: 18px;
  background: #fee2e2; border: 1px solid #fecaca; color: #991b1b; font-size: 13px;
}
.auth-error svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .builder { grid-template-columns: minmax(0, 1fr); }
  .setup-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-steps a:last-child { grid-column: 1 / -1; }
}

/* Collapsed sidebar (desktop): icons only, labels appear as tooltips. */
@media (min-width: 901px) {
  html.nav-collapsed { --sidebar-w: 68px; }
  html.nav-collapsed .sidebar { overflow-x: hidden; }
  html.nav-collapsed .brand { padding: 0; justify-content: center; }
  html.nav-collapsed .brand-logo { display: none; }
  html.nav-collapsed .brand-logo-compact { display: block; }
  html.nav-collapsed .brand-text,
  html.nav-collapsed .nav-group-label span,
  html.nav-collapsed .nav a span,
  html.nav-collapsed .sidebar-foot { display: none; }
  html.nav-collapsed .nav { padding: 12px 10px 20px; }
  html.nav-collapsed .nav-group-label { height: 1px; padding: 0; margin: 12px 8px; background: var(--sidebar-border); font-size: 0; }
  html.nav-collapsed .nav-group-label:first-child { display: none; }
  html.nav-collapsed .nav a { justify-content: center; padding: 10px 0; }
  html.nav-collapsed .nav a svg { width: 19px; height: 19px; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 100; left: 0; top: 0; bottom: 0; width: 264px;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 90; }
  .sidebar-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; gap: 8px; }
  .topbar-user .who { display: none; }
  .context-chip { display: none; }
  .page { padding: 20px 16px 48px; }
  .form-grid .span-2 { grid-column: span 1; }
  .help-grid { grid-template-columns: 1fr; }
  .help-hero { align-items: flex-start; flex-wrap: wrap; }
  .help-hero .btn { margin-left: 66px; }
}

@media (max-width: 520px) {
  .topbar { height: auto; min-height: var(--topbar-h); flex-wrap: wrap; padding: 8px 16px; }
  .topbar-spacer { order: 1; }
  .topbar-user { order: 2; }
  .topbar-context { order: 3; flex: 1 0 100%; width: 100%; }
  .topbar-context select { flex: 1 1 0; width: 0; min-width: 0; }
  .topbar-context .badge { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .help-hero { padding: 18px; }
  .help-hero-mark { width: 42px; height: 42px; border-radius: 12px; }
  .help-hero h2 { font-size: 19px; }
  .help-hero .btn { width: 100%; margin-left: 0; justify-content: center; }
  .help-link-arrow { font-size: 0; }
  .help-link-arrow svg { width: 16px; height: 16px; }
}

@media (max-width: 560px) {
  h1 { font-size: 20px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 24px; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .setup-steps { grid-template-columns: 1fr; }
  .setup-steps a:last-child { grid-column: auto; }
  .glossary div { grid-template-columns: 1fr; gap: 3px; }
}

/* Keep every filter reachable and turn generated data rows into readable phone cards. */
@media (max-width: 900px) {
  .card-head .seg { width: 100%; }
  .seg { display: flex; flex-wrap: wrap; gap: 6px; overflow: visible; border: 0; background: transparent; }
  .seg button, .seg button + button { flex: 1 1 auto; min-height: 40px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
  .seg button.active { background: var(--brand-soft); border-color: var(--brand-border); }
  table.data.responsive, table.data.responsive tbody, table.data.responsive tr, table.data.responsive td { display: block; width: 100%; }
  table.data.responsive thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  table.data.responsive tbody { display: grid; gap: 10px; padding: 12px; }
  table.data.responsive tbody tr { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
  table.data.responsive td { display: grid; grid-template-columns: minmax(85px, 34%) minmax(0, 1fr); align-items: start; gap: 10px; padding: 10px 12px; text-align: left !important; white-space: normal !important; overflow-wrap: anywhere; }
  table.data.responsive td::before { content: attr(data-label); color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
  table.data.responsive .table-cell-content { min-width: 0; }
  table.data.responsive td:last-child { border-bottom: 0; }
  table.data.responsive td.col-actions .row-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; }
  table.data.responsive td.col-actions .btn { min-height: 40px; }
  .name-action { width: 40px; min-width: 40px; min-height: 40px; }
}

@media print {
  .sidebar, .topbar, .page-actions, .row-actions { display: none !important; }
  .shell { grid-template-columns: 1fr; }
}

/* Keep guidance and keyboard focus visible throughout the workspace. */
.nav-help { margin: 8px 16px; color: #cbd5e1; font-size: 12px; line-height: 1.5; }
.nav-collapsed .nav-help { display: none; }
a:focus-visible, summary:focus-visible, button:focus-visible, [tabindex="0"]:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
[data-modal-error][hidden] { display: none; }
[data-modal-error] { margin-top: 16px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Computer controls are shared by Players and Your Store. */
.visual-command-note { display:flex; align-items:flex-start; gap:7px; margin:0 0 16px; font-size:12.5px; line-height:1.5; color:var(--text-muted); }
.visual-command-note svg { flex:0 0 auto; margin-top:2px; color:var(--text-subtle); }
.visual-command-group + .visual-command-group { margin-top:16px; }
.visual-command-group h3 { display:flex; align-items:center; gap:6px; margin:0 0 8px; font-size:10.5px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--text-subtle); }
.visual-command-group h3 svg { flex:0 0 auto; }
.visual-command-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,230px),1fr)); gap:8px; }
.visual-command { display:flex; align-items:center; gap:12px; min-width:0; padding:11px 12px; text-align:left; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface-2); color:var(--text); cursor:pointer; font:inherit; }
.visual-command-icon { display:grid; place-items:center; flex:0 0 auto; width:36px; height:36px; border-radius:10px; color:var(--brand); background:var(--brand-soft); }
.visual-command.is-disruptive .visual-command-icon { color:var(--warn); background:var(--warn-soft); }
.visual-command-text { display:flex; flex-direction:column; gap:2px; min-width:0; }
.visual-command-text b { font-size:13.5px; font-weight:650; }
.visual-command-text small { font-size:12px; line-height:1.4; color:var(--text-muted); }
.visual-command:hover { border-color:var(--brand); }
.visual-command.is-disruptive:hover { border-color:var(--warn); }
.visual-command:disabled { opacity:.5; cursor:not-allowed; }
.visual-command:focus-visible { outline:2px solid var(--brand); outline-offset:2px; }
[data-command-status]:not(:empty) { margin-top:14px; font-size:12.5px; color:var(--ok); }

/* ---------- account link, auth pages ---------- */
.topbar-account { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; border-radius: var(--radius-sm); padding: 2px 6px 2px 2px; min-width: 0; }
.topbar-account:hover { background: var(--surface-3); }
.topbar-account:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Visual hierarchy shared by every CMS section. */
body { font-size: 14px; line-height: 1.55; }
h1 { font-size: 29px; font-weight: 720; letter-spacing: -.035em; line-height: 1.1; }
h2 { font-size: 18px; letter-spacing: -.02em; line-height: 1.25; }
.page { padding-top: 26px; }
.page-head { align-items: center; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.page-head p { margin-top: 5px; font-size: 14px; line-height: 1.45; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 6px; color: var(--brand); }
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.page-actions { margin-left: auto; }
.topbar { box-shadow: 0 1px 4px rgba(15, 23, 42, .035); }
.card { box-shadow: var(--shadow-sm); }
.card-head { padding: 16px 20px; }
.card-head h2 { font-size: 16.5px; }
.card-head p { margin-top: 3px; line-height: 1.45; }
.card-body { padding: 18px 20px; }
.card-foot { padding: 13px 20px; }
.btn { min-height: 40px; }
.btn-sm { min-height: 34px; }
.btn-icon { min-height: 36px; width: 36px; }
.btn-primary { box-shadow: 0 2px 5px rgba(37, 99, 235, .2); }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(37, 99, 235, .24); }
.field { gap: 7px; }
.field > label, .label { font-size: 13px; }
.field .hint { line-height: 1.5; }
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="datetime-local"], input[type="date"], input[type="time"],
input[type="url"], select, textarea { min-height: 40px; }
.form-grid { gap: 16px; }
table.data th { padding: 12px 16px; font-size: 11.5px; }
table.data td { padding: 14px 16px; }
table.data tbody tr:hover td { background: var(--surface-2); }
.badge { gap: 7px; padding: 4px 10px; font-weight: 700; }
.badge .dot { width: 7px; height: 7px; }
.badge.warn .dot { border-radius: 2px; transform: rotate(45deg); }
.badge.info .dot { border-radius: 2px; }
.badge[data-status="maintenance"] .dot { border-radius: 50%; background: transparent; border: 2px solid currentColor; width: 8px; height: 8px; }
.empty { padding: 54px 24px; }
.empty-icon { width: 60px; height: 60px; margin-bottom: 17px; border: 1px solid var(--brand-border); border-radius: 18px; background: linear-gradient(145deg, var(--surface), var(--brand-soft)); color: var(--brand); box-shadow: 0 10px 24px -17px rgba(37, 99, 235, .6); }
.empty-icon svg { width: 28px; height: 28px; }
.empty h3 { font-size: 16px; margin-bottom: 7px; }
.empty p { line-height: 1.6; }

/* Keep every action in view, with its name, without turning table rows into menus. Compact, on one line;
   Players have the most actions, so theirs sit in a strip along the bottom of each player card. */
.row-actions { display: inline-flex; flex-wrap: nowrap; align-items: center; justify-content: flex-end; gap: 5px; }
.row-actions .btn { min-height: 30px; padding: 4px 9px; gap: 5px; font-size: 12.5px; }
.row-actions .btn svg { width: 13px; height: 13px; }
table.data td.col-actions { width: 1%; white-space: nowrap; }

/* Media remains recognizable in the library and playlist editor. */
.thumb, .thumb-fallback, .video-thumb-wrap { width: 108px; height: 62px; border-radius: var(--radius-sm); }
.thumb-fallback { background: linear-gradient(145deg, var(--surface-2), var(--brand-soft)); border-color: var(--brand-border); color: var(--brand); }
.thumb-fallback svg { width: 23px; height: 23px; }
.thumb-web { padding: 6px 10px; box-sizing: border-box; overflow: hidden; background: linear-gradient(145deg, #eaf2ff, #f8fbff); }
.thumb-web-window { display: flex; flex-direction: column; width: 100%; height: 100%; overflow: hidden; border: 1px solid #9bbdfb; border-radius: 5px; background: #fff; box-shadow: 0 2px 6px #1649991c; }
.thumb-web-top { display: flex; align-items: center; gap: 3px; height: 9px; min-height: 9px; padding: 0 6px; border-bottom: 1px solid #d7e5fb; background: #f1f6ff; }
.thumb-web-top i { width: 3px; height: 3px; border-radius: 50%; background: #9bb8e5; }
.thumb-web-content { display: grid; flex: 1; place-items: center; color: var(--brand); }
.thumb-web-content svg { width: 22px; height: 22px; }
.media-row .thumb, .media-row .thumb-fallback, .media-row .video-thumb-wrap { width: 88px; height: 52px; }
.schedule-card { padding: 16px 18px; gap: 16px; transition: border-color .13s ease, box-shadow .13s ease; }
.schedule-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

@media (max-width: 900px) {
  .page { padding-top: 20px; }
  .page-head { align-items: flex-start; }
  table.data.responsive td.col-actions { width: 100%; min-width: 0; }
  .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  .row-actions .btn { min-height: 40px; }
}
@media (max-width: 560px) {
  h1 { font-size: 23px; }
  .page-head { padding-bottom: 15px; margin-bottom: 16px; }
  .card-head, .card-body { padding: 16px; }
  .empty { padding: 42px 18px; }
  .row-actions .btn { min-height: 40px; }
}
.auth-foot a { color: var(--brand); font-weight: 600; }

/* ---------- repeating schedules ---------- */
.label-text { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.day-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.day-check { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; background: var(--surface-2); }
.day-check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

/* The schedule editor keeps the everyday choices visible and groups optional tools. */
.modal.schedule-modal { width: min(640px, 100%); }
.schedule-modal .modal-body { padding: 18px 20px; }
.schedule-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 15px; }
.schedule-modal .modal-body .schedule-editor-grid > .field + .field { margin-top: 0; }
.schedule-editor-full { grid-column: 1 / -1; }
.schedule-enabled { align-self: end; min-height: 40px; justify-content: center; }
.schedule-enabled .check { min-height: 40px; }
.schedule-editor-note { margin: 12px 0 4px; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.schedule-repeat-fields { margin-top: 14px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.schedule-repeat-fields .schedule-editor-grid { margin-top: 12px; }
.schedule-repeat-fields > .hint { display: block; margin-top: 8px; color: var(--text-muted); font-size: 12px; }
.schedule-extra { border-top: 1px solid var(--border); margin-top: 8px; }
.schedule-extra > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px; color: var(--brand); font-weight: 650; cursor: pointer; list-style: none; }
.schedule-extra > summary::-webkit-details-marker { display: none; }
.schedule-extra > summary::after { content: ""; width: 7px; height: 7px; flex: 0 0 auto; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .13s ease; }
.schedule-extra[open] > summary::after { transform: rotate(225deg); }
.schedule-extra-body { display: grid; gap: 13px; padding: 2px 0 14px; }
.schedule-preview-picker { display: flex; gap: 8px; }
.schedule-preview-picker select { min-width: 0; }
.schedule-preview-picker .btn { flex: 0 0 auto; }
.schedule-extra [data-preview-result]:not(:empty) { margin-top: 9px; }

/* An on/off switch: <label class="switch"><input type="checkbox"><i></i></label> */
.switch { position: relative; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { position: relative; flex: 0 0 auto; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .3); transition: transform .15s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch input:disabled + i { opacity: .55; }

/* Schedules list */
.sched-list { display: flex; flex-direction: column; gap: 10px; }
.sched-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px 14px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; transition: border-color .13s, box-shadow .13s; }
.sched-card[tabindex] { cursor: pointer; }
.sched-card[tabindex]:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.sched-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sched-color { align-self: stretch; flex: 0 0 auto; width: 5px; margin: -14px 0; background: var(--fill); }
.sched-main { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-width: 0; }
.sched-card.is-disabled .sched-main, .sched-card.is-expired .sched-main { opacity: .62; }
.sched-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.sched-title b { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.sched-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; margin: 0; font-size: 13px; color: var(--text); }
.sched-line svg { flex: 0 0 auto; color: var(--text-subtle); }
.sched-line small { font-size: 12px; color: var(--text-muted); }
.sched-line small::before { content: "·"; margin-right: 7px; color: var(--text-subtle); }
.sched-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.sched-actions .switch { margin-right: 6px; }
.sched-actions .btn-icon { color: var(--text-muted); }
.sched-actions .sched-delete:hover { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }

/* Schedule editor */
.schedule-editor { display: flex; flex-direction: column; gap: 15px; }
.schedule-modal .schedule-editor > .field + .field, .schedule-modal .schedule-editor .schedule-extra { margin-top: 0; }
.schedule-editor .schedule-repeat-fields { margin-top: -4px; }
.schedule-editor .label-text { margin-bottom: 0; }
.schedule-editor > .field { gap: 7px; }
.sched-summary { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--brand-border); border-radius: var(--radius); background: var(--brand-soft); color: var(--text); }
.sched-summary:empty { display: none; }
.sched-summary > svg { flex: 0 0 auto; margin-top: 3px; color: var(--brand); }
.sched-summary p { margin: 0; font-size: 14px; line-height: 1.55; }
.sched-summary small { display: block; margin-top: 4px; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.sched-summary.is-off { border-color: var(--border); background: var(--surface-2); }
.sched-summary.is-off > svg { color: var(--text-subtle); }
.sched-where { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sched-where-option { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 6px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-muted); font-size: 12.5px; font-weight: 600; text-align: center; cursor: pointer; }
.sched-where-option:hover { border-color: var(--border-strong); }
.sched-where-option input { position: absolute; opacity: 0; pointer-events: none; }
.sched-where-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.sched-where-option:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.sched-day-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.sched-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.sched-enabled { font-weight: 600; }

/* Timeline: an empty spot on a screen's row starts a new schedule there */
.stl-creatable .stl-row .stl-track, .stl-creatable .stl-bar:not(.is-link) { cursor: cell; }
.stl-creatable .stl-row:hover .stl-track { box-shadow: inset 0 0 0 1px var(--brand-border); }

@media (max-width: 560px) {
  .sched-card { position: relative; flex-wrap: wrap; padding-left: 18px; }
  .sched-color { position: absolute; left: 0; top: 0; bottom: 0; margin: 0; }
  .sched-actions { width: 100%; }
  .sched-where { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .schedule-editor-grid { grid-template-columns: 1fr; }
  .schedule-enabled { justify-content: flex-start; }
  .schedule-modal .modal-body { padding: 16px; }
  .schedule-repeat-fields { padding: 12px; }
}

/* ---------- monitoring pages: one plain answer first, detail below ---------- */
.danger-text { color: var(--danger); }
.warn-text { color: var(--warn); }

.mon-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.mon-hero .grow { min-width: 0; }
.mon-hero h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.mon-hero p { margin: 3px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--text-muted); }
.mon-hero-icon { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; background: var(--surface-3); color: var(--text-subtle); }
.mon-hero-when { flex: 0 0 auto; font-size: 12px; color: var(--text-subtle); }
.mon-hero.is-ok { border-color: var(--ok-border); background: var(--ok-soft); }
.mon-hero.is-ok .mon-hero-icon { background: var(--ok); color: #fff; }
.mon-hero.is-warn { border-color: var(--warn-border); background: var(--warn-soft); }
.mon-hero.is-warn .mon-hero-icon { background: var(--warn); color: #fff; }
.mon-hero.is-danger { border-color: var(--danger-border); background: var(--danger-soft); }
.mon-hero.is-danger .mon-hero-icon { background: var(--danger); color: #fff; }
.mon-hero.is-info .mon-hero-icon { background: var(--brand); color: #fff; }

.mon-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.mon-item { display: flex; align-items: flex-start; gap: 13px; padding: 14px 16px; border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.mon-item-icon { display: grid; place-items: center; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); color: var(--text-subtle); }
.mon-item-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mon-item h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; font-size: 14.5px; font-weight: 650; overflow-wrap: anywhere; }
.mon-item p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.mon-item small { font-size: 12px; line-height: 1.5; color: var(--text-subtle); }
.mon-item small b { font-weight: 650; }
.mon-item-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; flex: 0 0 auto; }
.mon-item-actions .btn { gap: 6px; }
.mon-state { font-size: 12px; font-weight: 650; color: var(--text-muted); }
.mon-item.is-danger { border-left-color: var(--danger); }
.mon-item.is-danger .mon-item-icon { background: var(--danger-soft); color: var(--danger); }
.mon-item.is-danger small b { color: var(--danger); }
.mon-item.is-warn { border-left-color: var(--warn); }
.mon-item.is-warn .mon-item-icon, .mon-item.is-warn .mon-state { color: var(--warn); }
.mon-item.is-warn .mon-item-icon { background: var(--warn-soft); }
.mon-item.is-ok { border-left-color: var(--ok); }
.mon-item.is-ok .mon-item-icon, .mon-item.is-ok .mon-state { color: var(--ok); }
.mon-item.is-ok .mon-item-icon { background: var(--ok-soft); }
.mon-item.is-info { border-left-color: var(--brand); }
.mon-item.is-info .mon-item-icon, .mon-item.is-info .mon-state { color: var(--brand); }
.mon-item.is-info .mon-item-icon { background: var(--brand-soft); }
.mon-item.is-seen { border-left-color: var(--border-strong); box-shadow: none; }
.mon-item.is-seen .mon-item-body > h3, .mon-item.is-seen .mon-item-body > p { opacity: .7; }
.mon-seen { display: inline-flex; align-items: center; gap: 5px; }
.mon-quiet { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-muted); }
.mon-quiet:hover { border-color: var(--border); background: var(--surface-2); color: var(--text); }
.mon-danger { color: var(--danger); }
.mon-danger:hover { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger); }
.mon-foot { margin: 0 0 16px; font-size: 12.5px; color: var(--text-muted); }
#clearAlerts { margin-left: auto; }

/* Messages from players */
.mon-log-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.mon-log-scope { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-size: 12.5px; color: var(--text-muted); }
.mon-logs { list-style: none; margin: 0; padding: 4px 20px; }
.mon-log { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.mon-log:last-child { border-bottom: 0; }
.mon-log-dot { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--text-subtle); }
.mon-log.is-danger .mon-log-dot { background: var(--danger); }
.mon-log.is-warn .mon-log-dot { background: var(--warn); }
.mon-log.is-info .mon-log-dot { background: var(--brand); }
.mon-log-body { min-width: 0; flex: 1; }
.mon-log-body p { margin: 0; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.mon-log-body small { font-size: 12px; color: var(--text-subtle); }
.mon-log.is-danger small b { color: var(--danger); }
.mon-log.is-warn small b { color: var(--warn); }
.mon-log-foot { display: flex; justify-content: flex-end; padding: 10px 20px 14px; border-top: 1px solid var(--border); }
.mon-tech { margin-top: 6px; font-size: 12.5px; }
.mon-tech summary { cursor: pointer; color: var(--text-muted); font-weight: 600; }
.mon-tech pre { margin: 8px 0 0; padding: 10px 12px; max-height: 260px; overflow: auto; border-radius: var(--radius-sm); background: var(--surface-3); white-space: pre-wrap; word-break: break-word; font-size: 12px; }
.mon-facts { display: grid; margin: 0 0 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.mon-facts > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 14px; }
.mon-facts > div + div { border-top: 1px solid var(--border); }
.mon-facts dt { font-size: 12.5px; color: var(--text-muted); }
.mon-facts dd { margin: 0; font-size: 13px; font-weight: 550; overflow-wrap: anywhere; }

/* Tabs and a small download menu */
.mon-tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.mon-tabs [role="tab"] { display: inline-flex; align-items: center; gap: 7px; padding: 13px 12px 11px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-muted); font: inherit; font-size: 13.5px; font-weight: 650; white-space: nowrap; cursor: pointer; }
.mon-tabs [role="tab"]:hover { color: var(--text); }
.mon-tabs [role="tab"][aria-selected="true"] { border-bottom-color: var(--brand); color: var(--brand); }
.mon-tabs [role="tab"]:focus-visible { outline: 2px solid var(--brand); outline-offset: -4px; border-radius: var(--radius-sm); }
.mon-panel-note { margin: 0; padding: 12px 20px 0; font-size: 12.5px; color: var(--text-muted); }
.mon-menu { position: relative; margin-left: auto; }
.mon-menu > summary { list-style: none; gap: 6px; }
.mon-menu > summary::-webkit-details-marker { display: none; }
.mon-menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 290px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); }
.mon-menu-panel button { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 9px 11px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.mon-menu-panel button:hover, .mon-menu-panel button:focus-visible { background: var(--surface-2); }
.mon-menu-panel b { font-size: 13.5px; }
.mon-menu-panel small { font-size: 12px; line-height: 1.45; color: var(--text-muted); }

/* Playback history summary */
.pop-sentence { margin-bottom: 18px; }
.pop-sentence p { margin: 0; font-size: 16px; line-height: 1.55; }
.pop-sentence small { display: block; margin-top: 4px; font-size: 13px; color: var(--text-muted); }
.pop-sentence small.is-warn { color: var(--warn); font-weight: 600; }
.pop-chart-note { margin: 8px 0 0; font-size: 12px; color: var(--text-subtle); }

/* Change history: grouped by day, one sentence per change */
.audit-day { margin-bottom: 18px; }
.audit-day h3 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-subtle); }
.audit-list { list-style: none; margin: 0; padding: 4px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.audit-entry { display: flex; gap: 12px; padding: 11px 0; }
.audit-entry + .audit-entry { border-top: 1px solid var(--border); }
.audit-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 700; }
.audit-body { min-width: 0; flex: 1; }
.audit-body p { margin: 0; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.audit-body small { font-size: 12px; color: var(--text-subtle); }
.audit-more { margin-top: 5px; font-size: 12.5px; }
.audit-more summary { cursor: pointer; color: var(--text-muted); font-weight: 600; }
.audit-more dl { display: grid; gap: 3px; margin: 6px 0 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.audit-more dl > div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px; }
.audit-more dt { color: var(--text-muted); }
.audit-more dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 600px) {
  .mon-hero { flex-wrap: wrap; }
  .mon-hero-when { width: 100%; }
  .mon-item { flex-wrap: wrap; }
  .mon-item-actions { width: 100%; justify-content: flex-start; padding-left: 43px; }
  .mon-log-scope { margin-left: 0; }
  .mon-facts > div, .audit-more dl > div { grid-template-columns: 1fr; gap: 2px; }
  .mon-menu-panel { right: auto; left: 0; }
}

/* ---------- playback history ---------- */
.page-controls.pop-filters { justify-content: flex-start; }
@media (max-width: 560px) {
  .pop-filters #rangeFilter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pop-filters #rangeFilter button { min-width: 0; }
}
.pop-chart { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 160px auto; column-gap: 8px; }
.pop-chart-empty { grid-column: 1 / -1; align-self: center; text-align: center; }
.pop-chart-scale { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--text-subtle); text-align: right; padding-bottom: 1px; }
.pop-chart-plot { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--border-strong); height: 100%; }
.pop-bar-slot { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; min-width: 0; outline: none; cursor: default; }
.pop-bar-slot:hover, .pop-bar-slot:focus-visible { background: var(--surface-3); }
.pop-bar-slot:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.pop-bar { display: block; width: 100%; max-width: 28px; background: var(--brand); border-radius: 4px 4px 0 0; }
.pop-bar-value { position: absolute; top: -2px; font-size: 11px; font-weight: 600; color: var(--text-muted); transform: translateY(-100%); white-space: nowrap; }
.pop-chart-axis { grid-column: 2; display: flex; justify-content: space-between; font-size: 11px; color: var(--text-subtle); margin-top: 6px; }
.pop-chart-table { margin-top: 12px; font-size: 13px; }
.pop-chart-table summary { cursor: pointer; color: var(--text-muted); }
.pop-tooltip { position: fixed; z-index: 3000; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12px; padding: 6px 9px; border-radius: var(--radius-sm); box-shadow: var(--shadow); max-width: 280px; }

/* ---------- playlist filmstrip ---------- */
.filmstrip-panel { margin-bottom: 14px; padding: 14px 20px 18px; }
.filmstrip-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 10px; font-size: 12.5px; }
.filmstrip-title { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-subtle); }
/* Tiles grow by their seconds on screen, so width is time; a 2px surface gap separates them. */
.filmstrip { display: flex; gap: 2px; min-height: 64px; overflow-x: auto; border-radius: var(--radius-sm); }
.filmstrip-tile { position: relative; flex-shrink: 1; flex-basis: 0; min-width: 36px; height: 64px; padding: 0; overflow: hidden; border: 0; border-radius: 4px; background: var(--surface-3); color: var(--text-muted); cursor: pointer; }
.filmstrip-tile img, .filmstrip-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.filmstrip-icon { position: absolute; inset: 0; display: grid; place-items: center; color: var(--brand); background: linear-gradient(145deg, var(--surface-2), var(--brand-soft)); }
.filmstrip-pos, .filmstrip-dur { position: absolute; z-index: 1; padding: 1px 5px; border-radius: 4px; font-size: 10.5px; font-weight: 700; line-height: 1.4; color: #fff; background: rgba(8, 15, 28, .72); font-variant-numeric: tabular-nums; white-space: nowrap; }
.filmstrip-pos { top: 4px; left: 4px; }
.filmstrip-dur { right: 4px; bottom: 4px; }
.filmstrip-tile:hover, .filmstrip-tile:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.filmstrip-tile[draggable="true"] { cursor: grab; }
.filmstrip-tile.dragging { opacity: .4; }
.filmstrip-tile.drop-target { outline: 3px solid var(--brand); outline-offset: -3px; }
.filmstrip-empty { margin: 0; padding: 20px; width: 100%; text-align: center; font-size: 13px; color: var(--text-muted); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.filmstrip-scale { display: flex; justify-content: space-between; margin-top: 5px; font-size: 11px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.timeline-item.is-flash { animation: filmstrip-flash 1.4s ease; }
@keyframes filmstrip-flash { 0%, 40% { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); } 100% { box-shadow: none; } }
.playlist-usage { display: grid; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.playlist-usage p { margin: 0; font-size: 12.5px; }
.usage-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.usage-label { flex: 0 0 110px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-subtle); }
.usage-chips { display: flex; flex: 1 1 300px; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }
.usage-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 12px; text-decoration: none; }
.usage-chip:hover { border-color: var(--brand-border); background: var(--brand-soft); }
.usage-chip svg { color: var(--text-subtle); }
.usage-chip .stl-swatch { margin-right: 0; }
.usage-chip small { color: var(--text-muted); }
.usage-chip.is-off { opacity: .7; }
@media (prefers-reduced-motion: reduce) { .timeline-item.is-flash { animation: none; border-color: var(--brand); } }

/* ---------- table graphics: storage, mirrors ---------- */
.cell-sub svg { vertical-align: -2px; }

.storage-bar { display: flex; gap: 2px; width: 150px; max-width: 100%; height: 8px; margin: 6px 0 4px; }
.storage-bar span { display: block; height: 100%; border-radius: 2px; }
.storage-bar .is-media, .storage-key.is-media { background: var(--brand); }
.storage-bar .is-other, .storage-key.is-other { background: var(--text-subtle); opacity: .55; }
.storage-bar .is-free, .storage-key.is-free { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border); }
.visual-key-item i.storage-key { width: 12px; height: 8px; border-radius: 2px; }
.storage-low { color: var(--warn); font-weight: 600; }


/* ---------- player cards ---------- */
.player-cards { display: grid; gap: 12px; }
.player-card { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.player-card:has(.skeleton) { padding: 16px 18px; }
.player-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 13px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.player-card-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player-card-title h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15.5px; font-weight: 700; overflow-wrap: anywhere; }
.player-card-title h3 svg { flex: 0 0 auto; color: var(--text-subtle); }
.player-card-title .name-actions { margin-top: 0; }
.player-card-health { display: flex; flex: 1 1 280px; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; font-size: 13px; }
.player-card-health .cell-primary { font-weight: 600; }
.player-card-health .cell-sub { font-size: 12.5px; color: var(--text-muted); }
.player-card.is-warn .player-card-health .cell-primary { color: var(--warn); }
/* Four facts side by side, wrapping to two and then one column as the page narrows. */
.player-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 20px; padding: 14px 16px; }
.player-fact { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.player-fact-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-subtle); }
.player-fact-body { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.player-fact-body .cell-primary { font-weight: 600; }
.player-fact-body .cell-sub { font-size: 12px; color: var(--text-muted); }
.player-fact .storage-bar { width: 100%; max-width: 220px; }
.player-card-actions { padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.player-card-actions .row-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; }
@media (max-width: 560px) {
  .player-card-head, .player-facts, .player-card-actions { padding-left: 12px; padding-right: 12px; }
  .player-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- media library ---------- */
/* Type chips on the left, search, tag and sort on the right (in .page-controls): one row that wraps as a unit. */
.media-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 0 1 auto; }
.media-search { flex: 1 1 220px; min-width: 180px; }
.media-tools select { width: auto; min-width: 128px; }
.media-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.media-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; font: inherit; font-size: 12.5px; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; transition: border-color .14s, background .14s, color .14s; }
.media-chip svg { opacity: .75; }
.media-chip b { font-size: 12.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.media-chip:hover { border-color: var(--border-strong); }
.media-chip.is-active { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-border); }
.media-chip.is-active b { color: var(--brand); }
.media-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.media-card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color .14s, box-shadow .14s, transform .14s; }
.media-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.media-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; overflow: hidden; border: 0; border-bottom: 1px solid var(--border); background: var(--surface-3); cursor: pointer; }
.media-thumb.skeleton { border-radius: 0; cursor: default; }
.media-thumb img, .media-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.media-thumb .is-portrait { object-fit: contain; background: #0b1220; }
.media-card:hover .media-thumb img, .media-card:hover .media-thumb video { transform: scale(1.03); }
.media-thumb:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
.media-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--brand); background: linear-gradient(145deg, var(--surface-2), var(--brand-soft)); }
.media-web { position: absolute; inset: 34px 14px 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--brand-border); border-bottom: 0; border-radius: 7px 7px 0 0; background: var(--surface); box-shadow: 0 4px 14px -8px rgba(15, 23, 42, .35); }
.media-web-bar { display: flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.media-web-bar i { width: 5px; height: 5px; border-radius: 50%; background: var(--border-strong); }
.media-web-bar span { margin-left: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; color: var(--text-muted); }
.media-web-page { display: grid; flex: 1; place-items: center; color: var(--brand); background: linear-gradient(180deg, var(--surface), var(--brand-soft)); }
.media-type, .media-length { position: absolute; z-index: 1; display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 700; line-height: 1.5; color: #fff; background: rgba(8, 15, 28, .68); }
.media-type { top: 8px; left: 8px; }
.media-length { right: 8px; bottom: 8px; font-variant-numeric: tabular-nums; }
.media-zoom { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; color: #fff; background: rgba(8, 15, 28, .32); opacity: 0; transition: opacity .15s; }
.media-thumb:hover .media-zoom, .media-thumb:focus-visible .media-zoom { opacity: 1; }
.media-info { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-width: 0; padding: 11px 13px 12px; }
.media-info h3 { margin: 0; font-size: 13.5px; font-weight: 650; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta { margin: 0; font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.media-usage { display: flex; align-items: center; gap: 5px; margin: 0; font-size: 12px; color: var(--text-muted); }
.media-usage svg { flex: 0 0 auto; color: var(--text-subtle); }
.media-usage.is-unused { color: var(--text-subtle); font-style: italic; }
.media-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.media-tag { padding: 1px 8px; font: inherit; font-size: 11px; line-height: 1.6; color: var(--brand); background: var(--brand-soft); border: 1px solid var(--brand-border); border-radius: 999px; cursor: pointer; }
.media-tag:hover { border-color: var(--brand); }
.media-tag.is-more { color: var(--text-muted); background: var(--surface-2); border-color: var(--border); cursor: default; }
.media-actions { display: flex; justify-content: flex-end; gap: 2px; padding: 5px 7px; border-top: 1px solid var(--border); background: var(--surface-2); }
.media-action { display: grid; place-items: center; width: 32px; height: 30px; padding: 0; color: var(--text-muted); background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
.media-action:hover { color: var(--brand); background: var(--brand-soft); }
.media-action.is-danger:hover { color: var(--danger); background: var(--danger-soft); }
.media-action:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.media-hint { display: flex; align-items: center; gap: 7px; margin: 18px 0 0; font-size: 12px; color: var(--text-subtle); }

.media-drop-overlay { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 24px; background: rgba(10, 20, 40, .45); pointer-events: none; }
.media-drop-overlay[hidden] { display: none; }
.media-drop-overlay > div { display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(460px, 100%); padding: 38px 24px; text-align: center; color: var(--brand); background: var(--surface); border: 2px dashed var(--brand); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.media-drop-overlay b { font-size: 17px; color: var(--text); }
.media-drop-overlay span { font-size: 13px; color: var(--text-muted); }
@media (max-width: 560px) {
  .media-tools { flex: 1 1 100%; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .media-tools select { flex: 1 1 130px; }
}
@media (prefers-reduced-motion: reduce) {
  .media-card, .media-thumb img, .media-thumb video, .media-zoom { transition: none; }
  .media-card:hover { transform: none; }
  .media-card:hover .media-thumb img, .media-card:hover .media-thumb video { transform: none; }
}

/* ---------- stores ---------- */
.media-chip.is-warn b { color: var(--warn); }
.media-chip.is-warn.is-active { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }
.store-totals { display: flex; flex-wrap: wrap; gap: 8px; }
.store-totals:empty { display: none; }
.store-total { display: flex; flex-direction: column; gap: 1px; min-width: 104px; padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.store-total b { font-size: 17px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.store-total b small { font-size: 12.5px; font-weight: 600; color: var(--text-subtle); }
.store-total > span { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.store-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.store-search { flex: 0 1 300px; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }

.store-card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; transition: border-color .14s, box-shadow .14s; }
.store-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.store-card.is-current { border-color: var(--brand-border); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow-sm); }
.store-card-head { display: flex; align-items: center; gap: 12px; padding: 15px 16px 12px; }
.store-card-icon { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; color: var(--brand); background: var(--brand-soft); }
.store-card.is-warn .store-card-icon { color: var(--warn); background: var(--warn-soft); }
.store-card-id { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
.store-card-id h3 { margin: 0; font-size: 15.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-state { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-muted); }
.store-card.is-warn .store-state { color: var(--warn); font-weight: 600; }
.store-lamp { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--text-subtle); }
.store-lamp.is-ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.store-lamp.is-warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.store-lamp.is-info { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.store-card-head .badge { flex: 0 0 auto; }

/* The store's own local time: large enough to read at a glance. */
.store-clock { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 16px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.store-clock b { font-size: 24px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.store-clock span { font-size: 12px; color: var(--text-muted); }
.store-clock small { flex-basis: 100%; font-size: 11.5px; color: var(--text-subtle); }

.store-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; padding: 14px 16px 16px; }
.store-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.store-stat-label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted); }
.store-stat-label svg { flex: 0 0 auto; color: var(--text-subtle); }
.store-stat-value { display: flex; align-items: baseline; gap: 1px; }
.store-stat-value b { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.store-stat-value small { font-size: 12.5px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.store-bar { display: flex; gap: 2px; height: 5px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.store-bar span { display: block; height: 100%; }
.store-bar .is-online { background: var(--ok); }
.store-bar .is-offline { background: var(--warn); }
.store-bar .is-maintenance { background: var(--brand); }
.store-bar .is-planned { background: var(--border-strong); }

.store-card-actions { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 11px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.store-card-actions .grow { flex: 1 1 auto; }
.store-card-actions .btn { gap: 6px; }
.store-delete { width: 34px; padding: 0; justify-content: center; color: var(--text-muted); }
.store-delete:hover { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
@media (max-width: 560px) {
  .store-search { flex: 1 1 100%; }
  .store-total { flex: 1 1 0; min-width: 0; }
  .store-total > span { white-space: normal; }
}

/* ---------- clients (built on the store cards) ---------- */
.client-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; font-size: 14px; font-weight: 750; letter-spacing: .02em; color: var(--brand); background: var(--brand-soft); border: 1px solid var(--brand-border); }
.client-card.is-warn .client-avatar { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }
.store-card-id h3 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.store-card-id h3 > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-current { flex: 0 0 auto; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; color: var(--brand); background: var(--brand-soft); border: 1px solid var(--brand-border); }
.store-card .store-state { align-items: flex-start; }
.store-card .store-state .store-lamp { margin-top: 5px; }
.store-card .store-stats { padding-top: 12px; padding-bottom: 12px; }
.client-card .store-stats { padding-top: 2px; }
.store-card .store-clock { flex-direction: column; align-items: flex-start; }
.client-size { margin: 0 16px 14px; padding-top: 11px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--text-muted); }
.store-icon-btn { width: 34px; padding: 0; justify-content: center; color: var(--text-muted); }
.store-icon-btn:not(.store-delete):hover { color: var(--brand); border-color: var(--brand-border); background: var(--brand-soft); }

/* ---------- screens (built on the store cards and the "Your Store" monitor) ---------- */
/* Pages without an outer card (Clients, Stores, Players, Screens, Screen Groups, Content, Playlists, Schedules,
   Change history, Playback History): the heading, totals, filters and search
   sit on the page, and each item below is its own card. */
.page-intro { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; margin-bottom: 14px; }
.page-intro .grow { min-width: 0; flex: 1 1 320px; }
/* No heading of its own: the page title above already names the page, and the top bar names the store. */
.page-intro p { margin: 0; max-width: 80ch; font-size: 13px; color: var(--text-muted); }
.page-intro .store-total { background: var(--surface); }
.page-select { width: auto; min-width: 170px; max-width: 260px; }
.page-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 18px; }
.page-controls .media-chip:not(.is-active) { background: var(--surface); }
.visual-legend.page-legend { margin: 0 0 16px; background: var(--surface); }
/* ---------- store dialog: name and local time ---------- */
.store-form { display: flex; flex-direction: column; gap: 18px; }
.modal-body .store-form .field + .field { margin-top: 0; }
.tz-label { font-size: 13px; font-weight: 600; color: var(--text); }
.tz-box { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.tz-current { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; }
.tz-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.tz-place, .tz-clock { display: flex; flex-direction: column; min-width: 0; }
.tz-place b { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.tz-place small, .tz-clock small { font-size: 12px; color: var(--text-muted); }
.tz-clock { align-items: flex-end; text-align: right; }
.tz-clock b { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tz-picker { border-top: 1px solid var(--border); background: var(--surface-2); }
.tz-search { display: block; margin: 10px 10px 6px; max-width: none; }
.tz-search input { width: 100%; }
.tz-list { list-style: none; margin: 0; padding: 0 6px 6px; max-height: 232px; overflow-y: auto; }
.tz-list [role="option"] { display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.tz-list [role="option"]:hover { background: var(--surface-3); }
.tz-list [role="option"].is-active { background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand-border); }
.tz-list [role="option"][aria-selected="true"] { color: var(--brand); }
.tz-list [role="option"] svg { color: var(--brand); }
.tz-row-place, .tz-row-time { display: flex; flex-direction: column; min-width: 0; }
.tz-row-place b { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.tz-row-place small, .tz-row-time small { font-size: 11.5px; color: var(--text-muted); }
.tz-row-time { align-items: flex-end; }
.tz-row-time b { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tz-empty { padding: 18px 12px; font-size: 13px; line-height: 1.5; color: var(--text-muted); text-align: center; }
.tz-note { display: flex; align-items: flex-start; gap: 7px; margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.tz-note svg { flex: 0 0 auto; margin-top: 2px; }
.tz-note.is-warn { padding: 9px 11px; border: 1px solid var(--warn-border); border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); }
@media (max-width: 480px) {
  .tz-current { grid-template-columns: auto minmax(0, 1fr) auto; }
  .tz-clock { display: none; }
}

.scr-board { display: flex; flex-direction: column; gap: 18px; }
.scr-player { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); box-shadow: var(--shadow-sm); overflow: hidden; }
.scr-player-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.scr-player-head h3 { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; font-size: 15px; font-weight: 700; }
.scr-player-head h3 span { overflow-wrap: anywhere; }
.scr-player-head h3 svg { flex: 0 0 auto; color: var(--text-subtle); }
.scr-player-meta { flex: 1 1 auto; font-size: 12.5px; color: var(--text-muted); }
.scr-player-head .btn { gap: 6px; }
.scr-player-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 9px 16px; font-size: 12.5px; line-height: 1.5; color: var(--warn); background: var(--warn-soft); border-bottom: 1px solid var(--warn-border); }
.scr-player-note.is-info { color: var(--info); background: var(--info-soft); border-bottom-color: var(--info-border); }
.scr-player-note svg { flex: 0 0 auto; margin-top: 2px; }
.scr-player-note a { color: inherit; font-weight: 600; text-decoration: underline; }
.scr-player-empty { margin: 0; padding: 20px 16px; font-size: 13px; color: var(--text-muted); text-align: center; }
.scr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; padding: 14px; }

.scr-card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; transition: border-color .14s, box-shadow .14s; }
.scr-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
/* An explicit width keeps the stage edge to edge when max-height stops it keeping 16:9 on wide cards. */
.scr-card .vmon-stage { box-sizing: border-box; width: 100%; max-height: 190px; padding: 7% 10%; }
/* The face takes the colour of the playlist on screen now, as on the Schedules timeline. */
.vmon-face.scr-face { background: var(--fill); color: var(--on); font-weight: 600; }
.vmon-face.scr-face span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vmon.scr-mon-planned { background: transparent; border-style: dashed; border-color: var(--text-subtle); box-shadow: none; }

.scr-body { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; padding: 13px 15px 14px; }
.scr-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.scr-title h4 { min-width: 0; margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.scr-title .client-current { white-space: nowrap; }
.scr-title .name-actions { margin: 0 0 0 auto; }
.scr-title .name-action { width: 28px; min-width: 28px; min-height: 26px; }
.scr-card .store-state { font-size: 12.5px; }
.scr-card.is-warn .store-state { color: var(--warn); font-weight: 600; }

.wall-status { margin: 8px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.wall-status.is-error {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 8px 10px; border-radius: var(--radius);
  background: var(--danger-soft); border: 1px solid var(--danger-border); color: var(--danger);
}
.wall-status.is-error svg { flex: 0 0 auto; margin-top: 1px; }
.wall-status.is-error span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wall-status.is-error b { font-weight: 600; }
.wall-status.is-error small { font-size: 12px; color: var(--text); overflow-wrap: anywhere; }
.wall-status + .btn { align-self: flex-start; margin-top: 8px; }
.scr-card .vscreen-spec { margin: 0; }

.scr-facts { display: grid; gap: 8px; margin: 6px 0 0; padding-top: 10px; border-top: 1px dashed var(--border); }
.scr-fact { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: baseline; min-width: 0; }
.scr-fact dt { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-subtle); }
.scr-fact dd { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.scr-fact dd small { font-size: 12px; line-height: 1.45; color: var(--text-muted); }
.scr-fact .skeleton { height: 12px; }
.scr-playing { display: inline-flex; align-items: center; min-width: 0; }
.scr-playing b { font-weight: 650; }
.scr-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.scr-tags .badge { gap: 5px; white-space: normal; line-height: 1.4; }
.scr-site { display: inline-flex; align-items: center; gap: 5px; min-width: 0; color: var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scr-site svg { flex: 0 0 auto; }

.scr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
.scr-actions .btn { flex: 1 1 0; justify-content: center; gap: 6px; white-space: nowrap; }
.scr-card[data-screen] { cursor: pointer; }
.scr-card[data-screen]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- screen details drawer ---------- */
.visual-drawer.sd { width: min(520px, 100%); padding: 0; overflow: hidden; }
.visual-drawer.sd[open] { display: flex; flex-direction: column; }
.sd-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.sd-head-text { flex: 1; min-width: 0; }
.sd-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.sd-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 5px 0 0 !important; font-size: 13px; line-height: 1.4 !important; color: var(--text-muted); }
.sd-sub svg { flex: 0 0 auto; color: var(--text-subtle); }
.sd-close { flex: 0 0 auto; font-size: 20px; line-height: 1; }
.sd-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.sd-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.sd-foot .btn { gap: 6px; }
.sd-delete { color: var(--danger); border-color: transparent; background: transparent; }
.sd-delete:hover { background: var(--danger-soft); border-color: var(--danger-border); }

.sd-status { display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.sd-status .store-lamp { margin-top: 6px; }
.sd-status b { font-size: 14px; }
.sd-status p { margin: 3px 0 0 !important; font-size: 12.5px; line-height: 1.5 !important; color: var(--text-muted); }
.sd-status a { color: inherit; font-weight: 600; text-decoration: underline; white-space: nowrap; }
.sd-status.is-ok { background: var(--ok-soft); border-color: var(--ok-border); }
.sd-status.is-ok b { color: var(--ok); }
.sd-status.is-warn { background: var(--warn-soft); border-color: var(--warn-border); }
.sd-status.is-warn b, .sd-status.is-warn p { color: var(--warn); }
.sd-status.is-info { background: var(--info-soft); border-color: var(--info-border); }
.sd-status.is-info b { color: var(--info); }

.sd-hero { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; align-items: center; }
.sd-preview .vmon-stage { box-sizing: border-box; width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.sd-preview .vmon-face { font-size: 10.5px; gap: 3px; }
.sd-preview .vmon-face svg { width: 16px; height: 16px; }
.sd-label { display: block; margin-bottom: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-subtle); }
.sd-now-name { display: flex; align-items: center; gap: 2px; margin: 0 !important; font-size: 18px; font-weight: 650; line-height: 1.3 !important; letter-spacing: -.01em; overflow-wrap: anywhere; }
.sd-now-name.is-empty { color: var(--text-muted); font-weight: 600; font-size: 16px; }
.sd-now-meta { display: flex; align-items: center; gap: 5px; margin: 3px 0 0 !important; font-size: 12.5px; line-height: 1.4 !important; color: var(--text-muted); }

.sd-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sd-tools .btn { justify-content: center; gap: 7px; border: 0; border-radius: 0; box-shadow: none; min-height: 40px; white-space: nowrap; }
.sd-tools .btn + .btn { border-left: 1px solid var(--border); }
.sd-tools .btn:hover { background: var(--surface-2); }

.sd-section { display: flex; flex-direction: column; gap: 10px; }
.sd-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.visual-drawer.sd .sd-section h3 { margin: 0; }
.sd-link { font-size: 12.5px; font-weight: 600; color: var(--brand); text-decoration: none; }
.sd-link:hover { text-decoration: underline; }
.sd-card { margin: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.sd-week { padding: 2px 10px 10px; }
.sd-empty { margin: 0 !important; padding: 14px; font-size: 13px; color: var(--text-muted); text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }

.sd-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.sd-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 10px 14px; }
.sd-list li + li { border-top: 1px solid var(--border); }
.sd-list b { display: block; font-size: 13.5px; font-weight: 650; overflow-wrap: anywhere; }
.sd-list small { display: block; font-size: 12px; color: var(--text-muted); }
.sd-when { font-size: 12px; color: var(--text-muted); text-align: right; }

.sd-facts { display: grid; gap: 0; padding: 0; }
.sd-facts > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 14px; }
.sd-facts > div + div { border-top: 1px solid var(--border); }
.sd-facts dt { font-size: 12.5px; color: var(--text-muted); }
.sd-facts dd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; margin: 0; font-size: 13px; font-weight: 550; overflow-wrap: anywhere; }
.sd-facts .scr-site { white-space: normal; }

.sd-primary .btn { width: 100%; justify-content: center; gap: 7px; min-height: 40px; }
.sd-primary + .sd-tools { margin-top: -8px; }
.sd-note { margin: 0 !important; font-size: 12px; line-height: 1.5 !important; color: var(--text-subtle); }
.sd-foot-links { display: flex; gap: 8px; }
.sd-group { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.sd-group-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sd-group-head svg { flex: 0 0 auto; color: var(--text-subtle); }
.sd-group-head b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sd-group p { margin: 0 !important; font-size: 12.5px; line-height: 1.5 !important; color: var(--text-muted); }
.sd-group p a { color: inherit; font-weight: 600; text-decoration: underline; }
.sd-group .visual-wall-scroll { margin: 4px 0; }
.sd-group > .btn { align-self: flex-start; gap: 6px; }

@media (max-width: 560px) {
  .sd-head, .sd-body, .sd-foot { padding-left: 16px; padding-right: 16px; }
  .sd-hero { grid-template-columns: 1fr; }
  .sd-preview { max-width: 240px; }
  .sd-tools span { display: none; }
  .sd-list li { grid-template-columns: auto minmax(0, 1fr); }
  .sd-when { grid-column: 2; text-align: left; }
}
@media (max-width: 560px) {
  .page-controls .search { flex: 1 1 100%; }
  .scr-grid { padding: 10px; }
  .scr-player-head, .scr-player-note { padding-left: 12px; padding-right: 12px; }
}

/* ---------- screen groups (built on the screen cards) ---------- */
/* ---------- group member editor: a wall laid out as it hangs, and a screen picker ---------- */
.mw { display: flex; flex-direction: column; gap: 14px; }
.mw p { margin: 0; }
.mw-wall-frame { overflow-x: auto; padding: 2px; }
.mw-wall { display: grid; grid-template-columns: repeat(var(--cols), minmax(118px, 1fr)); gap: 5px; padding: 7px; border-radius: 10px; background: #1b2230; box-shadow: 0 6px 16px -8px rgba(15, 23, 42, .55); }
.mw-cell { position: relative; aspect-ratio: var(--ar, 1.7778); min-height: 70px; border-radius: 3px; background: #2a3344; color: #b8c3d4; outline: 1.5px dashed #56627a; outline-offset: -5px; transition: outline-color .12s, background .12s; }
.mw-cell.is-filled { background: var(--brand); color: #fff; outline: 0; }
.mw-cell.is-active { outline: 3px solid #60a5fa; outline-offset: -3px; }
.mw-cell.is-filled.is-active { box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .28); }
.mw.is-dragging .mw-cell { outline-color: #8fa0b8; }
.mw-cell.is-over { outline: 3px solid #fbbf24; outline-offset: -3px; }
.mw-cell[draggable="true"] { cursor: grab; }
.mw-cell-main { box-sizing: border-box; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 20px 10px 10px; border: 0; border-radius: inherit; background: transparent; color: inherit; font: inherit; text-align: center; cursor: pointer; }
.mw-cell-main:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.mw-cell-main small { position: absolute; top: 6px; left: 8px; font-size: 9.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; opacity: .75; }
.mw-cell-main b { max-width: 100%; font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; }
.mw-cell-main span { max-width: 100%; font-size: 11.5px; line-height: 1.3; opacity: .82; overflow-wrap: anywhere; }
.mw-cell-main svg { opacity: .8; }
.mw-clear { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .28); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; }
.mw-clear:hover { background: rgba(0, 0, 0, .5); }

.mw-status { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px; line-height: 1.5; }
.mw-status svg { flex: 0 0 auto; margin-top: 2px; }
.mw-status.is-ok { color: var(--ok); }
.mw-status.is-warn { color: var(--warn); }
.mw-tray-head { display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid var(--border); }
.mw-tray-head b { font-size: 13.5px; }
.mw-tray-head small { font-size: 12.5px; color: var(--text-muted); }

.mw-tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 8px; max-height: 264px; overflow-y: auto; padding: 2px; }
.mw-screen { position: relative; display: flex; align-items: center; gap: 11px; min-width: 0; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .12s, background .12s; }
.mw-screen:hover { border-color: var(--border-strong); }
.mw-screen:focus-visible, .mw-screen:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.mw-screen.is-placed { background: var(--surface-2); }
.mw-screen .badge { flex: 0 0 auto; margin-left: auto; }
.mw-shape { flex: 0 0 auto; height: 22px; aspect-ratio: var(--ar, 1.7778); max-width: 40px; border: 2px solid var(--text-subtle); border-radius: 3px; background: var(--surface-3); }
.mw-screen-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.mw-screen-text b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mw-screen-text small { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mw-screen-text .store-lamp { width: 6px; height: 6px; box-shadow: none; }
.mw-screen input { position: absolute; opacity: 0; pointer-events: none; }
.mw-tick { flex: 0 0 auto; display: flex; color: var(--border-strong); }
.mw-screen:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.mw-screen:has(input:checked) .mw-tick { color: var(--brand); }
@media (max-width: 560px) {
  .mw-wall { grid-template-columns: repeat(var(--cols), minmax(96px, 1fr)); }
}

.grp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
/* The drawing is an SVG scaled to fit, so a 4 × 4 wall and a single mirror both fill the same box. */
.grp-stage { position: relative; box-sizing: border-box; width: 100%; display: flex; align-items: center; justify-content: center; aspect-ratio: 16/9; max-height: 190px; background: var(--surface-3); border-bottom: 1px solid var(--border); }
.grp-svg { position: absolute; inset: 12% 10%; display: block; width: 80%; height: 76%; overflow: visible; }
.grp-svg text { text-anchor: middle; dominant-baseline: central; font-family: var(--font); font-weight: 600; }
.grp-bezel { fill: var(--vbezel); }
.grp-fill { fill: var(--fill); }
.grp-on { fill: var(--on); }
.grp-empty { fill: var(--surface); stroke: var(--text-subtle); stroke-width: 2; stroke-dasharray: 6 4; }
.grp-empty-text { fill: var(--text-subtle); font-weight: 500 !important; }
.grp-more { fill: var(--text-muted); font-weight: 700 !important; text-anchor: start !important; }
.grp-none { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-subtle); }
.grp-card .scr-title .badge { flex: 0 0 auto; }

/* Screen group dialog: mode cards, a live wall preview and the frame gaps tucked away. */
.gf { display: grid; gap: 18px; }
/* The grids space these fields, so the modal's stacked-field margin would push the second one down. */
.modal-body .gf .field + .field { margin-top: 0; }
.gf-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding: 0; border: 0; min-width: 0; }
.gf-modes legend { grid-column: 1 / -1; padding: 0; margin-bottom: 8px; }
.gf-mode { position: relative; display: block; cursor: pointer; }
.gf-mode input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.gf-mode-card { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); transition: border-color .13s, background .13s, box-shadow .13s; }
.gf-mode:hover .gf-mode-card { border-color: var(--brand-border); background: var(--surface-2); }
.gf-mode input:checked + .gf-mode-card { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.gf-mode input:focus-visible + .gf-mode-card { outline: 2px solid var(--brand); outline-offset: 2px; }
.gf-mode-art { display: flex; align-items: center; justify-content: space-between; color: var(--text-subtle); }
.gf-mode-art svg { width: 64px; height: 28px; }
.gf-mode input:checked + .gf-mode-card .gf-mode-art { color: var(--brand); }
.gf-mode-art::after { content: ""; width: 16px; height: 16px; box-sizing: border-box; border: 1.5px solid var(--border-strong); border-radius: 50%; background: var(--surface); }
.gf-mode input:checked + .gf-mode-card .gf-mode-art::after { border: 5px solid var(--brand); }
.gf-mode-text { display: flex; flex-direction: column; gap: 2px; }
.gf-mode-text b { font-size: 13.5px; font-weight: 650; color: var(--text); }
.gf-mode-text small { font-size: 12px; line-height: 1.4; color: var(--text-muted); }

.gf-wall { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.gf-wall[hidden] { display: none; }
.gf-wall-top { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 16px; align-items: center; }
.gf-preview { display: flex; align-items: center; justify-content: center; height: 136px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-3); }
.gf-preview svg { display: block; max-width: 100%; max-height: 100%; }
.gf-sky-a { stop-color: #60a5fa; }
.gf-sky-b { stop-color: #dbeafe; }
.gf-sun { fill: #fbbf24; }
.gf-hill-a { fill: #1e40af; }
.gf-hill-b { fill: #3b82f6; }
.gf-size { display: grid; gap: 10px; }
.gf-stepper { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.gf-stepper:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.gf-stepper input { min-width: 0; border: 0; border-radius: 0; text-align: center; font-weight: 650; -moz-appearance: textfield; }
.gf-stepper input:focus { box-shadow: none; }
.gf-stepper input::-webkit-inner-spin-button, .gf-stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.gf-step { flex: 0 0 34px; border: 0; background: var(--surface-2); color: var(--text-muted); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
.gf-step:first-child { border-right: 1px solid var(--border); }
.gf-step:last-child { border-left: 1px solid var(--border); }
.gf-step:hover { background: var(--surface-3); color: var(--text); }
.gf-caption { margin: 0; font-size: 12px; color: var(--text-muted); }

.gf-gaps { border-top: 1px solid var(--border); }
.gf-gaps > summary { display: flex; align-items: center; gap: 12px; padding: 12px 0 2px; cursor: pointer; list-style: none; }
.gf-gaps > summary::-webkit-details-marker { display: none; }
.gf-gaps > summary::after { content: ""; width: 7px; height: 7px; flex: 0 0 auto; margin: 0 4px 3px 0; border-right: 2px solid var(--text-subtle); border-bottom: 2px solid var(--text-subtle); transform: rotate(45deg); transition: transform .13s ease; }
.gf-gaps[open] > summary::after { transform: rotate(225deg); margin-bottom: -3px; }
.gf-gaps > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.gf-gaps-title { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.gf-gaps-title b { font-size: 13px; font-weight: 650; color: var(--text); }
.gf-gaps-title small { font-size: 12px; color: var(--text-muted); }
.gf-gaps-value { padding: 2px 8px; border-radius: 999px; background: var(--neutral-soft); color: var(--text-muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.gf-gaps-value.is-set { background: var(--brand-soft); color: var(--brand); }
.gf-gaps-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 12px; }
.gf-gaps-hint { grid-column: 1 / -1; margin: 0; font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.gf-unit { position: relative; }
.gf-unit input { padding-right: 36px; }
.gf-unit span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-size: 12.5px; color: var(--text-subtle); pointer-events: none; }

.gf-note { display: flex; gap: 8px; margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-muted); }
.gf-note svg { flex: 0 0 auto; margin-top: 1px; color: var(--text-subtle); }

@media (max-width: 560px) {
  .gf-modes, .gf-wall-top, .gf-gaps-body { grid-template-columns: 1fr; }
  .gf-preview { height: 110px; }
}

/* ---------- playlists ---------- */
/* Every playlist as a card in a grid, so they can be compared and switched at a glance.
   The script folds it to two rows behind a "Show all" button. */
.pl-picker { margin-bottom: 14px; }
.pl-picker-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 9px; }
.pl-picker-title { margin: 0; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-subtle); }
.pl-picker-search { flex: 0 1 260px; }
.pl-rail { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 10px; }
.pl-rail.is-empty { display: block; }
.pl-rail-none { margin: 10px 0 0; font-size: 12.5px; }
.pl-more { display: flex; margin: 10px auto 0; }
.pl-more[hidden] { display: none; }
.pl-card { display: flex; gap: 11px; align-items: center; min-width: 0; padding: 10px; font: inherit; text-align: left; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); cursor: pointer; transition: border-color .13s, background .13s, box-shadow .13s; }
.pl-card[hidden] { display: none; }
.pl-card:hover { border-color: var(--brand-border); }
.pl-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pl-card.is-active { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.pl-card-thumb { position: relative; flex: 0 0 auto; display: grid; place-items: center; width: 64px; height: 40px; overflow: hidden; border-radius: 6px; background: var(--surface-3); color: var(--text-subtle); }
.pl-card-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pl-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pl-card-body b { overflow: hidden; font-size: 13.5px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.pl-card-body small { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pl-card-state { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--text-subtle); }
.pl-card-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.pl-card-state.is-on, .pl-card-state.is-live { color: var(--ok); }
.pl-card-state.is-on i, .pl-card-state.is-live i { background: var(--ok); }
.pl-card-state.is-live i { box-shadow: 0 0 0 3px var(--ok-soft); }
.pl-rail-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 16px 18px; color: var(--text-subtle); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.pl-rail-empty .grow { display: flex; flex-direction: column; gap: 2px; flex: 1 1 260px; }
.pl-rail-empty b { font-size: 14px; color: var(--text); }
.pl-rail-empty small { font-size: 12.5px; color: var(--text-muted); }

/* The open playlist's name, unsaved state and Save stay in view below the top bar while editing. */
.pl-bar { position: sticky; top: var(--topbar-h); z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; padding: 10px 12px 10px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.pl-bar[hidden] { display: none; }
.pl-bar-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; flex: 1 1 260px; min-width: 0; }
.pl-bar-title h2 { max-width: 100%; margin: 0; overflow: hidden; font-size: 16.5px; text-overflow: ellipsis; white-space: nowrap; }
.pl-bar-title span { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pl-bar-status { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.pl-bar-status.is-dirty { display: inline-flex; align-items: center; gap: 6px; color: var(--warn); }
.pl-bar-status.is-dirty::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pl-bar-actions { display: flex; align-items: center; gap: 8px; }
.pl-menu { position: relative; }
.pl-menu > summary { display: inline-flex; gap: 7px; list-style: none; user-select: none; }
.pl-menu > summary::-webkit-details-marker { display: none; }
.pl-menu > summary::after { content: ""; width: 5px; height: 5px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.pl-menu[open] > summary { border-color: var(--brand); color: var(--brand); }
.pl-menu-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 200px; padding: 5px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.pl-menu-panel button { display: block; width: 100%; padding: 8px 10px; font: inherit; font-size: 13px; text-align: left; color: var(--text); background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
.pl-menu-panel button:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand); }
.pl-menu-panel button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.pl-menu-panel button.is-danger { color: var(--danger); }
.pl-menu-panel button.is-danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.pl-menu-panel hr { margin: 5px 0; border: 0; border-top: 1px solid var(--border); }

.pl-added { align-self: flex-start; margin-top: 2px; padding: 1px 8px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 11px; font-weight: 650; }
.pl-added[hidden] { display: none; }
.pl-schedule-list { display: grid; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.pl-schedule-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pl-schedule-list svg { flex: 0 0 auto; color: var(--text-subtle); }
.pl-schedule-list small { margin-left: auto; color: var(--text-muted); }

/* Timeline rows: one compact line each; picture size, position and fade open under Options. */
.timeline-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: grab; overflow: hidden; transition: border-color .14s, box-shadow .14s; }
.timeline-item:hover, .timeline-item.is-open { border-color: var(--border-strong); }
.timeline-item:hover { box-shadow: 0 5px 16px rgba(15, 23, 42, .06); }
.timeline-item:active { cursor: grabbing; }
.timeline-item.dragging { opacity: .4; }
.timeline-item.drop-target { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .16); }
.tl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 11px; padding: 8px 10px 8px 6px; }
.tl-row > .grow { display: flex; flex-direction: column; gap: 2px; flex: 1 1 160px; min-width: 0; }
.timeline-item .name { overflow: hidden; font-size: 13.5px; font-weight: 650; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.timeline-item .thumb, .timeline-item .thumb-fallback, .timeline-item .video-thumb-wrap { width: 72px; height: 44px; flex: 0 0 auto; }
.tl-move { display: flex; flex-direction: column; align-items: center; gap: 1px; flex: 0 0 auto; }
.timeline-item .pos { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 700; }
.tl-arrow { display: grid; place-items: center; width: 26px; height: 18px; padding: 0; color: var(--text-subtle); background: transparent; border: 0; border-radius: 5px; cursor: pointer; }
.tl-arrow:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.tl-arrow:disabled { opacity: .3; cursor: default; }
.tl-arrow:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; }
.tl-duration { display: flex; align-items: center; gap: 6px; width: 108px; min-height: 34px; margin-left: auto; padding: 0 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: text; }
.tl-duration:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.tl-duration.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.tl-duration svg { flex: 0 0 auto; color: var(--text-subtle); }
.tl-duration input { min-width: 0; min-height: 32px; padding: 0; font-weight: 650; font-variant-numeric: tabular-nums; background: transparent; border: 0; box-shadow: none !important; }
.tl-duration input:disabled { background: transparent; }
.tl-toggle { gap: 7px; }
.tl-toggle::after { content: ""; width: 5px; height: 5px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .13s ease; }
.tl-toggle[aria-expanded="true"] { background: var(--brand-soft); border-color: var(--brand-border); color: var(--brand); }
.tl-toggle[aria-expanded="true"]::after { transform: translateY(1px) rotate(225deg); }
.tl-remove { color: var(--text-subtle); }
.tl-remove:hover { background: var(--danger-soft); color: var(--danger); }

.tl-settings { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 28px; padding: 14px 16px 16px; background: var(--surface-2); border-top: 1px solid var(--border); cursor: default; }
.tl-settings[hidden], .tl-group[hidden] { display: none; }
.tl-group { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tl-group-wide { flex: 1 1 100%; }
.tl-label { display: flex; align-items: baseline; gap: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .065em; text-transform: uppercase; color: var(--text-subtle); }
.tl-label small { font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.tl-sizes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tl-size { position: relative; min-width: 0; cursor: pointer; }
.tl-size input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tl-size-card { display: flex; flex-direction: column; gap: 3px; height: 100%; padding: 9px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); transition: border-color .13s, background .13s, box-shadow .13s; }
.tl-size-card .scale-preview { margin-bottom: 5px; }
.tl-size-card b { font-size: 12.5px; font-weight: 650; color: var(--text); }
.tl-size-card small { font-size: 11px; line-height: 1.35; color: var(--text-muted); }
.tl-size:hover .tl-size-card { border-color: var(--brand-border); }
.tl-size input:checked + .tl-size-card { background: var(--brand-soft); border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.tl-size input:focus-visible + .tl-size-card { outline: 2px solid var(--brand); outline-offset: 2px; }
.tl-size input:disabled + .tl-size-card { cursor: default; }
/* Position: a tiny screen split into nine spots; the lit one is where the picture sits. */
.tl-pos { display: grid; grid-template-columns: repeat(3, 26px); grid-template-rows: repeat(3, 18px); gap: 3px; width: max-content; padding: 5px; background: #0f172a; border: 2px solid #334155; border-radius: 6px; }
.tl-pos-cell { position: relative; display: block; cursor: pointer; }
.tl-pos-cell input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tl-pos-cell span { display: block; width: 100%; height: 100%; border-radius: 3px; background: rgba(148, 163, 184, .22); transition: background .12s; }
.tl-pos-cell:hover span { background: rgba(148, 163, 184, .45); }
.tl-pos-cell input:checked + span { background: #60a5fa; box-shadow: inset 0 0 0 1px #fff; }
.tl-pos-cell input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.tl-fade { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tl-fade select { width: auto; min-width: 170px; min-height: 34px; font-size: 12.5px; }
.tl-fade-time { display: flex; align-items: center; width: 86px; min-height: 34px; overflow: hidden; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.tl-fade-time[hidden] { display: none; }
.tl-fade-time:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.tl-fade-time input { min-width: 0; min-height: 32px; padding: 0 3px 0 9px; text-align: right; border: 0; box-shadow: none !important; -moz-appearance: textfield; appearance: textfield; }
.tl-fade-time input::-webkit-inner-spin-button, .tl-fade-time input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.tl-fade-time span { padding-right: 9px; font-size: 12px; color: var(--text-subtle); }
.tl-video { max-width: 320px; margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.tl-link { padding: 0; font: inherit; font-weight: 600; color: var(--brand); background: none; border: 0; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

@media (max-width: 760px) {
  .tl-sizes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .pl-picker-search { flex: 1 1 100%; }
  .pl-card { padding: 8px 10px; }
  .pl-card-thumb { width: 52px; height: 34px; }
  .pl-more { width: 100%; justify-content: center; }
  .pl-bar { padding: 10px 12px; }
  .pl-bar-actions { width: 100%; }
  .pl-bar-actions .btn-primary { flex: 1 1 auto; }
  .timeline-item .thumb, .timeline-item .thumb-fallback, .timeline-item .video-thumb-wrap { width: 60px; height: 38px; }
}

/* ---------- sidebar edge handle ---------- */
/* A round tab on the sidebar's right edge, just below the top bar, pointing the way the menu will move.
   It is fixed to the edge and slides with it, so it reads as the thing that folds the menu. */
.sidebar-edge { position: fixed; z-index: 45; top: calc(var(--topbar-h) + 14px); left: calc(var(--sidebar-w) - 13px); display: grid; place-items: center; width: 26px; height: 26px; padding: 0; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 50%; box-shadow: var(--shadow-sm); cursor: pointer; transition: left .2s ease, color .14s, background .14s, border-color .14s, box-shadow .14s; }
.sidebar-edge svg { transition: transform .2s ease; }
.sidebar-edge:hover { color: #fff; background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.sidebar-edge:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Hovering the menu itself brings the handle forward, so it is found where people look. */
.sidebar:hover ~ .sidebar-edge { color: var(--brand); border-color: var(--brand-border); }
html.nav-collapsed .sidebar-edge svg { transform: rotate(180deg); }
@media (max-width: 900px) { .sidebar-edge { display: none; } }
@media (prefers-reduced-motion: reduce) { .sidebar-edge, .sidebar-edge svg { transition: none; } }
@media print { .sidebar-edge { display: none; } }
