/* 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: 14px/1.5 var(--font-ui); font-feature-settings: "cv11", "ss01"; }
h1 { font-size: var(--text-xl); line-height: 1.25; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.mono, code, kbd, .kpi-value, .plate-badge, .plate { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
h2 { font-size: var(--text-lg); line-height: 1.3; margin: 0; font-weight: 600; }
h3 { font-size: var(--text-md); margin: 0; color: var(--muted); font-weight: 600; }
a { color: var(--accent-2); }
.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }
.boot { padding: 32px; text-align: center; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.icon { width: 18px; height: 18px; 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); box-shadow: var(--shadow-1); }
.card { padding: var(--space-5); }

/* ---------- Formulários (reforma visual, fase 0) ----------
   Altura fixa (--ctl-h) em campos, selects e botões, para ficarem alinhados lado a lado. Largura pelo conteúdo: cada
   tipo tem um máximo e as classes w-xs..w-xl escolhem outro; nenhum campo ocupa a largura toda de um cartão largo. */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-weight: 600; font-size: var(--text-sm); color: var(--fg-2); }
.field small { color: var(--muted); font-size: var(--text-xs); }
input, select, textarea { font: inherit; font-size: var(--text-md); color: inherit; background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 0 var(--ctl-pad); width: 100%;
  min-height: var(--ctl-h); transition: border-color .12s, box-shadow .12s; }
input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"]), select:not([multiple]) { height: var(--ctl-h); }
textarea { resize: vertical; padding: 8px var(--ctl-pad); line-height: 1.5; min-height: 80px; }
select[multiple] { padding: 4px; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; background: var(--surface-3); }
@media (hover: hover) and (pointer: fine) {
  input:hover:not(:disabled, :focus), select:hover:not(:disabled, :focus), textarea:hover:not(:disabled, :focus) { border-color: var(--primary); }
}
.field > input:is([type="number"], [type="time"]) { max-width: 160px; }
.field > input:is([type="date"], [type="month"]) { max-width: var(--w-sm); }
.field > input[type="datetime-local"] { max-width: 240px; }
.field > input:is([type="tel"]) { max-width: var(--w-sm); }
.field > select:not([multiple]) { max-width: var(--w-md); }
.field > input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="color"])) { max-width: var(--w-lg); }   /* :where: perde para as regras acima */
.field > textarea { max-width: var(--w-xl); }
/* Larguras escolhidas pela tela (valem para input, select, textarea e .field inteiro) */
.w-xs, .field > .w-xs { max-width: var(--w-xs) !important; } .w-sm, .field > .w-sm { max-width: var(--w-sm) !important; }
.w-md, .field > .w-md { max-width: var(--w-md) !important; } .w-lg, .field > .w-lg { max-width: var(--w-lg) !important; }
.w-xl, .field > .w-xl { max-width: var(--w-xl) !important; } .w-full, .field > .w-full { max-width: none !important; }
/* Grade de formulário: 2 a 3 colunas conforme a largura, no lugar de uma coluna longa */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: var(--space-3) var(--space-4); align-items: start; }
.form-grid > .span-all { grid-column: 1 / -1; }
/* Ocupam a linha inteira sozinhos: texto longo, campo largo, grupos de opções, avisos e sub-blocos */
.form-grid > :is(.field:has(> textarea, > .w-xl, > .w-full, > select[multiple]), .stack, fieldset, .check-grid, p, small,
  .row, .actions, strong, h3) { grid-column: 1 / -1; }
.form-grid .field > :is(input, select) { max-width: none; }
/* Seletor de cor: amostra do tamanho de um campo */
input[type="color"] { height: var(--ctl-h); width: 64px; padding: 3px; cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 4px; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 4px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: var(--ring); }
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; min-height: var(--ctl-h-sm); }
.check input, input:is([type="checkbox"], [type="radio"]) { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--primary); flex: none; }
.form-error { color: var(--err); margin: 0; }
/* Fase 4 (formulários e cadastros): botão solto numa coluna (.stack) fica do tamanho do texto, não da largura toda;
   numa linha com campos, o botão alinha pela base do campo (mesma altura --ctl-h). */
:where(.stack) > .btn, :where(.stack) > a.btn { align-self: flex-start; }
.auth :where(.stack) > .btn { align-self: stretch; }   /* telas de entrada (fase 1): o botão do cartão continua largo */
.row:has(> .field) { align-items: flex-end; }
.row2, .row3 { align-items: start; }
.form-grid > .check, .row2 > .check, .row3 > .check { align-self: end; min-height: var(--ctl-h); }
/* Dica (dom.js infoTip): ícone "i" ao lado do rótulo ou do título; o texto abre num cartão (popover) no meio da tela */
.field-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.field-head > label { font-weight: 600; font-size: var(--text-sm); color: var(--fg-2); }
.tip-wrap { display: inline-flex; vertical-align: middle; margin-inline-start: 6px; }
.field-head .tip-wrap { margin: 0; }
.info-tip { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; flex: none; cursor: help;
  border: 1px solid var(--line-2); border-radius: 50%; background: var(--surface); color: var(--muted);
  font: italic 700 11px/1 Georgia, "Times New Roman", serif; transition: color .12s ease, border-color .12s ease; }
.info-tip:hover, .info-tip:focus-visible { color: var(--primary-text); border-color: var(--primary); }
.tip-pop { max-width: min(380px, calc(100vw - 32px)); margin: auto; padding: 12px 14px; border: 1px solid var(--line-2);
  border-radius: var(--radius); background: var(--surface-2); color: var(--fg); box-shadow: var(--shadow-2);
  font: 400 var(--text-sm)/1.5 var(--font-ui); letter-spacing: 0; text-transform: none; white-space: normal; text-align: left; }
.tip-pop::backdrop { background: transparent; }

/* ---------- Botões: um só conjunto ----------
   .btn (sem tamanho)  ação principal: azul sólido, texto branco (diálogos e formulários têm um só).
   .btn.small / .sm    ação de linha ou de painel: azul suave, sem borda, 30 px.
   .btn.ghost          secundária: fundo da superfície com contorno.  .btn.danger: exclusão/irreversível.
   .btn.primary        força o azul sólido também no tamanho pequeno.
   Altura fixa, ícone de 16 px, pressionar encolhe 3% (sem animação de entrada; o operador clica o dia todo). */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: var(--text-md);
  font-weight: 600; line-height: 1; white-space: nowrap; height: var(--ctl-h); padding: 0 14px; min-width: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--primary); color: var(--on-primary);
  cursor: pointer; text-decoration: none; flex: none; user-select: none;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease, transform .16s cubic-bezier(.23, 1, .32, 1); }
.btn:hover { background: var(--primary-2); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:is(.small, .sm) { height: var(--ctl-h-sm); padding: 0 var(--ctl-pad-sm); font-size: var(--text-sm);
  background: var(--primary-soft); color: var(--primary-soft-fg); }
.btn:is(.small, .sm):hover { background: var(--hover); color: var(--fg-strong); }
.btn:is(.small, .sm).primary { background: var(--primary); color: var(--on-primary); }
.btn:is(.small, .sm).primary:hover { background: var(--primary-2); }
.btn.ghost { background: var(--surface); color: var(--fg-2); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--fg-strong); border-color: var(--primary); }
.btn.danger { background: var(--err); border-color: var(--err); color: var(--on-err); }
.btn.danger:hover { filter: brightness(.92); }
.btn.danger.ghost, .btn.ghost.danger { background: var(--surface); color: var(--err); border-color: var(--line-2); }
.btn.danger.ghost:hover, .btn.ghost.danger:hover { background: var(--err-bg); color: var(--err-fg); border-color: var(--err); }
.btn:is(.small, .sm).danger:not(.ghost) { background: var(--err-bg); color: var(--err-fg); border-color: transparent; }
.btn:is(.small, .sm).danger:not(.ghost):hover { background: var(--err); color: var(--on-err); }
.btn:disabled { opacity: .5; cursor: default; }
.btn .icon { width: 16px; height: 16px; }
.btn:is(.small, .sm) .icon { width: 15px; height: 15px; }
.icon-btn { display: inline-grid; place-items: center; width: var(--ctl-h-sm); height: var(--ctl-h-sm); padding: 0; flex: none;
  background: transparent; color: var(--fg-2); border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
  transition: background-color .12s ease, color .12s ease; }
.icon-btn:hover { background: var(--hover); color: var(--fg-strong); }
.actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; }
.input-icon { display: flex; align-items: center; gap: 8px; height: var(--ctl-h); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 0 10px; color: var(--muted); }
.input-icon input { border: 0; background: transparent; padding: 0; height: 100%; min-height: 0; box-shadow: none; }
.input-icon input:focus { outline: none; box-shadow: none; }
.input-icon:focus-within { border-color: var(--focus); box-shadow: var(--ring); }

/* Login e primeiro acesso */
/* Telas sem login: a logo oficial (BrandLogo lg), com a área livre em volta (o fundo vivo não passa 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); }
/* O login fica sempre no visual escuro da marca, com o fundo animado (decisão do responsável, 27/11/2026), mesmo
   com o sistema no tema claro: redefine as cores só dentro da tela de entrada. */
.auth { color-scheme: dark; --bg: #050B16; --surface: #0E1D33; --surface-2: #11223C; --surface-3: #18304F; --hover: #1C3A60;
  --line: #22406A; --line-2: #2E5283; --fg: #F4F8FF; --fg-2: #CCD9EE; --muted: #A3B6D2; --placeholder: #8095B5;
  --fg-strong: #FFFFFF; --primary: #2272E4; --primary-2: #1659BD; --primary-text: #7CBDFF; --on-primary: #FFFFFF;
  --focus: #4CC3FF; --primary-soft: #1B3A66; --primary-soft-fg: #CFE5FF; --ring: 0 0 0 3px rgba(76, 195, 255, .3);
  --ok: #2FD27A; --ok-bg: #0F4029; --ok-fg: #9AF5C6; --warn: #FFB547; --warn-bg: #45300B; --warn-fg: #FFDB9A;
  --err: #FF6B7A; --err-bg: #4E1822; --err-fg: #FFB3BB; --info: #29D3FF; --info-bg: #0A3550; --info-fg: #A3ECFF;
  --shadow-2: 0 10px 40px rgba(0, 0, 0, .45); color: var(--fg); }
/* Fundo vivo (login-bg.js): atrás do conteúdo, sem receber cliques */
.auth > :not(.auth-net) { position: relative; z-index: 1; }
.auth-net { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; animation: m-fade-in 1.2s ease-out; }
.auth .card { width: 100%; max-width: 440px; background: var(--surface-2); }
/* Fase 1 (referência do responsável): cartão translúcido sobre o fundo animado, borda azul sutil, brilho em volta e
   um filete de luz no meio da borda de baixo; título "Entrar" grande, rótulos claros, campos com ícone e o botão
   Entrar contornado em ciano na largura do cartão. */
.auth .auth-card { position: relative; padding: 28px 28px 30px; border-radius: 18px; border: 1px solid rgba(76, 195, 255, .26);
  background: rgba(14, 29, 51, .62); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(124, 189, 255, .08), 0 0 44px rgba(10, 132, 255, .16), 0 24px 60px rgba(0, 0, 0, .5); }
.auth-card::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--brand-glow), transparent); box-shadow: 0 0 14px 1px rgba(41, 211, 255, .4);
  pointer-events: none; }
.auth-card > h1 { font-size: var(--text-2xl); font-weight: 700; color: var(--fg-strong); }
.auth-card .field > label { color: var(--fg); font-size: var(--text-md); font-weight: 600; }
.auth-card input:not([type="checkbox"], [type="radio"]) { height: var(--ctl-h-lg); border-radius: var(--radius);
  background: rgba(24, 48, 79, .6); border-color: rgba(163, 182, 210, .34); font-size: var(--text-lg); }
.auth-card input:not([type="checkbox"], [type="radio"]):focus { border-color: var(--focus); }
.auth-input { position: relative; }
.auth-input > input { padding-left: 44px; }
.auth-input.has-trailing > input { padding-right: 48px; }
.auth-input-icon { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%);
  color: var(--fg-2); pointer-events: none; }
.auth-reveal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center;
  width: 36px; height: 34px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--fg-2);
  cursor: pointer; transition: color var(--m-out, 120ms) ease-out, background-color var(--m-out, 120ms) ease-out; }
.auth-reveal .icon { width: 20px; height: 20px; }
.auth-reveal:hover { color: var(--fg-strong); background: var(--hover); }
.auth-reveal[aria-pressed="true"] { color: var(--focus); }
.auth-card :where(form) > .btn[type="submit"] { height: var(--ctl-h-lg); margin-top: 6px; border: 1.5px solid var(--brand-cyan);
  border-radius: var(--radius); color: var(--auth-cta-fg); font-size: var(--text-lg); font-weight: 700; letter-spacing: .01em;
  background: linear-gradient(180deg, rgba(0, 194, 255, .14), rgba(0, 194, 255, 0) 75%), var(--auth-cta-bg);
  box-shadow: 0 0 18px rgba(0, 194, 255, .3), inset 0 0 14px rgba(0, 194, 255, .12); }
.auth-card :where(form) > .btn[type="submit"]:hover { background: var(--auth-cta-hover);
  box-shadow: 0 0 26px rgba(0, 194, 255, .46), inset 0 0 16px rgba(0, 194, 255, .18); }
.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(--sb-line); isolation: isolate;
  color: var(--sb-fg);
  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: 2px; flex: 1; overflow-y: auto; }
.side-nav a, .nav-group-head, .side-logout { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px;
  border-radius: var(--radius-sm); color: var(--sb-fg); text-decoration: none; font: inherit; font-size: var(--text-md);
  background: none; border: 0; cursor: pointer; text-align: left; transition: background-color .12s ease, color .12s ease; }
.side-nav a:hover, .nav-group-head:hover, .side-logout:hover { background: var(--sb-hover); color: var(--sb-fg-strong); }
.side-nav a.active { background: var(--sb-active-bg); color: var(--sb-active-fg); font-weight: 600; box-shadow: var(--shadow-1); }
/* Ícone de cada grupo do menu num quadrado com a cor do grupo (desenhos da Lucide em icons.js). O degradê vai da cor
   clara (--t1) para a escura (--t2); o traço é branco em todos. Cores fixas: iguais nos dois temas, sobre o menu azul. */
.nav-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; flex: none; color: #fff;
  background: linear-gradient(145deg, var(--t1, #60A5FA), var(--t2, #2563EB));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), 0 1px 3px rgba(4, 16, 40, .28); }
.nav-ico .icon { width: 16px; height: 16px; stroke-width: 2; }
.nav-ico[data-tone="blue"] { --t1: #7DB7FF; --t2: #2563EB; }
.nav-ico[data-tone="sky"] { --t1: #38BDF8; --t2: #0369A1; }
.nav-ico[data-tone="cyan"] { --t1: #22D3EE; --t2: #0E7490; }
.nav-ico[data-tone="teal"] { --t1: #2DD4BF; --t2: #0F766E; }
.nav-ico[data-tone="green"] { --t1: #4ADE80; --t2: #15803D; }
.nav-ico[data-tone="amber"] { --t1: #FBBF24; --t2: #B45309; }
.nav-ico[data-tone="orange"] { --t1: #FB923C; --t2: #C2410C; }
.nav-ico[data-tone="red"] { --t1: #F87171; --t2: #B91C1C; }
.nav-ico[data-tone="pink"] { --t1: #F472B6; --t2: #BE185D; }
.nav-ico[data-tone="violet"] { --t1: #A78BFA; --t2: #6D28D9; }
.nav-ico[data-tone="indigo"] { --t1: #818CF8; --t2: #4338CA; }
.nav-ico[data-tone="slate"] { --t1: #A3B3C9; --t2: #475569; }
.main { min-width: 0; display: flex; flex-direction: column; }
/* Barra do topo (reforma visual, fase 2): 56 px, uma linha, tudo na altura dos controles (--ctl-h); sem texto de ajuda */
.topbar { display: flex; align-items: center; gap: var(--space-3); height: 56px; padding: 0 var(--space-5); 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: var(--text-lg); font-weight: 650; color: var(--fg-strong); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.greeting span { color: var(--muted); font-size: var(--text-sm); }
.top-search { width: min(360px, 32vw); }
.topbar:not(.topbar-compact) > .icon-btn { width: var(--ctl-h); height: var(--ctl-h); }   /* sino e menu na altura da busca */
.bell { color: var(--fg-2); }
.user-chip { display: flex; align-items: center; gap: var(--space-2); height: var(--ctl-h-lg); padding: 0 var(--space-2) 0 4px;
  text-decoration: none; color: var(--fg); border-radius: var(--radius); }
.user-chip:hover { background: var(--hover); }
.user-chip[aria-expanded="true"] { background: var(--hover); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: var(--text-xs);
  border: 2px solid var(--ok); color: var(--ok-fg); background: var(--ok-bg); flex: none; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; max-width: 180px; }
.user-meta strong { font-size: var(--text-md); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--muted); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.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: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); 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: var(--text-md); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; font-size: var(--text-xs); font-weight: 600;
  line-height: 1; padding: 0 8px; border-radius: var(--radius-sm); background: var(--panel-2); color: var(--fg-2);
  white-space: nowrap; flex-shrink: 0; vertical-align: middle; }
.chip .icon { width: 13px; height: 13px; }
.chip.lpr, .chip.ok { background: var(--ok-bg); color: var(--ok-fg); }
.chip.intrusion { background: var(--violet-bg); color: var(--violet-fg); }
.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: var(--on-err); }
.seg { display: inline-flex; gap: 2px; flex-wrap: wrap; padding: 2px; border-radius: calc(var(--radius-sm) + 2px);
  background: var(--surface-3); border: 1px solid var(--line); }
.seg button { font: inherit; font-size: var(--text-sm); font-weight: 550; height: calc(var(--ctl-h-sm) - 2px); padding: 0 12px;
  background: transparent; color: var(--fg-2); border: 0; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
  transition: background-color .12s ease, color .12s ease; }
.seg button:hover:not(.active, :disabled) { color: var(--fg-strong); background: var(--hover); }
.seg button.active { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-1); }
.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: var(--space-3); padding: var(--space-4); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.kpi-icon { width: 42px; height: 42px; border-radius: var(--radius); display: grid; place-items: center; color: #fff; flex: none; }
.kpi-icon .icon { width: 22px; height: 22px; }
.kpi-icon.blue { background: var(--accent); } .kpi-icon.green { background: var(--ok); } .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: var(--text-sm); }
.kpi-value { font-size: var(--text-2xl); line-height: 1.2; }
.kpi-sub { color: var(--muted); font-size: var(--text-xs); }
.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; }
/* Painéis estreitos da visão geral (coluna de ~250px): os 7 horários não cabem lado a lado e a legenda da rosca
   espremia o texto em 3 linhas. A largura do próprio painel decide (container query), não a da tela. */
.ops-bottom > .panel { container-type: inline-size; }
@container (max-width: 300px) {
  .timeline-axis span:nth-child(even) { display: none; }
  .donut-wrap { flex-direction: column; align-items: stretch; gap: 12px; }
  .donut { align-self: center; width: 104px; height: 104px; }
}
.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: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: var(--text-md); }
th { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--panel-2); white-space: nowrap; }
tbody tr { transition: background-color .12s ease; }
@media (hover: hover) and (pointer: fine) { tbody tr:hover { background: var(--surface-3); } }
tr:last-child td { border-bottom: 0; }
.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); }
.record-actions { display: flex; justify-content: flex-end; }
.admin-app .record-actions > .btn, .record-actions > .btn { min-width: 96px; white-space: nowrap; }
.user-menu.record-action-menu { margin: 0; right: auto; bottom: auto; width: max-content;
  min-width: min(220px, calc(100vw - 16px)); max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px); overflow-y: auto; }
.record-action-menu:not(:popover-open) { display: none; }
.admin-app .record-actions .record-action-menu > .btn, .record-actions .record-action-menu > .btn { width: 100%; margin: 0; white-space: normal; height: auto; min-height: var(--ctl-h-sm); padding-block: 6px; justify-content: flex-start;
  min-height: 36px; padding: 9px 12px; border: 0; background: none; text-align: left; }
.admin-app .record-actions .record-action-menu > .btn:hover, .record-actions .record-action-menu > .btn:hover { background: var(--panel-2); }
.record-action-menu > :disabled { opacity: .5; cursor: not-allowed; }
.admin-app table td:has(> .record-actions) { width: 1%; vertical-align: middle; }
.users-table .users-actions-cell { width: 1%; white-space: nowrap; vertical-align: middle; }
.users-table td:nth-child(4) { overflow-wrap: anywhere; }
.users-action-menu { min-width: min(220px, calc(100vw - 16px)); max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px); overflow-y: auto; }
.menu-sep { height: 1px; margin: 4px 0; background: var(--line); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); font-weight: 600; line-height: 1.35; padding: 2px 8px;
  border-radius: var(--radius-sm); margin: 0 4px 4px 0; background: var(--surface-3); color: var(--fg-2); }
/* Estado nunca só pela cor (fase 5): o rótulo é o texto e o marcador redondo repete o tom */
.tag:is(.ok, .warn, .err, .info)::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
p.tag { width: fit-content; max-width: 100%; }
.tag.info { background: var(--info-bg); color: var(--info-fg); }
.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); }
/* Configurações > Alarme > Transmitters: código de pareamento mostrado uma vez */
.pairing-code strong { font-size: 1.6rem; letter-spacing: .12em; font-family: var(--font-mono, monospace); user-select: all; }
.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; font-size: var(--text-md); background: none; border: 0; height: var(--ctl-h); padding: 0 14px; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .12s ease; }
.tab:hover { color: var(--fg-strong); }
.tab.active { color: var(--primary-text); border-bottom-color: var(--primary); 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: var(--video-bg); border-radius: var(--radius); 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: var(--video-bg); }
/* Legenda sobre o vídeo (fase 5): faixa escura em degradê, texto branco com sombra leve; nome primeiro, controles à direita */
.tile figcaption { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 6px; min-width: 0;
  padding: 6px 8px 16px; color: var(--video-fg); font-size: var(--text-sm); font-weight: 600; line-height: 1.2;
  background: linear-gradient(var(--video-scrim), transparent); text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.tile .name { flex: 1 1 auto; min-width: 3ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .badge { flex: none; font-size: var(--text-xs); font-weight: 500; color: var(--video-muted); white-space: nowrap; }
.tile[data-state="offline"]::after { content: "Sem vídeo"; position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--video-muted); font-size: var(--text-sm); }
.tile.empty-slot { background: var(--video-bg); border: 1px dashed var(--video-line); }
.tile:fullscreen { border-radius: 0; aspect-ratio: auto; }
.tile .icon-btn { flex: none; width: 26px; height: 24px; color: var(--video-fg); background: var(--video-chip); text-shadow: none; }
.tile .icon-btn:hover { background: var(--video-scrim); color: var(--video-fg); }
/* Sincronia de cada câmera: seletor pequeno e escuro na legenda (a regra geral de select é 100% e 36 px) */
.tile figcaption select { flex: 0 0 auto; width: auto; max-width: 9.5rem; height: 24px; min-height: 0; padding: 0 4px;
  font-size: var(--text-xs); font-weight: 500; color: var(--video-fg); background: var(--video-chip); border-color: var(--video-line);
  text-shadow: none; }
.tile figcaption select option { color: var(--fg); background: var(--surface); }
/* Com mouse, o seletor só aparece ao passar sobre o quadro ou com o foco nele (no toque fica sempre visível) */
@media (hover: hover) and (pointer: fine) {
  .tile:not(:hover, :focus-within) figcaption select { opacity: 0; }
}
.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); border-radius: var(--radius); padding: var(--space-3) var(--space-4); 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); border-radius: var(--radius-lg); background: var(--panel); color: var(--fg);
  padding: var(--space-5); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto;
  box-shadow: var(--shadow-2); }
.modal::backdrop { background: var(--scrim); }
.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; }
/* Aviso no canto (fase 2): cartão do tema com faixa da cor do aviso; erro e atenção com o fundo e o texto da cor */
.toast { position: fixed; right: var(--space-4); bottom: var(--space-4); z-index: 100; width: auto; height: auto;
  max-width: min(420px, calc(100vw - 32px)); min-height: 44px; padding: 11px 16px 11px 14px; border: 1px solid var(--line);
  border-inline-start: 4px solid var(--primary); border-radius: var(--radius); background: var(--surface-2); color: var(--fg);
  box-shadow: var(--shadow-2); font-size: var(--text-md); line-height: 1.45; top: auto; left: auto; margin: 0; overflow: visible; }
.toast.ok { border-inline-start-color: var(--ok); }
.toast.info { border-inline-start-color: var(--info); }
.toast.err { background: var(--err-bg); color: var(--err-fg); border-color: var(--err); }
.toast.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn); }
@media (max-width: 600px) { .toast { left: var(--space-3); right: var(--space-3); bottom: var(--space-3); max-width: none; } }
/* 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: var(--on-err); 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: var(--cyan-bg); color: var(--cyan-fg); }
.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: min(280px, 86vw); z-index: 50; transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(.23, 1, .32, 1); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-2); }
  .side-collapse { display: none; }   /* recolher só existe com a tela larga */
  .menu-btn { display: inline-grid; }
  .topbar { height: 52px; padding: 0 var(--space-3); gap: var(--space-2); }
  .top-search, .user-meta, .greeting span { display: none; }
  .user-chip { padding: 0 4px; }
  .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; }
  /* Fase 6: na linha em cartão, a célula das ações deixa a largura de 1% (o botão Ações saía pela esquerda) */
  .admin-app table td:has(> .record-actions) { width: auto; }
  .record-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 var(--line-2);
  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; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-left: auto; color: var(--fg-2); font-size: var(--text-xs); }
.map-legend > span { display: inline-flex; align-items: center; white-space: nowrap; }
.map-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; box-shadow: 0 0 0 1px var(--line-2); }
.lg.online { background: var(--pin-online); } .lg.offline { background: var(--pin-offline); } .lg.event { background: var(--pin-event); }
.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: var(--pin-ring); font-weight: 700;
  font-size: var(--text-sm); border: 3px solid var(--pin-ring); box-shadow: 0 2px 8px rgba(0,0,0,.6); background: var(--pin-unknown); 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: var(--pin-online); }
.map-pin.offline { background: var(--pin-offline); }
.map-pin.unknown { background: var(--pin-unknown); }
.map-pin.event { background: var(--pin-event); }
.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: var(--text-sm); font-variant-numeric: tabular-nums; }
.link-btn { background: none; border: 0; color: var(--accent-2); cursor: pointer; padding: 1px 0; font: inherit; text-align: left; }
.trail-line { stroke: var(--pin-trail); stroke-dasharray: 8 6; }
.trail-pt { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--pin-trail); color: #111;
  font-weight: 700; font-size: var(--text-xs); border: 2px solid var(--pin-ring); box-sizing: border-box; }
.trail-pt.last { background: var(--pin-event); color: var(--pin-ring); }
.pick-map { height: 320px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); }
.pick-pin { background: var(--primary); border: 3px solid var(--pin-ring); 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: var(--orange-bg); color: var(--orange-fg); }
.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: var(--shadow-2); 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: var(--video-bg); 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: 6px; align-items: center; opacity: 0;
  transition: opacity .2s; background: var(--glass); padding: 4px 6px 4px 10px; border-radius: var(--radius); box-shadow: var(--shadow-1); }
.videowall:hover .wall-bar, .wall-bar:focus-within { opacity: 1; }
.wall-start { position: absolute; inset: 0; margin: auto; width: max-content; max-width: calc(100% - 32px); height: max-content;
  padding: 14px 22px; font: inherit; font-size: var(--text-lg); font-weight: 600; color: var(--on-primary); background: var(--primary);
  border: 0; border-radius: var(--radius); box-shadow: var(--shadow-2); cursor: pointer; }
.wall-start:hover { background: var(--primary-2); }
.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: var(--on-err); background: var(--err); 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: var(--radius-sm); background: var(--video-bg); }
.tab-badge { margin-left: 6px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--err);
  color: var(--on-err); 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: 12px;
  background: var(--surface-2); color: var(--fg); border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2); overflow: hidden; box-sizing: border-box; }
.group-panel.sheet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 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: var(--text-lg); 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: var(--video-bg); }
.panel-tile video { width: 100%; height: 100%; object-fit: contain; background: var(--video-bg); }
.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(--video-muted); font-size: var(--text-xs); }
.panel-tile.no-signal { background: var(--video-nosignal); }
.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: var(--video-muted); font-size: var(--text-sm); }
.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: var(--on-primary); }

/* 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: var(--err-bg); 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; }
/* Filtros soltos numa linha flex (sem .field em volta): a regra geral width:100% esticava cada select/campo pela
   largura toda, um por linha (Chamados técnicos, barra do Ao vivo). Aqui ocupam o tamanho do conteúdo. */
:is(.row, .head-tools) > :is(select, input:not([type=checkbox]):not([type=radio]):not([type=range])) {
  width: auto; min-width: 160px; max-width: 100%; }

/* 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: var(--err); background: var(--err-bg); }
.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(--sb-fg-strong); background: var(--sb-hover); font-weight: 600; }
.nav-sub { display: none; flex-direction: column; gap: 1px; padding: 2px 0 6px 30px; }
.nav-group.open > .nav-sub { display: flex; }
.side-nav .nav-sub a { min-height: 32px; padding: 0 10px; font-size: var(--text-md); color: var(--sb-muted); }
.side-nav .nav-sub a:hover { color: var(--sb-fg-strong); }
.side-nav .nav-sub a.active { color: var(--sb-active-fg); }
.nav-fly-title { display: none; }
.side-foot { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--sb-line); padding-top: var(--space-2); }
.side-foot .side-logout { min-height: var(--ctl-h-sm); color: var(--sb-muted); font-size: var(--text-sm); }
.side-foot .side-logout:hover { color: var(--sb-fg-strong); }
.side-foot .side-logout > .icon { width: 18px; height: 18px; margin: 0 5px; }   /* 18 + 2 x 5 = 28 px, a largura do .nav-ico */
@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: 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: var(--radius);
    box-shadow: var(--shadow-2); z-index: 60; }
  /* o menu flutuante é um cartão claro: texto do tema, não o do menu azul */
  .sidebar.collapsed .nav-sub a { color: var(--fg-2); }
  .sidebar.collapsed .nav-sub a:hover { color: var(--fg-strong); background: var(--hover); }
  .sidebar.collapsed .nav-sub a.active { background: var(--primary); color: var(--on-primary); }
  .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: 220px; display: flex; flex-direction: column; gap: 2px;
  padding: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); z-index: 40; }
.user-menu-wrap > .user-menu { max-width: min(300px, calc(100vw - 16px)); }
.user-menu[hidden] { display: none; }
.user-menu-head { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu-head strong { font-size: var(--text-md); color: var(--fg-strong); overflow-wrap: anywhere; }
.user-menu-head small { font-size: var(--text-xs); color: var(--muted); }
.user-menu-item { display: flex; align-items: center; gap: 10px; min-height: var(--ctl-h); padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--fg-2); text-decoration: none; font: inherit; font-size: var(--text-md); background: none; border: 0; cursor: pointer; text-align: left; }
.user-menu-item:hover { background: var(--hover); color: var(--fg-strong); }
.user-menu-item .icon { width: 16px; height: 16px; color: var(--muted); }
.user-menu-item:hover .icon { color: currentColor; }

/* 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; }
/* Conversão proibida: entrada em âmbar, saída proibida em vermelho */
.pe-poly.area-turn_entry { fill: rgba(251,191,36,.16); stroke: #fbbf24; }
.pe-poly.area-turn_exit { fill: rgba(248,113,113,.18); stroke: #f87171; }
.pe-handle.handle-turn_entry { background: #fbbf24; } .pe-handle.handle-turn_exit { background: #f87171; }
.tab.tab-turn_entry.active { box-shadow: inset 0 -3px 0 #fbbf24; } .tab.tab-turn_exit.active { box-shadow: inset 0 -3px 0 #f87171; }

/* 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(--video-muted); font-size: var(--text-sm); }
.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(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow-2); }
.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: var(--warn); color: var(--warn-fg); background: var(--warn-bg); }
.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(--primary); background: var(--primary-soft); color: var(--primary-soft-fg); }
.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: var(--text-sm); }
.editor-cell-body input[type=text] { font-size: var(--text-sm); height: var(--ctl-h-sm); min-height: 0; padding: 0 8px; }
.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: var(--radius-sm); border: 0; background: none;
  color: var(--fg); font: inherit; font-size: var(--text-sm); 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 var(--pin-trail); }
@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: var(--warn); }
.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: var(--info-bg); color: var(--info-fg); }
.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 var(--pin-event); border-color: var(--pin-event); } }
@media (prefers-reduced-motion: reduce) { .tile.flash { animation: none; box-shadow: inset 0 0 0 4px var(--pin-event); } }
.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; overflow-y: hidden; scrollbar-width: thin; }
.infra-tabs .tab { white-space: nowrap; flex: none; margin-bottom: 0; }
.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: var(--err); background: var(--err-bg); color: var(--err-fg); }
.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: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.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: 11px; color: var(--muted); text-align: right;
  min-width: 48px; font-variant-numeric: tabular-nums; }
.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: var(--radius-sm); font-size: var(--text-xs);
  background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-1); pointer-events: none; font-variant-numeric: tabular-nums; }
.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; flex: none; padding: 1px 5px; border-radius: 4px; font-size: 11px; font-weight: 800; line-height: 1.2;
  letter-spacing: .04em; color: var(--video-fg); background: var(--video-rec); vertical-align: middle; text-shadow: none; }
.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: var(--ok); border-radius: 3px; opacity: .85; }
.rec-span.remote { background: repeating-linear-gradient(135deg, var(--ok) 0 4px, color-mix(in srgb, var(--ok) 35%, transparent) 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: var(--fg-strong); pointer-events: none; }
.rec-hover { position: absolute; top: 2px; transform: translateX(-50%); padding: 0 4px; border-radius: 4px; font-size: var(--text-xs); font-variant-numeric: tabular-nums;
  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: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.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: var(--video-bg); 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; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: var(--text-sm); font-weight: 600; padding: 2px 8px; border-radius: var(--radius-sm);
  color: var(--video-fg); background: var(--video-chip); }
.rec-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 0 16px; text-align: center; color: var(--video-muted); font-size: var(--text-md); }
.rec-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; }
.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); }
/* Sem sombra no texto do menu (a imagem do rodapé já tem a camada escura --art-dark); só um contorno leve no rodapé,
   que fica sobre a imagem. O submenu flutuante é um cartão claro e nunca tem sombra no texto. */
.sidebar.has-art .side-foot .side-logout, .sidebar.has-art .side-foot button { color: var(--sb-fg-strong); }
@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(--err); border-color: var(--err); }
.cam-form .derived { margin-left: 1.6rem; }
/* Canais do DVR/NVR: grade de caixas que se ajusta à largura (celular: duas colunas) */
.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px 12px; }
/* Câmeras do Digifort: uma por linha, nome inteiro, estado à direita, rolagem própria (centenas de câmeras) */
.digifort-head, .digifort-actions { flex-wrap: wrap; gap: 8px; }
.digifort-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 240px); gap: 8px; }
.digifort-filters[hidden], .digifort-filters select[hidden] { display: none; }
.digifort-filters:has(select[hidden]) { grid-template-columns: minmax(0, 1fr); }
.digifort-list { display: flex; flex-direction: column; max-height: min(52vh, 480px); overflow-y: auto; overflow-x: hidden;
  border: 1px solid var(--line-2); border-radius: 8px; }
.digifort-list:empty { display: none; }
.digifort-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--line-2);
  cursor: pointer; min-width: 0; }
.digifort-row:last-child { border-bottom: 0; }
.digifort-row:hover { background: var(--hover); }
.digifort-row[hidden] { display: none; }
.digifort-row input { flex: 0 0 auto; width: auto; margin: 0; }   /* a regra geral de input é 100% de largura */
.digifort-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.digifort-row .tag { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 640px) { .digifort-filters { grid-template-columns: minmax(0, 1fr); } }
.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-3); color: var(--fg-2); }
.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: color-mix(in srgb, var(--err) 9%, transparent); }
tr.row-warn td { background: color-mix(in srgb, var(--warn) 10%, transparent); }
.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: var(--primary-soft); color: var(--primary-soft-fg); }
.tag.access-privado { background: var(--violet-bg); color: var(--violet-fg); }
.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: 36px; --brand-logo-sm: 84px; --brand-logo-md: 96px; --brand-logo-lg: 150px; }
.brand-logo { display: block; box-sizing: border-box; width: auto; max-width: 100%; height: var(--brand-logo-md); object-fit: contain; }
/* símbolo: o ícone já vem num quadrado branco; só os cantos arredondados */
.brand-logo--xs { height: var(--brand-logo-xs); width: var(--brand-logo-xs); border-radius: 8px; }
.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%; padding-bottom: 16px; }
/* Brilho azul suave embaixo da logo (referência da fase 1): um filete de luz e um halo largo e fraco */
.auth-brand::before, .auth-brand::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none; }
.auth-brand::before { bottom: -10px; width: min(380px, 86vw); height: 24px; background: radial-gradient(closest-side, rgba(41, 211, 255, .24), rgba(41, 211, 255, 0)); }
.auth-brand::after { bottom: 1px; width: min(420px, 90vw); height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(41, 211, 255, 0), rgba(41, 211, 255, .85), rgba(41, 211, 255, 0)); }
.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; }
  .auth .auth-card { padding: 22px 18px 24px; }
}
/* 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-row-end { align-items: flex-end; }
.bg-nav { max-width: 320px; flex: none; padding: 10px; border-radius: var(--radius); background: linear-gradient(180deg, var(--sb-top), var(--sb-end)); }
.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; height: var(--ctl-h); }
.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); }
/* Cartão do quadro por tipo (reforma visual, fase 3). Faixa à esquerda e ícone com a cor do tipo (--kb-tone, os mesmos
   tons do menu); título em até duas linhas; miolo do tipo com a miniatura à direita; tempo de espera que muda de cor. */
.kb-card { --kb-tone: #64748B; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 10px 11px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--kb-tone); border-radius: var(--radius);
  box-shadow: var(--shadow-1); cursor: pointer; text-align: left; flex: none; min-width: 0;
  transition: border-color .12s ease, box-shadow .12s ease; }
@media (hover: hover) and (pointer: fine) { .kb-card:hover { border-color: var(--primary); border-left-color: var(--kb-tone); box-shadow: var(--shadow-2); } }
.kb-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.kb-card.kb-k-alarme_central, .kb-card.kb-k-placa_alerta { --kb-tone: #DC2626; }
.kb-card.kb-k-ligacao_voz { --kb-tone: #0D9488; }
.kb-card.kb-k-porta_aberta { --kb-tone: #D97706; }
.kb-card.kb-k-invasao_perimetro { --kb-tone: #7C3AED; }
.kb-card.kb-k-conversao_proibida, .kb-card.kb-k-veiculo_caracteristica { --kb-tone: #EA580C; }
.kb-card.kb-k-aparencia_caracteristica { --kb-tone: #DB2777; }
.kb-card.kb-k-rosto_reconhecido { --kb-tone: #0891B2; }
.kb-card.kb-k-registro_manual { --kb-tone: #2563EB; }
.kb-card > .kb-card-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 10px; }
.kb-card .kb-kind-ico { width: 30px; height: 30px; }
.kb-card .kb-kind-ico .icon { width: 17px; height: 17px; margin: 0; vertical-align: 0; }
.kb-title { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.kb-cam { font-weight: 650; font-size: var(--text-md); line-height: 1.3; color: var(--fg-strong);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.kb-kind { font-size: var(--text-xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-card-body { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.kb-body-text { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.kb-body-text:empty { display: none; }
.kb-line { display: flex; align-items: center; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
.kb-line.kb-main { font-size: var(--text-md); font-weight: 550; color: var(--fg); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kb-line.kb-sub { font-size: var(--text-sm); color: var(--muted); }
.kb-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.kb-facts:empty { display: none; }
.kb-plate { font-size: .82rem; padding: 2px 7px 3px; border-width: 2px; border-top-width: 5px; }
.kb-color { gap: 5px; }
.kb-color .sw { width: 10px; height: 10px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.kb-thumb { width: 96px; height: 60px; flex: none; object-fit: cover; border-radius: var(--radius-sm); background: #000;
  border: 1px solid var(--line); }
.kb-card .icon { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }
.kb-card-times { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--muted); }
.kb-where { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-elapsed { flex: none; font-weight: 650; font-size: var(--text-xs); font-variant-numeric: tabular-nums; white-space: nowrap;
  padding: 2px 8px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--fg-2); }
.kb-elapsed[data-age="1"] { background: var(--warn-bg); color: var(--warn-fg); }
.kb-elapsed[data-age="2"] { background: var(--err-bg); color: var(--err-fg); }
.kb-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px;
  padding-top: 8px; border-top: 1px solid var(--line); font-size: var(--text-sm); color: var(--fg-2); }
.kb-operator { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.kb-avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%;
  font-size: 10px; font-weight: 700; background: var(--primary-soft); color: var(--primary-soft-fg); }
.kb-card > .actions { justify-content: flex-start; }
/* 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: var(--radius); overflow: hidden; border: 1px solid var(--line); isolation: isolate; }
.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-timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); display: flex; flex-direction: column;
  gap: var(--space-3); }
/* Alarme: roteiro, contatos e tentativas no detalhe da ocorrência */
.alarm-steps, .alarm-contacts, .alarm-attempts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alarm-contacts > li { padding: 10px 12px; }
.alarm-step-text { flex: 1 1 260px; max-width: none; }
.alarm-attempts > li { padding-bottom: 8px; border-bottom: 1px solid var(--line-2); }
.kb-timeline li { display: flex; flex-direction: column; gap: 2px; position: relative; min-width: 0; }
.kb-timeline li::before { content: ""; position: absolute; left: -23px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--primary); }
.kb-timeline li:last-child::before { background: var(--primary); }
.kb-tl-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); min-width: 0; }
.kb-tl-top time { flex: none; font-size: var(--text-xs); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Detalhe da ocorrência (reforma visual, fase 3): cabeçalho na cor do tipo, com as ações à direita (o primeiro botão
   sólido é o principal), grade de informações e seções em cartão. No diálogo comum o cabeçalho fica preso no topo. */
.kb-detail { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.kb-detail .ev-detail { grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); gap: var(--space-4); }
.kb-detail-head { --kb-tone: var(--primary); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-left: 4px solid var(--kb-tone);
  border-radius: var(--radius); background: color-mix(in srgb, var(--kb-tone) 7%, var(--surface)); min-width: 0; }
.kb-detail-head:focus { outline: none; }
.kb-detail > .kb-detail-head { position: sticky; top: calc(-1 * var(--space-5)); z-index: 3; box-shadow: var(--shadow-1); }
.kb-detail-head:is(.kb-k-alarme_central, .kb-k-placa_alerta) { --kb-tone: var(--err); }
.kb-detail-head.kb-k-ligacao_voz { --kb-tone: var(--teal); }
.kb-detail-head.kb-k-porta_aberta { --kb-tone: var(--warn); }
.kb-detail-head.kb-k-invasao_perimetro { --kb-tone: var(--violet); }
.kb-detail-head:is(.kb-k-conversao_proibida, .kb-k-veiculo_caracteristica) { --kb-tone: var(--orange); }
.kb-detail-head.kb-k-aparencia_caracteristica { --kb-tone: var(--pink); }
.kb-detail-head.kb-k-rosto_reconhecido { --kb-tone: var(--cyan); }
.kb-detail-head:is(.kb-k-camera_offline, .kb-k-sistema) { --kb-tone: var(--neutral); }
.kb-detail-head .kb-kind-ico { width: 38px; height: 38px; border-radius: var(--radius); }
.kb-detail-head .kb-kind-ico .icon { width: 20px; height: 20px; }
.kb-detail-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kb-detail-title > strong { font-size: var(--text-lg); font-weight: 650; line-height: 1.3; color: var(--fg-strong); overflow-wrap: anywhere; }
.kb-detail-title > small { font-size: var(--text-sm); color: var(--fg-2); overflow-wrap: anywhere; }
.kb-detail-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.kb-detail-chips:empty { display: none; }
.kb-detail-actions { gap: var(--space-2); }
.kb-detail-actions:empty { display: none; }
.kb-detail-actions .btn { height: var(--ctl-h); padding: 0 var(--ctl-pad); font-size: var(--text-md); }
.kb-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.kb-info > div { min-width: 0; padding: 8px 12px; background: var(--surface); }
.kb-info > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
.kb-info dt { font-size: var(--text-xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kb-info dd { margin: 2px 0 0; font-size: var(--text-md); color: var(--fg); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kb-sec { gap: var(--space-2); min-width: 0; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); }
.kb-sec > h3 { font-size: var(--text-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kb-sec-lead { font-weight: 550; color: var(--fg); overflow-wrap: anywhere; }
.kb-sec .kv.compact { margin: 0; }
.kb-sec .kv.compact > :nth-last-child(-n + 2) { border-bottom: 0; }
.kb-detail .card { padding: var(--space-3); background: var(--surface); box-shadow: none; }
.kb-detail .ev-media-wrap { border-radius: var(--radius); }
@media (max-width: 900px) { .kb-detail .ev-detail { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .kb-detail-head { grid-template-columns: auto minmax(0, 1fr); padding: var(--space-3); }
  .kb-detail-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .kb-info { grid-template-columns: minmax(0, 1fr); }
  .kb-voice-detail .kb-detail-head { gap: var(--space-2); padding: var(--space-2) var(--space-3); }
  .kb-voice-detail .kb-detail-actions .btn { height: var(--ctl-h-sm); padding: 0 var(--ctl-pad-sm); font-size: var(--text-sm); }
}
.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: var(--on-err); 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: 12px 28px; padding: 12px 16px; }
.rep-kpi { display: flex; flex-direction: column; gap: 2px; min-width: 140px; }
.rep-kpi strong { font-size: var(--text-lg); color: var(--fg-strong); font-variant-numeric: tabular-nums; }
.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 12px; text-align: left; vertical-align: middle; white-space: nowrap; }
.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; flex-wrap: wrap; 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; min-height: var(--ctl-h-lg); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; font: inherit; font-size: var(--text-xs); font-weight: 600; padding: 4px 2px; background: var(--bg-2);
  color: var(--fg); border: 1px solid var(--line-2); border-radius: var(--radius-sm); cursor: pointer;
  transition: background-color .12s ease, transform .16s cubic-bezier(.23, 1, .32, 1); }
.phone-ctl:active:not(:disabled) { transform: scale(.97); }
.phone-ctl .icon { width: 16px; height: 16px; }
.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: var(--on-err); }
.phone-ctl[data-ctl="answer"] { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.phone-ctl:is(.danger, [data-ctl="answer"]):hover:not(:disabled) { filter: brightness(.94); }
.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 > 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 :is(.phone-name, .phone-num) { white-space: normal; overflow-wrap: anywhere; }
.phone-embedded .phone-ctl[data-ctl="return"] { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.phone-notes { width: min(440px, calc(100vw - 24px)); }
.phone-notes textarea { width: 100%; resize: vertical; }
.shift-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.operator-resident-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr)); gap: 6px; }
.operator-resident-actions .btn { justify-content: center; white-space: normal; text-align: center; height: auto; min-height: var(--ctl-h); padding-block: 6px; }
@media (min-width: 860px) {
  .phone-notes:has(> .phone-panel:not([hidden])) { margin-right: max(400px, calc(50vw - 40px)); }
}
@media (max-width: 859px) {
  .phone-notes:has(> .phone-panel:not([hidden])) { margin-top: 12px; }
  .phone-notes:has(> .phone-panel:not([hidden])) textarea { height: 20dvh; min-height: 4rem; }
}
.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; }
/* Fase 6: cabeçalho igual ao das outras páginas de configuração (tokens), ícones dos cartões na cor de cada área */
.admin-status-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-4);
  padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.admin-status-heading h1 { font-size: var(--text-xl); }
.admin-status-eyebrow { margin: 0 0 2px; color: var(--muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.admin-status-updated { margin: 0; max-width: 46ch; text-align: right; line-height: 1.5; }
.admin-status-layout { display: flex; flex-direction: column; gap: var(--space-4); }
.admin-status-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--space-4); 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: var(--space-3) var(--space-5); border-bottom: 1px solid var(--line); }
.admin-status-card-head h2 { font-size: var(--text-md); }
.admin-status-icon { display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary-soft-fg); flex: none; }
.admin-status-icon[data-tone="orange"] { background: var(--orange-bg); color: var(--orange-fg); }
.admin-status-icon[data-tone="cyan"] { background: var(--cyan-bg); color: var(--cyan-fg); }
.admin-status-icon[data-tone="green"] { background: var(--ok-bg); color: var(--ok-fg); }
.admin-status-icon[data-tone="violet"] { background: var(--violet-bg); color: var(--violet-fg); }
.admin-status-icon[data-tone="pink"] { background: var(--pink-bg); color: var(--pink-fg); }
.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: 40px; padding-block: 8px; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.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: var(--text-xs); line-height: 1.4; font-weight: 600; border-radius: var(--radius-sm); padding: 3px 8px;
  max-width: 156px; white-space: normal; text-align: right; background: var(--surface-3); 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: var(--text-sm); }
.admin-status-summary { background: 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: var(--text-sm); }
.admin-status-summary .admin-status-row:nth-child(n+2) .chip { padding: 0; background: transparent; font-size: var(--text-2xl); line-height: 1.2; }
.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: var(--text-xl); }
@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: var(--video-bg); }
.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)); }}
/* Ligação de portaria (reforma visual, fase 3): duas colunas (controles e câmeras), blocos em cartão do tema com a faixa
   de cor de cada assunto (operação ciano, telefone verde, pessoa violeta, câmeras ciano) e campos na altura dos tokens. */
.kb-voice-detail .portaria-workflow { gap: var(--space-4); padding-top: 0; border-top: 0; }
.kb-voice-detail .portaria-controls { gap: var(--space-3); }
.kb-voice-detail .portaria-operation-block,
.kb-voice-detail .portaria-step { gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); }
.kb-voice-detail .portaria-operation-block { border-top: 3px solid var(--cyan); }
.kb-voice-detail .portaria-step { min-height: 0; border-top: 3px solid var(--violet); }
.kb-voice-detail .portaria-controls .stack { gap: var(--space-3); }
.kb-voice-detail .portaria-controls small { font-size: var(--text-xs); }
.kb-voice-detail .portaria-controls .field > :is(input, select) { max-width: none; }
.kb-voice-detail .portaria-controls .stack > .btn { align-self: flex-start; }
.kb-voice-detail .phone-embedded { gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-top: 3px solid var(--ok);
  border-radius: var(--radius); background: var(--surface); }
.kb-voice-detail .phone-embedded .phone-name { font-size: var(--text-lg); font-weight: 650; }
.kb-voice-detail .phone-ctl[data-ctl="hold"] { background: var(--primary-soft); color: var(--primary-soft-fg); }
.kb-voice-detail .phone-ctl[data-ctl="keypad"] { background: var(--violet-bg); color: var(--violet-fg); }
.kb-voice-detail .phone-ctl[data-ctl="transfer"] { background: var(--cyan-bg); color: var(--cyan-fg); }
.kb-voice-detail .portaria-access-actions { min-height: 0; padding: 0; gap: var(--space-2); }
.kb-voice-detail .portaria-relay-button { min-width: 112px; height: auto; min-height: var(--ctl-h); padding-block: 4px; font-size: var(--text-md); }
.portaria-section-title { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-md); font-weight: 650; color: var(--fg); }
.portaria-section-mark { display: inline-grid; place-items: center; flex: 0 0 28px; height: 28px;
  border-radius: var(--radius-sm); color: var(--violet-fg); background: var(--violet-bg); }
.portaria-section-mark .icon { width: 16px; height: 16px; }
.portaria-section-mark.camera { color: var(--cyan-fg); background: var(--cyan-bg); }
.kb-voice-detail .portaria-media { gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-top: 3px solid var(--cyan);
  border-radius: var(--radius); background: var(--surface); }
.kb-voice-detail .portaria-person-registration { gap: var(--space-3); grid-template-columns: minmax(0,1fr) 100px; }
.kb-voice-detail .portaria-person-photo { min-height: 130px; font-size: var(--text-xs); }
.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: var(--text-xs); }
.kb-voice-detail .portaria-photo-button { height: var(--ctl-h); }
.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(340px, 5fr) minmax(0, 8fr); gap: var(--space-5); 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: var(--video-bg); 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-access-actions > .btn.portaria-fast-button {
  width: 100%;
  height: var(--ctl-h-lg);
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--on-primary);
  font-size: var(--text-md);
  font-weight: 700;
}
.portaria-fast-button::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  background: currentColor;
  clip-path: polygon(57% 0, 10% 57%, 44% 57%, 36% 100%, 90% 40%, 54% 40%);
}
.portaria-access-actions > .btn.portaria-fast-button:hover:not(:disabled) {
  background: var(--primary-2);
  color: var(--on-primary);
  border-color: var(--primary-2);
}
.portaria-access-actions > .btn.portaria-fast-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.portaria-access-actions > .btn.portaria-fast-button:disabled {
  background: var(--surface-3);
  border-color: var(--line-2);
  color: var(--muted);
  box-shadow: none;
  opacity: 1;
}
.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 { background: var(--surface); }
.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%; }   /* altura e fonte: as do tema (fase 4) */
.equipment-form small { line-height: 1.4; }
.equipment-form p { margin: 0; }
.equipment-form .stack { gap: 7px; }
.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: start; padding-top: 32px; }
.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; }
  .equipment-form .equipment-toggle { padding-top: 0; }
}
@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: var(--text-xs); }
.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: var(--text-sm); }
.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: var(--text-md); }
.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-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: var(--text-md); }
.operator-interphone small { display: block; margin-top: 3px; font-size: var(--text-xs); }
.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: var(--text-md); }
.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: var(--text-sm); 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-visual { display:flex; flex-direction:column; align-items:center; gap:18px; padding:22px 16px;
  border-radius:12px; background:var(--bg); border:1px solid var(--line); color:var(--info); }
.resident-sync-visual[hidden] { display:none; }
.resident-sync-ring { width:90px; height:90px; border-radius:50%;
  background:conic-gradient(from 0deg,transparent,var(--info));
  mask:repeating-conic-gradient(#000 0deg 6deg,transparent 6deg 10deg),radial-gradient(transparent 58%,#000 60%);
  mask-composite:intersect; animation:resident-sync-spin 1.3s linear infinite; }
.resident-sync-segments { width:min(100%,290px); display:flex; gap:4px; border:1px solid currentColor; border-radius:7px; padding:5px; }
.resident-sync-segments span { flex:1; height:20px; border-radius:3px; background:currentColor; opacity:.18;
  animation:resident-sync-pulse 1.4s ease-in-out infinite alternate; }
.resident-sync-segments span:nth-child(3n+1) { animation-delay:-.9s; }
.resident-sync-segments span:nth-child(3n+2) { animation-delay:-.45s; }
.resident-sync-caption { font-size:.92rem; font-weight:650; letter-spacing:.025em; }
@keyframes resident-sync-spin { to { transform:rotate(360deg); } }
@keyframes resident-sync-pulse { to { opacity:1; } }
@media(prefers-reduced-motion:reduce) {
  .resident-sync-ring,.resident-sync-segments span { animation:none; }
  .resident-sync-segments span { opacity:.6; }
}
.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; }
.collaborator-schedule-row { display:grid; grid-template-columns:minmax(110px,1fr) repeat(2,minmax(0,1fr)); gap:12px;
  align-items:center; padding:6px 0; border-bottom:1px solid var(--line); }
.collaborator-schedule-head { display:grid; grid-template-columns:minmax(110px,1fr) repeat(2,minmax(0,1fr)); gap:12px; color:var(--muted); }
.admin-app .modal .collaborator-schedule, .collaborator-schedule { gap:6px; }
.collaborator-schedule-row .field { min-width:0; }
.collaborator-schedule-row .field > label { font-size:.7rem; }
.collaborator-schedule-row .check { font-size:.86rem; }
@media(max-width:480px) { .collaborator-schedule-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .collaborator-schedule-head { display:none; }
 .collaborator-schedule-row > .check { grid-column:1/-1; } }

/* 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 var(--ok);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}

/* Resultado confirmado do comando; não representa sensor de porta aberta. */
.btn.portaria-relay-button.relay-success { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.btn.portaria-relay-button.relay-error { background: var(--err); border-color: var(--err); color: var(--on-err); }
/* Botão de chamada do interfone: verde suave (o conjunto único de botões fica no início do arquivo). */
.btn.operator-interphone-call { background:var(--ok-bg); color:var(--ok-fg); border-color:var(--ok); }
.btn.operator-interphone-call:hover { background:var(--ok-bg); color:var(--ok-fg); }
.operator-access-gates .portaria-relay-button:not(.relay-success):not(.relay-error) {
  background:var(--warn-bg); color:var(--warn-fg); border-color:var(--warn); }
.operator-unit-search { position:relative; min-width:0; }
.operator-unit-options { position:absolute; top:100%; left:0; right:0; z-index:8; display:flex; flex-direction:column;
  max-height:280px; overflow:auto; margin-top:5px; padding:6px; border:1px solid var(--line-2); border-radius:10px;
  background:var(--surface); box-shadow:var(--shadow-1); gap:4px; }
.operator-unit-options[hidden] { display:none; }
.operator-unit-option { display:flex; flex-direction:column; align-items:flex-start; gap:4px; border:1px solid transparent;
  border-radius:7px; padding:10px; text-align:left; background:transparent; color:var(--fg); font:inherit; cursor:pointer; }
.operator-unit-option:hover,.operator-unit-option:focus-visible { background:var(--info-bg); border-color:var(--primary); outline:none; }
.operator-unit-option strong { font-size:.85rem; overflow-wrap:anywhere; }
.operator-unit-option small { font-size:.75rem; }
.operator-unit-options > small { padding:10px; }

/* Relatório de acessos: filtros alinhados e tabela compacta, comum às duas entradas. */
/* Fase 5: período, campo, operador, pesquisa e o botão numa linha só (quebra quando falta espaço), alinhados pela base */
.access-report-filterbar{display:flex;flex-wrap:wrap;gap:12px 16px;align-items:flex-end}
.access-report-period,.access-report-filters{display:contents}
.access-report-filterbar>div>.field{flex:0 1 var(--w-sm);min-width:160px}
.access-report-filterbar>div>.field:has(input[type="datetime-local"]){flex-basis:220px}
.access-report-filterbar>div>.field:has(input[type="search"]){flex:1 1 var(--w-sm);max-width:var(--w-md)}
.access-report-filterbar>div>.field>:is(input,select){max-width:none}
.access-report-tabs{display:flex;flex-wrap:wrap;gap:8px}
.access-report-tabs [aria-pressed="true"]{border-color:var(--primary);background:var(--primary-soft);color:var(--primary-soft-fg)}
.access-report-table{overflow:auto;border:1px solid var(--line);border-radius:var(--radius)}
.access-report-table table{width:100%;min-width:1050px;border-collapse:collapse}
.access-report-table th,.access-report-table td{padding:8px 12px;text-align:left;vertical-align:middle;border-bottom:1px solid var(--line);font-size:var(--text-md)}
.access-report-table th{background:var(--surface-3);color:var(--muted);font-size:var(--text-xs);font-weight:600;text-transform:uppercase;letter-spacing:.05em;white-space:nowrap}
.access-report-table td:first-child{font-weight:600;min-width:150px}
.access-report-table tbody tr:last-child td{border-bottom:0}
.access-result-success{color:var(--ok-fg);background:var(--ok-bg)}
.access-result-failure{color:var(--err-fg);background:var(--err-bg)}
.access-result-unknown{color:var(--fg-2);background:var(--surface-3)}
@media(max-width:760px){.access-report-filterbar>div>.field{flex:1 1 100%;max-width:none}}
.access-report-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px 16px;flex-wrap:wrap;border-bottom:1px solid var(--line);padding-bottom:12px}
.access-report-toolbar>strong{font-size:var(--text-lg)}
.access-report-toolbar>div{align-items:flex-end;max-width:420px;text-align:right}
.access-report-table table{min-width:1400px}
@media(max-width:650px){.access-report-toolbar>div{align-items:flex-start;text-align:left;max-width:100%}}
/* Larguras próprias evitam transformar vínculos de unidade em linhas muito altas. */
.access-report-table td:nth-child(1){min-width:185px}
.access-report-table td:nth-child(2){min-width:200px;white-space:nowrap}
.access-report-table td:nth-child(4){min-width:300px;max-width:440px}
.access-report-table td:nth-child(5),.access-report-table td:nth-child(9){min-width:165px;white-space:nowrap}
.access-report-units{display:flex;flex-wrap:wrap;gap:6px 16px;max-width:420px}
.access-report-units span{white-space:nowrap}
/* Categorias internas de Inteligência, também no menu flutuante. */
.nav-category{min-width:0;margin:2px 0}
.nav-category>summary{display:flex;align-items:center;justify-content:space-between;gap:12px;cursor:pointer;list-style:none;min-height:var(--ctl-h-sm);padding:0 10px;border-radius:var(--radius-sm);color:var(--sb-fg);font-size:var(--text-sm);font-weight:600}
.nav-category>summary::-webkit-details-marker{display:none}
.nav-category>summary:hover{background:var(--sb-hover);color:var(--sb-fg-strong)}
.nav-category>summary .chevron{width:14px;height:14px;opacity:.7;transition:transform .15s}
.nav-category[open]>summary .chevron{transform:rotate(90deg)}
.nav-category-links{display:flex;flex-direction:column;gap:2px;margin:2px 0 6px 9px;padding-left:8px;border-left:1px solid var(--sb-line)}
.nav-category:has(a.active)>summary{color:var(--sb-fg-strong)}
@media (min-width:901px){
  .sidebar.collapsed .nav-category>summary{color:var(--fg-strong)}
  .sidebar.collapsed .nav-category>summary:hover{background:var(--hover);color:var(--fg-strong)}
  .sidebar.collapsed .nav-category-links{border-left-color:var(--line)}
  .sidebar.collapsed .nav-category:has(a.active)>summary{color:var(--primary-text)}
}
.incident-captured-preview{margin:0;display:grid;gap:8px}
.incident-captured-preview img{display:block;width:100%;max-height:320px;object-fit:contain;border:1px solid var(--border);border-radius:12px;background:var(--video-bg)}
.group-panel .panel-tile figcaption{flex-wrap:wrap;row-gap:6px}
.group-panel .map-create-incident{font-size:.72rem;padding:4px 8px;flex-shrink:0;min-height:28px}
.attendance-intelligence{display:flex;flex-direction:column;gap:18px;min-width:0}
.intelligence-groups{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.intelligence-groups h2{font-size:1.1rem;margin:0 0 6px}
.intelligence-action{justify-content:flex-start;text-align:left;min-height:48px}
@media(max-width:760px){.intelligence-groups{grid-template-columns:1fr}}
.facial-transfer-summary{padding:14px;border:1px solid var(--border);border-radius:12px;background:var(--hover)}
.facial-import-row{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px;border:1px solid var(--border);border-radius:12px}
.facial-import-row>div:first-child{min-width:0;flex:1}
@media(max-width:760px){.facial-import-row{flex-direction:column;align-items:stretch}}
.admin-area-menu,.admin-unit-menu{border:1px solid var(--line);border-radius:12px;overflow:hidden;background:var(--surface)}
.admin-area-menu>summary,.admin-unit-menu>summary{display:flex;align-items:center;gap:12px;padding:14px 18px;cursor:pointer;list-style:none;text-align:left}
.admin-area-menu>summary::before,.admin-unit-menu>summary::before{content:'›';font-size:20px;line-height:1;color:var(--accent)}
.admin-area-menu[open]>summary::before,.admin-unit-menu[open]>summary::before{transform:rotate(90deg)}
.admin-area-menu>summary .chip,.admin-unit-menu>summary .chip{margin-left:auto;white-space:nowrap}
.admin-area-menu>summary{border-left:3px solid var(--accent)}
.admin-area-content{padding:0 14px 14px}.admin-unit-content{padding:0 12px 12px}
.admin-unit-menu>summary{padding:12px 14px}.admin-area-menu summary:focus-visible,.admin-unit-menu summary:focus-visible{outline:2px solid var(--accent);outline-offset:-3px}
.modal.wide:has(.resident-access-panel){width:min(980px,calc(100vw - 32px));padding:24px}
.resident-access-panel>[role="status"]:empty{display:none}
.field input.resident-vehicle-plate{width:12ch;max-width:100%;text-transform:uppercase}
.resident-access-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.resident-access-grid>.card{padding:18px;gap:12px;min-width:0}
.resident-access-contact{grid-column:1/-1}
.resident-access-contact-info{display:flex;flex-wrap:wrap;gap:8px 24px;color:var(--muted);overflow-wrap:anywhere}
.resident-access-grid .btn{align-self:start;justify-self:start;width:auto;max-width:100%}
.resident-access-grid .actions{flex-wrap:wrap;margin-top:0;padding-top:12px}
@media(max-width:700px){.resident-access-grid{grid-template-columns:1fr}.modal.wide:has(.resident-access-panel){padding:16px}.resident-access-contact{grid-column:auto}}

/* Assistente de condomínios: mesmo tema e cartões compactos do novo admin. */
.modal.wide:has(.access-wizard){width:min(1160px,calc(100vw - 32px));padding:22px}
.access-wizard{display:grid;gap:18px;min-width:0}
.access-wizard-hero{display:flex;align-items:center;gap:16px;padding:18px;border:1px solid var(--line-2);border-left:3px solid var(--ok);border-radius:14px;background:linear-gradient(110deg,var(--surface-2),var(--surface))}
.access-wizard-mark{display:grid;place-items:center;width:52px;height:52px;flex-shrink:0;background:var(--info-bg);color:var(--info-fg);border-radius:14px;font-size:1.8rem}
.access-wizard-hero small,.access-wizard-summary>small{font-size:.66rem;letter-spacing:.12em;font-weight:700;color:var(--muted)}
.access-wizard-hero h3{margin:5px 0;font-size:1.16rem}.access-wizard-hero p{margin:0;font-size:.8rem}
.access-wizard-progress{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));list-style:none;margin:0;padding:0;gap:8px}
.access-wizard-progress li{display:flex;align-items:center;gap:7px;padding:10px 8px;border:1px solid var(--line);border-radius:9px;color:var(--muted);font-size:.71rem}
.access-wizard-progress li>span{display:grid;place-items:center;min-width:23px;height:23px;border-radius:7px;background:var(--surface-3);font-weight:700}
.access-wizard-progress li.active{border-color:var(--primary);background:var(--info-bg);color:var(--info-fg)}
.access-wizard-progress li.done{border-color:var(--ok);color:var(--ok-fg)}
.access-wizard-layout{display:grid;grid-template-columns:minmax(0,2.2fr) minmax(220px,1fr);gap:18px;align-items:start}
.access-wizard-fields,.access-wizard-summary{display:grid;gap:14px;padding:20px;background:var(--surface-2);border:1px solid var(--line);border-radius:14px;min-width:0}
.access-wizard-fields{border-top:2px solid var(--info)}.access-wizard-fields>h3{margin:0 0 4px;font-size:1rem}
.access-wizard-summary{border-top:2px solid var(--ok);position:sticky;top:0;gap:12px}.access-wizard-summary h3,.access-wizard-summary p{margin:0}.access-wizard-summary h3{overflow-wrap:anywhere;font-size:.98rem}
.access-wizard-stat{display:grid;gap:4px;padding:13px 0;border-bottom:1px solid var(--line)}.access-wizard-stat strong{font-size:1.65rem;color:var(--info-fg)}.access-wizard-stat span{font-size:.76rem;color:var(--muted)}
.access-wizard-safe{font-size:.77rem;padding:10px;border-radius:8px;background:var(--ok-bg);color:var(--ok-fg)}
.access-wizard-group{display:grid;gap:12px;padding:15px;border:1px solid var(--line-2);border-radius:10px;background:var(--surface)}.access-wizard-group h4{margin:0}
.access-wizard-floor-grid,.access-wizard-unit-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.access-wizard-preview{padding:12px;border:1px solid var(--line-2);border-radius:10px;background:var(--surface)}
.access-wizard-preview summary{display:flex;justify-content:space-between;align-items:center;gap:10px;cursor:pointer;font-size:.84rem}.access-wizard-preview[open] summary{margin-bottom:14px}
.access-wizard-unit{display:flex;gap:8px;align-items:center;min-width:0}.access-wizard-unit>.field{flex:1;min-width:0}.access-wizard-unit input[type=checkbox]{width:16px;height:16px;flex-shrink:0}
.access-wizard textarea{min-height:100px;resize:vertical}.access-wizard .field{margin:0}
@media(max-width:760px){.access-wizard-layout{grid-template-columns:minmax(0,1fr)}.access-wizard-summary{position:static}.access-wizard-progress{grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}.access-wizard-progress li{flex-direction:column;padding:7px 2px;text-align:center;font-size:.6rem}.access-wizard-floor-grid,.access-wizard-unit-grid{grid-template-columns:minmax(0,1fr)}}

/* WhatsApp W3: conversas (lista à esquerda, conversa à direita; uma coluna no celular) */
.wa-layout { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 12px; align-items: start; }
@media (max-width: 860px) { .wa-layout { grid-template-columns: 1fr; } }
.wa-list { max-height: 70vh; overflow-y: auto; gap: 6px; }
.wa-item { display: flex; flex-direction: column; gap: 3px; text-align: left; width: 100%; padding: 10px 12px; cursor: pointer;
  background: var(--panel-2); color: var(--fg); border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; }
.wa-item:hover { background: var(--hover); }
.wa-item.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.wa-item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wa-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-messages { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; padding: 4px; }
.wa-msg { max-width: 78%; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line); }
.wa-msg.out { align-self: flex-end; background: var(--info-bg); border-color: transparent; }
.wa-msg.before { opacity: .7; }
.wa-msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.wa-signup-photo { max-width: 260px; max-height: 320px; border-radius: var(--radius-sm); border: 1px solid var(--line); object-fit: cover; }

/* Mobile: filtros compactos e ação proporcional ao cadastro, no tema existente. */
.mobile-page { display: grid; gap: 16px; width: 100%; max-width: 1120px; }
.mobile-filters { display: grid; grid-template-columns: minmax(220px,1fr) minmax(220px,1fr) auto; align-items: end; gap: 12px; padding: 16px; }
.mobile-filters .field { min-width: 0; }
.mobile-filters > .btn { width: auto; }
.mobile-status { margin: 0; }
.mobile-people-list { display: grid; gap: 10px; }
.mobile-person-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; }
.mobile-person-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mobile-person-mark { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border: 1px solid var(--line-2); border-radius: 10px; color: var(--accent-2); background: var(--bg-2); }
.mobile-person-name { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.mobile-person-name > strong { font-size: .92rem; }
.mobile-person-name > small { font-size: .78rem; }
.mobile-person-links { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.mobile-person-link { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.mobile-invite-button { align-self: flex-start; width: auto; min-height: 36px; white-space: nowrap; }
.mobile-pagination { justify-content: flex-end; }
.mobile-activation-code { max-width: 280px; align-self: center; text-align: center; font-size: 1.5rem; letter-spacing: .18em; }
.mobile-code-actions { display: flex; justify-content: center; }
@media (max-width: 760px) {
  .mobile-filters { grid-template-columns: 1fr; }
  .mobile-filters > .btn { justify-self: start; }
  .mobile-person-card { flex-direction: column; align-items: stretch; gap: 12px; }
  .mobile-person-links { align-items: flex-start; }
  .mobile-person-link { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
}

/* Avisos operacionais no shell e sobre os diálogos do atendimento. */
.attendance-alerts { position: fixed; z-index: 2900; top: 68px; right: var(--space-4); width: min(390px, calc(100vw - 32px)); display: grid;
  gap: var(--space-2); pointer-events: none; }
.attendance-alert { padding: var(--space-3) var(--space-4); background: var(--surface-2); border: 1px solid var(--line);
  border-inline-start: 4px solid var(--warn); border-radius: var(--radius); box-shadow: var(--shadow-2); pointer-events: auto;
  overflow-wrap: anywhere; }
.attendance-alert strong { font-size: var(--text-md); color: var(--fg-strong); }
.attendance-alert p { margin: 2px 0 0; color: var(--fg-2); font-size: var(--text-sm); }
.attendance-alert .actions { margin-top: var(--space-3); gap: var(--space-2); }
@media (max-width: 600px) { .attendance-alerts { top: 60px; right: var(--space-3); width: calc(100vw - 24px); } }
/* Recepção de alarme (etapa 3): câmeras do disparo na tela do operador, quando não há Video-wall aberto */
.alarm-cameras { position: fixed; z-index: 2850; left: 16px; bottom: 16px; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 100px);
  display: flex; flex-direction: column; gap: 8px; padding: 12px; border-inline-start: 4px solid var(--err); box-shadow: var(--shadow-2); overflow: auto; }
.alarm-cameras-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; overflow-wrap: anywhere; }
.alarm-cameras-head .btn { flex: none; white-space: nowrap; }
.alarm-cameras-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.alarm-cameras-grid[data-count="1"] { grid-template-columns: 1fr; }
.alarm-camera { margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.alarm-camera video { width: 100%; aspect-ratio: 16 / 9; background: var(--video-bg); object-fit: contain; border-radius: var(--radius-sm); }
.alarm-camera figcaption { display: flex; justify-content: space-between; gap: 6px; font-size: var(--text-sm); min-width: 0; }
.alarm-camera figcaption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .alarm-cameras { left: 8px; right: 8px; bottom: 8px; width: auto; } }

/* Recepção de alarme, etapa 2: número de partição/zona no cadastro da central */
.input-narrow { width: 6rem; flex: 0 0 auto; }

/* Recepção de alarme, etapa 4: painel de alarme (seletores na linha dos botões; a regra geral de input/select é 100%) */
.alarm-console .actions select, .alarm-console .actions input, .alarm-console > .row select { width: auto; min-width: 180px; flex: 0 1 280px; max-width: 100%; }

/* Módulos em homologação (0118): aviso nas telas do alarme e do controle de acesso */
.module-homolog-notice { padding: 10px 14px; border-radius: var(--radius); border-left: 3px solid var(--warn);
  background: var(--warn-bg); color: var(--warn-fg); font-size: var(--text-sm); line-height: 1.5; }
.module-homolog-notice[hidden] { display: none; }

/* Recepção de alarme: grade única das telas e janelas (filtros, formulários, linhas de configuração e listas) */
.alarm-filters, .alarm-grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.alarm-filters { align-items: end; }
.alarm-filters.wide { grid-template-columns: minmax(0, 460px); }
.alarm-grid { align-items: start; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.alarm-grid.small { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.alarm-grid.wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.alarm-grid[hidden] { display: none; }
.alarm-filters .field > :is(input, select):not([type="checkbox"], [multiple]), .alarm-grid .field > :is(input, select):not([type="checkbox"], [multiple]) { max-width: none; width: 100%; }
.alarm-filters > .btn { justify-self: start; }
.alarm-cards { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.alarm-cards > .card { margin: 0; }
.alarm-wide { grid-column: 1 / -1; }
.alarm-wide .alarm-grid { align-items: end; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.alarm-checks { display: grid; gap: 8px 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.alarm-form h3 { margin: 6px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.alarm-form > h3:first-child, .alarm-form .card > h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.alarm-form .stack > .btn, .alarm-form > .btn { align-self: flex-start; }
.alarm-form td:last-child:has(> .btn) { width: 1%; white-space: nowrap; text-align: right; }
.alarm-person .tag, .alarm-setting .tag, .alarm-step .tag { margin: 0; align-self: center; }
.alarm-person .actions.actions.actions, .alarm-phone .actions.actions.actions, .alarm-setting .actions.actions.actions { margin: 0; padding: 0; border: 0; }
.alarm-settings { display: flex; flex-direction: column; }
.alarm-setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 16px; min-height: 58px; padding: 8px 0; border-top: 1px solid var(--line); }
.alarm-setting:last-child { border-bottom: 1px solid var(--line); }
.alarm-unit { display: grid; grid-template-columns: 96px 28px; align-items: center; gap: 8px; }
.alarm-unit > input { width: 100%; text-align: right; }
.alarm-unit.fill { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.alarm-unit.fill > input { text-align: left; }
.alarm-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: auto; padding-top: 4px; }
.alarm-foot.start { justify-content: flex-start; }
.alarm-foot > .btn { min-width: 120px; }
.alarm-add { display: grid; grid-template-columns: minmax(0, 420px) auto; justify-content: start; gap: 10px; align-items: stretch; }
.alarm-add > input { width: 100%; }
.alarm-more { display: flex; justify-content: center; }
.alarm-line { display: grid; gap: 10px; align-items: center; }
.alarm-line > input, .alarm-line > select { width: 100%; max-width: none; min-width: 0; }
.alarm-line.part { grid-template-columns: 90px minmax(0, 1fr) auto 96px; }
.alarm-line.pgm { grid-template-columns: 90px minmax(0, 1fr) 96px; }
.alarm-line.zone { grid-template-columns: 90px repeat(4, minmax(0, 1fr)) 96px; align-items: start; }
.alarm-line.zone > .btn, .alarm-line.zone > small { margin-top: 6px; }
.alarm-line.zone > select[multiple] { min-height: 74px; }
.alarm-line.step { grid-template-columns: 24px minmax(0, 1fr) auto 76px 96px; }
.alarm-person { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 16px; }
.alarm-state { display: grid; gap: 0 24px; margin: 0; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.alarm-state > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.alarm-state dt { color: var(--muted); font-size: var(--text-sm); }
.alarm-state dd { font-variant-numeric: tabular-nums; }
.alarm-state dd { margin: 0; overflow-wrap: anywhere; }
.alarm-command { display: grid; grid-template-columns: 250px minmax(0, 1fr); align-items: end; gap: 10px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.alarm-command > strong { align-self: center; font-size: var(--text-sm); font-weight: 600; color: var(--fg-2); }
.alarm-command-buttons { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.alarm-command-buttons > .btn { width: 100%; height: var(--ctl-h-lg); }
.alarm-console .alarm-command select, .alarm-console .alarm-command input, .alarm-console .alarm-filters select { width: 100%; max-width: none; min-width: 0; }
.alarm-step { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.alarm-step > small { grid-column: 1 / -1; padding-left: 24px; }
.alarm-phone { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; padding-top: 8px; border-top: 1px solid var(--line); }
@media (max-width: 900px) {
  .alarm-cards, .alarm-command { grid-template-columns: minmax(0, 1fr); }
  .alarm-line.zone { grid-template-columns: 90px minmax(0, 1fr) 96px; }
  .alarm-line.zone > :nth-child(n+3):not(.btn) { grid-column: 1 / -1; }
  .alarm-line.zone > .btn { grid-column: 3; grid-row: 1; margin-top: 0; }
}
@media (max-width: 600px) {
  .alarm-line.part { grid-template-columns: 76px minmax(0, 1fr); }
  .alarm-line.pgm { grid-template-columns: 76px minmax(0, 1fr); }
  .alarm-line.step { grid-template-columns: 24px minmax(0, 1fr); }
  .alarm-line.step > :nth-child(n+3), .alarm-line.part > .check { grid-column: 2; justify-self: start; }
  .alarm-line.part > .btn, .alarm-line.pgm > .btn { grid-column: 2; justify-self: start; }
  .alarm-person, .alarm-phone, .alarm-add, .alarm-setting:has(> .actions) { grid-template-columns: minmax(0, 1fr); }
  .alarm-person > .actions, .alarm-phone > .actions, .alarm-setting > .actions { justify-content: flex-start; }
  .alarm-state > div { grid-template-columns: 120px minmax(0, 1fr); }
  .alarm-foot > .btn { flex: 1 1 140px; }
}

/* ---------- Reforma visual, fase 5: vídeo, mapa, alarme e relatórios (28/11/2026) ----------
   Barras de ferramentas numa linha só, na altura dos botões pequenos (--ctl-h-sm); tabelas dos relatórios com
   cabeçalho fixo ao rolar (.table-scroll); números alinhados (tabular-nums). A área de vídeo usa --video-* (escura
   nos dois temas) e o mapa, --pin-* (tokens.css). */
.rec-badge { margin-left: 6px; }
.tile figcaption .rec-badge { margin-left: 0; }
td, .pager, .kpi-value, .rec-clock { font-variant-numeric: tabular-nums; }

/* Barra do Ao vivo, do Mapa e do vídeo-wall: tudo na altura de 30 px, alinhado e sem esticar */
.page-head .head-tools { gap: 6px; justify-content: flex-end; }
.head-tools > .row { gap: 6px; flex-wrap: nowrap; }
.head-tools :is(select, input:not([type=checkbox]):not([type=radio])) { height: var(--ctl-h-sm); min-height: 0; min-width: 0;
  width: auto; max-width: 15rem; padding: 0 8px; font-size: var(--text-sm); }
.head-tools .btn:not(:is(.small, .sm)) { height: var(--ctl-h-sm); padding: 0 var(--ctl-pad-sm); font-size: var(--text-sm); }
/* Layout do mosaico (1/4/9/16) como seletor segmentado: o ativo em azul sólido */
.layout-bar { display: inline-flex; gap: 2px; padding: 2px; border-radius: calc(var(--radius-sm) + 2px); background: var(--surface-3);
  border: 1px solid var(--line); }
.layout-bar .btn { height: calc(var(--ctl-h-sm) - 6px); min-width: 30px; padding: 0 8px; border: 0; background: transparent; color: var(--fg-2);
  font-variant-numeric: tabular-nums; }
.layout-bar .btn:hover { background: var(--hover); color: var(--fg-strong); }
.layout-bar .btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-1); }
.wall-bar .btn { height: var(--ctl-h-sm); }
.live .mosaic { gap: 6px; }
/* Quadro estreito (celular, mosaicos de 9 e 16): nome numa linha com o botão de tela cheia; estado e sincronia abaixo */
.tile:has(> figcaption) { container: tile / inline-size; }
@container tile (max-width: 340px) {
  .tile figcaption { flex-wrap: wrap; row-gap: 3px; padding-bottom: 12px; font-size: var(--text-xs); }
  .tile figcaption > .name { flex-basis: calc(100% - 52px); }
  .tile figcaption > .icon-btn { order: 1; }
  .tile figcaption > :is(.rec-badge, .badge, select) { order: 2; }
  .tile figcaption > select { max-width: 100%; }
  /* Sincronia da câmera: aparece ao tocar/focar o quadro, para a legenda não cobrir o vídeo pequeno */
  .tile:not(:focus-within) figcaption > select { display: none; }
}
.live .pager:empty { display: none; }
/* Gravações: o player não passa de 64% da altura da tela (os controles ficam à vista); velocidade na altura dos botões */
.rec-tile { width: 100%; max-height: 64vh; }
.rec-controls select { height: var(--ctl-h-sm); min-height: 0; width: auto; padding: 0 8px; font-size: var(--text-sm); }
.rec-controls .inline-field { display: inline-flex; align-items: center; gap: 6px; }

/* Filtros de mapa e relatórios: cada seletor no tamanho do conteúdo, numa linha que quebra quando falta espaço */
:is(.map-page, .rep-page) .ev-filters { gap: 8px; padding: 10px 12px; align-items: center; }
:is(.map-page, .rep-page) .ev-filters select { flex: 0 1 auto; min-width: 0; width: auto; max-width: var(--w-sm); }
.rep-page .ev-filters .grow { flex: 1 1 200px; max-width: var(--w-md); }
.rep-page .ev-filters .inline-field { flex: none; }
.rep-page .ev-filters .inline-field input { width: 150px; }
.map-page .ev-filters .muted.small { white-space: nowrap; }

/* Tabelas dos relatórios: rolam dentro do cartão com o cabeçalho fixo */
.table-scroll { max-height: max(320px, calc(100dvh - 260px)); overflow: auto; overscroll-behavior: contain; }
.table-scroll thead th { position: sticky; top: 0; z-index: 1; box-shadow: inset 0 -1px 0 var(--line); }
.table-scroll table { border-collapse: separate; border-spacing: 0; }

/* Painel de alarme: título com dica, comando principal destacado */
.alarm-console .card > h2 { display: flex; align-items: center; gap: 6px; }
.alarm-console .alarm-command-buttons > .btn:not(.ghost):not(:disabled) { box-shadow: var(--shadow-1); }

@media (max-width: 860px) {
  .page-head .head-tools { justify-content: flex-start; }
  .head-tools > .row { flex-wrap: wrap; }
  .table-scroll { max-height: none; }
}
@media (max-width: 600px) {
  /* Celular: os filtros dividem a linha em pares do mesmo tamanho (sem a borda direita irregular) */
  :is(.map-page, .rep-page) .ev-filters select { flex: 1 1 140px; max-width: none; }
  .rep-page .ev-filters .grow { max-width: none; }
}
