/* ==========================================================================
   Rial — estilos
   ========================================================================== */

:root {
  --bg: #0b0f17;
  --bg-soft: #0f1522;
  --surface: #141b2a;
  --surface-2: #1a2233;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e9eef7;
  --text-muted: #8b96a9;
  --text-faint: #5d6a80;

  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --rose: #f43f5e;
  --rose-soft: rgba(244, 63, 94, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);

  --iraci: #a78bfa;
  --iraci-soft: rgba(167, 139, 250, 0.16);
  --willian: #38bdf8;
  --willian-soft: rgba(56, 189, 248, 0.16);

  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-grad: linear-gradient(135deg, #6366f1, #8b5cf6);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

body { background:
  radial-gradient(1200px 600px at 80% -10%, rgba(99, 102, 241, 0.12), transparent 60%),
  radial-gradient(900px 500px at -10% 20%, rgba(34, 197, 94, 0.08), transparent 55%),
  var(--bg);
  background-attachment: fixed;
}

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 0.98rem; }
.muted { color: var(--text-muted); font-size: 0.86rem; }

a { color: var(--accent-2); text-decoration: none; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 16px; font-family: var(--font); font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: transform .12s ease, background .15s, border-color .15s, opacity .15s;
  white-space: nowrap; color: var(--text); background: transparent;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--accent-grad); color: #fff; box-shadow: 0 4px 18px rgba(99,102,241,.35); }
.btn-primary:hover { filter: brightness(1.08); }

.btn-outline { border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-2); }

.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: var(--rose-soft); color: var(--rose); }
.btn-danger:hover { background: rgba(244,63,94,.22); }

.btn-block { width: 100%; }

.icon-btn {
  background: transparent; border: none; color: var(--text-muted);
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 1.1rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.link-btn { background: none; border: none; color: var(--accent-2); cursor: pointer; font-weight: 600; font-size: .85rem; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Auth ---------- */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 22px; padding: 36px 30px;
  box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-mark { font-size: 2.6rem; display: block; margin-bottom: 8px; }
.auth-logo h1 { font-size: 1.7rem; font-weight: 800; }
.auth-logo h1 span { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-logo p { color: var(--text-muted); font-size: .9rem; margin-top: 4px; }

.auth-card label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-muted); margin: 14px 0 6px; }
.auth-card input {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 12px 14px; color: var(--text); font-family: var(--font); font-size: .95rem;
}
.auth-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
.auth-card .btn { margin-top: 20px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--text-muted); font-size: .88rem; }
.auth-hint { text-align: center; margin-top: 14px; color: var(--text-faint); font-size: .78rem; line-height: 1.5; }
.auth-error {
  background: var(--rose-soft); color: var(--rose); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: .85rem; margin-bottom: 6px;
}

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; flex-shrink: 0; background: var(--bg-soft);
  border-right: 1px solid var(--border); padding: 20px 14px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 20px; }
.logo-mark { font-size: 1.5rem; }
.brand-text { font-size: 1.15rem; font-weight: 700; }
.brand-text b { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: transparent; border: none; border-radius: var(--radius-sm);
  padding: 11px 12px; color: var(--text-muted); font-family: var(--font);
  font-size: .9rem; font-weight: 500; cursor: pointer; text-align: left; transition: .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.nav-item.active .nav-ico { filter: none; }
.nav-ico { font-size: 1.1rem; width: 22px; text-align: center; }
.sidebar-foot { padding-top: 14px; border-top: 1px solid var(--border); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-x: hidden; }

.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 22px;
  border-bottom: 1px solid var(--border); background: rgba(11,15,23,.7);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 1.15rem; font-weight: 700; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
#btn-menu { display: none; }

.select {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 9px 12px; font-family: var(--font); font-size: .88rem; cursor: pointer;
}
.select:focus { outline: none; border-color: var(--accent); }

.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: 10px; }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-grad); display: flex; align-items: center; justify-content: center; font-size: .85rem; }
.user-email { font-size: .84rem; color: var(--text-muted); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content { padding: 22px; max-width: 1280px; width: 100%; margin: 0 auto; padding-bottom: 90px; }

/* ---------- Views ---------- */
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
  overflow: hidden; min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.card h3 { margin-bottom: 4px; }

.chart-wrap { position: relative; height: 300px; width: 100%; overflow: hidden; }
.chart-wrap.tall { height: 320px; }

/* ---------- KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.kpi .kpi-label { color: var(--text-muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .kpi-value { font-size: 1.7rem; font-weight: 800; margin-top: 6px; letter-spacing: -0.02em; }
.kpi .kpi-sub { font-size: .78rem; color: var(--text-faint); margin-top: 4px; }
.kpi .kpi-ico { position: absolute; top: 14px; right: 14px; font-size: 1.3rem; opacity: .8; }
.kpi.pos .kpi-value { color: var(--green); }
.kpi.neg .kpi-value { color: var(--rose); }
.kpi.accent .kpi-value { color: #c7d2fe; }

/* ---------- Segmented ---------- */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-btn {
  border: none; background: transparent; color: var(--text-muted); font-family: var(--font);
  font-size: .78rem; font-weight: 600; padding: 6px 11px; border-radius: 8px; cursor: pointer; transition: .15s;
}
.seg-btn.active { background: var(--accent-grad); color: #fff; }

/* ---------- List / table ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 4px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.li-ico { width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0; }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub { font-size: .78rem; color: var(--text-muted); }
.li-amount { font-weight: 700; font-size: .92rem; white-space: nowrap; }
.li-amount.neg { color: var(--rose); }
.li-amount.pos { color: var(--green); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th {
  text-align: left; color: var(--text-faint); font-weight: 600; font-size: .74rem;
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border-strong);
}
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; }
.table .num-cell { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.amt-neg { color: var(--rose); }
.amt-pos { color: var(--green); }

.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600;
  background: var(--surface-2); color: var(--text-muted); white-space: nowrap;
}
.pill.iraci { background: var(--iraci-soft); color: var(--iraci); }
.pill.willian { background: var(--willian-soft); color: var(--willian); }
.pill.cat { background: rgba(99,102,241,.14); color: #a5b4fc; }
.pill.pend { background: rgba(244,63,94,.16); color: #fda4af; }
.pill.split { background: rgba(56,189,248,.16); color: #7dd3fc; }
.li-sub .pill { font-size: .66rem; padding: 2px 7px; }

/* conta recorrente pendente */
.paid-check { width: 19px; height: 19px; flex-shrink: 0; cursor: pointer; accent-color: var(--green); }
.list-item.unpaid .li-title { color: var(--text-muted); }
.list-item.unpaid .li-amount { color: var(--text-faint); font-weight: 600; }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions .icon-btn { width: 30px; height: 30px; font-size: .9rem; }

.empty { text-align: center; color: var(--text-faint); padding: 40px 20px; font-size: .9rem; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar h2 { margin-right: auto; }
.toolbar-spacer { flex: 1; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Balance hero ---------- */
.balance-hero { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.bh-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.bh-card .bh-label { font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.bh-card .bh-value { font-size: 1.5rem; font-weight: 800; margin-top: 6px; }
.bh-card .bh-sub { font-size: .8rem; color: var(--text-faint); margin-top: 4px; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; font-size: .82rem; font-weight: 500;
}
.chip .chip-x { cursor: pointer; color: var(--text-faint); font-weight: 700; }
.chip .chip-x:hover { color: var(--rose); }
.chip-add { border-style: dashed; color: var(--text-muted); cursor: pointer; background: transparent; }
.chip-add:hover { border-color: var(--accent); color: var(--accent-2); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
}
.modal {
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .78rem; font-weight: 600; color: var(--text-muted); }
.field input, .field select, .field textarea {
  background: var(--bg-soft); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text); font-family: var(--font); font-size: .9rem; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.16); }
.field textarea { resize: vertical; min-height: 54px; }
.field .hint { font-size: .72rem; color: var(--text-faint); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 12px; padding: 12px 20px; font-size: .88rem; font-weight: 600;
  box-shadow: var(--shadow); z-index: 200; animation: fade .2s ease;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
}
.toast-action {
  background: var(--accent-grad); color: #fff; border: none; border-radius: 8px;
  padding: 7px 13px; font-family: var(--font); font-size: .8rem; font-weight: 700;
  cursor: pointer; white-space: nowrap;
}
.toast-action:hover { filter: brightness(1.12); }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: rgba(15,21,34,.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border); padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; color: var(--text-faint); font-size: .66rem; font-weight: 600;
  cursor: pointer; padding: 4px 0;
}
.bn-item span { font-size: 1.25rem; }
.bn-item.active { color: var(--accent-2); }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .balance-hero { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  #btn-menu { display: inline-flex; }
  .content { padding: 16px; padding-bottom: 100px; }
  .topbar { padding: 12px 16px; }
  .user-email { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .kpi-value { font-size: 1.35rem; }
  .chart-wrap { height: 240px; }
  .toolbar .btn { padding: 9px 12px; font-size: .82rem; }
}

/* ==========================================================================
   Novos componentes (Início / Gastos / Investimentos)
   ========================================================================== */

.month-nav { display: flex; align-items: center; gap: 4px; margin-left: 14px; }
.month-nav .select { min-width: 150px; }
@media (max-width: 720px) { .month-nav { margin-left: auto; } .month-nav .select { min-width: 120px; } .topbar-actions { display: none; } }

/* Hero (Início) */
.hero-card {
  background: linear-gradient(135deg, rgba(99,102,241,.22), rgba(139,92,246,.12)), var(--surface);
  border: 1px solid var(--border-strong); border-radius: 20px; padding: 24px; box-shadow: var(--shadow);
  margin-bottom: 16px; position: relative; overflow: hidden;
}
.hero-eyebrow { color: var(--text-muted); font-size: .84rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.hero-gastos { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.03em; margin: 6px 0 2px; }
.hero-sub { color: var(--text-muted); font-size: .92rem; }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-badge { background: rgba(255,255,255,.05); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; }
.hero-badge .hb-label { font-size: .74rem; color: var(--text-muted); font-weight: 600; }
.hero-badge .hb-value { font-size: 1.15rem; font-weight: 800; margin-top: 2px; }
.hero-badge.iraci .hb-value { color: var(--iraci); }
.hero-badge.willian .hb-value { color: var(--willian); }
.hero-cta { position: absolute; top: 20px; right: 20px; }
@media (max-width: 720px) { .hero-cta { position: static; margin-top: 16px; } .hero-gastos { font-size: 2rem; } }

.person-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.person-card .pc-name { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.person-card .pc-free { font-size: 1.6rem; font-weight: 800; margin: 8px 0 2px; }
.person-card .pc-free.pos { color: var(--green); }
.person-card .pc-free.neg { color: var(--rose); }
.person-card .pc-line { display: flex; justify-content: space-between; font-size: .82rem; color: var(--text-muted); margin-top: 6px; }

/* Box (página Gastos) */
.box { position: relative; }
.box-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }

.balance-strip {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(99,102,241,.18), rgba(139,92,246,.08)), var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.balance-strip .bs-ico { font-size: 1.6rem; }
.balance-strip .bs-main { flex: 1; min-width: 180px; }
.balance-strip .bs-title { font-size: .78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.balance-strip .bs-value { font-size: 1.25rem; font-weight: 800; margin-top: 2px; }
.balance-strip .bs-value.zero { color: var(--green); }

/* Investimentos / potes */
.pot-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); cursor: pointer; transition: transform .12s, border-color .15s; }
.pot-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.pot-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pot-name { font-weight: 700; }
.pot-tag { font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.pot-tag.col { background: var(--iraci-soft); color: #c4b5fd; }
.pot-tag.ind { background: var(--willian-soft); color: #7dd3fc; }
.pot-tag.done { background: var(--green-soft); color: var(--green); }
.pot-card.done { opacity: .6; }
.pot-total { font-size: 1.7rem; font-weight: 800; margin: 10px 0 2px; }
.pot-goal-label { font-size: .8rem; color: var(--text-muted); display: flex; justify-content: space-between; }
.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.progress-bar { height: 100%; background: var(--accent-grad); border-radius: 999px; transition: width .4s ease; }
.pot-people { display: flex; gap: 12px; font-size: .8rem; color: var(--text-muted); margin-top: 8px; }
.pot-people b { color: var(--text); }

/* FAB */
.fab {
  position: fixed; right: 22px; bottom: 92px; width: 58px; height: 58px; border-radius: 50%;
  background: var(--accent-grad); color: #fff; border: none; font-size: 1.9rem; line-height: 1;
  box-shadow: 0 10px 30px rgba(99,102,241,.5); cursor: pointer; z-index: 40; transition: transform .12s;
}
.fab:hover { transform: scale(1.05); }
@media (min-width: 721px) { .fab { bottom: 28px; } }
@media (max-width: 720px) { .fab { right: 18px; bottom: 84px; } }

/* Auth checkbox */
.check-line { display: flex !important; align-items: center; gap: 8px; font-size: .84rem; color: var(--text-muted); margin-top: 14px; font-weight: 500; }
.check-line input { width: auto; }

/* Quick add */
.amount-input {
  width: 100%; font-size: 2.2rem; font-weight: 800; text-align: center; letter-spacing: -0.02em;
  background: var(--bg-soft); border: 1px solid var(--border-strong); border-radius: 14px; color: var(--text);
  padding: 16px; font-family: var(--font);
}
.amount-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
.quick-label { font-size: .78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip { border: 1px solid var(--border-strong); background: transparent; border-radius: 999px; padding: 8px 13px; font-family: var(--font); font-size: .82rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: .12s; }
.cat-chip:hover { border-color: var(--accent); color: var(--text); }
.cat-chip.active { background: var(--accent-grad); color: #fff; border-color: transparent; }
.seg-person { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg-person button { padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: transparent; color: var(--text-muted); font-family: var(--font); font-weight: 700; cursor: pointer; }
.seg-person button.active.iraci { background: var(--iraci-soft); color: var(--iraci); border-color: transparent; }
.seg-person button.active.willian { background: var(--willian-soft); color: var(--willian); border-color: transparent; }
.adv-toggle { background: none; border: none; color: var(--accent-2); font-weight: 600; font-size: .82rem; cursor: pointer; padding: 4px 0; }
.adv-fields { display: none; }
.adv-fields.open { display: flex; flex-direction: column; gap: 14px; }

/* drawer for mobile menu */.drawer { position: fixed; inset: 0; z-index: 50; display: flex; }
.drawer .drawer-bg { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.drawer .drawer-panel {
  position: relative; width: 250px; height: 100%; background: var(--bg-soft);
  border-right: 1px solid var(--border); padding: 18px 14px; display: flex; flex-direction: column; gap: 8px;
  animation: slide .2s ease;
}
@keyframes slide { from { transform: translateX(-100%); } to { transform: none; } }

/* ==========================================================================
   v3 — Início / Lançamentos / Relatórios / Detalhe investimento
   ========================================================================== */
.topbar-right { margin-left: auto; position: relative; }
.period-btn {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 9px 14px;
  color: var(--text); font-family: var(--font); font-size: .9rem; font-weight: 600; cursor: pointer;
}
.period-btn:hover { border-color: var(--accent); }
.period-btn .chev { color: var(--text-muted); }
.dropdown {
  position: absolute; right: 0; top: 48px; width: 290px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow);
  padding: 14px; z-index: 60; animation: fade .15s ease;
}
.dd-section { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 12px; }
.dd-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.dd-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-bottom: 8px; }
.dd-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.dd-quick button { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px; color: var(--text-muted); font-family: var(--font); font-size: .8rem; font-weight: 600; cursor: pointer; }
.dd-quick button:hover { border-color: var(--accent); color: var(--text); }
.dd-account-row { display: flex; align-items: center; gap: 10px; }
.dd-account-row .avatar { width: 34px; height: 34px; }

/* Início — resumo (no celular vira um slider, igual ao carrossel de baixo) */
.home-summary { display: flex; gap: 14px; margin-bottom: 14px; }
.home-summary .hs-item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); flex: 0 0 auto; }
.home-summary .hs-label { font-size: .72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.home-summary .hs-value { font-size: 1.25rem; font-weight: 800; margin-top: 2px; white-space: nowrap; }

.hscroll-wrap { position: relative; }
.hscroll { display: flex; gap: 14px; overflow-x: auto; scroll-behavior: smooth; padding: 4px 2px 10px; scrollbar-width: thin; }
.hscroll::-webkit-scrollbar { height: 8px; }
.hscroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
.hscroll .person-card { min-width: 260px; flex: 0 0 260px; }

.quickadd-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.amount-inline { font-size: 1.4rem; font-weight: 800; text-align: center; width: 150px; background: var(--bg-soft); border: 1px solid var(--border-strong); border-radius: 12px; color: var(--text); padding: 12px; font-family: var(--font); }
.amount-inline:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
.seg-person.compact { grid-template-columns: 1fr 1fr; width: auto; }
.seg-person.compact button { padding: 10px 16px; }
.inline-text { background: transparent; border: none; border-bottom: 1px dashed var(--border-strong); color: var(--text); font-family: var(--font); font-size: .86rem; padding: 4px; min-width: 220px; }
.inline-text:focus { outline: none; border-bottom-color: var(--accent); }

/* Detalhe investimento */
.inv-detail-head { margin-bottom: 8px; }
.inv-detail-head .id-total { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; }
.inv-back-btn { margin-bottom: 0; }

/* Cartões com dono (config) */
.card-owner-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.card-owner-row:last-child { border-bottom: none; }
.card-owner-row .co-name { font-weight: 600; flex: 1; }
.card-owner-row select { background: var(--bg-soft); border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; color: var(--text); font-family: var(--font); font-size: .84rem; }
.card-owner-row .icon-btn { width: 30px; height: 30px; }

.rep-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 720px) {
  .topbar-right { margin-left: auto; }
  .period-btn { padding: 8px 10px; font-size: .82rem; }
  .dropdown { width: 260px; right: -6px; }
  .hscroll .person-card { min-width: 78vw; flex: 0 0 78vw; }
  .home-summary .hs-item { min-width: 78vw; flex: 0 0 78vw; }
  .home-summary .hs-value { font-size: 1.5rem; }
  .quickadd-inline .amount-inline { width: 100%; }
}

/* Relatórios — legenda de categorias */
.rep-legend { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.rep-legend .rl-row { display: flex; align-items: center; gap: 8px; font-size: .84rem; }
.rep-legend .rl-swatch { width: 12px; height: 12px; border-radius: 4px; flex: 0 0 12px; }
.rep-legend .rl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-legend .rl-val { font-weight: 700; white-space: nowrap; }
.rep-legend .rl-pct { color: var(--text-faint); font-size: .76rem; width: 42px; text-align: right; }

/* Investimentos — lista no card de movimentações */
.invest-mini { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.invest-mini:last-child { border-bottom: none; }
.invest-mini .im-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.invest-mini .im-main { flex: 1; min-width: 0; }
.invest-mini .im-amount { font-weight: 700; }

/* Progressão investimento */
.inv-proj { font-size: .86rem; color: var(--text-muted); margin-top: 8px; }
.inv-proj b { color: var(--text); }

/* ==========================================================================
   Overflow mobile — impedir que cards e gráficos vazem para fora da tela
   ========================================================================== */
.grid > * { min-width: 0; }
.card > * { max-width: 100%; }
canvas { max-width: 100%; }

@media (max-width: 720px) {
  .toolbar { gap: 8px; }
  .toolbar h2 { font-size: 1.1rem; min-width: 0; word-break: break-word; }
  .toolbar .btn { white-space: nowrap; }
  .inv-detail-head .id-total { font-size: 1.6rem; word-break: break-all; }
  .pot-people { flex-wrap: wrap; gap: 6px; }
  .grid.grid-2[style] { grid-template-columns: 1fr !important; }
  .grid.rep-cat-wrap[style] { grid-template-columns: 1fr !important; }
  .hero-badge { flex: 1; min-width: 140px; }
  .list-item { flex-wrap: wrap; }
  .li-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .li-amount { white-space: nowrap; }
}
