/* ===================== Mavia Finance =====================
   Três temas (data-palette = eletrica | violeta | coral), cada um com modo claro e escuro
   (data-theme = light | dark; sem atributo = segue o sistema). Fontes servidas pelo próprio app (OFL, ver fonts/). */
@font-face { font-family: "Inter"; src: url(fonts/inter.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url(fonts/space-grotesk.woff2) format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url(fonts/plus-jakarta-sans.woff2) format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Sora"; src: url(fonts/sora.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }

/* ---------- Séries dos gráficos (iguais nos três temas; variam só com o modo) ---------- */
:root {
  color-scheme: light;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948; --s-other: #8a8985;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #2a9a2a; --s7: #9085e9; --s8: #e66767; --s-other: #8a8985; }
}
:root[data-theme="dark"] { color-scheme: dark;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #2a9a2a; --s7: #9085e9; --s8: #e66767; --s-other: #8a8985; }

/* ---------- Luz violeta (padrão) ---------- */
:root, [data-palette="violeta"] {
  --font-h: "Plus Jakarta Sans", system-ui, sans-serif; --font-b: "Plus Jakarta Sans", system-ui, sans-serif;
  --r: 22px; --r-sm: 13px;
  --bg: #f6f6fa; --surface: #ffffff; --surface-2: #eeeef6; --border: #e3e3ee;
  --ink: #14141c; --ink-2: #5e6070; --ink-3: #6e7082;
  --accent: #5b4beb; --accent-ink: #ffffff; --link: #4b3bd9; --focus: #5b4beb;
  --hero-bg: #5b4beb; --hero-ink: #ffffff; --hero-ink-2: #e1ddff; --hero-chip: rgba(255,255,255,.14);
  --nav-bg: #ffffff; --nav-fg: #14141c; --nav-ink: #5e6070; --nav-bd: #e3e3ee; --nav-act-bg: #e9e6ff; --nav-act-ink: #3a2cb8;
  --chip-bg: #e9e6ff; --chip-ink: #3a2cb8;
  --pos: #0b7d52; --bad: #b93a0b; --ok: #0b7d52; --warn: #9a6200; --grid: #e9e9f1; --shadow: rgba(40,30,120,.12);
}
@media (prefers-color-scheme: dark) { [data-palette="violeta"]:not([data-theme="light"]) {
  --bg: #101019; --surface: #191926; --surface-2: #23233a; --border: #2e2e48;
  --ink: #f2f2f8; --ink-2: #abacc4; --ink-3: #9293ad;
  --accent: #8b7dff; --accent-ink: #0f0b2e; --link: #b0a7ff; --focus: #a99fff;
  --hero-bg: #5b4beb; --hero-ink: #ffffff; --hero-ink-2: #e1ddff; --hero-chip: rgba(255,255,255,.14);
  --nav-bg: #15151f; --nav-fg: #f2f2f8; --nav-ink: #a2a3bd; --nav-bd: #2a2a42; --nav-act-bg: #3a3270; --nav-act-ink: #ece9ff;
  --chip-bg: #2e2858; --chip-ink: #dcd6ff;
  --pos: #4fd39a; --bad: #ff9c7a; --ok: #4fd39a; --warn: #f0b84a; --grid: #25253a; --shadow: rgba(0,0,0,.45); } }
[data-palette="violeta"][data-theme="dark"] {
  --bg: #101019; --surface: #191926; --surface-2: #23233a; --border: #2e2e48;
  --ink: #f2f2f8; --ink-2: #abacc4; --ink-3: #9293ad;
  --accent: #8b7dff; --accent-ink: #0f0b2e; --link: #b0a7ff; --focus: #a99fff;
  --hero-bg: #5b4beb; --hero-ink: #ffffff; --hero-ink-2: #e1ddff; --hero-chip: rgba(255,255,255,.14);
  --nav-bg: #15151f; --nav-fg: #f2f2f8; --nav-ink: #a2a3bd; --nav-bd: #2a2a42; --nav-act-bg: #3a3270; --nav-act-ink: #ece9ff;
  --chip-bg: #2e2858; --chip-ink: #dcd6ff;
  --pos: #4fd39a; --bad: #ff9c7a; --ok: #4fd39a; --warn: #f0b84a; --grid: #25253a; --shadow: rgba(0,0,0,.45); }

/* ---------- Noite elétrica (nasceu escura; no claro o limão fica só nos destaques) ---------- */
[data-palette="eletrica"] {
  --font-h: "Space Grotesk", system-ui, sans-serif; --font-b: "Inter", system-ui, sans-serif;
  --r: 20px; --r-sm: 12px;
  --bg: #f3f4ef; --surface: #ffffff; --surface-2: #eceee6; --border: #dfe2d8;
  --ink: #0d0e12; --ink-2: #4f5360; --ink-3: #626674;
  --accent: #0d0e12; --accent-ink: #c8f135; --link: #3d5a00; --focus: #3d5a00;
  --hero-bg: #0d0e12; --hero-ink: #f4f5f7; --hero-ink-2: #c8f135; --hero-chip: rgba(255,255,255,.08);
  --nav-bg: #ffffff; --nav-fg: #0d0e12; --nav-ink: #4f5360; --nav-bd: #dfe2d8; --nav-act-bg: #c8f135; --nav-act-ink: #0d0e12;
  --chip-bg: #e6f5b8; --chip-ink: #2f3d00;
  --pos: #3a7000; --bad: #c2372b; --ok: #3a7000; --warn: #8f6200; --grid: #e6e8e0; --shadow: rgba(13,14,18,.14);
}
@media (prefers-color-scheme: dark) { [data-palette="eletrica"]:not([data-theme="light"]) {
  --bg: #0d0e12; --surface: #17181f; --surface-2: #23252e; --border: #2c2e39;
  --ink: #f4f5f7; --ink-2: #a3a6b3; --ink-3: #8a8d9a;
  --accent: #c8f135; --accent-ink: #0d0e12; --link: #c8f135; --focus: #c8f135;
  --hero-bg: #c8f135; --hero-ink: #0d0e12; --hero-ink-2: #3a410f; --hero-chip: rgba(13,14,18,.09);
  --nav-bg: #121319; --nav-fg: #f4f5f7; --nav-ink: #9a9daa; --nav-bd: #24262f; --nav-act-bg: #c8f135; --nav-act-ink: #0d0e12;
  --chip-bg: #2a2f17; --chip-ink: #d9f77a;
  --pos: #c8f135; --bad: #ff9b8e; --ok: #c8f135; --warn: #f2c14e; --grid: #262833; --shadow: rgba(0,0,0,.5); } }
[data-palette="eletrica"][data-theme="dark"] {
  --bg: #0d0e12; --surface: #17181f; --surface-2: #23252e; --border: #2c2e39;
  --ink: #f4f5f7; --ink-2: #a3a6b3; --ink-3: #8a8d9a;
  --accent: #c8f135; --accent-ink: #0d0e12; --link: #c8f135; --focus: #c8f135;
  --hero-bg: #c8f135; --hero-ink: #0d0e12; --hero-ink-2: #3a410f; --hero-chip: rgba(13,14,18,.09);
  --nav-bg: #121319; --nav-fg: #f4f5f7; --nav-ink: #9a9daa; --nav-bd: #24262f; --nav-act-bg: #c8f135; --nav-act-ink: #0d0e12;
  --chip-bg: #2a2f17; --chip-ink: #d9f77a;
  --pos: #c8f135; --bad: #ff9b8e; --ok: #c8f135; --warn: #f2c14e; --grid: #262833; --shadow: rgba(0,0,0,.5); }

/* ---------- Grafite e coral ---------- */
[data-palette="coral"] {
  --font-h: "Sora", system-ui, sans-serif; --font-b: "Inter", system-ui, sans-serif;
  --r: 16px; --r-sm: 10px;
  --bg: #eceef2; --surface: #ffffff; --surface-2: #f1f2f5; --border: #dcdfe5;
  --ink: #111318; --ink-2: #585d68; --ink-3: #636874;
  --accent: #ff5a36; --accent-ink: #111318; --link: #b8350f; --focus: #d9431f;
  --hero-bg: #15171c; --hero-ink: #ffffff; --hero-ink-2: #b4b8c2; --hero-chip: rgba(255,255,255,.08);
  --nav-bg: #15171c; --nav-fg: #ffffff; --nav-ink: #a9aeb8; --nav-bd: #15171c; --nav-act-bg: #ff5a36; --nav-act-ink: #111318;
  --chip-bg: #15171c; --chip-ink: #ffffff;
  --pos: #0f7b55; --bad: #c23b1e; --ok: #0f7b55; --warn: #8f5a00; --grid: #e3e5ea; --shadow: rgba(17,19,24,.14);
}
@media (prefers-color-scheme: dark) { [data-palette="coral"]:not([data-theme="light"]) {
  --bg: #0f1013; --surface: #181a1f; --surface-2: #22252b; --border: #2e3138;
  --ink: #f1f2f4; --ink-2: #aeb2bc; --ink-3: #9196a0;
  --accent: #ff6a48; --accent-ink: #111318; --link: #ff8f75; --focus: #ff8f75;
  --hero-bg: #ff6a48; --hero-ink: #111318; --hero-ink-2: #4a1a0d; --hero-chip: rgba(17,19,24,.10);
  --nav-bg: #15171c; --nav-fg: #ffffff; --nav-ink: #a9aeb8; --nav-bd: #24272d; --nav-act-bg: #ff6a48; --nav-act-ink: #111318;
  --chip-bg: #3a2018; --chip-ink: #ffbfae;
  --pos: #3fc495; --bad: #ff8f78; --ok: #3fc495; --warn: #f0b84a; --grid: #262930; --shadow: rgba(0,0,0,.5); } }
[data-palette="coral"][data-theme="dark"] {
  --bg: #0f1013; --surface: #181a1f; --surface-2: #22252b; --border: #2e3138;
  --ink: #f1f2f4; --ink-2: #aeb2bc; --ink-3: #9196a0;
  --accent: #ff6a48; --accent-ink: #111318; --link: #ff8f75; --focus: #ff8f75;
  --hero-bg: #ff6a48; --hero-ink: #111318; --hero-ink-2: #4a1a0d; --hero-chip: rgba(17,19,24,.10);
  --nav-bg: #15171c; --nav-fg: #ffffff; --nav-ink: #a9aeb8; --nav-bd: #24272d; --nav-act-bg: #ff6a48; --nav-act-ink: #111318;
  --chip-bg: #3a2018; --chip-ink: #ffbfae;
  --pos: #3fc495; --bad: #ff8f78; --ok: #3fc495; --warn: #f0b84a; --grid: #262930; --shadow: rgba(0,0,0,.5); }

/* ===================== Base ===================== */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font-b); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-h); letter-spacing: -.3px; }
h1 { font-size: 26px; font-weight: 700; margin: 0 0 16px; letter-spacing: -.6px; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 12px; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ic { flex: none; display: block; }
.muted { color: var(--ink-3); }
.neg { color: var(--bad); }
.pos { color: var(--pos); }
.empty { text-align: center; color: var(--ink-3); padding: 28px 8px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.row .grow, .grow { flex: 1; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===================== Estrutura ===================== */
#hdr { background: var(--nav-bg); color: var(--nav-fg); }
.bar { display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-h); font-weight: 700; font-size: 18px; letter-spacing: -.3px; white-space: nowrap;
  background: none; border: 0; padding: 0; color: inherit; cursor: pointer; text-align: left; border-radius: var(--r-sm); }
.brand:hover .mark { filter: brightness(1.08); }
.mark { width: 34px; height: 34px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-h); font-weight: 800; font-size: 18px; letter-spacing: 0; flex: none; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav button, .nbtn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--r-sm); background: none;
  color: var(--nav-ink); font: 500 14.5px var(--font-b); text-align: left; cursor: pointer; }
#nav button:hover, .nbtn:hover { background: color-mix(in srgb, var(--nav-fg) 7%, transparent); color: var(--nav-fg); }
#nav button[aria-current="page"] { background: var(--nav-act-bg); color: var(--nav-act-ink); font-weight: 600; }
.tools { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--nav-ink); padding: 0 12px; min-width: 0; }
.user:empty { display: none; }
.user img { width: 28px; height: 28px; border-radius: 50%; }
.user .uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; color: var(--nav-fg); }
.user .sync { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.ubtn { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 0; border: 0; border-radius: 999px; background: none; color: inherit; cursor: pointer; text-align: left; }
.ubtn:hover .uname { text-decoration: underline; text-underline-offset: 3px; }
.only-m { display: none; }
#hdr .btn { background: transparent; color: var(--nav-fg); border-color: var(--nav-bd); }
#hdr .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 32px 60px; }
.bnav { display: none; }
body.sem-login #nav, body.sem-login .side-new, body.sem-login .bnav { display: none !important; }

/* Computador: menu lateral */
@media (min-width: 901px) {
  body { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
  #hdr { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--nav-bd); }
  .bar { flex-direction: column; align-items: stretch; height: 100%; padding: 22px 14px 16px; gap: 14px; }
  .brand { padding: 0 6px 8px; }
  .side-new { justify-content: center; min-height: 44px; margin-bottom: 6px; }
}
/* Celular e tablet: barra superior + menu inferior */
@media (max-width: 900px) {
  #hdr { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); color: var(--ink);
    backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); }
  .bar { padding: 10px 16px; max-width: 1120px; margin: 0 auto; }
  .brand { flex: 1; font-size: 17px; }
  #nav, #hdr .side-new { display: none; }
  .tools { flex-direction: row; align-items: center; margin: 0; gap: 4px; }
  .user { padding: 0; color: var(--ink-2); }
  .user .uname { display: none; }
  .user img { width: 32px; height: 32px; }
  .nbtn { width: 42px; height: 42px; padding: 0; justify-content: center; border-radius: 50%; color: var(--ink-2); }
  .nbtn:hover { background: var(--surface-2); color: var(--ink); }
  .nbtn .lbl { display: none; }
  #hdr .btn { color: var(--ink); border-color: var(--border); background: var(--surface); }
  main { padding: 6px 16px calc(112px + env(safe-area-inset-bottom)); }
  .hide-m { display: none !important; }
  .only-m { display: inline; }
  .bnav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
    padding: 8px 6px calc(10px + env(safe-area-inset-bottom)); background: var(--nav-bg); border-top: 1px solid var(--nav-bd); }
  .bnav button { display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: none; color: var(--nav-ink); font: 500 11px var(--font-b);
    cursor: pointer; padding: 0; min-height: 48px; }
  .bnav .pill { width: 52px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
  .bnav button[aria-current="page"] { color: var(--nav-fg); font-weight: 700; }
  .bnav button[aria-current="page"] .pill { background: var(--nav-act-bg); color: var(--nav-act-ink); }
  .bnav .novo { justify-self: center; width: 56px; height: 56px; min-height: 0; margin: -26px auto 4px; border-radius: 18px; background: var(--accent); color: var(--accent-ink);
    justify-content: center; box-shadow: 0 10px 24px var(--shadow); }
}

/* ===================== Componentes ===================== */
.ph { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; min-height: 44px; }
.ph h1 { margin: 0; flex: 1; min-width: 0; }
.sec { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
.sec h2 { margin: 0; }
.lnk { font-size: 13px; font-weight: 600; color: var(--link); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 6px 0; font-family: inherit; }
.lnk:hover { text-decoration: underline; }

button, select, input, textarea { font: inherit; color: var(--ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: calc(var(--r-sm) - 3px); }
.btn.ib { width: 40px; padding: 0; }
.btn.ib.sm { width: 32px; padding: 0; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.ghost.danger { color: var(--bad); }
button.btn.primary.perigo-btn { background: var(--bad); color: #fff; }

input, select { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 12px; min-height: 42px; min-width: 0; }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); cursor: pointer; margin: 0; }
input[type=radio] { accent-color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px 20px; min-width: 0; }
.kpi .label { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.kpi .value { font-family: var(--font-h); font-size: 26px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.kpi .sub { color: var(--ink-3); font-size: 12px; }

/* Cartão de destaque (saldo) */
.hero { background: var(--hero-bg); color: var(--hero-ink); border-radius: var(--r); padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hero .lbl { font-size: 13px; font-weight: 500; color: var(--hero-ink-2); }
.hero .big { font-family: var(--font-h); font-weight: 700; font-size: 40px; letter-spacing: -1.2px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero .mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.hero .mini > div { background: var(--hero-chip); border-radius: var(--r-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hero .mini span { font-size: 12px; color: var(--hero-ink-2); }
.hero .mini strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.dash-top { display: grid; gap: 14px; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); margin-bottom: 14px; }
.orc { display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.orc .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; color: var(--ink-2); }
.orc .big { font-family: var(--font-h); font-weight: 700; font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.orc .big small { font-family: var(--font-b); font-size: 13px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.progress { background: var(--surface-2); height: 8px; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* Seletor de mês */
.mnav { display: inline-flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.mnav .btn { border-radius: 50%; width: 36px; min-height: 36px; padding: 0; border: 0; background: transparent; color: var(--ink-2); }
.mnav .btn:hover { background: var(--surface-2); color: var(--ink); }
.mnav strong { min-width: 150px; text-align: center; font-size: 14px; }
.mnav strong::first-letter { text-transform: uppercase; }

/* Listas (lançamentos, contas fixas, faturas) */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 2px 16px; }
.card .list { border: 0; padding: 0; background: none; }
.list + .grp-h { margin-top: 18px; }
.grp-h { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--ink-2); padding: 0 4px 8px; }
.grp-h span:last-child { font-variant-numeric: tabular-nums; }
.li { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); }
.li:last-child { border-bottom: 0; }
.li-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.li-main:hover .t > span:first-child { text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
.li-ic { --c: var(--s-other); width: 40px; height: 40px; border-radius: calc(var(--r-sm) + 1px); flex: none; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: color-mix(in srgb, var(--c) 82%, var(--ink)); }
.li-ic.in { background: var(--accent); color: var(--accent-ink); }
.li-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.li-tx .t { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.li-tx .t > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-tx .m { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-v { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.li-v small { display: block; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.li-act { display: flex; gap: 2px; flex: none; }
.li.done .t > span:first-child { color: var(--ink-2); }
.li .chk { display: flex; align-items: center; justify-content: center; width: 40px; height: 44px; flex: none; cursor: pointer; }
.tag { flex: none; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); }
.sumbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(var(--r) - 4px); padding: 12px 16px; margin-bottom: 16px; color: var(--ink-2); font-size: 13.5px; }
.sumbar strong { font-family: var(--font-h); font-size: 18px; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
dialog [tabindex="-1"]:focus { outline: none; }
@media (max-width: 900px) { .li-act { display: none; } }

/* Contas e cartões */
.acc-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.acc { display: flex; flex-direction: column; gap: 6px; }
.acc .hd { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.acc .hd span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc .value { font-family: var(--font-h); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.4px; margin-top: 4px; }
.acc .sub { font-size: 12px; color: var(--ink-3); }
.acc .row { margin: 6px 0 0; gap: 6px; }
.acc.arq { opacity: .6; }
.mini-acc { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.mini-acc > div { border: 1px solid var(--border); border-radius: calc(var(--r) - 6px); padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mini-acc span { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-acc strong { font-variant-numeric: tabular-nums; }
.bico { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; font-size: 11px; font-weight: 800;
  letter-spacing: -.3px; flex: none; }
.bico.gen { background: var(--surface-2); color: var(--ink); }
.kv { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: 0; }
.kv .grow { min-width: 0; }
.kv strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.kv .m { display: block; font-size: 12px; color: var(--ink-3); }

/* Tabelas (relatórios) */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--ink-2); font-weight: 600; font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* Gráficos */
.bars .b { display: grid; grid-template-columns: minmax(80px, 150px) 1fr 96px; gap: 8px; align-items: center; margin: 6px 0; font-size: 14px; }
.bars .track { background: var(--surface-2); height: 12px; border-radius: 999px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--s1); border-radius: 999px; }
.bars .v { text-align: right; font-variant-numeric: tabular-nums; }
.legend { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.legend .sw { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.legend .nm { flex: 1; }
.chartbox { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
svg text { fill: var(--ink-2); font-size: 12px; font-family: var(--font-b); }
#tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--bg); padding: 7px 10px; border-radius: 8px; font-size: 12px; line-height: 1.4; max-width: 260px; }
#tip[hidden] { display: none; }

/* Etiquetas, avisos */
.chip { display: inline-flex; gap: 2px; align-items: center; background: var(--chip-bg); color: var(--chip-ink); border-radius: 999px; padding: 0 4px 0 12px; min-height: 32px;
  font-size: 13px; font-weight: 600; margin: 0 6px 6px 0; }
.chip button { background: none; border: 0; cursor: pointer; color: inherit; opacity: .75; width: 28px; height: 28px; border-radius: 50%; font: inherit; font-size: 15px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; }
.chip button:hover { opacity: 1; background: color-mix(in srgb, currentColor 12%, transparent); }
.cats-chips .chip { background: var(--surface-2); color: var(--ink); font-weight: 500; }
.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; border-color: var(--accent); }
.banner .grow { min-width: 200px; }
.perigo { border-color: var(--bad); }
.perigo h2 { color: var(--bad); }
details summary { cursor: pointer; color: var(--ink-2); margin-top: 10px; }
.login { max-width: 400px; margin: 12vh auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.login .mark { width: 64px; height: 64px; border-radius: 20px; font-size: 32px; }
.login h1 { margin: 6px 0 0; }
.login p { color: var(--ink-2); margin: 0 0 8px; }
.login .g-btn { width: 100%; min-height: 46px; }
.ou { display: flex; align-items: center; gap: 12px; width: 100%; color: var(--ink-3); font-size: 13px; margin: 4px 0; }
.ou::before, .ou::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.lform { display: grid; gap: 12px; width: 100%; text-align: left; }
.lform h2 { margin: 0; font-size: 17px; }
.lform label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.lform input { width: 100%; color: var(--ink); }
.lform .btn { min-height: 46px; }
.lform .dica, .lform p { margin: -4px 0 0; font-size: 12.5px; }
.lform .err:empty { display: none; }
.ok-msg { font-size: 13px; color: var(--ok); }
.lnks { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; }
.lform .aceite { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; font-weight: 400; color: var(--ink-2); }
.lform .aceite input { width: 18px; height: 18px; flex: none; margin: 1px 0 0; }
.lform a, .login .legal a { color: var(--link); font-weight: 600; }
.login .legal { font-size: 12px; color: var(--ink-3); margin: 6px 0 0; }

/* Aparência */
.temas { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; }
.tema-op { display: flex; flex-direction: column; gap: 8px; cursor: pointer; border-radius: calc(var(--r) - 2px); padding: 6px; border: 2px solid transparent; position: relative; }
.tema-op input { position: absolute; opacity: 0; pointer-events: none; }
.tema-op:has(input:checked) { border-color: var(--accent); }
.tema-op:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.tema-op .nm { font-size: 13px; font-weight: 600; text-align: center; }
.prev { background: var(--bg); border: 1px solid var(--border); border-radius: calc(var(--r) - 6px); padding: 10px; display: flex; flex-direction: column; gap: 6px; height: 112px; overflow: hidden; }
.prev .ph1 { background: var(--hero-bg); border-radius: 8px; height: 42px; padding: 6px 8px; display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.prev .ph1 b { display: block; height: 5px; width: 40%; border-radius: 3px; background: var(--hero-ink-2); }
.prev .ph1 i { display: block; height: 9px; width: 70%; border-radius: 3px; background: var(--hero-ink); }
.prev .pl { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 5px 6px; }
.prev .pl u { width: 14px; height: 14px; border-radius: 5px; background: var(--accent); flex: none; }
.prev .pl s { flex: 1; height: 5px; border-radius: 3px; background: var(--ink-3); opacity: .5; }
.prev .fn { font-family: var(--font-h); font-weight: 700; font-size: 13px; color: var(--ink); line-height: 1; }
.seg.modo { max-width: 420px; }

/* Diálogos e menus */
dialog { border: 0; border-radius: var(--r); padding: 0; background: var(--surface); color: var(--ink); width: min(500px, 94vw); max-height: 92vh; box-shadow: 0 24px 60px var(--shadow); }
dialog::backdrop { background: rgba(10, 10, 16, .5); backdrop-filter: blur(2px); }
dialog form { padding: 22px; display: grid; gap: 14px; }
dialog h2 { margin: 0; font-size: 20px; }
dialog label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
dialog label input, dialog label select { color: var(--ink); font-size: 15px; width: 100%; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface-2); border-radius: var(--r-sm); padding: 4px; }
.seg label { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 8px; text-align: center; cursor: pointer; color: var(--ink-2);
  font-size: 14px; font-weight: 600; border-radius: calc(var(--r-sm) - 3px); position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent); color: var(--accent-ink); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.err { color: var(--bad); font-size: 13px; min-height: 1em; }
.actions { display: flex; gap: 8px; flex-direction: row-reverse; flex-wrap: wrap; }
dialog.menu form { padding: 14px 12px; gap: 2px; }
.mh { padding: 6px 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.mh strong { font-family: var(--font-h); font-size: 18px; }
.mh span { font-size: 13px; color: var(--ink-2); }
.mh .v { font-family: var(--font-h); font-size: 22px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 4px; }
.mh .v.pos { color: var(--pos); }
.mi { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink);
  font-size: 15px; font-weight: 500; text-align: left; cursor: pointer; }
.mi:hover { background: var(--surface-2); }
.mi .bx { width: 36px; height: 36px; border-radius: 11px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex: none; }
.mi[aria-current="page"] .bx { background: var(--nav-act-bg); color: var(--nav-act-ink); }
.mi.danger { color: var(--bad); }
.mi.cancel { justify-content: center; margin-top: 6px; color: var(--ink-2); }

/* Orçamento clicável, vencimentos e lista de contas a pagar */
.orc.clk { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.orc.clk:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.orc .progress { display: block; }
.orc .ft { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.orc .ver { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; color: var(--link); white-space: nowrap; }
.kv-btn { width: 100%; background: none; border-width: 0 0 1px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.kv-btn:hover .grow { text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
.mi .mi-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mi .mi-tx small { font-size: 12.5px; color: var(--ink-2); }
.mi .mi-v { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag.parcial { background: color-mix(in srgb, var(--warn) 22%, var(--surface)); color: var(--ink); }
.dica { font-size: 13px; min-height: 1.2em; }
.parc-lado { align-self: end; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-size: 13px; }
#lnkParc { justify-self: start; padding: 2px 0; }

/* Metas de gastos */
.meta { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.meta:last-child { border-bottom: 0; }
.meta-h { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 14px; }
.meta-h span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.meta-h small { font-weight: 500; color: var(--ink-2); }
.meta-m { font-size: 12px; color: var(--ink-2); }
.progress.warn > i { background: var(--warn); }
.progress.bad > i { background: var(--bad); }
.banner.aviso { border-color: var(--warn); }
.banner.aviso .ic { color: var(--warn); flex: none; }

/* Aviso rápido */
#toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translate(-50%, 20px); max-width: min(92vw, 520px); padding: 12px 18px;
  border-radius: var(--r-sm); background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.alerta { background: var(--warn); color: #fff; }
@media (max-width: 900px) { #toast { bottom: calc(96px + env(safe-area-inset-bottom)); } }

/* Receitas recorrentes */
.grp-rec { margin-top: 22px; align-items: center; }
.grp-rec .lnk { display: inline-flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: 0; font-size: 13px; padding: 0; }

/* Importar extrato */
.imp-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; color: var(--ink-2); margin: 4px 0 8px; }
dialog label.imp-inv { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
dialog label.imp-inv input { width: auto; }
.imp-l { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-sm); }
.imp-r { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.imp-r:last-child { border-bottom: 0; }
.imp-r.off { opacity: .55; }
dialog label.imp-c { display: grid; grid-template-columns: auto 50px minmax(0, 1fr) auto; gap: 8px; align-items: center; color: var(--ink); font-size: 13.5px; cursor: pointer; }
dialog label.imp-c input { width: 18px; height: 18px; }
.imp-d { color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
.imp-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.imp-t small, .imp-v small { display: block; font-size: 11.5px; color: var(--warn); }
.imp-v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.imp-v.pos { color: var(--pos); }
dialog .imp-r select { font-size: 13px; padding: 4px 6px; min-height: 34px; }
@media (max-width: 600px) {
  .imp-r { grid-template-columns: 1fr; }
  dialog label.imp-c { grid-template-columns: auto 44px minmax(0, 1fr) auto; }
}

/* Calendário */
.cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px; margin-bottom: 16px; }
.cal-g { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-w { font-size: 12px; font-weight: 600; color: var(--ink-3); text-align: center; padding: 2px 0 6px; text-transform: capitalize; }
.cd { display: flex; flex-direction: column; align-items: stretch; gap: 1px; min-height: 84px; min-width: 0; padding: 6px 7px; border: 1px solid transparent;
  border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.cd.vazio { background: none; cursor: default; }
.cd:hover { border-color: var(--border); }
.cd .n { align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; margin: -2px 0 2px -3px; }
.cd .e, .cd .s { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd .e { color: var(--pos); }
.cd .s { color: var(--bad); }
.cd .pt { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); margin-top: 2px; }
.cd.hoje .n { background: var(--accent); color: var(--accent-ink); }
.cd.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.cal-leg { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.cal-leg i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.cal-leg i.e { background: var(--pos); }
.cal-leg i.s { background: var(--bad); }
.kpi .value.pos { color: var(--pos); }

/* Filtros: em linha no computador, painel inferior no celular */
.filtros { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-bottom: 16px; }
.fbar, .fpanel { display: contents; }
.fhead, .factions, .fbtn, .fchips, .fback { display: none; }
.fmes { order: 0; }
.fpanel label { order: 1; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); }
.fq, .fresumo { order: 2; flex: 1; min-width: 180px; }
.fresumo { color: var(--ink-3); }
.fresumo .fper { display: none; }

@media (max-width: 600px) {
  h1 { font-size: 24px; }
  .ph { margin-bottom: 14px; gap: 10px; }
  .ph h1 { flex: 1 0 100%; }
  .ph.solo h1 { flex: 1; }
  .ph select { flex: 1; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .g4 > :last-child:nth-child(odd) { grid-column: span 2; }
  .g4 .kpi { padding: 14px; }
  .kpi .value { font-size: 20px; }
  .dash-top { grid-template-columns: 1fr; }
  .hero .big { font-size: 36px; }
  .card { padding: 16px; }
  .list { padding: 2px 14px; }
  input, select { font-size: 16px; }
  .two { grid-template-columns: 1fr; }
  .cal { padding: 8px 6px; }
  .cal-g { gap: 3px; }
  .cd { min-height: 60px; padding: 4px 3px; align-items: center; text-align: center; }
  .cd .n { align-self: center; font-size: 12.5px; margin: 0 0 1px; }
  .cd .e, .cd .s { font-size: 10.5px; letter-spacing: -.2px; max-width: 100%; }
  .orc .ft { flex-wrap: wrap; }
  .bars .b { grid-template-columns: 100px 1fr 90px; }
  .mnav strong { min-width: 120px; }
  .temas { gap: 8px; }
  .prev { height: 96px; padding: 7px; }
  .tema-op { padding: 4px; }
  .tema-op .nm { font-size: 12px; }
  dialog { margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92vh; border-radius: var(--r) var(--r) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  dialog[open] { animation: sobe .22s ease-out; }
  .filtros { display: block; margin-bottom: 14px; }
  .fbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .fbar .fmes { flex: 1; min-width: 0; }
  .fbar .fq { order: 3; flex: 1 0 100%; }
  .fresumo { order: 0; min-width: 0; color: var(--ink-2); }
  .fresumo .fper { display: inline; }
  .fbtn { display: inline-flex; order: 1; }
  .fbtn.on { border-color: var(--accent); }
  .fbtn b { background: var(--accent); color: var(--accent-ink); border-radius: 999px; min-width: 20px; height: 20px; padding: 0 6px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
  .fchips { display: flex; flex-wrap: wrap; margin-top: 10px; }
  .fback.open { display: block; position: fixed; inset: 0; background: rgba(10, 10, 16, .5); z-index: 30; }
  .fpanel { display: none; }
  .fpanel.open { display: grid; gap: 14px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 85vh; overflow-y: auto;
    background: var(--surface); border-radius: var(--r) var(--r) 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 34px var(--shadow); }
  .fpanel.open::before { content: ""; justify-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--border); }
  .fpanel.anim { animation: sobe .22s ease-out; }
  .fhead { display: flex; align-items: center; justify-content: space-between; }
  .fhead h2 { margin: 0; font-size: 19px; }
  .fpanel label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; order: 0; }
  .fpanel label select, .fpanel label input { width: 100%; color: var(--ink); }
  .factions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 4px; }
  .factions .btn { min-height: 48px; }
}
@keyframes sobe { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .fpanel.anim, dialog[open] { animation: none; } }
