/* RPS Checklist — telas do tablet (10", uso em pé, luz variável). Dark, alto contraste, sem hover. */
:root {
  --ca-bg: #0d1017;
  --ca-surface: #161b27;
  --ca-surface2: #1f2636;
  --ca-surface3: #2a3348;
  --ca-text: #f1f3f8;
  --ca-text2: #aab2c5;
  --ca-text3: #7d869b;
  --ca-border: rgba(255, 255, 255, 0.09);
  --ca-border2: rgba(255, 255, 255, 0.18);
  --ca-border3: rgba(255, 255, 255, 0.32);
  --ca-blue: #5fb0ff;
  --ca-blue-dark: #1a3a6b;
  --ca-blue-bg: rgba(95, 176, 255, 0.16);
  --ca-n: #3ddc72;
  --ca-n-bg: rgba(61, 220, 114, 0.17);
  --ca-f: #ffb020;
  --ca-f-bg: rgba(255, 176, 32, 0.17);
  --ca-t: #ff5a4f;
  --ca-t-bg: rgba(255, 90, 79, 0.18);
  --ca-tec: #c79bff;
  --ca-tec-bg: rgba(199, 155, 255, 0.16);
  --altura-hdr: 60px;
  --altura-rodape: 82px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ca-text);
  background: var(--ca-bg);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
a { color: var(--ca-blue); }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.hdr {
  position: fixed; inset: 0 0 auto 0; height: var(--altura-hdr); z-index: 100;
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: var(--ca-surface); border-bottom: 1px solid var(--ca-border2);
}
.hdr-logo { height: 34px; display: block; }
.hdr-titulo { font-size: 15px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--ca-blue); }
.hdr-mid { flex: 1; min-width: 0; }
.hdr-sub { font-size: 12px; color: var(--ca-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-placa { font-size: 20px; font-weight: 800; letter-spacing: 1.5px; color: #fff; }
.hdr-right { display: flex; align-items: center; gap: 10px; }
.hdr-menu { position: relative; }
/* "pill" de identidade do operador logado (avatar + nome + badges de cargo); não compete com os botões de ação */
.hdr-id {
  display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 48px; padding: 5px 14px 5px 6px;
  border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid var(--ca-border2);
  color: var(--ca-text); font: inherit; text-align: left;
}
button.hdr-id { cursor: pointer; }
button.hdr-id:active { background: var(--ca-surface3); }
.hdr-avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--ca-blue); color: #04121f; font-size: 14px; font-weight: 800; letter-spacing: .3px;
}
.hdr-id-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hdr-id-nome { max-width: 200px; font-size: 15px; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-id-cargos { display: flex; gap: 4px; }
.hdr-id-cargos .tag { padding: 1px 7px; line-height: 1.45; white-space: nowrap; }
.hdr-id-seta { flex: none; font-size: 14px; color: var(--ca-text2); }
.hdr-menu-lista {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; z-index: 110; padding: 6px;
  background: var(--ca-surface2); border: 1.5px solid var(--ca-border3); border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .5);
}
.hdr-menu-item {
  display: flex; align-items: center; width: 100%; min-height: 52px; padding: 0 16px; border: 0; border-radius: 10px;
  background: none; color: var(--ca-text); font-size: 15px; font-weight: 700; text-align: left; text-decoration: none; cursor: pointer;
}
.hdr-menu-item:active { background: var(--ca-surface3); }
.hdr-menu-item[disabled] { opacity: .42; cursor: not-allowed; }

.page { min-height: 100vh; padding: calc(var(--altura-hdr) + 14px) 16px 40px; }
.page.com-rodape { padding-bottom: calc(var(--altura-rodape) + 24px); }
.content { max-width: 1040px; margin: 0 auto; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 14px; cursor: pointer;
  border: 1.5px solid var(--ca-border3); background: var(--ca-surface2); color: var(--ca-text);
  font-size: 15px; font-weight: 700; text-decoration: none; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ca-blue); border-color: var(--ca-blue); color: #04121f; }
.btn-verde { background: var(--ca-n); border-color: var(--ca-n); color: #03210f; }
.btn-perigo { border-color: var(--ca-t); color: var(--ca-t); background: transparent; }
/* secundário discreto: contorno fino, sem preenchimento, cor neutra (ex.: "Gestão", pra não ser tocado sem querer) */
.btn-ghost { background: transparent; border: 1px solid var(--ca-border2); color: var(--ca-text2); font-weight: 600; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn[disabled], .btn.desabilitado { opacity: .42; cursor: not-allowed; transform: none; }

/* ---------- cards / campos ---------- */
.card { background: var(--ca-surface); border: 1px solid var(--ca-border); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.card-titulo { margin: 0 0 12px; font-size: 13px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--ca-blue); }
.grade { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grade.tres { grid-template-columns: repeat(3, 1fr); }
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo.cheio { grid-column: 1 / -1; }
.rotulo { font-size: 11px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; color: var(--ca-text2); }
.finput {
  width: 100%; min-height: 54px; padding: 12px 16px; border-radius: 12px; outline: none;
  background: var(--ca-surface2); color: var(--ca-text); font-size: 17px;
  border: 1.5px solid var(--ca-border2); -webkit-appearance: none; appearance: none;
}
.finput:focus { border-color: var(--ca-blue); box-shadow: 0 0 0 3px var(--ca-blue-bg); }
.finput::placeholder { color: var(--ca-text3); }
/* Campos de identificação curtos: só exibição — o servidor grava em caixa alta de verdade. */
.caixa-alta { text-transform: uppercase; }
.caixa-alta::placeholder { text-transform: none; }
.finput.erro { border-color: var(--ca-t); }
textarea.finput { min-height: 110px; resize: vertical; }
select.finput { background-image: linear-gradient(45deg, transparent 50%, var(--ca-text2) 50%), linear-gradient(135deg, var(--ca-text2) 50%, transparent 50%); background-position: calc(100% - 22px) 24px, calc(100% - 16px) 24px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.ajuda { font-size: 13px; color: var(--ca-text2); }
.filial-info { margin: 0 0 12px; }
.aviso { border-radius: 12px; padding: 12px 14px; font-size: 14px; border: 1.5px solid var(--ca-f); background: var(--ca-f-bg); color: var(--ca-text); }
.aviso.erro { border-color: var(--ca-t); background: var(--ca-t-bg); }
.aviso.ok { border-color: var(--ca-n); background: var(--ca-n-bg); }
.aviso.info { border-color: var(--ca-blue); background: var(--ca-blue-bg); }
.aviso + .aviso, .aviso + .card, .card + .aviso { margin-top: 12px; }

/* ---------- busca de cliente ---------- */
.linha-busca { display: flex; gap: 10px; }
.linha-busca .finput { flex: 1; }
/* Resultados: painel flutuante sobre a página (não empurra Nome/CPF); z-index abaixo do cabeçalho (100). */
.busca-cliente { position: relative; }
.resultados {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 95; max-height: min(52vh, 420px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--ca-surface3); border: 1.5px solid var(--ca-border3); border-top: 3px solid var(--ca-blue); border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .75), 0 4px 12px rgba(0, 0, 0, .5);
}
.resultados[hidden] { display: none; }
.resultado { display: block; text-align: left; width: 100%; min-height: 56px; padding: 10px 16px; cursor: pointer; background: none; border: 0; border-bottom: 1px solid var(--ca-border2); }
.resultado:last-child { border-bottom: 0; }
.resultado:active, .resultado:hover { background: var(--ca-blue-bg); }
.resultado b { display: block; font-size: 16px; }
.resultado span { font-size: 13px; color: var(--ca-text2); }
.resultados-msg { padding: 14px 16px; font-size: 14px; color: var(--ca-text2); }

/* ---------- medida do pneu: toggle por eixo + autocomplete (assets/js/medida-pneu.js) ---------- */
.medida-toggle { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 6px; font-size: 15px; cursor: pointer; }
.medida-toggle input { width: 24px; height: 24px; flex: none; accent-color: var(--ca-blue); }
.medida-pneu .campo[hidden] { display: none; }
.ac { position: relative; }
.sugestoes {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 95; overflow: hidden;
  background: var(--ca-surface3); border: 1.5px solid var(--ca-border3); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.sugestoes[hidden] { display: none; }
.sugestao { display: block; width: 100%; min-height: 48px; padding: 0 16px; text-align: left; font: inherit; font-size: 16px; font-weight: 700; color: var(--ca-text); background: none; border: 0; border-bottom: 1px solid var(--ca-border); cursor: pointer; }
.sugestao:last-child { border-bottom: 0; }
.sugestao:active, .sugestao:hover { background: var(--ca-blue-bg); }

/* ---------- pills de seções ---------- */
.barra-passos {
  position: sticky; top: var(--altura-hdr); z-index: 90; margin: 0 -16px 14px; padding: 10px 16px;
  background: var(--ca-bg); border-bottom: 1px solid var(--ca-border);
  display: flex; align-items: center; gap: 12px;
}
.pills-wrap { position: relative; flex: 1; min-width: 0; }
.pills {
  position: relative; /* offsetParent das pills: a centralização da pill ativa usa offsetLeft */
  display: flex; gap: 8px; padding-bottom: 2px; scrollbar-width: none;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  /* Pan horizontal e vertical liberados aqui e em cada pill; o gesto nunca é reivindicado por um
     ancestral. overscroll-behavior-x evita que o fim da barra dispare o "voltar" do navegador. */
  touch-action: pan-x pan-y; overscroll-behavior-x: contain;
}
.pills::-webkit-scrollbar { display: none; }
.pills > .pill { touch-action: pan-x pan-y; }
/* Com Pointer Events o arraste é feito por JS (dedo e mouse): o navegador não pode reivindicar o gesto. */
.pills.pills-arrasto, .pills.pills-arrasto > .pill { touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
.pills.arrastando, .pills.arrastando > .pill { cursor: grabbing; }
/* Setas de "há mais seções desse lado" (só aparecem com conteúdo escondido), com fade na borda. */
.pills-seta {
  position: absolute; top: 0; bottom: 2px; z-index: 2; width: 52px; padding: 0; border: 0; cursor: pointer;
  font-size: 34px; line-height: 1; font-weight: 700; color: var(--ca-text); display: flex; align-items: center;
}
.pills-seta.esq { left: 0; justify-content: flex-start; padding-left: 6px; background: linear-gradient(to right, var(--ca-bg) 45%, transparent); }
.pills-seta.dir { right: 0; justify-content: flex-end; padding-right: 6px; background: linear-gradient(to left, var(--ca-bg) 45%, transparent); }
.pill {
  flex: 0 0 auto; min-height: 46px; padding: 0 16px; border-radius: 23px; cursor: pointer;
  border: 1.5px solid var(--ca-border2); background: var(--ca-surface); color: var(--ca-text2);
  font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.pill.ativo { background: var(--ca-blue); border-color: var(--ca-blue); color: #04121f; }
.pill.tecnico { border-color: var(--ca-tec); color: var(--ca-tec); }
.pill.tecnico.ativo { background: var(--ca-tec); color: #1b0838; }
.pill .marca, .nav-atual .marca, .folha-passo .marca { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--ca-text3); }
.pill .marca.feito, .nav-atual .marca.feito, .folha-passo .marca.feito { background: var(--ca-n); }
.pill .marca.pendente, .nav-atual .marca.pendente, .folha-passo .marca.pendente { background: var(--ca-f); }
.pill.ativo .marca { box-shadow: 0 0 0 2px rgba(0, 0, 0, .25); }
.alternador { display: flex; flex: 0 0 auto; margin-left: auto; border: 1.5px solid var(--ca-border2); border-radius: 23px; overflow: hidden; }
.alternador button { display: inline-flex; align-items: center; justify-content: center; width: 46px; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--ca-text2); cursor: pointer; }
.alternador button + button { border-left: 1px solid var(--ca-border2); }
.alternador button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.alternador button.ativo { background: var(--ca-surface3); color: var(--ca-text); }
/* Seletor de seção de celular (public/preenchimento.php): escondido aqui; o bloco @media (max-width: 480px) o liga. */
.nav-secao { display: none; }
/* Modo "Obrigatórios": sem seção ativa, a barra de pills some e só o alternador fica. */
.pills-wrap[hidden] { display: none; }

/* ---------- seções e itens ---------- */
.secao { scroll-margin-top: calc(var(--altura-hdr) + 76px); margin-bottom: 22px; }
.secao-titulo { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 14px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--ca-blue); }
.secao-titulo.tecnica { color: var(--ca-tec); }
.btn-marcar-normal { margin-left: auto; text-transform: none; letter-spacing: 0; }
.tag { font-size: 10px; font-weight: 800; letter-spacing: .5px; padding: 3px 8px; border-radius: 10px; background: var(--ca-surface3); color: var(--ca-text2); text-transform: uppercase; }
.tag.obrig { background: var(--ca-f-bg); color: var(--ca-f); }
.tag.tec { background: var(--ca-tec-bg); color: var(--ca-tec); }
.tag.sup { background: var(--ca-n-bg); color: var(--ca-n); }

.item {
  background: var(--ca-surface); border: 1.5px solid var(--ca-border); border-radius: 16px;
  padding: 14px 16px; margin-bottom: 10px;
}
.item.sel-n { border-color: rgba(61, 220, 114, .5); }
.item.sel-f { border-color: rgba(255, 176, 32, .55); }
.item.sel-t { border-color: rgba(255, 90, 79, .6); }
.item.pendente-obrig { border-left: 5px solid var(--ca-f); }
.item-topo { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.item-nome { flex: 1; font-size: 17px; font-weight: 600; min-width: 0; }
.item-nome small { display: block; font-size: 12px; font-weight: 600; color: var(--ca-text3); }
.item-pos { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px dashed var(--ca-border); }
.item-pos:first-of-type { border-top: 0; }
.item-pos .pos-nome { flex: 0 0 132px; font-size: 14px; font-weight: 700; color: var(--ca-text2); }
.item-pos .pos-ctl { flex: 1; display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.quem { font-size: 11px; color: var(--ca-text3); margin-top: 4px; }

.nft-group { display: flex; gap: 8px; }
.btn-nft {
  width: 68px; min-height: 54px; border-radius: 13px; cursor: pointer; font-size: 19px; font-weight: 800;
  background: var(--ca-surface2); color: var(--ca-text2); border: 2px solid var(--ca-border2);
  display: flex; align-items: center; justify-content: center; user-select: none;
}
.btn-nft:active { transform: scale(.94); }
.btn-nft.ativo-n { background: var(--ca-n-bg); border-color: var(--ca-n); color: var(--ca-n); }
.btn-nft.ativo-f { background: var(--ca-f-bg); border-color: var(--ca-f); color: var(--ca-f); }
.btn-nft.ativo-t { background: var(--ca-t-bg); border-color: var(--ca-t); color: var(--ca-t); }
.legenda-nft { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ca-text2); margin: 0 0 12px; }
.legenda-nft b { display: inline-flex; width: 26px; height: 26px; border-radius: 8px; align-items: center; justify-content: center; margin-right: 6px; }
.legenda-nft .n { background: var(--ca-n-bg); color: var(--ca-n); }
.legenda-nft .f { background: var(--ca-f-bg); color: var(--ca-f); }
.legenda-nft .t { background: var(--ca-t-bg); color: var(--ca-t); }

.numero { width: 130px; text-align: center; font-weight: 700; }

/* combustível: medidor analógico (só exibição) + paradas grandes, sem input[type=range] */
.medidor { display: block; width: 100%; max-width: 300px; margin: 6px auto 0; }
.medidor-arco { fill: none; stroke: var(--ca-border3); stroke-width: 10; }
.medidor-arco.aviso { stroke: var(--ca-t); opacity: .75; }
.medidor-marca { stroke: var(--ca-text3); stroke-width: 2; stroke-linecap: round; }
.medidor-marca.ativo { stroke: var(--ca-blue); }
.medidor-rotulo { fill: var(--ca-text3); font-size: 12px; font-weight: 700; text-anchor: middle; dominant-baseline: middle; }
.medidor-rotulo.ativo { fill: var(--ca-blue); }
.medidor-ponteiro { stroke: var(--ca-text); stroke-width: 4; stroke-linecap: round; }
.medidor-eixo { fill: var(--ca-text); }
.combustivel-dica { margin: 2px 0 0; text-align: center; font-size: 12px; color: var(--ca-text3); }
.combustivel { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.combustivel button {
  min-height: 64px; border-radius: 13px; cursor: pointer; font-weight: 800; font-size: 15px;
  background: var(--ca-surface2); color: var(--ca-text2); border: 2px solid var(--ca-border2);
}
.combustivel button.ativo { background: var(--ca-blue-bg); border-color: var(--ca-blue); color: var(--ca-blue); }
.combustivel button.ate { background: var(--ca-blue-bg); border-color: rgba(95, 176, 255, .45); color: var(--ca-text); }

/* fotos */
.btn-foto { width: 54px; min-height: 54px; padding: 0; border-radius: 13px; position: relative; }
.btn-foto svg { width: 26px; height: 26px; }
.btn-foto .n-fotos { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--ca-blue); color: #04121f; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.miniaturas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mini { position: relative; width: 96px; height: 96px; border-radius: 12px; overflow: hidden; border: 1.5px solid var(--ca-border2); background: var(--ca-surface2); }
.mini img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.mini .x { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .72); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.mini.enviando::after { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, .55) center / 30px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M12 3a9 9 0 1 0 9 9' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='0.9s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E"); }

/* mapa de avarias */
.mapa-abas { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.mapa-palco { position: relative; max-width: 620px; margin: 0 auto; background: #f8fafc; border-radius: 14px; border: 2px solid var(--ca-border3); overflow: hidden; touch-action: manipulation; user-select: none; }
.mapa-palco img { display: block; width: 100%; height: auto; pointer-events: none; }
.marca-avaria { position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; background: #dc2626; color: #fff; border: 3px solid #fff; font-weight: 800; font-size: 16px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); padding: 0; }
.marca-avaria.sel { outline: 4px solid var(--ca-blue); }
.marca-avaria.pendente { opacity: .55; }
.lista-avarias { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.avaria-linha { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--ca-surface2); border: 1.5px solid var(--ca-border); }
.avaria-linha.sel { border-color: var(--ca-blue); }
.avaria-num { flex: 0 0 34px; height: 34px; border-radius: 50%; background: #dc2626; color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.avaria-linha .finput { min-height: 46px; font-size: 15px; }

/* ---------- rodapé fixo ---------- */
.rodape {
  position: fixed; inset: auto 0 0 0; z-index: 100; min-height: var(--altura-rodape);
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--ca-surface); border-top: 1px solid var(--ca-border2);
}
.rodape .btn { flex: 0 0 auto; }
.rodape .btn-primary, .rodape .btn-verde { flex: 1; }
.rodape-info { flex: 1; font-size: 13px; color: var(--ca-text2); }

/* ---------- botão flutuante "Enviar PDF" (detalhe do checklist encerrado): só rola até a seção de envio ---------- */
.fab-envio {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 90; /* abaixo do cabeçalho (100), toast e modais */
  display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 20px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--ca-blue); background: var(--ca-blue); color: #04121f; font-size: 15px; font-weight: 800;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
}
.fab-envio:active { transform: scale(.97); }
.det-envio-bloco { scroll-margin-top: calc(var(--altura-hdr) + 12px); } /* o título da seção não fica sob o cabeçalho fixo */
.fab-envio.enviado { background: var(--ca-surface3); border-color: var(--ca-n); color: var(--ca-n); }

/* ---------- indicador de autosave ---------- */
.autosave {
  position: fixed; bottom: calc(var(--altura-rodape) + 12px); right: 14px; z-index: 120;
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 22px;
  font-size: 13px; font-weight: 700; background: var(--ca-surface3); border: 1.5px solid var(--ca-border3); color: var(--ca-text);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}
.autosave .ponto { width: 10px; height: 10px; border-radius: 50%; background: var(--ca-text3); }
.autosave.salvando .ponto { background: var(--ca-f); animation: pulsa 1s infinite; }
.autosave.salvo .ponto { background: var(--ca-n); }
.autosave.erro { border-color: var(--ca-t); background: var(--ca-t-bg); }
.autosave.erro .ponto { background: var(--ca-t); }
.autosave button { min-height: 34px; padding: 0 12px; border-radius: 17px; border: 1.5px solid var(--ca-t); background: var(--ca-t); color: #1c0503; font-weight: 800; cursor: pointer; }
/* "Pronto" (checklist completo) é atalho pra assinatura: só um leve destaque, sem virar botão de ação */
.autosave.pronto { cursor: pointer; border-color: var(--ca-n); }
.autosave.pronto:hover, .autosave.pronto:active { background: var(--ca-n-bg); }
.autosave.pronto:focus-visible { outline: 2px solid var(--ca-n); outline-offset: 2px; }
@keyframes pulsa { 50% { opacity: .35; } }

/* ---------- lista em andamento ---------- */
.topo-lista { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.topo-lista .finput { flex: 1; min-width: 200px; }
.topo-lista select.finput { flex: 0 0 240px; }
.abas { display: flex; gap: 8px; margin-bottom: 14px; }
.cartao-check {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 10px; border-radius: 16px;
  background: var(--ca-surface); border: 1.5px solid var(--ca-border); text-decoration: none; color: var(--ca-text);
}
.cartao-check:active { background: var(--ca-surface3); }
.cartao-check .placa { font-size: 21px; font-weight: 800; letter-spacing: 1.5px; color: #fff; min-width: 118px; }
.cartao-check .info { flex: 1; min-width: 0; }
.cartao-check .info b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cartao-check .info span { font-size: 13px; color: var(--ca-text2); }
.cartao-check .lado { text-align: right; font-size: 12px; color: var(--ca-text3); display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.cartao-check.aguardando { border-color: var(--ca-tec); }
.cartao-check.novo { animation: destaque 2.4s ease-out; }
@keyframes destaque { from { background: var(--ca-blue-bg); } to { background: var(--ca-surface); } }
.badge { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; background: var(--ca-surface3); color: var(--ca-text); }
.badge.iniciado { background: var(--ca-surface3); }
.badge.em_preenchimento { background: var(--ca-f-bg); color: var(--ca-f); }
.badge.completo { background: var(--ca-n-bg); color: var(--ca-n); }
.badge.assinado, .badge.encerrado { background: var(--ca-blue-bg); color: var(--ca-blue); }
.badge.cancelado { background: var(--ca-t-bg); color: var(--ca-t); }
.badge.aguardando-tec { background: var(--ca-tec-bg); color: var(--ca-tec); }
.vazio { text-align: center; padding: 48px 16px; color: var(--ca-text2); }
.paginacao { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 14px; font-size: 14px; color: var(--ca-text2); text-align: center; }
.paginacao[hidden] { display: none; }
.paginacao .btn { min-width: 120px; }
.paginacao .btn:disabled { opacity: .4; pointer-events: none; }
.status-poll { font-size: 12px; color: var(--ca-text3); text-align: right; margin-top: 6px; }

/* ---------- modais ---------- */
.modal-fundo { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: min(720px, 100%); max-height: 94vh; overflow: auto; background: var(--ca-surface); border: 1.5px solid var(--ca-border3); border-radius: 20px; padding: 20px; }
.modal h3 { margin: 0 0 12px; font-size: 20px; }
.modal-acoes { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.assinatura-canvas { width: 100%; height: 300px; display: block; background: #fff; border-radius: 14px; touch-action: none; border: 3px solid var(--ca-border3); }
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(0, 0, 0, .92); display: flex; align-items: center; justify-content: center; padding: 12px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--altura-rodape) + 16px); transform: translateX(-50%); z-index: 400; max-width: 92vw; padding: 12px 20px; border-radius: 14px; font-weight: 700; background: var(--ca-surface3); border: 1.5px solid var(--ca-border3); box-shadow: 0 6px 24px rgba(0, 0, 0, .55); }
.toast.erro { border-color: var(--ca-t); background: var(--ca-t-bg); }
.toast.ok { border-color: var(--ca-n); }
.toast-desfazer { display: flex; align-items: center; gap: 14px; bottom: calc(var(--altura-rodape) + 76px); }

/* ---------- detalhe (compartilhado com a gestão: ver assets/js/detalhe-view.js) ---------- */
.det-secao { margin-bottom: 18px; }
.det-secao h4 { margin: 0 0 8px; font-size: 13px; letter-spacing: .6px; text-transform: uppercase; color: var(--ca-blue); }
.det-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 16px; }
.det-grid div span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--ca-text2); }
.det-linha { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--ca-border); }
.det-linha .nome { flex: 0 0 42%; font-weight: 600; }
.det-linha .valor { flex: 1; }
.det-nft { display: inline-block; min-width: 28px; text-align: center; padding: 2px 8px; border-radius: 8px; font-weight: 800; margin-right: 6px; }
.det-nft.N { background: var(--ca-n-bg); color: var(--ca-n); }
.det-nft.F { background: var(--ca-f-bg); color: var(--ca-f); }
.det-nft.T { background: var(--ca-t-bg); color: var(--ca-t); }
.det-fotos { display: flex; flex-wrap: wrap; gap: 8px; }
.det-fotos img { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; cursor: zoom-in; border: 1.5px solid var(--ca-border2); }
.det-mapa { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.det-mapa .palco { position: relative; background: #f8fafc; border-radius: 10px; overflow: hidden; }
.det-mapa img { display: block; width: 100%; }
.det-mapa .palco .marca { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: #dc2626; color: #fff; border: 2px solid #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.det-mapa .legenda { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--ca-text2); margin-bottom: 4px; }
.det-envio { display: flex; gap: 10px; flex-wrap: wrap; }
.det-envio-item { flex: 1 1 260px; }
.det-envio-item .btn { width: 100%; }
.det-envio-item .motivo { font-size: 13px; color: var(--ca-text2); margin-top: 6px; }
.det-historico { margin: 12px 0 0; padding: 0; list-style: none; font-size: 14px; }
.det-historico li { padding: 6px 0; border-bottom: 1px solid var(--ca-border); }
.det-historico .falhou { color: var(--ca-t); }
.det-historico .enviado { color: var(--ca-n); }
.det-assinatura { background: #fff; border-radius: 10px; padding: 6px; display: inline-block; }
.det-assinatura img { height: 90px; display: block; }

@media (max-width: 800px) {
  .grade, .grade.tres, .det-grid { grid-template-columns: 1fr; }
  .item-pos .pos-nome { flex-basis: 96px; }
  .hdr-id-nome { max-width: 120px; }
  .det-mapa { grid-template-columns: 1fr; }
}

/* seleção única (pesquisa) */
.opcoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.opcao { min-height: 54px; padding: 0 20px; border-radius: 27px; cursor: pointer; font-size: 16px; font-weight: 700; background: var(--ca-surface2); color: var(--ca-text2); border: 2px solid var(--ca-border2); }
.opcao.ativo { background: var(--ca-blue-bg); border-color: var(--ca-blue); color: var(--ca-blue); }
.opcoes-filhas { margin-top: 12px; padding-left: 14px; border-left: 3px solid var(--ca-border3); }

/* correção de contato pós-encerramento (supervisor) */
.det-contato { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--ca-border2); }
.det-contato h5 { margin: 0 0 10px; font-size: 13px; color: var(--ca-text2); }
.det-contato-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.det-contato-campos label span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--ca-text2); margin-bottom: 4px; }

/* ---------- login por PIN (public/entrar.php) ---------- */
.entrar-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px 16px; }
.entrar-content { width: 100%; max-width: 520px; text-align: center; }
.entrar-logo { height: 40px; margin-bottom: 28px; }
.entrar-titulo { margin: 0 0 4px; font-size: 24px; }
.entrar-sub { margin: 0 0 22px; color: var(--ca-text2); font-size: 14px; }

.op-grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.op-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 10px;
  border-radius: 16px; background: var(--ca-surface); border: 1.5px solid var(--ca-border2);
  cursor: pointer; color: var(--ca-text);
}
.op-card:active { transform: scale(.97); }
.op-card.desabilitado { opacity: .45; cursor: not-allowed; }
.op-avatar {
  width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--ca-blue-bg); color: var(--ca-blue); font-size: 20px; font-weight: 800;
}
.op-nome { font-size: 15px; font-weight: 700; text-align: center; }
.op-aviso { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--ca-t); }

.entrar-contexto { margin: 0 auto 6px; max-width: 340px; text-align: left; }
.entrar-content #pin-erro { max-width: 340px; margin: 0 auto 14px; }
.pin-pontos { font-size: 30px; letter-spacing: 10px; margin: 18px 0; color: var(--ca-blue); }
.teclado-pin { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 340px; margin: 0 auto; }
.tecla {
  min-height: 68px; border-radius: 16px; font-size: 24px; font-weight: 800; cursor: pointer;
  background: var(--ca-surface2); border: 1.5px solid var(--ca-border2); color: var(--ca-text);
}
.tecla:active { transform: scale(.96); background: var(--ca-surface3); }
.tecla-alt { font-size: 15px; font-weight: 700; color: var(--ca-text2); }

/* ---------- bloqueio de tela por inatividade (assets/js/bloqueio-tela.js) ---------- */
/* Acima de tudo (modal 200, lightbox 300, toast 400). Fundo desfocado quando o navegador suporta; senão, mais escuro. */
html.bloqueio-ativo { overflow: hidden; }
.bloqueio-tela {
  position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(13, 16, 23, .95); touch-action: none; outline: none;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .bloqueio-tela { background: rgba(13, 16, 23, .62); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
}
.bloqueio-card {
  max-width: 420px; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  padding: 22px 20px; border-radius: 22px; background: var(--ca-surface); border: 1.5px solid var(--ca-border3);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .6);
}
.bloqueio-topo {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 16px;
  font-size: 12px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--ca-text2);
}
.bloqueio-topo svg, .btn-icone svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-icone { padding: 0; width: 44px; }
.btn-icone svg { width: 20px; height: 20px; }
.bloqueio-card .pin-pontos { margin: 12px 0; }

@media (max-width: 480px) {
  /* cabeçalho compacto: "Trocar" + "Gestão" ao lado do logo sem esmagar título/placa */
  .hdr { gap: 8px; padding: 0 10px; }
  .hdr-logo { height: 26px; }
  .hdr-right { gap: 6px; }
  .hdr-id { padding: 3px; gap: 4px; min-height: 0; } /* telas de celular: só o avatar (o nome completo fica no title) */
  .hdr-id-txt { display: none; }
  button.hdr-id { padding-right: 7px; }
  .hdr-avatar { width: 32px; height: 32px; font-size: 13px; }
  .hdr-placa { font-size: 17px; letter-spacing: 1px; } /* a placa não pode ser cortada nem invadir os botões */
  .hdr-right .btn-sm { padding: 0 10px; }
  .hdr-titulo { display: block; font-size: 13px; letter-spacing: .2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hdr-trocar-resto { display: none; }
  .op-grade { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) { .det-contato-campos { grid-template-columns: 1fr; } }

/* ---------- celular (≤480px): empilha linhas de item, troca pills por seletor de seção, rodapé em duas linhas ---------- */
@media (max-width: 480px) {
  :root { --altura-rodape: 118px; }
  .page { padding-left: 12px; padding-right: 12px; }

  /* Barra de seções: linha 1 = modos de visualização, linha 2 = ‹ seção atual ›. Ao rolar, a linha 1 sai por
     baixo do cabeçalho (top negativo) e só o seletor de seção fica fixo. */
  .barra-passos { flex-wrap: wrap; gap: 6px; margin: 0 -12px 12px; padding: 8px 12px; top: calc(var(--altura-hdr) - 54px); }
  .barra-passos.sem-secoes { top: var(--altura-hdr); }
  .pills-wrap { display: none; }
  .alternador { order: -1; flex: 1 0 100%; margin-left: 0; }
  .alternador button { flex: 1; width: auto; min-height: 44px; }
  .nav-secao { display: flex; flex: 1 0 100%; align-items: stretch; gap: 8px; }
  .nav-seta {
    flex: 0 0 52px; min-height: 52px; padding: 0 0 4px; border-radius: 14px; cursor: pointer;
    border: 1.5px solid var(--ca-border3); background: var(--ca-surface2); color: var(--ca-text); font-size: 32px; line-height: 1; font-weight: 700;
  }
  .nav-seta[disabled] { opacity: .35; cursor: not-allowed; }
  .nav-atual {
    flex: 1; min-width: 0; min-height: 52px; padding: 6px 12px; border-radius: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
    border: 1.5px solid var(--ca-blue); background: var(--ca-blue-bg); color: var(--ca-text); font-size: 15px; font-weight: 800; line-height: 1.2;
  }
  .nav-atual.tecnico { border-color: var(--ca-tec); background: var(--ca-tec-bg); }
  .nav-nome { min-width: 0; overflow-wrap: anywhere; } /* o nome da seção quebra em vez de ser cortado */
  .nav-caret { flex: none; font-size: 13px; color: var(--ca-text2); }
  .secao { scroll-margin-top: calc(var(--altura-hdr) + 84px); }

  /* Folha de seções (abre da base) */
  .modal-fundo.folha { align-items: flex-end; padding: 0; }
  .modal-fundo.folha .modal { width: 100%; max-height: 82vh; border-radius: 20px 20px 0 0; padding: 16px 12px calc(16px + env(safe-area-inset-bottom)); }
  .folha-lista { display: flex; flex-direction: column; gap: 8px; }
  .folha-passo {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 14px; border-radius: 14px; cursor: pointer; text-align: left;
    border: 1.5px solid var(--ca-border2); background: var(--ca-surface2); color: var(--ca-text); font-size: 15px; font-weight: 700;
  }
  .folha-passo.ativo { border-color: var(--ca-blue); background: var(--ca-blue-bg); }
  .folha-passo.tecnico { color: var(--ca-tec); }
  .folha-passo.ativo.tecnico { border-color: var(--ca-tec); background: var(--ca-tec-bg); }

  /* Título da seção: o atalho "Marcar tudo como Normal" desce para uma linha própria */
  .secao-titulo { flex-wrap: wrap; }
  .btn-marcar-normal { flex: 1 0 100%; margin-left: 0; }

  /* Itens: nome numa linha própria (largura toda); N/F/T + câmera logo abaixo, dividindo a largura */
  .item { padding: 12px; }
  .item-topo { flex-wrap: wrap; gap: 10px; min-height: 0; }
  .item-topo > .item-nome { flex: 1 0 100%; }
  .item-topo > .finput:not(.numero) { flex: 1 1 100%; max-width: none !important; }
  .item-pos { flex-wrap: wrap; gap: 8px; }
  .item-pos .pos-nome { flex: 1 0 100%; }
  .item-pos .pos-ctl { flex: 1 0 100%; flex-wrap: nowrap; justify-content: stretch; }
  .nft-group { flex: 1 1 0; min-width: 0; }
  .btn-nft { flex: 1 1 0; width: auto; min-width: 0; min-height: 52px; }
  .btn-foto { flex: 0 0 52px; width: 52px; min-height: 52px; }

  /* Mapa de avarias: vista + "Remover" na primeira linha, descrição embaixo */
  .avaria-linha { flex-wrap: wrap; }
  .avaria-linha > div[style] { flex: 1 1 0 !important; min-width: 0; }
  .avaria-linha > .btn { order: 1; }
  .avaria-linha > .finput { order: 2; flex: 1 1 100%; }

  .hdr-right .btn-sm { font-size: 13px; }

  /* Rodapé: resumo de pendências em cima, botões embaixo dividindo a largura */
  .rodape { flex-wrap: wrap; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .rodape-info { order: -1; flex: 1 0 100%; font-size: 13px; line-height: 1.3; }
  .rodape .btn { flex: 1 1 0; min-width: 0; padding: 0 12px; }
  .rodape .btn-primary, .rodape .btn-verde { flex: 2 1 0; }
  /* Indicador flutuante: não pode roubar toque do botão que fica atrás dele (só o erro, com "Tentar novamente", é clicável) */
  .autosave { right: 10px; max-width: calc(100vw - 20px); flex-wrap: wrap; pointer-events: none; }
  .autosave.erro, .autosave.pronto { pointer-events: auto; }
  .toast, .toast-desfazer { max-width: calc(100vw - 24px); }
}
@media (max-width: 400px) {
  /* 360px: o cabeçalho tem logo + placa/cliente + Trocar + avatar + Gestão; tudo enxuto para a placa não ser cortada */
  .hdr { padding: 0 8px; gap: 6px; }
  .hdr-logo { height: 22px; }
  .hdr-right { gap: 4px; }
  .hdr-avatar { width: 28px; height: 28px; font-size: 12px; }
  .hdr-right .btn-sm { padding: 0 8px; font-size: 12.5px; }
  .hdr-placa { font-size: 16px; letter-spacing: .5px; }
}
