/* ════════════════════════════════════════════════════════════
   FINANCE CONTROL  —  Main Stylesheet
   ════════════════════════════════════════════════════════════ */

/* ── TEMA ESCURO (padrão) ──────────────────────────────────── */
:root {
  --sidebar-w: 260px;
  --topbar-h: 64px;

  --bg:             #f1f5f9;
  --sidebar-bg:     #0f172a;
  --sidebar-text:   #94a3b8;
  --sidebar-active: #22c55e;
  --card-bg:        #ffffff;
  --topbar-bg:      #ffffff;
  --topbar-border:  #e2e8f0;
  --text-primary:   #1e293b;
  --text-muted:     #64748b;
  --text-heading:   #0f172a;
  --border:         #e2e8f0;
  --table-head-bg:  #f8fafc;
  --table-row-hover:#f8fafc;
  --table-border:   #f1f5f9;
  --input-border:   #e2e8f0;

  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-md: 0 4px 24px rgba(0,0,0,.10);
  --radius: 16px;
  --transition: all .25s cubic-bezier(.4,0,.2,1);
}

/* ── TEMA CLARO EXPLÍCITO (classe no <html>) ─────────────────
   Adicionar class="light" no <html> ativa modo claro.
   Quando não há classe, o app usa o padrão acima (também claro).
   O modo ESCURO é ativado pela classe "dark".
   ─────────────────────────────────────────────────────────── */
html.dark {
  --bg:             #0f172a;
  --sidebar-bg:     #020617;
  --sidebar-text:   #94a3b8;
  --card-bg:        #1e293b;
  --topbar-bg:      #1e293b;
  --topbar-border:  rgba(255,255,255,.08);
  --text-primary:   #e2e8f0;
  --text-muted:     #94a3b8;
  --text-heading:   #f8fafc;
  --border:         rgba(255,255,255,.08);
  --table-head-bg:  #0f172a;
  --table-row-hover:#0f172a;
  --table-border:   rgba(255,255,255,.06);
  --input-border:   rgba(255,255,255,.12);
  --shadow:    0 1px 3px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
  --shadow-md: 0 4px 24px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }

/* ══════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, #0d1f3c 0%, #0f172a 60%, #0a1628 100%);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .3s ease;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,.06);
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
}

/* ── Logo ─────────────────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  position: relative;
}
.sidebar-brand::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 50%;
  transform: translateX(-50%);
  width: 40px; height: 2px;
  background: linear-gradient(90deg, transparent, #22c55e, transparent);
  border-radius: 2px;
}
.sidebar-brand img {
  max-height: 64px;
  max-width: 190px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(34,197,94,.25));
}

.sidebar-divider {
  border-color: rgba(255,255,255,.07);
  margin: .5rem 1.25rem .75rem;
}

/* ── Nav ──────────────────────────────────────────────────── */
.sidebar-nav {
  list-style: none;
  padding: .5rem .75rem;
  margin: 0;
  flex: 1;
}

.sidebar-nav .nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(148,163,184,.45);
  padding: .75rem 1rem .35rem;
  display: block;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .8rem;
  color: #94a3b8;
  padding: .72rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: .15rem;
  position: relative;
  border: 1px solid transparent;
}
.sidebar-nav .nav-link i {
  width: 18px;
  text-align: center;
  font-size: .95rem;
  flex-shrink: 0;
  transition: var(--transition);
}
.sidebar-nav .nav-link:hover {
  background: rgba(255,255,255,.06);
  color: #e2e8f0;
  border-color: rgba(255,255,255,.06);
}
.sidebar-nav .nav-link:hover i { color: #22c55e; }

.sidebar-nav .nav-link.active {
  background: rgba(34,197,94,.12);
  color: #4ade80;
  border-color: rgba(34,197,94,.2);
}
.sidebar-nav .nav-link.active i { color: #22c55e; }
.sidebar-nav .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: #22c55e;
  border-radius: 0 3px 3px 0;
}

/* link Open Finance — azul */
.sidebar-nav .nav-link-bank { color: #38bdf8; }
.sidebar-nav .nav-link-bank i { color: #38bdf8; }
.sidebar-nav .nav-link-bank:hover { color: #7dd3fc; }
.sidebar-nav .nav-link-bank:hover i { color: #7dd3fc; }
.sidebar-nav .nav-link-bank.active {
  background: rgba(56,189,248,.12);
  color: #7dd3fc;
  border-color: rgba(56,189,248,.2);
}
.sidebar-nav .nav-link-bank.active::before { background: #38bdf8; }

/* link IA — roxo */
.sidebar-nav .nav-link-ai { color: #a78bfa; }
.sidebar-nav .nav-link-ai i { color: #a78bfa; }
.sidebar-nav .nav-link-ai:hover { color: #c4b5fd; }
.sidebar-nav .nav-link-ai:hover i { color: #c4b5fd; }
.sidebar-nav .nav-link-ai.active {
  background: rgba(167,139,250,.12);
  color: #c4b5fd;
  border-color: rgba(167,139,250,.2);
}
.sidebar-nav .nav-link-ai.active::before { background: #a78bfa; }

/* link Master — âmbar */
.sidebar-nav .nav-link-master { color: #fbbf24; }
.sidebar-nav .nav-link-master i { color: #fbbf24; }
.sidebar-nav .nav-link-master:hover { color: #fcd34d; }
.sidebar-nav .nav-link-master:hover i { color: #fcd34d; }
.sidebar-nav .nav-link-master.active {
  background: rgba(251,191,36,.12);
  color: #fcd34d;
  border-color: rgba(251,191,36,.2);
}
.sidebar-nav .nav-link-master.active::before { background: #fbbf24; }

/* ── Footer ───────────────────────────────────────────────── */
.sidebar-footer {
  padding: 1rem 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.07);
  margin-top: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .75rem;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  margin-bottom: .75rem;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(34,197,94,.3);
}

.user-details { overflow: hidden; }
.user-name {
  color: #f1f5f9;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-email {
  color: #64748b;
  font-size: .7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.2);
  color: #f87171;
  font-size: .82rem;
  font-weight: 500;
  padding: .5rem 1rem;
  border-radius: 10px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}
.btn-logout:hover {
  background: rgba(239,68,68,.2);
  border-color: rgba(239,68,68,.35);
  color: #fca5a5;
  transform: translateY(-1px);
}

/* ── SIDEBAR OVERLAY (mobile) ─────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
  backdrop-filter: blur(4px);
}

/* ══════════════════════════════════════════════════════════
   MAIN WRAPPER & TOPBAR
   ══════════════════════════════════════════════════════════ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .3s ease;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.topbar-toggle {
  background: none;
  border: none;
  padding: .4rem;
  font-size: 1.15rem;
  color: #64748b;
  cursor: pointer;
  display: none;   /* shown on mobile */
  border-radius: 8px;
  transition: var(--transition);
}
.topbar-toggle:hover { background: var(--bg); color: var(--text-heading); }

.topbar-title {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-heading);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.user-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
}

.topbar-logout {
  color: #ef4444;
  font-size: 1.1rem;
  text-decoration: none;
  padding: .4rem;
  border-radius: 8px;
  transition: var(--transition);
}
.topbar-logout:hover { background: #fee2e2; }

.page-content {
  flex: 1;
  padding-top: 1.5rem;
}

/* ══════════════════════════════════════════════════════════
   SUMMARY CARDS
   ══════════════════════════════════════════════════════════ */
.summary-card {
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.summary-icon {
  width: 54px; height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.summary-info { display: flex; flex-direction: column; min-width: 0; }
.summary-label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  opacity: .75;
  margin-bottom: .25rem;
}
.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: .25rem;
}
.summary-sub { font-size: .75rem; opacity: .7; }

/* card variants */
.card-receitas {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  color: #14532d;
}
.card-receitas .summary-icon { background: #22c55e; color: #fff; }

.card-despesas {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #7f1d1d;
}
.card-despesas .summary-icon { background: #ef4444; color: #fff; }

.card-saldo-pos {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #1e3a8a;
}
.card-saldo-pos .summary-icon { background: #3b82f6; color: #fff; }

.card-saldo-neg {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #78350f;
}
.card-saldo-neg .summary-icon { background: #f59e0b; color: #fff; }

/* ══════════════════════════════════════════════════════════
   CHART CARDS
   ══════════════════════════════════════════════════════════ */
.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  height: 100%;
}
.chart-header {
  padding: 1.1rem 1.5rem .75rem;
  border-bottom: 1px solid var(--border);
}
.chart-title {
  margin: 0;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
}
.chart-body {
  padding: 1rem 1.25rem 1.25rem;
}

/* ══════════════════════════════════════════════════════════
   TABLE CARDS
   ══════════════════════════════════════════════════════════ */
.table-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.table-card-title {
  margin: 0;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.table thead th {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: var(--table-head-bg);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1rem;
}
.table tbody td {
  padding: .75rem 1rem;
  font-size: .875rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--table-border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover td { background: var(--table-row-hover); }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: #94a3b8;
}
.empty-state i {
  font-size: 2.5rem;
  margin-bottom: .75rem;
  display: block;
}
.empty-state p { margin: 0; font-size: .9rem; }

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-header-title {
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0;
  color: var(--text-heading);
}
.page-header-sub { margin: .25rem 0 0; font-size: .875rem; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f2027 100%);
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,.97);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  box-shadow: 0 25px 60px rgba(0,0,0,.35);
  position: relative;
  z-index: 2;
}

.login-header { text-align: center; margin-bottom: 2rem; }
.login-logo {
  width: 90px; height: 90px;
  border-radius: 22px;
  background: #22c55e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(0,0,0,.25);
}
.login-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 .25rem;
  letter-spacing: -.5px;
}
.login-subtitle { color: #64748b; font-size: .9rem; margin: 0; }

.login-form .form-label {
  font-weight: 600;
  font-size: .85rem;
  color: #374151;
}
.login-form .form-control {
  border-radius: 10px;
  border: 1.5px solid var(--input-border);
  font-size: .95rem;
  transition: var(--transition);
}
.login-form .form-control:focus {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.18);
}

.btn-login {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: .3px;
  box-shadow: 0 4px 16px rgba(34,197,94,.35);
  transition: var(--transition);
}
.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(34,197,94,.45);
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.login-footer {
  text-align: center;
  margin-top: 1.75rem;
  color: #94a3b8;
}

/* ── BLOBS ───────────────────────────────────────────────── */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .35;
  pointer-events: none;
}
.blob-1 {
  width: 350px; height: 350px;
  background: #22c55e;
  top: -80px; left: -100px;
}
.blob-2 {
  width: 280px; height: 280px;
  background: #3b82f6;
  bottom: -60px; right: -80px;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
   ══════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤ 992px)
   ══════════════════════════════════════════════════════════ */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0 !important; }
  .topbar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .container-fluid {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  /* Modais em tela cheia abaixo de 992px */
  .modal-dialog { margin: .5rem; max-width: calc(100% - 1rem); }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 576px)
   ══════════════════════════════════════════════════════════ */
@media (max-width: 575.98px) {
  /* Tipografia e espaçamento geral */
  .summary-value { font-size: 1.2rem; }
  .summary-card { padding: 1rem 1.1rem; gap: .85rem; }
  .summary-icon { width: 44px; height: 44px; font-size: 1.2rem; }

  /* Container */
  .container-fluid {
    padding-left: .75rem !important;
    padding-right: .75rem !important;
  }

  /* Topbar */
  .topbar { padding: 0 .75rem; gap: .5rem; }
  .topbar-title { font-size: .9rem; }

  /* Page header */
  .page-header { gap: .75rem; }
  .page-header-title { font-size: 1rem; }
  .page-header .btn { font-size: .82rem; padding: .45rem .9rem; }

  /* Cards de gráfico */
  .chart-body { padding: .75rem .5rem; }
  .chart-card { border-radius: 12px; }

  /* Tabelas — padding menor para caber na tela */
  .table thead th { padding: .6rem .75rem; font-size: .7rem; }
  .table tbody td { padding: .65rem .75rem; font-size: .82rem; }
  .table-card-header { flex-direction: column; align-items: flex-start; gap: .5rem; }

  /* Modais — ocupa toda a tela no celular */
  .modal-dialog {
    margin: 0;
    max-width: 100%;
    min-height: 100%;
    align-items: flex-end;
  }
  .modal.show .modal-dialog { transform: none; }
  .modal-content {
    border-radius: 20px 20px 0 0;
    max-height: 92dvh;
    overflow-y: auto;
  }
  .modal-sm .modal-content { border-radius: 20px 20px 0 0; }
  .modal-header { padding: 1rem 1.25rem .75rem; }
  .modal-body { padding: 1rem 1.25rem; }
  .modal-footer { padding: .75rem 1.25rem 1.25rem; }

  /* Botões — área de toque mínima de 44px */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; font-size: .8rem; }

  /* Login */
  .login-card { padding: 1.75rem 1.25rem; border-radius: 20px; }
  .login-title { font-size: 1.3rem; }
  .login-logo { width: 72px; height: 72px; }

  /* Filtros de data — empilha os campos */
  .filter-row .col-md-4 { margin-bottom: .5rem; }
  .filter-row .d-flex { flex-wrap: wrap; gap: .5rem; }
  .filter-row .btn { flex: 1; justify-content: center; }
}

/* ══════════════════════════════════════════════════════════
   OPEN FINANCE — BANK CARDS
   ══════════════════════════════════════════════════════════ */
.bank-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.bank-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.bank-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.25rem .75rem;
}
.bank-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56,189,248,.15), rgba(14,165,233,.1));
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.bank-name {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-heading);
  margin-bottom: .25rem;
}
.bank-status {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .3px;
  padding: .2rem .6rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
}
.status-ok { background: rgba(34,197,94,.12); color: #22c55e; }
.status-connected { background: rgba(56,189,248,.12); color: #38bdf8; }

.bank-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.25rem 1.1rem;
  border-top: 1px solid var(--border);
  gap: .5rem;
  flex-wrap: wrap;
}
.bank-sync-date { font-size: .75rem; color: var(--text-muted); }
.bank-actions { display: flex; gap: .4rem; }

.info-box {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  background: rgba(34,197,94,.06);
  border: 1px solid rgba(34,197,94,.15);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

html.dark .bank-card { background: var(--card-bg); border-color: var(--border); }
html.dark .info-box { background: rgba(34,197,94,.05); border-color: rgba(34,197,94,.12); }

/* ── BADGE / ALERT tweaks ────────────────────────────────── */
.alert {
  font-size: .875rem;
  border-radius: 12px;
}

/* ── MODAL tweaks ────────────────────────────────────────── */
.modal-content { border-radius: 18px; }
.modal-header { border-radius: 18px 18px 0 0; padding: 1.25rem 1.5rem; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem 1.5rem; }
.form-control, .form-select {
  border-radius: 10px;
  font-size: .9rem;
}
.form-control:focus, .form-select:focus {
  box-shadow: 0 0 0 3px rgba(34,197,94,.18);
  border-color: #22c55e;
}


/* ══════════════════════════════════════════════════════════
   PWA — BANNER DE INSTALAÇÃO iOS
   ══════════════════════════════════════════════════════════ */
.ios-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: 0 1rem 1.5rem;
  animation: slideUp .35s cubic-bezier(.4,0,.2,1);
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.ios-install-content {
  background: #1e293b;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  padding: 1rem 1rem 1rem 1rem;
  display: flex;
  align-items: center;
  gap: .85rem;
  box-shadow: 0 -4px 32px rgba(0,0,0,.45);
  color: #f1f5f9;
  position: relative;
}

.ios-install-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  flex-shrink: 0;
  object-fit: cover;
}

.ios-install-text {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  font-size: .875rem;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.ios-install-text strong {
  font-size: .95rem;
  font-weight: 600;
  color: #f8fafc;
}

.ios-install-text span {
  color: #94a3b8;
  font-size: .82rem;
}

.ios-install-text .fa-arrow-up-from-bracket {
  color: #22c55e;
}

.ios-install-close {
  background: rgba(255,255,255,.08);
  border: none;
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .2s;
}

.ios-install-close:hover {
  background: rgba(255,255,255,.15);
  color: #f1f5f9;
}

/* Setinha apontando para o botão de compartilhamento do Safari */
.ios-install-arrow {
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #1e293b;
  margin: 0 auto;
}

/* ══════════════════════════════════════════════════════════
   BOTÃO TOGGLE DE TEMA (dark/light)
   ══════════════════════════════════════════════════════════ */
.theme-toggle {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--bg);
  color: var(--sidebar-active);
}

/* Transição suave ao trocar tema (não afeta transforms de sidebar) */
body, .topbar, .chart-card, .table-card, .summary-card,
.form-control, .form-select, .modal-content, .table thead th,
.table tbody td {
  transition: background-color .3s ease, border-color .3s ease, color .2s ease;
}

/* ══════════════════════════════════════════════════════════
   TEMA ESCURO — overrides Bootstrap e componentes
   ══════════════════════════════════════════════════════════ */
html.dark .chart-card,
html.dark .table-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
}

html.dark .table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: var(--table-row-hover);
  color: var(--text-primary);
}

html.dark .form-control,
html.dark .form-select {
  background: #0f172a;
  border-color: var(--input-border);
  color: var(--text-primary);
}
html.dark .form-control:focus,
html.dark .form-select:focus {
  background: #0f172a;
  color: var(--text-primary);
}
html.dark .form-control::placeholder { color: #475569; }

html.dark .modal-content {
  background: var(--card-bg);
  border-color: var(--border);
  color: var(--text-primary);
}
html.dark .modal-header,
html.dark .modal-footer { border-color: var(--border); }

html.dark .btn-close { filter: invert(1); }

html.dark .input-group-text {
  background: #0f172a;
  border-color: var(--input-border);
  color: var(--text-muted);
}
html.dark .btn-outline-secondary {
  border-color: var(--input-border);
  color: var(--text-muted);
}
html.dark .btn-outline-secondary:hover {
  background: rgba(255,255,255,.06);
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════
   TEMA ESCURO — Summary Cards (variantes coloridas)
   ══════════════════════════════════════════════════════════ */
html.dark .card-receitas {
  background: linear-gradient(135deg, rgba(34,197,94,.2), rgba(22,163,74,.10));
  color: #86efac;
}
html.dark .card-receitas .summary-icon {
  background: rgba(34,197,94,.22);
  color: #4ade80;
}

html.dark .card-despesas {
  background: linear-gradient(135deg, rgba(239,68,68,.2), rgba(220,38,38,.10));
  color: #fca5a5;
}
html.dark .card-despesas .summary-icon {
  background: rgba(239,68,68,.22);
  color: #f87171;
}

html.dark .card-saldo-pos {
  background: linear-gradient(135deg, rgba(59,130,246,.2), rgba(37,99,235,.10));
  color: #93c5fd;
}
html.dark .card-saldo-pos .summary-icon {
  background: rgba(59,130,246,.22);
  color: #60a5fa;
}

html.dark .card-saldo-neg {
  background: linear-gradient(135deg, rgba(245,158,11,.2), rgba(217,119,6,.10));
  color: #fcd34d;
}
html.dark .card-saldo-neg .summary-icon {
  background: rgba(245,158,11,.22);
  color: #fbbf24;
}

/* ── Dark mode — alertas ─────────────────────────────────── */
html.dark .alert-danger {
  background: rgba(239,68,68,.15);
  color: #fca5a5;
  border-color: rgba(239,68,68,.3);
}
html.dark .alert-warning {
  background: rgba(245,158,11,.15);
  color: #fcd34d;
  border-color: rgba(245,158,11,.3);
}
html.dark .alert-success {
  background: rgba(34,197,94,.15);
  color: #86efac;
  border-color: rgba(34,197,94,.3);
}
html.dark .alert-info {
  background: rgba(59,130,246,.15);
  color: #93c5fd;
  border-color: rgba(59,130,246,.3);
}

/* ── Dark mode — botão secundário (modal Cancelar etc.) ───── */
html.dark .btn-secondary {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}
html.dark .btn-secondary:hover {
  background: #475569;
  border-color: #64748b;
  color: #f1f5f9;
}

/* ── Dark mode — topbar logout hover ─────────────────────── */
html.dark .topbar-logout:hover { background: rgba(239,68,68,.15); }

/* ── Dark mode — scrollbar ───────────────────────────────── */
html.dark ::-webkit-scrollbar-thumb { background: #334155; }

/* ── Dark mode — links de rodapé / footer ────────────────── */
html.dark .login-footer a { color: #86efac; }
html.dark .login-footer { color: #64748b; }

/* ── Dark mode — label nos forms ─────────────────────────── */
html.dark .form-label { color: var(--text-primary); }

/* ══════════════════════════════════════════════════════════
   DARK MODE — LOGIN / REGISTER CARD
   ══════════════════════════════════════════════════════════ */
html.dark .login-card {
  background: #1e293b;
  box-shadow: 0 25px 60px rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.06);
}
html.dark .login-title  { color: #f8fafc; }
html.dark .login-subtitle { color: #94a3b8; }
html.dark .login-form .form-label { color: #cbd5e1; }
html.dark .login-form .form-control {
  background: #0f172a;
  border-color: rgba(255,255,255,.12);
  color: #e2e8f0;
}
html.dark .login-form .form-control:focus {
  background: #0f172a;
  border-color: #22c55e;
  color: #e2e8f0;
}
html.dark .login-form .form-control::placeholder { color: #475569; }
html.dark .login-form .btn-outline-secondary {
  border-color: rgba(255,255,255,.12);
  color: #94a3b8;
  background: #0f172a;
}
html.dark .login-form .btn-outline-secondary:hover {
  background: rgba(255,255,255,.06);
  color: #e2e8f0;
}

/* ── Botão tema na página de login ───────────────────────── */
.login-theme-btn {
  position: absolute;
  top: 1rem; right: 1rem;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #e2e8f0;
  font-size: .95rem;
  transition: var(--transition);
  z-index: 10;
}
.login-theme-btn:hover {
  background: rgba(255,255,255,.22);
  color: #fff;
}
html.dark .login-theme-btn {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.12);
  color: #94a3b8;
}
html.dark .login-theme-btn:hover {
  background: rgba(255,255,255,.15);
  color: #f8fafc;
}

/* ── date input no tema escuro ───────────────────────────── */
html.dark input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(.6);
}
html.dark input[type="date"] { color-scheme: dark; }

