/* =============================================================================
   Lorentz ATP — sistema visual
   Equipe: "utilidade e precisão" (cinza-azulado, profundidade por borda, 4px, um acento).
   Público: sinalização de transporte (Big Shoulders, tinta e amarelo de sinal).
   ============================================================================= */

@font-face { font-family: "Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Sinal"; src: url("../fonts/big-shoulders-display-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Sinal"; src: url("../fonts/big-shoulders-display-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  /* superfícies e texto: quatro níveis */
  --fundo: #f5f6f8;
  --superficie: #ffffff;
  --superficie-2: #f9fafb;
  --borda: rgba(15, 23, 42, 0.10);
  --borda-sutil: rgba(15, 23, 42, 0.06);
  --texto: #0f172a;
  --texto-2: #334155;
  --suave: #5c6c83;
  --tenue: #94a3b8;

  /* um acento: azul-tinta */
  --acento: #2350d0;
  --acento-forte: #1a3fa8;
  --acento-fundo: #eef2fc;
  /* texto sobre fundo cheio: claro aqui, escuro nos temas escuros */
  --sobre-acento: #ffffff; --sobre-ok: #ffffff; --sobre-erro: #ffffff;

  /* cor só com significado */
  --ok: #157f3c;      --ok-fundo: #e9f6ee;
  --alerta: #a75a00;  --alerta-fundo: #fdf3e2;
  --erro: #b42318;    --erro-fundo: #fdecea;
  --pref: #6b35c9;    --pref-fundo: #f2ecfc;
  --neutro-fundo: #f1f3f6;

  --sans: "Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "Plex Mono", ui-monospace, "Cascadia Mono", monospace;
  --sinal: "Sinal", "Arial Narrow", sans-serif;

  --r-1: 4px; --r-2: 6px; --r-3: 8px;
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  --foco: 0 0 0 3px rgba(35, 80, 208, 0.25);

  --lateral: var(--superficie);
  --trilho: #cbd2dc;
  --grafico-barra: #c9d3e3;
  color-scheme: light;

  /* público */
  --tinta: #12151b;
  --tinta-2: #1c2129;
  --amarelo: #ffc629;
  /* público: sinalização do totem e do painel da TV (tema "sinal"; outros em data-sinal) */
  --s-fundo: #eceae4; --s-cartao: #ffffff; --s-linha: rgba(18, 21, 27, 0.12); --s-linha-forte: rgba(18, 21, 27, 0.2);
  --s-titulo: #12151b; --s-texto: #4a5260; --s-acento: #2350d0;
  --s-barra: #12151b; --s-sobre-barra: #ffffff; --s-sobre-barra-2: rgba(255, 255, 255, 0.75); --s-barra-linha: rgba(255, 255, 255, 0.35);
  --s-destaque: #ffc629; --s-sobre-destaque: #12151b;
  --s-botao: #12151b; --s-botao-hover: #1c2129; --s-sobre-botao: #ffffff; --s-pref: #6b35c9; --s-pref-hover: #5a2ab0;
  --s-tv-fundo: #12151b; --s-tv-lateral: #1c2129; --s-tv-texto: #ffffff; --s-tv-texto-2: rgba(255, 255, 255, 0.75);
  --s-tv-suave: rgba(255, 255, 255, 0.6); --s-tv-tenue: rgba(255, 255, 255, 0.35); --s-tv-linha: rgba(255, 255, 255, 0.08);
  --s-tv-codigo: #ffc629; --s-tv-pref: #c9a7ff; --s-tv-chip: #ffffff; --s-tv-sobre-chip: #12151b; --s-tv-veu: rgba(18, 21, 27, 0.92);
}

* { box-sizing: border-box; }
html { font-size: calc(16px * var(--escala, 1)); -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 0.875rem/1.5 var(--sans); background: var(--fundo); color: var(--texto); }
a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1rem; }
h3 { font-size: 0.875rem; }
p { margin: 0 0 12px; color: var(--texto-2); }
small { color: var(--suave); }
.cod, .num, td.num, .kpi b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: none; box-shadow: var(--foco); }

/* Tabela de chave e valor (detalhe) */
table.dados th { width: 38%; padding-left: 0; background: none; text-transform: none; letter-spacing: 0;
  font-size: 0.8125rem; font-weight: 400; color: var(--suave); }
table.dados td { padding-right: 0; }
table.dados tr:hover td { background: none; }

/* Interruptor (liga e desliga): botão com role="switch" */
.interruptor { position: relative; display: inline-flex; align-items: center; height: 32px; padding: 0 0 0 44px; border: 0;
  border-radius: var(--r-2); background: none; color: var(--suave); font: 500 0.8125rem var(--sans); cursor: pointer; }
.interruptor::before { content: ""; position: absolute; left: 0; top: 7px; width: 32px; height: 18px; border-radius: 9px;
  background: var(--trilho); transition: background 150ms var(--ease); }
.interruptor::after { content: ""; position: absolute; left: 2px; top: 9px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25); transition: transform 150ms var(--ease); }
.interruptor[aria-checked="true"] { color: var(--ok); }
.interruptor[aria-checked="true"]::before { background: var(--ok); }
.interruptor[aria-checked="true"]::after { transform: translateX(14px); }

/* Itens do atendimento: edição em linha sem quebra */
.form-linha { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; margin: 0; }
.form-linha input[type="number"] { width: 64px; flex: none; }
.form-linha input:not([type]) , .form-linha input[type="text"] { flex: 1; min-width: 0; }
.busca { min-width: 18rem; }

/* ---------- Estrutura da equipe: barra lateral + conteúdo ---------- */
/* a coluna da barra lateral vai até o fim da página, mesmo com conteúdo longo */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh;
  background: linear-gradient(to right, var(--lateral) 231px, var(--borda) 231px, var(--borda) 232px, transparent 232px); }
.principal { min-width: 0; display: flex; flex-direction: column; }
.lateral { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 12px; background: var(--lateral); border-right: 1px solid var(--borda); align-self: start; }
.marca { display: flex; align-items: center; gap: 8px; padding: 4px 8px 16px; color: var(--texto); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.marca:hover { text-decoration: none; }
.marca .selo { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: var(--r-2);
  background: var(--tinta); color: var(--amarelo); font: 800 1rem/1 var(--sinal); }
.marca small { display: block; font-weight: 400; font-size: 0.75rem; }
.nav-item { display: flex; align-items: center; gap: 12px; height: 32px; padding: 0 8px; border-radius: var(--r-2);
  color: var(--texto-2); font-weight: 500; transition: background 150ms var(--ease), color 150ms var(--ease); }
.nav-item i { font-size: 1.125rem; color: var(--suave); }
.nav-item:hover { background: var(--neutro-fundo); text-decoration: none; }
.nav-item.ativo { background: var(--acento-fundo); color: var(--acento-forte); }
.nav-item.ativo i { color: var(--acento); }
.nav-rotulo { padding: 16px 8px 4px; font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--suave); }
.usuario { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px 8px 0; border-top: 1px solid var(--borda-sutil); }
.usuario .avatar { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--neutro-fundo);
  color: var(--texto-2); font-weight: 600; font-size: 0.75rem; }
.usuario div { flex: 1; min-width: 0; line-height: 1.3; }
.usuario b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario form { margin: 0; }
.usuario button { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--r-2);
  background: transparent; color: var(--suave); cursor: pointer; font-size: 1.125rem; }
.usuario button:hover { background: var(--neutro-fundo); color: var(--texto); }

.conteudo { width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px; flex: 1; }
.rodape-staff { padding: 16px 24px; color: var(--suave); font: 400 0.75rem var(--mono); }

/* Sem login: topo simples */
.topo { display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 24px; background: var(--superficie); border-bottom: 1px solid var(--borda); }
.topo .marca { padding: 0; }
.topo nav { margin-left: auto; display: flex; gap: 16px; }

/* ---------- Componentes ---------- */
.card { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--r-3); padding: 16px; margin-bottom: 16px;
  min-width: 0; overflow-x: auto; }   /* tabela larga rola dentro do cartão, não alarga a página */
.grade { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 16px; }
.grade > .card { margin-bottom: 0; }
.cabecalho { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.cabecalho h1 { margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 0 12px;
  border: 1px solid transparent; border-radius: var(--r-2); background: var(--acento); color: var(--sobre-acento);
  font: 500 0.8125rem/1 var(--sans); white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background 150ms var(--ease), border-color 150ms var(--ease); }
.btn:hover { background: var(--acento-forte); text-decoration: none; }
.btn i { font-size: 1rem; }
.btn.sec { background: var(--superficie); color: var(--texto); border-color: var(--borda); }
.btn.sec:hover { background: var(--superficie-2); border-color: rgba(15, 23, 42, 0.18); }
.btn.ok { background: var(--ok); color: var(--sobre-ok); }
.btn.ok:hover { background: color-mix(in oklab, var(--ok) 85%, #000); }
.btn.alerta { background: var(--superficie); color: var(--alerta); border-color: rgba(167, 90, 0, 0.35); }
.btn.alerta:hover { background: var(--alerta-fundo); }
.btn.erro { background: var(--superficie); color: var(--erro); border-color: rgba(180, 35, 24, 0.30); }
.btn.erro:hover { background: var(--erro-fundo); }
.btn.grande { height: 40px; padding: 0 16px; font-size: 0.9375rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.acoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.acoes form { margin: 0; }
form.card.acoes { padding: 12px; }
td.acoes { display: table-cell; text-align: right; white-space: nowrap; }
td.acoes > * { display: inline-flex; vertical-align: middle; margin-left: 4px; }

input, select, textarea { font: 400 0.875rem/1.4 var(--sans); color: var(--texto); background: var(--superficie);
  border: 1px solid var(--borda); border-radius: var(--r-2); transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease); }
input, select { height: 32px; padding: 0 8px; }
textarea { padding: 8px; resize: vertical; }
select { appearance: none; padding-right: 28px; white-space: nowrap;
  background: var(--superficie) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 256 256'%3E%3Cpath fill='%2364748b' d='M213.66 101.66l-80 80a8 8 0 0 1-11.32 0l-80-80a8 8 0 0 1 11.32-11.32L128 164.69l74.34-74.35a8 8 0 0 1 11.32 11.32Z'/%3E%3C/svg%3E") no-repeat right 8px center / 12px; }
input:hover, select:hover, textarea:hover { border-color: rgba(15, 23, 42, 0.18); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acento); box-shadow: var(--foco); }
input[type="checkbox"] { height: 16px; width: 16px; accent-color: var(--acento); vertical-align: -3px; margin: 0 4px 0 0; }
label { display: block; font-weight: 500; font-size: 0.8125rem; color: var(--texto-2); margin-bottom: 4px; }
.campo { margin-bottom: 12px; }

.aviso { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border-radius: var(--r-2); margin-bottom: 16px;
  border: 1px solid var(--borda); background: var(--superficie); color: var(--texto-2); }
.aviso::before { content: ""; flex: none; width: 3px; align-self: stretch; border-radius: 2px; background: var(--tenue); }
.aviso.ok::before { background: var(--ok); }
.aviso.erro::before { background: var(--erro); }
.aviso.erro { color: var(--erro); }

/* status: ponto + rótulo; cor só aqui */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-1);
  background: var(--neutro-fundo); color: var(--texto-2); font-size: 0.75rem; font-weight: 500; white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--tenue); }
.tag.livre { background: var(--ok-fundo); color: var(--ok); }
.tag.livre::before { background: var(--ok); }
.tag.chamando { background: var(--alerta-fundo); color: var(--alerta); }
.tag.chamando::before { background: var(--alerta); }
.tag.ocupado { background: var(--acento-fundo); color: var(--acento-forte); }
.tag.ocupado::before { background: var(--acento); }
.tag.pausa { background: var(--neutro-fundo); color: var(--suave); }
.tag.pref { background: var(--pref-fundo); color: var(--pref); }
.tag.pref::before { background: var(--pref); }
.tag.sem { background: var(--erro-fundo); color: var(--erro); }
.tag.sem::before { background: var(--erro); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--borda-sutil); vertical-align: middle; }
th { font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--suave); }
thead th { background: var(--superficie-2); }
tbody tr:hover td { background: var(--superficie-2); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; }

.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 16px; }
.kpi { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--r-3); padding: 16px; }
.kpi span { display: block; margin-bottom: 4px; font-size: 0.75rem; color: var(--suave); }
.kpi b { display: block; font-size: 1.75rem; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }

.senha-atual { margin: 8px 0 4px; font: 500 3.5rem/1 var(--mono); letter-spacing: -0.02em; }

/* ---------- Monitor: central de atendimento (histórico) ---------- */
.central { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--borda); }
.central .secao h2 { font-size: 1.25rem; margin-bottom: 4px; }
.legenda { margin: 0; font-size: 0.8125rem; color: var(--suave); font-weight: 400; letter-spacing: 0; }
.legenda b { color: var(--texto-2); font-weight: 500; }
.sub { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font-size: 0.875rem; }
.card .cabecalho { margin-bottom: 8px; }
.card .cabecalho h2 { margin: 0; }

.kpi { position: relative; }
.kpi .delta { display: block; margin-top: 4px; font: 500 0.75rem var(--mono); color: var(--suave); }
.kpi .delta.bom { color: var(--ok); }
.kpi .delta.ruim { color: var(--erro); }
.kpi .meta { position: absolute; top: 16px; right: 16px; font: 500 0.6875rem var(--mono); color: var(--erro); }
.kpi.abaixo { box-shadow: inset 3px 0 0 var(--erro); }

.chaves { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chave { display: inline-block; margin-left: 8px; }
.chave.barra { width: 10px; height: 10px; border-radius: 2px; background: var(--grafico-barra); }
.chave.linha { width: 16px; height: 2px; background: var(--acento); }
.chave.alvo { width: 16px; border-top: 2px dashed var(--erro); }

.grafico svg { display: block; }
.grafico .grade-linha { stroke: var(--borda-sutil); }
.grafico .eixo { font: 400 11px var(--mono); fill: var(--suave); }
.grafico .barra { fill: var(--grafico-barra); }
.grafico .alvo { stroke: var(--erro); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: 0.7; }
.grafico .linha-sla { fill: none; stroke: var(--acento); stroke-width: 2; stroke-linejoin: round; }
.grafico .ponto { fill: var(--superficie); stroke: var(--acento); stroke-width: 2; }
.grafico .ponto.abaixo { stroke: var(--erro); }
.grafico .alvo-dica { fill: transparent; }
.grafico .alvo-dica:hover { fill: rgba(35, 80, 208, 0.05); }

.termal-grade { display: grid; gap: 2px; }
.termal-grade .eixo-h, .termal-grade .eixo-d { font: 400 11px var(--mono); color: var(--suave); }
.termal-grade .eixo-h { text-align: center; padding-bottom: 2px; }
.termal-grade .eixo-d { display: flex; align-items: center; }
.termal-grade .quad { display: grid; place-items: center; aspect-ratio: 1.5; min-height: 22px; border-radius: 2px;
  background: var(--superficie-2); font: 500 11px var(--mono); cursor: default; }
.termal-grade .quad.fora { box-shadow: inset 0 0 0 1.5px var(--erro); }
.escala { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; font: 400 11px var(--mono); color: var(--suave); }
.escala-barra { width: 96px; height: 8px; border-radius: 2px;
  background: linear-gradient(to right, color-mix(in oklab, var(--acento) 8%, var(--superficie)), var(--acento)); }
.escala-fora { margin-left: 12px; padding-left: 16px; position: relative; }
.escala-fora::before { content: ""; position: absolute; left: 0; top: 0; width: 10px; height: 10px; border-radius: 2px; box-shadow: inset 0 0 0 1.5px var(--erro); }

.spark { display: block; }
.spark rect { fill: var(--acento); opacity: 0.75; }
td.abaixo { color: var(--erro); }

.dica { position: fixed; z-index: 10; min-width: 160px; padding: 8px 12px; border-radius: var(--r-2); pointer-events: none;
  background: var(--tinta); color: #fff; font-size: 0.75rem; box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18); }
.dica .dica-titulo { margin-bottom: 4px; font-weight: 600; }
.dica div:not(.dica-titulo) { display: flex; justify-content: space-between; gap: 16px; }
.dica b { font: 500 0.75rem var(--mono); }
.vazio { color: var(--suave); }

/* ---------- Telas públicas: sinalização ---------- */
body.publico { min-height: 100vh; display: flex; flex-direction: column; background: var(--s-fundo); color: var(--s-titulo); overflow-x: hidden; font-size: 1rem; }
.totem-topo { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 24px; background: var(--s-barra); color: var(--s-sobre-barra); border-bottom: 6px solid var(--s-destaque); }
.totem-topo h1 { margin: 0; font: 800 2.25rem/1 var(--sinal); letter-spacing: 0.01em; text-transform: uppercase; }
.relogio-totem { text-align: right; line-height: 1.15; }
.relogio-totem b { display: block; font: 700 2.5rem/1 var(--sinal); color: var(--s-destaque); letter-spacing: 0.02em; }
.relogio-totem span { font-size: 0.875rem; color: var(--s-sobre-barra-2); }
.a11y { display: flex; gap: 8px; flex-wrap: wrap; }
.a11y button { display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: var(--r-3);
  border: 1px solid var(--s-barra-linha); background: transparent; color: var(--s-sobre-barra); font: 600 1rem var(--sans); cursor: pointer; }
.a11y button:hover { border-color: var(--s-sobre-barra); }
.a11y button[aria-pressed="true"] { background: var(--s-destaque); border-color: var(--s-destaque); color: var(--s-sobre-destaque); }
.a11y svg { width: 1.5rem; height: 1.5rem; }

.totem { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 32px 24px; }
.totem .instrucao { margin: 0 0 24px; font: 700 1.75rem/1.1 var(--sinal); text-transform: uppercase; letter-spacing: 0.01em; color: var(--s-titulo); }
.totem .instrucao b { color: var(--s-acento); }
.totem .servicos { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); grid-auto-rows: 1fr; }
.totem .servico { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr auto; column-gap: 16px;
  background: var(--s-cartao); border: 1px solid var(--s-linha); border-radius: var(--r-3); padding: 20px; }
.totem .servico .linha { grid-row: 1 / 3; display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: var(--r-2);
  background: var(--s-destaque); color: var(--s-sobre-destaque); font: 800 2.75rem/1 var(--sinal); }
.totem .servico h2 { margin: 0; align-self: end; font: 800 1.875rem/1.05 var(--sinal); text-transform: uppercase; letter-spacing: 0.01em; color: var(--s-titulo); }
.totem .servico p { margin: 4px 0 0; color: var(--s-texto); font-size: 1rem; }
.totem .botoes { grid-column: 1 / -1; margin-top: 16px; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.totem .botoes form { margin: 0; }
.btn-totem { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-width: 0; min-height: 5rem; padding: 8px;
  border: 0; border-radius: var(--r-3); background: var(--s-botao); color: var(--s-sobre-botao); cursor: pointer; text-decoration: none; text-align: center;
  font: 800 1.75rem/1 var(--sinal); text-transform: uppercase; letter-spacing: 0.02em; overflow-wrap: break-word; hyphens: none;
  transition: transform 150ms var(--ease), background 150ms var(--ease); }
.btn-totem:hover { background: var(--s-botao-hover); text-decoration: none; }
.btn-totem:active { transform: scale(0.98); }
.btn-totem.pref { background: var(--s-pref); color: #fff; }
.btn-totem.pref:hover { background: var(--s-pref-hover); }
.btn-totem.neutro { background: var(--s-cartao); color: var(--s-titulo); box-shadow: inset 0 0 0 2px var(--s-titulo); }
.btn-totem i { font-size: 1.5rem; }
.btn-totem.ouvindo { box-shadow: 0 0 0 4px var(--s-destaque); }
.totem .nota { margin-top: 24px; color: var(--s-texto); font-size: 0.9375rem; }
.totem .acoes-ticket { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 34rem; margin: 0 auto; }

.ticket { max-width: 34rem; margin: 0 auto 24px; padding: 24px; background: var(--s-cartao); border-radius: var(--r-3);
  border: 1px solid var(--s-linha); text-align: center; }
.ticket .rotulo { font: 700 1.125rem/1 var(--sinal); text-transform: uppercase; letter-spacing: 0.08em; color: var(--s-texto); }
.ticket .codigo { margin: 12px 0 8px; font: 800 7rem/0.9 var(--sinal); letter-spacing: 0.02em; color: var(--s-titulo); }
.ticket .servico-nome { font: 700 1.5rem/1.1 var(--sinal); text-transform: uppercase; }
.ticket .rodape-ticket { margin: 20px -24px -24px; padding: 16px 24px; border-top: 2px dashed var(--s-linha-forte); color: var(--s-texto); }
.ticket .rodape-ticket p { margin: 0; color: inherit; }
.ticket .rodape-ticket b { font-size: 1.25rem; color: var(--s-titulo); }
body.publico :focus-visible { box-shadow: 0 0 0 4px var(--s-destaque); }

/* Rodapé público: mensageiro */
.rodape-publico { display: flex; align-items: center; gap: 16px; min-height: 3.25rem; padding: 0 24px; background: var(--s-barra); color: var(--s-sobre-barra); }
.rotulo-avisos { flex: none; padding: 2px 8px; border-radius: var(--r-1); background: var(--s-destaque); color: var(--s-sobre-destaque);
  font: 800 1rem/1.3 var(--sinal); text-transform: uppercase; letter-spacing: 0.04em; }
.mensageiro { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; font-size: 1.125rem; }
.mensageiro span { display: inline-block; padding-left: 100%; animation: rolar var(--duracao, 30s) linear infinite; }
.mensageiro.parado span { padding-left: 0; animation: none; }
.versao { font: 400 0.75rem var(--mono); color: var(--s-sobre-barra-2); white-space: nowrap; }
@keyframes rolar { to { transform: translateX(-100%); } }

/* Alto contraste */
html.contraste body.publico, html.contraste .totem-topo, html.contraste .servico, html.contraste .ticket,
html.contraste .rodape-publico { background: #000 !important; color: #fff !important; border-color: #fff !important; }
html.contraste .servico h2, html.contraste .instrucao, html.contraste .ticket .codigo, html.contraste .ticket .servico-nome,
html.contraste .ticket .rodape-ticket b { color: #fff !important; }
html.contraste .servico p, html.contraste .nota, html.contraste .ticket .rotulo, html.contraste .ticket .rodape-ticket { color: #fff !important; }
html.contraste .instrucao b { color: var(--amarelo) !important; }
html.contraste .btn-totem { background: var(--amarelo) !important; color: #000 !important; box-shadow: inset 0 0 0 3px #fff; }
html.contraste .btn-totem.pref { background: #fff !important; }

/* ---------- Painel da TV: quadro de chamadas ---------- */
body.tv { background: var(--s-tv-fundo); color: var(--s-tv-texto); overflow: hidden; }
.tv .palco { display: grid; grid-template-columns: 3fr 2fr; height: calc(100vh - 3.25rem); }
.tv .destaque { display: flex; flex-direction: column; justify-content: center; padding: 4vh 4vw; border-right: 1px solid var(--s-tv-linha); }
.tv .destaque .rotulo { font: 700 2.4vw/1 var(--sinal); text-transform: uppercase; letter-spacing: 0.1em; color: var(--s-tv-suave); }
.tv .destaque .codigo { margin: 1vh 0 3vh; font: 800 19vw/0.85 var(--sinal); letter-spacing: 0.01em; color: var(--s-tv-codigo); }
.tv .destaque .codigo.pref { color: var(--s-tv-pref); }
.tv .destaque .guiche { align-self: flex-start; padding: 0.6vw 1.4vw; border-radius: 0.6vw;
  background: var(--s-tv-chip); color: var(--s-tv-sobre-chip); font: 800 5vw/1 var(--sinal); text-transform: uppercase; }
.tv .destaque.pisca .codigo { animation: pisca 1s var(--ease) 3; }
.tv .historico { display: flex; flex-direction: column; padding: 4vh 3vw; background: var(--s-tv-lateral); }
.tv .historico h2 { margin: 0 0 2vh; font: 700 1.8vw/1 var(--sinal); text-transform: uppercase; letter-spacing: 0.1em; color: var(--s-tv-suave); }
.tv .historico ul { list-style: none; margin: 0; padding: 0; }
.tv .historico li { display: flex; justify-content: space-between; align-items: baseline; padding: 1.6vh 0;
  border-bottom: 1px solid var(--s-tv-linha); font: 800 3.6vw/1 var(--sinal); text-transform: uppercase; }
.tv .historico li span:last-child { font-size: 2.4vw; color: var(--s-tv-texto-2); }
.tv .historico .vazio { font: 700 1.6vw var(--sinal); text-transform: uppercase; color: var(--s-tv-tenue); }
.tv .pref { color: var(--s-tv-pref); }
.tv .relogio { position: fixed; right: 3vw; top: 3vh; font: 700 2.6vw/1 var(--sinal); color: var(--s-tv-texto-2); letter-spacing: 0.04em; }
.tv .ativar { position: fixed; inset: 0; display: grid; place-items: center; background: var(--s-tv-veu);
  font: 700 2.5vw var(--sinal); text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer; }
@keyframes pisca { 50% { opacity: 0.15; } }

@media (prefers-reduced-motion: reduce) {
  .mensageiro span { animation: none; padding-left: 0; }
  .tv .destaque.pisca .codigo { animation: none; }
  * { transition: none !important; }
}

/* ---------- Telas estreitas ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; background: none; }
  .busca { min-width: 0; flex: 1; }
  .lateral { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 12px;
    border-right: 0; border-bottom: 1px solid var(--borda); }
  .marca { padding: 4px 8px; }
  .marca small { display: none; }
  .nav-rotulo { display: none; }
  .nav-item span { display: none; }
  .usuario { margin: 0 0 0 auto; padding: 0; border: 0; }
  .usuario div { display: none; }
  .conteudo { padding: 16px; }
  .grade[style] { grid-template-columns: 1fr !important; }
}
@media (max-width: 640px) {
  .totem-topo { padding: 12px 16px; }
  .relogio-totem { text-align: left; }
  .totem { padding: 24px 16px; }
  .tv .palco { grid-template-columns: 1fr; }
}

/* =============================================================================
   Temas das telas da equipe (Configurações → Aparência)
   Paletas vindas de lorentz-vps-stack/config/settings.lorentz-*.json
   ============================================================================= */
:root[data-tema="lorentz-light"] {
  --fundo: #f4f8fc; --superficie: #ffffff; --superficie-2: #e9f1f8; --lateral: #e6eff7;
  --borda: #c2d5e5; --borda-sutil: #dbe7f1;
  --texto: #0b1626; --texto-2: #355169; --suave: #4f7089; --tenue: #8fa9be;
  --acento: #356486; --acento-forte: #2a5575; --acento-fundo: #d2e1ef;
  --ok: #1f7a45; --alerta: #8a5a0a; --erro: #a93f3c; --pref: #6b4fa0;
  --ok-fundo: #e3f4ea; --alerta-fundo: #fbf0dc; --erro-fundo: #f8e4e3; --pref-fundo: #ece6f6; --neutro-fundo: #e9f1f8;
  --trilho: #c2d5e5; --grafico-barra: #c2d5e5; --foco: 0 0 0 3px rgba(94, 151, 188, 0.35);
}
:root[data-tema="lorentz-dark"] {
  --fundo: #05080f; --superficie: #0b1626; --superficie-2: #15263d; --lateral: #0b1626;
  --borda: #34546f; --borda-sutil: #1a2e48;
  --texto: #e7f1f9; --texto-2: #aac6da; --suave: #7f9fb8; --tenue: #5b7e98;
  --acento: #5289b2; --acento-forte: #9fd0ec; --acento-fundo: #22405f;
  --ok: #6fd08a; --alerta: #d9a857; --erro: #d27878; --pref: #b79cf0;
  --ok-fundo: #143327; --alerta-fundo: #33291a; --erro-fundo: #3a1f24; --pref-fundo: #2a2346; --neutro-fundo: #15263d;
  --trilho: #34546f; --grafico-barra: #34546f; --foco: 0 0 0 3px rgba(127, 176, 204, 0.4);
  --sobre-acento: #05080f; --sobre-ok: #05080f; --sobre-erro: #05080f;
  color-scheme: dark;
}
:root[data-tema="lorentz-night-green-forest"] {
  --fundo: #040c07; --superficie: #081410; --superficie-2: #0d1f18; --lateral: #081410;
  --borda: #1e3d2e; --borda-sutil: #122b21;
  --texto: #d8f0e4; --texto-2: #9ccdb2; --suave: #6dab89; --tenue: #4a7a62;
  --acento: #1aad64; --acento-forte: #4ee87a; --acento-fundo: #122b21;
  --ok: #4ee87a; --alerta: #d9c857; --erro: #e05c5c; --pref: #b79cf0;
  --ok-fundo: #10301f; --alerta-fundo: #2c2a14; --erro-fundo: #341818; --pref-fundo: #241f3a; --neutro-fundo: #0d1f18;
  --trilho: #1e3d2e; --grafico-barra: #1e3d2e; --foco: 0 0 0 3px rgba(34, 201, 122, 0.35);
  --sobre-acento: #040c07; --sobre-ok: #040c07; --sobre-erro: #040c07;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-tema="auto"] {
    --fundo: #05080f; --superficie: #0b1626; --superficie-2: #15263d; --lateral: #0b1626;
    --borda: #34546f; --borda-sutil: #1a2e48;
    --texto: #e7f1f9; --texto-2: #aac6da; --suave: #7f9fb8; --tenue: #5b7e98;
    --acento: #5289b2; --acento-forte: #9fd0ec; --acento-fundo: #22405f;
    --ok: #6fd08a; --alerta: #d9a857; --erro: #d27878; --pref: #b79cf0;
    --ok-fundo: #143327; --alerta-fundo: #33291a; --erro-fundo: #3a1f24; --pref-fundo: #2a2346; --neutro-fundo: #15263d;
    --trilho: #34546f; --grafico-barra: #34546f; --foco: 0 0 0 3px rgba(127, 176, 204, 0.4);
  --sobre-acento: #05080f; --sobre-ok: #05080f; --sobre-erro: #05080f;
    color-scheme: dark;
  }
}
/* em tema escuro, a seta do select e o selo da marca precisam de contraste */
:root[data-tema="lorentz-dark"] select, :root[data-tema="lorentz-night-green-forest"] select { background-color: var(--superficie-2); }
:root[data-tema="lorentz-dark"] .marca .selo, :root[data-tema="lorentz-night-green-forest"] .marca .selo { box-shadow: inset 0 0 0 1px var(--borda); }

/* ---------- Tela de Configurações ---------- */
.ajustes h2 { margin-bottom: 4px; }
.ajuste { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start;
  padding: 12px 0; border-top: 1px solid var(--borda-sutil); }
.ajuste:first-of-type { border-top: 0; }
.ajuste label { display: flex; align-items: center; gap: 8px; margin: 0; }
.ajuste-texto .legenda { margin-top: 4px; }
.ajuste-campo { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.ajuste-campo select { min-width: 14rem; }
.com-unidade { display: inline-flex; align-items: center; gap: 8px; color: var(--suave); }
.com-unidade input { width: 6rem; font-family: var(--mono); }
.ajuste:has(.temas) { grid-template-columns: 1fr; }
.temas { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); width: 100%; }
.tema-opcao { display: flex !important; flex-direction: column; align-items: flex-start !important; gap: 4px !important; padding: 12px;
  border: 1px solid var(--borda); border-radius: var(--r-3); background: var(--superficie); cursor: pointer; font-weight: 400 !important; }
.tema-opcao:has(input:checked) { border-color: var(--acento); box-shadow: var(--foco); }
.tema-opcao input { position: absolute; opacity: 0; pointer-events: none; }
.tema-opcao b { font-weight: 500; color: var(--texto); }
.tema-opcao small { font-size: 0.75rem; }
.amostra { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; height: 28px; border-radius: var(--r-2); overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--borda-sutil); margin-bottom: 4px; }
.interruptor-campo { position: relative; display: inline-flex !important; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.interruptor-campo input { appearance: none; width: 32px; height: 18px; margin: 0; border-radius: 9px; background: var(--trilho);
  position: relative; cursor: pointer; transition: background 150ms var(--ease); }
.interruptor-campo input::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: transform 150ms var(--ease); }
.interruptor-campo input:checked { background: var(--ok); }
.interruptor-campo input:checked::after { transform: translateX(14px); }
.barra-salvar { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--borda); border-radius: var(--r-3); background: var(--superficie); }

/* ---------- Monitor: controle de atualização ---------- */
.atualizacao { display: inline-flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--suave); }
.atualizacao .pulso { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.atualizacao.pausado .pulso { background: var(--tenue); }
.atualizacao button { height: 24px; padding: 0 8px; font-size: 0.75rem; }
@media (max-width: 640px) { .ajuste { grid-template-columns: 1fr; } }

/* ---------- Fase 1: cadastros, fila de espera, troca de unidade ---------- */
.abas { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
.abas a { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r-2);
  color: var(--texto-2); font-weight: 500; font-size: 0.8125rem; }
.abas a:hover { background: var(--neutro-fundo); text-decoration: none; }
.abas a.ativo { background: var(--acento-fundo); color: var(--acento-forte); }
.abas a b { font: 500 0.75rem var(--mono); color: var(--suave); }
.filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
form.card.filtros { padding: 12px; }
.form-grade { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.form-grade .largo { grid-column: 1 / -1; }
.campo input:not([type="checkbox"]):not([type="radio"]), .campo select { width: 100%; }
.marcas { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 12px; }
.marcas label { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-weight: 400; }
.lista-marcas { display: grid; gap: 4px 16px; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.lista-marcas label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 0; font-weight: 400; }
.lista-marcas input[type="number"] { width: 4.5rem; margin-left: auto; }
form.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; flex-wrap: wrap; }
tr.inativo td { color: var(--suave); }
td small { display: block; }
td.cod, td a.cod { white-space: nowrap; }
.usuario small a { color: var(--suave); text-decoration: underline; }
.troca-unidade { margin: -8px 0 12px; }
.troca-unidade select { width: 100%; }
.espera-fora { color: var(--erro); font-weight: 500; }
.zona-perigo { border-color: rgba(180, 35, 24, 0.30); }
.zona-perigo h2 { color: var(--erro); }
.campo > small.legenda { display: block; margin-top: 4px; }
.campo .com-unidade input { width: 6rem; }

/* ---------- Fase 2: relatórios e impressão ---------- */
.relatorio tfoot td { font-weight: 600; border-top: 1px solid var(--borda); background: var(--superficie-2); }
.so-impressao { display: none; }
section.card.inativo { opacity: 0.65; }
@media print {
  .lateral, .so-tela, .rodape-staff, .aviso, .paginacao { display: none !important; }
  .app { display: block; background: none; }
  body { background: #fff; color: #000; font-size: 10pt; }
  .conteudo { padding: 0; max-width: none; }
  .so-impressao { display: block; margin-bottom: 8px; }
  .conteudo > .cabecalho { display: none; }
  .card { border: 0; padding: 0 !important; overflow: visible; }
  th, td { padding: 3px 6px; }
  tr { break-inside: avoid; }
}

label.marcas { align-items: center; gap: 6px; }

/* ---------- Pedidos de pausa ---------- */
.nav-item .contador { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px;
  background: var(--erro); color: var(--sobre-erro); font: 500 0.6875rem/18px var(--mono); text-align: center; }
.pedidos-pausa { border-color: var(--alerta); box-shadow: inset 3px 0 0 var(--alerta); }
.pedidos-pausa[hidden] { display: none; }

/* ---------- Monitor: pendente nas filas ---------- */
.kpi.na-fila { border-color: var(--acento); box-shadow: inset 3px 0 0 var(--acento); }
.kpi.na-fila.vazia { border-color: var(--borda); box-shadow: none; }
.kpi.na-fila .pref-total { display: inline-flex; align-items: baseline; gap: 4px; margin-top: 8px; padding: 2px 8px;
  border-radius: 999px; background: var(--pref-fundo); color: var(--pref); font: 500 0.75rem var(--sans, inherit); font-style: normal; }
.kpi.na-fila .pref-total b { display: inline; font: 600 0.8125rem var(--mono); letter-spacing: 0; }

/* =============================================================================
   Temas de sinalização: painel da TV e totem (Configurações → Aparência)
   ============================================================================= */
:root[data-sinal="lorentz-dark"] {
  --s-fundo: #05080f; --s-cartao: #0b1626; --s-linha: #1a2e48; --s-linha-forte: #34546f;
  --s-titulo: #e7f1f9; --s-texto: #aac6da; --s-acento: #9fd0ec;
  --s-barra: #0b1626; --s-sobre-barra: #e7f1f9; --s-sobre-barra-2: #aac6da; --s-barra-linha: #34546f;
  --s-destaque: #9fd0ec; --s-sobre-destaque: #05080f;
  --s-botao: #356486; --s-botao-hover: #4e83ac; --s-sobre-botao: #ffffff; --s-pref: #6b4fa0; --s-pref-hover: #7d60b4;
  --s-tv-fundo: #05080f; --s-tv-lateral: #0b1626; --s-tv-texto: #e7f1f9; --s-tv-texto-2: #aac6da;
  --s-tv-suave: #7f9fb8; --s-tv-tenue: #4a6a85; --s-tv-linha: #1a2e48;
  --s-tv-codigo: #9fd0ec; --s-tv-pref: #b79cf0; --s-tv-chip: #e7f1f9; --s-tv-sobre-chip: #05080f; --s-tv-veu: rgba(5, 8, 15, 0.92);
  color-scheme: dark;
}
:root[data-sinal="lorentz-light"] {
  --s-fundo: #e6eff7; --s-cartao: #ffffff; --s-linha: #c2d5e5; --s-linha-forte: #8fa9be;
  --s-titulo: #0b1626; --s-texto: #355169; --s-acento: #356486;
  --s-barra: #1d3f5c; --s-sobre-barra: #ffffff; --s-sobre-barra-2: #d2e1ef; --s-barra-linha: rgba(255, 255, 255, 0.4);
  --s-destaque: #9fd0ec; --s-sobre-destaque: #0b1626;
  --s-botao: #356486; --s-botao-hover: #2a5575; --s-sobre-botao: #ffffff; --s-pref: #6b4fa0; --s-pref-hover: #5a3f8c;
  --s-tv-fundo: #f4f8fc; --s-tv-lateral: #e6eff7; --s-tv-texto: #0b1626; --s-tv-texto-2: #355169;
  --s-tv-suave: #5b7e98; --s-tv-tenue: #8fa9be; --s-tv-linha: #c2d5e5;
  --s-tv-codigo: #1d3f5c; --s-tv-pref: #6b4fa0; --s-tv-chip: #1d3f5c; --s-tv-sobre-chip: #ffffff; --s-tv-veu: rgba(244, 248, 252, 0.94);
}
:root[data-sinal="lorentz-night-green-forest"] {
  --s-fundo: #040c07; --s-cartao: #081410; --s-linha: #122b21; --s-linha-forte: #1e3d2e;
  --s-titulo: #d8f0e4; --s-texto: #9ccdb2; --s-acento: #4ee87a;
  --s-barra: #081410; --s-sobre-barra: #d8f0e4; --s-sobre-barra-2: #9ccdb2; --s-barra-linha: #1e3d2e;
  --s-destaque: #4ee87a; --s-sobre-destaque: #040c07;
  --s-botao: #0f6b3d; --s-botao-hover: #14824b; --s-sobre-botao: #ffffff; --s-pref: #6b4fa0; --s-pref-hover: #7d60b4;
  --s-tv-fundo: #040c07; --s-tv-lateral: #081410; --s-tv-texto: #d8f0e4; --s-tv-texto-2: #9ccdb2;
  --s-tv-suave: #6dab89; --s-tv-tenue: #4a7a62; --s-tv-linha: #122b21;
  --s-tv-codigo: #4ee87a; --s-tv-pref: #b79cf0; --s-tv-chip: #d8f0e4; --s-tv-sobre-chip: #040c07; --s-tv-veu: rgba(4, 12, 7, 0.92);
  color-scheme: dark;
}
