/* GESTÃO FINANCEIRA no iPhone. Cores e tamanhos centralizados aqui (tokens em :root). */
:root {
  --primaria: #244062; --primaria-clara: #E4EAF2; --titulo: #1F497D; --fundo: #F4F2EC; --branco: #fff;
  --texto: #1C2024; --texto-2: #4A4F55; --texto-3: #7A7F86; --borda: #D8D4CA; --pos: #0070C0; --neg: #C00000;
  --ok: #1E6B3A; --ok-fundo: #E3F4E8; --aviso: #7A4E00; --aviso-fundo: #FFF4D6; --erro-fundo: #FBE3DE;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; overflow-x: hidden; overscroll-behavior: none; background: #2B2F35; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--texto); }
/* no iPhone, a tela do app ocupa a tela inteira (100dvh deixava uma faixa preta embaixo no app instalado) */
.tela-celular { position: fixed; inset: 0; max-width: 420px; margin: 0 auto; background: var(--fundo); display: flex; flex-direction: column; overflow: hidden; touch-action: pan-y; }
@media (min-width: 600px) { body { padding: 24px 0; } .tela-celular { position: relative; inset: auto; height: 860px; border-radius: 36px; overflow: hidden; box-shadow: 0 0 0 10px #111, 0 20px 50px rgba(0,0,0,.5); } }
.faixa-teste { flex: none; background: #FFE58A; color: #5A4300; font-size: 11px; text-align: center; padding: 4px 8px; }
header { flex: none; background: var(--primaria); color: #fff; padding: calc(12px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 12px max(12px, env(safe-area-inset-left, 0px)); display: grid; grid-template-columns: 76px 1fr 76px; align-items: center; gap: 4px; }
header h1 { font-size: 16px; margin: 0; letter-spacing: .04em; text-align: center; grid-column: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header button { background: transparent; border: 0; color: #fff; font-size: 14px; padding: 6px; }
header .esq { justify-self: start; grid-column: 1; grid-row: 1; } header .dir { justify-self: end; grid-column: 3; grid-row: 1; }
header .voltar { border: 1px solid rgba(255,255,255,.55); border-radius: 8px; padding: 5px 10px; font-weight: 600; font-size: 14px; }
main { flex: 1; min-height: 0; padding: 14px max(14px, env(safe-area-inset-right, 0px)) 14px max(14px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 12px; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.cartao { background: var(--branco); border: 1px solid var(--borda); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--texto-3); font-size: 13px; }
.forte { font-weight: 700; }
.btn { height: 44px; border-radius: 10px; border: 1px solid var(--borda); background: var(--branco); color: var(--texto); font-size: 15px; padding: 0 14px; font-weight: 600; }
.btn.prim { background: var(--primaria); color: #fff; border-color: var(--primaria); }
.btn.grande { height: 56px; font-size: 17px; width: 100%; }
.btn.peq { height: 34px; font-size: 13px; padding: 0 10px; }
.btn:disabled { opacity: .5; }
label.campo { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--texto-2); font-weight: 600; }
input, select { height: 44px; border: 1px solid var(--borda); border-radius: 8px; padding: 0 10px; font-size: 16px; background: var(--branco); color: var(--texto); width: 100%; }
/* iPhone: o campo de data tem largura própria e empurrava a tela para o lado */
input[type=date], input[type=month] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; text-align: left; }
/* iPhone: sem a aparência nativa, a data ficava no alto do campo; centraliza na altura */
input[type=date], input[type=month] { line-height: 42px; padding-top: 0; padding-bottom: 0; }
input[type=date]::-webkit-date-and-time-value, input[type=month]::-webkit-date-and-time-value { text-align: left; margin: 0; line-height: 42px; }
.linha { display: flex; gap: 8px; align-items: flex-end; }
.linha > * { flex: 1; min-width: 0; }
.seg { display: flex; border: 1px solid var(--primaria); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; height: 38px; border: 0; background: var(--branco); color: var(--primaria); font-size: 13px; font-weight: 600; }
.seg button.on { background: var(--primaria); color: #fff; }
.msg { border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.msg.ok { background: var(--ok-fundo); color: var(--ok); }
.msg.aviso { background: var(--aviso-fundo); color: var(--aviso); }
.msg.erro { background: var(--erro-fundo); color: var(--neg); }
.item { display: flex; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid #EEE; }
.item:first-child { border-top: 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--neg); font-weight: 700; } .pos { color: var(--pos); font-weight: 700; }
.etiqueta { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: var(--aviso-fundo); color: var(--aviso); font-weight: 600; }
.etiqueta.ok { background: var(--ok-fundo); color: var(--ok); }
/* menu de baixo: mesmo espaço em cima e embaixo dos ícones; embaixo só o necessário para não encostar na barra de gestos do iPhone */
nav.abas { flex: none; display: flex; border-top: 1px solid var(--borda); background: var(--branco); padding-bottom: max(0px, calc(env(safe-area-inset-bottom, 0px) - 22px)); }
nav.abas button { flex: 1; border: 0; background: transparent; padding: 6px 0; font-size: 12px; color: var(--texto-3); font-weight: 600; }
nav.abas button.on { color: var(--primaria); }
nav.abas .ic { display: block; font-size: 20px; margin-bottom: 2px; }
.lista-sug { border: 1px solid var(--borda); border-radius: 8px; background: var(--branco); max-height: 200px; overflow-y: auto; }
.lista-sug div { padding: 10px; border-top: 1px solid #F0F0F0; font-size: 15px; }
.lista-sug div.g { background: var(--fundo); font-size: 11px; font-weight: 700; color: var(--titulo); letter-spacing: .05em; padding: 6px 10px; }
.fundo-modal { position: fixed; inset: 0; background: rgba(20,24,28,.55); display: flex; align-items: center; justify-content: center; z-index: 30;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.folha { background: var(--branco); width: 100%; max-width: 400px; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; max-height: 85vh; max-height: 85dvh; overflow: hidden; }
.folha .rolar { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0; max-height: none; }
.seletor { height: 44px; width: 100%; border: 1px solid var(--borda); border-radius: 8px; background: var(--branco); color: var(--texto); font-size: 16px;
  padding: 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; font-weight: 400; }
.seletor .vazio { color: var(--texto-3); } .seletor .seta { color: var(--texto-3); flex: none; }
.seletor span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item.toque { cursor: pointer; }
.barra-teclado { position: fixed; left: 0; right: 0; top: 0; z-index: 40; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: calc(6px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 6px max(12px, env(safe-area-inset-left, 0px));
  background: #E9E6DD; border-bottom: 1px solid var(--borda); box-shadow: 0 2px 8px rgba(0,0,0,.12); font-size: 13px; color: var(--texto-2); }
.barra-teclado button { height: 36px; padding: 0 18px; border-radius: 8px; border: 0; background: var(--primaria); color: #fff; font-weight: 700; font-size: 15px; }
.ajuda { font-size: 12px; color: var(--texto-3); font-weight: 400; }
.teclas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.teclas button { height: 48px; font-size: 20px; border-radius: 10px; border: 1px solid var(--borda); background: var(--fundo); }
.rosto { width: 92px; height: 92px; border-radius: 24px; border: 4px solid var(--primaria); margin: 10px auto; display: flex; align-items: center; justify-content: center; font-size: 46px; }
.giro { animation: giro 1.1s linear infinite; } @keyframes giro { to { transform: rotate(360deg); } }
.passos { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.passos div::before { content: "○ "; color: var(--texto-3); } .passos div.feito::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.rodape-form { flex: none; background: var(--fundo); border-top: 1px solid var(--borda); padding: 8px 14px; display: flex; gap: 8px; }
.rodape-form .btn { flex: 1; }
.cat-linha { display: grid; grid-template-columns: 1fr; gap: 6px; border: 1px dashed var(--borda); border-radius: 10px; padding: 8px; }
.x { background: transparent; border: 0; font-size: 20px; color: var(--texto-3); }
/* app de verdade */
.faixa-teste { padding-top: calc(4px + env(safe-area-inset-top, 0px)); }
.faixa-teste + header { padding-top: 12px; }
.lista-estado { font-size: 12px; }
.item.erro { background: var(--erro-fundo); border-radius: 8px; padding: 10px 8px; }
.oculto { display: none; }
header .sair { border: 1px solid rgba(255,255,255,.55); border-radius: 8px; padding: 5px 10px; font-weight: 600; font-size: 14px; }
/* teclado aberto: o menu de baixo sai para sobrar espaço para os campos */
body.teclado nav.abas { display: none; }
body.teclado .faixa-teste { display: none; }
