/* CastListen - visual language borrowed from VivaSonic RF Planner.
   Producer page is DARK by default (used on a floor at night); admin page adds body.light. */
@font-face { font-family: Inter; font-weight: 400; src: url("fonts/Inter_18pt-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: Inter; font-weight: 500 600; src: url("fonts/Inter_18pt-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: Inter; font-weight: 700; src: url("fonts/Inter_18pt-Bold.ttf") format("truetype"); font-display: swap; }

:root {
  --bg: #1a2030;
  --panel: #232a3a;
  --muted: #9aa3b2;
  --primary: #e8600a;
  --primary-dark: #c65102;
  --primary-light: #3a2a1f;
  --border: #323b4d;
  --danger: #f87171;
  --ok: #34d399;
  --text: #eef1f5;
  --tile: #2c3548;
  --tile-initials: #6b7a93;
  --btn: #2b3345;
  --shadow: 0 2px 8px rgba(0,0,0,0.25);
}
body.light {
  --bg: #f5f7fa;
  --panel: #fff;
  --muted: #6b7280;
  --primary: #c65102;
  --primary-dark: #a04201;
  --primary-light: #fff4ed;
  --border: #e4e7eb;
  --danger: #ef4444;
  --ok: #10b981;
  --text: #1f2937;
  --tile: #e4e8ee;
  --tile-initials: #94a3b8;
  --btn: #fff;
  --shadow: 0 2px 8px rgba(0,0,0,0.04);
}

*, *::before, *::after { box-sizing: border-box; }
html {
  background: linear-gradient(160deg, #1e2331 0%, #334050 100%);
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  line-height: 1.5;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 14px; padding-bottom: env(safe-area-inset-bottom, 14px); }

/* header card */
.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; margin-bottom: 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow);
}
.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { height: 24px; width: auto; max-width: 60vw; object-fit: contain; }
.logo-text { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.logo-text span { color: var(--primary); }
.who { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who b { color: var(--text); }
.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.2); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.dot.wait { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,.2); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* buttons */
.btn {
  font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px;
  border-radius: 6px; border: 1px solid var(--border); background: var(--btn); color: var(--text); cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: rgba(239,68,68,.4); }
.btn.small { font-size: 12px; padding: 5px 10px; }

/* cards */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 14px; box-shadow: var(--shadow); overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.card-header h2 { margin: 0; font-size: 15px; font-weight: 700; }
.card-body { padding: 14px 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 10px; }

/* cast grid */
.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.grid.mini { gap: 8px; grid-template-columns: repeat(8, 1fr); max-width: 900px; }

.tile {
  position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden;
  background: var(--tile); border: 3px solid transparent; cursor: pointer;
  touch-action: manipulation; transition: border-color .12s, box-shadow .12s, transform .08s;
}
.tile img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; filter: saturate(.5) brightness(.75); transition: filter .15s; }
.tile .initials {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: var(--tile-initials); pointer-events: none;
}
.tile .name {
  z-index: 2; position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 6px 6px; text-align: center;
  font-size: 13px; font-weight: 600; color: #fff; line-height: 1.15;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.7) 60%); pointer-events: none;
}
.grid.mini .tile { border-width: 2px; border-radius: 7px; }
.grid.mini .tile .name { font-size: 12px; padding: 14px 4px 4px; }
.grid.mini .tile .initials { font-size: 14px; }
.tile:active { transform: scale(.97); }

.tile.on { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232,96,10,.3), 0 6px 18px rgba(232,96,10,.35); }
.tile.on img { filter: none; }
.tile.on::after {
  content: "ON"; z-index: 2; position: absolute; top: 6px; right: 6px; font-size: 10px; font-weight: 700; letter-spacing: .06em;
  background: var(--primary); color: #fff; padding: 2px 6px; border-radius: 4px;
}
.grid.mini .tile.on::after { font-size: 9px; top: 4px; right: 4px; padding: 1px 5px; }
.tile.held { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(52,211,153,.35); animation: pulse 1s infinite; }
.tile.held img { filter: none; }
.tile.held::after { content: "HOLD"; background: var(--ok); color: #062c1f; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(52,211,153,.35); } 50% { box-shadow: 0 0 0 7px rgba(52,211,153,.15); } }

/* pairing list */
.choice-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.choice { font: inherit; font-size: 15px; font-weight: 600; padding: 16px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--btn); color: var(--text); cursor: pointer; }
.choice:active { background: var(--primary-light); border-color: var(--primary); }
input.text { font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; width: 100%; background: var(--btn); color: var(--text); }
input.text:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(198,81,2,.2); }

/* modal (RF Planner style) */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 10000; animation: fadeIn .2s ease; }
.modal-overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-dialog { background: var(--panel); color: var(--text); border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.4); max-width: 420px; width: 90%; animation: slideUp .2s ease; border: 1px solid var(--border); }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; font-size: 17px; font-weight: 600; }
.modal-body { padding: 20px 22px; font-size: 14px; color: var(--muted); }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-footer .btn { min-width: 96px; }

/* admin */
.prod-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: start; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.prod-row:last-child { border-bottom: 0; }
.prod-meta b { display: block; font-size: 14px; }
.prod-meta small { color: var(--muted); font-size: 12px; display: block; }
.prod-meta .btn { margin-top: 6px; }
@media (max-width: 700px) { .prod-row { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.qr-box { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.qr-box svg, .qr-box img { width: 180px; height: 180px; background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--border); }
.qr-url { font-size: 18px; font-weight: 600; word-break: break-all; }
select.text { font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--btn); color: var(--text); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20000; }
.toast.show { opacity: 1; }

/* producer header: logo row, then who + buttons (phone); one row on wide screens */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-header { flex-wrap: wrap; row-gap: 10px; }
.app-header .brand { flex: 1 1 100%; justify-content: flex-start; }
.app-header .who { flex: 1 1 auto; min-width: 0; }
.app-header .header-right { flex: 0 0 auto; }
.brand .logo { height: 26px; max-width: 90%; }
@media (min-width: 640px) {
  .app-header .brand { flex: 0 0 auto; justify-content: flex-start; }
  .app-header .who { text-align: left; }
}
/* admin header: logo with the role under it, equal-width buttons on the right */
.admin-header { align-items: center; }
.admin-header .brand-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.admin-header .brand-col .logo { height: 30px; max-width: 100%; }
.admin-header .header-right .btn { min-width: 150px; text-align: center; }
@media (max-width: 700px) { .grid.mini { grid-template-columns: repeat(4, 1fr); } }
.btn.full { flex: 1 1 100%; width: 100%; padding: 12px; font-size: 15px; }
/* ---- 0.3.0: bigger client logo, inactive slots + hide toggle, admin slot cards, version stamp ---- */
.brand .logo { height: 40px; }
@media (min-width: 640px) { .brand .logo { height: 44px; } }
.btn.ghost { background: transparent; color: var(--muted); }
.ver { text-align: center; color: var(--muted); font-size: 11px; padding: 6px 0 2px; opacity: .7; }

/* inactive slot: dim, greyscale, red strike; never tappable; hidden entirely when the producer chooses */
.tile.inactive { cursor: default; opacity: .45; }
.tile.inactive img { filter: grayscale(1) brightness(.5); }
.tile.inactive::before {
  content: ""; position: absolute; z-index: 3; left: 50%; top: 50%; width: 135%; height: 4px;
  background: var(--danger); transform: translate(-50%, -50%) rotate(-45deg); opacity: .85; pointer-events: none;
}
.tile.inactive .name { text-decoration: line-through; opacity: .8; }
.tile.inactive:active { transform: none; }
.grid.hide-inactive .tile.inactive { display: none; }

/* admin: cast slot cards */
.slots { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.slot { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.slot.off { opacity: .6; }
.slot-photo { position: relative; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; background: var(--tile); cursor: pointer; border: 2px dashed transparent; }
.slot-photo img { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 1; }
.slot.off .slot-photo img { filter: grayscale(1) brightness(.6); }
.slot-initials { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 26px; color: var(--tile-initials); }
.slot-drop {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff; background: rgba(0,0,0,.55); opacity: 0; transition: opacity .15s; pointer-events: none;
}
.slot-photo:hover .slot-drop, .slot-photo.over .slot-drop { opacity: 1; }
.slot-photo.over { border-color: var(--primary); }
.slot-badge { position: absolute; z-index: 3; top: 4px; left: 4px; font-size: 10px; font-weight: 700; letter-spacing: .05em; background: rgba(0,0,0,.65); color: #fff; padding: 2px 6px; border-radius: 4px; }
.slot-fields { display: flex; flex-direction: column; gap: 6px; justify-content: center; min-width: 0; }
.slot-fields .text { font-size: 14px; padding: 7px 10px; }
.slot-fields .btn { align-self: flex-start; min-width: 90px; }
.slots.simple { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.slot.simple { grid-template-columns: 56px 1fr; align-items: center; }
.slot-num { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.slot.simple .slot-fields { flex-direction: row; align-items: center; }
.slot.simple .slot-fields .text { flex: 1; min-width: 0; }
.prod-meta .name-edit { font-size: 14px; font-weight: 700; padding: 5px 8px; margin-bottom: 2px; width: 100%; }
/* ---- 0.4.0: RFPlanner footer, Online/Offline status button, log page, bottom clearance for phone nav bars ---- */
.wrap { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 48px); }
.wrap.wide { max-width: 1600px; }
.footer {
  margin-top: 24px; padding: 16px 0; border-top: 1px solid rgba(255,255,255,.12);
  font-size: 13px; color: #cbd5e1; display: flex; justify-content: space-between; align-items: center; position: relative;
}
body.light .footer { border-top-color: rgba(0,0,0,.12); color: var(--muted); }
.footer-left, .footer-right { display: flex; align-items: center; gap: 12px; }
.footer-center { position: absolute; left: 50%; transform: translateX(-50%); }
.footer a { color: #fdba74; text-decoration: none; }
body.light .footer a { color: var(--primary); }
.footer a:hover { text-decoration: underline; }
@media (max-width: 1024px) {
  .footer { flex-direction: column; gap: 8px; text-align: center; font-size: 12px; align-items: center; }
  .footer-left, .footer-center, .footer-right { position: static; transform: none; }
}
.btn.status { background: var(--danger); border-color: var(--danger); color: #fff; cursor: default; }
.btn.status.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.status.wait { background: #f59e0b; border-color: #f59e0b; color: #fff; }   /* 0.16.2 exec: Connecting */
.admin-header .header-right { flex-wrap: wrap; justify-content: flex-end; }
.card-header .header-right { gap: 8px; }
.log {
  margin: 0; padding: 12px 14px; height: calc(100vh - 220px); min-height: 300px; overflow: auto;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace; font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
.log div { padding: 1px 0; border-bottom: 1px solid rgba(0,0,0,.03); }
.log .bad { color: var(--danger); }
.log .warn { color: #b45309; }
.log .good { color: #047857; }
/* ---- 0.4.1: Cast on its own page; log page header matches admin; filter lives in the log card header ---- */
.card-header .filter { width: 320px; max-width: 45vw; font-size: 13px; padding: 6px 10px; }
.log { height: calc(100vh - 260px); }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
/* ---- 0.5.0: follow another PD, cameras ---- */
.follow-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px;
  padding: 10px 14px; border-radius: 10px; background: rgba(249,115,22,.14); border: 1px solid rgba(249,115,22,.5); font-size: 14px;
}
body.light .follow-banner { background: #fff7ed; border-color: #fdba74; }
.grid.locked .tile { cursor: default; }
.grid.locked .tile:active { transform: none; }
.grid.locked .tile.on::after { background: var(--primary); opacity: .85; }
.grid.locked .tile.on { border-color: var(--primary); box-shadow: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--tile); color: var(--text);
}
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip:active { transform: scale(.97); }

.camgrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.cam {
  position: relative; border-radius: 10px; padding: 12px 8px 10px; text-align: center; cursor: pointer; user-select: none;
  background: var(--tile); border: 2px solid var(--border); -webkit-tap-highlight-color: transparent;
}
.cam:active { transform: scale(.97); }
.cam-name { font-weight: 700; font-size: 15px; line-height: 1.1; }
.cam-owner { font-size: 11px; margin-top: 5px; color: var(--muted); }
.cam.mine { background: rgba(232,96,10,.18); border-color: var(--primary); }
.cam.mine .cam-owner { color: var(--primary); font-weight: 700; }
.cam.taken { opacity: .6; }
.cam.taken .cam-owner { color: var(--text); }
.cam select.text { margin-top: 6px; width: 100%; font-size: 12px; padding: 5px 6px; }
.prod-meta .sub { display: block; font-size: 12px; color: var(--muted); margin: 2px 0 4px; }
.prod-meta .sub b { color: var(--primary); }
/* ---- 0.6.0: [hidden] always wins (display rules on .btn / .follow-banner were overriding it) ---- */
[hidden] { display: none !important; }
/* ---- 0.6.1: Hide as well as Disable on the roster ---- */
.slot-btns { display: flex; gap: 6px; }
.slot-fields .slot-btns .btn { min-width: 72px; }
.slots.simple { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.slot.hid { border-style: dashed; opacity: .45; }
/* ---- 0.7.1: my cameras = my video - picture tiles on the phone, full-screen viewer ---- */
body.noscroll { overflow: hidden; }
.camgrid.vid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.cam.vid { padding: 0; text-align: left; overflow: hidden; -webkit-touch-callout: none; }
.cam-pic { position: relative; aspect-ratio: 16 / 9; background: #000; }
.cam-pic img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.cam-pic.novid { display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); font-size: 11px; }
.cam-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding: 6px 8px 7px; }
.cam.vid .cam-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cam.vid .cam-owner { margin-top: 0; white-space: nowrap; flex-shrink: 0; }
.cam.vid.taken .cam-pic img { filter: grayscale(.4) brightness(.8); }   /* 0.9.1: dim less, the holder's name is on the picture */
.vbadge.other { background: rgba(0,0,0,.7); font-weight: 600; font-size: 11px; }
.vlabel { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 6px; font-size: 11px; font-weight: 600; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.8)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vbadge { position: absolute; top: 4px; left: 4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

.vview { position: fixed; inset: 0; z-index: 60; background: #000; }
.vgrid { position: absolute; top: env(safe-area-inset-top); right: env(safe-area-inset-right); bottom: env(safe-area-inset-bottom);
  left: env(safe-area-inset-left); display: grid; gap: 2px; align-content: center; justify-content: center; }
.vtile { position: relative; background: #111; overflow: hidden; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.vtile img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.vtile.nosig img { visibility: hidden; }
.vtile .vlabel { font-size: 14px; padding: 6px 10px; }
.vtile .vbadge { top: 8px; left: 8px; }
.vnosig { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; color: #9aa3b2; font-weight: 600; }
.vtile.nosig .vnosig { display: flex; }
.vnone { color: #9aa3b2; font-weight: 600; }
.vexit { position: absolute; z-index: 2; top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right));
  width: 48px; height: 48px; border-radius: 24px; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 30px; line-height: 1;
  cursor: pointer; transition: opacity .5s; }
.vview.idle .vexit { opacity: .3; }

/* 0.8.0 admin: per-PD camera strips (pictures for held cameras, chips for the rest), PD colours, viewer title */
.prod-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.name-line { display: flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 24px; border-radius: 3px; background: var(--pdc, var(--primary)); flex-shrink: 0; margin-bottom: 2px; }
.name-line .name-edit { margin-bottom: 0; }
.row-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.prod-meta .row-btns .btn { margin-top: 0; }
.pdcams { display: flex; flex-direction: column; gap: 8px; }
.camgrid.vid.pdtiles { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); max-width: 900px; }
.prod-row .cam.vid.mine { border-color: var(--pdc, var(--primary)); background: var(--panel); }
.prod-row .cam.vid.mine .cam-owner { color: var(--pdc, var(--primary)); }
.chip.camchip { font-size: 12px; padding: 5px 10px; }
.chip.camchip.taken { opacity: .8; border-color: var(--pdc, var(--border)); color: var(--pdc, var(--muted)); }
.camgrid.vid.admin { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.camgrid.vid.admin .cam select.text { margin: 0 8px 8px; width: calc(100% - 16px); }
.cam.vid.owned { border-color: var(--pdc, var(--primary)); }
.cam.vid.owned .cam-pic::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--pdc, var(--primary)); }
.vtitle { position: absolute; z-index: 2; top: calc(14px + env(safe-area-inset-top)); left: calc(14px + env(safe-area-inset-left));
  padding: 6px 12px; border-radius: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; font-weight: 600; transition: opacity .5s; pointer-events: none; }
.vview.idle .vtitle { opacity: .3; }

/* 0.9.2 admin layout: nav = 6 equal buttons, 6 cameras per row, meta column uniform; phone header + button row */
.admin-header { flex-direction: column; align-items: stretch; }
.admin-nav { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; width: 100%; }
.admin-nav .btn { min-width: 0; text-align: center; padding: 6px 6px; }
@media (max-width: 700px) { .admin-nav { grid-template-columns: repeat(3, 1fr); } }
.prod-meta .online { display: block; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 13px; margin: 6px 0 0; background: var(--btn); }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.row-btns .btn { min-width: 0; padding: 8px 6px; font-size: 13px; }
.row-btns [data-unfollow] { grid-column: 1 / -1; }
.camgrid.vid.admin { grid-template-columns: repeat(6, 1fr); max-width: none; }
.camgrid.vid.pdtiles { grid-template-columns: repeat(var(--cams-per-row, 8), 1fr); max-width: none; }   /* one PD per screen: 16 cams = 2 rows */
.prod-row .grid.mini { grid-template-columns: repeat(var(--cast-per-row, 7), 1fr); max-width: none; }
@media (max-width: 1100px) { .camgrid.vid.pdtiles, .camgrid.vid.admin { grid-template-columns: repeat(4, 1fr); } }
.prod-row .cam.vid.taken .cam-owner { color: var(--pdc, var(--muted)); font-weight: 600; }
.app-header .who-right { flex: 1 1 auto; justify-content: flex-end; min-width: 0; }
.who-right .who { flex: 0 1 auto; text-align: right; }
.btn-row { display: flex; gap: 8px; margin-bottom: 10px; }
.btn-row .btn { flex: 1 1 0; padding: 12px; font-size: 15px; font-weight: 600; }

/* 0.9.3 PD colour on the buttons that act as a PD; admin logo left; follow buttons share the row */
.btn.pd { background: var(--pdc, var(--primary)); border-color: var(--pdc, var(--primary)); color: #fff; }
.btn.pd:active { filter: brightness(.9); }
.card-header .btn.hdr { padding: 4px 14px; font-size: 13px; font-weight: 600; margin: -4px 0; min-width: 104px; text-align: center; }   /* 0.17.0: header rows all one height */
.btn.pd.hdr.on { box-shadow: inset 0 0 0 2px #fff; }                                   /* Main PGM Mix while on */
.admin-header .brand-col { align-items: flex-start; padding-bottom: 16px; }
.admin-header .brand-col .logo { height: 40px; }
/* 0.13.0 admin logo (same height / face as the main logo) to its right */
.brand-row { display: flex; align-items: center; gap: 16px; min-width: 0; width: 100%; }
.brand-row .logo { max-width: 60vw; }
.brand-row .logo-admin { max-width: 30vw; margin-left: auto; }   /* far right of the row */
.prod-row { padding-bottom: 36px; }    /* a clear break before the next PD */
.chips.follow { display: grid; gap: 8px; }
.chip.pd { background: transparent; border: 2px solid var(--pdc, var(--border)); color: var(--pdc, var(--text)); border-radius: 10px;
  padding: 11px 6px; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.pd.on { background: var(--pdc, var(--primary)); color: #fff; }

/* 0.9.0 video step 2: live WebRTC tile */
.vtile video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; pointer-events: none; }
.vtile.nosig video { visibility: hidden; }

/* 0.10.0: follow chip of a PD with no phone online; admin colour picker styled as the swatch; settings selects in a card header */
.chip.pd.off:not(.on) { opacity: .45; }
input.swatch { padding: 0; border: 0; background: var(--pdc, var(--primary)); cursor: pointer; width: 14px; }
input.swatch::-webkit-color-swatch-wrapper { padding: 0; }
input.swatch::-webkit-color-swatch { border: 0; border-radius: 3px; }
input.swatch::-moz-color-swatch { border: 0; border-radius: 3px; }
.hdr-set { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.hdr-set .text { width: auto; margin: 0; padding: 4px 8px; font-size: 13px; }

/* 0.14.0: Pair a Device modal; Roster / Log / login headers = admin header (brand row + nav grid, status in the last column) */
.qr-dialog { max-width: 620px; }
.qr-dialog .modal-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qr-dialog .modal-body { color: var(--text); }
.admin-nav .status { grid-column: -2 / -1; }
.admin-nav.right > :first-child { grid-column: 4; }   /* Roster / Log: Admin, Log|Roster, status sit where Roster, Log, status sit on admin */
@media (max-width: 700px) { .admin-nav.right > :first-child { grid-column: auto; } }

/* 0.16.0 health: viewer clock (laptop time, read against the burnt-in clock), admin Health card */
.vclock { position: absolute; z-index: 2; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  padding: 4px 10px; border-radius: 8px; background: rgba(0,0,0,.6); color: #fff; font: 600 14px/1.4 ui-monospace, Consolas, monospace;
  font-variant-numeric: tabular-nums; pointer-events: none; }
.health td, .health th { white-space: nowrap; }
.health .warn { color: #b45309; font-weight: 600; }
.health .bad { color: var(--danger); font-weight: 600; }
.health .small { font-size: 12px; color: var(--muted); font-weight: 400; }
.health td.small { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.health .spark { color: var(--primary); vertical-align: middle; }

/* 0.17.0 admin audio pill (same as the exec page's) + the Main PGM chip in the admin cast grids */
.vaudio { position: absolute; z-index: 2; bottom: calc(14px + env(safe-area-inset-bottom)); left: calc(14px + env(safe-area-inset-left));
  font: 600 13px/1 inherit; font-family: inherit; color: #fff; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: 9px 14px; cursor: pointer; transition: opacity .3s; }
.vview.idle .vaudio { opacity: .3; }
.vaudio.need, .vview.idle .vaudio.need { opacity: 1; background: var(--primary); border-color: var(--primary); }
.tile.pgm .initials { font-size: 15px; letter-spacing: .06em; }
