/* Vórtice IA - interface (as cores, fontes, espaçamentos, raios e sombras vêm de tokens.css) */
:root { --sidebar: 250px; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font-ui); font-feature-settings: "cv11", "ss01"; }
h1 { font-size: 1.25rem; line-height: 1.3; font-weight: 650; margin: 0; }
.mono, code, kbd, .kpi-value, .plate-badge, .plate { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
h2 { font-size: 1.02rem; margin: 0; font-weight: 600; }
h3 { font-size: .9rem; margin: 0; color: var(--muted); font-weight: 600; }
a { color: var(--accent-2); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.boot { padding: 32px; text-align: center; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card { padding: 20px; }

/* Formulários */
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-weight: 600; font-size: .88rem; }
.field small { color: var(--muted); font-size: .8rem; }
input, select, textarea { font: inherit; color: inherit; background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 9px 11px; width: 100%; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:disabled, select:disabled { opacity: .6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(41,211,255,.28); }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; accent-color: var(--accent); }
.form-error { color: var(--err); margin: 0; }
/* Primário: gradiente azul -> ciano com texto azul-marinho (contraste AA) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 650;
  border: 1px solid transparent; background: var(--grad-primary); color: var(--on-primary); border-radius: var(--radius-sm);
  padding: 9px 16px; cursor: pointer; text-decoration: none; transition: box-shadow .15s, filter .15s; }
.btn:hover { background: var(--grad-primary-hover); box-shadow: var(--glow-primary); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }
.btn .icon { width: 17px; height: 17px; }
.icon-btn { display: inline-grid; place-items: center; background: transparent; color: var(--fg); border: 1px solid transparent;
  border-radius: 8px; padding: 6px; cursor: pointer; }
.icon-btn:hover { background: var(--panel-2); }
.actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.input-icon { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 0 10px; color: var(--muted); }
.input-icon input { border: 0; background: transparent; padding: 9px 0; }
.input-icon input:focus { outline: none; }
.input-icon:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(41,211,255,.28); }

/* Login e primeiro acesso */
/* Telas sem login: a logo oficial (BrandLogo lg), sem efeito nenhum atrás dela, e o card com borda sutil em gradiente */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 24px 16px 16px; background: var(--bg); }
.auth .card { width: 100%; max-width: 420px; background: var(--surface-2); }
.auth-card { position: relative; border: 1px solid transparent; box-shadow: var(--shadow-2);
  background: linear-gradient(var(--surface-2), var(--surface-2)) padding-box, var(--grad-border) border-box; }
.auth-foot { margin-top: auto; padding-top: 8px; color: var(--muted); font-size: var(--text-xs); letter-spacing: .04em; }
.auth-panel-label { margin: 0; max-width: 420px; text-align: center; font-weight: 650; color: var(--fg); }

/* Estrutura: menu lateral + área principal */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: 18px 14px;
  background: linear-gradient(180deg, var(--sb-top) 0%, var(--sb-end) 100%); border-right: 1px solid var(--line); isolation: isolate;
  z-index: 30; }   /* acima da área principal: o submenu flutuante do menu recolhido não fica atrás dos vídeos */
.side-brand .brand-logo--xs { display: none; }   /* o símbolo só aparece com o menu recolhido (ver .sidebar.collapsed) */
.side-brand { display: flex; align-items: center; justify-content: center; padding: 4px 8px 14px; text-decoration: none; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.side-nav a, .nav-group-head, .side-logout { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--fg-2); text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
.side-nav a:hover, .nav-group-head:hover, .side-logout:hover { background: var(--hover); color: var(--fg-strong); }
.side-nav a.active { background: linear-gradient(90deg, rgba(10,132,255,.95), rgba(10,132,255,.72)); color: #fff;
  box-shadow: var(--glow-primary); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20; }
.greeting { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.greeting strong { font-size: 1.3rem; }
.greeting span { color: var(--muted); font-size: .9rem; }
.top-search { width: min(360px, 32vw); }
.bell { color: var(--muted); }
.user-chip { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); padding: 4px 8px; border-radius: 10px; }
.user-chip:hover { background: var(--panel-2); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  border: 2px solid var(--ok); color: var(--ok); background: #0d2a1d; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta small { color: var(--muted); }
.menu-btn { display: none; }
.content { padding: 20px 24px; min-width: 0; }
.page { max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Painéis */
.panel { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; }
.panel-tools { display: flex; align-items: center; gap: 10px; min-width: 0; }
.panel-tools .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { color: var(--muted); text-align: center; padding: 18px 8px; font-size: .9rem; }
.chip { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 6px;
  background: var(--panel-2); color: var(--fg-2); white-space: nowrap; }
.chip.lpr, .chip.ok { background: var(--ok-bg); color: var(--ok-fg); }
.chip.intrusion { background: #3b1d6e; color: #c4b5fd; }
.chip.err { background: var(--err-bg); color: var(--err-fg); }
.chip.warn { background: var(--warn-bg); color: var(--warn-fg); }
/* Origem dos números do Painel do S3 (Tarefa 06, Fase D): provedor, contabilizado pelo Vórtice, estimativa */
.chip.orig-prov { background: var(--info-bg); color: var(--info-fg); }
.chip.orig-vtx { background: transparent; color: var(--accent-2); box-shadow: inset 0 0 0 1px currentColor; }
.chip.orig-est { background: transparent; color: var(--fg-2); outline: 1px dashed currentColor; outline-offset: -1px; }
a.chip { text-decoration: none; }
.chip.live { background: var(--err); color: #fff; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: .85rem; background: var(--bg-2); color: var(--fg-2); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.seg button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg button:disabled { cursor: default; }

/* Visão geral (tela de operação) */
.ops { display: flex; flex-direction: column; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.kpi { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.kpi-icon { width: 50px; height: 50px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.kpi-icon .icon { width: 26px; height: 26px; }
.kpi-icon.blue { background: var(--accent); } .kpi-icon.green { background: #16a34a; } .kpi-icon.purple { background: var(--purple); }
.kpi-icon.red { background: var(--err); } .kpi-icon.teal { background: var(--teal); }
.kpi-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.kpi-label { color: var(--fg-2); font-size: .88rem; }
.kpi-value { font-size: 1.6rem; line-height: 1.2; }
.kpi-sub { color: var(--muted); font-size: .75rem; }
.kpi-ring { position: relative; width: 56px; height: 56px; flex: none; }
.kpi-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .78rem; font-weight: 700; }
.ring { width: 56px; height: 56px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4.5; stroke-linecap: round; }
.ring-bg { stroke: var(--line-2); } .ring-fg { stroke: var(--ok); }

.ops-grid { display: grid; gap: 16px;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr) minmax(260px, 330px);
  grid-template-areas: "search search details" "cams live details" "status timeline types"; }
.ops-grid > .panel:nth-child(1) { grid-area: search; }
.ops-grid > .panel:nth-child(2) { grid-area: cams; }
.ops-grid > .panel:nth-child(3) { grid-area: live; }
.ops-grid > .panel:nth-child(4) { grid-area: details; }
.ops-grid > .panel:nth-child(5) { grid-area: status; }
.ops-grid > .panel:nth-child(6) { grid-area: timeline; }
.ops-grid > .panel:nth-child(7) { grid-area: types; }
.search-panel { display: flex; flex-direction: column; gap: 10px; }
.search-row { display: flex; gap: 10px; }
.search-row .input-icon { flex: 1; }
.cam-list { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; }
.cam-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 10px; font: inherit; color: inherit;
  background: var(--bg-2); border: 1px solid var(--line); cursor: pointer; text-align: left; }
.cam-item:hover { border-color: var(--line-2); }
.cam-item.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cam-name { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cam-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cam-name small { color: var(--muted); font-size: .75rem; }
.stage { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; }
.stage video { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage-overlay { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; }
.stage[data-state="playing"] .stage-overlay { display: none; }
.stage[data-state="connecting"] .stage-overlay::before { content: "Conectando…"; }
.stage[data-state="offline"] .stage-overlay::before { content: "Sem vídeo"; }
.stage[data-state="connecting"] .stage-overlay, .stage[data-state="offline"] .stage-overlay { font-size: 0; }
.stage[data-state="connecting"] .stage-overlay::before, .stage[data-state="offline"] .stage-overlay::before { font-size: 1rem; }
.stage:fullscreen { border-radius: 0; aspect-ratio: auto; }
.kv { display: grid; grid-template-columns: max-content 1fr; margin: 0; }
.kv dt, .kv dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--muted); padding-right: 16px; }
.last-event { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.status-box { display: flex; flex-direction: column; gap: 8px; }
.stat { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg-2); border-radius: 8px; }
.stat span:nth-child(2) { flex: 1; }
.timeline { display: flex; flex-direction: column; gap: 8px; }
.timeline-bars { height: 72px; border-radius: 8px; display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px;
  background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px calc(100% / 24)); }
.tl-col { display: flex; flex-direction: column-reverse; min-width: 0; }
.tl-seg { display: block; min-height: 3px; border-radius: 2px; }
.tl-seg.intrusion { background: var(--purple); } .tl-seg.alert { background: var(--err); } .tl-seg.offline { background: var(--warn); }
.timeline-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .72rem; }
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { width: 120px; height: 120px; border-radius: 50%; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle, var(--panel) 54%, transparent 55%), conic-gradient(var(--line-2) 0 100%); }
.donut strong { font-size: 1.5rem; line-height: 1; }
.donut small { color: var(--muted); font-size: .72rem; }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; font-size: .85rem; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend b { margin-left: auto; color: var(--muted); font-weight: 600; }
.sw { width: 10px; height: 10px; border-radius: 50%; }
.sw.lpr { background: var(--ok); } .sw.alert { background: var(--err); } .sw.intrusion { background: var(--purple); } .sw.offline { background: var(--warn); }

/* Tabelas */
.table-wrap { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--panel-2); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(31,122,255,.05); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.row-actions.nowrap { flex-wrap: nowrap; }
.user-menu.action-menu { position: fixed; z-index: 70; }   /* com .user-menu: fixo na tela para não ser cortado pelo .table-wrap */
.user-menu-item.danger { color: var(--err-fg); }
.menu-sep { height: 1px; margin: 4px 0; background: var(--line); }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; margin: 0 4px 4px 0;
  background: var(--panel-2); color: var(--fg-2); }
.tag.ok { background: var(--ok-bg); color: var(--ok-fg); }
.tag.err { background: var(--err-bg); color: var(--err-fg); }
.tag.warn { background: var(--warn-bg); color: var(--warn-fg); }
.ua { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { font: inherit; background: none; border: 0; padding: 8px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }
.props { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.props dt { color: var(--muted); }
.props dd { margin: 0; }
.page .card > h2, .page .card h2 { margin-bottom: 2px; }
.page form.stack > .btn { align-self: flex-start; }

/* Monitoramento (mosaico) */
.layout-bar { display: flex; gap: 6px; }
.mosaic { display: grid; gap: 8px; }
.mosaic.g1 { grid-template-columns: 1fr; }
.mosaic.g4 { grid-template-columns: repeat(2, 1fr); }
.mosaic.g9 { grid-template-columns: repeat(3, 1fr); }
.mosaic.g16 { grid-template-columns: repeat(4, 1fr); }
.live { max-width: none; }
.tile { position: relative; margin: 0; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.tile:focus-visible { outline: 2px solid var(--accent); }
.tile video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.tile figcaption { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; color: #fff; font-size: .85rem; background: linear-gradient(rgba(0,0,0,.7), transparent); }
.tile .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .badge { font-size: .7rem; opacity: .8; }
.tile[data-state="offline"]::after { content: "Sem vídeo"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.tile.empty-slot { background: var(--panel); border-style: dashed; }
.tile:fullscreen { border-radius: 0; aspect-ratio: auto; }
.tile .icon-btn { color: #fff; background: rgba(0,0,0,.35); padding: 2px 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--neutral); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot.off { background: var(--err); }
.empty { grid-column: 1 / -1; text-align: center; }

/* Formulário de câmera */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { border: 1px solid var(--line-2); border-radius: 8px; padding: 12px; margin: 0; }
legend { font-weight: 600; padding: 0 4px; }
.copy-row { display: flex; gap: 6px; }
.copy-row input { font-family: ui-monospace, monospace; font-size: .85rem; }
details summary { cursor: pointer; color: var(--muted); }

/* Diálogos e avisos */
.modal { border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel); color: var(--fg);
  padding: 20px; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal::backdrop { background: rgba(2, 6, 14, .7); }
.qr { width: 200px; height: 200px; align-self: center; background: #fff; border-radius: 8px; }
.secret { word-break: break-all; background: var(--bg-2); padding: 8px; border-radius: 6px; }
.toast { position: fixed; right: 16px; bottom: 16px; padding: 10px 16px; border-radius: 8px; background: var(--toast-bg);
  color: var(--toast-fg); box-shadow: 0 4px 16px rgba(0,0,0,.4); z-index: 100; max-width: calc(100vw - 32px);
  top: auto; left: auto; margin: 0; border: 0; overflow: visible; }
.toast.err { background: var(--err); color: #fff; }
.toast.warn { background: var(--warn); color: #1a1205; }
/* Link do aviso na cor do próprio texto do aviso: o azul de `a` some sobre o fundo claro do toast */
.toast .toast-action { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
button.toast-action { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

/* Detecções sobre o vídeo e editor de perímetro (etapa 4) */
.head-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
canvas.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.bell { position: relative; }
.bell-badge { position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--err); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.bell-badge[hidden] { display: none; }
.alert-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.alert-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg-2); border-radius: 8px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.search-field { display: flex; }
.search-field > * { flex: 1; min-width: 0; }
.alert-item { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 10px; background: var(--bg-2); border-radius: 8px; }
.stack-tight { display: inline-flex; flex-direction: column; gap: 2px; }
.modal.wide { width: min(1180px, calc(100vw - 32px)); }
.pe-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.pe-stage { cursor: crosshair; }
.pe-stage video { object-fit: fill; }
.pe-surface { position: absolute; inset: 0; touch-action: none; }
.pe-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pe-poly { fill: rgba(167,139,250,.22); stroke: #a78bfa; stroke-width: 2; vector-effect: non-scaling-stroke; }
.pe-line { fill: none; stroke: #a78bfa; stroke-width: 2; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.pe-handles { position: absolute; inset: 0; pointer-events: none; }
.pe-handle { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; padding: 0;
  background: #fff; border: 3px solid #7c3aed; cursor: grab; pointer-events: auto; box-shadow: 0 0 0 2px rgba(0,0,0,.4); }
.pe-handle:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.pe-handle:active { cursor: grabbing; }
.pe-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }

/* Ocorrências (etapa 5) */
.ev-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px; }
.ev-filters select { width: auto; min-width: 180px; flex: 1 1 180px; }
.ev-filters .grow { flex: 2 1 220px; }
.inline-field { display: flex; align-items: center; gap: 6px; flex: 1 1 170px; }
.inline-field span { color: var(--muted); font-size: .85rem; }
.ev-list { display: flex; flex-direction: column; gap: 8px; }
.ev-row { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.ev-row:hover, .ev-row:focus-visible { border-color: var(--line-2); background: var(--panel-2); }
.ev-row.compact { background: var(--bg-2); padding: 8px; gap: 10px; }
.ev-thumb { width: 128px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: #000; flex: none; }
.ev-row.compact .ev-thumb { width: 96px; }
.ev-thumb.none { display: grid; place-items: center; color: var(--muted); font-size: .75rem; background: var(--bg-2); border: 1px dashed var(--line-2); }
.ev-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ev-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.ev-detail.single { grid-template-columns: 1fr; }
.ev-media-wrap { background: #000; border-radius: 10px; overflow: hidden; }
.ev-media { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: #000; }
.ev-detail .actions.start, .actions.start { justify-content: flex-start; align-items: center; grid-column: 1 / -1; }
.alert-link { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; font: inherit; color: inherit;
  background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

/* Placas (etapa 6) */
.plate-badge { display: inline-block; font: 700 1rem/1 "Segoe UI", system-ui, sans-serif; letter-spacing: .12em; color: #111827;
  background: #f8fafc; border: 2px solid #1f2937; border-top: 6px solid #1d4ed8; border-radius: 5px; padding: 3px 8px 4px; white-space: nowrap; }
.plate-badge.alert { border-top-color: var(--err); box-shadow: 0 0 0 2px rgba(239,68,68,.45); }
.pass-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pass-card { display: flex; flex-direction: column; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 0; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.pass-card:hover, .pass-card:focus-visible { border-color: var(--line-2); background: var(--panel-2); }
.pass-card.alert { border-color: rgba(239,68,68,.6); }
.pass-photo { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; display: block; }
.pass-photo.none { display: grid; place-items: center; color: var(--muted); font-size: .8rem; background: var(--bg-2); }
.pass-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; }
.pass-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pass-crop { height: 40px; max-width: 100%; object-fit: contain; align-self: flex-start; border-radius: 4px; background: #000; }
.pass-crop.big { height: 64px; }
.err-text { color: var(--err-fg); }
.warn-text, .face-compare figcaption.warn-text { color: var(--warn-fg); }

/* Telas menores */
/* Etapa 7: tratativa, busca e status das câmeras */
.ack-box { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--bg-2); border-radius: 8px; }
.ack-box textarea { width: 100%; resize: vertical; }
.ack-note { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.watch-hit { overflow-wrap: anywhere; }
.status-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.cam-status { display: flex; flex-direction: column; gap: 12px; }
.cam-status.err { border-color: rgba(239,68,68,.55); }
.cam-status-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cam-status-head h2 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.uptime-bar { position: relative; height: 14px; border-radius: 4px; background: #15803d; overflow: hidden; }
.uptime-bar.off { background: var(--neutral-2); }
.uptime-bar .untracked { position: absolute; top: 0; bottom: 0; left: 0; background: var(--neutral-2); }
.uptime-bar .down { position: absolute; top: 0; bottom: 0; background: var(--err); }
.uptime-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .7rem; margin-top: 3px; }
.kv.compact dt, .kv.compact dd { padding: 5px 0; font-size: .85rem; }
.kv.compact dt { padding-right: 12px; }
.ev-filters .inline-field { flex: 0 1 210px; }
/* select dentro de um .field (coluna): a base flexível de 180px viraria altura */
.ev-filters .field > select { flex: none; }
.goto-row { display: flex; gap: 6px; }
.kv.compact dd { overflow-wrap: anywhere; }
.up.ok { color: var(--ok-fg); } .up.warn { color: var(--warn-fg); } .up.err { color: var(--err-fg); }
.search-panel select, .search-panel input[type=date] { flex: 1; min-width: 0; }

/* Etapa 8: reconhecimento facial */
.chip.face { background: #0e4a5c; color: #67e8f9; }
.sw.face { background: var(--teal); }
.face-compare { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.face-compare figure { margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.face-compare img, .face-compare .none { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: 50% 12%; border-radius: 8px; background: #000; display: block; }
.face-compare .none { display: grid; place-items: center; color: var(--muted); font-size: .75rem; background: var(--bg-2); }
.face-compare figcaption { color: var(--muted); font-size: .75rem; text-align: center; }
.face-score { display: flex; flex-direction: column; align-items: center; padding: 0 4px; }
.face-score strong { font-size: 1.25rem; }
.face-score small { color: var(--muted); font-size: .7rem; }
.face-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.face-card, .person-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.face-card-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.face-card-body > .btn { align-self: flex-start; }
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.person-photo { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: 50% 12%; border-radius: 8px; background: #000; display: block; }
.person-photo.none { display: grid; place-items: center; color: var(--muted); font-size: .8rem; background: var(--bg-2); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.photo-tile { margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.photo-tile img, .photo-tile .none { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: 50% 12%; border-radius: 8px; background: #000; }
.photo-tile figcaption { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-size: .8rem; }
.num-input { width: 80px; }

@media (max-width: 1500px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  .ops-grid { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    grid-template-areas: "search search" "cams live" "details details" "status timeline" "types types"; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .top-search, .user-meta, .greeting span { display: none; }
  .greeting strong { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .content { padding: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-grid { grid-template-columns: 1fr; grid-template-areas: "live" "cams" "details" "search" "status" "timeline" "types"; }
  .mosaic.g9, .mosaic.g16 { grid-template-columns: repeat(2, 1fr); }
  .row2 { grid-template-columns: 1fr; }
  .pe-layout { grid-template-columns: 1fr; }
  .ev-detail { grid-template-columns: 1fr; }
  thead { display: none; }
  table, tbody, tr, td { display: block; }
  tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  td { border: 0; padding: 4px 14px; }
  td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .8rem; }
  .row-actions { justify-content: flex-start; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi-value { font-size: 1.35rem; }
  .search-row { flex-direction: column; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut { align-self: center; }
  .ev-thumb { width: 88px; }
  .sys-grid { grid-template-columns: 1fr; }
  .pass-grid { grid-template-columns: 1fr; }
  .face-grid { grid-template-columns: 1fr; }
  .person-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-grid { grid-template-columns: 1fr; }
  .status-kpis { grid-template-columns: 1fr; }
}

/* Etapa 9: busca por aparência */
.sight-filters { padding: 14px; gap: 10px; }
.ev-filters.flat { padding: 0; }
.understood { margin: 0; min-height: 1.2em; }
.warn-text { color: var(--warn-fg); }
.picker { display: flex; flex-direction: column; gap: 4px; }
.picker-row { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 8px; }
.swatch-btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.swatch { display: inline-block; width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25);
  flex: none; }
.swatch.small { width: 12px; height: 12px; }
.sw-preto { background: #111; } .sw-branco { background: #f5f5f5; } .sw-cinza { background: #8a8f98; }
.sw-vermelho { background: #d42a2a; } .sw-laranja { background: #f07c12; } .sw-amarelo { background: #f2d22e; }
.sw-verde { background: #2f9e44; } .sw-azul { background: #1f5fd1; } .sw-roxo { background: #7b2fa8; }
.sw-rosa { background: #f28cc0; } .sw-marrom { background: #7a4a24; } .sw-bege { background: #d8c3a0; }
.sw-azul-claro { background: #7fb3e8; }
.attr { font-size: .85rem; }
.region-wrap { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.region-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.region-torso { fill: rgba(47, 158, 68, .28); stroke: #2f9e44; stroke-width: 2; vector-effect: non-scaling-stroke; }
.region-leg { stroke: rgba(31, 95, 209, .75); stroke-width: 6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.color-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.color-name { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; }
.sight-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.sight-crop { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: #000; display: block; }
.sight-crop.none { display: grid; place-items: center; color: var(--muted); font-size: .8rem; background: var(--bg-2); }
.sight-crop.big { width: auto; max-width: 100%; max-height: 260px; aspect-ratio: auto; border-radius: 6px; }
@media (max-width: 520px) {
  .sight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Etapa 10: mapa das câmeras */
.map-view { height: calc(100vh - 250px); min-height: 420px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--map-bg); z-index: 0; }
.map-page .ev-filters { gap: 8px; }
.map-legend { display: flex; gap: 12px; align-items: center; margin-left: auto; color: var(--muted); }
.map-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.lg.online { background: var(--ok); } .lg.offline { background: #64748b; } .lg.event { background: var(--err); }
.map-notice { background: var(--warn-bg); border: 1px solid var(--warn); color: var(--warn-fg); border-radius: var(--radius); padding: 8px 14px; }
.map-notice p { margin: 4px 0; }
.map-pin { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; color: #fff; font-weight: 700;
  font-size: .85rem; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.6); background: #64748b; box-sizing: border-box; }
.map-pin.cam { border-width: 2px; }
.map-pin.group { border-radius: 10px; }
.map-pin.cluster { border-style: double; border-width: 4px; }
.map-pin.online { background: #16a34a; }
.map-pin.offline { background: #475569; }
.map-pin.unknown { background: #64748b; }
.map-pin.event { background: #dc2626; }
.map-pin.blink { animation: pin-blink .6s ease-in-out infinite alternate; }
.map-pin.blink.k-intrusion { --blink: var(--purple); } .map-pin.blink.k-alert { --blink: var(--err); }
.map-pin.blink.k-offline { --blink: var(--warn); } .map-pin.blink.k-face { --blink: var(--teal); }
@keyframes pin-blink { from { background: var(--blink, var(--err)); transform: scale(1); box-shadow: 0 0 0 0 var(--blink, var(--err)); }
  to { background: #fff; color: #000; transform: scale(1.25); box-shadow: 0 0 14px 6px var(--blink, var(--err)); } }
@media (prefers-reduced-motion: reduce) { .map-pin.blink { animation: none; outline: 4px solid var(--blink, var(--err)); } }
.cam-cone { fill: #38bdf8; fill-opacity: .22; stroke: #38bdf8; stroke-opacity: .7; }
.cam-cone.event { fill: #ef4444; stroke: #ef4444; } .cam-cone.offline { fill: #94a3b8; stroke: #94a3b8; }
.leaflet-container { font: inherit; background: var(--map-bg); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--fg); border: 1px solid var(--line-2); }
.leaflet-popup-content { margin: 12px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-control-attribution { background: var(--glass) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--accent-2); }
.leaflet-bar a { background: var(--panel-2); color: var(--fg); border-color: var(--line-2); }
.leaflet-tooltip { background: var(--panel-2); color: var(--fg); border-color: var(--line-2); }
.map-popup { display: flex; flex-direction: column; gap: 8px; min-width: 260px; }
.map-popup .btn.danger { text-align: left; }
.map-videos { display: grid; gap: 6px; grid-template-columns: 1fr; }
.map-videos.n2, .map-videos.n3, .map-videos.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.map-videos .tile { margin: 0; min-height: 0; aspect-ratio: 16 / 9; width: 100%; }
.map-videos.n1 .tile { width: 400px; max-width: 70vw; }
.map-videos.n2 .tile, .map-videos.n3 .tile, .map-videos.n4 .tile { width: 250px; max-width: 38vw; }
.trail-box { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.trail-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.trail-list { margin: 0; padding-left: 20px; max-height: 140px; overflow: auto; font-size: .85rem; }
.link-btn { background: none; border: 0; color: var(--accent-2); cursor: pointer; padding: 1px 0; font: inherit; text-align: left; }
.trail-line { stroke: #f59e0b; stroke-dasharray: 8 6; }
.trail-pt { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #f59e0b; color: #111;
  font-weight: 700; font-size: .75rem; border: 2px solid #fff; box-sizing: border-box; }
.trail-pt.last { background: var(--err); color: #fff; }
.pick-map { height: 320px; border-radius: 8px; border: 1px solid var(--line-2); }
.pick-pin { background: var(--accent); border: 3px solid #fff; border-radius: 50%; box-shadow: 0 1px 6px rgba(0,0,0,.6); }
.pick-other { fill: #94a3b8; fill-opacity: .8; stroke: #fff; stroke-width: 1; }
.stack.tight { gap: 4px; }
.check-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow: auto; }
@media (max-width: 860px) {
  .map-view { height: 65vh; }
  .map-legend { margin-left: 0; }
}

/* Etapa 12: veículos */
.chip.vehicle { background: #4a2d0b; color: #fdba74; }
.sw.vehicle, .tl-seg.vehicle { background: #f97316; }
.map-pin.blink.k-vehicle { --blink: #f97316; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-toggle { font: inherit; font-size: .8rem; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  background: var(--bg-2); color: var(--fg); border: 1px solid var(--line-2); }
.chip-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.vsw-preto { background: #111; } .vsw-branco { background: #f5f5f5; } .vsw-prata { background: #c0c4cc; }
.vsw-cinza { background: #6b7280; } .vsw-vermelho { background: #d42a2a; } .vsw-azul { background: #1f5fd1; }
.vsw-verde { background: #2f9e44; } .vsw-amarelo { background: #f2d22e; } .vsw-marrom_bege { background: #8b6a43; }
.vsw-outra { background: linear-gradient(135deg, #f07c12, #7b2fa8); }

/* Etapa 13: aplicativo instalável (PWA) e vídeo-wall */
.update-banner { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1000; display: flex;
  align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel-2); border: 1px solid var(--accent);
  border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.5); max-width: calc(100vw - 32px); flex-wrap: wrap; }
.install-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.install-btn .icon { width: 16px; height: 16px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.offline-card { max-width: 440px; text-align: center; align-items: center; }
.videowall { position: fixed; inset: 0; background: #000; display: flex; flex-direction: column; z-index: 50; }
.videowall .mosaic { flex: 1; gap: 2px; padding: 2px; height: 100%; align-content: stretch; }
.videowall .mosaic .tile { border-radius: 0; border: 0; aspect-ratio: auto; min-height: 0; }
.videowall .mosaic.g1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.videowall .mosaic.g4 { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.videowall .mosaic.g9 { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.videowall .mosaic.g16 { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); }
.wall-bar { position: absolute; top: 8px; right: 8px; display: flex; gap: 8px; align-items: center; opacity: 0;
  transition: opacity .2s; background: var(--glass); padding: 6px 10px; border-radius: 8px; }
.videowall:hover .wall-bar, .wall-bar:focus-within { opacity: 1; }
.wall-start { position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; padding: 16px 24px;
  font: inherit; font-size: 1.1rem; color: #fff; background: rgba(31,122,255,.9); border: 0; border-radius: 12px;
  cursor: pointer; }
.map-view:fullscreen { border-radius: 0; border: 0; height: 100vh; }
@media (max-width: 860px) {
  .install-btn span { display: none; }
}

/* Etapa 17: placa aproximada (lida x cadastrada) e fila de confirmação das placas */
.plate-diff { color: #fff; background: var(--err, #d42a2a); border-radius: 3px; padding: 0 1px; }
.plate-compare { display: grid; gap: 6px; }
.plate-row { display: flex; align-items: center; gap: 10px; }
.plate-row > small { width: 78px; }
.queue-card { display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 14px; align-items: start; }
.queue-photo { width: 100%; border-radius: 6px; background: #000; }
.tab-badge { margin-left: 6px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--err, #d42a2a);
  color: #fff; font-size: .72rem; line-height: 18px; display: inline-block; text-align: center; }
.block { display: block; }
@media (max-width: 640px) { .queue-card { grid-template-columns: 1fr; } }

/* Etapa 18: painel de vídeos do grupo no mapa (no lugar do popup do Leaflet) */
.map-wrap { position: relative; }
.map-wrap:fullscreen { background: var(--bg); }
.map-wrap:fullscreen .map-view { height: 100vh; border-radius: 0; border: 0; }
.group-panel { position: absolute; z-index: 1000; display: flex; flex-direction: column; gap: 10px; padding: 14px;
  background: var(--panel); color: var(--fg); border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55); overflow: hidden; box-sizing: border-box; }
.group-panel.sheet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; border-radius: 16px 16px 0 0;
  padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.panel-head { display: flex; align-items: flex-start; gap: 10px; }
.panel-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.panel-title strong { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-close { flex: none; }
.panel-events { display: flex; flex-direction: column; gap: 6px; }
.panel-events .btn { justify-content: flex-start; text-align: left; }
.panel-grid { display: grid; gap: 8px; min-height: 0; flex: 1 1 auto; overflow-y: auto; align-content: start; }
.panel-grid.c1 { grid-template-columns: minmax(0, 1fr); }
.panel-grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Com 3 câmeras em 2 colunas, a última fica centralizada com o mesmo tamanho das outras */
.panel-grid.n3 > .tile:last-child { grid-column: 1 / -1; justify-self: center; width: calc(50% - 4px); }
.panel-grid.scroll { overflow-y: auto; padding-right: 4px; }
.panel-tile { cursor: pointer; aspect-ratio: 16 / 9; width: 100%; min-width: 0; overflow: hidden; background: #000; }
.panel-tile video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.panel-tile figcaption { gap: 6px; }
.panel-tile .tile-expand { margin-left: auto; }
.panel-tile[data-state="idle"]::after { content: "Aguardando…"; position: absolute; inset: 0; display: grid;
  place-items: center; color: var(--muted); font-size: .8rem; }
.panel-tile.no-signal { background: #3a4150; }
.panel-tile.no-signal::after { content: none; }
.no-signal-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; color: #d5dbe5; font-size: .85rem; }
.no-signal-icon { font-size: 1.6rem; line-height: 1; opacity: .8; }
.panel-tile:fullscreen { aspect-ratio: auto; cursor: default; }
.panel-foot { display: flex; justify-content: flex-end; }
.panel-foot .btn, .panel-foot .btn:visited { color: #fff; }

/* Etapa 20: tipo/cor incertos e matriz de confusão das correções */
.pass-top .uncertain { margin-left: 2px; color: var(--warn-fg); font-weight: 700; }
table.confusion th, table.confusion td { text-align: center; white-space: nowrap; }
table.confusion tbody th { text-align: left; }
table.confusion td.hit { color: var(--ok-fg); }
table.confusion td.miss { background: rgba(212, 42, 42, .18); color: var(--err-fg); font-weight: 600; }

/* Etapa 21: fila "ajude a classificar" e painel de qualidade */
.help-card { max-width: 980px; }
.help-media { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.help-crop { max-height: 260px; max-width: 100%; border-radius: 8px; background: #000; }
.help-snap { max-height: 260px; max-width: 100%; border-radius: 8px; opacity: .85; }
.chip-toggle.second { border-style: dashed; border-color: var(--warn-fg); }
.chip-toggle kbd, .btn kbd { font: inherit; font-size: .7rem; padding: 0 4px; border-radius: 4px; border: 1px solid var(--line-2); opacity: .8; }
.quality-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
table.compact td { padding: 3px 8px 3px 0; font-size: .85rem; }
table.compact td.num { text-align: right; }
.quality-grid table.compact { width: auto; align-self: flex-start; }
.quality-grid table.compact td.num { padding-left: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row.spread { justify-content: space-between; }

/* Etapa 22: cartão de conferência */
.conf-dialog { max-width: min(1200px, 96vw); }
.conf-card { gap: 12px; }
.conf-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .conf-grid { grid-template-columns: 1fr; } }
.conf-media { display: flex; flex-direction: column; gap: 8px; }
.conf-snap { width: 100%; border-radius: 8px; background: #000; }
.conf-crop { max-height: 180px; max-width: 100%; align-self: flex-start; border-radius: 6px; }
.conf-attr { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.conf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.conf-actions { margin-left: auto; display: inline-flex; gap: 6px; }
.plate-crop-big { width: 100%; max-width: 420px; image-rendering: pixelated; border-radius: 4px; background: #000; }
.plate-boxes { display: flex; gap: 6px; }
.plate-box { width: 2.6rem; height: 3rem; text-align: center; font: 700 1.5rem/1 ui-monospace, monospace; text-transform: uppercase; padding: 0; }
.plate-box.changed { border-color: #f87171; background: rgba(212, 42, 42, .15); }
.chip-toggle.current { box-shadow: inset 0 -2px 0 var(--accent); }
table.compact td.bad { color: var(--err-fg); font-weight: 600; }

/* Etapa 23: menu em grupos (acordeão), lateral recolhível com menus flutuantes, menu do usuário */
.nav-group { display: flex; flex-direction: column; position: relative; }
.nav-group-head { width: 100%; }
.nav-group-head .chevron { margin-left: auto; width: 16px; height: 16px; transition: transform .15s; opacity: .7; }
.nav-group.open .nav-group-head .chevron { transform: rotate(90deg); }
.nav-group.active > .nav-group-head { color: var(--fg-strong); background: var(--hover); box-shadow: inset 3px 0 0 var(--primary); }
.nav-sub { display: none; flex-direction: column; gap: 2px; padding: 2px 0 6px 34px; }
.nav-group.open > .nav-sub { display: flex; }
.side-nav .nav-sub a { padding: 7px 10px; font-size: .92rem; }
.nav-fly-title { display: none; }
.side-foot { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }
.side-collapse { color: var(--muted); }
@media (min-width: 901px) {
  .shell.nav-collapsed { grid-template-columns: 72px 1fr; }
  .sidebar.collapsed { padding: 18px 10px; }
  .sidebar.collapsed .nav-label, .sidebar.collapsed .chevron { display: none; }
  .sidebar.collapsed .side-brand { padding: 6px 0 18px; }
  .sidebar.collapsed .side-brand .brand-logo--sm { display: none; }   /* recolhido: sem a logo completa (nunca comprimida)... */
  .sidebar.collapsed .side-brand .brand-logo--xs { display: block; }   /* ...mas o símbolo aprovado, quadrado, cabe nos 52 px úteis */
  .sidebar.collapsed .side-nav { overflow: visible; }
  .sidebar.collapsed .nav-item, .sidebar.collapsed .nav-group-head, .sidebar.collapsed .side-logout { justify-content: center; padding: 10px 0; }
  /* Submenus num menu flutuante: ao passar o mouse, com o teclado ou ao clicar no ícone */
  .sidebar.collapsed .nav-sub, .sidebar.collapsed .nav-group.open > .nav-sub { display: none; position: absolute; left: calc(100% + 6px); top: 0;
    min-width: 220px; padding: 8px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 60; }
  .sidebar.collapsed .nav-group:hover > .nav-sub, .sidebar.collapsed .nav-group:focus-within > .nav-sub,
  .sidebar.collapsed .nav-group.fly > .nav-sub { display: flex; }
  /* Um submenu por vez: com o mouse sobre outro grupo, o que ficou aberto por clique ou foco se fecha */
  .sidebar.collapsed .side-nav:hover .nav-group:not(:hover) > .nav-sub { display: none; }
  .sidebar.collapsed .nav-fly-title { display: block; font-weight: 700; color: var(--fg-strong); padding: 4px 10px 6px; }
}
.user-menu-wrap { position: relative; }
.user-chip { font: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
.user-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; display: flex; flex-direction: column; gap: 2px;
  padding: 8px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 40; }
.user-menu[hidden] { display: none; }
.user-menu-head { display: flex; flex-direction: column; padding: 4px 8px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; color: var(--fg); text-decoration: none;
  font: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
.user-menu-item:hover { background: var(--panel-2); }
.user-menu-item .icon { width: 18px; height: 18px; }

/* Etapa 24: áreas de interesse do LPR */
.pe-poly.roi { fill: rgba(52,211,153,.12); stroke: #34d399; }
.pe-poly.roi.current { fill: rgba(52,211,153,.26); }
.roi-crop { fill: none; stroke: #f8fafc; stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; opacity: .8; }
.capture-line { stroke: #facc15; stroke-width: 3; vector-effect: non-scaling-stroke; }
.pe-handle.line { background: #facc15; }
.roi-preview { width: 100%; max-width: 320px; aspect-ratio: 1; border-radius: 6px; background: #727272; }

/* Etapa 25: cadastro com análises combináveis e editor de áreas por análise */
.derived { margin: -4px 0 6px 26px; padding-left: 12px; border-left: 2px solid var(--line-2); }
.derived[hidden] { display: none; }
.cost-line { margin: 4px 0 0; }
.pe-poly.area-lpr { fill: rgba(52,211,153,.14); stroke: #34d399; }
.pe-poly.area-intrusion { fill: rgba(167,139,250,.18); stroke: #a78bfa; }
.pe-poly.area-passerby { fill: rgba(96,165,250,.16); stroke: #60a5fa; }
.pe-poly.current { stroke-width: 3; }
.pe-poly.faded, .capture-line.faded { opacity: .35; }
.pe-handle.handle-lpr { background: #34d399; } .pe-handle.handle-intrusion { background: #a78bfa; }
.pe-handle.handle-passerby { background: #60a5fa; }
.tab.tab-lpr.active { box-shadow: inset 0 -3px 0 #34d399; } .tab.tab-intrusion.active { box-shadow: inset 0 -3px 0 #a78bfa; }
.tab.tab-passerby.active { box-shadow: inset 0 -3px 0 #60a5fa; }

/* Etapa 26: mosaicos salvos */
.mosaic.g6 { grid-template-columns: repeat(3, 1fr); }
.mosaic.gdestaque5 { grid-template-columns: repeat(3, 1fr); }
.mosaic.gdestaque7 { grid-template-columns: repeat(4, 1fr); }
.mosaic.gdestaque5 > .big { grid-column: span 2; grid-row: span 2; }
.mosaic.gdestaque7 > .big { grid-column: span 3; grid-row: span 3; }
.mosaic.gdestaque5 > .big, .mosaic.gdestaque7 > .big { aspect-ratio: auto; }
.tile.no-signal { display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.mosaic-picker { position: relative; }
.mosaic-picker-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 300px; max-height: 60vh; overflow: auto;
  display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.mosaic-picker-panel[hidden] { display: none; }
.picker-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; border: 0; background: none;
  color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.picker-item:hover, .picker-item.active { background: var(--panel-2); }
.picker-item .icon, .mosaic-icon .icon { width: 18px; height: 18px; }
.mosaic-icon { display: inline-grid; place-items: center; color: var(--accent-2); }
.mosaic-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.mosaic-card { display: flex; flex-direction: column; gap: 8px; }
.mosaic-card-head { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; }
.btn.active { border-color: #facc15; color: #facc15; }
.mosaic-editor { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .mosaic-editor { grid-template-columns: 1fr; } }
.editor-side { max-height: 70vh; }
.editor-cams { display: flex; flex-direction: column; gap: 4px; overflow: auto; max-height: 60vh; }
.editor-cam { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--fg); font: inherit; text-align: left; cursor: grab; }
.editor-cam.active { border-color: var(--accent); background: rgba(31,111,255,.18); }
.editor-cam.used { opacity: .65; }
.editor-grid { gap: 6px; }
.editor-cell { display: flex; align-items: center; justify-content: center; padding: 8px; background: var(--bg-2); cursor: pointer; }
.editor-cell.drop { outline: 2px dashed var(--accent); }
.editor-cell-body { width: 100%; font-size: .8rem; }
.editor-cell-body input[type=text] { font-size: .8rem; padding: 4px 6px; }
.editor-cell .icon-btn { position: absolute; top: 4px; right: 4px; }
.mosaic-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; }
.mosaic-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2);
  color: var(--fg); text-decoration: none; background: var(--bg-2); }
.mosaic-chip:hover { border-color: var(--accent); }
.mosaics-strip { margin-bottom: 16px; }

/* Etapa 27: Visão geral como central de operação */
.kpi-link { color: inherit; text-decoration: none; cursor: pointer; transition: transform .1s, border-color .1s; }
.kpi-link:hover { border-color: var(--accent); transform: translateY(-1px); }
.ops-main { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  grid-template-areas: "map alerts" "map form"; margin-bottom: 16px; }
.ops-main > .panel:nth-child(1) { grid-area: map; }
.ops-main > .panel:nth-child(2) { grid-area: alerts; max-height: 520px; overflow: auto; }
.ops-main > .panel:nth-child(3) { grid-area: form; }
.ops-main:not(:has(.map-embed)) { grid-template-columns: 1fr 1fr; grid-template-areas: "alerts form"; }
.ops-bottom { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); }
@media (max-width: 1200px) {
  .ops-main { grid-template-columns: 1fr; grid-template-areas: "map" "alerts" "form"; }
  .ops-bottom { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) { .ops-bottom { grid-template-columns: 1fr; } }
.map-embed { min-height: 560px; }
.map-embed-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.map-embed .map-wrap.embedded { height: 520px; }
.map-wrap { position: relative; display: flex; }
.map-wrap .map-view { flex: 1; min-width: 0; }
.map-wrap.embedded .map-view { height: 100%; }
.map-drawer { width: 230px; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--panel);
  border-right: 1px solid var(--line); overflow: auto; z-index: 2; }
.map-drawer[hidden] { display: none; }
.map-drawer-list { display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.map-drawer-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; border: 0; background: none;
  color: var(--fg); font: inherit; font-size: .85rem; text-align: left; cursor: pointer; }
.map-drawer-item:hover:not(:disabled) { background: var(--panel-2); }
.map-drawer-item:disabled { opacity: .55; cursor: default; }
.map-wrap:fullscreen { height: 100vh; }
.map-pin.focus { animation: pin-focus 1s ease-in-out 4; box-shadow: 0 0 0 4px #facc15; }
@keyframes pin-focus { 50% { transform: scale(1.35); } }
/* Estilo colorido: pinos com contorno escuro para destacar no fundo claro */
.map-light .map-pin { box-shadow: 0 0 0 2px rgba(15,23,42,.85), 0 2px 6px rgba(0,0,0,.45); }
.incident-types { flex-wrap: wrap; }
.incident textarea { width: 100%; font: inherit; }
.alert-feed { display: flex; flex-direction: column; gap: 4px; }
.feed-row.done { opacity: .7; }
.feed-text { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pending-alert { padding: 8px; border-color: #f59e0b; }
.mosaic-cards.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.mosaic-mini { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; padding: 10px; font: inherit;
  text-align: left; cursor: pointer; }
.mosaic-mini:hover { border-color: var(--accent); }
.mosaic-thumb { display: grid; gap: 2px; width: 56px; aspect-ratio: 16 / 9; flex: none; }
.mosaic-thumb span { background: var(--line-2); border-radius: 2px; }
.mosaic-thumb span.on { background: var(--accent); }
.mosaic-thumb span.destaque5 { grid-column: span 2; grid-row: span 2; }
.mosaic-thumb span.destaque7 { grid-column: span 3; grid-row: span 3; }
.mosaic-thumb.add { display: grid; place-items: center; font-size: 1.4rem; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 6px; }
.chip.manual { background: #0e3a4a; color: #67e8f9; }
.sw.manual, .tl-seg.manual { background: #22d3ee; }
.map-pin.blink.k-manual { --blink: #22d3ee; }

.tile.flash { animation: tile-flash 1s ease-in-out infinite; }
@keyframes tile-flash { 50% { box-shadow: inset 0 0 0 4px #ef4444; border-color: #ef4444; } }
.feed-wrap { display: flex; align-items: center; gap: 4px; }
.feed-wrap > .ev-row { flex: 1; min-width: 0; }
.wall-send { display: inline-flex; flex-direction: column; gap: 2px; }

/* Etapa 29: câmeras/ao vivo/detalhes de volta no topo; mapa e alertas abaixo; Nova ocorrência em janela */
.ops-actions { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.ops-cams { display: grid; gap: 16px; margin-bottom: 16px;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr) minmax(260px, 330px); }
@media (max-width: 1200px) { .ops-cams { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
  .ops-cams > .panel:nth-child(3) { grid-column: 1 / -1; } }
@media (max-width: 900px) { .ops-cams { grid-template-columns: 1fr; } }
.ops-main { grid-template-areas: "map alerts"; }
.ops-main > .panel:nth-child(2) { max-height: 620px; }
@media (max-width: 1200px) { .ops-main { grid-template-areas: "map" "alerts"; } }
.kpi-action { font: inherit; text-align: left; border-style: dashed; }
.kpi-action:hover { border-style: solid; }
.kpi-primary { border-style: solid; border-color: var(--err); text-decoration: none; color: inherit; }
.kpi-value.small-value { font-size: 1.2rem; }
/* Mapa em tela cheia a partir da Visão geral */
.map-fullscreen { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: flex; flex-direction: column; padding: 8px; gap: 8px; }
.map-fullscreen .map-embed { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.map-fullscreen .map-wrap.embedded { flex: 1; height: auto; min-height: 0; }
.map-fullscreen .map-view { height: 100% !important; min-height: 0; }
.map-fullscreen-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px; }

/* Etapa 31: monitoramento da infraestrutura (Administração > Sistema) */
.infra-kpis { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.infra-tabs { overflow-x: auto; scrollbar-width: thin; }
.infra-tabs .tab { white-space: nowrap; flex: none; }
.kpi-icon.amber { background: var(--warn); }
.kpi-icon.gray { background: var(--line-2); }
.kpi .meter { margin-top: 6px; }
.infra-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; align-items: start; }
.infra-grid > .card { min-width: 0; }
.infra-alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--warn); background: var(--warn-bg); color: var(--warn-fg); }
.infra-alert.critico { border-color: #7f1d1d; background: #2a0b0b; color: #fecaca; }
.infra-alert .icon { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.meter { display: inline-block; vertical-align: middle; width: 100%; max-width: 160px; height: 6px; border-radius: 3px;
  background: var(--line-2); overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.meter-fill.warn { background: var(--warn); } .meter-fill.crit { background: var(--err); }
.core-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; }
.core { position: relative; display: grid; place-items: center; height: 30px; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line-2); --lvl: .1; }
.core::before { content: ""; position: absolute; inset: 0; background: var(--accent); opacity: var(--lvl); }
.core.warn::before { background: var(--warn); } .core.crit::before { background: var(--err); }
.core small { position: relative; font-size: .7rem; font-weight: 700; }
.chart-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.chart { display: grid; grid-template-columns: auto 1fr; gap: 6px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: .68rem; text-align: right; min-width: 48px; }
.chart-plot { position: relative; min-width: 0; }
.chart-svg { display: block; width: 100%; height: 150px; border-left: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.chart-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-line { fill: none; stroke-width: 1.8; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart-cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.chart-cursor.hidden, .chart-tip.hidden { display: none; }
.chart-tip { position: absolute; top: 4px; z-index: 2; min-width: 150px; padding: 6px 8px; border-radius: 6px; font-size: .75rem;
  background: var(--panel-2); border: 1px solid var(--line-2); pointer-events: none; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.chart-empty { padding: 30px 0; text-align: center; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; background: currentColor; }
.ln-1 { stroke: var(--chart-1); color: var(--chart-1); } .ln-2 { stroke: var(--chart-2); color: var(--chart-2); } .ln-3 { stroke: var(--chart-5); color: var(--chart-5); }
.ln-4 { stroke: var(--chart-3); color: var(--chart-3); } .ln-5 { stroke: var(--chart-6); color: var(--chart-6); } .ln-6 { stroke: var(--chart-4); color: var(--chart-4); }
tr.row-warn td { background: var(--warn-bg); }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .row3 { grid-template-columns: 1fr; } .chart-svg { height: 120px; } }

/* Etapa 32: gravação contínua */
.rec-badge { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px; font-size: .65rem; font-weight: 800;
  letter-spacing: .04em; color: #fff; background: var(--err); vertical-align: middle; }
.rec-timeline { display: flex; flex-direction: column; gap: 4px; }
.rec-bar { position: relative; height: 34px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line-2);
  cursor: pointer; overflow: hidden; }
.rec-span { position: absolute; top: 6px; bottom: 6px; background: #16a34a; border-radius: 3px; opacity: .85; }
.rec-span.remote { background: repeating-linear-gradient(135deg, #16a34a 0 4px, rgba(22, 163, 74, .35) 4px 8px); }
.rec-event { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; padding: 0; border: 0; background: var(--err); cursor: pointer; }
.rec-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; pointer-events: none; }
.rec-hover { position: absolute; top: 2px; transform: translateX(-50%); padding: 0 4px; border-radius: 4px; font-size: .68rem;
  background: var(--panel-2); border: 1px solid var(--line-2); pointer-events: none; white-space: nowrap; }
.rec-head.hidden, .rec-hover.hidden, .rec-msg.hidden { display: none; }
.rec-ticks { display: flex; justify-content: space-between; font-size: .65rem; color: var(--muted); }
.rec-grid { display: grid; gap: 10px; }
.rec-grid.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rec-grid.n3, .rec-grid.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rec-tile { position: relative; margin: 0; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
.rec-tile video { width: 100%; height: 100%; object-fit: contain; display: block; }
.rec-tile figcaption { position: absolute; left: 8px; top: 6px; font-size: .8rem; padding: 2px 6px; border-radius: 4px; background: rgba(0, 0, 0, .55); }
.rec-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.rec-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; }
.rec-clock { margin-left: auto; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .rec-grid.n2, .rec-grid.n3, .rec-grid.n4 { grid-template-columns: 1fr; } .rec-clock { margin-left: 0; } }

/* Etapa 35: WireGuard */
.code-box { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; word-break: break-all; }
.stack-tight.wide { display: flex; width: 100%; }

/* Etapa 36: imagem decorativa no rodapé do menu lateral. O degradê usa a cor da lateral (variáveis do tema),
   opaca no topo da imagem e transparente embaixo; escurecimento opcional para o contraste dos itens. */

.nav-art { position: absolute; left: 0; right: 0; bottom: 0; height: 46%; z-index: -1; pointer-events: none;
  background-size: cover; background-position: center bottom; background-repeat: no-repeat; --art-fade: .6; --art-dark: .25; }
.nav-art[hidden] { display: none; }
.nav-art::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, var(--art-dark)); }
.nav-art::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--sb-end) 0%, var(--sb-end) calc(var(--art-fade) * 22%),
    color-mix(in srgb, var(--sb-end) calc(var(--art-fade) * 55%), transparent) calc(18% + var(--art-fade) * 30%), transparent 100%); }
.sidebar.has-art .side-foot { border-top-color: rgba(255, 255, 255, .12); }
.sidebar.has-art .side-foot .side-logout, .sidebar.has-art .side-foot button { color: #e3eaf6; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
.sidebar.has-art .side-nav a:not(.active), .sidebar.has-art .nav-group-head { text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
@media (min-width: 901px) { .sidebar.collapsed .nav-art { display: none; } }   /* recolhida: só ícones, sem imagem */
@media (max-width: 900px) { .nav-art { height: 28%; } }                         /* celular: versão reduzida */
.art-preview { position: relative; height: 372px; width: 240px; max-width: 100%; border-radius: var(--radius); border: 1px solid var(--line);
  overflow: hidden; display: flex; flex-direction: column; gap: 6px; padding: 14px; }
.art-preview .side-nav { flex: 1; pointer-events: none; }

/* Sistema > Notificações: tipos de alerta do Telegram */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }

/* Cadastro de câmera em abas e agenda das IAs */
.tab.has-error { color: var(--danger, #ef4444); border-color: var(--danger, #ef4444); }
.cam-form .derived { margin-left: 1.6rem; }
.sched-box summary { cursor: pointer; }
.sched-box[open] summary { margin-bottom: 8px; }
.sched-quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sched-grid { display: grid; gap: 6px; }
.sched-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; align-items: center; }
.sched-ranges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sched-range { display: inline-flex; gap: 4px; align-items: center; }
.sched-range input[type=time] { width: 7.2em; }
@media (max-width: 720px) { .sched-row { grid-template-columns: 1fr; } }

/* Permissões, chamados e versões */
.perm-matrix td.center, .perm-matrix th.center { text-align: center; }
.perm-matrix .group-row th { text-align: left; background: var(--surface-2, rgba(127,127,127,.08)); }
.perm-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 14px; }
.perm-pick .perm-mod { grid-column: 1 / -1; margin-top: 6px; }
.ticket-snap img, img.ticket-snap { max-width: 100%; max-height: 260px; border-radius: 8px; }
.ticket-history { margin: 0; padding-left: 1.1rem; }
tr.clickable { cursor: pointer; }
tr.row-err td { background: rgba(239, 68, 68, .08); }
tr.row-warn td { background: rgba(245, 158, 11, .08); }
.sched .sched-quick input[type=time], .sched .sched-range input[type=time] { width: 8.5em; flex: none; }

/* Tipo de acesso do grupo (administradores) */
.tag.access-publico { background: rgba(59,130,246,.15); color: #3b82f6; }
.tag.access-privado { background: rgba(168,85,247,.15); color: #a855f7; }
.map-pin.acc-privado { outline: 3px solid #a855f7; outline-offset: 1px; }
.map-pin.acc-publico { outline: 3px solid #3b82f6; outline-offset: 1px; }
.map-pin .acc-badge { position: absolute; right: -6px; top: -6px; font-style: normal; font-size: 11px; line-height: 16px;
  min-width: 16px; text-align: center; border-radius: 8px; background: #111827; color: #fff; }
.map-pin.group { position: relative; }

/* ---------------- Marca Vórtice IA Monitoring ---------------- */
/* A logo oficial é só uma <img> (componente BrandLogo, brand.js): altura por variante, largura automática, proporção
   preservada (object-fit: contain). Nunca recebe filtro, sombra, brilho, contorno nem recorte. Só existe a versão de
   fundo branco (decisão de 2026-10-28), em qualquer tema: o próprio <img> é o contêiner branco discreto (fundo #fff,
   padding pequeno, cantos arredondados, sem sombra). A altura inclui o padding (border-box). */
:root { --brand-logo-xs: 34px; --brand-logo-sm: 92px; --brand-logo-md: 120px; --brand-logo-lg: 168px; }
.brand-logo { display: block; box-sizing: border-box; width: auto; max-width: 100%; height: var(--brand-logo-md); object-fit: contain;
  background: #fff; padding: 4px; border-radius: var(--radius-sm); }
.brand-logo--xs { height: var(--brand-logo-xs); width: var(--brand-logo-xs); padding: 2px; }   /* símbolo: quadrado */
.brand-logo--sm { height: var(--brand-logo-sm); }
.brand-logo--md { height: var(--brand-logo-md); }
.brand-logo--lg { height: var(--brand-logo-lg); }
.auth-brand { display: flex; justify-content: center; max-width: 100%; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 520px), (max-height: 720px) {
  .auth { gap: 14px; padding-top: 14px; }
  .brand-logo--lg { height: 112px; }
}
/* Indicador de carregamento neutro (não imita a marca) */
.spinner { display: inline-block; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-2);
  border-top-color: var(--primary); animation: spinner-turn .8s linear infinite; }
@keyframes spinner-turn { to { transform: rotate(360deg); } }
.boot p { margin: 0; }
.boot { display: grid; place-items: center; gap: 12px; }
/* Brilho só nos destaques (logo, item ativo e alertas importantes) */
.chip.err.urgent, .alert-urgent { box-shadow: 0 0 0 1px rgba(255,92,108,.35), 0 0 18px rgba(255,92,108,.25); }

/* Abertura animada (pré-login, intro.js): sobreposição; a sequência usa --intro-d (duração em ms, definida pelo JS) */
.intro { --intro-d: 3000ms; --intro-exit: 300ms; position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  cursor: pointer; overflow: hidden; color: #fff; padding: 16px;
  background: radial-gradient(620px 460px at 50% 46%, rgba(10,132,255,.14), transparent 72%), var(--brand-navy);
  transition: opacity var(--intro-exit) ease; }
.intro-net { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.intro-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 18px; }
/* Painel branco discreto com a logo oficial inteira (BrandLogo): sem filtro, sombra, brilho, máscara nem nada por cima.
   Entra por opacidade entre 60% e 75% da duração. */
.intro-panel { background: #fff; border-radius: var(--radius-sm); padding: 18px 22px; max-width: 86vw; opacity: 0;
  animation: i-fade-in calc(var(--intro-d) * .15) ease-out calc(var(--intro-d) * .6) forwards; }
.intro .brand-logo { display: block; width: min(330px, 70vw); height: auto; max-width: 100%; object-fit: contain; }
/* Estado real de /api/health; só aparece se respondeu a tempo */
.intro-status { margin: 0; min-height: 1.2em; font-size: .78rem; letter-spacing: .02em; color: #8FA3C0; opacity: 0;
  transition: opacity .3s ease; }
.intro-status.on { opacity: 0; animation: i-fade-in .3s ease-out calc(var(--intro-d) * .7) forwards; }
.intro-status.ok::before, .intro-status.err::before { content: ""; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; margin-right: 8px; vertical-align: middle; background: var(--brand-cyan); }
.intro-status.err::before { background: #FF5C6C; }
.intro-skip { position: absolute; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); background: transparent;
  border: 1px solid rgba(143,163,192,.35); border-radius: var(--radius-sm); color: #8FA3C0; font: inherit;
  font-size: .78rem; padding: 6px 12px; cursor: pointer; }
.intro-skip:hover { color: #fff; border-color: rgba(143,163,192,.7); }
.intro-skip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.intro.leaving { opacity: 0; pointer-events: none; }
.intro.skip * { animation-duration: .01s !important; animation-delay: 0s !important; }
@keyframes i-fade-in { from { opacity: 0; } to { opacity: 1; } }
/* Movimento reduzido: só a logo com fade curto, nada se move (sem Canvas) */
.intro.reduced .intro-panel, .intro.reduced .intro-status.on { animation: none; opacity: 1; }
.intro.reduced { animation: i-fade-in .2s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .btn, .intro { transition: none; }
}

/* Guia da marca */
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.bg-grid.icons { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.bg-grid.logos { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.bg-tile { margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 18px 12px;
  border-radius: var(--radius); border: 1px solid var(--line); min-height: 150px; text-align: center; }
.bg-tile.dark { background: var(--brand-navy); color: #C9D6EA; }
.bg-tile.light { background: #F2F5FA; color: #22344F; }
.bg-tile.auto { background: var(--bg); color: var(--fg-2); }
.bg-tile img:not(.brand-logo) { max-width: 100%; max-height: 90px; object-fit: contain; }
.bg-tile figcaption { font-size: var(--text-xs); }
.bg-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.bg-color { display: flex; align-items: center; gap: 10px; }
.bg-swatch { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-2); flex: none; }
.bg-sample { display: inline-grid; place-items: center; width: 44px; height: 28px; border-radius: 6px; font-weight: 700; }
.bg-font { margin: 0; font-size: 1.05rem; }
.bg-font.ui { font-family: var(--font-ui); }
.bg-font.mono { font-family: var(--font-mono); }
.bg-nav { max-width: 320px; flex: none; }
.bg-hash { word-break: break-all; font-size: var(--text-xs); }

/* Kanban de ocorrências: ferramenta de trabalho do operador (Tarefas 04 e 04.1) */
/* Modo compacto do shell (só a rota do Kanban): barra fina de uma linha e a área útil toda para as colunas */
.shell.kb-mode { height: 100vh; height: 100dvh; grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.shell.kb-mode .main { height: 100%; min-height: 0; }
.shell.kb-mode .content { flex: 1; min-height: 0; padding: var(--space-2); display: flex; flex-direction: column; }
.topbar.topbar-compact { height: 44px; padding: 0 var(--space-2); gap: var(--space-3); flex: none; }
.topbar-title { margin: 0; font-size: var(--text-md); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-slot { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.topbar-compact .avatar { width: 30px; height: 30px; font-size: var(--text-xs); }
.topbar-compact .user-meta { display: none; }
.topbar-compact .user-chip { padding: 2px; }
.kb-controls { display: flex; align-items: center; gap: var(--space-3); }
.kb-live { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.kb-live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--neutral); }
.kb-live.on { color: var(--ok-fg); }
.kb-live.on .kb-live-dot { background: var(--ok); }
.kb-live.off { color: var(--warn-fg); }
.kb-live.off .kb-live-dot { background: var(--warn); }
.kb-fs-btn .icon { width: 16px; height: 16px; }
.kb-fs-btn { display: inline-flex; align-items: center; gap: 6px; }
.kb-fs-btn[hidden] { display: none; }
/* Tela cheia: sem barra lateral nem barra do topo; ficam num canto (rodapé) o indicador, o botão de sair e o sino */
.kb-fullscreen .shell.kb-mode { grid-template-columns: 1fr; }
.kb-fullscreen .shell.kb-mode > .sidebar { display: none; }
.kb-fullscreen .shell.kb-mode .content { padding-bottom: 44px; }
.kb-fullscreen .shell.kb-mode .topbar { position: fixed; top: auto; bottom: var(--space-1); right: var(--space-2); height: 36px;
  padding: 0 var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-pill); }
.kb-fullscreen .shell.kb-mode .topbar-title, .kb-fullscreen .shell.kb-mode .menu-btn,
.kb-fullscreen .shell.kb-mode .user-menu-wrap { display: none; }
.kb-fullscreen .shell.kb-mode .topbar-slot { margin-left: 0; }

.kb-page { display: flex; flex-direction: column; gap: var(--space-2); flex: 1; min-height: 0; }
.kb-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.kb-bar h1 { margin: 0; font-size: var(--text-md); }
.kb-notice { margin: 0; }
.kb-notice[hidden] { display: none; }
.kb-board { flex: 1; min-height: 360px; display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr));
  grid-template-rows: minmax(0, 1fr); gap: var(--space-2); overflow-x: auto; overflow-y: hidden; }
.kb-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); border: 1px solid var(--line);
  border-top: 3px solid var(--line-2); border-radius: var(--radius); padding: var(--space-2); gap: var(--space-2); }
.kb-nova { border-top-color: var(--primary); }
.kb-em_analise { border-top-color: var(--warn); }
.kb-despachado { border-top-color: var(--ok); }
.kb-descartado { border-top-color: var(--neutral); }
.kb-col-head { display: flex; align-items: center; gap: var(--space-2); padding: 2px 4px; flex: none; }
.kb-col-head h2 { flex: 1; font-size: var(--text-lg); margin: 0; }
.kb-col-icon { width: 24px; height: 24px; flex: none; }
.kb-nova .kb-col-icon { color: var(--primary-text); }
.kb-em_analise .kb-col-icon { color: var(--warn); }
.kb-despachado .kb-col-icon { color: var(--ok); }
.kb-descartado .kb-col-icon { color: var(--muted); }
.kb-count { min-width: 34px; text-align: center; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--panel-2);
  color: var(--fg-strong); font-size: var(--text-lg); font-weight: 700; }
.kb-cards { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--space-2); overflow-y: auto; }
.kb-empty { color: var(--muted); font-size: var(--text-sm); text-align: center; padding: var(--space-3); }
.kb-card { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; background: var(--bg-2); border: 1px solid var(--line-2);
  border-left: 4px solid var(--line-2); border-radius: 10px; cursor: pointer; text-align: left; flex: none; }
.kb-card.kb-sev-alta { border-left-color: var(--err); }
.kb-card.kb-sev-media { border-left-color: var(--warn); }
.kb-card:hover { border-color: var(--focus); }
.kb-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.kb-card-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kb-card-where { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--space-2); font-size: var(--text-sm); overflow-wrap: anywhere; }
.kb-card .icon { width: 12px; height: 12px; vertical-align: -1px; margin-right: 3px; }
.kb-card-times { display: flex; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); }
.kb-elapsed { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kb-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.kb-cam { font-weight: 600; }
/* Cartão que acaba de chegar: destaque por alguns segundos (sem movimento se o usuário preferir) */
@keyframes kb-new-pulse { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 3px var(--focus); } }
.kb-card.kb-new { border-color: var(--focus); animation: kb-new-pulse 1.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .kb-card.kb-new { animation: none; box-shadow: 0 0 0 2px var(--focus); } }
.kb-map { height: 240px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.kb-nomap, .kb-nomedia { display: flex; align-items: center; gap: 8px; padding: 14px; color: var(--muted); background: var(--bg-2);
  border: 1px dashed var(--line-2); border-radius: 10px; font-size: .9rem; }
.kb-rule { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--bg-2); border-radius: 8px;
  border-left: 3px solid var(--accent); }
.kb-timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line-2); display: flex; flex-direction: column; gap: 10px; }
.kb-timeline li { display: flex; flex-direction: column; gap: 2px; position: relative; }
.kb-timeline li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); }
.kb-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kb-action-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.kb-action-row > input:first-child { flex: 1 1 220px; }
.kb-order { width: 80px; }
@media (max-width: 640px) { .kb-grid-2 { grid-template-columns: 1fr; } .kb-fs-btn span { display: none; } }

/* Tarefa 05: Treinamento IA (carrossel de revisão por execução de análise) */
.tr-filters { align-items: flex-end; }
.tr-filters .field { min-width: 150px; }
.tr-metrics .tag { font-weight: 500; }
.tr-card { padding: 16px; }
.tr-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 900px) { .tr-grid { grid-template-columns: 1fr; } }
.tr-evidence { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; }
/* Fase B: o quadro tem exatamente o tamanho da imagem (sem faixas pretas), então a caixa em % fica no lugar certo */
.tr-shots { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; width: 100%; }
.tr-frame { position: relative; display: inline-block; width: fit-content; max-width: 100%; line-height: 0; background: #000;
  border-radius: 8px; overflow: hidden; flex: 0 1 auto; }
.tr-photo { display: block; width: auto; height: auto; max-width: 100%; max-height: 62vh; user-select: none; }
.tr-box { position: absolute; border: 1px dashed rgba(255, 255, 255, .55); pointer-events: none; }
.tr-box.target { border: 2px solid var(--err); box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 0 0 200vmax rgba(0, 0, 0, .42); z-index: 1; }
.tr-box.plate { border: 2px solid var(--warn); z-index: 2; }
.tr-box-label { position: absolute; left: -2px; bottom: 100%; padding: 2px 6px; border-radius: 4px 4px 0 0; background: var(--err);
  color: #fff; font-size: .75rem; line-height: 1.3; white-space: nowrap; font-weight: 600; }
.tr-box-label.inside { bottom: auto; top: 0; border-radius: 0 0 4px 0; }   /* caixa colada no topo da imagem */
.tr-crop-box { display: flex; flex-direction: column; gap: 4px; margin: 0; flex: 0 0 auto; max-width: 100%; }
.tr-crop { max-height: 220px; max-width: min(100%, 320px); border-radius: 6px; background: #000; }
.tr-crop-css { position: relative; width: min(240px, 100%); max-height: 260px; overflow: hidden; border-radius: 6px; background: #000; }
.tr-crop-css img { position: absolute; max-width: none; }
.tr-tools { gap: 6px; }
.tr-claim { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin: 0 0 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); background: var(--surface-3); border-left: 3px solid var(--err); font-size: .95rem; }
.tr-claim strong { color: var(--fg-strong); }
.tr-claim.missing { border-left-color: var(--warn); }
.tr-sep { color: var(--muted); }
.tr-field.off { opacity: .5; }
.tr-field.tr-problem.active { border-color: var(--warn); box-shadow: inset 3px 0 0 var(--warn); }
.tr-zoom { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; background: rgba(2, 8, 18, .94); }
.tr-zoom-bar { padding: 10px 14px; gap: 10px; }
.tr-zoom-bar .tr-claim { margin: 0; flex: 1 1 auto; }
.tr-zoom-view { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: grab;
  touch-action: none; padding: 12px; }
.tr-zoom-view:active { cursor: grabbing; }
.tr-zoom-inner { transform-origin: center; max-width: 100%; max-height: 100%; }
.tr-zoom-inner .tr-photo { max-height: calc(100vh - 110px); }
.tr-result { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: .9rem; }
.tr-result dt { color: var(--muted); }
.tr-result dd { margin: 0; color: var(--fg-strong); }
.tr-result .mono, .tr-ai.mono, .tr-plate-input { letter-spacing: .04em; }
.tr-field { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.tr-field.active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.tr-q { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.tr-ai { color: var(--muted); font-size: .85rem; }
.tr-plate-input { font-size: 1.3rem; width: 11ch; text-transform: uppercase; }
.tr-noform { border: 1px dashed var(--line-2); border-radius: 8px; }
.tr-save { color: var(--muted); }
.tr-save.good { color: var(--ok-fg); }
.tr-save.bad { color: var(--err-fg); font-weight: 600; }
/* Tarefa 05.1 (Fase A): botão "Iniciar treinamento", painel suspenso, sessão e resumo */
.tr-top { align-items: flex-start; }
.tr-start { position: relative; }
.tr-start-btn { padding: 10px 18px; font-size: 1rem; box-shadow: var(--glow-primary); }
.tr-count { min-width: 1.8em; padding: 1px 8px; border-radius: var(--radius-pill); background: rgba(4, 16, 31, .28);
  font-size: .82rem; font-variant-numeric: tabular-nums; }
.tr-pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: min(520px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow-2); transform-origin: top left;
  opacity: 0; transform: scale(.94) translateY(-6px); transition: opacity .22s ease, transform .22s cubic-bezier(.2, .8, .2, 1); }
.tr-pop.open { opacity: 1; transform: none; }
.tr-pop[hidden] { display: none; }
.tr-mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tr-mod { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px; font: inherit; text-align: left;
  color: var(--fg); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); cursor: pointer; }
.tr-mod .icon { width: 20px; height: 20px; color: var(--primary-text); }
.tr-mod-name { font-weight: 600; font-size: .9rem; }
.tr-mod:hover:not(:disabled) { background: var(--hover); }
.tr-mod[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tr-mod:disabled { opacity: .45; cursor: default; }
.tr-mod:focus-visible, .tr-pop .seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tr-switch { gap: 10px; cursor: pointer; }
.tr-switch input { width: 18px; height: 18px; accent-color: var(--primary); }
.tr-disabled { border: 1px dashed var(--line-2); border-radius: var(--radius-sm); }
.tr-session-head { padding: 12px 16px; gap: 8px; }
.tr-bar { height: 6px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.tr-bar-fill { display: block; height: 100%; width: 0; background: var(--grad-primary); transition: width .3s ease; }
.tr-summary { padding: 18px; }
.tr-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tr-summary-n { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-3); }
.tr-summary-n strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.tr-summary-n.ok strong { color: var(--ok-fg); }
.tr-summary-n.err strong { color: var(--err-fg); }
.tr-summary-n.warn strong { color: var(--warn-fg); }
@keyframes tr-in-next { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes tr-in-prev { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes tr-in-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes tr-fade { from { opacity: 0; } to { opacity: 1; } }
.tr-in-next { animation: tr-in-next .24s ease-out; }
.tr-in-prev { animation: tr-in-prev .24s ease-out; }
.tr-stage.tr-in-session { animation: tr-in-up .3s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .tr-pop { transform: none; transition: opacity .15s linear; }
  .tr-in-next, .tr-in-prev, .tr-stage.tr-in-session { animation: tr-fade .15s linear; }
  .tr-bar-fill { transition: none; }
}
@media (max-width: 760px) { .tr-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tr-summary-grid { grid-template-columns: 1fr; } }

/* Relatórios de ocorrências (Tarefa 04.1) */
.rep-kpis { display: flex; flex-wrap: wrap; gap: 18px 28px; padding: 14px; }
.rep-kpi { display: flex; flex-direction: column; gap: 2px; min-width: 140px; }
.rep-kpi strong { font-size: 1rem; color: var(--fg); }
.rep-page { max-width: none; }   /* tela larga: usa toda a largura disponível; em tela estreita a tabela rola dentro do cartão */
.rep-table th, .rep-table td { padding: 8px 10px; text-align: left; vertical-align: middle; white-space: nowrap; }
.rep-table th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.rep-row { cursor: pointer; }
.rep-row:hover, .rep-row:focus-visible { background: var(--hover); outline: none; }

/* Treinamento IA > Dataset protegido (Tarefa 05.1, Fase C) */
.ds-queue { display: grid; gap: var(--space-3); }
.ds-item { display: grid; grid-template-columns: 160px 1fr; gap: var(--space-3); padding: var(--space-3);
  border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ds-thumb { width: 160px; max-height: 160px; object-fit: contain; background: var(--surface-3); border-radius: var(--radius-sm); }
.ds-votes { margin: 0; padding-left: 1.2em; }
.ds-votes .row { display: inline-flex; margin-left: var(--space-2); }
.ds-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); }
@media (max-width: 640px) { .ds-item { grid-template-columns: 1fr; } .ds-thumb { width: 100%; } }

/* Tarefa 07: vídeo-wall em monitor auxiliar */
.wall-away { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; min-height: 220px; }

/* Softphone (Tarefa 11, Fase C): indicador do ramal no topo e painel flutuante (popover: fica acima da tela cheia) */
.phone-ind { position: relative; color: var(--muted); }
.phone-ind.in-call { color: var(--ok); }
.phone-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral);
  box-shadow: 0 0 0 2px var(--panel); flex: none; }
.phone-ind .phone-dot { position: absolute; right: 2px; bottom: 3px; }
.phone-dot.ok { background: var(--ok); }
.phone-dot.warn { background: var(--warn); }
.phone-dot.err { background: var(--err); }
.phone-panel { position: fixed; right: 16px; bottom: 16px; top: auto; left: auto; margin: 0; z-index: 90;
  width: min(330px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 10px; background: var(--panel); color: var(--fg);
  border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-2); font-size: var(--text-sm); }
.phone-panel[hidden] { display: none; }
/* Tarefa 11, Fase E: chamada recebida tocando */
.phone-panel.ringing { border-color: var(--ok); animation: phone-ring 1.6s ease-in-out infinite; }
@keyframes phone-ring { 0%, 100% { box-shadow: var(--shadow-2), 0 0 0 0 transparent; }
  50% { box-shadow: var(--shadow-2), 0 0 0 4px var(--ok); } }
@media (prefers-reduced-motion: reduce) { .phone-panel.ringing { animation: none; box-shadow: var(--shadow-2), 0 0 0 3px var(--ok); } }
.phone-ident { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; color: var(--fg-2); }
.phone-link { font-size: var(--text-xs, .75rem); }
.inbound-members { margin: 0; padding-left: 20px; }
.inbound-members li { justify-content: space-between; }
.inbound-people { margin: 0; padding-left: 18px; }
.field[hidden] { display: none; }
.phone-panel::backdrop { background: transparent; }
.phone-head { display: flex; align-items: center; gap: 8px; }
.phone-head-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.phone-head-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-head .icon-btn.active { background: var(--panel-2); }
.phone-body { display: flex; flex-direction: column; gap: 10px; }
.phone-favorites { border-top: 1px solid var(--line); padding-top: 10px; }
.phone-favorites > .stack { max-height: 180px; overflow-y: auto; }
.phone-dial-row { display: flex; gap: 6px; align-items: center; }
.phone-number { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 1.05rem; letter-spacing: .04em; }
.phone-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.phone-key { font: inherit; font-family: var(--font-mono); font-size: 1.05rem; font-weight: 650; padding: 8px 0;
  background: var(--bg-2); color: var(--fg); border: 1px solid var(--line-2); border-radius: var(--radius-sm); cursor: pointer; }
.phone-key:hover { background: var(--hover); }
.phone-key:focus-visible, .phone-ctl:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.phone-call-btn { width: 100%; }
.phone-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.phone-name { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-status { display: flex; justify-content: space-between; gap: 8px; color: var(--fg-2); }
.phone-status.em_chamada { color: var(--ok-fg); }
.phone-status.recebendo, .phone-status.chamando { color: var(--warn-fg); }
.phone-timer { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.phone-ctls { display: flex; gap: 6px; flex-wrap: wrap; }
.phone-ctl { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit;
  font-size: .68rem; padding: 6px 2px; background: var(--bg-2); color: var(--fg); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); cursor: pointer; }
.phone-ctl span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-ctl:hover:not(:disabled) { background: var(--hover); }
.phone-ctl:disabled { opacity: .45; cursor: default; }
.phone-ctl.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.phone-ctl.danger { background: var(--err); border-color: var(--err); color: #fff; }
.phone-ctl[data-ctl="answer"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.phone-settings { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.phone-settings select { width: 100%; }
.phone-error { display: flex; align-items: flex-start; gap: 6px; margin: 0; padding: 8px; border-radius: var(--radius-sm);
  background: var(--err-bg); color: var(--err-fg); }
.phone-error .icon-btn { color: inherit; padding: 2px; margin-left: auto; }
@media (max-width: 480px) { .phone-panel { right: 8px; bottom: 8px; width: calc(100vw - 16px); } }

/* Tarefa 11 (Fase D): telefones das pessoas, botão "Ligar" e contatos das organizações */
.call-btn { color: var(--ok-fg); padding: 4px; vertical-align: middle; }
.call-btn .icon { width: 16px; height: 16px; }
.call-btn:disabled { color: var(--fg-3, var(--fg-2)); opacity: .45; cursor: not-allowed; }
.call-btn:disabled:hover { background: transparent; }
.phone-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.phone-list li, .phone-main { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.phone-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.stack-tight { display: flex; flex-direction: column; gap: 2px; }
.phone-editor-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 6px; align-items: center; }
.phone-editor-row input[type=tel] { min-width: 0; }
.contact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.contact-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; display: flex;
  flex-direction: column; gap: 4px; }
.contact-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.contact-head .row-actions { margin-left: auto; }
.call-audio { display: block; width: 100%; max-width: 360px; margin-top: 6px; }
/* Tarefa 11 (Fase F): chamadas da ocorrência no detalhe e sons do PABX em Sistema > Telefonia */
.kb-calls { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.kb-calls .chip { font-size: inherit; }
.kb-voice-detail { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.kb-voice-detail p { margin: 0; }
.kb-voice-detail .stack { gap: 10px; }
.kb-voice-detail > .actions:empty { display: none; }
.kb-voice-detail > details { border-top: 1px solid var(--line); padding-top: 10px; }
.kb-voice-detail > details > div { padding-top: 10px; }
.phone-embedded { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel); font-size: var(--text-sm); }
.phone-embedded .phone-ctls { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); }
.phone-embedded .phone-ctl { min-height: 52px; padding: 7px 4px; }
.phone-embedded .phone-name { white-space: normal; overflow-wrap: anywhere; }
.phone-embedded .phone-head { flex-wrap: wrap; }
.phone-embedded .phone-ctl[data-ctl="return"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.kb-call-row { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kb-call-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.kb-voice-detail .kb-calls .row-actions { justify-content: flex-start; }
.tel-sound { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; display: flex;
  flex-direction: column; gap: 6px; }
@media (max-width: 480px) { .phone-editor-row { grid-template-columns: minmax(0, 1fr) auto; } }

/* Sistema > Telefonia, visão geral (Tarefa 11, Fase G) */
.tel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tel-ext { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border: 1px solid var(--line); border-radius: var(--radius); }
.tel-when { white-space: nowrap; }
@media (max-width: 900px) { .tel-grid { grid-template-columns: 1fr; } }

/* Visão geral administrativa: resumo e seis cartões alinhados, somente status. */
.admin-status { width: 100%; max-width: 1600px; margin-inline: auto; container-type: inline-size; }
.admin-status-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding-bottom: 6px; }
.admin-status-heading h1 { font-size: 1.5rem; letter-spacing: -.035em; }
.admin-status-eyebrow { margin: 0 0 6px; color: var(--muted); font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.admin-status-updated { margin: 0; max-width: 46ch; text-align: right; line-height: 1.65; }
.admin-status-layout { display: flex; flex-direction: column; gap: 20px; }
.admin-status-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; align-items: stretch; }
.admin-status-card, .admin-status-summary { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; }
.admin-status-card { display: flex; flex-direction: column; height: 334px; }
.admin-status-card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.admin-status-card-head h2 { font-size: .95rem; letter-spacing: -.015em; }
.admin-status-icon { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line-2);
  border-radius: 10px; background: var(--surface-2); color: var(--accent-2); flex: none; }
.admin-status-icon .icon { width: 17px; height: 17px; }
.admin-status-rows { flex: 1; min-height: 0; padding: 6px 20px 12px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.admin-status-rows:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
.admin-status-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px;
  min-height: 43px; padding-block: 10px; border-bottom: 1px solid var(--line); font-size: .8rem; }
.admin-status-row:last-child { border-bottom: 0; }
.admin-status-label { color: var(--fg-2); overflow-wrap: anywhere; line-height: 1.5; }
.admin-status .chip { font-size: .72rem; line-height: 1.4; font-weight: 600; border-radius: 6px; padding: 4px 7px;
  max-width: 156px; white-space: normal; text-align: right; background: var(--surface-2); color: var(--fg-2); }
.admin-status .chip.ok { background: var(--ok-bg); color: var(--ok-fg); }
.admin-status .chip.err { background: var(--err-bg); color: var(--err-fg); }
.admin-status .chip.warn { background: var(--warn-bg); color: var(--warn-fg); }
.admin-status-empty { display: grid; place-items: center; min-height: 140px; margin: 0; font-size: .82rem; }
.admin-status-summary { background: linear-gradient(120deg,var(--surface-2),var(--surface)); }
.admin-status-summary .admin-status-card-head { padding-block: 12px; }
.admin-status-summary .admin-status-rows { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); padding: 20px 0; overflow: visible; }
.admin-status-summary .admin-status-row { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  gap: 10px; padding: 0 24px; border-bottom: 0; border-right: 1px solid var(--line-2); }
.admin-status-summary .admin-status-row:last-child { border-right: 0; }
.admin-status-summary .chip { text-align: left; max-width: 100%; font-size: .87rem; }
.admin-status-summary .admin-status-row:nth-child(n+2) .chip { padding: 0; background: transparent; font-size: 1.5rem; line-height: 1.2; letter-spacing: -.035em; }
.admin-status-card:last-child .admin-status-rows:has(.admin-status-row) { display: grid; grid-template-rows: repeat(3,minmax(0,1fr)); }
.admin-status-card:last-child .admin-status-row .chip { padding: 0; background: transparent; font-size: 1.3rem; letter-spacing: -.025em; }
@container (min-width: 1000px) { .admin-status-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@container (max-width: 720px) {
  .admin-status-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .admin-status-updated { text-align: left; max-width: none; }
  .admin-status-summary .admin-status-rows { grid-template-columns: repeat(2,minmax(0,1fr)); row-gap: 24px; }
  .admin-status-summary .admin-status-row:nth-child(2) { border-right: 0; }
  .admin-status-card-head { padding-inline: 16px; }
  .admin-status-rows { padding-inline: 16px; }
  .admin-status-row { gap: 8px; }
  .admin-status .chip { max-width: 130px; }
}
@container (max-width: 520px) {
  .admin-status-grid { grid-template-columns: minmax(0,1fr); gap: 14px; }
  .admin-status-layout { gap: 14px; }
  .admin-status-summary .admin-status-row { padding-inline: 16px; }
}
/* Procedimentos da portaria, dentro do cartão existente. */
.operator-access-panel { max-height: min(760px,75dvh); overflow-y: auto; padding: 2px; }
.operator-access-panel .card { padding: 14px; }
.operator-access-panel h2 { font-size: 1rem; }
.operator-access-panel .operator-access-grid { gap: 14px; }
.operator-person-photo img { width: 110px; height: 140px; object-fit: contain; border-radius: 8px; }
.operator-person-thumbnail { width: 56px; height: 70px; object-fit: contain; border-radius: 6px; }
.condominium-mosaic-grid { display: grid; gap: 8px; min-width: 0; }
.condominium-mosaic-grid.layout-1 { grid-template-columns: minmax(0,1fr); }
.condominium-mosaic-grid.layout-4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
.condominium-mosaic-grid.layout-9 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.condominium-mosaic-grid.layout-16 { grid-template-columns: repeat(4,minmax(0,1fr)); }
.condominium-mosaic-tile { margin: 0; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.condominium-mosaic-tile video,.condominium-camera-off { width: 100%; aspect-ratio:16/9; max-height: 420px; object-fit: contain; background:#000; }
.condominium-camera-off { display: grid; place-items: center; color: var(--muted); font-size:.8rem; }
.condominium-mosaic-tile figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap:4px; padding:7px; font-size:.8rem; }
@media(max-width:650px){.condominium-mosaic-grid.layout-9,.condominium-mosaic-grid.layout-16 { grid-template-columns:repeat(2,minmax(0,1fr)); }}
.kb-voice-detail { font-family: var(--font, Inter, system-ui, sans-serif); }
.kb-voice-detail .portaria-workflow { gap: 18px; padding-top: 10px; }
.kb-voice-detail .portaria-controls { gap: 10px; }
.kb-voice-detail .portaria-operation-block,
.kb-voice-detail .portaria-step { padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 65%); gap: 10px; }
.kb-voice-detail .portaria-operation-block { border-top: 2px solid #20cbb5; }
.kb-voice-detail .portaria-step { min-height: 0; border-top: 2px solid #ad89ff; }
.kb-voice-detail .portaria-controls input,
.kb-voice-detail .portaria-controls select { min-height: 38px; padding: 8px 10px; font-size: .87rem; border-radius: 8px; }
.kb-voice-detail .portaria-controls label { font-size: .84rem; gap: 5px; }
.kb-voice-detail .portaria-controls .stack { gap: 10px; }
.kb-voice-detail .portaria-controls small { font-size: .78rem; }
.kb-voice-detail .phone-embedded { gap: 8px; padding: 10px; border-top: 2px solid #29cf80; border-radius: 12px; }
.kb-voice-detail .phone-embedded .phone-ctl { min-height: 46px; padding: 6px 3px; font-size: .75rem; border-radius: 9px; }
.kb-voice-detail .phone-embedded .phone-name { font-size: 1.04rem; letter-spacing: -.02em; }
.kb-voice-detail .phone-ctl[data-ctl="hold"] { background: #243750; }
.kb-voice-detail .phone-ctl[data-ctl="keypad"] { background: #292c50; }
.kb-voice-detail .phone-ctl[data-ctl="transfer"] { background: #143f4b; }
.kb-voice-detail .portaria-access-actions { min-height: 0; padding: 0 2px; gap: 8px; }
.kb-voice-detail .portaria-relay-button { min-width: 112px; min-height: 36px; border-radius: 9px; }
.portaria-section-title { display: flex; align-items: center; gap: 9px; font-size: .94rem; letter-spacing: -.015em; }
.portaria-section-mark { display: inline-grid; place-items: center; flex: 0 0 28px; height: 28px;
  border-radius: 8px; color: #d5bdff; background: #65429a55; font-size: 16px; }
.portaria-section-mark.camera { color: #70e9dd; background: #159c8e33; }
.kb-voice-detail .portaria-media { gap: 8px; padding: 10px; border: 1px solid var(--line); border-top: 2px solid #20cbb5; border-radius: 12px; }
.kb-voice-detail .portaria-person-registration { gap: 10px; grid-template-columns: minmax(0,1fr) 100px; }
.kb-voice-detail .portaria-person-photo { min-height: 130px; font-size: .78rem; }
.kb-voice-detail .portaria-person-photo img { height: 116px; }
.kb-voice-detail .portaria-capture-actions { gap: 4px; }
.kb-voice-detail .portaria-capture-actions > small { font-size: .75rem; }
.kb-voice-detail .portaria-photo-button { min-height: 36px; }
.kb-voice-detail .portaria-controls > small:empty { display: none; }
.operator-access-grid { display: grid; grid-template-columns: minmax(280px,.8fr) minmax(0,1.2fr); gap: 20px; align-items: start; }
.operator-access-resident { padding: 12px 0; border-bottom: 1px solid var(--line); }
.operator-access-resident:first-child { padding-top: 0; }
.operator-access-resident:last-child { border-bottom: 0; }
.operator-access-message, .operator-access-refresh { align-self: flex-start; }
@media(max-width:850px) { .operator-access-grid { grid-template-columns: minmax(0,1fr); } }
.portaria-workflow { border-top: 1px solid var(--line); padding-top: 12px; }
.modal.wide:has(.kb-voice-detail) { width: min(1540px, calc(100vw - 40px)); max-width: calc(100vw - 40px); }
.portaria-workflow { display: grid; grid-template-columns: minmax(320px, .8fr) minmax(0, 1.5fr); gap: 24px; align-items: start; }
.portaria-controls, .portaria-media { min-width: 0; }
.portaria-media { position: sticky; top: 0; }
.portaria-media h3, .portaria-controls h3 { margin: 0; }
.portaria-controls .row2 { gap: 10px; }
@media (max-width: 900px) {
  .portaria-workflow { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .portaria-media { position: static; }
  .modal.wide:has(.kb-voice-detail) { width: calc(100vw - 24px); max-width: calc(100vw - 24px); }
}
.portaria-resident { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.portaria-resident > small { flex-basis: 100%; }
.portaria-cameras { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.portaria-cameras video { width: 100%; aspect-ratio: 16 / 9; background: #000; object-fit: contain; border-radius: 6px; }
.portaria-camera-pick { display: grid; gap: 8px; max-height: 240px; overflow: auto; }
.modal:has(.kb-voice-detail) { height: min(980px, calc(100dvh - 24px)); overflow: hidden; }
.modal > form:has(.kb-voice-detail) { height: 100%; min-height: 0; }
.kb-detail-host { flex: 1; min-height: 0; }
.kb-detail-host .kb-voice-detail { height: 100%; min-height: 0; }
.kb-voice-detail .portaria-workflow { flex: 1; min-height: 0; overflow: hidden; }
.portaria-controls { height: 100%; overflow-y: auto; padding-right: 8px; scrollbar-gutter: stable; }
.portaria-media { height: 100%; min-height: 0; overflow: hidden; position: static; }
.portaria-media > small:empty { display: none; }
.portaria-media .portaria-cameras { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.portaria-primary-slot { flex: 1; min-height: 0; overflow: hidden; }
.portaria-primary-slot:empty, .portaria-additional-cameras:empty { display: none; }
.portaria-primary-slot .portaria-camera-primary { display: grid; grid-template-rows: auto minmax(0,1fr) auto auto; height: 100%; min-height: 0; }
.portaria-camera-primary { background: var(--panel); }
.portaria-additional-cameras { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px,200px);
  flex: 0 0 125px; max-height: 25%; gap: 10px; min-height: 0; overflow-x: auto; overflow-y: hidden; }
.portaria-additional-cameras .portaria-camera { min-height: 0; overflow: hidden; }
.portaria-additional-cameras video { min-height: 0; max-height: 80px; }
.portaria-step { min-height: 300px; }
.portaria-person-registration { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 14px; align-items: start; }
.portaria-person-photo { margin: 0; min-height: 160px; padding: 8px; border: 1px solid var(--line); border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; background: var(--panel); }
.portaria-person-photo img { width: 100%; height: 140px; object-fit: contain; border-radius: 6px; }
.portaria-access-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; min-height: 40px; }
.portaria-access-actions:empty { display: none; }
.portaria-access-actions > small { flex-basis: 100%; }
.portaria-relay-button { flex: 0 1 auto; min-width: 120px; max-width: 210px; white-space: normal; }
.portaria-camera-primary { width: 100%; min-width: 0; justify-self: stretch; }
.portaria-camera-primary video { width: 100%; height: 100%; min-height: 0; aspect-ratio: auto; object-fit: contain; }
.attendance-photo-crop { width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 270px);
  align-self: center; touch-action: none; cursor: crosshair; }
.portaria-capture-actions { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.portaria-photo-button { min-width: 180px; max-width: 240px; }
@media(max-width:520px) { .portaria-person-registration { grid-template-columns: minmax(0, 1fr); } .portaria-person-photo { width: 120px; } }
.kb-card-portaria { border-left-color: var(--accent); background: var(--panel); }
.modal.wide:has(.kb-review) { width: min(1000px, calc(100vw - 32px)); }
.kb-review-person { display: flex; gap: 16px; align-items: flex-start; min-width: 0; }
.kb-review-person-photo { width: 88px; height: 110px; flex: 0 0 88px; object-fit: contain; border-radius: 8px; background: #000; }
.kb-review-person .kv { flex: 1; min-width: 0; margin: 0; }
.kb-review-person dd { overflow-wrap: anywhere; }
.kb-review-camera { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.kb-review-camera summary { cursor: pointer; font-weight: 600; }
.kb-review-video-body:empty { display: none; }
.kb-review-camera[open] .kb-review-video-body { margin-top: 10px; }
.kb-review-video { width: 100%; max-height: min(50dvh, 420px); object-fit: contain; }
@media(max-width:520px) {
  .kb-review-person { gap: 10px; }
  .kb-review-person-photo { width: 64px; height: 80px; flex-basis: 64px; }
  .kb-review-person .kv { grid-template-columns: 1fr; }
}
@media(max-width:900px) {
  .kb-voice-detail .portaria-workflow { display: flex; flex-direction: column; overflow: hidden; }
  .portaria-media { order: -1; flex: 0 0 55%; width: 100%; }
  .portaria-controls { flex: 1; min-height: 0; height: auto; overflow-y: auto; width: 100%; }
  .portaria-additional-cameras { flex-basis: 80px; }
  .portaria-capture-actions > small { display: none; }
}

/* Cadastro de equipamento: campos dimensionados pelo conteúdo, sem alterar outros diálogos. */
.modal.wide:has(.equipment-form) { width: min(1040px, calc(100vw - 32px)); }
.equipment-form { display: grid; gap: 12px; }
.equipment-group { padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg-2); min-width: 0; }
.equipment-group h3 { margin: 0 0 10px; font-size: .95rem; color: var(--accent); }
.equipment-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; align-items: start; }
.equipment-fields > .field, .equipment-half { grid-column: span 2; }
.equipment-three { grid-column: span 3; }
.equipment-full { grid-column: 1 / -1; gap: 6px; }
.equipment-form .field { gap: 5px; margin: 0; min-width: 0; }
.equipment-form input:not([type=checkbox]), .equipment-form select { min-width: 0; width: 100%; padding: 8px 10px; min-height: 38px; font-size: .9rem; }
.equipment-form .check { font-size: .88rem; }
.equipment-form small { font-size: .78rem; line-height: 1.4; }
.equipment-form p { margin: 0; }
.equipment-form .stack { gap: 7px; }
.equipment-form .btn { min-height: 36px; padding: 7px 13px; font-size: .85rem; }
.equipment-test { display: flex; align-items: center; gap: 12px; }
.equipment-test .btn { flex: 0 0 auto; }
.equipment-test p { font-size: .82rem; line-height: 1.4; }
.equipment-toggle { align-self: center; }
.equipment-model-info { font-size: .8rem; line-height: 1.5; color: var(--muted); }
.equipment-model-info summary { cursor: pointer; }
@media (max-width: 760px) {
  .equipment-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .equipment-three { grid-column: 1 / -1; }
  .equipment-form .equipment-half { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .equipment-fields { grid-template-columns: minmax(0, 1fr); }
  .equipment-fields > * { grid-column: 1 / -1; }
  .equipment-test { align-items: flex-start; flex-direction: column; }
}

/* Inventário de comunicação: metadados restritos, sem sugerir liberação de firewall. */
.service-connections-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.service-connection { min-width: 0; gap: 9px; }
.service-connection h3, .service-connection p { margin: 0; }
.service-connection h3 { font-size: 1rem; }
.service-addresses { display: flex; gap: 5px 14px; flex-wrap: wrap; padding: 9px 11px; background: var(--bg-2); border-radius: 8px; font-size: .8rem; }
.service-connection code { white-space: normal; overflow-wrap: anywhere; font-size: .76rem; }
.service-connection td { font-size: .78rem; vertical-align: top; }
.service-connection td small { display: block; font-size: .69rem; margin-top: 3px; }
.service-connection th { font-size: .72rem; }
.service-connection summary { cursor: pointer; font-size: .85rem; font-weight: 600; margin-bottom: 8px; }
@media (max-width: 1200px) { .service-connections-grid { grid-template-columns: minmax(0, 1fr); } }

/* Controle de acesso: operações compactas, cores por finalidade e monitoramento em diálogo próprio. */
.modal.wide:has(.operator-access-panel) { width: min(1240px,calc(100vw - 32px)); }
.operator-access-workspace { gap: 12px; }
.operator-access-topbar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: linear-gradient(110deg,var(--surface-3),var(--surface)); }
.operator-access-topbar small,.operator-camera-shortcut small { display: block; margin-top: 3px; font-size: .78rem; }
.operator-access-emblem { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--info-fg); background: var(--info-bg); }
.operator-access-emblem svg,.operator-section-icon svg { width: 21px; height: 21px; }
.operator-access-status { margin: 0; font-size: .83rem; }
.operator-access-status:empty { display: none; }
.operator-access-workspace .operator-access-grid { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; }
.operator-access-tools { gap: 12px; }
.operator-section { border-top: 3px solid var(--section-color,var(--primary)); gap: 10px; }
.operator-section-location { --section-color: var(--primary-2); }
.operator-section-phone { --section-color: var(--ok); }
.operator-section-gates { --section-color: var(--warn); }
.operator-section-people { --section-color: var(--chart-3); }
.operator-section-heading { display: flex; align-items: center; gap: 8px; }
.operator-section-heading h2 { margin: 0; font-size: .94rem; }
.operator-section-icon { display: grid; place-items: center; padding: 6px; border-radius: 9px; color: var(--section-color,var(--primary-text)); background: var(--surface-3); }
.operator-access-workspace .field { gap: 5px; margin: 0; }
.operator-access-workspace input,.operator-access-workspace select { min-height: 39px; padding: 8px 10px; font-size: .87rem; }
.operator-access-workspace .btn { min-height: 35px; padding: 7px 11px; font-size: .8rem; }
.operator-access-interphones { display: grid; gap: 8px; max-height: 220px; overflow-y: auto; }
.operator-interphone { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.operator-interphone strong { font-size: .87rem; }
.operator-interphone small { display: block; margin-top: 3px; font-size: .75rem; }
.operator-interphone-call { display: inline-flex; align-items: center; gap: 6px; background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok); }
.operator-interphone-call svg { width: 16px; height: 16px; }
.operator-access-gates { display: flex; flex-wrap: wrap; gap: 8px; }
.operator-access-gates .portaria-relay-button { min-width: 135px; width: auto; }
.operator-camera-shortcut { display: flex; align-items: center; gap: 10px; border-left: 3px solid var(--primary); }
.operator-camera-shortcut strong { font-size: .87rem; }
.operator-access-resident { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.operator-access-resident p,.operator-section-people p { margin: 0; font-size: .85rem; line-height: 1.5; }
.condominium-mosaic-controller { display: contents; }
.condominium-mosaic-controller[hidden] { display: none; }
.modal.wide.condominium-camera-dialog { width: min(1700px,calc(100vw - 32px)); height: min(940px,92dvh); max-height: 92dvh; padding: 18px; }
.condominium-camera-content { height: 100%; min-height: 0; gap: 10px; }
.condominium-camera-content h3,.condominium-camera-content p { margin: 0; }
.condominium-camera-content .condominium-mosaic-grid { flex: 1; min-height: 0; overflow-y: auto; align-content: start; }
.condominium-camera-content .layout-1 video { max-height: calc(92dvh - 200px); }
.condominium-camera-content .layout-4 video { max-height: calc((92dvh - 230px)/2); }
.condominium-camera-content .layout-9 video { max-height: calc((92dvh - 250px)/3); }
.condominium-camera-content .layout-16 video { max-height: calc((92dvh - 270px)/4); }
@media(max-width:850px) { .operator-access-workspace .operator-access-grid { grid-template-columns: minmax(0,1fr); } }
@media(max-width:540px) { .operator-access-topbar { flex-wrap: wrap; } .operator-camera-shortcut { flex-wrap: wrap; } .operator-phone-state { margin-left: 54px; } }

.operator-camera-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Softphone: abas de pasta e diretório compacto, separado do discador. */
.phone-panel { width:min(370px,calc(100vw - 32px)); }
.phone-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; border-bottom:1px solid var(--line-2); padding-top:3px; }
.phone-tab { display:flex; align-items:center; justify-content:center; gap:5px; padding:10px 5px; color:var(--fg-2); background:var(--bg-2); border:1px solid var(--line); border-bottom:0; border-radius:9px 9px 0 0; font:inherit; font-weight:650; cursor:pointer; }
.phone-tab svg { width:16px; height:16px; }
.phone-tab.active { color:var(--fg); background:var(--panel-2); box-shadow:inset 0 3px var(--accent); }
.phone-tab:disabled { opacity:.45; cursor:default; }
.phone-tab-live { width:7px; height:7px; border-radius:50%; background:var(--ok); flex:none; }
.phone-tab-content { min-width:0; }
.phone-tab-content > .phone-favorites { border-top:0; padding-top:0; }
.phone-directory { display:flex; flex-direction:column; gap:14px; }
.phone-directory-section { display:flex; flex-direction:column; gap:8px; min-width:0; }
.phone-directory-section + .phone-directory-section { border-top:1px solid var(--line); padding-top:12px; }
.phone-directory-section p { margin:0; }
.phone-directory-section p:empty { display:none; }
.phone-directory-list { display:flex; flex-direction:column; gap:6px; max-height:230px; overflow-y:auto; }
.phone-directory-person { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:10px; text-align:left; background:var(--bg-2); color:var(--fg); border:1px solid var(--line-2); border-radius:9px; font:inherit; cursor:pointer; }
.phone-directory-person > span:first-child { display:flex; flex-direction:column; gap:3px; min-width:0; overflow-wrap:anywhere; }
.phone-directory-person:disabled { opacity:.5; cursor:default; }
.phone-directory-call { color:var(--ok); font-weight:650; font-size:.8rem; }

/* Quadro do vídeo acompanha a proporção horizontal, sem barras causadas por altura artificial. */
.portaria-primary-slot .portaria-camera-primary { display:flex; flex-direction:column; justify-content:center; gap:8px; }
.portaria-primary-slot .portaria-camera-primary .portaria-video-frame { flex:1; min-height:0; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.portaria-primary-slot .portaria-camera-primary video { flex:none; width:auto; height:auto; max-width:100%; max-height:100%; aspect-ratio:auto; object-fit:contain; }
.portaria-additional-cameras .portaria-video-frame { min-height:0; overflow:hidden; }
.portaria-primary-slot .portaria-camera-primary > strong, .portaria-primary-slot .portaria-camera-primary > small,
.portaria-primary-slot .portaria-camera-primary > .portaria-capture-actions { flex:none; }

/* A coluna rola; seus blocos não podem encolher e sobrepor mensagens/cadastro. */
.portaria-controls > * { flex-shrink: 0; }
.portaria-controls > small:not(:empty) { display:block; line-height:1.4; overflow-wrap:anywhere; }
.portaria-access-actions > small { line-height:1.4; overflow-wrap:anywhere; }

/* Mapa em diálogo, mantendo o Kanban e o atendimento montados ao fundo. */
.modal.wide:has(.attendance-map-dialog) { width:min(1600px,calc(100vw - 32px)); height:min(900px,calc(100dvh - 32px)); max-height:calc(100dvh - 32px); }
.modal:has(.attendance-map-dialog) > form { height:100%; min-height:0; }
.attendance-map-dialog { flex:1; min-height:0; min-width:0; overflow:hidden; }
.attendance-map-dialog .map-embed { height:100%; min-height:0; }
.attendance-map-dialog .map-wrap.embedded { flex:1; min-height:0; height:auto; }
.attendance-map-dialog .map-view { min-height:0; height:100%; }

.resident-sync-bar { width:100%; height:9px; accent-color:var(--accent); }
.resident-sync-list { display:flex; flex-direction:column; gap:8px; max-height:45dvh; overflow:auto; }
.resident-sync-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px; border:1px solid var(--line); border-radius:9px; }
.resident-sync-row strong { min-width:0; overflow-wrap:anywhere; }

/* Controles dentro do diálogo: o softphone externo fica inerte enquanto o modal está aberto. */
.operator-access-call-control{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 14px;border:1px solid var(--line);border-left:3px solid #25ce8a;border-radius:10px;background:var(--panel);position:sticky;top:0;z-index:2}
.operator-access-call-control[hidden]{display:none}
.operator-access-call-control>span{min-width:0;overflow-wrap:anywhere}
.operator-access-call-control>button{flex-shrink:0}
