/* 1.5.236 (Direção A, seção 3 — V-235-5, aprovada pelo Alan em 22/11/2026): ESCALA ÚNICA DE CAMADAS. Todo z-index do frontend usa uma
   destas variáveis (ou calc() sobre uma delas, para a ordem DENTRO da mesma camada). Número solto é recusado pelo teste
   testes_automatizados/val_v1871_camadas_sem_z_index_solto.py. A tabela antiga (números de 1500 a 9999) logo abaixo virou referência
   histórica: os números de cada arquivo foram trocados pelas variáveis em 22/11, mantendo a mesma ordem entre eles.
     --z-local-1..5   empilhamento dentro de um componente (selo sobre a foto, cabeçalho de tabela)
     --z-flutuante    menu/cartão preso a um campo, cabeçalho grudado (sticky) de uma tela
     --z-barra-topo / --z-menu-celular / --z-barra-celular   barras do celular (antes 1500/1800/1900)
     --z-aviso-campo  aviso encostado no campo (.aviso-campo). Fica ABAIXO das gavetas, como a especificação pede (par 11) — por isso 900,
                      e não os 1100 «sugeridos» na tabela (com 1100 ele passaria por cima das gavetas de 1000).
     --z-gaveta       gavetas: Status, Configurações, menu do celular aberto
     --z-resultado    o cartão único de resultado (e a bandeja/detalhe da Recepção que ele substitui)
     --z-dialogo      diálogos e popups do produto (foto ampliada, Unidade, união de fichas, escolha de edição, painel Aparência)
     --z-dialogo-2    diálogo aberto de dentro de outro diálogo (Dialogos.confirmar/alerta)
     --z-sistema      faixa de sistema (queda da sessão, versão nova, «site para computador») */
:root {
  --z-local-1: 1; --z-local-2: 2; --z-local-3: 3; --z-local-4: 4; --z-local-5: 5;
  --z-flutuante: 30;
  --z-barra-topo: 800; --z-menu-celular: 810; --z-barra-celular: 820;
  --z-aviso-campo: 900;
  --z-gaveta: 1000;
  --z-resultado: 2000;
  --z-dialogo: 3000;
  --z-dialogo-2: 3100;
  --z-sistema: 4000;
}
/* bipa-app.css — IDENTIDADE «BIPA AZUL» DO APP LEVADA PARA O SITE/DESKTOP (rascunho de 15/11/2026; pedido e aprovação do Alan: «prévia aprovada, pode aplicar para todas as telas»).
   Camada de ESTILO apenas, carregada por último em todas as páginas: não muda HTML, ids, rotas, permissões nem scripts. Remover este <link> devolve o visual anterior.
   Tokens: DIRECAO_VISUAL_APROVADA_BIPA_AZUL_07-11.md (claro/escuro; «noturno» usa o escuro). As outras paletas de destaque do operador (data-cor) mantêm a COR de destaque; as superfícies seguem o app.
   Barra lateral: flutuante, com NOME em todos os itens e a assinatura oficial do Contrô (img/contro-assinatura-*.png, sem alteração). Celular (≤760 px): barra inferior flutuante com nomes. */

/* ---------- tokens ---------- */
:root:root:root:not([data-tema="escuro"]):not([data-tema="noturno"]) {
  --bg:#F3F3F6; --card-bg:#FFFFFF; --surface-2:#E9E9EE; --border:#E3E3E8; --text:#0B0B0C; --text-muted:#5A5A63; --text-3:#63636C; --sidebar-bg:#FFFFFF;
  --b-bg:#F3F3F6; --b-card:#FFFFFF; --b-s2:#E9E9EE; --b-ln:#E3E3E8; --b-ink:#0B0B0C; --b-mut:#5A5A63; --b-m3:#63636C; --bipa-sombra: 0 8px 28px rgba(11,11,12,.10); --bipa-fundo-forte:#0B0B0C; --bipa-texto-forte:#FFFFFF;
}
:root:root:root[data-tema="escuro"], :root:root:root[data-tema="noturno"] {
  --bg:#000000; --card-bg:#141416; --surface-2:#212126; --border:#26262B; --text:#FFFFFF; --text-muted:#8E8E96; --text-3:#85858D; --sidebar-bg:#141416;
  --b-bg:#000000; --b-card:#141416; --b-s2:#212126; --b-ln:#26262B; --b-ink:#FFFFFF; --b-mut:#8E8E96; --b-m3:#85858D; --bipa-sombra: 0 8px 28px rgba(0,0,0,.55); --bipa-fundo-forte:#FFFFFF; --bipa-texto-forte:#0B0B0C;
}
:root:root:root:not([data-cor]):not([data-tema="escuro"]):not([data-tema="noturno"]), :root:root:root[data-cor="amber"]:not([data-tema="escuro"]):not([data-tema="noturno"]) {
  --primary:#0A6CFF; --primary-hover:#0859D1; --primary-fg:#FFFFFF; --accent-text:#0A6CFF; --accent-dim:color-mix(in srgb, #0A6CFF 14%, #FFFFFF); --marca-eletrico:#0A6CFF; --marca-acao:#0A6CFF;
  --success:#17803F; --danger:#C5222B;
}
:root:root:root:not([data-cor])[data-tema="escuro"], :root:root:root:not([data-cor])[data-tema="noturno"], :root:root:root[data-cor="amber"][data-tema="escuro"], :root:root:root[data-cor="amber"][data-tema="noturno"] {
  --primary:#1A7BFF; --primary-hover:#4093FF; --primary-fg:#FFFFFF; --accent-text:#4093FF; --accent-dim:color-mix(in srgb, #1A7BFF 18%, #141416); --marca-eletrico:#1A7BFF; --marca-acao:#1A7BFF;
  --success:#3DDC84; --danger:#FF6B6B;
}
:root { --font-display: "Manrope", "Segoe UI Variable Display", "Segoe UI", -apple-system, Roboto, Arial, sans-serif; --bipa-raio:24px; }
html, body, button, input, select, textarea { font-family: "Manrope", "Segoe UI Variable Text", "Segoe UI", -apple-system, Roboto, Arial, sans-serif; }
body { background: var(--bg); }

/* ---------- barra lateral flutuante, com nomes ---------- */
html:root .app > .sidebar, html:root .app.interface-visual > .sidebar {
  --card-bg: var(--b-card); --surface-2: var(--b-s2); --border: var(--b-ln); --text: var(--b-ink); --text-muted: var(--b-mut); --text-3: var(--b-m3);
  --accent-text: var(--b-ink); --red-text: var(--danger); --green-text: var(--success);
  background: var(--b-card); color: var(--b-ink);
}
html:root .app > .sidebar .nav-item.active, html:root .app.interface-visual .sidebar .nav-item.active { background: var(--b-s2); color: var(--b-ink); box-shadow: none; }
html:root .app > .sidebar .nav-item.active .nav-icon { color: var(--primary); }
html:root .app > .sidebar .nav-item:nth-of-type(4)::before, html:root .app > .sidebar .nav-item.active::before { display: none; }
html:root .app > .sidebar .sidebar-top { border-bottom: 0; padding: 0; }
html:root .app > .sidebar .sidebar-foot { margin: auto 0 0; border: 0; background: transparent; }
html:root .app > .sidebar .nav-icon { background: transparent; box-shadow: none; padding: 0; }
html:root .app > .sidebar .marca-programa-icone { content: url("/static/img/contro-assinatura-clara.png"); }
html:root:not([data-tema="escuro"]):not([data-tema="noturno"]) .app > .sidebar .marca-programa-icone { content: url("/static/img/contro-assinatura-escura.png"); }
html:root .app.collapsed > .sidebar .marca-programa-icone { content: url("/static/img/contro-simbolo.png"); width: auto; height: 42px; }
html:root .app.collapsed > .sidebar .nav-item { width: 56px; height: 48px; border-radius: 24px; margin: 3px auto; }
.app { grid-template-columns: 272px 1fr; }
.app.collapsed { grid-template-columns: 92px 1fr; }
.app > .sidebar {
  margin: 16px 0 16px 16px; height: calc(100vh - 32px); border: 0; border-radius: 32px; padding: 12px 10px;
  background: var(--card-bg); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: var(--bipa-sombra);
  overflow-y: auto; overflow-x: hidden; scrollbar-width: none;
}
.app > .sidebar::-webkit-scrollbar { display: none; }
.sidebar .marca-programa { padding: 8px 6px 10px; justify-content: center; }
.sidebar .marca-programa-icone { content: url("/static/img/contro-assinatura-clara.png"); width: 100%; max-width: 200px; height: auto; border-radius: 0; object-fit: contain; }
:root:root:root:not([data-tema="escuro"]):not([data-tema="noturno"]) .sidebar .marca-programa-icone { content: url("/static/img/contro-assinatura-escura.png"); }
.sidebar .toggle-btn { background: var(--surface-2); border: 0; border-radius: 50%; width: 32px; height: 32px; color: var(--text-muted); }
.sidebar .nav-item {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 16px; margin: 2px 0; border-radius: 24px; box-shadow: none; background: transparent;
  color: var(--text-muted); font-weight: 700; font-size: 14px; transition: background .2s, color .2s, transform .12s;
}
.sidebar .nav-item:hover { background: var(--surface-2); color: var(--text); }
.sidebar .nav-item:active { transform: scale(.97); }
.sidebar .nav-item.active { background: var(--surface-2); color: var(--text); box-shadow: none; font-weight: 800; }
.sidebar .nav-item.active .nav-icon { color: var(--primary); }
.sidebar .nav-item .nav-icon svg { width: 22px; height: 22px; }
.sidebar .nav-item .nav-label { display: inline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app.collapsed .sidebar .nav-item { justify-content: center; padding: 0; }
.app.collapsed .sidebar .nav-label { display: none; }
.sidebar-foot { border-top: 0; padding: 10px 8px 4px; color: var(--text-muted); }
.sidebar-versao { color: var(--text-3); }
.app > .main { background: transparent; }

/* ---------- cartões, botões, campos, abas ---------- */
.card, .panel, .config-painel, .unidade-card, .dialog, .cropper-box, .fase2-dialogo, .dlg, .dialogos-caixa, .balao-resultado { border-radius: var(--bipa-raio); border-color: transparent; }
.card, .panel { background: var(--card-bg); box-shadow: none; }
button, .btn, a.btn, input[type="button"], input[type="submit"] { border-radius: 22px; font-weight: 700; transition: transform .12s, background .2s; }
button:active:not(:disabled), .btn:active, a.btn:active { transform: scale(.97); }
button.primary, .btn.primary, .btn-primary { background: var(--primary); color: var(--primary-fg); border-color: transparent; }
button.primary:hover, .btn.primary:hover { background: var(--primary-hover); }
button.danger, .btn.danger { border-radius: 22px; }
input[type="text"], input[type="search"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], input[type="email"], input[type="tel"], select, textarea {
  border-radius: 16px; border-color: transparent; background: var(--surface-2); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.tab, .seg-btn, .seg-abas button, [role="tab"] { border-radius: 22px; font-weight: 700; }
.tab.active, .seg-btn.active, .seg-abas button.ativa, [role="tab"][aria-selected="true"] { background: var(--bipa-fundo-forte); color: var(--bipa-texto-forte); }
.badge, .tag, .status-pill { border-radius: 12px; font-weight: 800; }
.topbar h1, h1.titulo { font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; }
.unidade-card-nome::before { background: var(--primary); }

/* ---------- celular: barra inferior flutuante COM nomes ---------- */
@media (max-width: 760px) {
  .mob-barra { left: 12px; right: 12px; border-radius: 30px; padding: 6px; border: 0; background: var(--card-bg); box-shadow: var(--bipa-sombra); }
  .mob-aba { height: 56px; flex-direction: column; gap: 2px; border-radius: 22px; font-size: 10.5px; font-weight: 700; line-height: 1.1; text-align: center; }
  .mob-aba::after { content: attr(aria-label); display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mob-aba svg { width: 22px; height: 22px; }
  .mob-aba.ativa { background: var(--surface-2); color: var(--text); }
  .mob-aba.ativa svg { color: var(--primary); }
  .mob-avatar { background: var(--surface-2); color: var(--primary); box-shadow: none; }
  .mob-lista, .mob-telas { border: 0; border-radius: 24px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar .nav-item, button, .btn { transition: none; } }

/* ---------- telas grandes: o conteúdo cresce em degraus, como nas prévias ---------- */
html { zoom: var(--bipa-z, 1); }
.app { height: calc(100vh / var(--bipa-z, 1)); }
.app > .sidebar { height: calc(100vh / var(--bipa-z, 1) - 32px); }
/* 16/11/2026 — tela cortada em monitor grande (4K, zoom 1,9): o `zoom` do html NÃO divide o `vh`; só .app e .sidebar eram corrigidos.
   O `.main` (style.css: height 100vh + overflow hidden) ficava ~1,9× mais alto que a janela e a base do Cadastro/Configurações sumia sem rolagem.
   O login (min-height 100vh) e os diálogos (max-height calc(100vh - …)) tinham o mesmo defeito. Só altura; nenhuma função muda. */
/* `--vz` = 1vh já dividido pelo zoom: «N vh» passa a ser calc(N * var(--vz)). Rede de segurança: se o conteúdo não couber, a área ROLA (nunca corta). */
:root { --vz: calc(1vh / var(--bipa-z, 1)); }
html:root .main { height: calc(100 * var(--vz)); overflow-y: auto; }
html:root body.login-visual .lv-tela { min-height: calc(100 * var(--vz)) !important; }   /* o login tem min-height:100vh INLINE no HTML */
html:root .dlg-caixa, html:root .acionamento-caixa { max-height: calc(100 * var(--vz) - 32px); }
html:root .fase1c-dialog, html:root .lnd-dialogo, html:root .ef-pilha { max-height: calc(100 * var(--vz) - 16px); }
html:root .cropper-overlay > *, html:root .popup-backdrop > * { max-height: calc(100 * var(--vz) - 32px); }
html:root .cropper-box, html:root .fase1c-real-caixa, html:root .dialogos-caixa, html:root [class*="dialogo-caixa"] { max-height: min(calc(88 * var(--vz)), 860px) !important; }   /* o cropper-box tem 85vh INLINE em 4 telas */
html:root .avisos-popup-box { max-height: calc(88 * var(--vz)); }
html:root .aparencia-rapida-painel.v14 { max-height: min(calc(78 * var(--vz)), 720px); }
html:root .visualizador-foto img { max-height: calc(90 * var(--vz)); }
html:root .acionamento-imagem-grande, html:root .acionamento-imagem-grande img, html:root .acionamento-imagem-grande canvas.acionamento-video { max-height: calc(100 * var(--vz) - 250px); }
html:root .fase1b-message-body, html:root .fase1b-popup-body { max-height: min(720px, calc(100 * var(--vz) - 58px)); }
@media (min-width: 1700px) { :root { --bipa-z: 1.12; } }
@media (min-width: 1920px) { :root { --bipa-z: 1.2; } }
@media (min-width: 2300px) { :root { --bipa-z: 1.45; } }
@media (min-width: 3000px) { :root { --bipa-z: 1.9; } }

/* ---------- ajustes da barra ---------- */
html:root .app > .sidebar .nav-item, html:root .app > .sidebar .nav-item:nth-of-type(n) { margin: 2px 0; }
html:root .app.collapsed > .sidebar .nav-item:nth-of-type(n) { margin: 3px auto; }
html:root .app > .sidebar .toggle-btn { top: 12px; bottom: auto; right: 12px; position: absolute; z-index: var(--z-local-2); }
html:root .app.collapsed > .sidebar .toggle-btn { right: 30px; top: auto; bottom: 14px; }
html:root .app > .sidebar .sidebar-foot { padding-right: 8px; }
html:root .app > .sidebar .nav-icon { min-width: 22px; }

/* 16/11/2026 (1.5.222; varredura da Identidade Visual, B-3/B-4): texto pequeno com no mínimo 11 px (era 9,5 e 10,5). Só tamanho: nenhuma função, id ou classe muda. */
html:root table th, html:root .td-sub, html:root .badge-similaridade, html:root .seg-pagina .badge, html:root .sim-title, html:root .seg-btn,
html:root .lnv-codigo, html:root .lnv-selo, html:root button.lnv-detalhes, html:root .lnv-foto-vazio small, html:root .ajv-faciais, html:root .cfg-tipo, html:root .cfg-gaveta-contexto,
html:root body.painel-visual .painel-tile-rotulo, html:root body.painel-visual .painel-h3, html:root body.painel-visual .pv-pct, html:root .rc-ultimo-dados dt, html:root .cfg-selo { font-size: 11px; }
html:root .sym-box .rec { font-size: 11px; }

/* 17/11/2026 (1.5.226, D7; prévia aprovada): faixa «Mostrando só: {BLOCO}», aviso de PC sem bloco e apoio do Destino. Só aparecem quando o servidor diz que a amarração do computador vale (atributo hidden). */
.escopo-faixa { display: flex; flex-direction: column; gap: 2px; margin: 8px 0; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 600; background: #E3EEFF; color: #0A55CC; }
.escopo-faixa small { font-weight: 500; opacity: .9; }
.escopo-aviso { margin: 8px 0; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 600; background: #FFF1D6; color: #8A5300; }
.escopo-faixa[hidden], .escopo-aviso[hidden], .escopo-apoio[hidden] { display: none; }
.escopo-apoio { margin: 4px 0 0; font-size: 12.5px; color: var(--text-muted); }
.escopo-apoio.escopo-apoio-ambar { color: #8A5300; font-weight: 600; }
:root[data-tema="escuro"] .escopo-faixa, :root[data-tema="noturno"] .escopo-faixa { background: #10243F; color: #4093FF; }
:root[data-tema="escuro"] .escopo-aviso, :root[data-tema="noturno"] .escopo-aviso { background: #33260E; color: #F2B04A; }
:root[data-tema="escuro"] .escopo-apoio.escopo-apoio-ambar, :root[data-tema="noturno"] .escopo-apoio.escopo-apoio-ambar { color: #F2B04A; }
