/* KGR Checklist — identidade visual KGR · Gestão de Resíduos */
:root {
  --azul: #004688; --ciano: #00AFF1; --verde: #00A749; --laranja: #FF8204; --vermelho: #FF161F; --amarelo: #FFF100;
  --tinta: #17212E; --rotulo: #6B7A8C; --borda: #DCE4EC; --fundo: #F5F9FC; --branco: #fff;
  --verde-claro: #E5F6EC; --vermelho-claro: #FFE8E9; --laranja-claro: #FFF1E3; --azul-claro: #E6F0FA;
  --raio: 14px; --sombra: 0 1px 2px rgba(23,33,46,.06), 0 4px 14px rgba(23,33,46,.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fundo); color: var(--tinta); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--azul); }
.oculto { display: none !important; }

/* Topo */
.topo { position: sticky; top: 0; z-index: 20; background: var(--azul); color: #fff; padding: 10px 16px calc(10px); padding-top: calc(10px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 12px; }
.topo .marca { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.topo .logo { width: 38px; height: 38px; border-radius: 10px; background: #fff; display: grid; place-items: center; font-weight: 800; color: var(--azul); font-size: 13px; flex: none; padding: 4px; }
.topo .logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 9px; }
.topo h1 { margin: 0; font-size: 16px; line-height: 1.15; }
.topo .logo-branca { height: 34px; width: auto; display: block; }
.topo.inicio .logo { display: none; }
.topo:not(.inicio) .logo-branca { display: none; }
.topo small { display: block; font-size: 12px; opacity: .85; font-weight: 500; }
.topo .voltar { background: rgba(255,255,255,.15); border: 0; color: #fff; width: 38px; height: 38px; border-radius: 10px; font-size: 20px; }
.rede { font-size: 12px; padding: 4px 9px; border-radius: 99px; background: rgba(255,255,255,.18); white-space: nowrap; }
.rede.off { background: var(--laranja); }

main { max-width: 720px; margin: 0 auto; padding: 14px 14px 110px; }

/* Cartões */
.card { background: var(--branco); border: 1px solid var(--borda); border-radius: var(--raio); padding: 14px; box-shadow: var(--sombra); margin-bottom: 12px; }
.card h2 { font-size: 17px; margin: 0 0 4px; }
.card h3 { font-size: 15px; margin: 0 0 8px; }
.sub { color: var(--rotulo); font-size: 13px; }
.aviso { border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; border: 1px solid; }
.aviso.info { background: var(--azul-claro); border-color: #b9d3ee; }
.aviso.alerta { background: var(--laranja-claro); border-color: #ffd0a3; }
.aviso.erro { background: var(--vermelho-claro); border-color: #ffb3b6; }
.aviso.ok { background: var(--verde-claro); border-color: #a9e2c0; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 13px 16px; font-weight: 700; background: var(--azul); color: #fff; min-height: 48px; cursor: pointer; text-decoration: none; }
.btn.sec { background: var(--branco); color: var(--azul); border: 1.5px solid var(--azul); }
.btn.verde { background: var(--verde); }
.btn.perigo { background: var(--branco); color: var(--vermelho); border: 1.5px solid var(--vermelho); }
.btn.grande { width: 100%; font-size: 18px; min-height: 60px; }
.btn.bloco { width: 100%; }
.btn:disabled { opacity: .45; }
.linha-btn { display: flex; gap: 10px; }
.linha-btn > * { flex: 1; }

/* Barra inferior fixa */
.rodape { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--branco); border-top: 1px solid var(--borda); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
.rodape .dentro { max-width: 720px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.rodape .dentro .btn { flex: 1; }

/* Status / chips */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--fundo); border: 1px solid var(--borda); color: var(--rotulo); white-space: nowrap; }
.chip.ok { background: var(--verde-claro); color: #0a7a3a; border-color: #a9e2c0; }
.chip.pend { background: var(--laranja-claro); color: #b35400; border-color: #ffd0a3; }
.chip.ruim { background: var(--vermelho-claro); color: #c4000a; border-color: #ffb3b6; }
.chip.azul { background: var(--azul-claro); color: var(--azul); border-color: #b9d3ee; }

/* Lista de equipamentos */
.equip { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--borda); border-radius: 12px; background: #fff; margin-bottom: 8px; width: 100%; text-align: left; cursor: pointer; }
.equip .ico { width: 46px; height: 46px; border-radius: 11px; background: var(--azul-claro); display: grid; place-items: center; font-size: 22px; flex: none; }
.equip .meio { flex: 1; min-width: 0; }
.equip .tag { font-weight: 800; font-size: 16px; }
.equip .det { font-size: 13px; color: var(--rotulo); }

/* Formulários */
label.campo { display: block; margin-bottom: 12px; }
label.campo > span { display: block; font-size: 13px; font-weight: 700; color: var(--rotulo); margin-bottom: 5px; }
input[type=text], input[type=number], input[type=tel], input[type=password], select, textarea {
  width: 100%; padding: 12px; border: 1.5px solid var(--borda); border-radius: 11px; background: #fff; min-height: 48px; font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ciano); box-shadow: 0 0 0 3px rgba(0,175,241,.15); }
textarea { min-height: 80px; resize: vertical; }
.invalido { border-color: var(--vermelho) !important; }

/* Opções em botões (rádio grande) */
.opcoes { display: grid; gap: 8px; }
.opcoes.col2 { grid-template-columns: 1fr 1fr; }
.opcoes.col3 { grid-template-columns: repeat(3, 1fr); }
.opc { border: 1.5px solid var(--borda); background: #fff; border-radius: 11px; padding: 11px 10px; font-weight: 700; text-align: center; cursor: pointer; min-height: 48px; }
.opc small { display: block; font-weight: 500; color: var(--rotulo); font-size: 12px; }
.opc.sel { border-color: var(--azul); background: var(--azul-claro); color: var(--azul); }
.opc.sel.critica { border-color: var(--vermelho); background: var(--vermelho-claro); color: #c4000a; }

/* Progresso */
.progresso { height: 6px; background: var(--borda); border-radius: 99px; overflow: hidden; margin: 2px 0 12px; }
.progresso > i { display: block; height: 100%; background: linear-gradient(90deg, var(--ciano), var(--azul)); width: 0; transition: width .3s; }
.passos { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--rotulo); margin-bottom: 4px; }
.cronometro { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--azul); }

/* Itens do checklist */
.secao-titulo { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; color: var(--azul); margin: 18px 2px 8px; }
.secao-titulo.contrato { color: #b35400; }
.item { background: #fff; border: 1px solid var(--borda); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.item.nc { border-color: #ffb3b6; background: #fffafa; }
.item.melhoria { border-color: #ffd0a3; border-left: 5px solid var(--laranja); }
.item .txt { font-size: 15px; margin-bottom: 10px; }
.item .num { font-weight: 800; color: var(--rotulo); margin-right: 4px; }
.item .crit { color: var(--vermelho); font-weight: 800; font-size: 11px; margin-left: 4px; white-space: nowrap; }
.resp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.resp button { border: 1.5px solid var(--borda); background: #fff; border-radius: 10px; min-height: 46px; font-weight: 800; font-size: 15px; cursor: pointer; }
.resp button.C.sel { background: var(--verde); border-color: var(--verde); color: #fff; }
.resp button.NC.sel { background: var(--vermelho); border-color: var(--vermelho); color: #fff; }
.resp button.NA.sel { background: var(--rotulo); border-color: var(--rotulo); color: #fff; }
.detalhe-nc { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #ffb3b6; }

/* Fotos */
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.foto { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--fundo); border: 1px solid var(--borda); }
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto .x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(23,33,46,.75); color: #fff; font-size: 16px; line-height: 1; }
.add-foto { aspect-ratio: 1; border: 2px dashed #b9c6d4; border-radius: 10px; background: #fff; color: var(--azul); font-weight: 700; display: grid; place-items: center; text-align: center; font-size: 13px; cursor: pointer; padding: 6px; }
.add-foto b { font-size: 26px; display: block; line-height: 1; }
.foto-padrao { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.slot { border: 1.5px solid var(--borda); border-radius: 12px; overflow: hidden; background: #fff; }
.slot .vis { aspect-ratio: 4/3; background: var(--fundo); display: grid; place-items: center; color: var(--rotulo); font-size: 34px; cursor: pointer; }
.slot .vis img { width: 100%; height: 100%; object-fit: cover; }
.slot .nome { padding: 7px 9px; font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.slot.obrig .nome::after { content: "obrigatória"; color: var(--vermelho); font-size: 11px; font-weight: 700; }
.slot.feita { border-color: var(--verde); }
.slot.feita .nome::after { content: "✓"; color: var(--verde); font-size: 15px; }
.slot.largo { grid-column: span 2; }
.slot.largo .vis { aspect-ratio: 16/7; }

/* Avarias */
.avaria { border: 1.5px solid var(--borda); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #fff; }
.avaria.critica { border-color: var(--vermelho); }
.avaria .cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.mini-fotos { display: flex; gap: 6px; overflow-x: auto; margin: 8px 0; }
.mini-fotos img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--borda); flex: none; }

/* Assinatura */
.assinatura { border: 1.5px dashed #9fb0c2; border-radius: 12px; background: #fff; position: relative; touch-action: none; }
.assinatura canvas { width: 100%; height: 170px; display: block; border-radius: 12px; }
.assinatura .dica { position: absolute; left: 0; right: 0; bottom: 34px; text-align: center; color: #b9c6d4; pointer-events: none; font-size: 14px; border-top: 1px solid #DCE4EC; margin: 0 24px; padding-top: 4px; }

/* Resultado */
.resultado { text-align: center; padding: 24px 16px; border-radius: var(--raio); color: #fff; margin-bottom: 12px; }
.resultado.lib { background: var(--verde); }
.resultado.nlib { background: var(--vermelho); }
.resultado .grande { font-size: 26px; font-weight: 900; letter-spacing: .5px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--rotulo); }
.kv dd { margin: 0; font-weight: 600; }

/* Scanner */
.scanner { position: relative; background: #000; border-radius: var(--raio); overflow: hidden; aspect-ratio: 3/4; max-height: 62vh; margin: 0 auto 12px; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .mira { position: absolute; inset: 18% 14%; border: 3px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--tinta); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; z-index: 50; max-width: 92vw; box-shadow: var(--sombra); }

/* Diálogo */
.modal-fundo { position: fixed; inset: 0; background: rgba(23,33,46,.55); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; }
@media (min-width: 600px) { .modal-fundo { align-items: center; } .modal { border-radius: 18px; } }
.modal h2 { margin: 0 0 12px; font-size: 18px; }

/* ===================== Relatório / PDF ===================== */
.rel { background: #fff; color: #000; font-size: 12px; }
.rel-pagina { max-width: 800px; margin: 0 auto; padding: 18px; background: #fff; }
.rel-cab { display: flex; align-items: center; gap: 12px; border-bottom: 3px solid var(--azul); padding-bottom: 8px; margin-bottom: 10px; }
.rel-cab .logo-img { height: 44px; width: auto; display: block; flex: none; }
.rel-cab h1 { font-size: 15px; margin: 0; }
.rel-cab .ref { font-size: 11px; color: #444; }
.rel-res { margin-left: auto; text-align: right; }
.rel-res .selo { display: inline-block; padding: 5px 10px; border-radius: 6px; color: #fff; font-weight: 900; font-size: 13px; }
.rel table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.rel th, .rel td { border: 1px solid #b8c2cc; padding: 4px 6px; text-align: left; vertical-align: top; }
.rel th { background: #eef3f8; font-size: 11px; }
.rel .ident td { width: 25%; }
.rel .ident b { display: block; font-size: 10px; color: #555; font-weight: 600; }
.rel h2 { font-size: 13px; background: var(--azul); color: #fff; padding: 4px 8px; margin: 12px 0 6px; border-radius: 3px; }
.rel .r-C { color: #0a7a3a; font-weight: 800; text-align: center; }
.rel .r-NC { color: #fff; background: #d9000b; font-weight: 800; text-align: center; }
.rel .r-NA { color: #555; text-align: center; }
.rel .grade-fotos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rel .grade-fotos figure { margin: 0; border: 1px solid #b8c2cc; break-inside: avoid; }
.rel .grade-fotos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.rel .grade-fotos figcaption { font-size: 10px; padding: 3px 5px; }
.rel .assin { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
.rel .assin div { border-top: 1px solid #000; padding-top: 3px; text-align: center; font-size: 11px; }
.rel .assin img { max-height: 70px; display: block; margin: 0 auto 2px; }
.rel .verif { margin-top: 14px; font-size: 10px; color: #444; border-top: 1px dashed #999; padding-top: 6px; display: flex; justify-content: space-between; gap: 10px; }
@media print {
  @page { size: A4; margin: 10mm; }
  .topo, .rodape, .nao-imprimir { display: none !important; }
  main { padding: 0; max-width: none; }
  body, html { background: #fff; }
  .rel-pagina { padding: 0; max-width: none; }
  .rel h2, .rel th, .rel .r-NC, .rel-res .selo { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
