:root {
  --verde: #0F766E;
  --verde-esc: #115E59;
  --fundo: #F4F7F6;
  --branco: #FFFFFF;
  --texto: #10201D;
  --suave: #4B5B58;
  --linha: #E2E8E6;
  --borda: #CBD5D2;
  --erro: #B42318;
  --alerta-bg: #FFF4E5;
  --alerta: #8A4B00;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--fundo); color: var(--texto); font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}
#app { min-height: 100%; display: flex; flex-direction: column; max-width: 1100px; margin: 0 auto; background: var(--fundo); }
h1, h2, .titulo { font-family: 'Plus Jakarta Sans', Inter, system-ui, sans-serif; }
h1 { margin: 0 0 6px; font-size: 26px; }
h2 { margin: 0; font-size: 17px; }
a { color: var(--verde); }
button, input, select, textarea { font: inherit; color: inherit; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* topo */
.topo { position: sticky; top: 0; z-index: 5; background: var(--branco); border-bottom: 1px solid var(--linha);
  padding: 12px 16px; display: flex; align-items: center; gap: 12px; min-height: 68px; }
.topo-txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.titulo { font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtitulo { font-size: 13px; color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icone-btn { width: 44px; height: 44px; flex-shrink: 0; border: 0; background: var(--fundo); border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--texto); cursor: pointer; text-decoration: none; }
.icone-btn.borda { background: var(--branco); border: 1px solid var(--borda); color: var(--verde); }
.btn-texto { border: 0; background: none; color: var(--verde); font-weight: 600; padding: 10px 6px; cursor: pointer; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }

/* faixas */
.faixa { display: flex; align-items: center; gap: 10px; padding: 10px 16px; font-size: 14px; flex-wrap: wrap; }
.faixa span { flex: 1; min-width: 180px; }
.faixa.info { background: #E6F4F1; color: var(--verde-esc); font-weight: 600; }
.faixa.alerta { background: var(--alerta-bg); color: var(--alerta); font-weight: 600; }

/* conteúdo */
.conteudo { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 14px; padding-bottom: 96px; }
.cartao { background: var(--branco); border: 1px solid var(--linha); border-radius: 16px; padding: 16px; }
.cartao.obs { font-size: 14px; color: var(--suave); white-space: pre-line; }
.linha { display: flex; gap: 10px; align-items: center; }
.linha.entre { justify-content: space-between; }
.linha .campo { flex: 1; }
.bloco { display: flex; flex-direction: column; gap: 8px; }
.rot-campo { font-size: 12px; font-weight: 600; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }
.vazio { color: var(--suave); text-align: center; padding: 24px 8px; margin: 0; }
.mini { font-size: 13px; color: var(--suave); margin: 0; }
.sub { color: var(--suave); margin: 0 0 16px; line-height: 1.45; }
.erro-txt { color: var(--erro); font-weight: 600; }

/* campos */
.campo { width: 100%; min-height: 46px; border: 1px solid var(--borda); border-radius: 10px; padding: 10px 12px; background: var(--branco); }
.campo:focus { outline: 2px solid var(--verde); outline-offset: 1px; border-color: var(--verde); }
.campo.curto { width: auto; min-width: 160px; flex: 0 0 auto; }
textarea.campo { resize: vertical; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--suave); }
.form > label[for] { margin-bottom: -8px; }

/* botões */
.btn { border: 0; border-radius: 12px; background: var(--verde); color: #fff; font-weight: 700; min-height: 46px; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--verde-esc); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.grande { min-height: 60px; font-size: 17px; border-radius: 16px; width: 100%; }
.btn.pequeno { min-height: 40px; font-size: 14px; padding: 0 12px; }
.btn.claro { background: #fff; color: var(--texto); }
.btn.perigo { background: var(--erro); }
.btn-perigo { border: 1px solid #F3C7C3; background: #fff; color: var(--erro); border-radius: 12px; min-height: 46px; font-weight: 600; cursor: pointer; }
.acoes-foto .tirar { flex: 1; }
.grande-q { width: 60px; height: 60px; border-radius: 16px; }
label.btn, label.icone-btn { cursor: pointer; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-sel { min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--borda); background: #fff; font-size: 15px; font-weight: 500; cursor: pointer; }
.chip-sel.ativo { background: var(--verde); border-color: var(--verde); color: #fff; font-weight: 600; }
.chip { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #EEF2F1; color: var(--suave); white-space: nowrap; }
.st-autorizada, .st-realizada { background: #E0F2FE; color: #075985; }
.st-faturada { background: #EDE9FE; color: #5B21B6; }
.st-paga { background: #DCFCE7; color: #166534; }
.st-glosada { background: #FEE4E2; color: #B42318; }

/* listas */
.lista { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--linha); border-radius: 16px; overflow: hidden; }
.lista li + li { border-top: 1px solid var(--linha); }
.lista a { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "n c" "i c"; gap: 2px 10px; align-items: center;
  padding: 12px 16px; text-decoration: none; color: inherit; min-height: 60px; }
.lista a:hover { background: #F8FAF9; }
.l-nome { grid-area: n; font-weight: 600; }
.l-info { grid-area: i; font-size: 13px; color: var(--suave); }
.lista .chip { grid-area: c; }

/* fotos */
.grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.foto { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: #D7E3E0; }
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-abrir { border: 0; padding: 0; margin: 0; width: 100%; height: 100%; background: none; cursor: zoom-in; display: block; }
.sem-mini { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--suave); }
.foto .rotulo { position: absolute; left: 8px; bottom: 8px; background: #fff; border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 600; pointer-events: none; }
.foto .estrela { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border: 0; border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.foto.pendente img { opacity: .55; }
.foto .enviando { position: absolute; top: 8px; left: 8px; background: var(--verde); color: #fff; border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 600; display: flex; gap: 4px; align-items: center; }

/* visor */
.visor { position: fixed; inset: 0; background: rgba(8, 16, 14, .92); z-index: 50; display: flex; flex-direction: column; }
.visor-img { flex: 1; display: flex; align-items: center; justify-content: center; padding: 12px; min-height: 0; }
.visor-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.visor-barra { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px 20px; background: #0B1513; }
.visor-info { color: #D5E0DD; font-size: 14px; flex: 1 1 100%; }

/* abas */
.abas { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: #fff; border-top: 1px solid var(--linha);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
.abas a { min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; color: var(--suave); text-decoration: none; }
.abas a.ativa { color: var(--verde); font-weight: 700; }

/* login */
.centro { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login { max-width: 380px; width: 100%; text-align: center; padding: 32px 24px; }
.logo { width: 64px; height: 64px; border-radius: 18px; background: var(--verde); color: #fff; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.logo svg { width: 32px; height: 32px; }

/* aviso */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 60; background: #10201D; color: #fff;
  padding: 12px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.erro { background: var(--erro); }
.toast.ok { background: var(--verde-esc); }

/* telas largas (notebook) */
@media (min-width: 760px) {
  .grade { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .abas { position: static; border-top: 0; border-bottom: 1px solid var(--linha);
    grid-template-columns: repeat(3, max-content); gap: 8px; padding: 0 16px; }
  .abas a { flex-direction: row; gap: 8px; font-size: 14px; min-height: 48px; padding: 0 12px; }
  .abas a.ativa { box-shadow: inset 0 -3px 0 var(--verde); }
  .conteudo { padding: 24px; padding-bottom: 40px; }
  .toast { bottom: 32px; }
  .btn.grande { width: auto; min-width: 280px; }
  .form .btn.grande { width: 100%; }
  .form { max-width: 640px; }
}
