/* 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; }
.scale-guide { margin: 12px 12px 0; border: 1px solid var(--brand-border); border-radius: var(--radius); background: var(--brand-soft); }
.scale-guide summary { padding: 10px 12px; cursor: pointer; color: var(--text); font-size: 12.5px; font-weight: 700; }
.scale-guide-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 0 12px 10px; }
.scale-guide-option { display: flex; align-items: center; gap: 9px; min-width: 0; }
.scale-guide-option > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.scale-guide-option b { font-size: 12px; color: var(--text); }
.scale-guide-option small { color: var(--text-muted); font-size: 10.5px; line-height: 1.25; }
.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-guide-tip { margin: 0; padding: 0 12px 11px; color: var(--text-muted); font-size: 11px; }
.timeline-item {
  display: block;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: grab; overflow: hidden;
  transition: border-color .14s, box-shadow .14s, transform .14s;
}
.timeline-item:hover { border-color: var(--border-strong); 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); }
.timeline-item-head { display: flex; gap: 11px; align-items: center; padding: 11px 12px; }
.timeline-item .grow { flex: 1 1 auto; min-width: 0; }
.timeline-item .name { font-size: 13.5px; font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-item .thumb, .timeline-item .thumb-fallback, .timeline-item .video-thumb-wrap { width: 70px; height: 44px; }
.timeline-item .pos {
  width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
}
.timeline-settings {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px 16px;
  padding: 15px 16px 16px; border-top: 1px solid var(--border); background: var(--surface-2);
}
.timeline-item .timeline-control { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.timeline-item .timeline-control .hint { font-size: 10px; font-weight: 700; letter-spacing: .065em; text-transform: uppercase; color: var(--text-subtle); line-height: 1.3; }
.timeline-item .timeline-control select,
.timeline-item .timeline-control input { width: 100%; min-height: 34px; padding: 5px 30px 5px 9px; font-size: 12.5px; background-color: var(--surface); }
.timeline-item .duration-parts { display: grid; grid-template-columns: repeat(3,minmax(48px,1fr)); gap: 5px; }
.timeline-item .duration-parts label { display: flex; align-items: center; min-width: 0; min-height: 34px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.timeline-item .duration-parts label:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.timeline-item .duration-parts input { min-width: 0; width: 100%; border: 0; box-shadow: none; text-align: right; padding: 5px 3px 5px 5px; -moz-appearance: textfield; }
.timeline-item .duration-parts input:focus { box-shadow: none; }
.timeline-item .duration-parts span { padding-right: 5px; color: var(--text-subtle); font-size: 10px; }
.timeline-item .duration-parts input::-webkit-inner-spin-button, .timeline-item .duration-parts input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.timeline-item [data-setting="fade_duration_seconds"] { -moz-appearance: textfield; appearance: textfield; }
.timeline-item [data-setting="fade_duration_seconds"]::-webkit-inner-spin-button,
.timeline-item [data-setting="fade_duration_seconds"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.timeline-item-head > .btn { flex: 0 0 auto; align-self: center; }
.drag-handle { color: var(--text-subtle); flex: 0 0 auto; display: grid; place-items: center; }
.drag-handle svg { width: 15px; height: 15px; }

@media (max-width: 760px) {
  .timeline-settings { grid-template-columns: 1fr 1fr; padding: 12px; }
  .scale-guide-options { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .timeline-item-head { gap: 8px; }
  .timeline-item .thumb, .timeline-item .thumb-fallback, .timeline-item .video-thumb-wrap { width: 56px; height: 38px; }
  .timeline-settings { grid-template-columns: 1fr; }
}

/* ---------- 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) ---------- */

.wall-grid { display: grid; gap: 10px; }
.wall-cell {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); padding: 10px; min-height: 92px;
  display: flex; flex-direction: column; gap: 6px;
}
.wall-cell .coord { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-subtle); }
.wall-cell.filled { background: var(--brand-soft); border-color: var(--brand-border); }
.wall-cell select { font-size: 12.5px; min-height: 32px; }

/* ---------- 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; }
.timeline-item .thumb, .timeline-item .thumb-fallback, .timeline-item .video-thumb-wrap { width: 94px; height: 56px; }
.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; }
}
@media (max-width: 480px) {
  .timeline-item .thumb, .timeline-item .thumb-fallback, .timeline-item .video-thumb-wrap { width: 64px; height: 42px; }
}
.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; }
@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; }
}

/* Alerts read as one list instead of cards nested inside a card. */
.alerts-panel { border: 0; background: transparent; box-shadow: none; overflow: visible; }
.alerts-panel .card-head { padding: 0 0 14px; border: 0; background: transparent; }
.alerts-panel .alerts-list { padding: 8px 22px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.alerts-list .empty { padding: 32px 16px; }
.alerts-list .alert-row { position: relative; border: 0; border-radius: 0; border-bottom: 1px solid var(--border); padding: 18px 0 18px 20px; margin: 0; background: transparent; box-shadow: none; transition: none; }
.alerts-list .alert-row::before { content: ""; position: absolute; top: 24px; left: 1px; width: 8px; height: 8px; border-radius: 50%; background: var(--text-subtle); }
.alerts-list .alert-row:has(.badge.danger)::before { background: var(--danger); }
.alerts-list .alert-row:has(.badge.warn)::before { background: var(--warn); }
.alerts-list .alert-row:has(.badge.info)::before { background: var(--brand); }
.alerts-list .alert-row:hover { border-color: var(--border); box-shadow: none; }
.alerts-list .alert-row:last-child { border-bottom: 0; }
.alerts-list .alert-row.is-disabled { opacity: .72; }
.alerts-list .alert-row .route { line-height: 1.4; }
.alerts-list .alert-row .meta { line-height: 1.5; column-gap: 9px; row-gap: 3px; }
.alerts-list .alert-row .meta .sep { display: none; }
@media (max-width: 600px) {
  .alerts-panel .card-head { gap: 12px; }
  .alerts-panel .alerts-list { padding: 4px 16px; }
  .alerts-list .alert-row { align-items: flex-start; padding: 16px 0 16px 18px; gap: 12px; }
  .alerts-list .alert-row::before { top: 22px; }
  .alerts-list .alert-row .row-actions { margin-left: 0; justify-content: flex-start; }
}

/* ---------- playback history ---------- */
.page-controls.pop-filters { justify-content: flex-start; }
.pop-export-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; max-width: 100%; }
@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-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); }
.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; }
@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) ---------- */
.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; }

/* Playlists: the picker and its buttons sit on the page, lined up on the select's baseline. */
.playlist-controls { align-items: flex-end; }
.playlist-pick { flex: 0 1 340px; min-width: 220px; }
.playlist-controls .page-actions { margin-left: auto; justify-content: flex-end; }
@media (max-width: 560px) {
  .playlist-pick { flex: 1 1 100%; }
  .playlist-controls .page-actions { margin-left: 0; justify-content: flex-start; }
}

/* ---------- 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; } }
