/* ==========================================================================
   Financeiro — sistema visual (paleta clara em tons de azul)
   ========================================================================== */

:root {
  color-scheme: light;

  /* Superfícies */
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eef2f8;
  --line: #e4e9f1;
  --line-strong: #cfd8e5;

  /* Texto */
  --text: #0f1b2d;
  --muted: #5b6b82;
  --faint: #8794a8;

  /* Marca (azul) */
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-700: #1e40af;
  --primary-900: #0f2a66;
  --primary-50: #eff5ff;
  --primary-100: #dbe7fe;
  --primary-200: #bcd3fd;

  /* Estados */
  --good: #0f8a5f;
  --good-soft: #e6f5ee;
  --warn: #a35f00;
  --warn-soft: #fff3df;
  --bad: #d03b3b;
  --bad-soft: #fdecec;

  /* Compatibilidade com nomes antigos */
  --accent: var(--primary);
  --accent-ink: #ffffff;
  --accent-soft: var(--primary-50);

  /* Categorias e gráficos (família azul + contrastes legíveis) */
  --c1: #2563eb; --c2: #0ea5e9; --c3: #6366f1; --c4: #14b8a6;
  --c5: #f59e0b; --c6: #ec4899; --c7: #8b5cf6; --c8: #64748b;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 27, 45, 0.04), 0 1px 3px rgba(15, 27, 45, 0.06);
  --shadow-lg: 0 6px 24px rgba(15, 42, 102, 0.10);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar: 232px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
:focus-visible { outline: 3px solid var(--primary-200); outline-offset: 2px; border-radius: 8px; }
.ic { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }
.ic.sm { width: 16px; height: 16px; }

/* ---------- Estrutura ---------- */

.app { max-width: 560px; margin: 0 auto; padding: 16px 16px 104px; }
.loading { color: var(--muted); text-align: center; padding: 80px 0; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 16px; }
.top h1 { font-size: 22px; font-weight: 700; }
.top .sub { font-size: 12px; color: var(--muted); }
.page-title { font-size: 22px; font-weight: 700; margin: 2px 0 2px; }
.page-sub { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.month { text-align: center; }
.month b { display: block; font-size: 17px; text-transform: capitalize; }
.monthbar { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.monthbar b { font-size: 14px; min-width: 120px; text-align: center; text-transform: capitalize; }
.monthbar .iconbtn { width: 30px; height: 30px; border: 0; box-shadow: none; border-radius: 999px; }
.iconbtn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); box-shadow: var(--shadow);
}
.iconbtn:hover { color: var(--primary); border-color: var(--primary-200); }
.back { font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; padding: 6px 0; cursor: pointer; background: none; border: 0; }
.back:hover { color: var(--primary); }

/* ---------- Cartões e seções ---------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-top: 12px; box-shadow: var(--shadow); }
.card.tap { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.card.tap:hover { border-color: var(--primary-200); box-shadow: var(--shadow-lg); }
.card.list { padding: 4px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h2 { font-size: 15px; font-weight: 650; }
.section { font-size: 15px; font-weight: 650; margin: 26px 0 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.section small { font-weight: 500; color: var(--faint); font-size: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.lbl { font-size: 12.5px; color: var(--muted); margin: 0; }
.big { font-size: 26px; font-weight: 700; margin: 2px 0 0; letter-spacing: -0.02em; }
.note { font-size: 13px; color: var(--muted); margin-top: 10px; }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; font-size: 14px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }

/* ---------- Indicadores (KPIs) ---------- */

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 4px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi .kpi-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .kpi-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.kpi .kpi-icon.good { background: var(--good-soft); color: var(--good); }
.kpi .kpi-icon.bad { background: var(--bad-soft); color: var(--bad); }
.kpi .kpi-icon.warn { background: var(--warn-soft); color: var(--warn); }
.kpi .kpi-value { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .kpi-foot { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.primary {
  grid-column: 1 / -1; color: #fff; border: 0;
  background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary) 100%);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
}
.kpi.primary .kpi-top { color: rgba(255, 255, 255, 0.85); }
.kpi.primary .kpi-icon { background: rgba(255, 255, 255, 0.16); color: #fff; }
.kpi.primary .kpi-value { font-size: 32px; }
.kpi.primary .kpi-foot { color: rgba(255, 255, 255, 0.85); white-space: normal; }
.kpi.primary .split { background: rgba(255, 255, 255, 0.18); margin-top: 12px; }
.kpi.primary .split .inv { background: #bcd3fd; }
.kpi.primary .split .cash { background: #ffffff; }
.kpi.primary .legend { color: rgba(255, 255, 255, 0.85); }
.kpi.primary .legend b { color: #fff; }
.kpi.primary .sw.inv { background: #bcd3fd; }
.kpi.primary .sw.cash { background: #fff; }
.kpi.primary .sw.in { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.6); }
.kpi.primary .hint { background: rgba(255, 255, 255, 0.14); color: #fff; }
.split { display: flex; height: 8px; border-radius: 6px; overflow: hidden; background: var(--primary-50); }
.split i { display: block; height: 100%; }
.split .inv, .sw.inv { background: var(--c3); }
.split .cash, .sw.cash { background: var(--c2); }
.sw.in { background: var(--primary-50); border: 1px solid var(--primary-200); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.legend b { color: var(--text); font-weight: 650; margin-left: 2px; }
.hint { font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; margin: 10px 0 0; }
.delta { font-size: 12px; font-weight: 600; color: var(--muted); }
.delta.up { color: var(--bad); }
.delta.down { color: var(--good); }
.kpi.primary .delta.up { color: #ffd2d2; }
.kpi.primary .delta.down { color: #c9f4e1; }

.tipline { display: flex; align-items: center; gap: 10px; margin-top: 12px; background: var(--primary-50); border: 1px solid var(--primary-100); color: var(--primary-900); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.tipline b { color: var(--primary-700); }

/* Tela inicial: saudação e frase do mês */
.home-top { flex-wrap: wrap; align-items: flex-start; }
.hello { flex: 1 1 100%; min-width: 0; }
.hello-date { margin: 0; font-size: 13px; color: var(--muted); }
.hello-title { margin: 2px 0 6px; font-size: 24px; font-weight: 700; color: var(--primary-900); letter-spacing: -0.01em; }
.hello-text { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--muted); max-width: 62ch; }
.hello-text b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.home-top .monthbar { margin: 4px auto 0; }

/* Calendário de contas: tira com os próximos dias */
.cal { margin-top: 14px; }
.cal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 15px; }
.cal-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cal-strip::-webkit-scrollbar { display: none; }
.cal-day {
  flex: 0 0 max(40px, calc((100% - 36px) / 7)); /* uma semana inteira cabe na tela */ display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 0 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; cursor: pointer;
}
.cal-day small { font-size: 11px; color: var(--faint); }
.cal-day b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-day.today { border: 1.5px solid var(--primary); }
.cal-day.today small { color: var(--primary); font-weight: 700; }
.cal-day.sel { background: var(--primary); border-color: var(--primary); color: #fff; }
.cal-day.sel small { color: rgba(255, 255, 255, 0.85); }
.cal-marks { display: flex; gap: 3px; height: 6px; }
.cal-marks i { width: 6px; height: 6px; border-radius: 50%; }
.cal-marks i.inv { background: var(--primary); }
.cal-marks i.rem { background: var(--warn); }
.cal-day.sel .cal-marks i { background: #fff; }
@media (min-width: 1000px) { .cal-day { flex-basis: 52px; } }
.cal-detail { margin-top: 2px; }
.cal-legend { margin-top: 8px; }

/* ---------- Gráficos ---------- */

.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 6px; }
.chart-bars .grp { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; }
.chart-bars .b { width: 40%; max-width: 18px; border-radius: 5px 5px 2px 2px; min-height: 2px; }
.chart-bars .b.in { background: var(--primary-200); }
.chart-bars .b.out { background: var(--primary); }
.chart-bars .grp.cur .b.out { background: var(--primary-700); }
.chart-x { display: flex; gap: 10px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.chart-x span { flex: 1; text-align: center; }
.chart-x .cur { color: var(--primary-700); font-weight: 700; }
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { width: 132px; height: 132px; flex: none; }
.donut text { font-family: var(--font); }

.cols { display: flex; align-items: flex-end; gap: 8px; height: 84px; margin-top: 10px; }
.cols > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.cols i { display: block; width: 100%; border-radius: 6px 6px 2px 2px; background: var(--primary); min-height: 3px; }
.cols.tall { height: 140px; }
.cols-lbl { display: flex; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 4px; }
.cols-lbl span { flex: 1; text-align: center; }

/* ---------- Listas ---------- */

.row-link, .tx { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.row-link:first-child, .tx:first-child { border-top: 0; }
.row-link:hover .desc, .tx:hover .desc { color: var(--primary-700); }
.desc { font-size: 15px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amt { font-weight: 650; white-space: nowrap; text-align: right; }
.dot { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; }
.datebox { flex: none; width: 48px; text-align: center; border: 1px solid var(--line); border-radius: 10px; padding: 4px 0 5px; background: var(--surface-2); }
.datebox b { display: block; font-size: 17px; line-height: 1.2; }
.datebox small { display: block; font-size: 10px; color: var(--muted); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.pill { display: inline-block; font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 999px; vertical-align: 1px; white-space: nowrap; }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.muted { background: var(--surface-3); color: var(--muted); }
.pill.blue { background: var(--primary-50); color: var(--primary-700); }
.more { display: block; width: 100%; text-align: center; padding: 12px 0 4px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--primary); font-weight: 650; font-size: 14px; cursor: pointer; }

/* Tabela de dados (computador); no celular as linhas viram cartões */
.dtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.dtable th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dtable td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dtable tr:last-child td { border-bottom: 0; }
.dtable tbody tr { cursor: pointer; }
.dtable tbody tr:hover td { background: var(--surface-2); }
.dtable .r { text-align: right; }
.dtable .progress { margin-top: 0; min-width: 90px; }

/* Categorias */
.cat { display: flex; align-items: center; gap: 12px; padding: 9px 6px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.cat:hover { background: var(--surface-2); }
.cat.on { border-color: var(--primary-200); background: var(--primary-50); }
.cat .lbl { margin-top: 3px; }
.bar { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 7px; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--primary); }

/* Parcelamentos */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stats b { display: block; font-size: 17px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats > div + div { border-left: 1px solid var(--line); padding-left: 12px; }
.relief { margin-top: 12px; background: var(--good-soft); color: #0b5e41; border-radius: 10px; padding: 9px 12px; font-size: 13px; display: grid; gap: 4px; }
.plans { margin-top: 6px; }
.plan { display: block; padding: 12px 0; border-top: 1px solid var(--line); }
.plans .plan:first-child { margin-top: 8px; }
.plan .desc { font-weight: 650; }
.progress { display: flex; height: 8px; border-radius: 5px; overflow: hidden; background: var(--surface-3); margin-top: 8px; }
.progress i { display: block; height: 100%; }
.progress .paid { background: var(--primary); }
.progress .late { background: var(--bad); }
.plan-grid { display: grid; gap: 12px; }
.plan-card { padding-top: 4px; }
.plan-card .plan { border-top: 0; }
.plan-card details { border-top: 1px solid var(--line); padding-top: 8px; }
.plan-card summary { cursor: pointer; font-size: 13px; color: var(--primary); font-weight: 650; }
.parcels { font-size: 13px; margin-top: 8px; }
.parcels div { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--line); }

/* ---------- Avisos ---------- */

.banner { display: block; background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 12px 14px; margin-top: 8px; font-size: 14px; border: 1px solid #f6dfb5; }
.banner b { color: var(--text); }
.banner.bad { background: var(--bad-soft); color: var(--bad); border-color: #f6caca; }
.banner.bad b { color: inherit; }
.banner .chips { margin-top: 8px; }

/* ---------- Botões e formulários ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius-sm);
  padding: 10px 16px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text);
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--primary-200); color: var(--primary-700); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25); }
.btn.primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: #f1b8b8; background: var(--bad-soft); color: var(--bad); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--primary); }
.actions { display: flex; gap: 10px; margin-top: 20px; }
.actions .btn { flex: 1; padding: 12px 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 14px; font-weight: 550; }
.chip:hover { border-color: var(--primary-200); color: var(--primary-700); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 18px 18px; box-shadow: var(--shadow); margin-top: 12px; }
.field { display: block; margin-top: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; min-width: 0; height: 46px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
.field input:hover, .field select:hover { border-color: var(--faint); }
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.money { font-size: 24px !important; font-weight: 700; height: 56px !important; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-3); padding: 4px; border-radius: 12px; gap: 4px; margin-top: 14px; }
.seg button { border: 0; background: transparent; padding: 9px; border-radius: 9px; cursor: pointer; font-weight: 650; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--primary-700); box-shadow: var(--shadow); }
.err { color: var(--bad); font-size: 13px; margin-top: 10px; font-weight: 550; }
.source { font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 9px 12px; margin-top: 14px; }
.budget-input { width: 130px; flex: none; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); text-align: right; font-weight: 600; }
.budget-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }
.search { position: relative; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { padding-left: 42px !important; }

/* Cartão de crédito (tela Cartões) */
.cc {
  position: relative; border-radius: 16px; padding: 16px 18px; color: #fff; overflow: hidden;
  background: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-600) 100%);
  box-shadow: 0 8px 22px rgba(15, 42, 102, 0.22);
}
.cc::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); }
.cc .cc-name { font-size: 17px; font-weight: 700; }
.cc .cc-meta { font-size: 12.5px; color: rgba(255, 255, 255, 0.8); }
.cc .cc-total { font-size: 24px; font-weight: 700; margin-top: 14px; }
.cc .btn.small { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.cc .btn.small:hover { background: rgba(255, 255, 255, 0.24); }

/* ---------- Navegação ---------- */

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: space-around; align-items: center;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.nav .brand { display: none; }
.nav a { flex: 1; max-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--faint); padding: 4px 0; border-radius: 10px; }
.nav a .ic { width: 22px; height: 22px; }
.nav a.on { color: var(--primary); }
/* Celular: Início · Extrato · + · Cartões · Mais (o + fica exatamente no meio).
   Parcelamentos, Comparativo e Lembretes ficam no menu "Mais". */
.nav a[data-nav='home'] { order: 1; }
.nav a[data-nav='list'] { order: 2; }
.nav a.nav-add { order: 3; }
.nav a[data-nav='cards'] { order: 4; }
.nav .nav-more { order: 5; }
.nav a[data-nav='installments'], .nav a[data-nav='compare'], .nav a[data-nav='reminders'] { display: none; }
.nav a, .nav .nav-more { min-width: 0; }
.nav a > span:not(.ico), .nav .nav-more > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .nav-more {
  flex: 1; max-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; font-size: 10.5px; font-weight: 600;
  color: var(--faint); padding: 4px 0; border: 0; border-radius: 10px; background: none; cursor: pointer;
}
.nav .nav-more .ic { width: 22px; height: 22px; }
.nav .nav-more.on, .nav .nav-more[aria-expanded='true'] { color: var(--primary); }

.more-sheet { position: fixed; inset: 0; z-index: 4; }
.more-backdrop { position: absolute; inset: 0; background: rgba(15, 27, 45, 0.28); }
.more-panel {
  position: absolute; left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom));
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 6px;
}
.more-panel a { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; color: var(--text); }
.more-panel a + a { border-top: 1px solid var(--line); }
.more-panel a .ic { width: 22px; height: 22px; color: var(--primary); flex: none; }
.more-panel a b { display: block; font-size: 15px; }
.more-panel a small { display: block; font-size: 12.5px; color: var(--muted); }
.more-panel a.on { background: var(--primary-50); }
.nav a.nav-add .ico { background: var(--primary); color: #fff; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35); margin-top: -18px; }
.nav a.nav-add .lbl-add { display: none; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom));
  background: var(--primary-900); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px;
  display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px); z-index: 10; box-shadow: var(--shadow-lg);
}
.toast button { background: none; border: 0; color: #9cc0ff; font-weight: 700; cursor: pointer; padding: 0; }

/* ---------- Entrada ---------- */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, var(--primary-100), transparent); }
.gate-card { max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px 26px; text-align: center; box-shadow: var(--shadow-lg); }
.gate-card h1 { font-size: 22px; margin: 14px 0 6px; }
.gate-card p { color: var(--muted); margin: 8px 0; }
.logo { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, var(--primary-700), var(--primary)); color: #fff; display: inline-grid; place-items: center; font-weight: 800; font-size: 24px; }
.steps { text-align: left; margin: 18px 0; padding-left: 20px; color: var(--muted); }
.steps li { margin: 8px 0; }

/* ---------- Painel: grade ---------- */

.dash { display: block; margin-top: 12px; }
.col { min-width: 0; }
.hero-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; border-top: 1px solid rgba(255, 255, 255, 0.2); margin-top: 12px; padding-top: 10px; font-size: 13px; color: rgba(255, 255, 255, 0.85); }
.hero-foot b { color: #fff; }
.only-desktop { display: none !important; }

@media (max-width: 400px) {
  .kpi .kpi-value { font-size: 19px; }
  .kpi.primary .kpi-value { font-size: 28px; }
  .stats b { font-size: 15px; }
}

@media (min-width: 720px) {
  .app { max-width: 680px; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Computador: menu lateral, conteúdo largo, duas colunas */
@media (min-width: 1000px) {
  .app { margin-left: var(--sidebar); max-width: none; padding: 28px 36px 48px; }
  .app > * { max-width: 760px; margin-left: auto; margin-right: auto; }
  .app.wide > * { max-width: 1160px; }
  .only-desktop { display: revert !important; }
  .only-mobile { display: none !important; }
  .kpis { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
  .kpi.primary { grid-column: auto; grid-row: span 1; }
  .dash { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 8px; }
  .dash > .col > .section:first-child { margin-top: 12px; }
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .cards-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

  .nav {
    top: 0; bottom: 0; right: auto; width: var(--sidebar); flex-direction: column; justify-content: flex-start; align-items: stretch;
    gap: 2px; padding: 22px 14px; border-top: 0; border-right: 1px solid var(--line); background: var(--surface);
  }
  .nav .brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; font-weight: 800; font-size: 17px; color: var(--primary-900); }
  .nav .brand .logo { width: 34px; height: 34px; font-size: 16px; border-radius: 10px; }
  .nav a { max-width: none; flex: none; flex-direction: row; gap: 12px; font-size: 14px; font-weight: 600; color: var(--muted); padding: 10px 12px; }
  .nav a:hover { background: var(--surface-2); color: var(--text); }
  .nav a.on { background: var(--primary-50); color: var(--primary-700); }
  .nav a .ic { width: 20px; height: 20px; }
  .nav a.nav-add { order: -1; margin-bottom: 14px; }
  .nav a.nav-add .ico { margin: 0; width: auto; height: auto; background: none; box-shadow: none; color: inherit; }
  .nav a.nav-add { background: var(--primary); color: #fff; justify-content: center; box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25); }
  .nav a.nav-add:hover { background: var(--primary-600); color: #fff; }
  .nav a.nav-add .lbl-add { display: inline; }
  .nav .lbl-tab { display: inline; }
  /* Computador: menu lateral com todas as telas; sem o botão "Mais". */
  .nav a[data-nav='installments'], .nav a[data-nav='compare'], .nav a[data-nav='reminders'] { display: flex; }
  .nav a[data-nav='home'] { order: 1; }
  .nav a[data-nav='list'] { order: 2; }
  .nav a[data-nav='installments'] { order: 3; }
  .nav a[data-nav='compare'] { order: 4; }
  .nav a[data-nav='cards'] { order: 5; }
  .nav a[data-nav='reminders'] { order: 6; }
  .nav .nav-more, .more-sheet { display: none !important; }
  .hello { flex: 1 1 0; }
  .home-top .monthbar { margin: 6px 0 0; }
  .toast { bottom: 24px; left: calc(50% + var(--sidebar) / 2); }
}

/* Seletor de mês: centralizado no celular, à direita no computador */
[data-monthbar] { margin: 0 auto; }
@media (min-width: 1000px) { [data-monthbar] { margin: 0; } }
@media (min-width: 1000px) { .nav .brand { order: -2; } }
@media (max-width: 719px) { .kpis:has(.kpi.primary) > .kpi:nth-child(4):last-child { grid-column: 1 / -1; } }

/* Ícone da categoria no quadradinho */
.dot .ic { width: 18px; height: 18px; }

/* Cartão na cor do banco */
.cc { background: linear-gradient(135deg, var(--cc-dark, var(--primary-900)) 0%, var(--cc, var(--primary-600)) 100%); }
.cc.light { color: #1a1a1a; }
.cc.light .cc-meta { color: rgba(0, 0, 0, 0.65); }
.cc.light::after { background: rgba(255, 255, 255, 0.25); }
.cc.light .btn.small { background: rgba(0, 0, 0, 0.08); border-color: rgba(0, 0, 0, 0.15); color: #1a1a1a; }

/* Escolha de cor */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); position: relative; }
.swatch[aria-checked="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.swatch.auto { width: auto; padding: 0 10px; background: var(--surface-3); font-size: 12px; font-weight: 700; color: var(--muted); }
.swatch.custom { display: grid; place-items: center; background: conic-gradient(#f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); overflow: hidden; }
.swatch.custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }

/* Menu: rótulo curto no celular */
.nav .lbl-long { display: none; }
@media (max-width: 999px) {
  .nav a { font-size: 10px; min-width: 0; }
  .nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
}
@media (min-width: 1000px) {
  .nav .lbl-long { display: inline; }
  .nav .lbl-short { display: none; }
}

/* ---------- Comparativo ---------- */
.cmp-pick { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: end; }
.cmp-vs { color: var(--muted); font-size: 13px; text-align: center; }
.cmp-presets { margin-top: 2px; }
.cmp-kpis { margin-top: 12px; }
.changes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.change { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.change b { white-space: nowrap; }
.cmp-row { padding: 10px 0; border-top: 1px solid var(--line); }
.cmp-row:first-child { border-top: 0; padding-top: 2px; }
.bars2 { display: grid; gap: 4px; margin-top: 8px; padding-left: 46px; }
.bars2 .bar { margin-top: 0; height: 7px; }
.heat-wrap { overflow-x: auto; }
.heat { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 12.5px; min-width: 420px; }
.heat th { font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: center; padding: 4px; }
.heat th:first-child { text-align: left; }
.heat th.cur { color: var(--primary-700); }
.heat td { text-align: center; padding: 8px 4px; border-radius: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
.heat .heat-name { text-align: left; background: none !important; color: var(--text) !important; font-weight: 550; white-space: nowrap; padding-right: 10px; }

@media (min-width: 720px) {
  .cmp-pick { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .cmp-presets { grid-column: 1 / -1; }
  .changes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  .cmp-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .changes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.cmp-kpis .kpi-foot { white-space: normal; }
/* Botão voltar alinhado com a coluna do formulário */
.back { display: flex; }
/* Comparativo no celular: os dois meses lado a lado */
@media (max-width: 719px) {
  .cmp-pick { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cmp-vs { display: none; }
  .cmp-presets { grid-column: 1 / -1; }
  .cmp-pick .field select { padding: 0 8px; font-size: 14px; }
}
:root {
  --hero-start: #163570;
  --hero-end: #204f9d;
  --hero-secondary: #e5eeff;
}

.nav .nav-desktop-only { display: none; }
.home-top { align-items: end; margin-bottom: 16px; }
.home-top .hello-title { margin: 0; }
.eyebrow { margin: 0 0 6px; font-size: .8rem; line-height: 1.3; font-weight: 750; }
.home-top .eyebrow { color: var(--muted); }
.home-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.month-hero {
  grid-column: 1 / -1;
  min-width: 0;
  padding: clamp(18px, 4vw, 32px);
  border-radius: 18px;
  background: linear-gradient(132deg, var(--hero-start), var(--hero-end));
  color: white;
  box-shadow: var(--shadow);
}
.hero-value, .overview-value {
  margin: 7px 0;
  overflow-wrap: anywhere;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.13;
  letter-spacing: -.035em;
}
.hero-value { font-size: clamp(2rem, 6vw, 3rem); }
.hero-detail { color: var(--hero-secondary); margin: 0; font-size: .9rem; }
.hero-link, .metric-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; }
.hero-link { color: white; margin-top: 13px; min-height: 32px; text-decoration: underline; text-underline-offset: 3px; }
.overview-tile { min-width: 0; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.metric-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .875rem; font-weight: 650; margin: 0; }
.metric-label .ic { color: var(--primary); flex-shrink: 0; }
.overview-value { font-size: clamp(1.16rem, 3.6vw, 1.8rem); }
.metric-link { color: var(--primary-600); font-size: .85rem; min-height: 30px; }
.summary-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; margin: 14px 0 20px; font-size: .88rem; }
.summary-line span { color: var(--muted); }
.summary-line strong { color: var(--text); white-space: nowrap; }
.summary-line .btn { margin-left: auto; }
.invoice-status { border: 1px solid var(--hero-secondary); padding: 4px 10px; border-radius: 16px; font-size: .8rem; }
.invoice-stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 16px; color: var(--hero-secondary); }
.invoice-stats strong { color: #fff; }
.invoice-settings { margin-top: 14px; }
.invoice-settings summary, .form-card summary { cursor: pointer; font-weight: 650; padding-block: 8px; }
.review-dialog { border: 1px solid var(--line); border-radius: 16px; width: min(440px, calc(100% - 32px)); color: var(--text); padding: 24px; }
.review-dialog::backdrop { background: rgb(10 25 49 / .55); }
.review-dialog h2 { margin: 0 0 10px; font-size: 1.2rem; }
.review-dialog p { margin: 0 0 14px; }
.notice { border-left: 3px solid var(--primary); border-radius: 8px; background: var(--surface-2); padding: 10px 12px; color: var(--text); font-size: .9rem; }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.filters .field { min-width: 0; }
.filters select { min-width: 0; }
.table-link { font-weight: 650; color: var(--text); }
.table-link:hover { text-decoration: underline; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.category-item { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.category-item:last-child { border-bottom: 0; }
.category-item .cat { border-bottom: 0; }
.category-limit { display: inline-flex; align-items: center; min-height: 32px; margin-left: 42px; color: var(--primary-600); font-size: .85rem; }
.budget-selected { background: var(--surface-2); }
.compare-summary { margin-top: 12px; }
.compare-summary h2 { font-size: 1.15rem; margin: 0 0 4px; }
.compare-summary p { margin: 0 0 8px; }
.compare-summary ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; }
.compare-summary li { display: flex; justify-content: space-between; gap: 10px; }
.btn:disabled, .chip:disabled, .seg button:disabled { opacity: .62; cursor: not-allowed; }
.cal-day small, .cal-day span, .datebox small { font-size: max(.75rem, 12px); }
@media (max-width: 500px) {
  .home-top { flex-wrap: wrap; }
  .home-top .monthbar { margin-left: 0; }
  .summary-line .btn { margin-left: 0; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters label:last-child { grid-column: 1 / -1; }
  .btn, .iconbtn, .chip { min-height: 42px; }
  .iconbtn { min-width: 42px; }
}
@media (min-width: 830px) {
  .home-overview { grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)); }
  .month-hero { grid-column: auto; }
  .overview-tile { padding: 20px; }
}
@media (min-width: 1000px) {
  .nav .nav-desktop-only { display: flex; order: 7; }
}
