:root {
  --bg: #0a0c0f;
  --panel: #111419;
  --panel2: #161a21;
  --line: #222832;
  --line2: #2c3440;
  --text: #e8ebf0;
  --muted: #8b94a3;
  --dim: #5d6573;
  --rec: #34d399;
  --stall: #f87171;
  --warn: #fbbf24;
  --live: #60a5fa;
  --off: #6b7280;
  --radius: 14px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 14px 26px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; letter-spacing: .2px; font-size: 17px; }
.brand svg { width: 26px; height: 26px; }
.brand svg path { fill: var(--rec); }
.brand svg circle { fill: var(--bg); }
.summary { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 600; }
.chip.bad { border-color: color-mix(in srgb, var(--stall) 45%, var(--line)); color: #fca5a5; }
.chip.bad b { color: #fecaca; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--off); }
.dot.rec { background: var(--rec); box-shadow: 0 0 0 0 color-mix(in srgb, var(--rec) 60%, transparent); animation: pulse 2.4s infinite; }
.dot.stall { background: var(--stall); }
.dot.warn { background: var(--warn); }
.dot.live { background: var(--live); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); } 70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
.tools { display: flex; gap: 10px; align-items: center; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 13px; }
.seg button[aria-selected="true"] { background: var(--line2); color: var(--text); }
#search {
  width: 210px; padding: 7px 12px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line); outline: none; font-size: 13px;
}
#search:focus { border-color: var(--line2); }

/* ---------- home: 3D racks + list ---------- */
html, body { height: 100%; }
body { display: flex; flex-direction: column; }
.home { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
.home[hidden] { display: none; }
.scene { position: relative; min-height: 420px; background: radial-gradient(ellipse at 50% 30%, #151a22, var(--bg) 70%); overflow: hidden; }
.scene > canvas { display: block; }
.scene-hint { position: absolute; left: 16px; bottom: 12px; font-size: 12px; color: var(--dim); pointer-events: none; z-index: 1; }
.side { border-left: 1px solid var(--line); overflow-y: auto; padding: 16px 18px 40px; background: var(--panel); }
.rack { margin-bottom: 22px; }
.rack h2 { font-size: 15px; font-weight: 650; margin: 0 0 10px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.rack h2 small { color: var(--muted); font-weight: 400; font-size: 12px; }
.group-focus { padding: 0; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.group-focus:hover { color: var(--rec); }
.group-focus:focus-visible { outline: 1px solid var(--rec); outline-offset: 3px; }
.location-note { color: var(--muted); }
.cages { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cagecard { position: relative; display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); cursor: pointer; transition: border-color .15s, background .15s; }
.cagecard:hover, .cagecard:focus-within { border-color: var(--line2); background: #1a1f27; outline: none; }
.cagecard.bad { border-color: color-mix(in srgb, var(--stall) 40%, var(--line)); }
.cagecard .num::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.cagecard .mini { position: relative; z-index: 1; }
.cagecard .num { color: inherit; text-decoration: none; width: 26px; text-align: center; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.cagecard .num small { display: block; font-size: 9px; color: var(--muted); font-weight: 500; }
.minis { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.mini { position: relative; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; background: #07090b; display: grid; place-items: center; text-decoration: none; border: 1px solid transparent; }
.mini img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mini .thumb { position: absolute; top: 0; bottom: 0; left: 50%; aspect-ratio: 16 / 9; transform: translateX(-50%); background-repeat: no-repeat; }
.mini .dot { position: absolute; left: 5px; top: 5px; }
.mini b { position: absolute; right: 5px; bottom: 3px; font-size: 11px; text-shadow: 0 1px 2px #000; }
.mini:hover { border-color: var(--text); }
.mini.empty { color: var(--dim); font-size: 11px; background: repeating-linear-gradient(135deg, #0c0e12 0 6px, #0e1116 6px 12px); }
.note { color: var(--dim); font-size: 11.5px; line-height: 1.45; }
.note.detect small { display: block; color: var(--dim); }
.note.detect.live { color: var(--muted); }
.note.detect.stale, .note.detect.unknown { color: #fcd9a0; }
/* A cage or camera the network scan placed, with no row in addresses.csv yet. */
.found-tag { position: absolute; top: -6px; left: 2px; z-index: 2; font-style: normal; font-size: 9px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: #0a0c0f; background: var(--rec); border-radius: 4px; padding: 0 3px; }
.mini.found { border-color: color-mix(in srgb, var(--rec) 55%, var(--line)); }
/* A cage the hourly occupancy check found a mouse in (admin/occupancy.py). */
.mouse-tag { position: absolute; top: -5px; right: 2px; z-index: 2; font-style: normal; font-size: 11px; line-height: 1; }
.where.mice { color: var(--dim); }
.where.mice.seen { color: var(--text); }
.legacy { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 12px; }
.legacy summary { cursor: pointer; color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: baseline; }
.legacy summary small { color: var(--dim); font-size: 11.5px; }
.legacy-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lcam { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); text-decoration: none; font-size: 12px; color: var(--muted); }
.lcam:hover { color: var(--text); border-color: var(--line2); }
.lcam small { color: var(--dim); }

/* ---------- viewer ---------- */
.viewer {
  position: fixed; inset: 0; z-index: 10; background: var(--bg);
  display: grid; grid-template-rows: auto 1fr auto;
}
.viewer[hidden] { display: none; }
.vbar { display: flex; align-items: center; gap: 18px; padding: 12px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.back { text-decoration: none; color: var(--muted); font-size: 13.5px; padding: 6px 10px; border-radius: 8px; }
.back:hover { background: var(--panel); color: var(--text); }
.vtitle { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; flex-wrap: wrap; }
.seg[hidden] { display: none; }
.vtitle h1 { font-size: 18px; margin: 0; font-weight: 650; white-space: nowrap; }
.vcams { display: flex; gap: 8px; flex-wrap: wrap; }
.vlinks { display: flex; gap: 8px; flex-wrap: wrap; }
.vlinks a, .vlinks button, .ghost {
  font-size: 12.5px; padding: 6px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line);
  text-decoration: none; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.vlinks a:hover, .vlinks button:hover, .ghost:hover { color: var(--text); border-color: var(--line2); }

.vbody { display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-height: 0; }
.stage { display: grid; gap: 10px; padding: 12px 16px; min-height: 0; grid-template-columns: repeat(var(--n, 1), minmax(0, 1fr)); }
.vside { border-left: 1px solid var(--line); padding: 12px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.vside h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 10px 0 2px; font-weight: 600; }
.schem svg { width: 100%; height: auto; display: block; }
.where { font-size: 12px; color: var(--muted); }
.where small { color: var(--dim); }
.caminfo { text-align: left; padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; display: grid; gap: 3px; }
.caminfo.on { border-color: var(--text); }
.caminfo .row1 { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.caminfo .row1 span { color: var(--muted); margin-left: auto; font-size: 12px; }
.caminfo .row2 { font-size: 11.5px; color: var(--dim); }
.recording-availability { padding: 0 10px 12px; display: grid; gap: 4px; color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; }
.recording-availability b { color: var(--text); font-size: 11.5px; margin-top: 5px; }
.recording-availability small { color: var(--muted); font-size: 10.5px; }
.coverage-status { color: var(--muted); font-size: 11px; }
.pager { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.pg { text-align: center; padding: 5px 0; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pg:hover { color: var(--text); }
.pg.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.pg.bad:not(.on) { border-color: color-mix(in srgb, var(--stall) 50%, var(--line)); }
.vsub { display: flex; gap: 8px; flex-wrap: wrap; }
.pane { position: relative; background: #050607; border-radius: 12px; overflow: hidden; min-height: 0; border: 1px solid var(--line); display: grid; }
.pane video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; min-height: 0; }
.pane .pstill { position: absolute; inset: 0; pointer-events: none; }
.pane .pstill:empty { display: none; }
.pane .poster { width: 100%; height: 100%; object-fit: contain; display: block; filter: blur(2px) brightness(.85); }
.pane .plabel { position: absolute; left: 12px; top: 10px; display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; text-shadow: 0 1px 3px #000; }
.pane .ptime { position: absolute; right: 12px; top: 10px; font-size: 13px; font-variant-numeric: tabular-nums; padding: 3px 8px; border-radius: 6px; background: rgba(0, 0, 0, .55); }
.pane .pnote { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 14px; padding: 20px; background: rgba(5, 6, 7, .72); }
.pane .pnote[hidden] { display: none; }
.pane .pnote button { margin-top: 10px; }
.pane .flip { position: absolute; right: 12px; bottom: 12px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.15); background: rgba(10,12,15,.7); backdrop-filter: blur(6px); font-size: 20px; cursor: pointer; }
.pane .flip:hover { background: rgba(40,46,56,.85); }
.pane .flip[hidden] { display: none; }
.pane .pnote .small { font-size: 12px; color: var(--dim); margin-top: 6px; }
.pane .pnote .btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--text); animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.badge-live { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 2px 7px; border-radius: 5px; background: #b91c1c; color: #fff; letter-spacing: .4px; }

.playbar { border-top: 1px solid var(--line); background: var(--panel); padding: 10px 16px 14px; display: grid; gap: 10px; }
.playbar[hidden] { display: none; }
.transport { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.transport .icon { min-width: 48px; padding: 7px 9px; border-radius: 9px; background: var(--panel2); border: 1px solid var(--line); cursor: pointer; font-size: 12.5px; color: var(--muted); }
.transport .icon:hover { color: var(--text); }
.transport .play { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--text); color: var(--bg); font-size: 15px; cursor: pointer; }
.clock { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; margin: 0 10px; min-width: 250px; }
.speed { color: var(--muted); font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
.speed select, .goto input { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: 12.5px; }
.goto { display: flex; gap: 6px; margin-left: auto; }
.goto button { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 12.5px; }

.days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.day {
  flex: none; display: grid; gap: 4px; padding: 6px 10px; border-radius: 9px; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: left; min-width: 74px;
}
.day b { color: var(--text); font-weight: 600; font-size: 12.5px; }
.day[aria-selected="true"] { border-color: var(--text); color: var(--text); }
.day .bar { height: 3px; border-radius: 2px; background: var(--line2); overflow: hidden; }
.day .bar i { display: block; height: 100%; background: var(--rec); }

.timeline { position: relative; height: 128px; user-select: none; }
.timeline canvas { width: 100%; height: 100%; display: block; cursor: crosshair; border-radius: 10px; background: #0c0f13; border: 1px solid var(--line); }
.timeline.dragging canvas { cursor: grabbing; }
.tip {
  position: absolute; bottom: calc(100% + 8px); transform: translateX(-50%); pointer-events: none; z-index: 3;
  background: #000; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; width: 240px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.tip img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; background: #0c0f13; }
.tip img[src=""] { visibility: hidden; }
.tip div { padding: 6px 9px; font-size: 12px; font-variant-numeric: tabular-nums; color: #cbd2dc; }
.zoom { position: absolute; right: 8px; top: 6px; display: flex; gap: 2px; background: rgba(10, 12, 15, .7); border-radius: 7px; padding: 2px; }
.zoom button { border: 0; background: none; font-size: 11px; color: var(--muted); padding: 3px 7px; border-radius: 5px; cursor: pointer; }
.zoom button:hover { color: var(--text); background: var(--line); }


/* ---------- camera settings ---------- */
.navlink { font-size: 13px; color: var(--muted); text-decoration: none; padding: 6px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); white-space: nowrap; }
.navlink:hover { color: var(--text); border-color: var(--line2); }
.navlink[aria-current="page"] { color: var(--text); border-color: var(--text); }
.tv { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 250px; }
.tv[hidden] { display: none; }
.tvstage { position: relative; background: #000; min-height: 0; overflow: hidden; }
.tvstage video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tvstill { position: absolute; inset: 0; pointer-events: none; }
.tvstill:empty { display: none; }
.tvstill .poster { width: 100%; height: 100%; object-fit: contain; display: block; filter: blur(2px) brightness(.85); }
.tvnote { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 15px; padding: 20px; }
.tvnote:empty { display: none; }
.tvcap { position: absolute; left: 18px; bottom: 16px; display: flex; gap: 10px; align-items: baseline; padding: 8px 14px; border-radius: 12px; background: rgba(5, 6, 7, .62); backdrop-filter: blur(6px); font-size: 14px; color: var(--muted); }
.tvcap:empty { display: none; }
.tvcap a { color: var(--text); font-weight: 700; font-size: 20px; text-decoration: none; }
.tvfull { position: absolute; right: 16px; bottom: 16px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,.15); background: rgba(10,12,15,.7); font-size: 18px; cursor: pointer; opacity: .55; }
.tvfull:hover { opacity: 1; }
.tvstage:fullscreen .tvfull { display: none; }
.tvside { border-left: 1px solid var(--line); background: var(--panel); padding: 16px 16px 30px; overflow-y: auto; font-size: 13px; }
.tvside h3 { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.tvrow { display: grid; grid-template-columns: 74px 1fr 34px; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 7px; text-decoration: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.tvrow:hover { background: var(--panel2); color: var(--text); }
.tvrow.on { color: var(--text); font-weight: 600; }
.tvrow .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.tvrow .bar i { display: block; height: 100%; background: #34d399; }
.tvrow span:last-child { text-align: right; }
.tvside p { color: var(--dim); font-size: 12px; line-height: 1.5; margin: 14px 0 0; }
@media (max-width: 800px) { .tv { grid-template-columns: 1fr; } .tvside { display: none; } }
.settings-page { flex: 1; min-height: 0; overflow-y: auto; padding: 0 26px 90px; }
.set-head { padding-top: 18px; }
.settings-page[hidden] { display: none; }
.set-head h1 { font-size: 18px; margin: 0 0 6px; font-weight: 650; }
.set-help { color: var(--muted); font-size: 12.5px; line-height: 1.5; max-width: 980px; margin: 0 0 4px; }
.set-help:last-child { margin-bottom: 14px; }
.set-help b { color: var(--text); font-weight: 600; }
.set-banner { padding: 9px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 12px; background: var(--panel); border: 1px solid var(--line); }
.set-banner.bad { border-color: color-mix(in srgb, var(--stall) 45%, var(--line)); color: #fca5a5; }
/* no scroll box of its own on a wide page, so the column names stay in view while the page scrolls */
.set-table-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.set-table thead th:first-child { border-top-left-radius: var(--radius); }
.set-table thead th:last-child { border-top-right-radius: var(--radius); }
.set-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.set-table th, .set-table td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.set-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; position: sticky; top: 0; z-index: 2; background: var(--panel); box-shadow: 0 1px 0 var(--line); }
.set-table .set-group th { background: var(--panel2); color: var(--text); font-size: 12px; text-transform: none; letter-spacing: 0; }
.set-table td.c { text-align: center; }
.set-table td.st { color: var(--muted); }
.set-table td.st .dot { margin-right: 7px; vertical-align: middle; }
.set-table td.rec { color: var(--dim); font-size: 12px; }
.set-table .mono { font-variant-numeric: tabular-nums; }
.set-table .mono small { color: var(--dim); margin-left: 8px; font-size: 11.5px; }
.set-table a { color: var(--text); text-decoration: none; }
.set-table a:hover { text-decoration: underline; }
.set-table input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--rec); cursor: pointer; }
.set-table select { background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 3px 6px; font-size: 12.5px; }
/* a cage's line, then one smaller line per camera */
.set-table tr.set-cage td { border-bottom: 0; padding-top: 9px; padding-bottom: 4px; }
.set-table tr.set-cage td:first-child a { font-weight: 650; font-size: 13.5px; }
.set-table td.who { color: var(--muted); font-size: 12px; }
.set-table td.who .differ { color: var(--warn); }
.set-table tr.set-cam td { border-bottom: 0; padding-top: 2px; padding-bottom: 2px; font-size: 12px; color: var(--muted); }
.set-table tr.set-cam.last td { border-bottom: 1px solid var(--line); padding-bottom: 9px; }
.set-table tr.set-cam td.ab { padding-left: 30px; }
.set-table tr.set-cam a { color: var(--muted); }
.set-table tr.set-cam input[type=checkbox] { width: 13px; height: 13px; }
.set-table tr.set-cam select { font-size: 11.5px; padding: 1px 4px; }
.set-table tr.set-cam :is(td.c, td.stream):not(.changed, .differs) > * { opacity: .5; }
.set-table tr.set-cam :is(td.c, td.stream) > *:is(:hover, :focus-visible) { opacity: 1; }
.set-table td.mixed input, .set-table td.mixed select { accent-color: var(--warn); border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.set-table tr.pending td { background: color-mix(in srgb, var(--warn) 6%, transparent); }
.set-table td.changed > * { outline: 1.5px solid color-mix(in srgb, var(--warn) 75%, transparent); outline-offset: 3px; border-radius: 5px; }
.set-table tr.focus td { background: color-mix(in srgb, var(--live) 10%, transparent); }
.set-bar { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 160%); transition: transform .2s; z-index: 6;
  display: flex; gap: 10px; align-items: center; min-width: min(640px, 92vw); max-width: 92vw; padding: 10px 12px 10px 16px;
  border-radius: 12px; background: var(--panel2); border: 1px solid var(--line2); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-size: 13px; }
.set-bar:not(.on) { visibility: hidden; }
.set-bar.on { transform: translate(-50%, 0); }
.set-bar .grow { flex: 1; }
.set-msg.bad { color: #fca5a5; }
.set-busy { display: inline-flex; gap: 9px; align-items: center; color: var(--muted); }
.spinner.small { width: 14px; height: 14px; margin: 0; }
button.primary { font-size: 13px; padding: 6px 14px; border-radius: 8px; border: 0; background: var(--text); color: var(--bg); cursor: pointer; font-weight: 600; }
button.primary:disabled { opacity: .45; cursor: default; }
.cfgline { display: flex; gap: 8px; align-items: baseline; padding: 0 10px 4px; font-size: 11.5px; color: var(--muted); text-decoration: none; }
.cfgline b { margin-left: auto; color: var(--dim); font-weight: 500; }
.cfgline:hover b { color: var(--text); }

/* ---------- dashboards ---------- */
body.screen .top { display: none; }
.dash { flex: 1; min-height: 0; display: flex; }
.dash[hidden] { display: none; }
.dash .grow { flex: 1; }
.dash-board { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #000; position: relative; }
.dash-board:fullscreen { width: 100vw; height: 100vh; }
.dash-bar { display: flex; align-items: center; gap: 12px; padding: 3px 10px; background: var(--bg); font-size: 12.5px; }
.dash-bar .back { padding: 2px 8px; }
.dash-bar .ghost { padding: 3px 9px; font-size: 12px; }
.dash-title { margin: 0; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-clock { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); }
/* watching a dashboard: header and bar lie over the video, shown while the mouse moves (dash.js) */
body.dash-watch .top { position: fixed; top: 0; left: 0; right: 0; transition: opacity .3s; }
body.dash-watch .dash-bar { position: absolute; top: var(--top-h, 0); left: 0; right: 0; z-index: 3; background: rgba(10, 12, 15, .85);
  backdrop-filter: blur(8px); padding: 6px 12px; transition: opacity .3s; }
body.dash-watch .dash-board:fullscreen .dash-bar { top: 0; }
body.dash-watch:not(.dash-awake) .top, body.dash-watch:not(.dash-awake) .dash-bar { opacity: 0; pointer-events: none; }
body.dash-watch:not(.dash-awake), body.dash-watch:not(.dash-awake) * { cursor: none; }
.dash-grid { flex: 1; min-height: 0; overflow: hidden; display: grid; gap: 4px; align-content: center; justify-content: center;
  grid-template-columns: repeat(var(--k, 2), var(--tw, 320px)); grid-auto-rows: var(--th, 260px); }
.dash-grid.cols { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: var(--tw, 320px);
  grid-template-rows: repeat(var(--k, 2), var(--th, 260px)); grid-auto-rows: unset; }
.dtile { position: relative; background: #050607; border-radius: 4px; overflow: hidden; border: 2px solid #1b2028; min-width: 0; min-height: 0; }
.dtile video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.dtile .pstill { position: absolute; inset: 0; pointer-events: none; }
.dtile .pstill:empty { display: none; }
.dtile .poster { width: 100%; height: 100%; object-fit: contain; display: block; filter: blur(2px) brightness(.8); }
.dtile .pnote { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13px; padding: 14px; background: rgba(5, 6, 7, .65); }
.dtile .pnote[hidden] { display: none; }
.dtile.empty { border-style: dashed; }
.dcap { --c: #9ca3af; position: absolute; left: 5px; top: 5px; max-width: calc(100% - 10px); display: flex; gap: 6px; align-items: center;
  font-size: clamp(10px, calc(var(--th, 260px) * .032), 14px); line-height: 1.2; text-decoration: none; color: #d6dbe2;
  padding: 2px 7px; border-radius: 5px; background: rgba(0, 0, 0, .5); white-space: nowrap; overflow: hidden; }
.dcap b { color: color-mix(in srgb, var(--c) 55%, #fff); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.dcap span { color: #aab2bd; flex: none; }
.dcap .dot { width: 6px; height: 6px; flex: none; }
.dfill { min-width: 0; }
.dash-empty { grid-column: 1 / -1; align-self: center; color: var(--muted); text-align: center; padding: 40px; }
.dash-edit { width: 360px; flex: none; border-left: 1px solid var(--line); background: var(--panel); padding: 14px 16px 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.dash-edit h2 { margin: 0; font-size: 15px; }
.dfield { display: flex; flex-direction: column; gap: 7px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
.dfield > *:not(.note) { text-transform: none; letter-spacing: 0; font-weight: 400; }
.dfield .note { text-transform: none; letter-spacing: 0; font-weight: 400; margin: 0; }
.dash-edit input[type=text], .dash-edit select { width: 100%; padding: 7px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line2); font-size: 13.5px; color: var(--text); }
.dradio { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--text); cursor: pointer; }
.drows { display: flex; flex-direction: column; gap: 8px; }
.drow { display: flex; flex-direction: column; gap: 6px; padding: 9px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); }
.drow1 { display: flex; gap: 6px; align-items: center; }
.drow1 select { width: auto; flex: 1 1 auto; min-width: 0; }
.dside { display: inline-flex; gap: 3px; align-items: center; font-size: 13px; color: var(--text); cursor: pointer; }
.dside.missing { color: var(--dim); text-decoration: line-through; }
.drow .icon { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; padding: 0; flex: none; }
.drow .icon:hover:not(:disabled) { color: var(--text); border-color: var(--line2); }
.drow .icon:disabled { opacity: .35; cursor: default; }
.dlink { display: flex; gap: 6px; }
.dlink input { font-size: 12px !important; color: var(--muted) !important; }
.dbar { position: sticky; bottom: 0; margin-top: auto; display: flex; gap: 8px; align-items: center; padding: 12px 0 14px; background: var(--panel); border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.ghost.danger:hover { color: #fca5a5; border-color: color-mix(in srgb, var(--stall) 45%, var(--line)); }
.dash-list { flex: 1; overflow-y: auto; padding: 22px 26px 60px; max-width: 1100px; }
.dash-list h1 { margin: 0; font-size: 22px; }
.dash-list-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.dash-list-head a.primary { font-size: 13px; padding: 7px 14px; border-radius: 8px; background: var(--text); color: var(--bg); text-decoration: none; font-weight: 600; }
.dash-list > .note { font-size: 13px; margin: 0 0 18px; }
.dash-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.dash-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.dash-card-title { font-size: 16px; font-weight: 650; text-decoration: none; }
.dash-card-title:hover { text-decoration: underline; }
.dash-card ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.dash-card li b { color: var(--text); font-weight: 600; }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 7px; background: #3a4250; }
.dash-card-links { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-none { color: var(--muted); }
@media (max-width: 900px) {
  .dash { flex-direction: column; }
  .dash-board { min-height: 70vh; }
  .dash-edit { width: auto; border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 900px) {
  .set-table-wrap { overflow-x: auto; }
  .home { grid-template-columns: 1fr; grid-template-rows: 55vh auto; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .vbody { grid-template-columns: 1fr; }
  .vside { border-left: 0; }
}
@media (max-width: 760px) {
  .top { padding: 12px 14px; }
  .stage { grid-template-columns: 1fr; }
  .clock { min-width: 0; font-size: 16px; }
}
