:root {
  --bg: #f6f7f9; --panel: #fff; --text: #1b1f24; --muted: #667085; --border: #e3e6ea;
  --accent: #2f6fed; --accent-text: #fff; --danger: #d92d20; --ok: #12a150; --rec: #e5484d;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111417; --panel: #1a1e23; --text: #e8eaed; --muted: #98a2b3; --border: #2b3139; --accent: #5b8cff; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--panel); }
header h1 { font-size: 18px; margin: 0; }
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.narrow { max-width: 520px; margin: 40px auto; }
h2 { font-size: 16px; margin: 0 0 12px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, textarea, select { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
textarea { min-height: 90px; }
button { padding: 8px 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); font: inherit; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; min-height: 1.2em; }
.hidden { display: none !important; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.on { background: var(--ok); }
.thumb { width: 120px; height: 68px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); background: var(--bg); }
code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.grid figure { margin: 0; cursor: pointer; }
.grid img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.grid figcaption { font-size: 12px; color: var(--muted); }
.timeline { position: relative; height: 28px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin: 8px 0 4px; }
.timeline .seg { position: absolute; min-width: 3px; top: 0; bottom: 0; background: var(--accent); opacity: .75; }
.timeline .tick { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ok); }
.scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 10; flex-direction: column; gap: 10px; }
.lightbox img, .lightbox video { max-width: 94vw; max-height: 85vh; border-radius: 6px; }
.lightbox .cap { color: #ddd; font-size: 13px; }
.stat { font-size: 28px; font-weight: 600; }
.status-banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); }
.status-banner.live { border-color: var(--rec); }
.rec { width: 12px; height: 12px; border-radius: 50%; background: var(--rec); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.consent { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; color: var(--text); font-size: 14px; }
.check input { width: auto; margin-top: 4px; }
ul.log { list-style: none; padding: 0; margin: 0; font-size: 13px; color: var(--muted); max-height: 160px; overflow: auto; }
@media (max-width: 640px) { .hide-sm { display: none; } header { padding: 12px 16px; } }
.badge { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-text); vertical-align: middle; margin-left: 6px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg); cursor: pointer; }
.card:hover { border-color: var(--accent); }
.card img, .card .noimg { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: var(--border); }
.card .body { padding: 10px 12px; }
.card .name { font-weight: 600; }
.nav-active { border-color: var(--accent); color: var(--accent); }
body:not(.is-owner) .owner-only { display: none !important; }
body.is-owner .not-owner { display: none !important; }
button.big { width: 100%; padding: 14px; font-size: 16px; font-weight: 600; margin-top: 8px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.role-tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); background: var(--panel); }
.livegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
@media (max-width: 640px) { .livegrid { grid-template-columns: 1fr; } }
.livetile { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #000; cursor: zoom-in; position: relative; }
.livetile img, .livetile .noimg { width: 100%; aspect-ratio: 16/9; object-fit: contain; display: block; background: #111; }
.livetile .bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel); color: var(--text); }
.livetile .livedot { position: absolute; top: 10px; right: 10px; background: var(--rec); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; letter-spacing: .05em; }
.livetile .stale { background: #8a8a8a; }
.shift { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; background: var(--panel); }
.shift > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.shift > summary::-webkit-details-marker { display: none; }
.shift[open] > summary { border-bottom: 1px solid var(--border); }
.shift .inner { padding: 14px; }
.player video { width: 100%; max-height: 70vh; background: #000; border-radius: 6px; }
.seglist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.seglist button { font-size: 12px; padding: 4px 8px; }
.seglist button.on { border-color: var(--accent); color: var(--accent); }
.livetile video { width: 100%; aspect-ratio: 16/9; object-fit: contain; display: block; background: #111; }
.lightbox video#lbVideo { background: #000; }

.ts th, .ts td { white-space: nowrap; text-align: right; }
.ts th:first-child, .ts td:first-child { text-align: left; white-space: normal; min-width: 160px; }
.ts td.zero { color: var(--muted); }
.ts td.today, .ts th.today { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.ts tfoot td { font-weight: 600; border-top: 2px solid var(--border); border-bottom: none; }
.ts .total { font-weight: 600; }
.warn { display: inline-block; width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 50%; background: #f5a524; color: #1b1f24; font-size: 11px; font-weight: 700; margin-left: 4px; vertical-align: middle; }
.ended { font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); }
.ended.bad { border-color: #f5a524; color: #b7791f; }

.resume { border: 1px solid #f5a524; background: color-mix(in srgb, #f5a524 10%, transparent); border-radius: 8px; padding: 10px 12px; margin: 12px 0 0; font-size: 14px; }

/* ---------- Phones and small tablets ---------- */
header { position: relative; gap: 12px; }
#menuBtn { display: none; }
@media (max-width: 900px) {
  #menuBtn:not(.hidden) { display: inline-block; }
  #nav { display: none !important; position: absolute; top: 100%; right: 12px; left: 12px; z-index: 20; flex-direction: column; align-items: stretch;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
  body.menu-open #nav:not(.hidden) { display: flex !important; }
  #nav button { width: 100%; text-align: left; }
  main { padding: 16px; }
  .panel { padding: 14px; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  td, th { white-space: nowrap; }
  td .row { flex-wrap: nowrap; }
  .stat { font-size: 22px; }
  .row { gap: 8px; }
}
@media (max-width: 480px) {
  .row > input, .row > select { min-width: 0 !important; flex: 1 1 100% !important; }
  .lightbox img, .lightbox video { max-width: 100vw; border-radius: 0; }
}
.phonetile { display: flex; align-items: center; justify-content: center; text-align: center; color: #ccc; font-size: 14px; padding: 16px; }
