/* Keep map gestures available outside the floating windows. */
.cctv-map-workspace{position:relative;isolation:isolate}
.cctv-map-workspace #map{height:74vh;min-height:540px}
.cctv-window-layer{position:absolute;inset:0;z-index:1100;pointer-events:none;overflow:hidden;border-radius:12px}
.cctv-window{position:absolute;display:flex;flex-direction:column;pointer-events:auto;box-sizing:border-box;min-width:0;background:#fff;border:1px solid #d2dae7;border-radius:22px;box-shadow:0 8px 28px #26334c30;overflow:hidden;color:#172438;font-family:Tahoma,"Segoe UI",sans-serif}
.cctv-window-head{display:flex;align-items:center;gap:6px;flex-shrink:0;min-height:46px;padding:4px 8px 4px 12px;border-bottom:1px solid #d8dfeb;cursor:grab;touch-action:none;user-select:none}
.cctv-window-head:active{cursor:grabbing}
.cctv-drag-grip{color:#52647c;font-size:20px}
.cctv-window-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:1.5}
.cctv-window-actions{display:flex;align-items:center;gap:0}
.cctv-action{display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:8px;background:transparent;color:#4c5e79;width:32px;height:36px;padding:0;cursor:pointer}
.cctv-action:hover{background:#edf3fb;color:#0867ca}
.cctv-action-close:hover{background:#fff0f0;color:#c02b3d}
.cctv-action:focus-visible,.cctv-tab:focus-visible,.cctv-retry:focus-visible{outline:3px solid #1674dc;outline-offset:-3px}
.cctv-window-content{padding:10px;overflow:auto;overscroll-behavior:contain;min-height:0}
.cctv-tabs{display:flex;gap:5px;overflow-x:auto;scrollbar-width:thin;padding-bottom:8px;flex-shrink:0}
.cctv-tab{border:0;border-radius:15px;background:#e4eaf2;color:#4b5b73;font-size:14px;font-weight:700;padding:5px 13px;white-space:nowrap;min-height:32px;cursor:pointer}
.cctv-tab[aria-selected="true"]{background:#0868ce;color:white}
.cctv-video-shell{position:relative;background:#101a28;aspect-ratio:16/9;border-radius:16px;overflow:hidden;min-height:0}
.cctv-video-mount,.cctv-video-mount>.video-js{width:100%;height:100%}
.cctv-video-mount{position:absolute;inset:0}
.cctv-video-mount video{object-fit:contain}
.cctv-live{position:absolute;top:10px;left:10px;z-index:2;background:#ee0018;color:white;border-radius:12px;padding:3px 9px;font-size:12px;font-weight:700;pointer-events:none}
.cctv-live[hidden],.cctv-retry[hidden]{display:none!important}
.cctv-window-footer{display:flex;align-items:center;gap:6px;margin-top:8px;min-height:24px;color:#52647c;font-size:12px;line-height:1.5}
.cctv-window-status{flex:1;min-width:0;overflow-wrap:anywhere}
.cctv-status-dot{flex-shrink:0;width:9px;height:9px;background:#c18a18;border-radius:50%}
.cctv-window[data-state="live"] .cctv-status-dot{background:#00b98b}
.cctv-window[data-state="error"] .cctv-status-dot{background:#df3043}
.cctv-window[data-state="paused"] .cctv-status-dot{background:#8492a7}
.cctv-retry{border:1px solid #cbd8e9;border-radius:8px;background:#f2f7fd;color:#075bb2;padding:5px 8px;flex-shrink:0;font-size:12px}
.cctv-resize-handle{position:absolute;right:0;bottom:0;width:16px;height:16px;cursor:nwse-resize;touch-action:none}
.cctv-window.is-minimised .cctv-window-content,.cctv-window.is-minimised .cctv-resize-handle,.cctv-window.is-minimised .cctv-action:not(.cctv-action-minimise):not(.cctv-action-close){display:none}
.cctv-window.is-minimised .cctv-window-head{min-height:50px;border:0}
.cctv-window.is-minimised .cctv-action-minimise svg{transform:rotate(180deg)}
.cctv-window.is-maximised:not(.is-minimised) .cctv-window-content,.cctv-window:fullscreen .cctv-window-content{display:flex;flex:1;flex-direction:column}
.cctv-window.is-maximised .cctv-video-shell,.cctv-window:fullscreen .cctv-video-shell{flex:1;aspect-ratio:auto;min-height:100px}
.cctv-window:fullscreen{width:100%!important;height:100%!important;max-height:none!important;left:0!important;top:0!important;border-radius:0}
.fullmap-toggle{display:none}
.fullmap .cctv-map-workspace{position:fixed;inset:0;z-index:1000}
.fullmap .cctv-map-workspace #map{position:absolute!important;height:100%!important;min-height:0!important;width:100%!important}
.fullmap .cctv-window-layer{border-radius:0}
@media(max-width:767px), (pointer:coarse){
  .page-shell{margin:8px auto;padding:0 6px}
  .card-muni>.card-body{padding:10px}
  .card-muni .card-header h4{font-size:18px;line-height:1.5}
  .toolbar{padding:10px}
  .toolbar input,.toolbar select{font-size:16px;min-height:44px}
  .toolbar .btn{min-height:44px}
  .cctv-map-workspace #map{height:72vh;height:72svh;min-height:440px}
  .cctv-window{border-radius:16px}
  .cctv-window-head{flex-wrap:wrap;padding:3px 6px 3px 10px;gap:0 6px}
  .cctv-window-title{font-size:13px;min-width:calc(100% - 30px);padding:4px 0}
  .cctv-window-actions{width:100%;justify-content:flex-end}
  .cctv-action{width:44px;min-width:44px;height:44px}
  .cctv-action-grid{display:none}
  .cctv-window-content{padding:8px}
  .cctv-tabs{gap:6px}
  .cctv-tab{min-height:44px;padding:8px 15px}
  .cctv-video-shell{border-radius:12px}
  .cctv-window-footer{font-size:12px;align-items:flex-start}
  .cctv-status-dot{margin-top:5px}
  .cctv-retry{min-height:44px}
  .cctv-resize-handle{display:none}
  .cctv-window.is-minimised .cctv-window-head{flex-wrap:nowrap;min-height:50px}
  .cctv-window.is-minimised .cctv-window-title{min-width:0}
  .cctv-window.is-minimised .cctv-window-actions{width:auto}
  .fullmap-toggle{display:block;bottom:calc(12px + env(safe-area-inset-bottom));right:10px;padding:10px 14px;min-height:44px}
  .fullmap .cctv-window-layer{bottom:64px;bottom:calc(64px + env(safe-area-inset-bottom));top:env(safe-area-inset-top)}
}
@media(prefers-reduced-motion:reduce){.cctv-window *{scroll-behavior:auto!important}}
