:root {
  --preto: #111111; --fundo: #F5F5F5; --borda: #DCDCDC; --texto2: #5C5C5C;
  --cinza1: #EBEBEB; --cinza2: #F0F0F0; --cinza3: #E6E6E6; --cinza4: #BFBFBF; --cinza5: #3D3D3D;
  --verde: #1E6B4A; --verde-bg: #E3F2EA; --verm: #9B2C2C; --verm-bg: #FBEAEA; --ambar: #8A4B0F; --ambar-bg: #FCEFD9;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fundo); color: var(--preto); }
body { font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font-family: inherit; font-size: 16px; color: var(--preto); }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding: calc(18px + var(--safe-top)) 18px calc(28px + var(--safe-bottom)); display: flex; flex-direction: column; }

h1 { font-size: 25px; font-weight: 800; line-height: 1.22; margin: 14px 0 0; letter-spacing: -0.01em; }
h2 { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--texto2); margin: 22px 0 8px; }
p.sub { margin: 6px 0 0; color: var(--texto2); font-size: 15px; }
.muted { color: var(--texto2); font-size: 13px; }
.spacer { flex-grow: 1; min-height: 18px; }
.row { display: flex; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

/* Topo */
.topo { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.voltar { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--borda); background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.chip { font-size: 13px; font-weight: 700; background: var(--cinza1); border-radius: 999px; padding: 6px 12px; text-transform: uppercase; letter-spacing: 0.02em; }
.link { background: none; border: none; font-weight: 700; font-size: 14px; cursor: pointer; padding: 10px 4px; text-decoration: underline; text-underline-offset: 3px; }
.progresso { display: flex; gap: 4px; margin-top: 14px; }
.progresso i { flex: 1; height: 4px; border-radius: 2px; background: var(--borda); }
.progresso i.on { background: var(--preto); }
.etapa { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--texto2); }

/* Botões */
.btn { min-height: 54px; border-radius: 14px; border: none; background: var(--preto); color: #fff; font-weight: 700; font-size: 16px; padding: 0 18px; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; width: 100%; text-transform: uppercase; letter-spacing: 0.03em; }
.btn.sec { background: #fff; color: var(--preto); border: 1.5px solid var(--preto); }
.btn.leve { background: var(--cinza1); color: var(--preto); }
.btn.perigo { background: var(--verm-bg); color: var(--verm); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.peq { min-height: 40px; font-size: 13px; border-radius: 10px; width: auto; padding: 0 12px; }
.acoes { display: flex; gap: 10px; margin-top: 16px; }
.acoes > * { flex: 1; }

/* Cartões de opção */
.opcao { display: flex; align-items: center; gap: 16px; background: #fff; border: 1.5px solid var(--borda); border-radius: 18px; padding: 18px; cursor: pointer; width: 100%; text-align: left; }
.opcao.on { border: 2px solid var(--preto); }
.opcao .ic { width: 52px; height: 52px; border-radius: 14px; background: var(--cinza1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.opcao.on .ic, .opcao.forte .ic { background: var(--preto); color: #fff; }
.opcao .tt { font-size: 18px; font-weight: 800; text-transform: uppercase; }
.opcao .ds { font-size: 14px; color: var(--texto2); }
.lista { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }

/* Formulários */
.card { background: #fff; border: 1px solid var(--borda); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.card + .card { margin-top: 12px; }
.f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.f label, .f .lb { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.f input, .f select, .f textarea { height: 48px; border: 1.5px solid var(--borda); border-radius: 12px; padding: 0 12px; background: #fff; width: 100%; min-width: 0; -webkit-appearance: none; appearance: none; }
.f select { background-image: linear-gradient(45deg, transparent 50%, #111 50%), linear-gradient(135deg, #111 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.f textarea { height: 88px; padding: 10px 12px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { outline: none; border-color: var(--preto); }
.f input.ok { border-color: var(--verde); }
.f input.erro { border-color: var(--verm); }
.f .hint { font-size: 12px; color: var(--texto2); }
.docrow { display: flex; gap: 8px; align-items: center; }
.docrow input { flex: 1; }
.badge { font-size: 12px; font-weight: 700; border-radius: 8px; padding: 6px 8px; white-space: nowrap; }
.badge.ok { color: var(--verde); background: var(--verde-bg); }
.badge.erro { color: var(--verm); background: var(--verm-bg); }
.badge.neutro { color: var(--texto2); background: var(--cinza2); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { min-height: 44px; border: 1.5px solid var(--borda); background: #fff; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; padding: 0 6px; }
.seg button.on { border: 2px solid var(--preto); background: var(--cinza1); font-weight: 800; }
.seg.tabs { background: var(--cinza3); padding: 4px; border-radius: 14px; }
.seg.tabs button { border: none; background: transparent; color: var(--texto2); }
.seg.tabs button.on { background: #fff; color: var(--preto); border: none; }
.yn { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.yn .lb { font-size: 14px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.yn .seg { grid-auto-columns: 58px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--borda); border-radius: 10px; padding: 0 12px; min-height: 44px; font-size: 14px; font-weight: 600; background: #fff; }
.checks input { width: 20px; height: 20px; accent-color: var(--preto); }
.secao { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--texto2); border-top: 1px solid var(--cinza2); padding-top: 14px; }
.card > .secao:first-child { border-top: none; padding-top: 0; }

/* Itens adicionados */
.item { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--borda); border-radius: 14px; padding: 10px 10px 10px 14px; }
.item + .item { margin-top: 8px; }
.item .av { width: 36px; height: 36px; border-radius: 10px; background: var(--cinza1); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; flex-shrink: 0; }
.item .tx { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }
.item .tx b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .tx span { font-size: 12px; color: var(--texto2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini { height: 36px; border: none; border-radius: 10px; padding: 0 10px; font-size: 13px; font-weight: 700; cursor: pointer; background: var(--cinza1); flex-shrink: 0; }
.mini.rem { background: var(--verm-bg); color: var(--verm); }

/* Avisos */
.aviso { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 11px 12px; font-size: 13px; line-height: 1.45; margin-top: 12px; }
.aviso svg { flex-shrink: 0; margin-top: 1px; }
.aviso.ambar { background: var(--ambar-bg); color: var(--ambar); }
.aviso.verde { background: var(--verde-bg); color: var(--verde); }
.aviso.verm { background: var(--verm-bg); color: var(--verm); }
.aviso.cinza { background: var(--cinza1); color: var(--cinza5); }
.aviso ul { margin: 4px 0 0; padding-left: 18px; }

/* Calculadora */
.calc { background: var(--preto); color: #fff; border-radius: 18px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; }
.calc small { display: block; font-size: 12px; color: var(--cinza4); }
.calc .grande { font-size: 26px; font-weight: 800; }
.calc .dir { text-align: right; }
.calc.pendente .grande { color: #F2C46D; }

/* Grade de ícones */
.icones { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.icones button { min-height: 66px; border: 1.5px solid var(--borda); background: #fff; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 700; cursor: pointer; padding: 4px; }
.icones button.on { border: 2px solid var(--preto); }
.modal { border: 2px solid var(--preto); }

/* Estoque */
.filtros { display: flex; gap: 6px; overflow-x: auto; margin-top: 12px; padding-bottom: 2px; }
.filtros button { min-height: 38px; border: 1.5px solid var(--borda); background: #fff; border-radius: 999px; padding: 0 14px; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.filtros button.on { background: var(--preto); color: #fff; border-color: var(--preto); font-weight: 700; }
.veic { background: #fff; border: 1px solid var(--borda); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; text-align: left; width: 100%; }
.veic + .veic { margin-top: 8px; }
.placa { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; border: 1.5px solid var(--preto); border-radius: 6px; padding: 3px 7px; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11px; font-weight: 700; border-radius: 8px; padding: 3px 8px; background: var(--cinza1); }
.tag.verde { color: var(--verde); background: var(--verde-bg); }
.tag.verm { color: var(--verm); background: var(--verm-bg); }
.tag.ambar { color: var(--ambar); background: var(--ambar-bg); }

/* Login */
.logo { width: 76px; height: 76px; border-radius: 22px; background: var(--preto); display: flex; align-items: center; justify-content: center; margin: 40px auto 0; }
.marca { text-align: center; font-size: 13px; font-weight: 700; letter-spacing: 0.1em; color: var(--texto2); margin-top: 14px; }

/* Resumo */
.res { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--borda); border-radius: 16px; margin-top: 14px; }
.res > div > svg { flex-shrink: 0; }
.res > div { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--cinza2); align-items: center; }
.res > div:last-child { border-bottom: none; }
.res .tx { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }
.res .tx span { font-size: 12px; color: var(--texto2); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700; }
.res .tx b { font-size: 14px; }
.aceite { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; color: #5A3208; }
.aceite input { width: 22px; height: 22px; margin: 0; flex-shrink: 0; accent-color: var(--preto); }

/* Pré-visualização do contrato */
.folha { background: #fff; border: 1px solid var(--borda); border-radius: 6px; padding: 26px 22px; margin-top: 14px; font-family: Arial, Helvetica, sans-serif; font-size: 12.5px; color: #000; }
.folha p { margin: 0; text-align: justify; line-height: 1.45; }
.folha p.tit { text-align: center; font-size: 15px; margin-bottom: 12px; }
.folha p.dir { text-align: right; }
.folha p.ind { margin-left: 14px; }
.folha p.esp { height: 8px; }
.folha p.qt { font-size: 11px; margin-top: 6px; }
.folha table.q { width: 100%; border-collapse: collapse; margin: 6px 0; table-layout: fixed; }
.folha table.q td { border: 1px solid #aaa; font-size: 10.5px; padding: 3px 4px; vertical-align: top; overflow-wrap: anywhere; }
.folha td.ql { background: #efefef; width: 19%; }
.folha td.qd { background: #dcdcdc; }
.folha table.ass { width: 100%; margin-top: 14px; }
.folha td.asc { width: 50%; padding: 0 10px 16px; vertical-align: top; }
.folha p.linha { border-bottom: 1px solid #000; height: 34px; }
.folha p.an, .folha p.ad { text-align: center; font-size: 11px; }

/* Mensagem rápida */
#toast { position: fixed; left: 50%; bottom: calc(22px + var(--safe-bottom)); transform: translateX(-50%); background: var(--preto); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; max-width: 90vw; z-index: 50; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
#toast.show { opacity: 1; }
.carregando { text-align: center; padding: 30px 0; color: var(--texto2); }
@media (min-width: 600px) { #app { padding-top: 28px; } }

/* Anexos opcionais */
.anx { display: flex; flex-direction: column; gap: 12px; }
.anx-op { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1.5px solid var(--borda); border-radius: 12px; cursor: pointer; }
.anx-op input { width: 22px; height: 22px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--preto); }
.anx-op span { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.anx-op small { font-size: 12.5px; color: var(--texto2); }
.anx-op:has(input:checked) { border-color: var(--preto); background: var(--cinza1); }
.anx-form { border-left: 3px solid var(--borda); padding: 2px 0 6px 12px; margin: -4px 0 4px 6px; }
.ck-item { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--borda); }
.ck-item b { font-size: 14px; }
.ck-item .seg button { min-height: 38px; font-size: 13px; }
.ck-item .f { margin: 0; }
.folha hr.quebra { border: 0; border-top: 2px dashed #bbb; margin: 28px -10px; }
.folha table.ck td { font-size: 11px; }

/* Leitor de documentos */
.leitor { display: flex; flex-direction: column; gap: 6px; }
.leitor .hint { font-size: 12px; color: var(--texto2); text-align: center; }
.f.lido input, .f.lido select, .f.lido textarea { border-color: #D9921F; background: #FFF7E6; }
.f.lido .seg button.on, .yn.lido .seg button.on { border-color: #D9921F; background: #FFF1D6; }
.yn.lido { background: #FFF7E6; border-radius: 10px; padding: 4px 6px; margin: 0 -6px; }
.lido-tag { font-size: 11.5px; font-weight: 700; color: var(--ambar); }
.sheet-fundo { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 22px 18px calc(22px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 10px; max-height: 92vh; overflow: auto; }
.sheet .aviso { margin-top: 2px; }
.lendo { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 0 8px; text-align: center; }
.giro { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--cinza1); border-top-color: var(--preto); animation: gira 0.9s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.barra { width: 100%; height: 6px; border-radius: 3px; background: var(--cinza1); overflow: hidden; }
.barra i { display: block; height: 100%; width: 4%; background: var(--preto); transition: width 0.3s; }
.cf-item { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--borda); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.cf-item input { width: 22px; height: 22px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--preto); }
.cf-item span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.cf-item small { font-size: 13px; color: var(--texto2); }
.cf-item:has(input:checked) { border-color: var(--preto); background: var(--cinza1); }
