/* Prumo — aparência sóbria e acolhedora; letras confortáveis, botões grandes, bom contraste. */
:root {
  --fundo: #f6f3ee; --cartao: #ffffff; --tinta: #1f2a2e; --suave: #55616a; --linha: #e2dcd2;
  --primaria: #1d5c63; --primaria-escura: #14454b; --primaria-clara: #e3efef; --ouro: #e0b25a;
  --ok: #24693a; --ok-fundo: #e5f2e8; --alerta: #8a5300; --alerta-fundo: #fdf1dc; --perigo: #a3231b; --perigo-fundo: #fbe7e5;
  --raio: 14px; --sombra: 0 1px 2px rgba(31, 42, 46, .06), 0 2px 8px rgba(31, 42, 46, .05);
  --fonte: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fundo); color: var(--tinta); font-family: var(--fonte); line-height: 1.45; -webkit-text-size-adjust: 100%; }
body.com-folha { overflow: hidden; }
h1 { font-size: 1.55rem; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .7rem; font-weight: 650; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; font-weight: 650; color: var(--suave); }
h3.inline { display: inline; margin: 0; }
p { margin: .5rem 0; }
small { font-size: .82rem; }
a { color: var(--primaria); }
:focus-visible { outline: 3px solid var(--ouro); outline-offset: 2px; border-radius: 6px; }
.sub, .ajuda { color: var(--suave); }
.ajuda { font-size: .88rem; display: block; margin: .3rem 0; }
.centro { text-align: center; }
.t-ok { color: var(--ok); } .t-perigo { color: var(--perigo); } .t-alerta { color: var(--alerta); }
.neg { color: var(--perigo); }

/* ---------- Botões ---------- */
.btn { font: inherit; font-size: 1rem; min-height: 48px; padding: .55rem 1.1rem; border-radius: 12px; border: 1.5px solid var(--linha); background: var(--cartao); color: var(--tinta); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none; }
.btn:hover { border-color: var(--primaria); }
.btn.primario { background: var(--primaria); color: #fff; border-color: var(--primaria); font-weight: 600; }
.btn.primario:hover { background: var(--primaria-escura); }
.btn.secundario { background: var(--primaria-clara); border-color: var(--primaria-clara); color: var(--primaria-escura); font-weight: 600; }
.btn.perigo { background: var(--perigo); color: #fff; border-color: var(--perigo); }
.btn.perigo-claro { color: var(--perigo); border-color: #ecc5c1; }
.btn.grande { min-height: 56px; font-size: 1.08rem; padding: .7rem 1.4rem; }
.btn.largo { width: 100%; }
.btn.pequeno { min-height: 40px; padding: .3rem .8rem; font-size: .92rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.gravando { background: var(--perigo); color: #fff; border-color: var(--perigo); }
.btn.arquivo { cursor: pointer; }
.btn-link { font: inherit; background: none; border: 0; color: var(--primaria); text-decoration: underline; cursor: pointer; padding: .5rem 0; min-height: 44px; }
.btn-icone { font: inherit; font-size: 1.2rem; width: 48px; height: 48px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--tinta); text-decoration: none; }
.btn-icone:hover { background: var(--primaria-clara); }
.linha-botoes { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.acoes { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; align-items: center; }
.acoes.secundarias { border-top: 1px solid var(--linha); padding-top: 1rem; }
.acoes.fixo { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--cartao) 25%); padding: 1rem 0 .3rem; margin-bottom: -.3rem; }
.acoes.fixo .btn { flex: 1; }

/* ---------- Formulários ---------- */
.campo { display: block; margin: 0 0 .9rem; border: 0; padding: 0; min-width: 0; }
.rotulo { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .3rem; }
input, select, textarea { font: inherit; font-size: 1rem; width: 100%; min-height: 48px; padding: .55rem .75rem; border: 1.5px solid #cfc7ba; border-radius: 10px; background: #fff; color: var(--tinta); }
textarea { min-height: 0; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; accent-color: var(--primaria); flex: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primaria); outline: 3px solid var(--primaria-clara); }
.in-valor { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: .6rem; align-items: center; margin: .6rem 0; min-height: 44px; cursor: pointer; }
.grade2, .grade3 { display: grid; gap: 0 .8rem; grid-template-columns: 1fr 1fr; }
.grade3 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.linha-data { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.linha-data input[type=date] { flex: 1; min-width: 170px; }
.linha-data .campo { margin: 0; }
.erro { background: var(--perigo-fundo); color: var(--perigo); padding: .7rem .9rem; border-radius: 10px; margin: .6rem 0; font-weight: 500; }
.alerta-txt { color: var(--alerta); background: var(--alerta-fundo); padding: .5rem .8rem; border-radius: 10px; }
.info { background: var(--primaria-clara); padding: .6rem .8rem; border-radius: 10px; }
.confira { color: var(--alerta); font-weight: 600; font-size: .85rem; background: var(--alerta-fundo); padding: 0 .4rem; border-radius: 6px; }
.caixa { border: 1px solid var(--linha); border-radius: 12px; padding: .8rem; margin: .7rem 0; background: #fcfbf9; }
details.mais { margin: .6rem 0; }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--primaria); list-style: none; }
details > summary::before { content: '▸'; transition: transform .15s; }
details[open] > summary::before { transform: rotate(90deg); }
details > summary::-webkit-details-marker { display: none; }

.segmentos { display: flex; background: #ece7df; border-radius: 12px; padding: 4px; margin-bottom: 1rem; gap: 4px; }
.seg { flex: 1; text-align: center; padding: .6rem .3rem; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--suave); min-height: 44px; display: flex; align-items: center; justify-content: center; gap: .3rem; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg.ativo { background: #fff; color: var(--primaria-escura); box-shadow: var(--sombra); }
.seg:has(input:focus-visible) { outline: 3px solid var(--ouro); }
.segmentos.pequeno .seg { font-size: .95rem; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chips.rolagem { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .3rem; margin-bottom: .4rem; }
.chip { font: inherit; font-size: .95rem; border: 1.5px solid #cfc7ba; background: #fff; border-radius: 999px; padding: .45rem .95rem; min-height: 44px; cursor: pointer; display: inline-flex; align-items: center; white-space: nowrap; color: var(--tinta); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip.ativo { background: var(--primaria); border-color: var(--primaria); color: #fff; font-weight: 600; }
.chip:has(input:focus-visible) { outline: 3px solid var(--ouro); }

/* ---------- Selos (cor sempre acompanhada de texto e ícone) ---------- */
.selo { display: inline-flex; align-items: center; gap: .25rem; font-size: .78rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap; }
.selo-realizado { background: var(--ok-fundo); color: var(--ok); }
.selo-previsto { background: var(--primaria-clara); color: var(--primaria-escura); }
.selo-vencido { background: var(--perigo-fundo); color: var(--perigo); }
.selo-cancelado { background: #eeeeee; color: #555; }
.selo-alerta { background: var(--alerta-fundo); color: var(--alerta); }

/* ---------- Estrutura ---------- */
.casca { min-height: 100vh; padding-bottom: 150px; }
.barra-topo { display: flex; justify-content: space-between; align-items: center; padding: .4rem .6rem .4rem 1rem; background: var(--fundo); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--linha); }
.marca { display: flex; flex-direction: column; align-items: center; gap: .3rem; margin-bottom: 1.2rem; }
.marca.pequena { flex-direction: row; margin: 0; gap: .5rem; font-size: 1.15rem; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: url(../icone.svg) center/cover; display: inline-block; }
.marca:not(.pequena) .logo { width: 64px; height: 64px; border-radius: 16px; }
#tela { max-width: 980px; margin: 0 auto; padding: 1rem; outline: none; }
.tela-topo { display: flex; justify-content: space-between; align-items: flex-end; margin: .4rem 0 1rem; }
.nav-lateral { display: none; }
.nav-inferior { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid var(--linha); z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; padding: .45rem .2rem; min-height: 62px; color: var(--suave); text-decoration: none; font-size: .78rem; font-weight: 600; background: none; border: 0; font-family: inherit; cursor: pointer; }
.nav-item .ic { font-size: 1.35rem; line-height: 1; }
.nav-item.ativo { color: var(--primaria); }
.nav-item.ativo .ic { background: var(--primaria-clara); border-radius: 999px; padding: .1rem .9rem; }
.fab { position: fixed; right: 1rem; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 11; font: inherit; font-weight: 700; font-size: 1.08rem; min-height: 60px; padding: 0 1.4rem; border: 0; border-radius: 999px; background: var(--primaria); color: #fff; box-shadow: 0 4px 14px rgba(20, 69, 75, .35); cursor: pointer; display: flex; align-items: center; gap: .4rem; }
.fab span { font-size: 1.5rem; line-height: 1; }
.fab:hover { background: var(--primaria-escura); }
.sem-nav .nav-inferior, .sem-nav .fab, .sem-nav .nav-lateral nav, .sem-nav .nav-rodape { display: none !important; }
@media (min-width: 900px) {
  .casca { display: grid; grid-template-columns: 240px 1fr; padding-bottom: 2rem; }
  .barra-topo, .nav-inferior { display: none; }
  .nav-lateral { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 1.2rem .8rem; background: #fff; border-right: 1px solid var(--linha); }
  .nav-lateral .marca { margin: 0 .5rem 1.6rem; }
  .nav-lateral nav, .nav-rodape { display: flex; flex-direction: column; gap: .2rem; }
  .nav-rodape { margin-top: auto; }
  .nav-lateral .nav-item { flex-direction: row; justify-content: flex-start; gap: .8rem; font-size: 1rem; min-height: 52px; padding: .5rem .9rem; border-radius: 12px; }
  .nav-lateral .nav-item.ativo { background: var(--primaria-clara); }
  .nav-lateral .nav-item.ativo .ic { background: none; padding: 0; }
  .fab { right: 2rem; bottom: 2rem; }
  #tela { padding: 1.5rem 2rem 6rem; }
}

/* ---------- Blocos ---------- */
.cartao-sec { background: var(--cartao); border-radius: var(--raio); padding: 1.1rem; margin-bottom: 1rem; box-shadow: var(--sombra); }
.grade-ind { display: grid; grid-template-columns: 1fr; gap: .8rem; margin-bottom: 1rem; }
@media (min-width: 640px) { .grade-ind { grid-template-columns: 1fr 1fr; } }
.ind { font: inherit; text-align: left; background: var(--cartao); border: 1.5px solid var(--linha); border-radius: var(--raio); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .2rem; box-shadow: var(--sombra); color: var(--tinta); }
button.ind { cursor: pointer; } button.ind:hover { border-color: var(--primaria); }
.ind .rot { font-size: .92rem; color: var(--suave); font-weight: 600; }
.ind strong { font-size: 1.7rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.ind.destaque { background: var(--primaria); color: #fff; border-color: var(--primaria); }
.ind.destaque .rot, .ind.destaque small { color: #d7e8e8; }
.ind.destaque strong.neg { color: #ffd2cc; }
.ind .abrir { font-size: .88rem; font-weight: 600; margin-top: .2rem; }
.faixa { font: inherit; width: 100%; text-align: left; border: 0; padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1rem; cursor: pointer; font-weight: 600; min-height: 48px; }
.faixa.alerta { background: var(--alerta-fundo); color: var(--alerta); }

.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid #efebe4; min-height: 56px; }
.lista > li:last-child { border-bottom: 0; }
.lista > li > .desc { padding: .6rem 0; }
.lista > li > .valor { margin-left: auto; }
.linha-btn { font: inherit; flex: 1; display: flex; align-items: center; justify-content: space-between; gap: .8rem; background: none; border: 0; padding: .65rem .2rem; text-align: left; cursor: pointer; color: var(--tinta); min-height: 56px; min-width: 0; }
.linha-btn:hover { background: #faf8f4; }
.linha-btn.col { flex-direction: column; align-items: stretch; gap: .3rem; }
.desc { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.desc small { color: var(--suave); }
.dir { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; flex: none; }
.valor { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.editar { font-size: .82rem; font-weight: 600; color: var(--primaria); }
.valor.entrada { color: var(--ok); } .valor.saida { color: var(--tinta); } .valor.neutro { color: var(--suave); }
.riscado .desc, .riscado .valor { text-decoration: line-through; opacity: .6; }
.lista.menu .linha-btn { font-size: 1.02rem; }
.lista-dias h3.dia { margin: 1.1rem 0 .2rem; color: var(--tinta); font-size: .95rem; }
.lista-dias h3.dia small { color: var(--suave); font-weight: 400; }
.lista-dias .lista { background: var(--cartao); border-radius: 12px; padding: 0 .7rem; box-shadow: var(--sombra); }

.barras { list-style: none; padding: 0; margin: 0; }
.barras li { margin: .3rem 0 .7rem; }
.barra-rot { display: flex; justify-content: space-between; gap: .5rem; font-size: .95rem; }
.barra { height: 10px; background: #ece7df; border-radius: 999px; overflow: hidden; margin: .25rem 0; }
.barra span { display: block; height: 100%; background: var(--primaria); border-radius: 999px; }
.barra.alerta span { background: #c98a1c; } .barra.perigo span { background: var(--perigo); } .barra.ok span { background: var(--ok); }

.nav-mes { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-bottom: .7rem; font-size: 1.1rem; }
.resumo-mes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; background: var(--cartao); border-radius: 12px; padding: .8rem; box-shadow: var(--sombra); margin-bottom: .8rem; text-align: center; }
.resumo-mes small { display: block; color: var(--suave); }
.resumo-mes strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.busca { margin-bottom: .6rem; }
.abas { display: flex; gap: .3rem; border-bottom: 2px solid var(--linha); margin-bottom: 1rem; overflow-x: auto; }
.aba { font: inherit; font-weight: 600; background: none; border: 0; padding: .7rem 1rem; min-height: 48px; color: var(--suave); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.aba.ativa { color: var(--primaria); border-bottom-color: var(--primaria); }
.vazio { text-align: center; padding: 2rem 1rem; color: var(--suave); }

.tabela { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tabela th, .tabela td { padding: .55rem .4rem; border-bottom: 1px solid #efebe4; text-align: left; vertical-align: top; }
.tabela .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabela tr.total th, .tabela tr.total td { border-top: 2px solid var(--tinta); font-weight: 700; font-size: 1.05rem; }
.tabela tr.sub th, .tabela tr.sub td { font-weight: 650; background: #faf8f4; }
.tabela-rolagem { overflow-x: auto; margin: 0 -.2rem; }
.tabela.imp td { vertical-align: middle; }
.tabela.imp select { min-height: 40px; padding: .3rem .5rem; font-size: .9rem; min-width: 140px; }
.grafico { width: 100%; max-width: 420px; height: auto; color: var(--primaria); display: block; margin: .3rem 0 .8rem; }

/* ---------- Entrada inteligente ---------- */
.inteligente { background: var(--primaria-clara); border-radius: 12px; padding: .8rem; margin-bottom: 1rem; }
.inteligente textarea { background: #fff; }
.previa { background: #fff; border-radius: 10px; padding: .7rem; margin-top: .6rem; border: 1.5px dashed var(--primaria); }
.destaque-parcela { display: flex; gap: .6rem; flex-wrap: wrap; margin: .4rem 0 .9rem; }
.destaque-parcela > div { flex: 1; min-width: 130px; background: var(--alerta-fundo); border: 1.5px solid #f0d49a; border-radius: 10px; padding: .5rem .7rem; display: flex; flex-direction: column; }
.destaque-parcela strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.destaque-parcela p { flex-basis: 100%; margin: 0; }
pre.ocr { white-space: pre-wrap; font-size: .85rem; background: #f4f1ec; padding: .6rem; border-radius: 8px; max-height: 200px; overflow: auto; }
.anexo-img { max-width: 100%; border-radius: 8px; }

/* ---------- Folhas ---------- */
.folha-fundo { position: fixed; inset: 0; background: rgba(20, 30, 33, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: aparece .15s ease-out; }
.folha { background: var(--cartao); width: 100%; max-width: 640px; max-height: 94vh; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; box-shadow: 0 -4px 24px rgba(0, 0, 0, .18); }
.folha.larga { max-width: 980px; }
.folha-topo { display: flex; justify-content: space-between; align-items: center; padding: .7rem .7rem .5rem 1.2rem; border-bottom: 1px solid var(--linha); }
.folha-topo h2 { margin: 0; font-size: 1.2rem; }
.folha-corpo { padding: 1rem 1.2rem 1.4rem; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(1.4rem + env(safe-area-inset-bottom)); }
.texto-grande { font-size: 1.1rem; }
.texto h3 { color: var(--primaria-escura); }
@media (min-width: 700px) { .folha-fundo { align-items: center; padding: 1.5rem; } .folha { border-radius: 18px; max-height: 90vh; } }
@keyframes aparece { from { opacity: 0; } }

.aviso { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom)); z-index: 60; background: var(--tinta); color: #fff; padding: .7rem 1rem; border-radius: 12px; display: flex; gap: 1rem; align-items: center; max-width: calc(100vw - 2rem); box-shadow: 0 4px 16px rgba(0, 0, 0, .25); font-weight: 500; }
.aviso.erro { background: var(--perigo); }
.aviso .btn-link { color: #ffe3a6; font-weight: 700; padding: 0; min-height: 0; }
.aviso[hidden] { display: none; }
@media (min-width: 900px) { .aviso { bottom: 2rem; } }

/* ---------- Acesso e assistente ---------- */
.acesso { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.acesso-caixa { background: var(--cartao); border-radius: 20px; padding: 1.8rem 1.5rem; width: 100%; max-width: 440px; box-shadow: var(--sombra); }
.passos { display: flex; gap: .4rem; list-style: none; padding: 0; margin: 0 0 1rem; flex-wrap: wrap; }
.passos li { padding: .3rem .8rem; border-radius: 999px; background: #ece7df; color: var(--suave); font-size: .88rem; font-weight: 600; }
.passos li.atual { background: var(--primaria); color: #fff; }
.passos li.feito { background: var(--ok-fundo); color: var(--ok); }
.assistente { max-width: 720px; margin: 0 auto; }

@media (max-width: 420px) { :root { font-size: 17px; } .grade2 { grid-template-columns: 1fr; } .ind strong { font-size: 1.5rem; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .nav-inferior, .nav-lateral, .fab, .barra-topo { display: none !important; } }

/* ---------- Sincronização ---------- */
.ind-sync { font-size: .88rem; font-weight: 600; margin: .3rem 0 0; color: var(--ok); }
.ind-sync.pendente { color: var(--suave); } .ind-sync.alerta { color: var(--alerta); }
.chave-sync { font-family: ui-monospace, Consolas, monospace; font-size: 1.3rem; font-weight: 700; letter-spacing: .06em; background: var(--primaria-clara); padding: .8rem 1rem; border-radius: 12px; text-align: center; word-break: break-all; user-select: all; }
