/* Codex Player — tema escuro com destaques em laranja (conforme PRD de UX).
   Fonte do sistema: o servidor pode rodar em rede interna sem internet. */
:root {
  color-scheme: dark;
  --bg: #0e0f11;
  --panel: #16181b;
  --panel-2: #1d2024;
  --line: #2a2e33;
  --text: #f2f3f4;
  --muted: #a3a9b0;
  --orange: #ff8a1f;
  --orange-ink: #1a0d00;
  --green: #3dcb7f;
  --red: #f0524a;
  --blue: #3d8bfd;
  --tile: #050607;
  --r: 6px;
  --top: 46px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); font-variant-numeric: tabular-nums; overflow: hidden; }
[hidden] { display: none !important; }
textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.muted { color: var(--muted); }
h2 { font-size: 15px; margin: 0; }

/* Controles ---------------------------------------------------------------- */
.btn, .tool {
  font: inherit; font-weight: 600; font-size: 13px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 7px 12px; cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled), .tool:hover:not(:disabled) { border-color: #4a5058; }
.btn:disabled, .tool:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary, .tool.primary { background: var(--orange); border-color: var(--orange); color: var(--orange-ink); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger { color: var(--red); background: transparent; }
.tool[aria-pressed="true"] { border-color: var(--orange); color: var(--orange); }
.link { background: none; border: 0; color: var(--orange); font: inherit; font-size: 12px; cursor: pointer; padding: 0; }
input, select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r); padding: 7px 9px; min-width: 0;
}
input.num { width: 5em; }
label.stack { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
label.stack small { font-weight: 400; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
label.check > input { flex: none; }   /* texto longo não encolhe a caixa */
.form-error { color: var(--red); min-height: 1.2em; margin: 0; font-size: 12px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.segmented button {
  font: inherit; font-size: 12px; font-weight: 600; min-width: 34px; padding: 5px 9px;
  border: 0; border-left: 1px solid var(--line); background: var(--panel-2); color: var(--muted); cursor: pointer;
}
.segmented button:first-child { border-left: 0; }
.segmented button[aria-pressed="true"] { background: var(--orange); color: var(--orange-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #5c636b; flex: none; display: inline-block; }
.dot.on { background: var(--green); }
.dot.err { background: var(--red); }
.dot.rec { background: var(--green); box-shadow: 0 0 0 3px rgba(61, 139, 253, .55); }

/* Login ---------------------------------------------------------------------- */
.login { height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(360px, 100%); display: grid; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 28px; }
.login-card .muted { margin: -6px 0 2px; }
.brand { display: flex; align-items: center; gap: 9px; margin: 0; font-weight: 800; letter-spacing: .02em; font-size: 15px; }
.login-card .brand { font-size: 20px; }
.mark { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--orange); position: relative; flex: none; }
.mark::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--orange); }

/* Barra superior --------------------------------------------------------------- */
.topbar {
  position: relative; height: var(--top); display: flex; align-items: center; gap: 22px;
  padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.tabs { display: flex; height: 100%; }
.tabs a {
  display: flex; align-items: center; padding: 0 14px; color: var(--muted);
  text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--orange); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who, .clock { font-size: 12px; color: var(--muted); white-space: nowrap; }
.dst-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 10px; margin-bottom: 14px; }
.dst-card { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--panel); display: grid; gap: 6px; }
.dst-card.off { opacity: .65; } .dst-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; } .dst-info { font-size: 12.5px; color: var(--muted); }
.dir-tab { max-height: 50vh; overflow: auto; } .dir-tab td { font-size: 12px; }
.leve-btn { font: inherit; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 12px; border: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; white-space: nowrap; }
.leve-btn[aria-pressed="true"] { border-color: var(--orange); color: var(--orange); background: rgba(255, 121, 0, .1); }
.icon-btn { position: relative; background: none; border: 0; padding: 4px; cursor: pointer; color: var(--muted); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; display: block; }
.icon-btn:hover { color: var(--text); }
.badge { position: absolute; top: -2px; right: -4px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px; padding: 0 5px; line-height: 16px; }
.alerts {
  position: absolute; right: 14px; top: calc(var(--top) - 4px); z-index: 30; width: 340px; max-height: 60vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}
.alerts header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.alerts ul { list-style: none; margin: 0; padding: 0; }
.alerts li { padding: 10px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.alerts li.read { opacity: .55; }
.alerts li .t { font-size: 13px; }
.alerts li .t b.crit { color: var(--red); }
.alerts li .t b.ok { color: var(--green); }
.alerts li .m { display: flex; gap: 12px; font-size: 11px; color: var(--muted); align-items: center; }
.alerts li .m .link { margin-left: auto; }
.alerts .empty { color: var(--muted); padding: 18px 12px; }

/* Estrutura das telas ----------------------------------------------------------- */
.view { display: none; height: calc(100vh - var(--top)); }
.view.active { display: grid; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; padding: 12px; min-height: 0; }
.side.right { border-right: 0; border-left: 1px solid var(--line); overflow-y: auto; }
.side-title { margin-bottom: 4px; }
.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.hint { font-size: 11px; color: var(--muted); margin: 0; }
.mfa-qr { display: flex; gap: 14px; align-items: center; } .mfa-qr svg { flex: none; border-radius: 4px; }
.mfa-key { font: 13px/1.5 Consolas, monospace; letter-spacing: 1px; word-break: break-all; user-select: all; }
.login-or { text-align: center; color: var(--muted); font-size: 12px; margin: 2px 0; }
.btn.ms { display: flex; justify-content: center; align-items: center; gap: 10px; text-decoration: none; background: #fff; color: #1b1b1b; border: 1px solid #8c8c8c; }
.ms-logo { display: grid; grid-template-columns: 9px 9px; gap: 2px; } .ms-logo i { width: 9px; height: 9px; display: block; }
.ms-logo i:nth-child(1) { background: #f25022; } .ms-logo i:nth-child(2) { background: #7fba00; } .ms-logo i:nth-child(3) { background: #00a4ef; } .ms-logo i:nth-child(4) { background: #ffb900; }
.badge-mfa { font-size: 10px; border: 1px solid var(--green); color: var(--green); border-radius: 3px; padding: 0 4px; margin-left: 4px; }
.sel-name { margin: -4px 0 4px; font-size: 12px; color: var(--muted); }

/* Visualização */
.view.live { grid-template-columns: 260px minmax(0, 1fr) 248px; }
.side-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); margin: -12px -12px 0; }
.side-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 11px 0 9px; cursor: pointer; }
.side-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--orange); }
.search { width: 100%; }
.tree { flex: 1; overflow-y: auto; margin: 0 -6px; }
.tree details { margin-bottom: 2px; }
.tree summary { list-style: none; cursor: pointer; padding: 6px; border-radius: 4px; font-weight: 700; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: "▸"; color: var(--muted); font-size: 10px; width: 10px; }
.tree details[open] > summary::before { content: "▾"; }
.tree summary .cnt { margin-left: auto; font-weight: 400; color: var(--muted); font-size: 11px; }
.tree .cam {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 22px; border-radius: 4px;
  font-size: 13px; cursor: grab; user-select: none;
}
.tree .cam:hover { background: var(--panel-2); }
.tree .cam.in-grid .nm { color: var(--orange); }
.tree .cam .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tree .fav { background: none; border: 0; color: #5c636b; cursor: pointer; font-size: 13px; padding: 0 2px; }
.tree .fav[aria-pressed="true"] { color: var(--orange); }
.tree .none { color: var(--muted); font-size: 12px; padding: 10px 6px; }
.btn.add { width: 100%; border-style: dashed; background: transparent; color: var(--orange); }

.grid {
  --cols: 2; flex: 1; min-height: 0; display: grid; gap: 2px; padding: 2px; background: #000;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr);
}
.grid[data-n="1"] { --cols: 1; }
.grid[data-n="9"] { --cols: 3; }
.grid[data-n="16"] { --cols: 4; }
.tile { position: relative; background: var(--tile); overflow: hidden; outline: 2px solid transparent; outline-offset: -2px; cursor: pointer; }
.tile.selected { outline-color: var(--orange); }
.tile.drop { outline-color: var(--orange); outline-style: dashed; }
.tile video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile .osd-top, .tile .osd-bot {
  position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 8px;
  padding: 6px 9px; font-size: 13px; color: #e9ecef; pointer-events: none;
}
/* o alto da imagem fica livre para a data que a própria câmera escreve: nome, status e horário numa faixa embaixo;
   no alto só os botões, à direita e só com o mouse em cima */
.tile .osd-top { top: 0; justify-content: flex-end; background: none; }
.tile .osd-bot { bottom: 0; background: linear-gradient(transparent, rgba(0, 0, 0, .8)); flex-wrap: nowrap; font-size: 12px; }
.tile .osd-bot > .si:empty { display: none; }
.tile .osd-bot .st { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 4 auto; }   /* aperta antes do nome */
.tile .osd-top .acts { background: rgba(0, 0, 0, .55); border-radius: 5px; padding: 2px; }
.tile .nm { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
.tile .tm { margin-left: auto; flex: none; }
.tile .st { color: #c4cad0; }
.tile .acts { margin-left: auto; display: flex; gap: 4px; pointer-events: auto; opacity: 0; transition: opacity .12s; }
.tile:hover .acts, .tile.selected .acts, .tile:focus-within .acts { opacity: 1; }
.tile .acts button {
  font: inherit; font-size: 11px; font-weight: 600; color: #fff; cursor: pointer;
  background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .25); border-radius: 4px; padding: 2px 7px;
}
.tile .acts button[aria-pressed="true"] { border-color: var(--orange); color: var(--orange); }
.tile-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 18px; color: #9aa2aa; font-size: 14px; pointer-events: none; }
.tile.empty .tile-msg { color: #4b525a; }

.viewbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel); border-top: 1px solid var(--line); }
.viewbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.viewbar-info { margin-left: auto; font-size: 12px; color: var(--muted); }

.panel { display: grid; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.panel:last-child { border-bottom: 0; }
.ptz-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 150px; margin: 0 auto; }
.ptz-pad button, .ptz-pairs button { height: 36px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); color: var(--text); font-size: 14px; cursor: pointer; }
.ptz-pad button:disabled, .ptz-pairs button:disabled { opacity: .35; cursor: not-allowed; }
.ptz-pad button, .ptz-pairs button { touch-action: none; user-select: none; }
.ptz-pad button:active, .ptz-pairs button:active { background: var(--orange); color: var(--orange-ink); border-color: var(--orange); }
.hint.err { color: var(--red); }
.ptz-center { border-radius: 50%; border: 2px solid var(--line); margin: 8px; }
.ptz-pairs { display: grid; grid-template-columns: 1fr 44px 44px; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); }
.row2 { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toggles { display: grid; gap: 2px; }
.toggle { display: flex; align-items: center; justify-content: space-between; font-size: 13px; padding: 5px 0; }
.switch { appearance: none; width: 34px; height: 18px; border-radius: 9px; background: #3a3f45; position: relative; cursor: pointer; border: 0; padding: 0; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #cfd4d9; transition: left .12s; }
.switch:checked { background: var(--orange); }
.switch:checked::after { left: 18px; background: #fff; }
.switch:disabled { opacity: .4; cursor: not-allowed; }

/* Reprodução */
.view.play { grid-template-columns: 250px minmax(0, 1fr); }
.player { position: relative; flex: 1; min-height: 0; background: #000; }
.player video { width: 100%; height: 100%; object-fit: contain; display: block; }
.player-osd { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-end; padding: 6px 8px; font-size: 12px; pointer-events: none; }
.player-osd > span:not(:empty) { background: rgba(0, 0, 0, .62); color: #fff; padding: 2px 7px; border-radius: 4px; }
.player-osd #rec-pos { font-size: 15px; font-weight: 700; }
#rec-time { font-variant-numeric: tabular-nums; font-size: 15px; letter-spacing: .5px; } #rec-time.bad { border-color: var(--red); }
.pb-hours { margin-top: -4px; } .pb-hours .tool { padding: 3px 7px; font-size: 12px; }
.timeline-box { background: var(--panel); border-top: 1px solid var(--line); padding: 8px 12px 10px; }
.tl-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; list-style: none; margin: 0 0 0 auto; padding: 0; font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.c-rec { background: var(--blue); } .c-mov { background: var(--green); } .c-ai { background: var(--red); } .c-man { background: var(--orange); }
.timeline {
  position: relative; height: 34px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; cursor: grab; overflow: hidden;
}
.timeline .seg { position: absolute; top: 8px; bottom: 8px; background: var(--blue); border-radius: 2px; min-width: 2px; }
.timeline .tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.timeline .cursor { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: var(--orange); cursor: ew-resize; z-index: 3; }
.timeline .cursor::before { content: ""; position: absolute; top: 0; bottom: 0; left: -7px; right: -7px; }   /* área de pegar maior que a linha */
.timeline .cursor::after { content: ""; position: absolute; top: -1px; left: -5px; width: 13px; height: 9px; background: var(--orange); border-radius: 0 0 4px 4px; }
.timeline .cursor.drag { box-shadow: 0 0 0 1px rgba(255,121,0,.4); }
.timeline .cur-t { position: absolute; bottom: 2px; left: 8px; padding: 1px 5px; border-radius: 3px; background: var(--orange); color: #fff; font-size: 11px; white-space: nowrap; pointer-events: none; }
.tl-rows.selmode .timeline { cursor: crosshair; } .tl-rows.panning .timeline { cursor: grabbing; }
#pb-selmode[aria-pressed="true"] { background: var(--orange); color: #fff; border-color: var(--orange); }
.timeline .sel-h { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: #2fbf71; cursor: ew-resize; z-index: 4; }
.timeline .sel-h.out { background: #a371f7; }
.timeline .sel-h::before { content: ""; position: absolute; top: 0; bottom: 0; left: -7px; right: -7px; }
.timeline .sel-h span { position: absolute; top: 50%; transform: translateY(-50%); padding: 1px 6px; border-radius: 3px; background: #2fbf71; color: #16181b; font-size: 10px; font-weight: 700; white-space: nowrap; }
.timeline .sel-h.in span { right: 4px; } .timeline .sel-h.out span { left: 4px; }   /* rótulos fora do trecho: não se sobrepõem */
.timeline .sel-h.in.inside span { right: auto; left: 4px; } .timeline .sel-h.out.inside span { left: auto; right: 4px; }
#pb-selinfo { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; } #pb-selinfo .tool.small { padding: 3px 8px; font-size: 12px; }
.timeline .sel-h.out span { background: #a371f7; color: #fff; }
#pb-in { border-color: #2fbf71; } #pb-out { border-color: #a371f7; }
#pb-in-t { border-color: #2fbf71; } #pb-out-t { border-color: #a371f7; }
.tl-ticks span { cursor: pointer; } .tl-ticks span:hover { color: var(--text); text-decoration: underline; }
.share-link { display: flex; gap: 6px; } .share-link input { flex: 1; font: 12px ui-monospace, monospace; padding: 6px 8px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; }
.cam-src-show { justify-self: start; font-size: 12px; margin-top: 2px; }
.tl-time { width: 104px; padding: 3px 6px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 12px; color-scheme: dark; }
/* Abas dentro de formulário (cadastro da câmera) */
.ftabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 2px 0 4px; flex-wrap: wrap; }
.ftabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 12px; font: inherit; cursor: pointer; }
.ftabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--orange); font-weight: 700; }
.ftabs button.has::after { content: " •"; color: var(--orange); }
.fpane { display: grid; gap: 10px; min-height: 300px; align-content: start; }
.fpane[hidden] { display: none; }
.perms { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; display: grid; gap: 6px; margin: 0; }
.perms legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.perms:disabled { opacity: .6; }
.sys-issue { margin-left: 8px; color: var(--orange); font-weight: 700; } .sys-issue.crit { color: var(--red); }
/* Importação de câmeras */
dialog.wide { width: min(1100px, 95vw); }
.grp-tools { display: flex; gap: 12px; align-items: center; } .grp-tools input { width: 260px; }
.grp-matrix-wrap { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.grp-matrix th, .grp-matrix td { padding: 5px 10px; } .grp-matrix th:not(:first-child), .grp-matrix td:not(:first-child) { text-align: center; width: 110px; }
.grp-matrix thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 1; }
.grp-matrix tr.base td:first-child { font-weight: 600; } .grp-matrix tr.cam td:first-child { padding-left: 30px; color: var(--muted); }
.grp-matrix tr.all td { background: var(--panel-2); } .grp-matrix .tog { background: none; border: 0; color: var(--muted); cursor: pointer; width: 18px; }
.grp-matrix input:disabled:checked { accent-color: var(--muted); }
.user-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; max-height: 140px; overflow: auto; }
.chip { display: inline-block; font-size: 11px; border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; margin: 1px 3px 1px 0; color: var(--muted); }
.chip.entra { border-color: var(--blue); color: var(--blue); }
.imp-table { max-height: 45vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.imp-table:empty { display: none; }
.imp-table td.msg { white-space: normal; max-width: 360px; }
.imp-st { font-weight: 700; white-space: nowrap; } .imp-st.ok, .imp-st.created { color: var(--green); } .imp-st.exists { color: var(--muted); } .imp-st.error { color: var(--red); }
.imp-summary { font-weight: 700; }
#imp-pick { cursor: pointer; }
.sys-issues { list-style: none; padding: 0; margin: 4px 0 16px; display: grid; gap: 6px; }
.sys-issues li { border: 1px solid var(--line); border-left: 3px solid var(--orange); border-radius: 4px; padding: 8px 10px; }
.sys-issues li.crit { border-left-color: var(--red); } .sys-issues li.none { border-left-color: var(--green); color: var(--muted); }
button.who { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; }
button.who:hover { text-decoration: underline; }
/* Agenda de gravação (7 dias × 24 h) */
.sched { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 2px; user-select: none; font-size: 10px; color: var(--muted); }
.sched .h { text-align: center; } .sched .d { align-self: center; font-size: 11px; }
.sched .c { height: 16px; border-radius: 2px; background: var(--line); cursor: pointer; }
.sched .c.on { background: var(--blue); }
.sched.off { opacity: .55; pointer-events: none; }
.sched-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.sched-bar .tool { font-size: 11px; padding: 3px 8px; }
.sched-sum { font-size: 12px; color: var(--muted); margin-left: auto; }
.ver-out { margin-top: 10px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); line-height: 1.5; word-break: break-all; }
.ver-out:empty { display: none; } .ver-out.ok { border-color: var(--green); } .ver-out.bad { border-color: var(--red); }
.tile .armed { margin-left: 8px; color: var(--orange); font-weight: 700; }
/* Filtros dos logs */
.log-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 10px; align-items: end; margin: 8px 0 6px; }
.log-quick { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; grid-column: 1 / -1; }
/* Armazenamento */
.stor-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 12px 0 18px; }
.stor-card { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: var(--panel); }
.stor-card .k { font-size: 12px; color: var(--muted); } .stor-card .v { font-size: 20px; font-weight: 700; margin-top: 2px; }
.stor-card .bar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 8px; overflow: hidden; }
.stor-card .bar i { display: block; height: 100%; background: var(--orange); }
.stor-card.warn .v { color: var(--orange); }
.stor-card.bad .v, .av-bad { color: var(--red); } .stor-card.ok .v, .av-ok { color: var(--green); } .av-warn { color: var(--orange); }
.av-bar { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--line); margin-right: 8px; vertical-align: middle; overflow: hidden; }
.av-bar i { display: block; height: 100%; background: currentColor; }
[data-cfgview="disponibilidade"] h3 { margin: 18px 0 8px; font-size: 14px; }
.over { color: var(--orange); font-weight: 700; }
/* Trecho selecionado, marcadores e calendário da reprodução */
.timeline .mov { position: absolute; bottom: 2px; height: 6px; background: var(--green); border-radius: 2px; min-width: 2px; pointer-events: none; }
.timeline .aiev { position: absolute; bottom: 9px; height: 6px; background: var(--red); border-radius: 2px; min-width: 3px; pointer-events: none; }
.timeline .tamp { position: absolute; bottom: 9px; height: 6px; background: repeating-linear-gradient(45deg, #e0c341 0 4px, #000 4px 8px); border-radius: 2px; min-width: 3px; pointer-events: none; }
.ai-panel { display: grid; gap: 6px; font-size: 13px; margin-bottom: 10px; } .ai-panel .row { display: flex; justify-content: space-between; gap: 8px; }
.ai-panel .on { color: var(--green); } .ai-panel .off { color: var(--muted); } .ai-panel .err { color: var(--red); }
.ev-kind.person, .ev-kind.vehicle, .ev-kind.abandoned, .ev-kind.removed, .ev-kind.changed { color: var(--red); } .ev-kind.motion { color: var(--green); }
.ev-kind.tamper { color: #e0c341; }
.timeline .selr { position: absolute; top: 0; bottom: 0; background: rgba(255, 138, 31, .22); border-left: 2px solid var(--orange); border-right: 2px solid var(--orange); pointer-events: none; }
.timeline .mk { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: #ffd23f; cursor: pointer; z-index: 2; }
.timeline .mk::before { content: ""; position: absolute; top: 0; left: -4px; border: 5px solid transparent; border-top-color: #ffd23f; }
.selinfo { font-size: 12px; color: var(--orange); white-space: nowrap; }
.selinfo button { margin-left: 4px; }
.date-row { display: flex; gap: 6px; } .date-row input { flex: 1; min-width: 0; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 700; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal .dow { font-size: 11px; color: var(--muted); }
.cal button { padding: 7px 0; border-radius: 4px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font: inherit; }
.cal button.rec { color: var(--text); border-color: var(--blue); background: rgba(80, 140, 255, .18); font-weight: 700; }
.cal button.sel { outline: 2px solid var(--orange); }
.cal button:disabled { opacity: .35; cursor: default; }
.cal-legend { margin-top: 8px; font-size: 12px; color: var(--muted); }
.timeline .hover { position: absolute; top: 2px; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 11px; padding: 0 5px; border-radius: 3px; pointer-events: none; }
.tl-ticks { position: relative; height: 16px; font-size: 10px; color: var(--muted); }
.tl-ticks span { position: absolute; transform: translateX(-50%); top: 2px; }

/* IA */
.view.ai { grid-template-rows: auto auto 1fr; align-content: start; overflow: hidden; }
.ai-tabs { display: flex; gap: 4px; align-items: center; padding: 8px 16px 0; background: var(--panel); border-bottom: 1px solid var(--line); }
.ai-tabs button { background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); padding: 8px 12px; font-weight: 600; cursor: pointer; }
.ai-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--orange); }
/* abas numa linha só (nome inteiro, sem quebrar em duas); em tela estreita rolam para o lado e a frase do canto sai */
.ai-tabs { overflow-x: auto; scrollbar-width: thin; } .ai-tabs button { white-space: nowrap; flex: none; }
.ai-principle { margin-left: auto; max-width: 300px; font-size: 11px; line-height: 1.3; padding-bottom: 6px; }
@media (max-width: 1400px) { .ai-principle { display: none; } }
@media (max-width: 1180px) { .clock { display: none; } .tabs a { padding: 0 9px; } .topbar { gap: 12px; } }
.badge-n { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; }
.badge-n:empty { display: none; }
.rv-list { overflow-y: auto; padding: 12px 16px; max-height: calc(100vh - var(--top) - 120px); display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; align-content: start; }
.rv-card { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--blue); border-radius: var(--r); padding: 10px; display: grid; gap: 7px; }
.rv-card.P0 { border-left-color: var(--red); } .rv-card.P1 { border-left-color: var(--orange); } .rv-card.P2 { border-left-color: #e0c341; }
.rv-shot { position: relative; background: #000; aspect-ratio: 16 / 9; border-radius: 4px; overflow: hidden; }
.rv-shot img { width: 100%; height: 100%; object-fit: contain; } .rv-shot .bx { position: absolute; border: 2px solid var(--orange); box-shadow: 0 0 0 1px #000; }
.rv-shot .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.sev { font-weight: 700; font-size: 12px; } .sev.P0 { color: var(--red); } .sev.P1 { color: var(--orange); } .sev.P2 { color: #e0c341; } .sev.P3 { color: var(--muted); }
.rv-prelim { font-size: 12px; color: var(--orange); } .rv-final { font-size: 12px; color: var(--green); }
.rv-acts { display: flex; flex-wrap: wrap; gap: 6px; } .rv-meta { font-size: 12px; color: var(--muted); }
.rv-hist { font-size: 12px; display: grid; gap: 4px; max-height: 220px; overflow: auto; } .rv-hist div { border-left: 2px solid var(--line); padding-left: 6px; }
.rv-player { display: grid; gap: 8px; margin-bottom: 10px; } .rv-stage video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 4px; display: block; }
.rv-stage [hidden] { display: none; } .rv-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .rv-pick select { flex: 1; min-width: 220px; }
.ev-list { overflow-y: auto; padding: 0 14px; max-height: calc(100vh - var(--top) - 70px); }
.ev-kind { color: var(--green); }
/* Eventos: linha compacta + detecções recolhidas */
.ev-table td { vertical-align: middle; }
.ev-when, .ev-cam { white-space: nowrap; } .ev-when small, .ev-cam small { display: block; font-size: 11px; color: var(--muted); }
.ev-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ev-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap;
  border: 1px solid currentColor; color: var(--red); }
.ev-chip i { font-style: normal; font-weight: 700; font-size: 11px; background: rgba(255, 255, 255, .12); border-radius: 8px; padding: 0 5px; }
.ev-chip.motion, .ev-chip.anomaly { color: var(--green); } .ev-chip.tamper { color: #e0c341; }
.ev-acts { white-space: nowrap; text-align: right; } .ev-acts .btn + .btn { margin-left: 6px; }
.ev-sub > td { padding: 0 0 10px; background: transparent; }
.ev-subbox { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); margin: 0 4px; }
.ev-subhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ev-filter { display: flex; gap: 4px; flex-wrap: wrap; }
.ev-sublist { max-height: 300px; overflow-y: auto; }
.ev-subrow { display: grid; grid-template-columns: 80px 190px 110px 1fr auto; gap: 10px; align-items: center; padding: 4px 10px; font-size: 12px; border-bottom: 1px solid var(--line); }
.ev-subrow:last-child { border-bottom: 0; } .ev-subrow .ev-chip { justify-self: start; }
/* Zonas e regras */
.zn-pane { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; padding: 0 16px 12px; overflow: auto; max-height: calc(100vh - var(--top) - 50px); }
.zn-pane[hidden] { display: none; }
/* layout fixo: imagem à esquerda (cabe na tela), painel à direita (guia, passos do desenho ou formulário) */
.zn-pane { grid-template-columns: minmax(0, 1fr) 380px; }
.zn-stage { width: min(100%, calc((100vh - var(--top) - 230px) * var(--ar, 1.78))); aspect-ratio: var(--ar, 1.78); }
.zn-side { display: grid; gap: 10px; align-content: start; position: sticky; top: 0; max-height: calc(100vh - var(--top) - 60px); overflow-y: auto; }
.zn-guide, .zn-steps { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 8px; }
.zn-guide h3, .zn-steps h3 { margin: 0; font-size: 15px; }
.zn-card { text-align: left; display: grid; gap: 2px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit; }
.zn-card:hover { border-color: var(--orange); } .zn-card b { font-size: 13px; } .zn-card span { font-size: 12px; } .zn-card i { font-size: 11px; color: var(--muted); font-style: normal; }
.zn-steps ol { margin: 0; padding-left: 18px; font-size: 13px; display: grid; gap: 4px; }
.zn-adv summary { cursor: pointer; font-size: 13px; color: var(--muted); margin-top: 14px; }
@media (max-width: 1100px) { .zn-pane { grid-template-columns: minmax(0, 1fr); } .zn-side { position: static; max-height: none; } }
.zn-stage { position: relative; background: #000; border-radius: 4px; overflow: hidden; user-select: none; max-width: 1100px; }
.zn-stage img { display: block; width: 100%; height: 100%; object-fit: fill; }
.zn-stage img[hidden] { display: none; }
.zn-noimg { position: absolute; inset: 0; display: grid; align-content: start; justify-content: start; gap: 2px; padding: 10px 12px; color: #c8cdd3; font-size: 12px;
  background: repeating-linear-gradient(45deg, #111 0 12px, #161616 12px 24px); pointer-events: none; }
.zn-noimg[hidden] { display: none; } .zn-noimg b { font-size: 15px; color: #fff; }
.zn-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.zn-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 8px; margin-bottom: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); max-width: 1100px; }
.zn-tools-l { font-size: 12px; color: var(--muted); margin-right: 4px; }
.zn-tool { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.zn-tool:hover { border-color: var(--orange); } .zn-tool[aria-pressed="true"] { border-color: var(--orange); background: #FF790026; }
/* cor de cada tipo: a mesma no botão, na lista e na imagem */
.zn-sw { width: 14px; height: 14px; border-radius: 3px; flex: none; display: inline-block; border: 2px solid; }
.zn-sw.area { border-color: var(--orange); background: rgba(255, 121, 0, .3); } .zn-sw.line { border-color: #4ea3ff; background: none; height: 0; border-width: 2px 0 0; width: 16px; }
.zn-sw.object { border-color: #4ea3ff; border-style: dashed; background: rgba(78, 163, 255, .2); } .zn-sw.perimeter { border-color: #e0c341; border-style: dashed; background: rgba(224, 195, 65, .2); }
.zn-sw.ignore { border-color: #9aa3ad; border-style: dashed; background: rgba(0, 0, 0, .5); } .zn-sw.mask { border-color: #c9a0ff; background: #000; }
.zn-layers { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; display: grid; gap: 8px; }
.zn-layers h3 { margin: 0; font-size: 15px; }
.zn-zlist { display: grid; gap: 2px; max-height: 40vh; overflow-y: auto; }
.zn-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.zn-row:hover { background: var(--panel-2); } .zn-row.sel { border-color: var(--orange); background: var(--panel-2); } .zn-row.off .zn-row-t { opacity: .55; }
.zn-row-t { flex: 1; min-width: 0; display: grid; } .zn-row-t b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .zn-row-t .hint { font-size: 11px; }
.zn-eye { background: none; border: 0; color: var(--text); cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 4px; } .zn-eye.hid { color: var(--muted); } .zn-eye:hover { background: var(--line); }
.zn-stage .hov polygon, .zn-stage .hov line { stroke: #fff; stroke-width: 3; }
.zn-stage svg { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.zn-stage polygon, .zn-stage line { stroke-width: 2; vector-effect: non-scaling-stroke; cursor: pointer; }
.zn-stage .area { fill: rgba(255, 121, 0, .18); stroke: var(--orange); } .zn-stage .ignore { fill: rgba(0, 0, 0, .45); stroke: #9aa3ad; stroke-dasharray: 6 4; }
.zn-stage .line { stroke: #4ea3ff; stroke-width: 3; } .zn-stage .off { opacity: .45; }
.zn-stage .mask { fill: #000; stroke: #c9a0ff; stroke-dasharray: 2 3; }
.zn-stage .object { fill: rgba(78, 163, 255, .15); stroke: #4ea3ff; stroke-dasharray: 6 3; }
.zn-stage .perimeter { fill: rgba(224, 195, 65, .12); stroke: #e0c341; stroke-dasharray: 3 3; }
.rc-pass { display: grid; grid-template-columns: 120px 1fr auto; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); padding: 4px 0; font-size: 12px; }
.rc-pass img { width: 120px; border-radius: 3px; display: block; }
/* Máscara de privacidade sobre o vídeo (ao vivo e reprodução) */
.pmask { position: absolute; pointer-events: none; z-index: 1; } .pmask polygon { fill: #000; }
.badge-test { display: inline-block; padding: 0 6px; border-radius: 9px; background: #6b5a00; color: #fff; font-size: 11px; font-weight: 700; }
/* Pesquisa retrospectiva */
.ps-pane { padding: 0 16px 12px; overflow-y: auto; overflow-x: hidden; max-height: calc(100vh - var(--top) - 50px); display: grid; gap: 10px; align-content: start; }
.ps-pane[hidden] { display: none; }
.ps-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 8px; min-width: 0; }
.ps-ask { display: flex; gap: 8px; } .ps-ask input { flex: 1; }
.ps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 12px; }
.ps-main { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 12px; }
.ps-sec { border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; }
.ps-sec > summary { cursor: pointer; padding: 7px 0; font-size: 13px; font-weight: 600; }
.ps-sec[open] { padding-bottom: 10px; } .ps-sum { font-weight: 400; color: var(--muted); margin-left: 6px; }
.ps-zones { font-size: 13px; } .zn-tpl { max-width: 230px; margin-left: 6px; } .box-scroll { max-height: 320px; overflow-y: auto; }
.ps-zones label[hidden], .ps-zg[hidden] { display: none; } .ps-zones > .muted { font-size: 12px; }
.ps-zg > b { display: block; font-size: 11px; font-weight: 600; opacity: .75; padding-bottom: 4px; margin-bottom: 2px; border-bottom: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* listas de marcar agrupadas: caixas em colunas que se encaixam (sem buracos), uma linha por item, nome longo cortado */
.box-cols { columns: 250px; column-gap: 8px; }
.box-col { break-inside: avoid; display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
.box-col label.check { min-width: 0; } .box-col label.check > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* listas de marcar soltas (tipos de evento, grupos, câmeras do relatório): grade alinhada em vez de linha corrida */
.ck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.ps-go { display: flex; gap: 10px; align-items: end; } .ps-why { flex: 1; }
.ps-rh { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ps-rh .segmented button { font-size: 13px; }
/* resultados: grade de cartões com foto (como a busca de gravações dos VMS) */
.ps-gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.ps-it { position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel-2); display: grid; align-content: start; }
.ps-it:hover { border-color: var(--orange); }
.ps-ph { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; padding: 0; border: 0; background: #0006; cursor: pointer; color: var(--muted); font: inherit; font-size: 12px; }
.ps-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ps-tag { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: #000b; color: #fff; }
.ps-tag.ev.P0, .ps-tag.ev.P1 { background: var(--red); } .ps-tag.ev.P2 { background: #b8860b; } .ps-tag.entrada { background: #1e7a3c; } .ps-tag.saida { background: #b35400; }
.ps-ph .ps-sim { position: absolute; right: 6px; top: 6px; }
.ps-it .ps-sel { position: absolute; left: 6px; top: 6px; width: 18px; height: 18px; margin: 0; accent-color: var(--orange); }
.ps-info { display: grid; gap: 1px; padding: 6px 8px 8px; font-size: 13px; min-width: 0; }
.ps-info .ps-cam { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ps-info .hint { font-size: 11px; }
.ps-det { position: absolute; right: 6px; top: 6px; background: #000b; color: #fff; }
.ps-group { margin-top: 8px; font-weight: 600; }
/* Sentinela */
.sn-pane { padding: 0 16px 12px; overflow-y: auto; overflow-x: hidden; min-width: 0; max-height: calc(100vh - var(--top) - 50px); display: grid; gap: 10px; align-content: start; }
.sn-pane[hidden] { display: none; }
.sn-sum { display: flex; flex-wrap: wrap; gap: 10px; } .sn-sum div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; min-width: 120px; }
.sn-sum b { display: block; font-size: 22px; } .sn-sum span { font-size: 12px; color: var(--muted); }
.sn-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 10px; }
.sn-card { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--blue); border-radius: var(--r); padding: 10px; display: grid; gap: 6px; font-size: 13px; }
.sn-card.P0 { border-left-color: var(--red); } .sn-card.P1 { border-left-color: var(--orange); } .sn-card.P2 { border-left-color: #e0c341; }
.sn-card.done { opacity: .6; } .sn-card ul { margin: 0; padding-left: 18px; } .sn-card .muted { font-size: 12px; }
.sn-sysitem { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--red); border-radius: var(--r); padding: 8px 10px; font-size: 13px; margin-bottom: 6px; }
.sn-more { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; overflow-x: auto; min-width: 0; } .sn-more summary { cursor: pointer; font-weight: 600; }
.sn-more table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; } .sn-more td, .sn-more th { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: left; }
/* Padrões (baseline) */
.bl-pane { padding: 0 16px 12px; overflow: auto; max-height: calc(100vh - var(--top) - 50px); display: grid; gap: 12px; align-content: start; }
.bl-pane[hidden] { display: none; }
.bl-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; position: relative; }
.bl-hh { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.bl-heat { position: relative; max-width: 760px; background: #000; border-radius: 6px; overflow: hidden; aspect-ratio: var(--ar, 1.779); }
.bl-heat img, .bl-heat canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; } .bl-heat img { opacity: .75; }
.bl-hleg { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.bl-ramp { display: inline-block; width: 140px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, rgba(255,121,0,.12), rgba(255,121,0,.55), #ff3d00); }
.ev-chk { font-size: 11px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); white-space: nowrap; }
.ev-chk.confirmado { color: var(--green); } .ev-chk.recusado { color: var(--muted); text-decoration: line-through; } .ev-chk.pendente { color: var(--muted); }
.bl-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.bl-legend .sw { display: inline-block; width: 12px; height: 10px; margin-right: 5px; vertical-align: -1px; border-radius: 2px; }
.bl-legend .sw.today { background: var(--blue); } .bl-legend .sw.band { background: #3a4048; } .bl-legend .sw.med { height: 2px; vertical-align: 3px; background: var(--text); }
.bl-chart svg { width: 100%; height: 260px; display: block; } .bl-chart text { fill: var(--muted); font: 11px var(--font); }
.bl-chart .grid { stroke: var(--line); stroke-width: 1; } .bl-chart .band { fill: #3a4048; } .bl-chart .med { stroke: var(--text); stroke-width: 2; }
.bl-chart .bar { fill: var(--blue); } .bl-chart .hit { fill: transparent; cursor: default; } .bl-chart .hit:hover { fill: rgba(255,255,255,.04); }
.bl-chart .warn { fill: #e0c341; font-size: 13px; }
.bl-tip { position: absolute; pointer-events: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; font-size: 12px; z-index: 2; }
.bl-table table { font-size: 12px; } #bl-table table { width: 100%; border-collapse: collapse; font-size: 12px; } #bl-table td, #bl-table th { padding: 2px 6px; border-bottom: 1px solid var(--line); text-align: right; }
/* Regras compostas */
.cp-box { margin-top: 16px; max-width: 1100px; }
.cp-step { display: grid; grid-template-columns: 24px 1fr; gap: 6px 8px; border: 1px solid var(--line); border-radius: var(--r); padding: 8px; margin-bottom: 6px; }
.cp-step .n { font-weight: 700; color: var(--orange); } .cp-step .grid { display: grid; gap: 6px; }
.cp-expl { width: 100%; font-size: 12px; border-collapse: collapse; } .cp-expl td, .cp-expl th { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: left; }
/* Casos de investigação */
.cs-pane { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 12px; padding: 0 16px 12px; max-height: calc(100vh - var(--top) - 50px); }
.cs-pane[hidden] { display: none; }
.cs-side { overflow-y: auto; } .cs-list { display: grid; gap: 6px; }
.cs-item { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--blue); border-radius: var(--r); padding: 8px 10px; cursor: pointer; font-size: 13px; }
.cs-item.sel { border-color: var(--orange); } .cs-item.P0 { border-left-color: var(--red); } .cs-item.P1 { border-left-color: var(--orange); } .cs-item.P2 { border-left-color: #e0c341; }
.cs-main { overflow-y: auto; display: grid; gap: 10px; align-content: start; }
.cs-head { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 6px; }
.cs-head h2 { margin: 0; font-size: 17px; } .cs-sec { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.cs-sec h3 { margin: 0 0 8px; font-size: 14px; } .cs-text { white-space: pre-wrap; font-size: 13px; }
.cs-tl { display: grid; gap: 6px; } .cs-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 10px; align-items: start; border-left: 3px solid var(--line); padding: 4px 8px; font-size: 13px; }
.cs-row.event { border-left-color: var(--red); } .cs-row.clip { border-left-color: var(--blue); } .cs-row.note { border-left-color: var(--green); } .cs-row.technical { border-left-color: #e0c341; }
.cs-row img { width: 160px; border-radius: 3px; display: block; margin-top: 4px; } .cs-row .hash { font: 11px Consolas, monospace; word-break: break-all; color: var(--muted); }
@media (max-width: 900px) { .cs-pane { grid-template-columns: 1fr; } }
/* Governança LGPD */
.gv-pane { padding: 0 16px 12px; overflow: auto; max-height: calc(100vh - var(--top) - 50px); }
.st-banner { margin: 10px 0 14px; padding: 10px 12px; border: 1px solid var(--orange); border-radius: 6px; background: rgba(255,121,0,.08); font-size: 13px; line-height: 1.5; }
.st-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 8px 0; }
.st-photos figure { margin: 0; display: grid; gap: 4px; } .st-photos img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 4px; background: var(--bg); }
.st-photos figcaption { font-size: 11px; color: var(--muted); } .st-photos .warn { color: var(--orange); }
.ps-staff { color: var(--orange); }
.gv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; }
.gv-card { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid #6b5a00; border-radius: var(--r); padding: 12px; display: grid; gap: 8px; }
.gv-card.prod { border-left-color: var(--green); }
.gv-check { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 13px; }
.gv-check li::before { content: "✗ "; color: var(--red); font-weight: 700; } .gv-check li.ok::before { content: "✓ "; color: var(--green); }
.gv-check small { color: var(--muted); }
.gv-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; } .gv-form .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .gv-list { grid-template-columns: 1fr; } .gv-form { grid-template-columns: 1fr; } }
.zn-stage .sel polygon, .zn-stage .sel line { stroke: #fff; stroke-width: 3; }
.zn-stage .draft { fill: rgba(255, 255, 255, .15); stroke: #fff; stroke-dasharray: 4 3; }
.zn-stage circle { fill: #fff; stroke: #000; stroke-width: 1; vector-effect: non-scaling-stroke; cursor: move; }
.zn-stage text { fill: #fff; font: 600 13px var(--font); paint-order: stroke; stroke: #000; stroke-width: 3px; pointer-events: none; }
.zn-list { display: grid; gap: 6px; margin-top: 10px; max-width: 1100px; }
.zn-item { display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 7px 10px; cursor: pointer; font-size: 13px; }
.zn-item.sel { border-color: var(--orange); } .zn-item .rv-meta { flex: 1; }
.zn-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 9px; align-content: start;
  position: sticky; top: 0; max-height: calc(100vh - var(--top) - 70px); overflow-y: auto; }
.zn-form h3 { margin: 0; font-size: 15px; } .zn-form .zn-rule { display: grid; gap: 9px; }
@media (max-width: 900px) { .zn-pane { grid-template-columns: 1fr; } }
/* Câmeras (grade com miniaturas) */
.view.cams { grid-template-rows: auto minmax(0, 1fr); }
.cams-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.cams-bar .search { flex: 1 1 240px; max-width: 360px; }
.cams-count { margin-left: auto; font-size: 12px; color: var(--muted); }
.cams-body { overflow-y: auto; padding: 14px; }
.cams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cam-card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; }
.cam-card.alarm { border-color: var(--red); }
.cam-thumb { position: relative; aspect-ratio: 16 / 9; background: #0b0c0e; cursor: pointer; }
.cam-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; } /* fora do fluxo: não estica o 16:9 */
.cam-thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #4b525a; font-size: 12px; text-align: center; padding: 10px; }
.cam-thumb .badge-st { position: absolute; left: 8px; top: 8px; font-size: 11px; padding: 2px 6px; border-radius: 3px; background: rgba(0, 0, 0, .7); }
.cam-thumb .age { position: absolute; right: 8px; bottom: 6px; font-size: 11px; color: #c4cad0; background: rgba(0, 0, 0, .6); padding: 1px 5px; border-radius: 3px; }
.cam-info { padding: 8px 10px; display: grid; gap: 2px; }
.cam-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-info .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-acts { display: flex; gap: 4px; padding: 0 10px 10px; flex-wrap: wrap; }
.cam-acts .btn { font-size: 12px; padding: 4px 8px; }
.cams-empty { color: var(--muted); padding: 40px; text-align: center; }
/* Mapa */
.view.map { grid-template-columns: 260px minmax(0, 1fr); }
.map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #0f1113; }
.map-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); background: var(--bg); }
.map-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.map-legend .dot, .map-pin { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.dot.on, .map-pin.on { background: #2fbf71; } .dot.err, .map-pin.err { background: #e5534b; } .dot.off, .map-pin.off { background: #7d858d; }
.map-pin.wait { background: #e3b341; }
.map-list { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 2px; margin: 0 -6px; }
.map-list button { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; padding: 6px; border: 0; border-radius: 4px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.map-list button:hover, .map-list button.sel { background: var(--line); }
.map-list .grp { font-size: 12px; color: var(--muted); padding: 6px 6px 2px; }
.map-list summary.grp { cursor: pointer; color: var(--text); font-weight: 600; } .map-list summary.grp .muted { font-weight: 400; }
.map-nocoord { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; }
.map-nocoord button { margin-top: 4px; }
.cfg-head .dev-q { width: 300px; max-width: 40vw; margin: 0; } .cfg-head select { max-width: 180px; }
.cam-marker.map-pin.many { display: grid; place-items: center; width: 26px; height: 26px; margin: 0; font: 600 11px/1 sans-serif; color: #fff; }
.map-pop-list { display: grid; gap: 4px; margin-top: 6px; max-height: 240px; overflow-y: auto; }
.map-pop-list > div { display: flex; align-items: center; gap: 6px; } .map-pop-list .btn { padding: 2px 8px; }
.map-nocoord ul { margin: 4px 0; padding-left: 18px; columns: 2; } .map-nocoord summary { cursor: pointer; margin-top: 6px; }
.map-nocoord { max-height: 40%; overflow-y: auto; overflow-x: hidden; overflow-wrap: anywhere; }
.map-nocoord .btn { white-space: normal; max-width: 100%; text-align: left; }
/* seletor de câmeras agrupado por local */
.cp-pick { display: grid; gap: 6px; }
.cp-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; } .cp-tools .search { max-width: 280px; margin: 0; }
.cp-scroll { max-height: 360px; overflow-y: auto; }
.cp-grp[hidden] { display: none; }
.cp-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 4px; margin-bottom: 2px; border-bottom: 1px solid var(--line); }
.cp-h .check { font-weight: 600; min-width: 0; } .cp-h .cp-gn { font-size: 11px; flex: none; }
/* marcador: círculo com borda escura; crítico ganha anel laranja */
.cam-marker { width: 20px; height: 20px; border-radius: 50%; border: 3px solid #16181b; box-shadow: 0 0 0 1px rgba(255,255,255,.5); }
.cam-marker.crit { box-shadow: 0 0 0 3px var(--orange); }
/* .map-wrap na frente: o leaflet.css carrega depois deste arquivo e venceria com a mesma especificidade */
.map-wrap .leaflet-popup-content-wrapper, .map-wrap .leaflet-popup-tip { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.map-wrap .leaflet-popup-content { margin: 10px 12px; font: 13px/1.4 var(--font); }
.map-wrap .leaflet-bar a { background: var(--panel); color: var(--text); border-color: var(--line); }
.map-pop strong { display: block; font-size: 14px; } .map-pop .muted { font-size: 12px; }
.map-pop .acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.map-wrap .leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
/* Tema escuro sobre os mapas do OpenStreetMap (combina com a interface) */
.map-wrap .leaflet-tile-pane { filter: invert(1) hue-rotate(200deg) brightness(.85) contrast(.9) saturate(.35); }
.map-wrap .leaflet-control-attribution { background: rgba(22, 24, 27, .8); color: var(--muted); }
.map-wrap .leaflet-control-attribution a { color: var(--orange); }
.filters { display: flex; flex-wrap: wrap; gap: 14px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.empty-state { align-self: center; justify-self: center; max-width: 520px; text-align: center; padding: 24px; }
.empty-state h2 { font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); }

/* Configurações */
.view.cfg { grid-template-columns: 220px minmax(0, 1fr); }
.cfg-nav { gap: 2px; }
.cfg-nav a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 4px; font-weight: 600; border-left: 2px solid transparent; }
.cfg-nav a:hover { color: var(--text); background: var(--panel-2); }
.cfg-nav a[aria-current="page"] { color: var(--text); border-left-color: var(--orange); background: var(--panel-2); }
.cfg-body { overflow: auto; padding: 18px 22px 30px; }
.cfg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.cfg-head h2 { font-size: 18px; }
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.table th { font-size: 11px; color: var(--muted); font-weight: 600; background: var(--panel-2); }
.table tr:last-child td { border-bottom: 0; }
.table td.mono { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--muted); word-break: break-all; }
.table td.wrap { max-width: 380px; color: var(--muted); }
.table .state { display: inline-flex; gap: 6px; align-items: center; }
.table .empty td { text-align: center; color: var(--muted); padding: 26px; }

/* Diálogos e toast */
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 0; background: var(--panel); color: var(--text); width: min(520px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(0, 0, 0, .65); }
.dialog-form { display: grid; gap: 13px; padding: 22px; }
.dialog-form h2 { font-size: 17px; }
.dialog-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.spacer { flex: 1; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 16px); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: var(--r); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== Evolução v2 (handoff de UX) ===== */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.monitor-tag { margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--orange-ink); background: var(--orange); border-radius: 4px; padding: 1px 6px; }
.health { font-size: 13px; color: var(--text); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.health.bad { color: var(--red); }
.side-tabs.three { grid-template-columns: repeat(3, 1fr); }
#tree-pane, #views-pane { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
/* árvore em 3 níveis */
.tree details details { margin-left: 12px; }
.tree details details > summary { font-weight: 600; color: #d6dade; font-size: 12.5px; }
.tree .cam { padding-left: 34px; }
.si { width: 14px; text-align: center; flex: none; font-size: 12px; line-height: 1; }
.si.on { color: var(--green); } .si.off { color: #6b737b; } .si.err { color: var(--red); } .si.wait { color: var(--orange); }
/* visões */
.views { list-style: none; margin: 0 -6px; padding: 0; overflow-y: auto; flex: 1; }
.views li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.views li:hover { background: var(--panel-2); }
.views li.active { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--orange); }
.views li .meta { margin-left: auto; color: var(--muted); font-size: 11px; }
.views li .del { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; padding: 0 2px; }
.views li .del:hover { color: var(--red); }
.views .none { cursor: default; color: var(--muted); font-size: 12px; display: block; }
.views-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } .views-acts .btn { margin: 0; }
.mz-mini { display: grid; grid-template-columns: repeat(var(--k), 1fr); gap: 1px; width: 20px; height: 15px; flex: none; }
.mz-mini i { background: var(--line); border-radius: 1px; } .mz-mini i.on { background: var(--orange); opacity: .8; }
#gen-dialog.wide { width: min(1080px, 96vw); max-width: 96vw; }
.mz-ed { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr); gap: 16px; }
.mz-left { display: grid; gap: 10px; align-content: start; }
.mz-grid { display: grid; grid-template-columns: repeat(var(--k), 1fr); gap: 4px; aspect-ratio: 16 / 9; background: #000; padding: 4px; border-radius: 6px; }
.mz-slot { position: relative; display: grid; align-content: center; justify-items: center; gap: 2px; padding: 4px; border: 1px dashed var(--line); border-radius: 4px; background: var(--bg); cursor: pointer; text-align: center; min-width: 0; overflow: hidden; }
.mz-slot.on { border-style: solid; background: var(--panel-2); cursor: grab; } .mz-slot.sel { outline: 2px solid var(--orange); outline-offset: -2px; }
.mz-slot b { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .mz-slot small { font-size: 10px; color: var(--muted); }
.mz-n { position: absolute; top: 2px; left: 4px; font-size: 10px; color: var(--muted); }
.mz-x { position: absolute; top: 1px; right: 2px; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; } .mz-x:hover { color: var(--red); }
.mz-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mz-right { display: grid; grid-template-rows: auto 1fr; gap: 6px; min-height: 0; }
.mz-cams { max-height: 420px; overflow-y: auto; display: grid; align-content: start; gap: 1px; }
.mz-cams .grp { font-size: 11px; font-weight: 700; color: var(--muted); padding: 6px 4px 2px; }
.mz-cams button { display: flex; align-items: center; gap: 6px; text-align: left; padding: 5px 6px; border: 0; border-radius: 4px; background: none; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.mz-cams button:hover { background: var(--panel-2); } .mz-cams button.used { opacity: .65; }
@media (max-width: 760px) { .mz-ed { grid-template-columns: 1fr; } }
/* ronda */
.tour { display: inline-flex; gap: 6px; align-items: center; }
.tour select { padding: 5px 6px; font-size: 12px; }
#tour-toggle[aria-pressed="true"] { background: var(--orange); border-color: var(--orange); color: var(--orange-ink); }
/* quadros: estado com ícone + texto + cor */
.tile .badge-rec { color: #9cc3ff; }
.tile.alarm { outline: 3px solid var(--red); outline-offset: -3px; }
.tile .unavail { pointer-events: auto; display: grid; gap: 8px; justify-items: center; max-width: 420px; }
.tile .unavail strong { color: #f3c9c6; font-size: 15px; }
.tile .unavail p { margin: 0; color: #b6bdc4; font-size: 13px; }
.tile .unavail .btn { font-size: 12px; padding: 5px 12px; }
.tile .unavail details { font-size: 12px; color: #9aa2aa; }
.tile .unavail summary { cursor: pointer; color: var(--orange); }
.tile .unavail .tech { text-align: left; margin-top: 6px; background: rgba(0,0,0,.5); border: 1px solid #2a2e33; border-radius: 4px; padding: 8px; color: #cfd4d9; display: grid; gap: 6px; }
/* modo foco */
/* Sem painéis: uma coluna só (com as laterais ocultas, o mosaico iria parar na 1ª coluna, de largura zero) */
body.focus .view.live { grid-template-columns: minmax(0, 1fr); }
body.focus .view.live > .side { display: none; }
/* painel contextual recolhível */
.side.right { padding: 0; gap: 0; flex-direction: row; }
.ctx-rail { display: none; flex-direction: column; gap: 4px; padding: 10px 6px; width: 52px; }
.ctx-rail button { background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); border-radius: var(--r); font: inherit; font-size: 11px; font-weight: 700; padding: 9px 0; cursor: pointer; }
.ctx-rail button:hover { color: var(--text); }
.ctx-rail .rail-toggle { margin-top: auto; }
.ctx-body { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; overflow-y: auto; min-width: 0; }
.ctx-head { display: flex; align-items: stretch; margin: 0 -12px; border-bottom: 1px solid var(--line); }
.ctx-tabs { flex: 1; margin: 0; border: 0; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.rail-toggle { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; padding: 0 12px; }
.rail-toggle:hover { color: var(--orange); }
.side.right.collapsed .ctx-body { display: none; }
.side.right.collapsed .ctx-rail { display: flex; }
.view.live.ctx-collapsed { grid-template-columns: 260px minmax(0, 1fr) 54px; }
body.focus .view.live.ctx-collapsed { grid-template-columns: minmax(0, 1fr); }
.panel { border-bottom: 0; }
.cam-events { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cam-events li { font-size: 12px; border-left: 3px solid var(--line); padding: 4px 8px; background: var(--panel-2); border-radius: 0 4px 4px 0; }
.cam-events li.crit { border-left-color: var(--red); } .cam-events li.warn { border-left-color: var(--orange); }
.cam-events li .when { color: var(--muted); display: block; font-size: 11px; }
.cam-events .none { background: none; border: 0; color: var(--muted); padding: 0; }
/* níveis de alerta */
.lvl { font-weight: 700; white-space: nowrap; }
.lvl.crit { color: var(--red); } .lvl.warn { color: var(--orange); } .lvl.info { color: var(--muted); }
.alerts li.crit { box-shadow: inset 3px 0 0 var(--red); } .alerts li.warn { box-shadow: inset 3px 0 0 var(--orange); }
.prefs { display: grid; gap: 10px; margin: 16px 0 10px; justify-items: start; }
.table.levels td:first-child { width: 130px; }
kbd { font-family: ui-monospace, Consolas, monospace; background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 7px; font-size: 12px; }
/* menu contextual */
.ctxmenu { position: fixed; z-index: 50; list-style: none; margin: 0; padding: 4px; min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.55); }
.ctxmenu li { padding: 7px 12px; font-size: 13px; border-radius: 4px; cursor: pointer; }
.ctxmenu li:hover, .ctxmenu li:focus { background: var(--panel-2); color: var(--orange); outline: none; }
.ctxmenu li.dis { opacity: .4; pointer-events: none; }
.ctxmenu li.sep { height: 1px; padding: 0; margin: 4px 0; background: var(--line); pointer-events: none; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.info-grid { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; margin: 0; }
.info-grid dt { color: var(--muted); } .info-grid dd { margin: 0; word-break: break-word; }
/* reprodução multicâmera */
.stack-label { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; margin-top: 4px; }
.pb-cams { flex: 1; min-height: 120px; overflow-y: auto; display: grid; align-content: start; gap: 2px; margin: 0 -6px; }
.pb-cams label { display: flex; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.pb-cams label:hover { background: var(--panel-2); }
.pb-cams .grp { font-size: 11px; color: var(--muted); padding: 8px 6px 2px; font-weight: 700; }
.players { flex: 1; min-height: 0; display: grid; gap: 2px; background: #000; padding: 2px; grid-template-columns: 1fr; grid-auto-rows: minmax(0, 1fr); }
.players[data-n="2"] { grid-template-columns: 1fr 1fr; }
.players[data-n="3"], .players[data-n="4"] { grid-template-columns: 1fr 1fr; }
.pl { position: relative; background: #000; outline: 2px solid transparent; outline-offset: -2px; cursor: pointer; min-height: 0; overflow: hidden; }
.pl.selected { outline-color: var(--orange); }
.pl video { width: 100%; height: 100%; object-fit: contain; display: block; }
/* Zoom digital */
.tile video, .pl video { transform-origin: 0 0; }
.tile.zoomed, .pl.zoomed { cursor: grab; }
.tile.panning, .pl.panning { cursor: grabbing; }
.zoom-ind { position: absolute; top: 40px; right: 10px; padding: 2px 8px; border-radius: 4px; background: rgba(0, 0, 0, .7); border: 1px solid var(--orange); color: var(--orange); font-size: 12px; font-weight: 700; pointer-events: none; }
.pl .player-osd { font-size: 12px; }
/* reprodução: nome e horário embaixo, em etiquetas escuras, para não cobrir a data que a própria câmera escreve no alto da imagem */
.pl .player-osd > span { background: rgba(0, 0, 0, .62); color: #fff; padding: 2px 7px; border-radius: 4px; line-height: 1.4;
  max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl .player-osd > span:empty { display: none; }
.pl .tile-msg { font-size: 13px; }
.tl-rows { display: grid; gap: 4px; }
.tl-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px; align-items: center; }
.tl-label { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-row .timeline { height: 44px; }
.tl-row .timeline .seg { top: 12px; bottom: 12px; }
.tl-ticks-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px; }
.tl-empty { color: var(--muted); font-size: 12px; padding: 8px 0; }

/* Telas estreitas: barras laterais viram faixas */
@media (max-width: 1000px) {
  body { overflow: auto; }
  .view.live, .view.play, .view.cfg { grid-template-columns: 1fr; height: auto; }
  .side { border: 0; border-bottom: 1px solid var(--line); }
  .tree { max-height: 220px; }
  .grid { min-height: 56vw; }
  .player { min-height: 56vw; }
  .tabs a { padding: 0 8px; }
  .who { display: none; }
}

/* ajustes finos v2 */
.alerts { width: 400px; }
.alerts li .m { flex-wrap: wrap; row-gap: 4px; }
.alerts li .m .link { margin-left: 0; }
.alerts li .m .link:first-of-type { margin-left: auto; }
.side-tabs.three button { font-size: 12.5px; }
.viewbar .tool { padding: 6px 10px; }
.viewbar { gap: 6px; }

/* ===== v3: rodada 2 do Copilot ===== */
.win-menu { font-size: 18px; line-height: 1; padding: 2px 6px; }
.monitor-tag:empty { display: none; }
.tour-status { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--orange); }
#act-lock[aria-pressed="true"] { border-color: var(--orange); color: var(--orange); }
.grow { flex: 1; min-width: 0; }
.cam-events li { cursor: pointer; }
.cam-events li .path { display: block; color: var(--muted); font-size: 11px; }
.cam-events li .st-tag { float: right; font-size: 10px; color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: 4px; }
.quick .tool { padding: 5px 8px; font-size: 12px; }
.tile.alarm { animation: alarm 1.6s ease-in-out infinite; }
@keyframes alarm { 50% { outline-color: rgba(240, 82, 74, .35); } }
@media (prefers-reduced-motion: reduce) { .tile.alarm { animation: none; } }
.tile .rec-state.off { color: #9aa2aa; } .tile .rec-state.broken { color: #f3a39d; }
.tile.na .tile-msg { color: #7d858d; }
.crit {
  position: fixed; right: 18px; bottom: 18px; z-index: 45; width: min(460px, calc(100vw - 36px));
  background: var(--panel); border: 2px solid var(--red); border-radius: 10px; box-shadow: 0 18px 40px rgba(0,0,0,.6);
  display: grid; gap: 8px; padding: 12px 14px;
}
.crit header { display: flex; justify-content: space-between; align-items: center; color: var(--red); font-size: 15px; }
/* triagem da portaria no alerta: três botões com cor e ícone (não só cor) */
.zn-learn { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; display: grid; gap: 6px; } .zn-learn h3 { margin: 0; font-size: 14px; }
.zn-acc { display: flex; gap: 14px; font-size: 13px; }
.zn-sug { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; border: 1px dashed var(--orange); border-radius: 6px; padding: 5px 7px; }
.zn-sug span { flex: 1 1 100%; }
#zn-svg polygon.sug { fill: rgba(255, 121, 0, .25); stroke: var(--orange); stroke-width: 3; stroke-dasharray: 8 6; }
.ev-tri.falso { color: var(--muted); } .ev-tri.ocorrencia { color: var(--red); } .ev-tri.normal { color: var(--green); }
.crit-tri { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .crit-tri > span { font-weight: 700; width: 100%; }
.crit-tri .btn { flex: 1 1 120px; font-weight: 700; }
.crit-tri .tri-oc { background: var(--red); border-color: var(--red); color: #fff; }
.crit-tri .tri-ok { background: var(--green); border-color: var(--green); color: #fff; }
/* ---- tela da Portaria: grande, simples, sem menus ---- */
.view.port { display: none; } .view.port.active { display: flex; flex-direction: column; height: 100vh; background: var(--bg); padding: 10px 14px; gap: 10px; }
.port-head { display: flex; align-items: center; gap: 14px; font-size: 20px; } .port-head #port-clock { font-size: 16px; color: var(--muted); text-transform: capitalize; }
.port-btn { font: inherit; font-size: 18px; font-weight: 700; padding: 12px 20px; border-radius: 10px; border: 2px solid var(--orange); background: var(--orange); color: #111; cursor: pointer; }
.port-btn.ghost { background: transparent; color: var(--text); border-color: var(--line); font-size: 15px; padding: 9px 14px; }
.port-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 10px; align-content: start; overflow: auto; }
.port-cam { position: relative; padding: 0; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: #000; cursor: pointer; aspect-ratio: 16 / 9; }
.port-cam:hover, .port-cam:focus-visible { border-color: var(--orange); }
.port-cam img { width: 100%; height: 100%; object-fit: cover; display: block; } .port-cam img.off { visibility: hidden; }
.port-cam span { position: absolute; left: 8px; bottom: 8px; right: 8px; text-align: left; width: fit-content; background: rgba(0, 0, 0, .65); color: #fff; font-size: 16px; font-weight: 700; padding: 4px 10px; border-radius: 6px; }
.port-hint { font-size: 15px; color: var(--muted); margin: 0; }
.port-live { position: fixed; inset: 0; z-index: 40; background: #000; display: flex; flex-direction: column; }
.port-live video { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.port-live-bar { display: flex; align-items: center; gap: 16px; padding: 10px 14px; color: #fff; font-size: 20px; background: #111; }
/* na portaria o alerta ocupa a tela, com letra e botões grandes; o que exige mais traquejo some */
body.portaria .crit { inset: 4vh 4vw; width: auto; font-size: 18px; border-width: 4px; overflow: auto; z-index: 50; }
body.portaria .crit header { font-size: 26px; }
.crit-what { display: block; font-size: 1.1em; margin-bottom: 2px; } body.portaria .crit-what { font-size: 26px; } body.portaria #crit-text > span { font-size: 14px; color: var(--muted); } body.portaria .crit-media { grid-template-columns: 1fr 1fr; }
body.portaria .crit-tri .btn { font-size: 22px; padding: 18px 10px; border-radius: 12px; } body.portaria .crit-tri > span { font-size: 22px; }
body.portaria .crit [data-c="open"], body.portaria .crit [data-c="max"], body.portaria .crit [data-c="close"] { display: none; }
body.portaria .crit:has(#crit-tri:not([hidden])) [data-c="ack"] { display: none; }
body.portaria .crit [data-c="ack"] { font-size: 20px; padding: 14px 24px; }
.crit header span { color: var(--muted); font-size: 12px; }
.crit p { margin: 0; font-size: 13px; }
.crit:has(#crit-shot-box:not([hidden])) { width: min(820px, calc(100vw - 36px)); }
.crit-media { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.crit-media figure { margin: 0; display: grid; gap: 3px; } .crit-media figcaption { font-size: 11px; color: var(--muted); }
.crit-shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; border-radius: 6px; display: block; }
@media (max-width: 700px) { .crit-media { grid-auto-flow: row; } }
.crit-video { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; }
.crit-video video { width: 100%; height: 100%; object-fit: contain; display: block; }
.crit-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.crit-actions .btn { padding: 6px 10px; font-size: 12px; }
.crit footer { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.crit-tour { color: var(--orange) !important; }
.views .grp-title { font-size: 11px; font-weight: 700; color: var(--muted); padding: 10px 8px 4px; cursor: default; display: block; }
.views .grp-title:hover { background: none; }
.views li .sub { display: block; color: var(--muted); font-size: 11px; }
.views li .txt { min-width: 0; }
.views li .dup { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 2px; }
.views li .dup:hover { color: var(--orange); }
.views li.org .ro { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.tile .unavail .no-perm { font-size: 12px; color: #7d858d; }
.sync-ok { color: var(--muted); } .sync-bad { color: var(--orange); }
.dialog-actions.wrap { flex-wrap: wrap; }
.tile .badge-rec, .tile .rec-state { margin-left: 8px; }

/* ===== v4 ===== */
.alerts.hist { right: 120px; }
.hist li { cursor: pointer; }
.hist li:hover { background: var(--panel-2); }
.hist li .m { color: var(--muted); }
body.compact .tree summary { padding: 3px 6px; font-size: 12px; }
body.compact .tree .cam { padding-top: 2px; padding-bottom: 2px; font-size: 12px; }
body.compact .views li { padding: 4px 8px; }
body.compact .pb-cams label { padding: 2px 6px; font-size: 12px; }
.views li .aud { color: var(--orange); }
input[type=range] { padding: 0; accent-color: var(--orange); }
#gen-dialog .rv-stage > * { max-height: 62vh; } #gen-dialog .rv-stage video { object-fit: contain; }
/* Pesquisa: sugestões prontas por tema */
.ps-ex { align-items: center; }
.ps-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ps-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--panel-2); border: 1px solid var(--orange); border-radius: 14px; padding: 2px 4px 2px 10px; font-size: 12.5px; color: var(--text); }
.ps-chip button { border: 0; background: none; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 50%; }
.ps-chip button:hover { color: var(--red); }
.ps-avisos { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.ps-voc { border: 1px solid var(--line); border-radius: var(--r); padding: 6px 10px; background: var(--panel-2); font-size: 12.5px; }
.ps-voc ul { margin: 0; padding-left: 16px; } .ps-voc .ps-grp b { top: 6px; }
.ps-acts { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 8px 8px; } .ps-more-btn { margin-left: auto; }
.ps-more { border: 1px solid var(--line); border-radius: var(--r); padding: 6px 10px 4px; background: var(--panel-2); }
.ps-more > .hint { margin: 0 0 4px; }
.ps-grp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 0 4px 160px; border-top: 1px solid var(--line); position: relative; }
.ps-grp b { font-size: 12px; color: var(--text); position: absolute; left: 0; top: 10px; width: 150px; }   /* botões que quebram linha ficam alinhados na coluna deles */
@media (max-width: 700px) { .ps-grp { padding-left: 0; } .ps-grp b { position: static; width: 100%; } }
/* ================================================================ Temas (botão ao lado do usuário)
   Só trocam as variáveis: o vídeo continua sobre fundo preto em qualquer tema. */
:root[data-theme="claro"] {
  color-scheme: light;
  --bg: #eef0f3; --panel: #ffffff; --panel-2: #f4f5f7; --line: #d3d8de; --text: #15181c; --muted: #59626c;
  --orange: #e26b00; --orange-ink: #ffffff; --green: #17894e; --red: #c9332b; --blue: #1d62d6; --tile: #050607;
  --yellow: #8a6d00; --band: #d9dee4; --soft: rgba(0, 0, 0, .06);
}
:root[data-theme="conecta"] {
  color-scheme: dark;
  --bg: #061331; --panel: #0b1d46; --panel-2: #102759; --line: #1d3a78; --text: #f2f5fb; --muted: #a9b8d8;
  --orange: #ff7900; --orange-ink: #1a0d00; --green: #3dcb7f; --red: #f0524a; --blue: #5b9bff; --tile: #03081a;
  --band: #24407e;
}
.sev.P2, .ev-kind.tamper, .ev-chip.tamper, .bl-chart .warn { color: var(--yellow, #e0c341); fill: var(--yellow, #e0c341); }
.bl-legend .sw.band { background: var(--band, #3a4048); } .bl-chart .band { fill: var(--band, #3a4048); }
.ev-chip i { background: var(--soft, rgba(255, 255, 255, .12)); }
:root[data-theme="claro"] .map-wrap .leaflet-control-attribution { background: rgba(255, 255, 255, .85); }
:root[data-theme="claro"] .cam-marker { border-color: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.ps-sim { display: inline-block; min-width: 26px; text-align: center; font-size: 11px; font-weight: 700; padding: 0 4px; border-radius: 8px; background: var(--blue); color: #fff; }
.ps-desc { grid-column: span 2; }
.ps-desc-note { border-left: 3px solid var(--orange); padding-left: 8px; }
/* Frota */
.ft-plate { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; background: #fff; color: #111; padding: 1px 6px; border-radius: 3px; border: 1px solid #888; }
.ft-dir.entrada { color: var(--green); font-weight: 700; } .ft-dir.saida { color: var(--orange); font-weight: 700; }
.ft-photo { height: 56px; border-radius: 4px; display: block; }
body.kiosk .topbar { display: none; } body.kiosk .view { height: 100vh; }
.view.mon.active { grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px; padding: 12px 16px; }
.mon-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; } .mon-head h2 { margin: 0 auto 0 0; }
.mon-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 12px; min-height: 0; }
.mon-left { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.mon-stage { flex: 1; min-height: 0; background: #000; border-radius: 8px; display: grid; place-items: center; overflow: hidden; border: 3px solid transparent; }
.mon-stage.alarm { border-color: #FF7900; }
.mon-stage video { width: 100%; height: 100%; object-fit: contain; grid-area: 1 / 1; }
.mon-stage p { grid-area: 1 / 1; }
.mon-cur { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.mon-cur img { height: 84px; border-radius: 6px; }
.mon-cur #mon-info { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 4px; }
.mon-actions { display: flex; gap: 8px; }
.mon-right { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--line); border-radius: 8px; }
.mon-right-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
#mon-list { overflow: auto; flex: 1; }
.mon-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); border-left: 4px solid transparent; cursor: pointer; }
.mon-row:hover { background: #ffffff0d; } .mon-row.sel { background: #FF79001f; }
.mon-row.novo { border-left-color: #FF7900; } .mon-row.ciente { opacity: .55; }
.mon-row .hint { display: block; }
@media (max-width: 900px) { body.kiosk .view.mon { height: auto; min-height: 100vh; } .mon-body { grid-template-columns: 1fr; } .mon-stage { flex: none; aspect-ratio: 16 / 9; } #mon-list { max-height: 60vh; } }
.ft-head { flex-wrap: wrap; margin-bottom: 4px; }
.ft-cards { margin: 6px 0 4px; }
.ft-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ft-bar input[type=search] { width: 160px; margin: 0; }
.ft-out { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.ft-chip { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel, transparent); cursor: pointer; text-align: left; padding: 0; color: inherit; font: inherit; }
.ft-chip:hover { border-color: var(--accent, #FF7900); }
.ft-chip .ft-img { width: 72px; height: 48px; flex: none; object-fit: cover; display: block; background: #0002; }
.ft-chip .ft-info { padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 3px; }
.ft-chip .ft-plate { align-self: flex-start; }
.badge-ft { display: inline-block; padding: 0 6px; border-radius: 9px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700; }
.ft-cand { cursor: pointer; } .ft-cand input { margin: 0 8px; flex: none; }
.ft-cand:has(input:checked) { border-color: var(--accent, #FF7900); background: #FF790014; }
.ft-cand-acts { margin: 6px 0 8px; }
#ft-form input[name=placa] { width: 130px; text-transform: uppercase; }

.ps-fb { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 6px 6px; } .ps-fb .btn { padding: 2px 8px; }
