html, body { background: #000; }
:root {
  --bg: #050708;
  --panel: #0c0f14;
  --lcd: #e9e5d7;
  --lcd-text: #1f2a2c;
  --lcd-indiglo: #8df5e2;
  --lcd-indiglo-dark: #0e2f2c;
  --accent: #9cff7a;
  --amber: #f3c56a;
  --danger: #f45f5f;
  --muted: #8a919b;
  --soft: #171c23;
  --border: #1f262d;
  --tl-bg: #0d1118;
  --tl-bg2: #0a0d13;
  --tl-base: #2f3b45;
  --tl-tick: #202a32;
  --tl-label: #b8c3d0;
  --t-pill-bg: rgba(0,0,0,.08);
  --t-pill-border: rgba(0,0,0,.12);
  --t-pill-text: #111;
  --t-pill-live-bg: #ffad15;
  --t-pill-live-text: #221500;
  --vfd-cyan: #5ad8e0;
  --vfd-amber: #c29e54;
  --vfd-red: #cc4a4a;
  --vfd-white: #bac5cc;
  --vfd-glow: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.v2-body {
  margin: 0;
  background: #000;
  color: #e9eef6;
  font-family: "Space Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.scanner-v2 {
  width: min(92vw, 56.25vh, 760px);
  max-width: 760px;
  margin: 18px auto 40px;
  padding: 0 16px;
}

@media (orientation: portrait) {
  .scanner-v2 {
    width: 100%;
    max-width: 100%;
    padding: 0 14px;
  }
}

@media (orientation: landscape) {
  .scanner-v2 {
    width: min(90vw, 56.25vh, 820px);
  }
}

.v2-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: none;
  background: #000;
  border-radius: 14px 14px 10px 10px;
  box-shadow: none;
}

.top-actions { display: inline-flex; align-items: center; gap: 10px; }
.top-icon-btn,
.reports-link {
  text-decoration: none;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1.5px solid rgba(113,247,255,.8);
  background: rgba(10, 18, 24, 0.35);
  color: var(--vfd-white);
  box-shadow: inset 0 0 0 1px rgba(113,247,255,.12), var(--vfd-glow);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease, color .12s ease;
}
.top-icon-btn svg,
.reports-link svg { width: 20px; height: 20px; }
.top-icon-btn:hover,
.reports-link:hover { transform: translateY(-1px); box-shadow: 0 12px 20px rgba(0,0,0,.35); border-color: rgba(113,247,255,0.9); }
.top-icon-btn:active,
.reports-link:active { transform: translateY(0); }

.fullscreen-btn {
  border-color: rgba(141, 245, 226, .35);
  background: rgba(10,18,24,.35);
}
.fullscreen-btn.is-active {
  border-color: rgba(113,247,255,.9);
  background: rgba(10,18,24,.5);
  box-shadow: var(--vfd-glow);
}

.brandmark {
  font-weight: 800;
  letter-spacing: 0.22em;
  font-size: 24px;
  color: var(--vfd-cyan);
  text-transform: uppercase;
}

.day-live { display: inline-flex; gap: 12px; align-items: center; }
.field { display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0; }
.day-live { padding: 0; border: none; background: transparent; box-shadow: none; margin: 0; }
.field { justify-content: center; padding: 0; }
.day-picker {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%235ad8e0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2' ry='2'/%3E%3Cline x1='16' y1='3' x2='16' y2='7'/%3E%3Cline x1='8' y1='3' x2='8' y2='7'/%3E%3Cline x1='3' y1='11' x2='21' y2='11'/%3E%3C/svg%3E") center center / 18px 18px no-repeat,
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0)) padding-box,
    linear-gradient(90deg, rgba(0,0,0,0) 0 20px, rgba(255,255,255,.08) 20px 22px, rgba(0,0,0,0) 22px 100%) border-box,
    var(--soft);
  color: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  width: 46px;
  height: 46px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.day-picker:focus-visible {
  outline: 2px solid rgba(113,247,255,.35);
  outline-offset: 1px;
  border-color: rgba(113,247,255,.5);
  box-shadow: 0 0 0 3px rgba(113,247,255,.18);
}

.transport-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  background: #000;
  border: none;
  border-radius: 12px;
  padding: 10px;
  margin: 6px 0;
  box-shadow: none;
}

/* Air Datepicker theming */
.air-datepicker {
  background: #0d1016;
  border: 1px solid #2a323c;
  box-shadow: 0 14px 32px rgba(0,0,0,.5);
  border-radius: 12px;
  color: #e6e6e6;
}
.air-datepicker-nav {
  border-color: rgba(255,255,255,.06);
  padding: 6px 10px;
}
.air-datepicker-nav--title {
  color: #e6e6e6;
  font-weight: 700;
}
.air-datepicker-nav--action svg {
  stroke: #e6e6e6;
}
.air-datepicker-body--day-name {
  color: var(--accent);
  font-weight: 700;
}
.air-datepicker-cell {
  color: #cfd6df;
  border-radius: 8px;
}
.air-datepicker-cell.-selected-,
.air-datepicker-cell.-selected-.-focus- {
  background: var(--accent);
  color: #0b0f14;
  box-shadow: 0 0 0 1px rgba(156,255,122,.4);
}
.air-datepicker-cell.-focus- {
  background: rgba(156,255,122,.12);
  color: #e6e6e6;
}
.air-datepicker-cell.-disabled- {
  color: rgba(255,255,255,.25);
}
.air-datepicker-cell.-current- {
  color: var(--accent);
}

.live-pill {
  background: rgba(8,16,20,.55);
  color: var(--vfd-cyan);
  border: 1.5px solid rgba(113,247,255,.9);
  border-radius: 999px;
  padding: 6px 12px;
  min-width: 64px;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: var(--vfd-glow);
  cursor: pointer;
}
.live-pill.is-kiosk::after {
  content: "KIOSK";
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.2);
  background: var(--t-pill-live-bg);
  color: var(--t-pill-live-text);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.v2-main { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: start; margin-top: 14px; }

.lcd-card {
  background: #000;
  border: none;
  border-radius: 16px;
  box-shadow: none;
  padding: 14px;
}

.lcd-face {
  background: #5d7168;
  color: #0f1b4f;
  border-radius: 12px;
  border: 1px solid #4a5c54;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15), inset 0 -1px 0 rgba(0,0,0,.18);
  padding: 14px;
  position: relative;
}

.lcd-face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,.35) 0%, rgba(255,255,255,0) 45%);
  border-radius: 12px;
  opacity: .55;
  pointer-events: none;
}
.is-playing-call .lcd-face {
  background: #036f7c;
  color: #000b14;
  border-color: rgba(0,0,0,.18);
  box-shadow: 0 0 18px rgba(3,111,124,.4), inset 0 1px 0 rgba(255,255,255,.25);
}
.is-playing-call .lcd-face::after { opacity: .75; }
.is-playing-call .transcript { color: #1b1e20; }
.is-playing-call .transcript .t-time { background: rgba(0,0,0,.12); color: #000b14; }

.lcd-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.lcd-indicators { display: flex; align-items: center; gap: 8px; }
.lcd-meta .label { font-size: 12px; letter-spacing: 0.06em; color: #4d585b; }
.lcd-meta .mono { font-family: "orbitron", "DM Mono", "SFMono-Regular", Menlo, Consolas, monospace; font-size: 16px; font-weight: 900; letter-spacing: 0.08em; line-height: 1.12; }
.led { width: 12px; height: 12px; border-radius: 4px; background: #2f343a; box-shadow: inset 0 1px 0 rgba(255,255,255,.2); border: 1px solid rgba(0,0,0,.2); }
.led.is-live { box-shadow: 0 0 12px rgba(106,255,58,.7); }
.share-btn {
  width: 12px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0,0,0,.24);
  border-radius: 4px;
  background: #1b1f25;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  padding: 0;
  cursor: pointer;
}
.share-btn svg { width: 10px; height: 10px; fill: #e6e6e6; }
.share-btn:focus-visible { outline: 2px solid #6aff3a; outline-offset: 2px; }
.share-btn.is-copied { box-shadow: 0 0 10px rgba(106,255,58,.6); }
.is-playing-call .share-btn { background: rgba(0,0,0,.08); }

.lcd-fields { display: grid; gap: 4px; margin-bottom: 8px; position: relative; z-index: 1; }
.lcd-fields .row { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; letter-spacing: 0.04em; align-items: flex-end; }
.lcd-fields .key { color: #576063; text-transform: uppercase; font-size: clamp(12px, 2.4vw, 18px); letter-spacing: 0.08em; }
.lcd-fields #lcdGroup {
  font-family: "Orbitron", "Roboto Mono", "DM Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: clamp(16px, 4.8vw, 28px);
  letter-spacing: 0.16em;
  text-shadow:
    -0.5px -0.5px 0 #000,
    0.5px -0.5px 0 #000,
    -0.5px 0.5px 0 #000,
    0.5px 0.5px 0 #000;
}

.lcd-transcript { background: rgba(0,0,0,.06); border: 1px solid rgba(0,0,0,.1); border-radius: 10px; padding: 10px; position: relative; z-index: 1; }
.transcript-bar { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:8px; }
.transcript-bar-bottom { margin-top:10px; }
.transcript-status { flex:1; text-align:right; font-size:12px; color:#e6e6e6; min-height:16px; }
.transcript-status.error { color:#ff6666; }
.transcript-actions[hidden] { display:none !important; }
.icon-btn { background: rgba(0,0,0,.12); color: #e6e6e6; border:1px solid rgba(0,0,0,.24); border-radius:10px; padding:6px 10px; cursor:pointer; font-size:13px; letter-spacing:0.05em; font-weight:700; }
.icon-btn.unlocked { background: rgba(156,255,122,.18); color:#0c180c; border-color: rgba(156,255,122,.5); box-shadow: 0 0 0 1px rgba(156,255,122,.25); }
.transcript-actions { display:flex; align-items:center; gap:8px; }
.transcript { margin: 0; height: 260px; background: transparent; border: 0; color: #323f47; font-family: "Orbitron", "Roboto Mono", "DM Mono", "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: 0.08em; white-space: pre-wrap; overflow-wrap: anywhere; overflow: hidden; font-weight: 900; line-height: 1.14; }
.ampm { text-transform: uppercase !important; margin-left: 0; }
.transcript .t-header { display:none; }

.layout-side { display: flex; flex-direction: column; gap: 12px; }

.timeline-card { background: #000; border: none; border-radius: 14px; padding: 12px; box-shadow: none; }
.timeline-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.zoom-group { display: flex; gap: 8px; flex-wrap: wrap; }
.pill-btn {
  background: rgba(8,16,20,.25);
  border: 1.3px solid rgba(113,247,255,.7);
  color: var(--vfd-cyan);
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: none;
}
.pill-btn.ghost { background: rgba(255,255,255,.06); color: var(--vfd-white); border-color: rgba(255,255,255,.35); box-shadow: none; }

.timeline-card { width: 100%; max-width: 100%; }
.timeline-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  background: linear-gradient(180deg, var(--tl-bg), var(--tl-bg2));
  border: 1px solid #1f2730;
  border-radius: 12px;
  overscroll-behavior-x: contain;
  cursor: grab;
  touch-action: pan-x;
  user-select: none;
  -webkit-user-drag: none;
}
.timeline-wrap.is-scrubbing { cursor: grabbing; }
#timeline { width: 100%; height: 120px; display: block; background: transparent; }
.time-legend { color: var(--muted); font-size: 12px; }
.transport { margin-top: 10px; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; }
.transport .softkey { min-width: 0; width: 100%; font-size: clamp(12px, 3vw, 15px); padding: 10px 8px; }

.softkeys {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  background: #000;
  border: none;
  border-radius: 14px;
  padding: 10px;
  box-shadow: none;
}

.softkey {
  background: rgba(6,12,16,0.35);
  border: 1.5px solid rgba(113,247,255,.8);
  border-radius: 10px;
  padding: 12px 10px;
  color: var(--vfd-cyan);
  font-size: clamp(12px, 1.9vw, 16px);
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4);
}
.softkey:active { transform: translateY(1px); }
.softkey.accent { background: rgba(12,26,20,.35); border-color: rgba(156,255,122,.95); color: #eaffde; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
.softkey.amber { background: rgba(32,24,12,.3); border-color: rgba(243,197,106,.9); color: var(--vfd-amber); box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
.softkey.danger { background: rgba(32,12,12,.3); border-color: rgba(255,92,92,.9); color: var(--vfd-red); box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
.softkey.ghost { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.22); color: var(--vfd-white); box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.softkey.is-on {
  background: rgba(12,26,20,.35);
  border-color: rgba(156,255,122,.95);
  color: #eaffde;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35);
}
#playPauseBtn.is-paused {
  border-color: var(--vfd-red);
  color: var(--vfd-red);
  background: rgba(32,12,12,.25);
}
#playPauseBtn.is-playing {
  border-color: rgba(156,255,122,.95);
  color: #eaffde;
}

.filter-banner { background: #000; border: none; border-radius: 10px; padding: 10px 12px; color: var(--vfd-cyan); font-size: 13px; box-shadow: none; display: flex; align-items: center; gap: 10px; }
.filter-banner.is-active { border-style: none; border-color: transparent; color: rgba(156,255,122,.9); box-shadow: none; }
.filter-banner.with-live { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-banner.with-live #liveBadge { margin-left: auto; }
#liveBadge { display: inline-flex; align-items: center; justify-content: center; }
.is-fullscreen #liveBadge { display: inline-flex !important; }
.fs-clock { margin-left: auto; font-family: "Orbitron", "Roboto Mono", "DM Mono", "SFMono-Regular", Menlo, Consolas, monospace; font-size: 20px; line-height: 1; letter-spacing: 0.08em; color: var(--vfd-cyan); display: none; }
.is-fullscreen .fs-clock { display: inline-flex; }

.talkgroups { background: #000; border: none; border-radius: 14px; padding: 12px; box-shadow: none; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-head .title { font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--vfd-cyan); text-shadow: none; }
.panel-head .hint { font-size: 12px; color: rgba(113,247,255,.7); letter-spacing: 0.06em; }

.tg-grid { display: grid; gap: 8px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tg-btn {
  background: rgba(6,12,16,.3);
  border: 1.2px solid rgba(113,247,255,.6);
  border-radius: 10px;
  padding: 10px 8px;
  color: var(--vfd-cyan);
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
  white-space: normal;
  overflow-wrap: break-word;
}
.tg-btn:hover { transform: translateY(-1px); }
.tg-btn.is-active { border-color: rgba(156,255,122,.9); box-shadow: 0 0 0 1px rgba(156,255,122,.3), 0 8px 18px rgba(0,0,0,.4); color: #d7ffd1; }
.tg-btn.is-locked { border-color: rgba(255,92,92,.8); color: var(--vfd-red); opacity: .85; box-shadow: none; }
.tg-btn.is-hold { border-color: rgba(243,197,106,.9); color: var(--vfd-amber); box-shadow: none; }
.tg-btn::before { content: "● "; color: var(--tg-color, #9cff7a); }

@media (max-width: 960px) {
  .v2-main { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .softkeys { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tg-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 580px) {
  .softkeys { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .scanner-v2 { max-width: 100%; padding: 0 12px; }
  .lcd-card { padding: 10px; }
  .lcd-face { padding: 10px; }
  .transcript { height: 180px; font-size: 14px; }
  .transport { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
  .transport .softkey { min-width: 0; width: 100%; }
  .softkeys { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .field select { min-width: 120px; }
  .timeline-head { flex-direction: column; align-items: flex-start; }
  .tg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .softkeys { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.is-fullscreen .v2-topbar { display: none; }

#fullscreenExitOverlay {
  display: none;
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.18);
  backdrop-filter: blur(1px);
  pointer-events: none;
  z-index: 9999;
}
#fullscreenExitOverlay.is-visible { display: flex; }
#fullscreenExitOverlay .exit-btn {
  pointer-events: auto;
  background: rgba(0,0,0,0.35);
  color: #e9eef6;
  border: 1px solid rgba(156,255,122,.6);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08);
}
#fullscreenExitOverlay .exit-btn:active { transform: translateY(1px); }
