@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(fontes/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(fontes/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(fontes/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Inter; font-weight: 700; font-display: swap; src: url(fontes/inter-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Montserrat; font-weight: 600; font-display: swap; src: url(fontes/montserrat-latin-600-normal.woff2) format("woff2"); }

:root {
  --principal: #13233F;
  --principal-2: #2A3F66;
  --suave: #E6EAF2;
  --fundo: #F4F5F8;
  --tinta: #0E1626;
  --texto-2: #5B6475;
  --linha: #E3E6EC;
  --cartao: #FFFFFF;
  --receita: #2E8B57;
  --despesa: #C8102E;
  --pendente: #C9932E;
  --nav-altura: 68px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--fundo); }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--tinta); font-size: 15px; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

.tela {
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 18px calc(var(--nav-altura) + env(safe-area-inset-bottom) + 28px);
  min-height: 100vh;
}
.tela.sem-nav { padding-bottom: calc(env(safe-area-inset-bottom) + 28px); }

/* Barra inferior */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--cartao); border-top: 1px solid var(--linha);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: calc(var(--nav-altura) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 500; color: var(--texto-2); }
.nav a.ativo { color: var(--principal); font-weight: 700; }
.nav svg { width: 22px; height: 22px; }
.nav .mais span { width: 52px; height: 52px; border-radius: 16px; background: var(--principal); color: #fff; display: grid; place-items: center; margin-top: -24px; box-shadow: 0 8px 18px -6px rgba(19,35,63,.55); }
.nav .mais svg { width: 24px; height: 24px; }
body.sem-nav .nav { display: none; }

/* Cabeçalhos */
.topo { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 16px; gap: 12px; }
.topo .ola { font-size: 13px; color: var(--texto-2); }
.topo .nome { font-family: Montserrat, Inter, sans-serif; font-weight: 600; font-size: 18px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--cartao); display: grid; place-items: center; color: #111; flex-shrink: 0; }
.titulo { font-family: Montserrat, Inter, sans-serif; font-weight: 600; font-size: 21px; padding: 6px 0 14px; }
.barra-titulo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 14px; }
.barra-titulo b { font-size: 16px; }
.voltar { width: 40px; height: 40px; display: grid; place-items: center; font-size: 22px; border-radius: 12px; }

/* Cartão de saldo */
.saldo { background: var(--principal); color: #fff; border-radius: 22px; padding: 20px; position: relative; overflow: hidden; }
.saldo .rot { font-size: 12px; opacity: .75; }
.saldo .valor { font-family: Montserrat, Inter, sans-serif; font-weight: 600; font-size: 30px; margin: 4px 0 16px; letter-spacing: -.01em; }
.saldo .linha2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.saldo .mini { background: rgba(255,255,255,.09); border-radius: 14px; padding: 10px 12px; }
.saldo .mini span { display: block; font-size: 11px; opacity: .75; }
.saldo .mini b { font-size: 15px; font-weight: 600; }
.saldo .marca-fundo { position: absolute; right: -28px; top: -28px; width: 150px; height: 150px; color: #fff; opacity: .08; }

.secao { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 10px; }
.secao h3 { font-size: 14px; font-weight: 600; }
.secao a, .secao span { font-size: 12px; color: var(--principal-2); font-weight: 600; }

.cartao { background: var(--cartao); border-radius: 18px; padding: 4px 14px; }
.vazio { background: var(--cartao); border-radius: 18px; padding: 22px 16px; text-align: center; color: var(--texto-2); font-size: 13px; line-height: 1.5; }

/* Itens */
.item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--linha); cursor: pointer; }
.item:last-child { border-bottom: 0; }
.ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; font-size: 18px; }
.ic.receita { background: #DDEEE3; } .ic.despesa { background: #F6DDD8; } .ic.pendente { background: #F7EBD3; } .ic.atrasada { background: #F6DDD8; }
.item .desc { flex: 1; min-width: 0; }
.item .desc b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .desc span { font-size: 12px; color: var(--texto-2); }
.item .desc .nota-linha { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.item .v { font-size: 14px; font-weight: 600; text-align: right; white-space: nowrap; }
.item .v small { display: block; margin-top: 3px; }
.pos { color: var(--receita); } .neg { color: var(--despesa); }
.tag { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 99px; letter-spacing: .02em; }
.tag.pend { background: #F7EBD3; color: #8A6216; }
.tag.venc { background: #F6DDD8; color: #9A3626; }
.tag.pago { background: #DDEEE3; color: #2D6B46; }
.pagar { width: 36px; height: 36px; border-radius: 12px; border: 1.5px solid var(--linha); display: grid; place-items: center; color: var(--receita); flex-shrink: 0; }
.pagar svg { width: 18px; height: 18px; }
.pagar:active { background: #DDEEE3; }

/* Filtros e busca */
.chips { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { font-size: 12px; font-weight: 600; padding: 8px 14px; border-radius: 99px; background: var(--cartao); color: var(--texto-2); white-space: nowrap; }
.chip.on { background: var(--principal); color: #fff; }
.busca { background: var(--cartao); border-radius: 14px; padding: 0 14px; display: flex; gap: 8px; align-items: center; margin-bottom: 12px; color: var(--texto-2); }
.busca svg { width: 18px; height: 18px; flex-shrink: 0; }
.busca input { border: 0; outline: 0; background: none; padding: 12px 0; width: 100%; font-size: 14px; color: var(--tinta); }
.dia { font-size: 11px; font-weight: 700; color: var(--texto-2); text-transform: uppercase; letter-spacing: .06em; margin: 16px 2px 6px; }


/* Formulário */
.tipo { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--cartao); border-radius: 14px; padding: 4px; gap: 4px; }
.tipo label { text-align: center; font-size: 13px; font-weight: 600; padding: 10px 0; border-radius: 10px; color: var(--texto-2); cursor: pointer; }
.tipo input { position: absolute; opacity: 0; pointer-events: none; }
.tipo label:has(input:checked) { color: #fff; background: var(--despesa); }
.tipo label.receita:has(input:checked) { background: var(--receita); }
.tipo label.apagar:has(input:checked) { background: var(--pendente); }
.grande { text-align: center; padding: 20px 0 16px; }
.grande small { font-size: 12px; color: var(--texto-2); }
.grande input { display: block; width: 100%; border: 0; outline: 0; background: none; text-align: center; font-family: Montserrat, Inter, sans-serif; font-weight: 600; font-size: 40px; color: var(--despesa); }
.grande.receita input { color: var(--receita); } .grande.apagar input { color: var(--pendente); }
.campo { display: flex; align-items: center; gap: 12px; padding: 4px 0; min-height: 50px; border-bottom: 1px solid var(--linha); }
.campo:last-child { border-bottom: 0; }
.campo .k { color: var(--texto-2); font-size: 12px; width: 84px; flex-shrink: 0; }
.campo input, .campo select { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-weight: 600; font-size: 15px; padding: 10px 0; }
.campo select { appearance: none; -webkit-appearance: none; }
.campo .dica { font-size: 12px; color: var(--texto-2); white-space: nowrap; }
.item .desc b small { font-weight: 500; color: var(--texto-2); font-size: 12px; }
.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--linha); transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--principal); }
.switch input:checked + span::after { transform: translateX(18px); }
.cats { display: flex; gap: 8px; flex-wrap: wrap; }
.cats label { font-size: 13px; padding: 8px 12px; background: var(--cartao); border-radius: 10px; font-weight: 500; cursor: pointer; border: 2px solid transparent; }
.cats input { position: absolute; opacity: 0; pointer-events: none; }
.cats label:has(input:checked) { border-color: var(--principal); font-weight: 700; }
.nota { display: block; width: 100%; border: 0; outline: 0; resize: vertical; background: var(--cartao); border-radius: 14px; padding: 12px 14px; font: inherit; font-size: 14px; line-height: 1.45; color: var(--tinta); min-height: 76px; }
.nota:focus { box-shadow: 0 0 0 2px var(--principal); }
.botao { display: block; width: 100%; background: var(--principal); color: #fff; font-weight: 600; font-size: 15px; text-align: center; padding: 15px; border-radius: 16px; margin-top: 18px; }
.botao.secundario { background: var(--cartao); color: var(--tinta); }
.botao.perigo { background: none; color: var(--despesa); margin-top: 8px; }
.erro { color: var(--despesa); font-size: 13px; text-align: center; margin-top: 10px; }

/* Calendário */
.calendario { background: var(--cartao); border-radius: 18px; padding: 6px 8px 10px; margin-bottom: 12px; }
.cal-topo { display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 600; padding-bottom: 4px; }
.cal-topo span { text-transform: capitalize; }
.cal-topo button { width: 40px; height: 36px; border-radius: 10px; font-size: 20px; color: var(--texto-2); }
.cal-grade { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-sem { font-size: 11px; font-weight: 600; color: var(--texto-2); padding: 4px 0; }
.cal-dia { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 5px; border-radius: 10px; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.cal-dia i { display: flex; gap: 2px; height: 5px; }
.cal-dia i b { width: 5px; height: 5px; border-radius: 50%; }
.cal-dia i b.receita { background: var(--receita); }
.cal-dia i b.despesa { background: var(--despesa); }
.cal-dia i b.pendente { background: var(--pendente); }
.cal-dia.fora { color: #B7BCC6; }
.cal-dia.hoje span { color: var(--principal); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.cal-dia.sel { background: var(--principal); color: #fff; }
.cal-dia.sel span { color: #fff; }
.cal-dia.sel i b { box-shadow: 0 0 0 1px #fff; }
.dia-sel { display: flex; justify-content: space-between; align-items: center; }
.dia-sel button { font-size: 11px; font-weight: 700; color: var(--principal-2); letter-spacing: .04em; }

/* Contas */
.resumo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.resumo div { background: var(--cartao); border-radius: 16px; padding: 12px 14px; }
.resumo span { font-size: 11px; color: var(--texto-2); }
.resumo b { display: block; font-size: 17px; margin-top: 2px; }

/* Relatórios */
.barras { background: var(--cartao); border-radius: 18px; padding: 16px 14px 12px; }
.barras .leg { display: flex; gap: 14px; font-size: 11px; color: var(--texto-2); margin-bottom: 10px; }
.barras .leg i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.graf { display: flex; align-items: flex-end; justify-content: space-between; height: 130px; gap: 8px; }
.graf .m { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.graf .par { display: flex; gap: 3px; align-items: flex-end; height: 106px; }
.graf .par i { width: 11px; border-radius: 4px 4px 0 0; display: block; min-height: 2px; }
.graf .m span { font-size: 10px; color: var(--texto-2); text-transform: uppercase; }
.graf .m.atual span { color: var(--tinta); font-weight: 700; }
.cat-linha { padding: 11px 0; border-bottom: 1px solid var(--linha); }
.cat-linha:last-child { border-bottom: 0; }
.cat-linha .t { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 7px; }
.cat-linha .t b { font-weight: 600; }
.trilho { height: 6px; background: var(--fundo); border-radius: 99px; overflow: hidden; }
.trilho i { display: block; height: 100%; border-radius: 99px; background: var(--principal); }

/* Ajustes */
.ajuste { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--linha); font-size: 14px; font-weight: 500; width: 100%; text-align: left; }
.ajuste:last-child { border-bottom: 0; }
.ajuste small { display: block; font-size: 12px; color: var(--texto-2); font-weight: 400; margin-top: 2px; }
.marca-rodape { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 32px; color: #111; font-size: 11px; letter-spacing: .25em; font-weight: 600; }
.marca-rodape svg { width: 40px; height: 40px; }

/* Aviso rápido */
.aviso {
  position: fixed; left: 50%; bottom: calc(var(--nav-altura) + env(safe-area-inset-bottom) + 14px); transform: translate(-50%, 20px);
  background: var(--tinta); color: #fff; font-size: 13px; font-weight: 500; padding: 11px 16px; border-radius: 12px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; max-width: calc(100% - 32px); text-align: center;
}
.aviso.on { opacity: 1; transform: translate(-50%, 0); }
