:root {
  --bg: #0f1115; --card: #181b22; --card2: #20242d; --line: #2a2f3a;
  --txt: #e9ecf2; --mut: #8b93a5; --acc: #4ade80; --acc2: #22c55e;
  --red: #f87171; --yel: #fbbf24; --blue: #60a5fa;
  --r: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--txt); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(80px + var(--safe-b)); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--txt); background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acc2); border-color: transparent; }
label { display: block; font-size: 13px; color: var(--mut); margin: 12px 0 6px; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }

header.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 14px 16px 10px; display: flex; align-items: center; justify-content: space-between; }
.mes-nav { display: flex; align-items: center; gap: 6px; }
.mes-nav button { width: 38px; height: 38px; border-radius: 50%; background: var(--card); font-size: 18px; }
.mes-nav .titulo { font-weight: 700; font-size: 18px; min-width: 150px; text-align: center; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--card); color: var(--mut); }

main { padding: 0 16px; max-width: 640px; margin: 0 auto; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.card { background: var(--card); border-radius: var(--r); padding: 14px; }
.card.big { grid-column: span 2; }
.card .lbl { font-size: 12px; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; }
.card .val { font-size: 22px; font-weight: 700; margin-top: 4px; }
.card.big .val { font-size: 30px; }
.bar { height: 8px; background: var(--card2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--acc2); border-radius: 99px; }

h2 { font-size: 14px; color: var(--mut); text-transform: uppercase; letter-spacing: .05em; margin: 20px 4px 8px; display: flex; justify-content: space-between; }
.alerta { background: #3b1518; border: 1px solid #7f1d1d; border-radius: var(--r); padding: 12px 14px; margin-bottom: 12px; }
.alerta b { color: var(--red); }

.lista { background: var(--card); border-radius: var(--r); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.item:last-child { border-bottom: 0; }
.item .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--mut); }
.item .info { flex: 1; min-width: 0; }
.item .nome { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: 13px; color: var(--mut); }
.item .dir { text-align: right; flex: none; }
.item .valor { font-weight: 700; }
.item.pago .nome, .item.pago .valor { color: var(--mut); text-decoration: line-through; }
.st-pago .dot { background: var(--acc2); }
.st-atrasado .dot { background: var(--red); } .st-atrasado .sub { color: var(--red); }
.st-hoje .dot { background: var(--yel); } .st-hoje .sub { color: var(--yel); font-weight: 600; }
.st-breve .dot { background: var(--yel); }
.st-aberto .dot { background: var(--blue); }
.st-meta .dot { background: #fb923c; } .st-meta .sub { color: #fb923c; }
.alerta.meta { background: #3a2410; border-color: #9a3412; } .alerta.meta b { color: #fb923c; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--card2); color: var(--mut); margin-left: 6px; }
.vazio { color: var(--mut); text-align: center; padding: 28px 10px; }
.pagar-btn { background: var(--acc2); color: #052e16; font-weight: 700; padding: 8px 12px; border-radius: 10px; font-size: 14px; }

.cat-linha { display: flex; justify-content: space-between; font-size: 14px; margin: 10px 0 4px; }

nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: #12151bf2; backdrop-filter: blur(10px); border-top: 1px solid var(--line); display: flex; padding-bottom: var(--safe-b); }
nav.tabs button { flex: 1; padding: 10px 0 12px; font-size: 12px; color: var(--mut); display: flex; flex-direction: column; align-items: center; gap: 2px; }
nav.tabs button .ic { font-size: 22px; line-height: 1; }
nav.tabs button.on { color: var(--acc); }
.fab { position: fixed; right: 18px; bottom: calc(84px + var(--safe-b)); z-index: 11; width: 58px; height: 58px; border-radius: 50%; background: var(--acc2); color: #052e16; font-size: 32px; font-weight: 300; box-shadow: 0 8px 24px #0008; }

.sheet-bg { position: fixed; inset: 0; background: #000a; z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--card); border-radius: 22px 22px 0 0; padding: 8px 18px calc(22px + var(--safe-b)); max-height: 92vh; overflow-y: auto; max-width: 640px; margin: 0 auto; animation: sobe .18s ease-out; }
@keyframes sobe { from { transform: translateY(40px); opacity: 0; } }
.sheet .puxador { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 12px; }
.sheet h3 { margin: 0 0 4px; font-size: 20px; }
.btn { display: block; width: 100%; padding: 14px; border-radius: 14px; font-weight: 700; margin-top: 12px; background: var(--card2); }
.btn.pri { background: var(--acc2); color: #052e16; }
.btn.perigo { color: var(--red); }
.seg { display: flex; background: var(--card2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 9px 4px; border-radius: 9px; font-size: 14px; color: var(--mut); }
.seg button.on { background: var(--bg); color: var(--txt); font-weight: 600; }
.escolha { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.escolha button { background: var(--card2); border-radius: 16px; padding: 22px 10px; font-weight: 600; }
.escolha button span { display: block; font-size: 30px; margin-bottom: 6px; }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); background: #fff; color: #111; padding: 10px 18px; border-radius: 99px; z-index: 30; font-weight: 600; font-size: 14px; box-shadow: 0 6px 20px #0006; }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; padding-bottom: 60px; }
.login .logo { font-size: 46px; }
.login h1 { margin: 8px 0 2px; }
.login p { color: var(--mut); margin: 0 0 18px; text-align: center; }
.pin-dots { display: flex; gap: 14px; margin: 14px 0 24px; height: 16px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--mut); }
.pin-dots i.on { background: var(--acc); border-color: var(--acc); }
.teclado { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; }
.teclado button { height: 76px; border-radius: 50%; background: var(--card); font-size: 26px; font-weight: 500; }
.teclado button:active { background: var(--card2); }
.login .msg { color: var(--red); min-height: 22px; margin-top: 14px; }

.orc { cursor: pointer; }
.anexo { display: block; background: var(--card2); border: 1px dashed var(--line); border-radius: 12px; padding: 14px; text-align: center; color: var(--txt); font-size: 15px; margin: 0; cursor: pointer; }
.btn[disabled] { opacity: .6; }
/* iPhone: espaço da barra de status quando aberto como app */
header.top { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
.login { padding-top: calc(24px + env(safe-area-inset-top, 0px)); }

[hidden] { display: none !important; }
