/* Smart Ambar: a cor dos postes na rua. Preto do metal pintado, laranja de sinalização.
   O laranja é só da marca e das ações principais; alerta é amarelo e crítico é vermelho, para nunca confundir.
   A faixa zebrada (fita de sinalização) aparece só em alarme disparado e pânico. */
:root {
  --asphalt: #000000; --kerb: #141414; --kerb-2: #1f1f1f; --line: #2e2e2e;
  --text: #f2f2f2; --muted: #a3a3a3; --sodium: #ff6b00; --sodium-ink: #000000; --sodium-soft: rgba(255,107,0,.12);
  --tl-24h: #1fa64a; --tl-motion: #e8d400; --tl-plate: #2f7bea;
  --ok: #3ecf7a; --warn: #ffc53d; --crit: #ff4d4f; --idle: #6b6b6b; --sky: #7db7ff;
  --hazard: repeating-linear-gradient(-45deg, #ff6b00 0 7px, #000 7px 14px);
  --display: 'Archivo', 'Arial', sans-serif;
  --body: 'Archivo', 'Segoe UI', system-ui, sans-serif;
  --r: 3px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body { margin: 0; background: var(--asphalt); color: var(--text); font: 400 15px/1.45 var(--body); }
h1, h2, h3 { font-family: var(--display); font-stretch: 125%; font-weight: 700; margin: 0; line-height: 1.1; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 28px; font-weight: 800; } h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--sodium); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sodium); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); height: 100%; }
.side { background: var(--asphalt); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 10px; gap: 2px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font: 800 22px var(--display); font-stretch: 125%; letter-spacing: -.01em; }
.nav { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 0; background: none; color: var(--muted); cursor: pointer; text-align: left; font-weight: 500; }
.nav:hover { background: var(--kerb-2); color: var(--text); }
/* Item atual: barra laranja na lateral, como a luz no alto do poste. */
.nav[aria-current='page'] { background: var(--sodium-soft); color: var(--text); box-shadow: inset 3px 0 var(--sodium); font-weight: 600; }
.nav .count { margin-left: auto; background: var(--crit); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 600; }
.who { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.linkish { background: none; border: 0; padding: 0; color: var(--sodium); cursor: pointer; text-decoration: underline; }

.main { overflow-y: auto; min-width: 0; padding-block: 20px 40px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.head > div { min-width: 0; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--r); border: 1px solid var(--line); background: transparent; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--text); }
.btn.primary:hover { background: #ff8126; border-color: #ff8126; }
.btn.primary { background: var(--sodium); border-color: var(--sodium); color: var(--sodium-ink); }
.btn.danger { background: transparent; border-color: var(--crit); color: var(--crit); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--kerb); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 16px; }
.stat { background: var(--kerb); padding: 10px 14px; box-shadow: 0 0 0 1px var(--line); }
.stat b { display: block; font: 700 28px/1.1 var(--display); font-stretch: 125%; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.panel { background: var(--kerb); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.map { width: 100%; aspect-ratio: 16 / 10; display: block; background: #0a0a0a; border-radius: var(--r); }
.pin { cursor: pointer; }
.pin:hover .pin-ring, .pin:focus-visible .pin-ring { stroke: var(--sodium); }
.pin:focus { outline: none; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--kerb-2); vertical-align: middle; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--kerb-2); }
tbody tr[aria-selected='true'] { background: var(--kerb-2); box-shadow: inset 3px 0 var(--sodium); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 4px; font-size: 13px; font-weight: 500; white-space: nowrap; background: var(--kerb-2); color: var(--muted); }
.pill.alarm { color: #000; font-weight: 700; padding-left: 20px; border-radius: 2px; background: linear-gradient(#ff6b00, #ff6b00) right / calc(100% - 14px) 100% no-repeat, repeating-linear-gradient(-45deg, #ff6b00 0 4px, #000 4px 8px); }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.crit { color: #fff; background: var(--crit); } .pill.info { color: var(--sky); } .pill.sodium { color: var(--sodium); }
.plate { font: 700 15px var(--display); font-stretch: 112%; letter-spacing: .04em; background: var(--text); color: var(--asphalt); padding: 0 7px; border-radius: 3px; white-space: nowrap; }

.pipeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; margin-bottom: 16px; }
.pipeline button { background: var(--kerb); border: 0; padding: 10px; text-align: left; cursor: pointer; border-bottom: 3px solid var(--line); }
.pipeline button[aria-pressed='true'] { border-bottom-color: var(--sodium); background: var(--kerb-2); }
.pipeline b { display: block; font: 600 24px var(--display); }
.pipeline span { font-size: 13px; color: var(--muted); }

/* Quatro faces do poste em cruz */
.cross { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tile { position: relative; aspect-ratio: 16 / 9; background: #0a0a0a; border-radius: 2px; overflow: hidden; }
.tile video, .tile canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.can-open { cursor: zoom-in; }
.tile.can-open:hover, .tile.can-open:focus-visible { outline: 2px solid var(--sodium); outline-offset: -2px; }
.focus { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; gap: 8px; background: var(--asphalt); padding: max(8px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); overflow-y: auto; }
.focus-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.focus-title { flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-bar .faces { margin: 0; }
.playback { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0; }
.focus .tl-video, .focus-video { flex: 1 1 auto; min-height: 200px; aspect-ratio: auto; max-width: none; width: 100%; }
.focus .tl-video > .tile { position: absolute; inset: 0; aspect-ratio: auto; }
.focus video { object-fit: contain; }
.focus .ruler { max-width: none; flex: none; }
.focus .tl-tools .field, .tl-tools label { margin: 0; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-legend button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 10px; color: var(--text); background: var(--kerb); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; font: inherit; font-size: 13px; }
.tl-legend button.off { opacity: .45; }
.tl-legend i, .tl-dot { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }
.tl-dot { margin-right: 6px; vertical-align: -1px; }
.tile-tag { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.72); color: #f2f2f2; padding: 1px 7px; border-radius: 2px; font: 600 13px var(--display); }
.tile-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13px; padding: 10px; }
.tile-live { position: absolute; right: 6px; top: 6px; font-size: 12px; font-weight: 600; background: var(--sodium); color: #000; padding: 1px 6px; border-radius: 2px; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
.field input, .field select, .field textarea { background: var(--asphalt); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; color: var(--text); font-size: 15px; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--sodium); outline: none; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid2 .full { grid-column: 1 / -1; }

.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--kerb); border-left: 1px solid var(--line); z-index: 21; overflow-y: auto; padding-block: calc(16px + env(safe-area-inset-top, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)); padding-left: 18px; padding-right: max(18px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 14px; }
.toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--asphalt); padding: 9px 16px; border-radius: var(--r); z-index: 40; font-weight: 500; max-width: calc(100% - 32px); }
.toast.err { background: var(--crit); color: #fff; }

.login { min-height: 100%; display: grid; place-items: center; padding-block: 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.login form, .login .box { width: min(400px, 100%); display: flex; flex-direction: column; gap: 12px; }
.profile { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--kerb); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; cursor: pointer; }
.profile:hover { border-color: var(--sodium); }

.panic { width: 100%; padding: 22px 16px; border-radius: var(--r); border: 3px solid transparent; border-image: var(--hazard) 3; background: #000; color: var(--text); font: 800 24px var(--display); font-stretch: 125%; cursor: pointer; position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.panic i { position: absolute; inset: 0; background: var(--crit); transform-origin: left; transform: scaleX(0); }
.panic span { position: relative; }
.panic.holding span { color: #fff; }

.check { display: flex; align-items: center; gap: 8px; }
.narrow { max-width: 440px; }
.settings { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.tl-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 200px)); gap: 10px; margin-bottom: 10px; }
.faces { display: flex; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.faces button { flex: 1; max-width: 140px; background: none; border: 0; padding: 9px 6px; color: var(--muted); font-weight: 600; cursor: pointer; }
.faces button[aria-selected='true'] { color: var(--sodium); box-shadow: inset 0 -2px var(--sodium); }
.tl-video { max-width: 960px; margin-bottom: 10px; }
.tl-video video { object-fit: contain; }
.ruler { position: relative; max-width: 960px; height: 92px; background: var(--kerb); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.ruler:active { cursor: grabbing; }
.ruler-time { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); font: 700 15px var(--display); font-variant-numeric: tabular-nums; pointer-events: none; }
.tl-tools { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-block: 10px; max-width: 960px; justify-content: space-between; }
.btn.on { background: var(--sodium); border-color: var(--sodium); color: var(--sodium-ink); }
.cap-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; max-width: 960px; }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; margin-top: 14px; }
.cap { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.cap img, .cap-empty { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 2px; background: var(--asphalt); display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.cap-plate { align-self: flex-start; }
.tabbar { display: none; }
.note-item { border-left: 2px solid var(--line); padding-left: 10px; }
textarea.csv { width: 100%; height: 150px; background: var(--asphalt); border: 1px solid var(--line); border-radius: var(--r); color: var(--text); font: 12px ui-monospace, monospace; padding: 8px; }
.notice { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; color: var(--muted); font-size: 14px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .side { display: none; }
  .main { padding-block: 14px 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .tabbar { display: flex; overflow-x: auto; background: var(--asphalt); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .tabbar button { flex: 1 0 auto; min-height: 50px; background: none; border: 0; color: var(--muted); padding: 8px 12px; font-size: 13px; font-weight: 500; }
  .tabbar button[aria-current='page'] { color: var(--sodium); box-shadow: inset 0 2px var(--sodium); }
}
@media (prefers-reduced-motion: reduce) { .panic i { transition: none !important; } }

/* Uma bolinha por câmera do ponto */
.dots { display: inline-flex; flex-wrap: wrap; gap: 3px; max-width: 90px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.login .btn { justify-content: center; padding-block: 10px; }

/* Equipamentos: gravadores agrupados por cliente. */
.client-group { margin-bottom: 28px; }
.client-name { color: var(--sodium); padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.device { padding-top: 6px; }
.device-head { justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 10px; }
.device-head h2 { font-size: 18px; }
/* Canais trazidos do gravador: número, nome editável e estado. */
.found-list { display: grid; gap: 4px; max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.found { display: grid; grid-template-columns: auto 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 8px; background: var(--kerb); border: 1px solid var(--line); border-radius: var(--r); }
.found .ch { color: var(--sodium); font-weight: 700; }
.found input[type='text'], .found input:not([type]) { min-width: 0; }
.found.off { opacity: .55; }
.found.off .ch { color: var(--muted); }
/* Gravador com muitos canais: mosaico mais denso, como no próprio DVR. */
.cross.dense { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 720px) { .cross.dense { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Central que já mandou evento e não tem cadastro: destaque em laranja. */
.unknown { border-color: var(--sodium); background: var(--sodium-soft); }
.how ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.how b { color: var(--text); }

/* Menu em grupos: poucos itens, rótulo discreto acima de cada grupo. */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: 14px; }
.nav-label { padding: 0 12px 4px; font-size: 12px; color: var(--idle); font-weight: 600; }
/* Abas dentro de Equipamentos e Administração. */
.subtabs { margin: 4px 0 14px; overflow-x: auto; }
.subtabs button { flex: 0 0 auto; max-width: none; padding-inline: 14px; }
.sub-head { margin-top: 0; }
.menu-sheet .nav { font-size: 16px; padding-block: 11px; }
.menu-sheet .who { margin-top: 10px; }
@media (max-width: 860px) {
  .tabbar { overflow-x: visible; }
  .tabbar button { flex: 1 1 0; padding-inline: 4px; }
}
/* Zonas editáveis na própria tabela. */
.zones td { vertical-align: middle; }
.zones input, .zones select { width: 100%; min-width: 140px; }
.zone-n { color: var(--sodium); font-weight: 700; width: 48px; }

/* Mosaico ao vivo: a grade ocupa a altura da tela, como uma parede de monitoramento. */
.wall-bar { gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.wall-bar select { width: auto; }
.wall { display: grid; gap: 4px; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows), minmax(0, 1fr)); height: calc(100vh - 210px); min-height: 360px; background: var(--asphalt); }
.wall .tile { aspect-ratio: auto; height: 100%; min-height: 0; }
.wall .tile-tag { font-size: 12px; max-width: calc(100% - 70px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall .tile-empty { background: #070707; }
.wall:fullscreen { height: 100vh; padding: 4px; gap: 3px; }
@media (max-width: 860px) {
  .wall { grid-template-columns: repeat(var(--mcols), minmax(0, 1fr)); grid-template-rows: none; height: auto; }
  .wall .tile { aspect-ratio: 16 / 9; height: auto; }
  .wall .tile-empty { display: none; }
}
.wall-bar select { background: var(--kerb); border: 1px solid var(--line); color: var(--text); padding: 8px 10px; border-radius: var(--r); }

/* Ao vivo como central: lista à esquerda, mosaico, eventos à direita. */
.live { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; height: calc(100vh - 62px); min-height: 480px; }
.live.with-side { grid-template-columns: 250px minmax(0, 1fr); }
.live.with-ev { grid-template-columns: minmax(0, 1fr) 270px; }
.live.with-side.with-ev { grid-template-columns: 250px minmax(0, 1fr) 270px; }
.live-side, .live-ev { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: hidden; }
.live-ev { overflow-y: auto; }
.side-sec { display: flex; flex-direction: column; gap: 6px; }
.side-sec.grow { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.side-sec h3, .live-ev h3 { font-size: 14px; }
.side-sec select { width: auto; font-size: 12px; padding: 4px 6px; background: var(--kerb); border: 1px solid var(--line); color: var(--text); border-radius: var(--r); }
.live-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.live-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.live-bar select { width: auto; background: var(--kerb); border: 1px solid var(--line); color: var(--text); padding: 8px 10px; border-radius: var(--r); }
.live-bar .grow { flex: 1 1 auto; }
.live-title { font-size: 18px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live .wall { flex: 1 1 auto; height: auto; min-height: 0; }
.tree { display: flex; flex-direction: column; gap: 2px; }
.tree-head { display: flex; align-items: center; }
.tree-arrow { background: none; border: 0; color: var(--muted); width: 22px; cursor: pointer; padding: 4px 0; }
.tree-name { background: none; border: 0; color: var(--text); text-align: left; cursor: pointer; padding: 4px 4px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-name:hover { color: var(--sodium); }
.tree-place { padding-left: 22px; display: flex; flex-direction: column; }
.tree-place .tree-name { font-weight: 600; color: var(--muted); }
.tree-node > .tree-cam { margin-left: 22px; }
.tree-cam { display: flex; align-items: center; gap: 7px; background: none; border: 0; color: var(--text); text-align: left; padding: 3px 6px; font-size: 13px; cursor: grab; border-radius: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-place .tree-cam { margin-left: 8px; }
.tree-cam:hover { background: var(--kerb-2); }
.tree-cam .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--idle); flex: none; }
.tree-cam .dot.on { background: var(--ok); }
.fav { display: flex; align-items: center; justify-content: space-between; gap: 6px; border-left: 2px solid transparent; padding-left: 4px; }
.fav.on { border-left-color: var(--sodium); }
.tile.selected { outline: 2px solid var(--sodium); outline-offset: -2px; }
.tile-menu { position: absolute; right: 4px; bottom: 4px; width: 28px; height: 28px; border-radius: 2px; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; opacity: 0; }
.tile:hover .tile-menu, .tile:focus-within .tile-menu, .tile-menu:focus-visible { opacity: 1; }
@media (hover: none) { .tile-menu { opacity: 1; } }
.ctx { position: fixed; z-index: 40; min-width: 220px; background: var(--kerb-2); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 0; box-shadow: 0 8px 24px rgba(0,0,0,.5); display: flex; flex-direction: column; }
.ctx-title { padding: 6px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.ctx button { background: none; border: 0; color: var(--text); text-align: left; padding: 8px 12px; cursor: pointer; font-size: 14px; }
.ctx button:hover, .ctx button:focus-visible { background: var(--sodium-soft); color: var(--text); }
.ev-list { display: flex; flex-direction: column; gap: 6px; }
.ev { display: flex; flex-direction: column; gap: 4px; text-align: left; background: var(--kerb); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; color: var(--text); cursor: pointer; }
.ev:disabled { cursor: default; }
.ev.hot { border-color: var(--crit); }
.ev:not(:disabled):hover { border-color: var(--sodium); }
.ev-cam { color: var(--sodium); font-weight: 600; }
@media (max-width: 860px) {
  .live, .live.with-side, .live.with-ev, .live.with-side.with-ev { display: flex; flex-direction: column; height: auto; }
  .live-side { max-height: 60vh; }
  .live .wall { flex: none; }
  .live-title { max-width: 100%; flex-basis: 100%; order: -1; }
}
.live-bar .btn { padding: 7px 11px; }
.live-bar select { padding: 7px 8px; }
.live .wall .tile-tag { max-width: calc(100% - 52px); }

/* Detecção inteligente: áreas desenhadas sobre o vídeo. Com áreas à vista, o vídeo ocupa o quadro inteiro para as áreas baterem com a imagem. */
.ai-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.ai-overlay polygon { fill: rgba(255,107,0,.14); stroke: var(--sodium); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.ai-overlay text { fill: #fff; font: 600 0.035px var(--display); paint-order: stroke; stroke: #000; stroke-width: 0.006px; }
.ai-overlay .draft { fill: none; stroke: var(--warn); stroke-width: 2px; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.ai-overlay circle { fill: var(--warn); }
.ai-overlay.drawing { pointer-events: auto; cursor: crosshair; }
.wall.with-areas .tile video { object-fit: fill; }
.ai-canvas { position: relative; max-width: 720px; aspect-ratio: 16 / 9; }
.ai-canvas .tile { position: absolute; inset: 0; aspect-ratio: auto; }
.ai-canvas .tile video { object-fit: fill; }
.ai-head { gap: 10px; }
.ai-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ai-shot { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.ai-shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 2px; background: var(--asphalt); }
.ev.hot-ai { border-color: var(--sodium); }
.ev-shot { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 2px; }
