/* Assistente Financeiro — layout: coluna única estilo app, cabeçalho com o mês, resumo, contas e entradas */
:root {
  --bg: #F2F6F3;
  --surface: #FFFFFF;
  --surface-2: #E9F1EC;
  --ink: #17271F;
  --muted: #5B6C63;
  --line: #D8E3DC;
  --accent: #2E7A57;
  --accent-strong: #1F5C40;
  --accent-ink: #FFFFFF;
  --accent-soft: #DFEFE6;
  --ok: #2E7A57;
  --warn: #A86A12;
  --warn-soft: #FBEFD9;
  --danger: #B83A2E;
  --danger-soft: #F9E1DE;
  --shadow: 0 1px 2px rgba(20, 40, 30, .06), 0 6px 18px rgba(20, 40, 30, .06);
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r: 14px;
}
:root[data-tema="rosa"] {
  --bg: #FBF3F6;
  --surface: #FFFFFF;
  --surface-2: #F6E6ED;
  --ink: #2C1A22;
  --muted: #76606A;
  --line: #EED9E2;
  --accent: #BF4F7B;
  --accent-strong: #9A3760;
  --accent-ink: #FFFFFF;
  --accent-soft: #F8E1EB;
  --shadow: 0 1px 2px rgba(60, 20, 35, .06), 0 6px 18px rgba(60, 20, 35, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101612; --surface: #18201B; --surface-2: #1F2A23; --ink: #E4EDE7; --muted: #98A99F; --line: #2A3730;
    --accent: #5FC08F; --accent-strong: #84D3AA; --accent-ink: #0C1C13; --accent-soft: #1E3A2B;
    --ok: #5FC08F; --warn: #E0A84A; --warn-soft: #3A2D16; --danger: #EE7A6C; --danger-soft: #3D1E1A;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
  :root:not([data-theme="light"])[data-tema="rosa"] {
    --bg: #171013; --surface: #21171B; --surface-2: #2B1E24; --ink: #F1E5EA; --muted: #B39CA6; --line: #3A2A31;
    --accent: #EB8CB1; --accent-strong: #F3AFC9; --accent-ink: #2A0F1B; --accent-soft: #3E2230;
  }
}
:root[data-theme="dark"] {
  --bg: #101612; --surface: #18201B; --surface-2: #1F2A23; --ink: #E4EDE7; --muted: #98A99F; --line: #2A3730;
  --accent: #5FC08F; --accent-strong: #84D3AA; --accent-ink: #0C1C13; --accent-soft: #1E3A2B;
  --ok: #5FC08F; --warn: #E0A84A; --warn-soft: #3A2D16; --danger: #EE7A6C; --danger-soft: #3D1E1A;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}
:root[data-theme="dark"][data-tema="rosa"] {
  --bg: #171013; --surface: #21171B; --surface-2: #2B1E24; --ink: #F1E5EA; --muted: #B39CA6; --line: #3A2A31;
  --accent: #EB8CB1; --accent-strong: #F3AFC9; --accent-ink: #2A0F1B; --accent-soft: #3E2230;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 560px; margin: 0 auto; padding-block: 14px 120px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- Topo ---------- */
.topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marca { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marca-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-family: var(--f-display); font-weight: 700; font-size: 15px; flex: none; }
.marca h1 { margin: 0; font-family: var(--f-display); font-size: 18px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.marca small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-ico { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; flex: none; }
.btn-ico svg { width: 20px; height: 20px; }

/* ---------- Seletor de mês ---------- */
.mes { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mes h2 { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: clamp(26px, 8vw, 34px); letter-spacing: -.02em; line-height: 1; text-wrap: balance; text-align: center; }
.mes h2 span { color: var(--muted); font-weight: 500; }
.mes .btn-ico { border-radius: 50%; }

.demo-aviso { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 12px; font-size: 13px; }

/* ---------- Resumo ---------- */
.resumo { background: var(--accent); color: var(--accent-ink); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.resumo-sobra small { text-transform: uppercase; letter-spacing: .08em; font-size: 11.5px; opacity: .85; font-weight: 600; }
.resumo-sobra strong { display: block; font-family: var(--f-display); font-size: clamp(32px, 10vw, 42px); font-weight: 700; letter-spacing: -.02em; line-height: 1.05; }
.resumo-sobra p { margin: 4px 0 0; font-size: 13px; opacity: .9; }
.resumo-linha { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.resumo-linha div { background: rgba(255,255,255,.14); border-radius: 12px; padding: 10px 12px; min-width: 0; }
:root[data-theme="dark"] .resumo-linha div { background: rgba(0,0,0,.12); }
.resumo-linha small { display: block; font-size: 12px; opacity: .85; }
.resumo-linha b { font-size: 17px; font-weight: 700; }
.barra { height: 8px; border-radius: 99px; background: rgba(255,255,255,.25); overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--accent-ink); border-radius: 99px; transition: width .4s ease; }
.barra-txt { display: flex; justify-content: space-between; font-size: 12.5px; opacity: .92; margin-top: 6px; gap: 8px; flex-wrap: wrap; }

/* ---------- Alertas ---------- */
.alerta { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.alerta.atraso { background: var(--danger-soft); color: var(--danger); }
.alerta.breve { background: var(--warn-soft); color: var(--warn); }
.alerta b { font-weight: 700; }

/* ---------- Seções ---------- */
.secao { display: flex; flex-direction: column; gap: 10px; }
.secao-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.secao-cab h3 { margin: 0; font-family: var(--f-display); font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.secao-cab span { color: var(--muted); font-size: 13.5px; }
.link { background: none; border: 0; color: var(--accent-strong); font-weight: 600; padding: 4px 0; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Lista de contas ---------- */
.lista { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item-corpo { min-width: 0; background: none; border: 0; text-align: left; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.item-nome { font-weight: 600; font-size: 15.5px; overflow-wrap: anywhere; }
.item-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.ponto { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.selo { border-radius: 6px; padding: 1px 6px; font-weight: 600; font-size: 11.5px; }
.selo.atraso { background: var(--danger-soft); color: var(--danger); }
.selo.breve { background: var(--warn-soft); color: var(--warn); }
.selo.pago { background: var(--accent-soft); color: var(--ok); }
.item-valor { font-weight: 700; font-size: 15.5px; text-align: right; white-space: nowrap; }
.item.pago .item-nome, .item.pago .item-valor { color: var(--muted); }
.item.pago .item-valor { text-decoration: line-through; text-decoration-thickness: 1px; }

.check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; padding: 0; flex: none; transition: background .15s, border-color .15s; }
.check svg { width: 16px; height: 16px; opacity: 0; color: var(--accent-ink); }
.check[aria-checked="true"] { background: var(--ok); border-color: var(--ok); }
.check[aria-checked="true"] svg { opacity: 1; }
.item.atrasada .check { border-color: var(--danger); }

.vazio { text-align: center; padding: 26px 18px; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.vazio strong { color: var(--ink); font-family: var(--f-display); font-size: 17px; }
.vazio p { margin: 0; max-width: 34ch; }

/* ---------- Categorias ---------- */
.cats { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.cat { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13.5px; }
.cat-barra { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.cat-barra i { display: block; height: 100%; border-radius: 99px; }
.cat span:first-child { display: flex; align-items: center; gap: 6px; }

/* ---------- Botões ---------- */
.btn { border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 700; background: var(--accent); color: var(--accent-ink); }
.btn.sec { background: var(--surface-2); color: var(--ink); }
.btn.perigo { background: var(--danger-soft); color: var(--danger); }
.btn.bloco { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.fab { position: fixed; right: max(18px, calc(env(safe-area-inset-right, 0px) + 12px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  border: 0; border-radius: 99px; padding: 14px 20px; background: var(--accent); color: var(--accent-ink); font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); display: flex; align-items: center; gap: 8px; z-index: 20; }
.fab svg { width: 18px; height: 18px; }

/* ---------- Folhas (modais) ---------- */
.fundo { position: fixed; inset: 0; background: rgba(10, 20, 15, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.folha { background: var(--surface); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; max-height: 92%; overflow-y: auto;
  padding: 18px max(18px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 18px) max(18px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 14px; animation: sobe .22s ease; }
@media (min-width: 640px) { .fundo { align-items: center; } .folha { border-radius: 22px; } }
@keyframes sobe { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .folha { animation: none; } .barra i { transition: none; } }
.folha-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.folha-cab h3 { margin: 0; font-family: var(--f-display); font-size: 21px; }
.campo { display: flex; flex-direction: column; gap: 5px; }
.campo label { font-size: 13px; font-weight: 600; color: var(--muted); }
.campo input, .campo select, .campo textarea { border: 1px solid var(--line); background: var(--bg); border-radius: 11px; padding: 11px 12px; width: 100%; min-width: 0; font-size: 16px; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.linha2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 14.5px; padding: 4px 0; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.acoes { display: flex; gap: 10px; flex-wrap: wrap; }
.acoes .btn { flex: 1 1 140px; }
.erro { color: var(--danger); font-size: 13.5px; min-height: 1em; margin: 0; }
.dica { color: var(--muted); font-size: 13px; margin: 0; }

.menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border: 0; border-top: 1px solid var(--line); background: none; width: 100%; text-align: left; font-weight: 600; }
.menu-item small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; }
.temas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tema-op { border: 2px solid var(--line); border-radius: 14px; padding: 12px; background: var(--surface); display: flex; align-items: center; gap: 10px; font-weight: 700; }
.tema-op[aria-pressed="true"] { border-color: var(--accent); }
.tema-op i { width: 22px; height: 22px; border-radius: 50%; display: inline-block; }
.passos { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.copiavel { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.copiavel span { flex: 1; min-width: 0; overflow-wrap: anywhere; user-select: all; }

/* ---------- Login / bloqueio ---------- */
.porta { min-height: 100%; display: flex; flex-direction: column; justify-content: center; max-width: 420px; margin: 0 auto; padding-block: 40px; gap: 18px; }
.porta-marca { display: flex; flex-direction: column; gap: 8px; }
.porta-marca .marca-ico { width: 52px; height: 52px; border-radius: 15px; font-size: 21px; }
.porta h1 { font-family: var(--f-display); font-size: 30px; margin: 0; letter-spacing: -.02em; line-height: 1.1; text-wrap: balance; }
.porta p { margin: 0; color: var(--muted); }
.cartao { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.abas { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.abas button { border: 0; background: none; border-radius: 9px; padding: 9px; font-weight: 700; color: var(--muted); }
.abas button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.rodape { text-align: center; color: var(--muted); font-size: 12.5px; padding-top: 10px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 99px; font-size: 14px; font-weight: 600; z-index: 60; max-width: calc(100% - 32px); text-align: center; }

/* ---------- Admin ---------- */
.tabela-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; }
th { border-top: 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
td .btn { padding: 6px 10px; font-size: 13px; }
