/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #27ae60;
  --green-light: #0d2b1a;
  --red: #e74c3c;
  --red-light: #2b1212;
  --orange: #f39c12;
  --orange-light: #2b2108;
  --blue: #4a9edd;
  --blue-light: #0d1f2d;
  --text: #e8e8f0;
  --text-muted: #8888aa;
  --bg: #0f0f13;
  --card-bg: rgba(255,255,255,.05);
  --card-border: rgba(255,255,255,.08);
  --border: rgba(255,255,255,.08);
  --shadow: 0 4px 24px rgba(0,0,0,.3);
  --radius: 12px;
  --header-h: 56px;
  --nav-h: 64px;
}

/* ── Tema claro ─────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --green-light: #e8f8ef;
  --red-light: #fdeaea;
  --orange-light: #fef5e0;
  --blue-light: #e0f0fc;
  --text: #1a1a2e;
  --text-muted: #6b6b85;
  --bg: #eef0f5;
  --card-bg: #ffffff;
  --border: #d8d8e4;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

/* Overrides de cores hardcoded no tema claro */
[data-theme="light"] #tela-login,
[data-theme="light"] #tela-loading {
  background: linear-gradient(135deg, #c8d6f0 0%, #a8bde0 60%, #7ea3d0 100%) !important;
}
[data-theme="light"] .dash-hero {
  background: linear-gradient(145deg, #f5f7fc 0%, #edf1fa 55%, #e6ebf5 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
[data-theme="light"] .dash-hero,
[data-theme="light"] .dash-hero * { color: #1a1a2e; }
[data-theme="light"] .dash-avatar {
  background: rgba(0,0,0,.08);
  border-color: rgba(0,0,0,.15);
}
[data-theme="light"] .dash-nav-btn {
  background: rgba(0,0,0,.08);
  color: rgba(0,0,0,.7);
}
[data-theme="light"] .dash-nav-btn:hover { background: rgba(0,0,0,.14); }
[data-theme="light"] .dash-hero-saldo-label { color: rgba(0,0,0,.5); }
[data-theme="light"] .dash-eye-btn { color: rgba(0,0,0,.35); }
[data-theme="light"] .dash-eye-btn:hover { color: rgba(0,0,0,.8); }
[data-theme="light"] .dash-hero-bottom { border-top-color: rgba(0,0,0,.1); }
[data-theme="light"] .dash-hero-divider { background: rgba(0,0,0,.1); }
[data-theme="light"] .dash-item-label { color: rgba(0,0,0,.5); }
[data-theme="light"] .dash-green { color: #1e8e4e; }
[data-theme="light"] .dash-red { color: #d43c2c; }
[data-theme="light"] .data-table thead th { background: #eeeef4; }
[data-theme="light"] .data-table tbody tr:hover { background: #f0f0f6; }
[data-theme="light"] .card-alert { background: #fef5e0; border-color: #e0c54a; }
[data-theme="light"] .card-alert:hover { background: #fef9ec; }
[data-theme="light"] .badge-projetado { background: #e0f0fc; color: #2a6fa8; border-color: #7eb8e8; }
[data-theme="light"] .ag-badge-rec { background: #e0f0fc; color: #2a6fa8; }
[data-theme="light"] .accordion-header:hover { background: rgba(0,0,0,.04); }
[data-theme="light"] .accordion-header-active { background: rgba(0,0,0,.06); }
[data-theme="light"] .nav-avatar {
  background: rgba(0,0,0,.08);
  border-color: rgba(0,0,0,.15);
}
[data-theme="light"] .nav-btn:hover { background: rgba(0,0,0,.06); }
[data-theme="light"] .nav-btn.active { background: rgba(74,158,221,.12); }
[data-theme="light"] .login-box { color: var(--text); }
[data-theme="light"] #tela-loading div[style*="border:3px"] {
  border-color: #d8d8e4 !important;
  border-top-color: #4a9edd !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100dvh;
}

/* Fundo base — evita flash branco em scroll/fullpage */
html                              { background: #0d0d11; }
[data-theme="light"]              { background: #f0f2f7; }

/* Fundo premium escuro */
html:not([data-theme="light"]) body {
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(25,80,180,.22) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 30%, rgba(40,100,200,.10) 0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at 5% 70%, rgba(80,60,180,.08) 0%, transparent 50%),
    linear-gradient(170deg, #131318 0%, #0f0f13 35%, #0d0d11 100%);
  background-attachment: fixed;
}

/* Fundo premium claro — formas geométricas decorativas */
[data-theme="light"] body {
  background:
    radial-gradient(ellipse 80% 60% at 70% -10%, rgba(180,200,230,.30) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 5% 90%, rgba(160,180,210,.15) 0%, transparent 50%),
    linear-gradient(160deg, #e8ecf4 0%, #eef0f5 40%, #f0f2f7 100%);
  background-attachment: fixed;
}
[data-theme="light"] body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle 2px at 20% 15%, rgba(160,170,190,.25) 0%, transparent 1px),
    radial-gradient(circle 2px at 22% 17%, rgba(160,170,190,.20) 0%, transparent 1px),
    radial-gradient(circle 2px at 24% 14%, rgba(160,170,190,.22) 0%, transparent 1px),
    radial-gradient(circle 2px at 26% 18%, rgba(160,170,190,.18) 0%, transparent 1px),
    radial-gradient(circle 2px at 28% 13%, rgba(160,170,190,.20) 0%, transparent 1px),
    radial-gradient(circle 2px at 30% 16%, rgba(160,170,190,.22) 0%, transparent 1px),
    radial-gradient(circle 2px at 32% 20%, rgba(160,170,190,.18) 0%, transparent 1px),
    radial-gradient(circle 2px at 18% 19%, rgba(160,170,190,.20) 0%, transparent 1px);
}
[data-theme="light"] body > *:not(.modal-overlay) { position: relative; z-index: 1; }

/* ── Glassmorphism (tema escuro) ──────────────────────────────────────── */
html:not([data-theme="light"]) .card,
html:not([data-theme="light"]) .dash-list-card,
html:not([data-theme="light"]) .admin-card,
html:not([data-theme="light"]) .login-box,
html:not([data-theme="light"]) .modal-box {
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 4px 30px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.05);
}

.hidden { display: none !important; }

/* ── Tela de login ───────────────────────────────────────────────────────── */
#tela-login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
}
.login-box {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 48px 32px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { font-size: 48px; margin-bottom: 16px; }
.login-box h1 { font-size: 22px; margin-bottom: 6px; color: var(--text); }
.login-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.login-box p { color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.login-box strong { color: var(--text); }
.login-hint { margin-top: 20px; font-size: 13px; }

#form-login { text-align: left; }
.input-group { margin-bottom: 14px; }
.input-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 6px; }
.input-group input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 15px; outline: none; transition: border-color .15s; background: var(--bg); color: var(--text); }
.input-group input:focus { border-color: var(--blue); }
.login-erro { background: var(--red-light); color: var(--red); border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }
.btn-full { width: 100%; padding: 12px; font-size: 15px; margin-top: 4px; border-radius: 10px; }

/* ── Main content ────────────────────────────────────────────────────────── */
.main-content {
  padding: 16px 16px calc(var(--nav-h) + 16px);
  max-width: 900px;
  margin: 0 auto;
}

/* ── Avatar dropdown ─────────────────────────────────────────────────────── */
.dash-avatar-wrap { position: relative; flex-shrink: 0; }
.dash-avatar { cursor: pointer; transition: opacity .15s; }
.dash-avatar:hover { opacity: .85; }

.avatar-dropdown {
  position: absolute;
  top: 54px; left: 0;
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
  min-width: 190px;
  padding: 6px;
  z-index: 300;
}
.avatar-dd-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; border: none; background: none;
  padding: 11px 12px;
  font-size: 14px; color: var(--text);
  border-radius: 8px; cursor: pointer; text-align: left;
  transition: background .1s; font-family: inherit;
}
.avatar-dd-item:hover { background: var(--bg); }
.avatar-dd-danger { color: var(--red); }
.avatar-dd-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Settings Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 400;
}
.modal-box {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 24px 24px 32px;
  width: calc(100% - 32px); max-width: 480px;
  max-height: 90dvh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text-muted);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; transition: background .1s;
}
.modal-close:hover { background: var(--bg); }

.settings-avatar-wrap {
  display: flex; align-items: center; gap: 16px;
  padding: 0 0 20px; border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
.settings-avatar-preview {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #0f3460 0%, #2980b9 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: white;
  flex-shrink: 0; overflow: hidden;
}
.settings-avatar-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.settings-avatar-info { display: flex; flex-direction: column; gap: 6px; }
.settings-avatar-name { font-size: 16px; font-weight: 600; color: var(--text); }
.btn-link {
  background: none; border: none; cursor: pointer;
  color: var(--blue); font-size: 13px; padding: 0; text-align: left; font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }

.settings-section { margin-bottom: 24px; }
.settings-section-title {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 14px;
}
.settings-section-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.settings-section-disabled { opacity: .45; pointer-events: none; }
.badge-dev {
  font-size: 11px; font-weight: 600;
  background: var(--orange-light); color: var(--orange);
  padding: 2px 8px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .3px; white-space: nowrap;
}
.settings-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.5; }
.btn-google {
  background: var(--card-bg); color: var(--text);
  border: 1.5px solid var(--border);
  padding: 10px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}

/* ── Bottom nav ──────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: #1c1c24;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  box-shadow: 0 -2px 8px rgba(0,0,0,.06);
  z-index: 100;
}
[data-theme="light"] .bottom-nav {
  background: #ffffff;
  border-top-color: #d8d8e4;
}
/* Mobile: wrappers transparentes */
.nav-brand { display: none; }
.nav-user  { display: none; }
.nav-links { display: contents; }

/* ── Theme switch (pill toggle) ──────────────────────────────────────────── */
.theme-switch {
  position: relative;
  width: 56px; height: 28px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.08);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background .3s, border-color .3s;
  margin-right: 12px;
  flex-shrink: 0;
}
.theme-switch-icon {
  font-size: 13px;
  z-index: 1;
  width: 24px;
  text-align: center;
  line-height: 28px;
  transition: opacity .3s;
}
.theme-switch-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  transition: transform .3s ease;
}
/* Dark mode: thumb left (moon active) */
.theme-switch-moon { opacity: 1; }
.theme-switch-sun  { opacity: .4; }

/* Light mode */
[data-theme="light"] .theme-switch {
  background: rgba(0,0,0,.06);
  border-color: rgba(0,0,0,.12);
}
[data-theme="light"] .theme-switch-thumb {
  transform: translateX(28px);
  background: #ffd43b;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
[data-theme="light"] .theme-switch-moon { opacity: .4; }
[data-theme="light"] .theme-switch-sun  { opacity: 1; }

.nav-btn {
  flex: 1;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  color: var(--text-muted);
  transition: color .15s;
}
.nav-btn.active { color: var(--blue); }
.nav-icon { font-size: 20px; }
.nav-label { font-size: 11px; font-weight: 500; }

/* ── Section header ──────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2 { font-size: 18px; font-weight: 700; }

.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.btn-icon {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px; height: 32px;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background .15s;
}
.btn-icon:hover { background: var(--bg); }

/* ── Cards grid ──────────────────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
}
.card-full { grid-column: span 2; }
.card-neutral { border-color: var(--blue); }
.card-green   { border-color: var(--green); }
.card-red     { border-color: var(--red); }
.card-orange  { border-color: var(--orange); }
.card-teal    { border-color: #16a085; }

.card-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .3px; }
.card-value { font-size: 18px; font-weight: 700; }
.card-neutral .card-value { color: var(--blue); }
.card-green   .card-value { color: var(--green); }
.card-red     .card-value { color: var(--red); }
.card-orange  .card-value { color: var(--orange); }
.card-teal    .card-value { color: #16a085; }

.card-alert {
  margin-top: 10px;
  padding: 6px 8px;
  background: #2b2108;
  color: #f5c542;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #6b5a0a;
  transition: background .15s;
}
.card-alert:hover { background: #3a2d0c; }

/* ── Dashboard Hero ──────────────────────────────────────────────────────── */
.dash-hero {
  background: linear-gradient(145deg, #141830 0%, #182848 55%, #1a3a6a 100%);
  border-radius: 0 0 24px 24px;
  padding: 20px 20px 22px;
  margin: -16px -16px 16px;
  color: white;
  box-shadow: none;
}

/* Linha superior */
.dash-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.dash-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  color: white;
  flex-shrink: 0;
  text-transform: uppercase;
  user-select: none;
}

.dash-month-row {
  display: flex; align-items: center; gap: 10px;
}
.dash-month-label {
  font-size: 17px; font-weight: 700; color: white;
  min-width: 90px; text-align: center;
}
.dash-nav-btn {
  background: rgba(255,255,255,.12);
  border: none; border-radius: 8px;
  width: 32px; height: 32px;
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.8);
  transition: background .15s;
}
.dash-nav-btn:hover { background: rgba(255,255,255,.22); }

.dash-cupom-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: #8e44ad;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  position: relative; flex-shrink: 0;
  transition: transform .15s;
  box-shadow: 0 4px 12px rgba(142,68,173,.5);
}
.dash-cupom-btn:hover { transform: scale(1.07); }
.dash-cupom-dot {
  position: absolute; top: 2px; right: 2px;
  width: 11px; height: 11px;
  background: #2ecc71; border-radius: 50%;
  border: 2px solid #8e44ad;
}

/* Saldo central */
.dash-hero-saldo {
  text-align: center;
  padding: 4px 0 22px;
}
.dash-saldo-label {
  font-size: 12px;
  color: rgba(255,255,255,.55);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.dash-saldo-valor {
  font-size: 36px; font-weight: 700;
  color: white; letter-spacing: -.5px;
  margin-bottom: 10px;
}
.dash-eye-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.45);
  padding: 4px; display: inline-flex;
  transition: color .15s;
}
.dash-eye-btn:hover { color: rgba(255,255,255,.9); }

/* Receitas / Despesas */
.dash-hero-bottom {
  display: flex; align-items: center;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.dash-hero-item {
  flex: 1; display: flex; align-items: center; gap: 12px;
}
.dash-hero-divider {
  width: 1px; height: 50px;
  background: rgba(255,255,255,.12);
  margin: 0 16px; flex-shrink: 0;
}
.dash-circle {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dash-circle-green { background: #27ae60; box-shadow: 0 4px 12px rgba(39,174,96,.4); }
.dash-circle-red   { background: #e74c3c; box-shadow: 0 4px 12px rgba(231,76,60,.4); }
.dash-item-label {
  font-size: 12px; color: rgba(255,255,255,.55); margin-bottom: 3px;
}
.dash-item-valor { font-size: 16px; font-weight: 700; }
.dash-green { color: #2ecc71; }
.dash-red   { color: #ff6b6b; }

/* ── Dashboard list cards (últimas tx + lembretes) ───────────────────────── */
.dash-lists-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.dash-list-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dash-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}
.dash-list-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.dash-list-body { padding: 0 16px 14px; }
.empty-hint { color: var(--text-muted); font-size: 13px; text-align: center; padding: 12px 0; }

/* Item de transação recente */
.dash-tx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.dash-tx-item:last-child { border-bottom: none; }
.dash-tx-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.dash-tx-icon.despesa { background: var(--red-light); }
.dash-tx-icon.receita { background: var(--green-light); }
.dash-tx-info { flex: 1; min-width: 0; }
.dash-tx-desc {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-tx-meta { font-size: 11px; color: var(--text-muted); }
.dash-tx-valor { font-size: 13px; font-weight: 600; text-align: right; white-space: nowrap; }
.dash-tx-valor.despesa { color: var(--red); }
.dash-tx-valor.receita { color: var(--green); }

/* Item de lembrete */
.dash-lem-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.dash-lem-item:last-child { border-bottom: none; }
.dash-lem-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--blue-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.dash-lem-info { flex: 1; min-width: 0; }
.dash-lem-msg {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-lem-data { font-size: 11px; color: var(--text-muted); }

/* ── FAB Speed Dial ─────────────────────────────────────────────────────── */
.fab-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
@media (max-width: 768px) {
  .fab-container { bottom: calc(var(--nav-h) + 16px); }
}
.fab-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: white;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(74,158,221,.4);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, background .15s;
}
.fab-btn:hover { background: #3a8ecd; }
.fab-btn.open { transform: rotate(45deg); }
.fab-icon { line-height: 1; }

.fab-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.fab-menu.hidden { display: none; }
.fab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: var(--card-bg);
  border-radius: 24px;
  padding: 8px 14px 8px 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s, box-shadow .15s;
}
.fab-item:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.fab-item-icon { font-size: 18px; }
.fab-item-label { font-size: 13px; font-weight: 500; color: var(--text); }

/* ── Charts ──────────────────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 16px;
}
.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.chart-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--text-muted); }
.chart-wrap { position: relative; height: 220px; }

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.filter-bar {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-tab {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  color: var(--text-muted);
  font-weight: 500;
}
.filter-tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
.search-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  width: 100%;
  transition: border-color .15s;
  background: var(--bg);
  color: var(--text);
}
.search-input:focus { border-color: var(--blue); }

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table thead th {
  padding: 12px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--text-muted);
  background: rgba(0,0,0,.15);
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #22222c; }
.data-table td {
  padding: 11px 14px;
  font-size: 13px;
  vertical-align: middle;
}
.tx-icon-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  vertical-align: middle;
  margin-right: 4px;
  flex-shrink: 0;
}
.text-right { text-align: right !important; }
.valor-positivo { color: var(--green); font-weight: 600; }
.valor-negativo { color: var(--red); font-weight: 600; }

/* ── Tabela responsiva (mobile portrait) ────────────────────────────────── */
@media (max-width: 600px) {
  .data-table thead { display: none; }

  .data-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    row-gap: 5px;
    column-gap: 12px;
    align-items: center;
    padding: 12px 14px;
  }

  .data-table tbody td {
    padding: 0;
    font-size: 13px;
    border-bottom: none !important;
  }

  /* DATA → segunda linha, esquerda */
  .data-table tbody td:nth-child(1) {
    grid-column: 1; grid-row: 2;
    font-size: 11px; color: var(--text-muted);
  }

  /* DESCRIÇÃO → primeira linha, esquerda */
  .data-table tbody td:nth-child(2) {
    grid-column: 1; grid-row: 1;
  }

  /* CATEGORIA → oculto */
  .data-table tbody td:nth-child(3) { display: none; }

  /* VALOR → primeira linha, direita */
  .data-table tbody td:nth-child(4) {
    grid-column: 2; grid-row: 1;
    font-size: 14px; font-weight: 700;
    text-align: right;
  }

  /* STATUS + AÇÕES → segunda linha, direita */
  .data-table tbody td:nth-child(5) {
    grid-column: 2; grid-row: 2;
    display: flex; gap: 6px;
    justify-content: flex-end; align-items: center;
  }
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-pago { background: var(--green-light); color: var(--green); }
.badge-pendente { background: var(--orange-light); color: var(--orange); }
.badge-projetado { background: #0d1f2d; color: #7eb8e8; border: 1px dashed #4a7fb5; }

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  opacity: .6;
  transition: opacity .15s;
  border-radius: 4px;
}
.action-btn:hover { opacity: 1; background: var(--bg); }

/* ── Totais de transações ────────────────────────────────────────────────── */
.tx-totais {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 0 0 12px 12px;
  flex-wrap: wrap;
}
.tx-totais-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.tx-totais-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.tx-totais-valor {
  font-size: 15px;
  font-weight: 700;
}
.tx-totais-saldo-pos { color: #2ecc71; }
.tx-totais-saldo-neg { color: #e74c3c; }
.tx-totais-sep {
  width: 1px;
  height: 32px;
  background: var(--border);
}

/* ── Paginação ───────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px;
}
.page-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.page-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
.page-btn:hover:not(.active) { background: var(--bg); }

/* ── Create bar ──────────────────────────────────────────────────────────── */
.create-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.create-bar .search-input { flex: 1; }
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-primary { background: var(--blue); color: white; }
.btn-danger { background: #e74c3c; color: white; }
.btn-outline-danger { background: transparent; color: #e74c3c; border: 1.5px solid #e74c3c; }
.btn-secondary { background: var(--bg); color: var(--text-muted); border: 1.5px solid var(--border); }

/* ── Modal recorrência (centrado) ─────────────────────────────────────────── */
#modal-recorrencia { align-items: center; }
.modal-box-center {
  border-radius: 16px;
  max-width: 420px;
  width: calc(100% - 32px);
  margin: auto;
}
.modal-recorrencia-btns {
  display: flex; flex-direction: column; gap: 10px;
}

/* ── Category grid ───────────────────────────────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 500px) {
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
}
.cat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
}
.cat-nome { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Cartões de crédito */
.cartao-row {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.cartao-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.cartao-nome { font-size: 15px; font-weight: 600; }
.cartao-meta { font-size: 12px; color: var(--text-muted); }
.cat-del {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  opacity: .4;
  transition: opacity .15s;
  padding: 2px;
  margin-left: 6px;
}
.cat-del:hover { opacity: 1; }

/* ── Agenda list ─────────────────────────────────────────────────────────── */
#ag-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ag-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.ag-icon { font-size: 22px; flex-shrink: 0; }
.ag-info { flex: 1; }
.ag-data { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ag-msg { font-size: 14px; font-weight: 500; }
.ag-badge-rec {
  font-size: 10px; font-weight: 600;
  background: #0d1f2d; color: #7eb8e8;
  padding: 1px 6px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: .3px;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Loading ─────────────────────────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: white;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  z-index: 999;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ── Admin ───────────────────────────────────────────────────────────────── */
.admin-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 16px;
  box-shadow: var(--shadow);
}
.admin-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}
.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.admin-card-header h3 { margin-bottom: 0; }
.admin-form { display: flex; flex-direction: column; gap: 10px; }
.admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.admin-row .input-group { flex: 1; min-width: 120px; margin-bottom: 0; }
.admin-row .input-group input,
.admin-row .input-group select {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: var(--bg);
  color: var(--text);
}
.admin-row .input-group input:focus,
.admin-row .input-group select:focus { border-color: var(--blue); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-green { background: var(--green); color: white; }
.btn-blue { background: var(--blue); color: white; }

/* ── Campaign progress ───────────────────────────────────────────────────── */
.camp-barra-bg {
  background: var(--bg);
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
}
.camp-barra-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 8px;
  transition: width .4s ease;
  width: 0%;
}
.camp-log {
  max-height: 160px;
  overflow-y: auto;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.camp-log-item {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
}
.camp-log-ok { background: var(--green-light); color: var(--green); }
.camp-log-erro { background: var(--red-light); color: var(--red); }

/* ── Individual send list ────────────────────────────────────────────────── */
.adm-ind-item {
  border-bottom: 1px solid var(--border);
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.adm-ind-item:last-child { border-bottom: none; }
.adm-ind-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}
.adm-ind-nome { font-weight: 600; font-size: 13px; }
.adm-ind-num  { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.adm-ind-status { font-size: 11px; }
.adm-ind-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.adm-ind-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
  outline: none;
  background: var(--bg);
  color: var(--text);
}
.adm-ind-textarea:focus { border-color: var(--blue); }

/* ── Accordion ───────────────────────────────────────────────────────────── */
.accordion { display: flex; flex-direction: column; gap: 8px; }
.accordion-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
}
.accordion-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.accordion-header:hover { background: rgba(255,255,255,.04); }
.accordion-header-active { background: rgba(255,255,255,.06); }
.accordion-icon {
  font-size: 18px;
  transition: transform .2s;
  color: var(--text-muted);
}
.accordion-body { padding: 0 18px 18px; }
.accordion-desc { color: var(--text-muted); font-size: 13px; margin-bottom: 12px; line-height: 1.4; }

/* ── Orçamento Mensal ────────────────────────────────────────────────────── */
.orcamento-salario-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 16px;
  font-size: 15px;
  color: var(--text);
}
.orcamento-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.orcamento-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.orcamento-cat-nome { font-weight: 700; font-size: 15px; color: var(--text); }
.orcamento-cat-valor { font-size: 14px; color: var(--green); font-weight: 600; }
.orcamento-slider, .orcamento-slider-sub {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.orcamento-slider::-webkit-slider-thumb, .orcamento-slider-sub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--blue);
  cursor: grab;
  border: 2px solid var(--card);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.orcamento-subs {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.orcamento-sub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.orcamento-sub-nome { min-width: 110px; font-size: 13px; color: var(--text-muted); }
.orcamento-sub-valor { min-width: 130px; text-align: right; font-size: 13px; color: var(--text-muted); }
.orcamento-sub-livre { font-size: 13px; color: var(--green); margin-top: 6px; }
.orcamento-sub-excedido { color: var(--red) !important; }
.orcamento-saldo {
  padding: 12px 18px;
  border-radius: 10px;
  margin: 12px 0;
  font-size: 14px;
  text-align: center;
}
.orcamento-saldo-ok { background: rgba(39,174,96,.12); color: var(--green); }
.orcamento-saldo-sobra { background: rgba(52,152,219,.12); color: var(--blue); }
.orcamento-saldo-falta { background: rgba(231,76,60,.12); color: var(--red); }
#orcamento-salvar { margin-top: 8px; width: 100%; }
#orcamento-salvar:disabled { opacity: .5; cursor: not-allowed; }

/* ── Toggle bar (tipo receita/despesa) ──────────────────────────────────── */
.toggle-bar {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.toggle-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.toggle-btn.active {
  background: var(--blue);
  color: white;
}
.toggle-btn:not(.active):hover {
  background: var(--card-bg);
}

/* ── Modals center alignment ────────────────────────────────────────────── */
#modal-nova-tx,
#modal-novo-cartao,
#modal-nova-caixinha,
#modal-deposito-caixinha,
#modal-novo-lembrete,
#modal-nova-recorrencia { align-items: center; }

/* ── Input style for modals ─────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}
.input:focus { border-color: var(--blue); }
select.input { cursor: pointer; }

/* ── Caixinha progress bar ──────────────────────────────────────────────── */
.caixinha-progress {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.caixinha-progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width .3s;
}

/* ── Recorrencia row ────────────────────────────────────────────────────── */
.rec-row {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.rec-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.rec-nome { font-size: 15px; font-weight: 600; }
.rec-meta { font-size: 12px; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════════════════ */
/* ── Desktop: top nav ─────────────────────────────────────────────────── */
/* ══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  /* Nav → topo */
  .bottom-nav {
    top: 0; bottom: auto;
    border-top: none;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    padding: 0 24px;
    gap: 0;
  }

  /* Brand à esquerda */
  .nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 24px;
    flex-shrink: 0;
  }
  .nav-brand-logo {
    height: 32px;
    max-width: 140px;
    object-fit: contain;
  }
  .nav-brand-icon { font-size: 24px; }
  .nav-brand-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.3px;
  }

  /* Links horizontais — distribuídos */
  .nav-links {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
  }
  .nav-btn {
    flex: unset;
    flex-direction: row;
    gap: 6px;
    padding: 10px 24px;
    border-radius: 8px;
    transition: color .15s, background .15s;
  }
  .nav-btn:hover { background: rgba(255,255,255,.06); }
  .nav-btn.active {
    color: var(--blue);
    background: rgba(74,158,221,.1);
  }
  .nav-icon { font-size: 16px; }
  .nav-label { font-size: 13px; }

  /* Avatar à direita */
  .nav-user {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
  }
  .nav-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    border: 2px solid rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
    color: var(--text);
    cursor: pointer;
    transition: opacity .15s;
    text-transform: uppercase;
    user-select: none;
    overflow: hidden;
  }
  .nav-avatar:hover { opacity: .8; }

  /* Modals: border-radius no desktop */
  .modal-box { border-radius: 16px; }

  /* Main content: padding-top para compensar top nav, full width */
  .main-content {
    padding: calc(var(--nav-h) + 16px) 24px 32px;
    max-width: 1400px;
  }

  /* Hero: compensar o padding-top */
  .dash-hero {
    margin: calc(-1 * (var(--nav-h) + 16px)) -24px 16px;
    padding: calc(var(--nav-h) + 20px) 24px 22px;
    border-radius: 0 0 24px 24px;
  }

  /* Avatar do hero: esconder no desktop (já aparece na top nav) */
  .dash-hero .dash-avatar-wrap { display: none; }

  /* Toast: sem compensar bottom nav */
  .toast { bottom: 24px; }
}
