/* Checklist de Vistoria — Prontoclin. Pensado para tablet (toque) em retrato e paisagem. */
:root {
  --verde: #00705e; --verde-esc: #00594b; --verde-cl: #1db8a0; --verde-bg: #e8f5f2;
  --txt: #1d2826; --txt2: #55635f; --borda: #d3dcda; --fundo: #f3f6f5; --card: #fff;
  --erro: #c0392b; --erro-bg: #fdecea; --aviso: #9a6700; --aviso-bg: #fff4d6; --info: #2f6fbf; --info-bg: #e8f0fb;
  --ok: #1e7d4f; --ok-bg: #e3f5ea; --raio: 12px; --sombra: 0 1px 3px rgba(0,40,30,.08), 0 4px 16px rgba(0,40,30,.05);
  --toque: 46px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--fundo); color: var(--txt); font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--verde); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h2 { font-size: 20px; } h3 { font-size: 17px; }
.oculto { display: none !important; }

/* ---------- Barra superior ---------- */
.topo { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--verde); color: #fff; min-height: 58px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.topo .marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-weight: 700; font-size: 17px; margin-right: auto; min-width: 0; }
.topo .marca img { height: 34px; width: 34px; border-radius: 8px; background: #fff; object-fit: contain; padding: 2px; }
.topo .marca span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pilula { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; background: rgba(255,255,255,.16); white-space: nowrap; }
.pilula .bola { width: 9px; height: 9px; border-radius: 50%; background: #7ef0c9; }
.pilula.salvando .bola { background: #ffe08a; animation: pulsa 1s infinite; }
.pilula.pendente .bola { background: #ffb347; }
.pilula.offline { background: #ffb347; color: #3d2600; }
.pilula.offline .bola { background: #7a3e00; }
@keyframes pulsa { 50% { opacity: .3; } }
.btn-topo { position: relative; display: grid; place-items: center; width: var(--toque); height: var(--toque); border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer; }
.btn-topo:active { background: rgba(255,255,255,.18); }
.btn-topo svg { width: 24px; height: 24px; }
.contador { position: absolute; top: 4px; right: 4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #ff5a4f; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.menu-flut { position: absolute; top: 60px; right: 12px; width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: #fff; color: var(--txt); border-radius: var(--raio); box-shadow: 0 10px 40px rgba(0,0,0,.2); z-index: 40; }
.menu-flut a, .menu-flut button.item { display: block; width: 100%; text-align: left; padding: 14px 16px; border: 0; background: none; text-decoration: none; color: var(--txt); border-bottom: 1px solid #eef2f1; cursor: pointer; }
.menu-flut .cab { padding: 14px 16px; font-weight: 700; border-bottom: 1px solid #eef2f1; display: flex; justify-content: space-between; align-items: center; }
.alerta-item.nao-lida { background: var(--verde-bg); font-weight: 600; }
.alerta-item small { display: block; color: var(--txt2); font-weight: 400; margin-top: 2px; }

/* ---------- Layout geral ---------- */
.pagina { max-width: 1200px; margin: 0 auto; padding: 20px 16px 80px; }
.linha-titulo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.linha-titulo h2 { margin-right: auto; }
.card { background: var(--card); border-radius: var(--raio); box-shadow: var(--sombra); padding: 18px; margin-bottom: 16px; }
.card > h3 { margin-bottom: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card > h3 .acoes { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.aviso-faixa { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 15px; }
.aviso-faixa.erro { background: var(--erro-bg); color: #7d1d14; }
.aviso-faixa.aviso { background: var(--aviso-bg); color: #6b4800; }
.aviso-faixa.info { background: var(--info-bg); color: #1d4b85; }
.aviso-faixa.ok { background: var(--ok-bg); color: #145c39; }
.vazio { text-align: center; color: var(--txt2); padding: 40px 16px; }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--toque); padding: 0 18px; border-radius: 10px; border: 1px solid var(--borda); background: #fff; color: var(--txt); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.prim { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn.prim:active { background: var(--verde-esc); }
.btn.perigo { color: var(--erro); border-color: #efc3bd; }
.btn.perigo.cheio { background: var(--erro); color: #fff; border-color: var(--erro); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.peq { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn.grande { min-height: 56px; font-size: 17px; padding: 0 24px; }
.btn.bloco { width: 100%; }
.btn svg { width: 20px; height: 20px; }

/* ---------- Formulários ---------- */
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 16px; }
.grade .largo { grid-column: 1 / -1; }
.campo label, .rot { display: block; font-size: 13.5px; font-weight: 600; color: var(--txt2); margin-bottom: 5px; }
.campo input, .campo select, .campo textarea, input.ent, textarea.ent, select.ent {
  width: 100%; min-height: var(--toque); padding: 10px 12px; border: 1px solid var(--borda); border-radius: 10px; background: #fff; font-size: 16px; }
.campo textarea, textarea.ent { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(29,184,160,.3); border-color: var(--verde-cl); }
input:disabled, textarea:disabled, select:disabled { background: #f7f9f8; color: var(--txt); }
.ref { font-size: 13.5px; color: var(--txt2); background: #f6f8f8; border-left: 3px solid var(--borda); padding: 8px 10px; border-radius: 0 8px 8px 0; margin-top: 6px; }
.ref button { margin-top: 6px; }
.segmentado { display: inline-flex; border: 1px solid var(--borda); border-radius: 10px; overflow: hidden; flex-wrap: wrap; }
.segmentado button { min-height: var(--toque); padding: 0 16px; border: 0; background: #fff; cursor: pointer; font-weight: 600; border-right: 1px solid var(--borda); }
.segmentado button:last-child { border-right: 0; }
.segmentado button.ativo { background: var(--verde); color: #fff; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--toque); cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--verde); }
.arquivo { display: flex; align-items: center; gap: 12px; padding: 14px; border: 2px dashed var(--borda); border-radius: 12px; background: #fafcfb; cursor: pointer; }
.arquivo.tem { border-color: var(--verde-cl); background: var(--verde-bg); }
.arquivo input { display: none; }
.arquivo .ic { width: 44px; height: 44px; border-radius: 10px; background: #fff; display: grid; place-items: center; color: var(--verde); flex: none; }
.arquivo b { display: block; }
.arquivo small { color: var(--txt2); }

/* ---------- Etiquetas ---------- */
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: #eef2f1; color: var(--txt2); white-space: nowrap; }
.tag.em_andamento { background: var(--info-bg); color: var(--info); }
.tag.concluida { background: var(--aviso-bg); color: var(--aviso); }
.tag.lancada { background: var(--ok-bg); color: var(--ok); }
.tag.novo { background: var(--info-bg); color: var(--info); }
.tag.alterado { background: var(--aviso-bg); color: var(--aviso); }
.tag.removido, .tag.ERRO { background: var(--erro-bg); color: var(--erro); }
.tag.REVISAR { background: var(--aviso-bg); color: var(--aviso); }
.tag.INFO { background: var(--info-bg); color: var(--info); }
.tag.mantido { background: #eef2f1; color: var(--txt2); }
.tag.local { background: #ffe9cc; color: #8a4b00; }

/* ---------- Painel ---------- */
.filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.chip { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--borda); background: #fff; font-weight: 600; cursor: pointer; }
.chip.ativo { background: var(--verde); color: #fff; border-color: var(--verde); }
.busca { flex: 1; min-width: 200px; }
.lista-vist { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.cv { display: block; background: #fff; border-radius: var(--raio); box-shadow: var(--sombra); padding: 16px; text-decoration: none; color: var(--txt); border-left: 5px solid var(--borda); }
.cv.em_andamento { border-left-color: var(--info); }
.cv.concluida { border-left-color: #e0a100; }
.cv.lancada { border-left-color: var(--ok); }
.cv h3 { font-size: 16.5px; margin-bottom: 4px; }
.cv .sub { color: var(--txt2); font-size: 14px; }
.cv .rodape { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.barra { height: 7px; border-radius: 4px; background: #e6ecea; overflow: hidden; margin-top: 10px; }
.barra i { display: block; height: 100%; background: var(--verde-cl); }
.resumo-nums { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.resumo-nums div { background: #fff; border-radius: var(--raio); box-shadow: var(--sombra); padding: 12px 18px; min-width: 150px; }
.resumo-nums b { display: block; font-size: 26px; color: var(--verde); }

/* ---------- Vistoria ---------- */
.vist-cab { background: #fff; border-bottom: 1px solid var(--borda); padding: 12px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; position: sticky; top: 58px; z-index: 20; }
.vist-cab .tit { margin-right: auto; min-width: 0; }
.vist-cab h2 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vist-cab .sub { color: var(--txt2); font-size: 13.5px; }
.vist-cab .acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.vist-corpo { display: grid; grid-template-columns: 280px 1fr; gap: 0; min-height: calc(100vh - 130px); }
.vist-menu { background: #fff; border-right: 1px solid var(--borda); padding: 10px; position: sticky; top: 130px; align-self: start; max-height: calc(100vh - 130px); overflow: auto; }
.vist-menu a { display: flex; align-items: center; gap: 10px; min-height: var(--toque); padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--txt); font-weight: 500; }
.vist-menu a.ativo { background: var(--verde-bg); color: var(--verde-esc); font-weight: 700; }
.vist-menu a .n { margin-left: auto; font-size: 12.5px; color: var(--txt2); }
.vist-menu .grupo-rot { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--txt2); padding: 14px 12px 6px; }
.vist-menu .st { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--borda); flex: none; }
.vist-menu .st.ok { background: var(--verde-cl); border-color: var(--verde-cl); }
.vist-menu .st.rem { background: var(--erro-bg); border-color: var(--erro); }
.vist-menu a.removido { color: var(--txt2); text-decoration: line-through; }
.vist-conteudo { padding: 18px; min-width: 0; }
.vist-conteudo.ro .so-edicao { display: none !important; }

.cargo { border: 1px solid var(--borda); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: #fff; }
.cargo.confirmado { border-color: #9ad9c6; background: #fbfefd; }
.cargo.removido { opacity: .6; background: #fafafa; }
.cargo .cab-item { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.cargo .cab-item input { flex: 1; min-width: 200px; font-weight: 700; }
.cargo .lin { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }

.risco { display: flex; border: 1px solid var(--borda); border-radius: 10px; margin-bottom: 10px; background: #fff; overflow: hidden; cursor: pointer; }
.risco .cor { width: 8px; flex: none; }
.risco .cont { padding: 12px 14px; flex: 1; min-width: 0; }
.risco .t { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 700; }
.risco .t small { font-weight: 600; color: var(--txt2); }
.risco .d { font-size: 14px; color: var(--txt2); margin-top: 4px; }
.risco.removido { opacity: .55; }
.risco.removido .t span.perigo { text-decoration: line-through; }
.epis { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.epis span { font-size: 13px; background: #eef6f4; border: 1px solid #cfe6e0; border-radius: 8px; padding: 3px 8px; }
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.foto { border-radius: 10px; overflow: hidden; border: 1px solid var(--borda); background: #fff; }
.foto img { display: block; width: 100%; height: 140px; object-fit: cover; background: #e9eeed; }
.foto .pe { display: flex; gap: 6px; padding: 6px; }
.foto .pe input { flex: 1; min-width: 0; min-height: 38px; font-size: 14px; }
.foto .pend { font-size: 11.5px; color: #8a4b00; padding: 0 8px 6px; }
.nav-setor { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-top: 8px; }
.pend-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid #eef2f1; }
.pend-item:last-child { border-bottom: 0; }
.pend-item .txt { flex: 1; }
.pend-item.resolvida .txt { color: var(--txt2); text-decoration: line-through; }
.alt-item { padding: 10px 0; border-bottom: 1px solid #eef2f1; }
.alt-item ul { margin: 6px 0 0; padding-left: 20px; color: var(--txt2); font-size: 14px; }
.verif li { margin-bottom: 8px; }
.assin { border: 2px dashed var(--borda); border-radius: 12px; background: #fff; touch-action: none; display: block; width: 100%; height: 180px; }
.assin-img { max-width: 100%; height: 120px; object-fit: contain; border: 1px solid var(--borda); border-radius: 10px; background: #fff; }
.tabela { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tabela th, .tabela td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eef2f1; vertical-align: top; }
.tabela th { font-size: 13px; color: var(--txt2); }
.rolavel { overflow-x: auto; }

/* ---------- Modal ---------- */
.fundo-modal { position: fixed; inset: 0; background: rgba(10,25,22,.5); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .fundo-modal { align-items: center; } }
.modal { background: #fff; width: 100%; max-width: 760px; max-height: 92vh; display: flex; flex-direction: column; border-radius: 16px 16px 0 0; }
@media (min-width: 700px) { .modal { border-radius: 16px; } }
.modal .m-cab { padding: 16px 20px; border-bottom: 1px solid #eef2f1; display: flex; align-items: center; gap: 10px; }
.modal .m-cab h3 { margin-right: auto; }
.modal .m-corpo { padding: 18px 20px; overflow: auto; }
.modal .m-pe { padding: 14px 20px; border-top: 1px solid #eef2f1; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal .m-pe .esq { margin-right: auto; }
.epi-linha { display: grid; grid-template-columns: 1fr 120px 46px; gap: 8px; margin-bottom: 8px; }
.grupos-esc { display: flex; gap: 8px; flex-wrap: wrap; }
.grupos-esc button { min-height: 42px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--borda); background: #fff; font-weight: 700; cursor: pointer; }
details.refpgr { margin-top: 14px; background: #f6f8f8; border-radius: 10px; padding: 10px 14px; }
details.refpgr summary { cursor: pointer; font-weight: 600; color: var(--txt2); min-height: 32px; }
details.refpgr dl { margin: 8px 0 0; font-size: 14px; }
details.refpgr dt { font-weight: 700; margin-top: 8px; }
details.refpgr dd { margin: 0; color: var(--txt2); }

.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(520px, calc(100vw - 24px)); }
.toast { background: #1d2826; color: #fff; padding: 14px 18px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.25); font-size: 15px; animation: entra .2s ease-out; }
.toast.erro { background: #8f2418; }
.toast.ok { background: #145c39; }
@keyframes entra { from { opacity: 0; transform: translateY(10px); } }
.carregando { display: grid; place-items: center; padding: 60px; color: var(--txt2); gap: 12px; }
.giro { width: 34px; height: 34px; border: 4px solid #d8e4e1; border-top-color: var(--verde); border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.progresso-passos li { margin: 6px 0; }
.progresso-passos li.feito { color: var(--ok); }

/* Retrato / telas estreitas: menu da vistoria vira faixa horizontal */
@media (max-width: 900px) {
  .vist-corpo { grid-template-columns: 1fr; }
  .vist-menu { position: sticky; top: 58px; z-index: 15; display: flex; gap: 6px; overflow-x: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--borda); padding: 8px; }
  .vist-menu a { flex: none; white-space: nowrap; }
  .vist-menu .grupo-rot { display: none; }
  .vist-cab { position: static; }
  .vist-conteudo { padding: 14px 12px; }
  .cargo .lin { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topo .marca span { display: none; }
  .epi-linha { grid-template-columns: 1fr 90px 46px; }
}
