/* DinDin - design system (paleta violeta, cartões em vidro, tema escuro/claro) */
:root {
  --bg: #0c0a17;
  --bg-glow-1: rgba(139, 92, 246, 0.22);
  --bg-glow-2: rgba(236, 72, 153, 0.10);
  --card: rgba(26, 20, 52, 0.72);
  --card-solid: #17122e;
  --input: rgba(14, 10, 30, 0.8);
  --border: rgba(168, 85, 247, 0.18);
  --text: #f4f1ff;
  --muted: #9a93c4;
  --primary: #8b5cf6;
  --primary-dark: #7c3aed;
  --grad: linear-gradient(135deg, #8b5cf6, #c026d3);
  --income: #34d399;
  --expense: #fb7185;
  --warn: #fbbf24;
  --radius: 18px;
  --shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.55), 0 6px 12px -6px rgba(139, 92, 246, 0.18);
  --track: rgba(255, 255, 255, 0.09);
  --grid-line: rgba(255, 255, 255, 0.07);
  color-scheme: dark;
}
:root[data-theme='light'] {
  --bg: #f5f3ff;
  --bg-glow-1: rgba(139, 92, 246, 0.16);
  --bg-glow-2: rgba(236, 72, 153, 0.08);
  --card: rgba(255, 255, 255, 0.9);
  --card-solid: #ffffff;
  --input: #ffffff;
  --border: rgba(124, 58, 237, 0.14);
  --text: #1e1538;
  --muted: #6d628f;
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --income: #059669;
  --expense: #e11d48;
  --warn: #d97706;
  --shadow: 0 10px 25px -6px rgba(124, 58, 237, 0.12), 0 6px 10px -6px rgba(124, 58, 237, 0.08);
  --track: rgba(124, 58, 237, 0.1);
  --grid-line: rgba(30, 21, 56, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(at 0% 0%, var(--bg-glow-1) 0, transparent 50%),
    radial-gradient(at 100% 0%, var(--bg-glow-2) 0, transparent 45%),
    radial-gradient(at 50% 100%, var(--bg-glow-1) 0, transparent 55%);
  background-attachment: fixed;
  color: var(--text); line-height: 1.5;
}
h1, h2, h3 { margin: 0 0 12px; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.05rem; font-weight: 700; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }
a { color: var(--primary); }

/* Layout */
.app { min-height: 100vh; padding-bottom: 84px; }
.topbar {
  position: sticky; top: 0; z-index: 12; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; flex: 1; }
.logo {
  width: 36px; height: 36px; border-radius: 11px; background: var(--grad); color: #fff;
  display: grid; place-items: center; box-shadow: 0 6px 16px -4px rgba(139, 92, 246, 0.6);
}
.logo svg { width: 20px; height: 20px; }
.user-chip { font-size: 0.85rem; color: var(--muted); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card-solid); color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.container { max-width: 1000px; margin: 0 auto; padding: 20px 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head input[type='month'] { width: auto; }

.nav {
  position: fixed; bottom: 10px; left: 10px; right: 10px; z-index: 11; display: flex;
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--shadow);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 2px; font-size: 0.68rem; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: 16px;
}
.nav a.active { color: var(--primary); background: rgba(139, 92, 246, 0.14); }
.nav svg { width: 21px; height: 21px; }

/* Cartões */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
.kpi { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; }
.kpi .ico {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: rgba(139, 92, 246, 0.16); color: var(--primary);
}
.kpi .ico svg { width: 22px; height: 22px; }
.kpi.income .ico { background: rgba(52, 211, 153, 0.15); color: var(--income); }
.kpi.expense .ico { background: rgba(251, 113, 133, 0.15); color: var(--expense); }
.kpi.balance { background-image: linear-gradient(135deg, rgba(139, 92, 246, 0.28), rgba(192, 38, 211, 0.16)); }
.kpi .label { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.kpi .value { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; }
.income { color: var(--income); }
.expense { color: var(--expense); }
.muted { color: var(--muted); }

/* Formulários */
label { display: block; font-size: 0.8rem; font-weight: 700; margin: 12px 0 5px; color: var(--muted); }
input, select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--input); color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input[type='color'] { padding: 3px; height: 44px; }
.field-error { color: var(--expense); font-size: 0.8rem; margin-top: 4px; }
.form-error { color: var(--expense); margin: 8px 0; font-size: 0.9rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }

.btn {
  display: inline-block; padding: 11px 18px; border: 0; border-radius: 12px; text-align: center; text-decoration: none;
  background: var(--grad); color: #fff; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 18px -6px rgba(139, 92, 246, 0.55); transition: transform 0.15s, filter 0.15s;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn.secondary { background: var(--track); color: var(--text); box-shadow: none; }
.btn.danger { background: rgba(251, 113, 133, 0.18); color: var(--expense); box-shadow: none; }
.btn.small { padding: 6px 11px; font-size: 0.8rem; border-radius: 10px; }
.btn.block { width: 100%; margin-top: 16px; }

/* Listas */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 140px; }
.list .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { font-size: 0.78rem; color: var(--muted); }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 10px -1px currentColor; }
.empty { text-align: center; color: var(--muted); padding: 28px 0; }

/* Orçamento */
.bar { height: 14px; background: var(--track); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #10b981, #34d399); transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.bar.warn > span { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar.over > span { background: linear-gradient(90deg, #e11d48, #fb7185); }
.alert {
  background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.4); color: var(--warn);
  border-radius: 12px; padding: 10px 13px; margin-top: 10px; font-weight: 700; font-size: 0.9rem;
}
.alert.over { background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.45); color: var(--expense); }

/* Modal e avisos */
.modal-bg {
  position: fixed; inset: 0; background: rgba(5, 3, 15, 0.65); z-index: 20; backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--card-solid); border: 1px solid var(--border); width: 100%; max-width: 480px; max-height: 92vh;
  overflow: auto; border-radius: 24px 24px 0 0; padding: 22px; box-shadow: var(--shadow);
}
.fab {
  position: fixed; right: 18px; bottom: 92px; z-index: 9; width: 58px; height: 58px; border-radius: 50%;
  border: 0; background: var(--grad); color: #fff; font-size: 1.9rem; cursor: pointer;
  box-shadow: 0 10px 24px -4px rgba(139, 92, 246, 0.7);
}
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 30;
  background: var(--card-solid); border: 1px solid var(--border); color: var(--text);
  padding: 11px 18px; border-radius: 12px; font-size: 0.9rem; box-shadow: var(--shadow);
}
.segment { display: flex; gap: 8px; margin-bottom: 4px; }
.segment button {
  flex: 1; padding: 10px; border: 1px solid var(--border); background: var(--input); color: var(--text);
  border-radius: 12px; cursor: pointer; font-weight: 700;
}
.segment button.on.income { background: rgba(52, 211, 153, 0.18); color: var(--income); border-color: var(--income); }
.segment button.on.expense { background: rgba(251, 113, 133, 0.18); color: var(--expense); border-color: var(--expense); }
.chart-box { position: relative; height: 250px; }

/* Login / cadastro */
.auth { max-width: 420px; margin: 6vh auto 0; padding: 16px; }
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-brand .logo { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; }
.auth-brand .logo svg { width: 32px; height: 32px; }
.auth-brand h1 { font-size: 2.1rem; margin: 0; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.auth .card { padding: 24px; }

@media (min-width: 720px) {
  .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-bg { align-items: center; }
  .modal { border-radius: 24px; }
  .app { padding-bottom: 0; padding-left: 220px; }
  .nav {
    top: 0; left: 0; right: auto; bottom: 0; width: 220px; flex-direction: column; gap: 4px;
    border-radius: 0; border-width: 0 1px 0 0; padding: 78px 12px 12px;
  }
  .nav a { flex: none; flex-direction: row; gap: 12px; padding: 12px 14px; font-size: 0.95rem; }
  .topbar { margin-left: -220px; padding-left: 236px; }
  .fab { bottom: 28px; }
  .toast { bottom: 28px; }
}

/* ===== Página inicial ===== */
.lp-wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.lp-head {
  position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.lp-head-in { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.lp-links { display: none; gap: 4px; flex: 1; justify-content: center; }
.lp-head-in .brand { flex: 1; }
.link-btn { background: none; border: 0; color: var(--muted); font-weight: 600; padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.link-btn:hover { color: var(--text); background: var(--track); }
.lp-actions { display: flex; align-items: center; gap: 10px; }
.hero { display: grid; gap: 32px; padding-top: 48px; padding-bottom: 48px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  color: var(--primary); background: rgba(139, 92, 246, 0.14); border: 1px solid var(--border);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--income); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
.hero h1 { font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.1; margin: 16px 0; font-weight: 800; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 62ch; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 12px; }
.btn.big { padding: 14px 24px; font-size: 1rem; border-radius: 14px; }
.small { font-size: 0.8rem; }
.preview { max-width: 380px; width: 100%; justify-self: center; transform: rotate(-2deg); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: rotate(-2deg) translateY(-10px); } }
.pv-balance { display: flex; flex-direction: column; margin: 8px 0; }
.pv-balance strong { font-size: 2rem; font-weight: 800; }
.pv-row { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 8px; }
.lp-sec { padding-top: 48px; padding-bottom: 24px; }
.kicker { color: var(--primary); font-weight: 800; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.lp-h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); line-height: 1.2; margin: 8px 0 12px; font-weight: 800; }
.grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
.stat-big .big { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-big .stat-label { font-weight: 700; }
.stat-big .stat-note { color: var(--muted); font-size: 0.78rem; margin-top: 4px; }
.callout { display: flex; gap: 14px; align-items: flex-start; border-left: 4px solid var(--warn); }
.callout svg { width: 28px; height: 28px; color: var(--warn); flex: none; }
.feat .ico, .step .ico {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 10px;
  background: rgba(139, 92, 246, 0.16); color: var(--primary);
}
.feat .ico svg, .step .ico svg { width: 22px; height: 22px; }
.feat p, .step p { margin: 0; }
.step { position: relative; }
.step-n { position: absolute; top: 14px; right: 18px; font-size: 2.4rem; font-weight: 800; color: var(--track); }
.sim-sec { display: grid; gap: 24px; align-items: center; }
.sim .row > div { flex: 1; min-width: 130px; }
.sim-pct { font-size: 1.4rem; font-weight: 800; margin: 4px 0 8px; }
.cta-final { text-align: center; padding: 36px 20px; margin-top: 40px; background-image: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(192, 38, 211, 0.15)); }
.cta-final .lead { margin: 0 auto 20px; }
.lp-foot { padding-top: 40px; padding-bottom: 40px; }
.sources { padding-left: 18px; color: var(--muted); font-size: 0.85rem; }
.sources li { margin-bottom: 4px; }
@media (min-width: 720px) {
  .lp-links { display: flex; }
  .hero { grid-template-columns: 1.2fr 0.8fr; }
  .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sim-sec { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { .preview, .pulse { animation: none; } }

/* ===== Cabeçalho do app (cartão arredondado com saudação e avatar) ===== */
.topbar {
  top: 10px; margin: 10px 12px 0; padding: 12px 16px; border: 1px solid var(--border);
  border-radius: 22px; box-shadow: var(--shadow);
}
.brand { gap: 12px; }
.brand-text { line-height: 1.2; min-width: 0; }
.brand-name { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.85rem; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub strong { color: var(--primary); font-weight: 700; }
.topbar .logo { width: 44px; height: 44px; border-radius: 14px; }
.topbar .logo svg { width: 22px; height: 22px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 0.95rem; text-decoration: none;
  border: 2px solid var(--primary); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}
@media (min-width: 720px) {
  .topbar { margin: 10px 16px 0 16px; padding-left: 16px; }
}
@media (min-width: 720px) {
  .nav { padding-top: 28px; }
}

/* ===== Menu da conta ===== */
.menu-wrap { position: relative; flex: none; }
button.avatar { cursor: pointer; font-family: inherit; padding: 0; }
.avatar.big { width: 50px; height: 50px; font-size: 1.05rem; box-shadow: none; }
.menu {
  position: absolute; right: 0; top: calc(100% + 12px); width: 290px; max-width: calc(100vw - 32px); z-index: 40;
  background: var(--card-solid); border: 1px solid var(--border); border-radius: 20px; padding: 10px; box-shadow: var(--shadow);
}
.menu-head { display: flex; gap: 12px; align-items: center; padding: 10px 8px; }
.menu-who { min-width: 0; }
.menu-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-mail { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: rgba(139, 92, 246, 0.16); color: var(--primary); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 12px; border: 0; background: none;
  color: var(--text); font: inherit; font-weight: 600; text-align: left; border-radius: 12px; cursor: pointer;
}
.menu-item svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.menu-item:hover { background: var(--track); }
.menu-item.danger, .menu-item.danger svg { color: var(--expense); }

/* ===== Menu hambúrguer da página inicial (celular) ===== */
.hamb-wrap { position: static; }
.hamb .ic-close { display: none; }
.hamb[aria-expanded='true'] .ic-open { display: none; }
.hamb[aria-expanded='true'] .ic-close { display: inline; }
.hamb span { display: grid; place-items: center; }
.lp-mobile {
  position: absolute; left: 12px; right: 12px; top: calc(100% + 8px); z-index: 40; padding: 10px;
  background: var(--card-solid); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow);
}
.lp-mobile .menu-item { padding: 14px 14px; font-size: 1.02rem; }
.lp-mobile-cta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 4px 4px; }
.lp-enter { display: none; }
@media (min-width: 720px) {
  .hamb-wrap { display: none; }
  .lp-enter { display: inline-block; }
}
