:root { --ink:#1d2328; --muted:#6b7680; --line:#dfe3e6; --bg:#f6f7f8; --card:#fff; --accent:#1f6feb; --ok:#1a7f37; --bad:#c62828; --warn:#9a6700; }
* { box-sizing: border-box; }
body { margin:0; font:15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color:var(--ink); background:var(--bg); }
a { color:var(--accent); text-decoration:none; } a:hover { text-decoration:underline; }
main { max-width:1200px; margin:0 auto; padding:24px 16px 64px; }
/* App shell: section sidebar on the left, page on the right */
.shell { display:grid; grid-template-columns:224px minmax(0, 1fr); min-height:100vh;
  background:linear-gradient(90deg, var(--card) 0 223px, var(--line) 223px 224px, transparent 224px); }
.shell main { width:100%; min-width:0; padding:24px 28px 64px; overflow-x:auto; }
.side { position:sticky; top:0; height:100vh; overflow-y:auto; display:flex; flex-direction:column; background:var(--card); border-right:1px solid var(--line); padding:16px 12px; }
.side-top { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:0 10px 8px; }
.side .brand { font-weight:700; color:var(--ink); font-size:16px; }
.side .brand:hover { text-decoration:none; }
.side nav a { display:block; padding:5px 10px; border-radius:6px; color:var(--ink); }
.side nav a:hover { background:var(--bg); text-decoration:none; }
.side nav a.active { background:#e8f0fe; color:var(--accent); font-weight:600; }
.nav-h { margin:14px 10px 3px; font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); }
.side-foot { margin-top:auto; padding:12px 10px 0; border-top:1px solid var(--line); }
.nav-toggle { display:none; }
@media (max-width:860px) {
  .shell { grid-template-columns:1fr; grid-template-rows:auto 1fr; background:none; }
  .head { flex-wrap:wrap; }
  .side { position:static; height:auto; border-right:0; border-bottom:1px solid var(--line); padding:12px; }
  .side-top { padding:0 4px; }
  .nav-toggle { display:inline-block; }
  .side nav, .side-foot { display:none; }
  .side.open nav, .side.open .side-foot { display:block; }
  .side.open .side-foot { margin-top:12px; }
  .shell main { padding:20px 16px 64px; }
}
/* Home */
.tiles { display:grid; grid-template-columns:repeat(auto-fill, minmax(190px, 1fr)); gap:12px; margin-bottom:16px; }
.tile { display:flex; flex-direction:column; gap:2px; background:var(--card); border:1px solid var(--line); border-radius:8px; padding:14px 16px; color:var(--ink); }
.tile:hover { border-color:var(--accent); text-decoration:none; }
.tile .label { font-size:13px; color:var(--muted); font-weight:600; }
.tile .value { font-size:26px; font-weight:700; line-height:1.2; }
.tile .value.bad { color:var(--bad); } .tile .value.ok { color:var(--ok); } .tile .value.warn { color:var(--warn); }
.tile .sub { font-size:13px; color:var(--muted); }
ul.attention { list-style:none; padding:0; margin:0; }
ul.attention li { display:flex; gap:10px; align-items:baseline; padding:7px 0; border-bottom:1px solid var(--line); }
ul.attention li:last-child { border-bottom:0; }
.dot { flex:0 0 8px; width:8px; height:8px; border-radius:50%; background:var(--warn); transform:translateY(-1px); }
.dot.bad { background:var(--bad); }
h1 { font-size:22px; margin:0 0 16px; } h2 { font-size:17px; margin:0 0 12px; }
.head { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:16px; }
.head h1 { margin:0; }
.card { background:var(--card); border:1px solid var(--line); border-radius:8px; padding:16px; margin-bottom:16px; }
.narrow { max-width:480px; }
.grid2 { display:grid; grid-template-columns:1.4fr 1fr; gap:16px; align-items:start; }
@media (max-width:800px) { .grid2 { grid-template-columns:1fr; } }
label { display:block; margin-bottom:12px; font-weight:600; }
label input, label select { display:block; width:100%; margin-top:4px; font-weight:400; }
input, select, button, .button { font:inherit; padding:7px 10px; border:1px solid var(--line); border-radius:6px; background:#fff; color:var(--ink); }
button, .button { background:var(--accent); border-color:var(--accent); color:#fff; cursor:pointer; display:inline-block; }
button:hover, .button:hover { text-decoration:none; filter:brightness(1.08); }
button:disabled { opacity:.4; cursor:default; }
button.small { padding:4px 9px; font-size:13px; }
button.link { background:none; border:none; color:var(--accent); padding:0; }
button.danger, .danger { color:var(--bad); }
.inline { display:inline; }
.row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.row.tight { gap:6px; } .row input:not([type=file]) { flex:1; min-width:120px; }
.num { width:84px; flex:0 0 auto !important; min-width:0 !important; }
.code { font:600 22px/1 ui-monospace, monospace; letter-spacing:.2em; text-transform:uppercase; }
.title-input { font-size:20px; font-weight:600; }
table { width:100%; border-collapse:collapse; background:var(--card); border:1px solid var(--line); border-radius:8px; overflow:hidden; }
th, td { text-align:left; padding:9px 12px; border-bottom:1px solid var(--line); vertical-align:middle; }
th { font-size:13px; color:var(--muted); font-weight:600; background:#fafbfc; }
td.actions { white-space:nowrap; display:flex; gap:12px; }
.muted { color:var(--muted); } .warn { color:var(--warn); }
.badge { display:inline-block; padding:2px 8px; border-radius:99px; font-size:12px; font-weight:600; background:#eef1f3; color:var(--muted); }
.badge.online { background:#dcf3e2; color:var(--ok); } .badge.offline { background:#fde2e1; color:var(--bad); }
.flash { padding:10px 14px; border-radius:6px; margin-bottom:12px; background:#dcf3e2; color:#0f5323; }
.flash.error { background:#fde2e1; color:#8a1c1c; }
.thumbs { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:16px; }
.thumb { margin:0; background:var(--card); border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.thumb img { width:100%; aspect-ratio:16/9; object-fit:contain; background:#111; display:block; }
.thumb figcaption { padding:8px 10px; display:flex; flex-direction:column; gap:2px; font-size:13px; }
.thumb b { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
ol.items { list-style:none; padding:0; margin:0 0 16px; }
.item { display:flex; align-items:center; gap:12px; background:var(--card); border:1px solid var(--line); border-radius:8px; padding:8px 12px; margin-bottom:8px; flex-wrap:wrap; }
.item img { width:128px; aspect-ratio:16/9; object-fit:contain; background:#111; border-radius:4px; }
.grow { flex:1; min-width:160px; }
ul.plain { list-style:none; padding:0; margin:0; } ul.plain li { padding:6px 0; border-bottom:1px solid var(--line); }
.crumbs { margin:0 0 14px; font-size:14px; } .crumbs .sep { color:var(--muted); margin:0 4px; }
.folders { display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:10px; margin-bottom:16px; }
.folder { display:flex; flex-direction:column; gap:2px; padding:10px 12px; background:var(--card); border:1px solid var(--line); border-radius:8px; color:var(--ink); }
.folder:hover { border-color:var(--accent); text-decoration:none; }
.ficon { font-size:18px; }
.small { font-size:13px; }
.grow-select { flex:1; min-width:0; font-size:13px; padding:4px 6px; }
.folder-head { cursor:pointer; display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.warnbox { border-color:#e3c46b; background:#fffbea; }
.narrowish { max-width:760px; }
.inline-label { display:flex; gap:10px; align-items:center; margin:0; }
.inline-label select { width:auto; min-width:280px; margin:0; }
td label { display:inline; font-weight:400; margin:0; cursor:pointer; }
label.check { display: flex; gap: .5rem; align-items: baseline; }
label.check input { width: auto; }
fieldset.slots { border: 1px solid #ddd; border-radius: 6px; padding: .5rem 1rem 1rem; margin: 1rem 0; }
label.slot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; align-items: center; }
label.slot[hidden], .no-slots[hidden] { display: none; }
.days label { display: inline-flex; gap: .2rem; margin-right: .5rem; }
.days input { width: auto; }
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000 center / contain no-repeat; border-radius: 6px; overflow: hidden; user-select: none; touch-action: none; }
.ov { position: absolute; cursor: move; display: flex; align-items: center; justify-content: center; outline: 1px dashed rgba(255,255,255,.7); }
.ov-code { border-radius: 6%/10%; }
.ov-ticker { cursor: ns-resize; overflow: hidden; justify-content: flex-start; }
.ov .burst { position: absolute; inset: 0; width: 100%; height: 100%; }
.ov-text { position: relative; text-align: center; font-weight: 700; line-height: 1.15; font-family: sans-serif; white-space: nowrap; pointer-events: none; }
.ov-ticker .ov-text { width: 100%; height: 100%; display: flex; align-items: center; }
.tick { white-space: nowrap; padding-left: 100%; animation: tick linear infinite; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-100%); } }
.grip { position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; background: #fff; border: 2px solid var(--accent); border-radius: 3px; cursor: nwse-resize; }
.ov-ticker .grip { right: 50%; cursor: ns-resize; }
.pick-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
label.pick { display: flex; flex-direction: column; gap: 4px; font-weight: 400; }
label.pick img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; border-radius: 4px; }
.inline-label { display: inline-flex; align-items: center; gap: 6px; margin: 0 12px 8px 0; }
.inline-label input { width: auto; display: inline-block; margin: 0; }
h3 { font-size: 15px; margin: 16px 0 8px; }
input[type=color] { width: 52px; height: 34px; padding: 2px; cursor: pointer; }
.items-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .items-layout { grid-template-columns: 1fr; } }
.items-stage { aspect-ratio: auto; }
.box { position: absolute; border: 2px solid #1f6feb; background: rgba(31,111,235,.12); cursor: move; }
.box.selected { border-color: #E3262E; background: rgba(227,38,46,.15); z-index: 2; }
.box-label { position: absolute; left: 0; top: -1.5em; font: 600 12px/1.4 sans-serif; background: #1f6feb; color: #fff; padding: 0 4px; border-radius: 3px; white-space: nowrap; pointer-events: none; }
.box.selected .box-label { background: #E3262E; }
.items-list ol { padding-left: 20px; margin: 8px 0 0; max-height: 70vh; overflow: auto; }
.items-list li { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); }
.items-list li.selected input { border-color: #E3262E; }
.items-list li input { flex: 1 1 100%; }
button.secondary, .button.secondary { background: #fff; color: var(--accent); }
.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; }
.stock-item.is-out { color: var(--bad); }
.items-list li select.toast-pick { flex: 1 1 100%; font-size: 13px; padding: 3px 4px; }
.items-list li select.toast-pick.unlinked { color: var(--muted); }

/* Page header: title, one-line subheader, actions and Help */
.page-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:20px; flex-wrap:wrap; }
.page-title { min-width:0; flex:1 1 360px; }
.page-title h1 { margin:0 0 4px; }
.subhead { margin:0; color:var(--muted); font-size:15px; max-width:72ch; }
.page-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.page-actions form { margin:0; }
.help-btn { display:inline-flex; align-items:center; gap:6px; }
.help-q { display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; border-radius:50%;
  border:1.5px solid currentColor; font-size:12px; font-weight:700; line-height:1; }
button.secondary.danger { color:var(--bad); border-color:#f1b5b2; }
/* Help panel (slides in from the right) */
.help-backdrop { position:fixed; inset:0; background:rgba(15,20,25,.35); z-index:40; }
.help-panel { position:fixed; top:0; right:0; bottom:0; width:min(440px, 100vw); overflow-y:auto; z-index:41;
  background:var(--card); border-left:1px solid var(--line); box-shadow:-8px 0 24px rgba(0,0,0,.12); padding:20px 22px 32px; }
.help-panel[hidden], .help-backdrop[hidden] { display:none; }
.help-panel-head { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:8px; }
.help-panel-head h2 { margin:0; }
.help-panel h3, .help-topic h3 { font-size:14px; margin:16px 0 6px; }
.help-steps, .help-tips { margin:0; padding-left:20px; }
.help-steps li, .help-tips li { margin:0 0 6px; }
.help-more { margin-top:20px; padding-top:12px; border-top:1px solid var(--line); }
/* Help page */
.help-toc { display:grid; grid-template-columns:repeat(auto-fill, minmax(170px, 1fr)); gap:4px 16px; }
.help-toc .nav-h { margin:4px 0; }
.help-toc ul.plain li { border:0; padding:3px 0; }
.help-section { margin:28px 0 12px; font-size:13px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
.help-topic { scroll-margin-top:16px; }
.help-topic .head { align-items:flex-start; }
.help-topic .head h2 { margin:0 0 2px; }
.help-topic:target { border-color:var(--accent); box-shadow:0 0 0 2px #cfe0fd; }
/* Playlist folders */
.folder-bar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
.folder-bar .folder-edit-btn { margin-left:auto; }
.folder-edit { background:var(--bg); border:1px solid var(--line); border-radius:8px; padding:14px 16px; margin-bottom:14px; }
.folder-edit[hidden] { display:none; }
.folder-edit label select { width:100%; }
.folder-edit .row label { margin-bottom:0; }
.folder-danger { margin-top:12px; padding-top:10px; border-top:1px solid var(--line); }
/* Playlist settings */
.pl-settings form { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:6px 0; }
.pl-settings form + form { border-top:1px solid var(--line); }
.pl-settings .pl-label { width:150px; font-weight:600; }
.pl-settings input[name=name] { flex:0 1 340px; }
/* Signed-in user, view-only notice, sign-in page */
.me { display:flex; flex-direction:column; margin-bottom:8px; }
.me-name { font-weight:600; color:var(--ink); }
.me-name.active { color:var(--accent); }
.viewonly { padding:10px 14px; border-radius:6px; margin-bottom:12px; background:#eef1f3; color:var(--muted); font-weight:600; }
.or { display:flex; align-items:center; gap:10px; margin:16px 0; color:var(--muted); font-size:13px; }
.or::before, .or::after { content:""; flex:1; border-top:1px solid var(--line); }
.ms-btn { display:flex; align-items:center; justify-content:center; gap:10px; width:100%; }
/* Users & audit */
.role-badge { display:inline-block; padding:2px 8px; border-radius:99px; font-size:12px; font-weight:600; background:#e8f0fe; color:var(--accent); }
.role-badge.admin { background:#1d2328; color:#fff; }
tr.inactive td { color:var(--muted); }
.check-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:4px 16px; margin:6px 0 12px; }
.check-grid label { font-weight:400; margin:0; display:flex; gap:6px; align-items:center; }
.check-grid input { width:auto; margin:0; }
.role-pick label { display:flex; gap:10px; align-items:flex-start; font-weight:400; padding:8px 10px; border:1px solid var(--line); border-radius:8px; margin-bottom:6px; cursor:pointer; }
.role-pick input { width:auto; margin-top:3px; }
.role-pick label:has(input:checked) { border-color:var(--accent); background:#f3f7fe; }
.matrix td, .matrix th { text-align:center; } .matrix td:first-child, .matrix th:first-child { text-align:left; }
.audit-filters { display:flex; gap:8px; flex-wrap:wrap; align-items:flex-end; }
.audit-filters label { margin:0; font-size:13px; }
.audit-filters input, .audit-filters select { width:auto; }
.badge.refused { background:#fff4d6; color:var(--warn); } .badge.denied { background:#fde2e1; color:var(--bad); } .badge.ok { background:#dcf3e2; color:var(--ok); }
.audit-details dl { display:grid; grid-template-columns:max-content 1fr; gap:2px 12px; margin:6px 0 0; font-size:13px; }
.audit-details dt { color:var(--muted); } .audit-details dd { margin:0; word-break:break-word; }
.pager { display:flex; gap:12px; align-items:center; margin-top:12px; }
dl.kv { display:grid; grid-template-columns:max-content 1fr; gap:6px 16px; margin:0 0 8px; }
dl.kv dt { color:var(--muted); font-weight:600; } dl.kv dd { margin:0; }
/* Scheduled changes */
.sched-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; flex-wrap:wrap; margin-bottom:8px; }
.when-pick label { align-items:flex-start; }
/* Media player panel, screenshot wall */
.device-grid { display:grid; grid-template-columns:1fr 1fr; gap:20px; align-items:start; }
@media (max-width:900px) { .device-grid { grid-template-columns:1fr; } }
.shot { display:block; width:100%; aspect-ratio:16/9; object-fit:contain; background:#111; border-radius:6px; }
.shot.empty { display:flex; align-items:center; justify-content:center; color:#9aa4ae; font-size:13px; }
.wall { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); gap:14px; }
.wall figure { margin:0; background:var(--card); border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.wall figcaption { padding:8px 10px; font-size:13px; display:flex; flex-direction:column; gap:2px; }
.wall .shot { border-radius:0; }
/* Playlist run dates and history */
.item.expired { opacity:.55; }
.item-dates summary { cursor:pointer; color:var(--accent); margin-top:2px; }
.item-dates form { margin-top:6px; }
.mini-strip { display:flex; gap:4px; align-items:center; flex-wrap:wrap; }
.mini-strip img { width:48px; aspect-ratio:16/9; object-fit:cover; background:#111; border-radius:3px; }
.mini-strip .gone { width:48px; text-align:center; color:var(--bad); font-size:12px; }
/* Tags */
.tag-filter { display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-bottom:12px; }
.tag { display:inline-block; padding:3px 10px; border-radius:99px; border:1px solid var(--line); background:#fff; color:var(--ink); font-size:13px; cursor:pointer; }
button.tag { font:inherit; font-size:13px; padding:3px 10px; }
.tag:hover { border-color:var(--accent); text-decoration:none; }
.tag.on { background:#e8f0fe; border-color:var(--accent); color:var(--accent); font-weight:600; }
.tags-input { max-width:200px; }
.table-filter { width:100%; max-width:420px; margin-bottom:10px; }
.import-form input[type=file] { display:none; }
.image-search { margin-bottom:14px; max-width:560px; }
.image-search input[type=search] { flex:1; }
.wave-box { margin:6px 0 14px 26px; padding:10px 14px; border-left:3px solid var(--line); }
.wave-box[hidden] { display:none; }
.badge.awaiting { background:#fff4d6; color:var(--warn); } .badge.rejected { background:#fde2e1; color:var(--bad); }
.waves { display:flex; gap:10px; flex-wrap:wrap; margin:4px 0 8px; }
.wave { flex:1 1 220px; border:1px solid var(--line); border-radius:6px; padding:6px 10px; background:var(--bg); }
.approve-row { margin-top:10px; padding-top:10px; border-top:1px solid var(--line); }
.approve-row input { flex:1; }
.token-box { display:inline-block; padding:8px 10px; background:#fff; border:1px solid var(--line); border-radius:6px; font:600 14px ui-monospace, monospace; word-break:break-all; }
.code-block { background:#1d2328; color:#e6edf3; padding:10px 12px; border-radius:6px; font:13px/1.5 ui-monospace, monospace; overflow-x:auto; }
