/* Visual inspirado no Meu Pluggy: branco, tipografia Outfit/DM Sans, rosa como cor principal, bordas finas. */
:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --text: #111111;
  --text-2: #3c3c3c;
  --muted: #676767;
  --line: #e3e9ef;
  --line-strong: #d4d4d5;
  --hover: #f5f5f5;
  --accent: #ef294b;
  --accent-hover: #c71b39;
  --accent-soft: #ffeff2;
  --on-accent: #ffffff;
  --good: #298f33;
  --good-soft: #e4ffe6;
  --warn: #c25a0e;
  --warn-soft: #fff1e6;
  --bad: #d91616;
  --bad-soft: #ffdede;
  --info: #1a73e8;
  --info-soft: #eff6ff;
  --debito: #1a73e8;
  --pix: #00a69c;
  --credito: #ef294b;
  --beneficio: #e8650f;
  --outro: #8f8f8f;
  --radius: 8px;
  --radius-lg: 12px;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Outfit", "DM Sans", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --card: #121214;
    --text: #fafafa;
    --text-2: #d4d4d8;
    --muted: #a1a1aa;
    --line: #232327;
    --line-strong: #2f2f35;
    --hover: #1a1a1e;
    --accent: #f2486a;
    --accent-hover: #ef294b;
    --accent-soft: #2a1118;
    --good: #5cb865;
    --good-soft: #10261a;
    --warn: #f59e4b;
    --warn-soft: #2b1a0c;
    --bad: #fd8383;
    --bad-soft: #2c1212;
    --info: #458eed;
    --info-soft: #0f1b2e;
    --debito: #458eed;
    --pix: #2dd4bf;
    --credito: #f2486a;
    --beneficio: #fb923c;
    --outro: #a0a0a0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
}
h1, h2, h3, .big, .brand { font-family: var(--font-head); }
h1 { font-size: 1.5rem; font-weight: 600; margin: 4px 0 16px; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 0 0 10px; }
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 12px; color: var(--text); }
p { margin: 0 0 8px; }
a { color: var(--accent); }
code { font-size: .85em; background: var(--hover); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.loading { text-align: center; color: var(--muted); margin-top: 30vh; }

/* barra superior */
.topbar {
  position: sticky; top: 0; z-index: 9;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-in { max-width: 640px; margin: 0 auto; height: 56px; padding: 0 16px; display: flex; align-items: center; gap: 10px; }
.brand { font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* cartões */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 12px;
}
.hero { padding: 20px 18px; }
.hero .big { font-size: 2.2rem; font-weight: 600; letter-spacing: -.02em; margin: 2px 0 12px; line-height: 1.1; }
.label { font-size: .78rem; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row + .row { margin-top: 6px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }

.bar { height: 6px; border-radius: 99px; background: var(--hover); overflow: hidden; margin: 6px 0; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar.over > span { background: var(--bad); }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 12px; min-width: 0; transition: border-color .15s;
}
.mini:hover { border-color: var(--line-strong); }
.mini .v { font-family: var(--font-head); font-weight: 600; font-size: clamp(.82rem, 3.6vw, 1.02rem); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; }
.mini .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 340px) { .grid3 { grid-template-columns: 1fr; } }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.d-debito { background: var(--debito); } .d-pix { background: var(--pix); }
.d-credito { background: var(--credito); } .d-beneficio { background: var(--beneficio); } .d-outro, .d-dinheiro { background: var(--outro); }

.monthnav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.monthnav strong { font-family: var(--font-head); font-size: 1.15rem; font-weight: 600; }
.iconbtn {
  width: 40px; height: 40px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 1.2rem; cursor: pointer; display: grid; place-items: center;
}
.iconbtn:hover { background: var(--hover); }
.iconbtn:disabled { opacity: .35; cursor: default; }

/* filtros (chips) */
.chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; scrollbar-width: none; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--text-2); font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer;
}
.chip:hover { background: var(--hover); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* listas de lançamentos — linhas como na lista de bancos do Pluggy */
.list { list-style: none; margin: 0; padding: 0; }
.day { font-size: .78rem; color: var(--muted); font-weight: 600; margin: 18px 2px 8px; text-transform: capitalize; }
.txgroup { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.tx {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card);
  border: 0; border-bottom: 1px solid var(--line); cursor: pointer; width: 100%;
  text-align: left; font: inherit; color: inherit;
}
.tx:last-child { border-bottom: 0; }
.tx:hover { background: var(--hover); }
.tx .info { flex: 1; min-width: 0; }
.tx .desc { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .meta { font-size: .8rem; color: var(--muted); }
.tx.ignored { opacity: .45; }
.tx.ignored .desc { text-decoration: line-through; }
.avatar {
  flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 600; font-size: .95rem;
  background: var(--hover); border: 1px solid var(--line); color: var(--text-2);
}
.avatar.entrada { background: var(--good-soft); color: var(--good); border-color: transparent; }
.tag {
  font-size: .7rem; padding: 1px 7px; border-radius: 99px; background: var(--info-soft); color: var(--info);
  font-weight: 600; margin-left: 6px; vertical-align: 1px;
}
.tag.m-credito { background: var(--accent-soft); color: var(--accent); }
.tag.m-pix { background: color-mix(in srgb, var(--pix) 14%, transparent); color: var(--pix); }
.tag.m-beneficio { background: color-mix(in srgb, var(--beneficio) 14%, transparent); color: var(--beneficio); }
.tag.m-debito { background: var(--info-soft); color: var(--info); }
.tag.m-outro, .tag.m-dinheiro { background: var(--hover); color: var(--muted); }

/* linhas da projeção (substituem a tabela, que não cabia no celular) */
.prow { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.pmes { font-family: var(--font-head); font-weight: 600; }
.pval { font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; }
.prow .bar { height: 4px; margin: 8px 0 6px; }
.prow-sub { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: .8rem; color: var(--muted); }
.prow-sub b { font-weight: 600; color: var(--text-2); }

.catrow { margin-bottom: 12px; }
.catrow:last-child { margin-bottom: 0; }
.catrow .bar { height: 6px; margin: 6px 0 0; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 4px; text-align: right; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { font-size: .75rem; color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: 0; }

/* botões no estilo Pluggy: primário rosa, secundário contornado */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--accent);
  background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--line-strong); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.actions { display: flex; gap: 8px; margin-top: 16px; }
.actions .btn { flex: 1; }

.fab {
  position: fixed; right: max(16px, calc(50vw - 304px)); bottom: calc(84px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  font-size: 1.8rem; line-height: 1; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
  cursor: pointer; z-index: 5;
}
.fab:hover { background: var(--accent-hover); }

/* formulários */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .85rem; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
input, select {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text); font: inherit; font-size: 16px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=range] { accent-color: var(--accent); padding: 0; min-height: 32px; border: 0; box-shadow: none; }
.check { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; font-size: .9rem; }
.check input { width: 20px; min-height: 20px; height: 20px; accent-color: var(--accent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-bottom: 14px; }
.seg label {
  text-align: center; padding: 10px 4px; border-radius: var(--radius); cursor: pointer; font-weight: 500;
  font-size: .92rem; border: 1px solid var(--line-strong); color: var(--text-2); background: var(--card);
}
.seg input { position: absolute; opacity: 0; pointer-events: none; width: 0; min-height: 0; }
.seg label:has(input:checked) { border-color: var(--text); color: var(--text); box-shadow: 0 0 0 1px var(--text); font-weight: 600; }

/* status */
.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.st-pronto, .st-ok { background: var(--good-soft); color: var(--good); }
.st-apertado { background: var(--warn-soft); color: var(--warn); }
.st-inviavel { background: var(--bad-soft); color: var(--bad); }

.highlight { font-size: .95rem; margin: 14px 0 10px; color: var(--text-2); }
.highlight strong { font-family: var(--font-head); font-size: 1.7rem; font-weight: 600; display: block; letter-spacing: -.01em; color: var(--text); }
.note { font-size: .85rem; color: var(--text-2); background: var(--hover); border-radius: var(--radius); padding: 10px 12px; margin-top: 8px; }
.banner {
  background: var(--accent-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: .9rem;
}
.banner a { color: var(--accent); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* navegação inferior */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 500; padding: 4px 0;
}
.tabbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--accent); font-weight: 600; }

/* bottom sheet */
dialog {
  border: 0; padding: 0; width: 100%; max-width: 560px; max-height: 92dvh;
  margin: auto auto 0; border-radius: 16px 16px 0 0;
  background: var(--card); color: var(--text);
}
@media (min-width: 600px) { dialog { margin: auto; border-radius: 16px; } }
dialog::backdrop { background: rgb(0 0 0 / .45); }
#sheet-body { padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.sheet-head h2 { margin: 0; font-size: 1.2rem; }

#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--card); padding: 10px 16px; border-radius: var(--radius); font-size: .9rem;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* login */
.login { max-width: 380px; margin: 14vh auto 0; padding: 28px 24px; }
.login h1 { text-align: center; margin-bottom: 4px; }
.login .sub { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: .9rem; }

/* linhas de benefício no cadastro de pessoa */
.benef-row { display: grid; grid-template-columns: minmax(0, 1fr) 104px 44px; gap: 8px; align-items: center; margin-bottom: 8px; }
.benef-row .iconbtn { width: 44px; height: 44px; }
