/* airplay operator UI — dark broadcast theme, zero external assets */

:root {
  --bg:        #0b0e12;
  --panel:     #10141a;
  --panel-2:   #151b23;
  --border:    #242c37;
  --text:      #c8d3df;
  --text-dim:  #6b7789;
  --accent:    #3fa9f5;
  --onair:     #e5484d;
  --next:      #46c26e;
  --amber:     #e8b33e;
  --red:       #ff5257;
  --green:     #3ecf6f;
  --mono: "DejaVu Sans Mono", "Liberation Mono", Consolas, Menlo, monospace;
  --sans: system-ui, "Segoe UI", "Liberation Sans", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  display: grid;
  grid-template-rows: auto 1fr 200px auto;
  grid-template-columns: 1fr;
  height: 100vh;
  overflow: hidden;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dim  { color: var(--text-dim); }
.hidden { display: none !important; }

/* ---------- header ---------- */

#header {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: linear-gradient(180deg, #161c25, #10141a);
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
}
.hdr-block {
  padding: 2px 18px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.hdr-block:first-child { padding-left: 0; }
.hdr-right { border-right: none; margin-left: auto; flex-direction: row; align-items: center; gap: 14px; }

.chan-name { font-size: 20px; font-weight: 700; letter-spacing: 2px; color: #e8eef5; }
.chan-sub  { font-size: 10px; color: var(--text-dim); font-family: var(--mono); }
/* product link under the brand (top-left) */
.brand-link { color: var(--text-dim); text-decoration: none; }
.brand-link:hover { color: var(--accent); }
/* multi-channel selector — lives in the playlist toolbar, pushed to the right */
.tb-chan { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.tb-chan-lbl { font-size: 10px; letter-spacing: 2px; color: var(--text-dim); }
.chan-select {
  font-size: 11px; font-weight: 700; letter-spacing: .5px; color: #e8eef5;
  background: #10151d; border: 1px solid var(--border); border-radius: 4px;
  padding: 3px 8px; max-width: 220px; cursor: pointer;
}
.chan-select:hover  { border-color: var(--accent); }
.chan-select:focus  { border-color: var(--accent); outline: none; }

.lbl { font-size: 10px; letter-spacing: 1.5px; color: var(--text-dim); margin-bottom: 2px; }
.val { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.val.big { font-size: 21px; }
.sub { font-size: 11px; color: var(--text-dim); white-space: nowrap;
       overflow: hidden; text-overflow: ellipsis; }

/* fixed-width numeric slots: digits changing can never shift neighbors */
.hdr-onair .val, .hdr-onair .sub { width: 26ch; }
#oa-pos { display: inline-block; width: 11ch; }              /* 88:88:88.88 */
#oa-elapsed { display: inline-block; width: 8ch; text-align: right; }
#oa-dur     { display: inline-block; width: 8ch; }
.hdr-next .val { width: 24ch; }
#next-remain { display: inline-block; width: 7ch; }
.hdr-pos { flex: none; }
.hdr-onair, .hdr-next { flex: none; }

.hdr-onair .val #oa-id { color: var(--onair); font-weight: 700; }
.hdr-next  .val #next-id { color: var(--next); }
#next-remain { color: var(--text); }

.badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 1px 7px;
  border-radius: 3px;
  vertical-align: 1px;
}
.badge-queued   { background: #1d3a29; color: var(--next); border: 1px solid #2a5a3d; }
.badge-cued     { background: #3a2c10; color: var(--amber); border: 1px solid #7a5c1e; }
.badge-selected { background: #14283f; color: var(--accent); border: 1px solid #2a4f7c; }
.badge-locked   { background: #46181b; color: var(--red);  border: 1px solid #7c2529;
                  animation: pulse-red 1s ease-in-out infinite; }
.badge-underrun { background: #46181b; color: var(--red);  border: 1px solid #7c2529;
                  font-size: 11px; padding: 3px 10px;
                  animation: pulse-red .6s ease-in-out infinite; }
.badge-hold     { background: #3a2c10; color: var(--amber); border: 1px solid #7a5c1e;
                  font-size: 11px; padding: 3px 10px;
                  animation: pulse-red 1.4s ease-in-out infinite; }

@keyframes pulse-red  { 50% { opacity: .45; } }
@keyframes pulse-onair { 50% { background: rgba(229, 72, 77, .28); } }

/* progress bar */
.progress-track {
  margin-top: 4px;
  height: 5px;
  width: 100%;
  min-width: 220px;
  background: #1b222c;
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--green);
  border-radius: 3px;
  transition: width .2s linear;
}
.progress-fill.p-amber { background: var(--amber); }
.progress-fill.p-red   { background: var(--red); animation: pulse-red .6s ease-in-out infinite; }
.pos-sub { margin-top: 3px; }

/* stale link: counter frozen + dimmed, red border — never ticks blind */
.hdr-pos.stale {
  outline: 1px solid var(--red);
  outline-offset: -2px;
  border-radius: 4px;
}
.hdr-pos.stale .val,
.hdr-pos.stale .sub,
.hdr-pos.stale .progress-track { opacity: .35; }
.conn-bad { color: var(--red); font-weight: 700; letter-spacing: 1px; }

/* conn dot */
.conn { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-dim); }
.conn #conn-txt { display: inline-block; width: 8ch; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green); box-shadow: 0 0 7px var(--green); }
.dot-red   { background: var(--red);   box-shadow: 0 0 7px var(--red); }

/* bottom status bar */
#statusbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 3px 14px;
  background: #0d1015;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
}
.sb-right { margin-left: auto; display: flex; gap: 18px; }
.sb-admin { color: var(--accent); text-decoration: none; letter-spacing: 1px; }
.sb-admin:hover { color: #fff; }
.sb-item { white-space: nowrap; }
.sb-age  { display: inline-block; width: 6ch; text-align: right; }
.sb-gen  { display: inline-block; width: 6ch; text-align: right; }
.sb-time { display: inline-block; width: 9ch; }

/* ---------- buttons ---------- */

.btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
}
.btn:hover  { border-color: var(--accent); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
/* soft-disabled: dimmed but still clickable so the click can log WHY */
.btn.btn-off { opacity: .35; cursor: default; }
.btn.btn-off:hover { border-color: var(--border); color: var(--text); }
.btn-danger:hover { border-color: var(--red); color: var(--red); }

.btn-skip {
  background: #2a1214;
  border-color: #7c2529;
  color: var(--red);
  font-size: 13px;
  padding: 8px 22px;
}
.btn-skip:hover { border-color: var(--red); color: #fff; background: #46181b; }
/* badges: reserved fixed-width slot so chips appearing never shift the clock */
.badges {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  min-width: 170px;
  flex: none;
}
.badges .badge { text-align: center; min-width: 84px; }

/* wall clock: fixed slot */
.wall-clock {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e8eef5;
  letter-spacing: 1px;
  padding: 0 10px;
  display: inline-block;
  width: calc(8ch + 20px);
  text-align: center;
  flex: none;
}
.wall-clock.cued {
  color: var(--red);
  animation: pulse-red .8s ease-in-out infinite;
}
.wall-clock.cued-air { color: #ff9b9e; }

/* transport cluster: pill buttons inside a distinct boxed panel so the
   controls read as one unit against the rest of the nav bar. Violet family:
   deliberately OUTSIDE the reserved semantics (red=on-air/cued,
   green=next/go, amber=hold/offline) so idle pills never read as state. */
.tp-box {
  background: #1a1230;
  border: 1px solid #4c3d7a;
  border-radius: 10px;
  padding: 5px 8px 7px;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(167, 139, 250, .08);
}
.tp-lbl {
  font-size: 8px;
  letter-spacing: 2px;
  color: #8f7fc0;
  margin: 0 0 3px 6px;
}
.transport {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 300px;
  flex: none;
}
.tp-row { display: flex; gap: 4px; }
.btn.tp {
  flex: 1 1 0;               /* equal fixed shares of the row width */
  font-size: 10px;
  padding: 4px 8px;
  letter-spacing: .3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 999px;      /* pill */
  color: #06121e;            /* dark text on the bright semantic fills */
  font-weight: 700;
  border-color: transparent;
}
/* per-button bright semantic fills; .btn-off (the JS toggles it on non-
   actionable buttons, e.g. START while playing) dims to opacity .35 — that IS
   the "dim for non-active" effect, matching the playlist toolbar colours */
.btn.tp-start { background: var(--green); }
.btn.tp-stop  { background: var(--red); }
.btn.tp-pause { background: var(--amber); }
.btn.tp-skip  { background: #ff7a3d; }
.btn.tp-sched { background: var(--accent); }
.btn.tp:not(.btn-off):hover { filter: brightness(1.14); color: #06121e; }
/* emphasis states layered on the bright base */
.tp-start.go { box-shadow: 0 0 10px rgba(62, 207, 111, .5); }                       /* ready to start */
.tp-pause.paused {                                                                  /* PAUSED — RESUME to continue */
  background: var(--green);
  animation: pulse-red 1.4s ease-in-out infinite;
}
.btn-hold.held, .btn.tp.held { background: var(--amber); }
.tp-skip.armed, .btn-skip.armed {
  background: var(--red);
  color: #fff;
  border-color: #fff;
  box-shadow: 0 0 10px rgba(255, 82, 87, .65);
  animation: pulse-red .5s ease-in-out infinite;
}

/* ---------- main panes ---------- */

#main {
  display: grid;
  grid-template-columns: 1fr 400px;
  min-height: 0;
}

.pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-right: 1px solid var(--border);
  outline: none;
}
.pane:last-child { border-right: none; }
.pane:focus { box-shadow: inset 0 0 0 2px var(--accent); }

.pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.pane-title { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--text-dim); }
.pane-info  { font-size: 10px; color: var(--text-dim); }
.pane-actions { margin-left: auto; display: flex; gap: 8px; }

.pane-body { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.pane-foot {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
/* row-actions bar moved to the TOP of the playlist pane */
.pane-foot.pane-foot-top {
  border-top: none;
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
}

/* collapsible right-panel sections (more function blocks land here later) */
.sect-head { cursor: pointer; user-select: none; }
.sect-head:hover .pane-title { color: var(--text); }
.sect-caret {
  display: inline-block;
  width: 1.2ch;
  color: var(--text-dim);
  font-size: 11px;
}
.sect-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.sect-body.collapsed { display: none; }

/* ---------- tables ---------- */

.tbl { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
.tbl thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 1px;
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}
.tbl td {
  padding: 4px 8px;
  border-bottom: 1px solid #171d26;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.tbl th.c-num, .tbl td.c-num { text-align: right; }
/* playlist table: FIXED layout (colgroup in index.php) — no cell content
   (state names, glyphs, long media names) can ever re-flow the columns,
   which used to shift the whole panel left at switchover */
#playlist-tbl { table-layout: fixed; }
/* visible column separators (body rows; the header draws its own via
   box-shadow below) */
#playlist-tbl td + td { border-left: 1px solid #1e2733; }
/* per-column header hues — bright media-suite palette. Static colors, so
   they never collide with the row-state semantics (red=on-air, green=next,
   amber=offline/hold). Backgrounds stay opaque: the header is sticky and
   rows scroll beneath it. The underline + separator are INSET BOX-SHADOWS,
   not borders: under border-collapse, cell borders are painted at the
   row's in-flow position and vanish from a stuck sticky header the moment
   the list scrolls — shadows travel with the cell. */
#playlist-tbl thead th:nth-child(1) { color: #4fc3f7; background: #15222d;
  box-shadow: inset 0 -2px 0 #4fc3f7; }
#playlist-tbl thead th:nth-child(2) { color: #b39dfa; background: #1c1a2e;
  box-shadow: inset 1px 0 0 #2c3746, inset 0 -2px 0 #b39dfa; }
#playlist-tbl thead th:nth-child(3) { color: #f472b6; background: #271724;
  box-shadow: inset 1px 0 0 #2c3746, inset 0 -2px 0 #f472b6; }
#playlist-tbl thead th:nth-child(4) { color: #2dd4bf; background: #12262a;
  box-shadow: inset 1px 0 0 #2c3746, inset 0 -2px 0 #2dd4bf; }
#playlist-tbl thead th:nth-child(5) { color: #fb923c; background: #2a1f14;
  box-shadow: inset 1px 0 0 #2c3746, inset 0 -2px 0 #fb923c; }
#playlist-tbl thead th:nth-child(6) { color: #22d3ee; background: #12252b;
  box-shadow: inset 1px 0 0 #2c3746, inset 0 -2px 0 #22d3ee; }
#playlist-tbl thead th:nth-child(7) { color: #c084fc; background: #221a2e;
  box-shadow: inset 1px 0 0 #2c3746, inset 0 -2px 0 #c084fc; }
/* draggable column-resize grips on the header cells (app.js initColResize);
   widths persist on disk via prefs.php. MUST stay sticky: this ID-scoped
   rule outweighs .tbl thead th, and position:relative here would silently
   kill the pinned header (sticky is already a containing block for the
   absolutely-positioned grips). */
#playlist-tbl thead th { position: sticky; }
.col-grip {
  position: absolute;
  top: 0;
  right: -5px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  z-index: 2;
}
.col-grip:hover {
  background: linear-gradient(90deg, transparent 4px,
              var(--accent) 4px, var(--accent) 6px, transparent 6px);
}
body.col-resizing { cursor: col-resize; user-select: none; }
/* START cell: marker glyphs (▶ on-air / ▷ next / ◷ fixed) live in a fixed
   slot ahead of the time so their appearance never moves the time text */
.start-cell { text-align: left; }
.row-mark {
  display: inline-block;
  width: 2.8ch;
  overflow: hidden;
  vertical-align: bottom;
}
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: #171e28; }

/* row states */
tr.sel        { background: #1c2a3a !important; box-shadow: inset 2px 0 0 var(--accent); }
tr.row-onair  {
  background: rgba(229, 72, 77, .16);
  animation: pulse-onair 2s ease-in-out infinite;
}
tr.row-onair td:first-child { color: var(--onair); font-weight: 700; }
tr.row-next td:first-child  { color: var(--next); font-weight: 700; }
tr.row-played { opacity: .38; }
tr.row-failed td { color: var(--red); }

.st { font-size: 10px; letter-spacing: .5px; }
.st-on_air    { color: var(--onair); font-weight: 700; }
.st-preloaded { color: var(--next); }
.st-staged    { color: var(--accent); }
.st-validated { color: var(--text-dim); }
.st-played, .st-archived, .st-skipped { color: var(--text-dim); }
.st-offline   { color: var(--amber); }
.st-staging_failed { color: var(--red); }

/* lock glyph: fixed reserved slot, visibility-toggled — display:none would
   change the STATUS column content width and breathe the table */
.lock-glyph {
  display: inline-block;
  width: 1.8ch;
  overflow: hidden;
  color: var(--red);
  font-weight: 700;
  margin-left: 5px;
  vertical-align: bottom;
}
.lock-glyph.glyph-off { visibility: hidden; }
.noidx { color: var(--amber); }
.start-proj  { color: var(--text-dim); font-style: italic; }

/* detached (offline) playlist */
tr.row-detached { filter: saturate(.45); }
tr.row-detached td { color: #a9b4c2; }
.pane-title.offline { color: var(--amber); }

/* paused: frozen pause-point timecode, dimmed */
.hdr-pos.frozen .val { opacity: .55; }
.start-fixed { color: var(--accent); font-weight: 700; }

/* schedule-start inline editor (START cell) */
td.time-edit {
  background: #0d1f30 !important;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.time-input { color: var(--accent); font-weight: 700; }
.time-input .tc-pending { color: #2c4a66; }

/* SOM inline timecode editor */
td.som-edit {
  background: #21160a !important;
  box-shadow: inset 0 0 0 1px var(--amber);
}
.som-input { color: var(--amber); font-weight: 700; }
.som-input .tc-pending { color: #6b5a33; }

/* content cursor row (keyboard) */
tr.cursor td:first-child { box-shadow: inset 2px 0 0 var(--text-dim); }

/* ---------- asset catalog (§10) ---------- */

/* content rows by catalog status: grey (arriving) -> amber (transcoding)
   -> normal (ready); red for failed/missing */
tr.ast-new td         { color: var(--text-dim); }
tr.ast-transcoding td { color: var(--amber); }
tr.ast-failed td,
tr.ast-missing td     { color: var(--red); }
tr.ast-ready .ast-id  { color: var(--green); }
/* §10.6: playable but violates the channel profile — operator must decide */
tr.ast-noncomp td       { color: #fb923c; }
tr.ast-noncomp .ast-id  { color: #fb923c; font-weight: 700; }
#content-tbl tbody tr[draggable="true"] { cursor: grab; }

/* playlist ↔ catalog verify flags on the MEDIA cell */
td.cat-miss    { color: var(--red) !important; text-decoration: underline wavy; }
td.cat-pend    { color: var(--amber) !important; }
td.cat-drift   { color: var(--amber) !important; text-decoration: underline dotted; }
td.cat-noncomp { color: #fb923c !important; text-decoration: underline dotted; }

/* drag & drop */
tr.drop-hint { box-shadow: inset 0 -2px 0 var(--accent); }
#playlist-body.drop-target { outline: 1px dashed var(--accent); outline-offset: -2px; }

/* DB SYNC toolbar toggle */
.btn-dbsync.active {
  background: #14283f;
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- live events (§12): __live__ marker rows + insert modal ---------- */
/* an armed live marker is state "skipped" but it HOLDS air — never dim it like
   a finished row; amber = the "on-air-alternate" language of .badge-hold */
tr.row-live td              { color: #e8dcc0; }
tr.row-live td:first-child  { color: var(--amber); font-weight: 700; }
.row-mark.mark-live         { color: var(--amber); }
.st-live { color: var(--amber); font-weight: 700; letter-spacing: .5px; }
.pill-live {
  display: inline-block;
  background: #3a2c10; color: var(--amber); border: 1px solid #7a5c1e;
  border-radius: 3px; font-size: 10px; font-weight: 700; letter-spacing: .5px;
  padding: 0 6px; margin-right: 7px;
}
.live-mode { color: var(--text-dim); font-size: 11px; }
/* header ON-AIR block reading LIVE while held at a marker */
#oa-id.hdr-live { color: var(--amber); animation: pulse-red 1.4s ease-in-out infinite; }
/* footer insert-live button */
.btn-live { color: var(--amber); border-color: #7a5c1e; }
.btn-live:hover { background: #3a2c10; }

/* live-event insert modal */
.modal-live { width: 520px; }
.live-help { padding: 4px 16px 10px; color: #c7d2de; font-size: 12.5px; line-height: 1.55; }
.live-opt {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 7px 16px; font-size: 12.5px; color: #d7e2ee; cursor: pointer;
}
.live-opt:hover  { background: #171e28; }
.live-opt input  { margin-top: 2px; }
.live-dur-row    { padding: 8px 16px 2px; }
.live-dur-lbl    { font-size: 12px; color: var(--text-dim); }
.live-dur {
  width: 110px; margin-left: 8px; padding: 4px 7px;
  background: #0d1117; border: 1px solid var(--border); border-radius: 3px;
  color: var(--amber); font-weight: 700;
}
.live-dur:disabled { opacity: .4; color: var(--text-dim); }
.live-note {
  padding: 6px 16px 2px; color: var(--text-dim); font-size: 11.5px;
  min-height: 2.4em; line-height: 1.5;
}

/* as-run export modal */
.asr-row { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 6px 16px 4px; }
.asr-lbl { font-size: 10px; letter-spacing: 1px; color: var(--text-dim); display: flex; flex-direction: column; gap: 3px; }
.asr-dt {
  background: #0d1117; border: 1px solid var(--border); border-radius: 4px;
  color: var(--text); padding: 5px 7px; font-family: var(--mono); font-size: 12px;
}
.asr-dt:focus { border-color: var(--accent); outline: none; }
.asr-rule { padding: 4px 16px; color: var(--amber); }
.asr-preview {
  margin: 6px 16px; padding: 10px 12px; background: #0d1117; border: 1px solid var(--border);
  border-radius: 4px; color: #c7d2de; font-size: 12px; line-height: 1.6; white-space: pre-wrap;
  min-height: 5em;
}

/* ---------- log ---------- */

#log-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--border);
  background: #0d1015;
}
#log-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
}
.log-line       { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-time       { color: var(--text-dim); margin-right: 8px; }

/* log tabs + archive viewer (§11 Phase 1) */
.logtab.active {
  background: #14283f;
  border-color: var(--accent);
  color: var(--accent);
}
#log-archive {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
#log-archive.hidden { display: none; }
.la-days {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
}
.la-days .btn.active { border-color: var(--accent); color: var(--accent); }
.la-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
}
.log-err        { color: var(--red); }
.log-warn       { color: var(--amber); }
.log-good       { color: var(--green); }
.log-ev         { color: #9fb6cc; }

/* playlist toolbar */
.pl-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: #0e1218;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.toolbar-lbl { font-size: 10px; letter-spacing: 2px; color: var(--text-dim); margin-right: 6px; }
.btn-sm { font-size: 10px; padding: 4px 10px; letter-spacing: .5px; }

/* modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 9, .72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal {
  width: 560px;
  max-width: 92vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .6);
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-head .btn { margin-left: auto; }
.modal-body { flex: 1; overflow-y: auto; min-height: 120px; padding: 6px 0; }
.modal-foot {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.plm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-bottom: 1px solid #171d26;
  font-family: var(--mono);
  font-size: 12px;
}
.plm-row:hover { background: #171e28; }
.plm-name { font-weight: 700; color: #d7e2ee; }
.plm-info { color: var(--text-dim); font-size: 10.5px; }
.plm-acts { margin-left: auto; display: flex; gap: 5px; }
.plm-empty { padding: 20px 14px; color: var(--text-dim); font-size: 12px; }

/* asset info modal (click-to-copy metadata card) */
.modal-meta { width: 640px; }
.meta-text {
  padding: 12px 16px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #d7e2ee;
  white-space: pre;
  overflow-x: auto;
  user-select: text;
}
#meta-copied { color: var(--green); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a3341; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3a4658; }

/* ---- find & replace modal ---- */
.fr-grid { display: flex; gap: 24px; }
.fr-col { flex: 1; }
.fr-lbl { font-size: 10px; letter-spacing: 1px; color: var(--accent); margin-bottom: 8px; text-transform: uppercase; }
.fr-f { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 10px; }
.fr-f input { display: block; width: 100%; margin-top: 3px; background: var(--bg); color: var(--text);
              border: 1px solid var(--border); border-radius: 4px; padding: 7px 9px; font-size: 13px; }
.fr-f input:focus { border-color: var(--accent); outline: none; }
.fr-f input:disabled { opacity: .4; }
.fr-chk { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text); margin-bottom: 10px; cursor: pointer; }
.fr-chk input { width: auto; }
.fr-note { font-size: 11px; color: var(--text-dim); line-height: 1.6; margin: 10px 0 12px; }
.fr-preview { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; }
.fr-preview:empty { display: none; }
.fr-prow { padding: 5px 10px; font-family: var(--mono); font-size: 12px; border-bottom: 1px solid #171d26; color: #cfe0f0; }
.fr-empty { padding: 16px; text-align: center; color: var(--text-dim); font-size: 12px; }

/* ---- playlist modal: searchable list box + coloured toolbar ---- */
.plm-body { display: flex; flex-direction: column; }
.plm-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; }
.plm-search { flex: 1; min-width: 160px; background: var(--bg); color: var(--text);
              border: 1px solid var(--border); border-radius: 4px; padding: 7px 10px; font-size: 13px; }
.plm-search:focus { border-color: var(--accent); outline: none; }
.plm-actbar { display: flex; gap: 6px; }
.plm-sel-info { flex-basis: 100%; font-size: 11px; color: var(--text-dim); }
.plm-listbox { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.plm-item { display: flex; justify-content: space-between; align-items: center; gap: 12px;
            padding: 7px 12px; cursor: pointer; border-bottom: 1px solid #141a22; }
.plm-item:hover { background: var(--panel-2); }
.plm-item.sel { background: #143050; }
.plm-item-name { font-size: 13px; color: #dbe6f2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plm-item.sel .plm-item-name { color: #fff; font-weight: 600; }
.plm-item-meta { font-size: 11px; color: var(--text-dim); flex: none; }
.plm-empty { padding: 20px; text-align: center; color: var(--text-dim); font-size: 12.5px; }

/* selection-action buttons (bright when a file is selected) */
.plm-act:not(:disabled) { color: #06121e; font-weight: 700; border-color: transparent; }
.plm-act-load:not(:disabled)   { background: var(--green); }
.plm-act-append:not(:disabled) { background: var(--accent); }
.plm-act-dl:not(:disabled)     { background: #7f8a9c; }
.plm-act:not(:disabled):hover  { filter: brightness(1.12); color: #06121e; }

/* bright, distinct toolbar buttons matching the app palette */
.plm-tb { color: #06121e; font-weight: 700; border-color: transparent; }
.plm-tb:hover { filter: brightness(1.12); color: #06121e; }
.plm-tb-new    { background: var(--green); }
.plm-tb-save   { background: var(--accent); }
.plm-tb-upload { background: #9b7bff; }
.plm-tb-import { background: #2ec9c2; }
.plm-tb-rev    { background: #ff9d42; }
.plm-tb-find   { background: #ff6fae; }
.plm-tb-dl     { background: #7f8a9c; }
/* DB SYNC: an amber toggle — muted off, bright on (overrides the old dark-blue active) */
.plm-tb-sync { background: #7a6320; color: #f0dca8; }
.btn-dbsync.active { background: var(--amber); color: #06121e; border-color: var(--amber);
                     box-shadow: 0 0 8px rgba(232,179,62,.55); }

/* Preview of the selected channel (preview.js) */
.pv-box { background: #000; aspect-ratio: 16 / 9; margin: 0 8px 8px; border: 1px solid #222a35; }
.pv-box video { width: 100%; height: 100%; display: block; }
.pv-state { margin-left: auto; font-size: 11px; color: #8b95a5; }
.pv-state.ok { color: #34d399; }
.pv-state.err { color: #f87171; }
