@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500&display=swap');

/* ══════════════════════════════════════════════════════
   ROOT / TOKENS
══════════════════════════════════════════════════════ */
:root {
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Outfit', sans-serif;
  --radius:        10px;
  --radius-lg:     16px;
  --radius-xl:     22px;
  --sidebar-w:     248px;
  --sidebar-icon:  64px;
  --topbar-h:      60px;
  --bottom-nav-h:  68px;
  --ease:          cubic-bezier(.4, 0, .2, 1);
  --dur:           .18s;
}

/* ══════════════════════════════════════════════════════
   DARK THEME
══════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg:           #080c14;
  --bg2:          #0e1220;
  --bg3:          #141a2c;
  --bg4:          #1c2338;
  --border:       #1d2640;
  --border-hi:    #2b3656;
  --accent:       #00e5a0;
  --accent-dim:   rgba(0, 229, 160, .10);
  --accent-glow:  rgba(0, 229, 160, .20);
  --accent2:      #00c48a;
  --accent-chart: rgba(0, 229, 160, .22);
  --purple:       #7c6fff;
  --purple-dim:   rgba(124, 111, 255, .12);
  --text:         #e2e8f8;
  --text-muted:   #4f5d7e;
  --text-dim:     #8592b4;
  --red:          #f05252;
  --red-dim:      rgba(240, 82, 82, .12);
  --warn-chart:   rgba(240, 82, 82, .20);
  --green:        #22d572;
  --green-dim:    rgba(34, 213, 114, .12);
  --yellow:       #f5a623;
  --blue:         #4da8ff;
  --shadow:       0 8px 40px rgba(0, 0, 0, .6);
  --shadow-sm:    0 2px 16px rgba(0, 0, 0, .4);
  --shadow-xs:    0 1px 6px  rgba(0, 0, 0, .3);
}

/* ══════════════════════════════════════════════════════
   LIGHT THEME
══════════════════════════════════════════════════════ */
[data-theme="light"] {
  --bg:           #f1f4fa;
  --bg2:          #ffffff;
  --bg3:          #e8ecf5;
  --bg4:          #dde3ef;
  --border:       #d0d9ec;
  --border-hi:    #b4c0d6;
  --accent:       #00956a;
  --accent-dim:   rgba(0, 149, 106, .10);
  --accent-glow:  rgba(0, 149, 106, .16);
  --accent2:      #007051;
  --accent-chart: rgba(0, 149, 106, .20);
  --purple:       #5b4fd4;
  --purple-dim:   rgba(91, 79, 212, .10);
  --text:         #131926;
  --text-muted:   #6a7590;
  --text-dim:     #46526a;
  --red:          #e03232;
  --red-dim:      rgba(224, 50, 50, .10);
  --warn-chart:   rgba(224, 50, 50, .18);
  --green:        #1da85c;
  --green-dim:    rgba(29, 168, 92, .10);
  --yellow:       #c97800;
  --blue:         #2460d4;
  --shadow:       0 8px 40px rgba(0, 0, 0, .10);
  --shadow-sm:    0 2px 16px rgba(0, 0, 0, .07);
  --shadow-xs:    0 1px 6px  rgba(0, 0, 0, .05);
}

/* ══════════════════════════════════════════════════════
   SYSTEM THEME
══════════════════════════════════════════════════════ */
[data-theme="system"] {
  --bg: #f1f4fa; --bg2: #ffffff; --bg3: #e8ecf5; --bg4: #dde3ef;
  --border: #d0d9ec; --border-hi: #b4c0d6;
  --accent: #00956a; --accent-dim: rgba(0,149,106,.10); --accent-glow: rgba(0,149,106,.16);
  --accent2: #007051; --accent-chart: rgba(0,149,106,.20);
  --purple: #5b4fd4; --purple-dim: rgba(91,79,212,.10);
  --text: #131926; --text-muted: #6a7590; --text-dim: #46526a;
  --red: #e03232; --red-dim: rgba(224,50,50,.10); --warn-chart: rgba(224,50,50,.18);
  --green: #1da85c; --green-dim: rgba(29,168,92,.10); --yellow: #c97800; --blue: #2460d4;
  --shadow: 0 8px 40px rgba(0,0,0,.10); --shadow-sm: 0 2px 16px rgba(0,0,0,.07); --shadow-xs: 0 1px 6px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --bg: #080c14; --bg2: #0e1220; --bg3: #141a2c; --bg4: #1c2338;
    --border: #1d2640; --border-hi: #2b3656;
    --accent: #00e5a0; --accent-dim: rgba(0,229,160,.10); --accent-glow: rgba(0,229,160,.20);
    --accent2: #00c48a; --accent-chart: rgba(0,229,160,.22);
    --purple: #7c6fff; --purple-dim: rgba(124,111,255,.12);
    --text: #e2e8f8; --text-muted: #4f5d7e; --text-dim: #8592b4;
    --red: #f05252; --red-dim: rgba(240,82,82,.12); --warn-chart: rgba(240,82,82,.20);
    --green: #22d572; --green-dim: rgba(34,213,114,.12); --yellow: #f5a623; --blue: #4da8ff;
    --shadow: 0 8px 40px rgba(0,0,0,.6); --shadow-sm: 0 2px 16px rgba(0,0,0,.4); --shadow-xs: 0 1px 6px rgba(0,0,0,.3);
  }
}

/* ══════════════════════════════════════════════════════
   RESET + BASE
══════════════════════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ══════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width var(--dur) var(--ease);
}

.sidebar-logo {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  height: var(--topbar-h);
}

.sidebar-logo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 10px var(--accent-glow);
  animation: pulseDot 3s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; box-shadow: 0 0 10px var(--accent-glow); }
  50%       { opacity: .5; box-shadow: none; }
}

.sidebar-logo-text { color: var(--text); }
.sidebar-logo-sep  { color: var(--text-muted); }

.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 400;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
  border-radius: 10px;
  white-space: nowrap;
  user-select: none;
}

.nav-item:hover  { color: var(--text-dim); background: var(--bg3); }
.nav-item.active { color: var(--accent); background: var(--accent-dim); font-weight: 500; }

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ──── Sidebar bottom (theme) ──── */
.sidebar-bottom {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   THEME SWITCHER
══════════════════════════════════════════════════════ */
.tema-switcher {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  display: flex;
  gap: 2px;
}

.tema-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  padding: 5px 0;
  border-radius: 7px;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  line-height: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tema-btn:hover  { color: var(--text); background: var(--bg2); }
.tema-btn.active { background: var(--accent-dim); color: var(--accent); }

/* topbar tema-switcher: mobile only */
.topbar .tema-switcher { display: none; }

/* ══════════════════════════════════════════════════════
   MAIN + TOPBAR
══════════════════════════════════════════════════════ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar-h);
  flex-shrink: 0;
}

.month-nav { display: flex; align-items: center; gap: 8px; }

.month-nav button {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur) var(--ease);
  flex-shrink: 0;
}
.month-nav button:hover { border-color: var(--accent); color: var(--accent); }

.month-label {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  min-width: 136px;
  text-align: center;
  letter-spacing: .02em;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ══════════════════════════════════════════════════════
   CONTENT + PAGE
══════════════════════════════════════════════════════ */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.content::-webkit-scrollbar { width: 5px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.page { display: none; }
.page.active {
  display: block;
  animation: fadeUp .22s var(--ease) both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}

/* ══════════════════════════════════════════════════════
   DASHBOARD CARDS GRID
══════════════════════════════════════════════════════ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

/* ══════════════════════════════════════════════════════
   CARD
══════════════════════════════════════════════════════ */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

/* Signature gradient top-line */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .35;
  pointer-events: none;
}

.card:hover {
  border-color: var(--border-hi);
  box-shadow: var(--shadow-xs);
}

.card-label {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .09em;
  margin-bottom: 10px;
}

.card-value {
  font-size: 26px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -.01em;
  line-height: 1.1;
}

.card-value.green  { color: var(--accent); }
.card-value.red    { color: var(--red); }
.card-value.blue   { color: var(--blue); }
.card-value.yellow { color: var(--yellow); }

.card-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 7px;
  font-family: var(--font-mono);
}

/* ══════════════════════════════════════════════════════
   SECTION HEADER
══════════════════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .09em;
}

/* ══════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════ */
.btn {
  padding: 8px 16px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--dur) var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #07080f;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent2);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-primary:active { transform: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-ghost:hover { border-color: var(--border-hi); color: var(--text); background: var(--bg3); }

.btn-danger {
  background: var(--red-dim);
  border: 1px solid var(--red);
  color: var(--red);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.btn-xs { padding: 3px 8px;  font-size: 11px; border-radius: 5px; }

/* ══════════════════════════════════════════════════════
   TABLE
══════════════════════════════════════════════════════ */
.table-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  padding: 10px 16px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  font-weight: 400;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); transition: background .1s; }

.td-mono  { font-family: var(--font-mono); }
.td-green { color: var(--accent); font-family: var(--font-mono); }
.td-red   { color: var(--red);    font-family: var(--font-mono); }

/* ══════════════════════════════════════════════════════
   BADGE
══════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: .02em;
}

.badge-pago     { background: var(--green-dim);           color: var(--green); }
.badge-pendente { background: rgba(245, 166, 35, .14);    color: var(--yellow); }
.badge-agendado { background: rgba(77, 168, 255, .14);    color: var(--blue); }
.badge-fixa     { background: var(--purple-dim);           color: var(--purple); }

/* ══════════════════════════════════════════════════════
   PROGRESS BAR
══════════════════════════════════════════════════════ */
.progress-bar {
  width: 100%;
  height: 5px;
  background: var(--bg4);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .5s var(--ease);
}

/* ══════════════════════════════════════════════════════
   CATEGORY ROWS (dashboard)
══════════════════════════════════════════════════════ */
.cat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.cat-row:last-child { border-bottom: none; }
.cat-row:hover { background: var(--bg3); }

.cat-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.cat-info     { flex: 1; min-width: 0; }
.cat-name     { font-size: 13px; margin-bottom: 3px; }
.cat-prog     { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

.cat-amounts  { text-align: right; flex-shrink: 0; }
.cat-gasto    { font-family: var(--font-mono); font-size: 13px; }
.cat-orcamento { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

.warn-80 .cat-gasto  { color: var(--yellow) !important; }
.warn-100 .cat-gasto { color: var(--red) !important; }

/* ══════════════════════════════════════════════════════
   CHART
══════════════════════════════════════════════════════ */
.chart-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 22px;
}

/* ══════════════════════════════════════════════════════
   CAIXINHAS
══════════════════════════════════════════════════════ */
.caixinhas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.caixinha-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.caixinha-card:hover { border-color: var(--border-hi); box-shadow: var(--shadow-xs); }

.caixinha-header { display: flex; align-items: center; gap: 12px; }
.caixinha-icone  { font-size: 22px; flex-shrink: 0; }
.caixinha-info   { flex: 1; min-width: 0; }
.caixinha-nome   {
  font-weight: 600; font-size: 14.5px; margin-bottom: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.cx-menu-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  width: 28px; height: 28px; border-radius: 7px; cursor: pointer;
  font-size: 14px; flex-shrink: 0;
  transition: all var(--dur) var(--ease);
  display: flex; align-items: center; justify-content: center;
}
.cx-menu-btn:hover { border-color: var(--accent); color: var(--accent); }

.caixinha-saldo      { font-family: var(--font-mono); font-size: 26px; font-weight: 700; }
.caixinha-meta-label { font-size: 12px; color: var(--text-muted); }
.caixinha-pct        { font-size: 11px; color: var(--text-muted); text-align: right; margin-top: -8px; }

.prog-wrap { height: 5px; background: var(--bg4); border-radius: 3px; overflow: hidden; }
.prog-bar  { height: 100%; border-radius: 3px; transition: width .5s var(--ease); }

.sugestao {
  background: var(--accent-dim);
  border: 1px solid rgba(0, 229, 160, .15);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.caixinha-acoes { display: flex; gap: 8px; }

.btn-depositar {
  flex: 1; padding: 8px; border-radius: 8px; border: none; cursor: pointer;
  background: var(--accent-dim); color: var(--accent);
  font-size: 12px; font-weight: 600; font-family: var(--font-sans);
  transition: background var(--dur) var(--ease);
}
.btn-depositar:hover { background: var(--accent-glow); }

.btn-resgatar {
  flex: 1; padding: 8px; border-radius: 8px; border: none; cursor: pointer;
  background: var(--red-dim); color: var(--red);
  font-size: 12px; font-weight: 600; font-family: var(--font-sans);
  transition: background var(--dur) var(--ease);
}
.btn-resgatar:hover:not(:disabled) { background: rgba(240, 82, 82, .22); }
.btn-resgatar:disabled { opacity: .4; cursor: not-allowed; }

.btn-historico {
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  font-size: 12px; font-family: var(--font-sans); cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.btn-historico:hover { border-color: var(--border-hi); color: var(--text-dim); }

/* ══════════════════════════════════════════════════════
   CATEGORIES PAGE
══════════════════════════════════════════════════════ */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.cat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color var(--dur) var(--ease);
}
.cat-card:hover { border-color: var(--border-hi); }

.cat-card-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.cat-card-info    { flex: 1; min-width: 0; }
.cat-card-name    { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.cat-card-tipo    { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.cat-card-actions { display: flex; gap: 6px; }

/* ══════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .70);
  display: none; align-items: center; justify-content: center;
  z-index: 100;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 520px;
  max-width: 95vw;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modalIn .22s var(--ease) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 22px;
  letter-spacing: -.01em;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.modal::-webkit-scrollbar { width: 4px; }
.modal::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ══════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════ */
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  appearance: none; -webkit-appearance: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-control option { background: var(--bg3); color: var(--text); }
textarea.form-control { resize: vertical; min-height: 70px; line-height: 1.5; }

.form-check {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 13px;
}
.form-check input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* ══════════════════════════════════════════════════════
   FILTERS
══════════════════════════════════════════════════════ */
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

.filter-select {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer; outline: none;
  transition: border-color var(--dur) var(--ease);
  appearance: none; -webkit-appearance: none;
}
.filter-select:focus { border-color: var(--accent); }

/* ══════════════════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════════════════ */
.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ══════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 18px;
  font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .2s var(--ease) both;
  min-width: 220px; max-width: 340px;
  box-shadow: var(--shadow-sm);
}
.toast.success { border-left: 3px solid var(--accent); }
.toast.error   { border-left: 3px solid var(--red); }

@keyframes slideIn {
  from { transform: translateX(16px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ══════════════════════════════════════════════════════
   HISTORICO (modal)
══════════════════════════════════════════════════════ */
.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg3);
  border-radius: 9px;
}
.hist-tipo     { font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; border-radius: 99px; }
.hist-deposito { background: var(--green-dim); color: var(--green); }
.hist-resgate  { background: var(--red-dim);   color: var(--red); }
.hist-desc     { flex: 1; font-size: 13px; }
.hist-data     { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.hist-valor    { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }

/* ══════════════════════════════════════════════════════
   CARTÕES DE CRÉDITO
══════════════════════════════════════════════════════ */
.cartoes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.cartao-card {
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg2);
}

/* Color tint overlay */
.cartao-card::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--card-cor, #7c6aff);
  opacity: .08; z-index: 0;
  transition: opacity var(--dur) var(--ease);
}
/* Top accent stripe */
.cartao-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--card-cor, #7c6aff);
  opacity: .65; z-index: 1;
}
.cartao-card > * { position: relative; z-index: 2; }

.cartao-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 36px rgba(0, 0, 0, .35);
  border-color: var(--card-cor, #7c6aff);
}
.cartao-card:hover::before { opacity: .14; }

.cartao-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 10px;
}
.cartao-nome { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }

.cartao-bandeira {
  font-size: 10px; font-family: var(--font-mono); font-weight: 600;
  padding: 3px 9px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: .06em;
  border: 1px solid; flex-shrink: 0;
}
.bandeira-visa       { color: #60a5fa; border-color: #60a5fa; background: rgba(96,165,250,.10); }
.bandeira-mastercard { color: #fb923c; border-color: #fb923c; background: rgba(251,146,60,.10); }
.bandeira-elo        { color: #facc15; border-color: #facc15; background: rgba(250,204,21,.10); }
.bandeira-amex       { color: #34d399; border-color: #34d399; background: rgba(52,211,153,.10); }
.bandeira-default    { color: var(--text-muted); border-color: var(--border); background: transparent; }

.cartao-fatura-row {
  display: flex; align-items: center; justify-content: space-between;
}
.cartao-fatura-label {
  font-size: 10.5px; font-family: var(--font-mono);
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em;
}
.cartao-fatura-valor { font-family: var(--font-mono); font-size: 20px; font-weight: 700; }

.limite-wrap  { display: flex; flex-direction: column; gap: 5px; }
.limite-labels {
  display: flex; justify-content: space-between;
  font-size: 10px; font-family: var(--font-mono); color: var(--text-muted);
}
.limite-bar {
  width: 100%; height: 4px;
  background: var(--bg4); border-radius: 99px; overflow: hidden;
}
.limite-bar-fill { height: 100%; border-radius: 99px; transition: width .5s var(--ease); }

.badge-fatura-aberta  { background: rgba(77,168,255,.14);  color: var(--blue); }
.badge-fatura-fechada { background: rgba(245,166,35,.14);  color: var(--yellow); }
.badge-fatura-paga    { background: var(--green-dim);       color: var(--green); }

/* ─── Cartão detalhe ─── */
.cartao-detalhe { display: none; }
.cartao-detalhe.active { display: block; }
.cartoes-lista.hidden  { display: none; }

.detalhe-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: 13px;
  cursor: pointer; margin-bottom: 18px;
  transition: color var(--dur) var(--ease);
  background: none; border: none; padding: 0; font-family: var(--font-sans);
}
.detalhe-back:hover { color: var(--accent); }

.detalhe-header { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.detalhe-cor-badge { width: 14px; height: 40px; border-radius: 5px; flex-shrink: 0; }
.detalhe-nome { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.detalhe-sub  { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 2px; }
.detalhe-limite-chip  { margin-left: auto; text-align: right; }
.detalhe-limite-valor { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.detalhe-limite-label { font-size: 10px; font-family: var(--font-mono); color: var(--text-muted); text-transform: uppercase; }

/* Abas */
.abas {
  display: flex; gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.aba-btn {
  padding: 8px 18px; border: none; background: transparent;
  color: var(--text-muted); font-family: var(--font-sans);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.aba-btn:hover { color: var(--text-dim); }
.aba-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.aba-panel { display: none; }
.aba-panel.active { display: block; }

.fatura-header {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 22px; margin-bottom: 18px;
}
.fatura-total   { font-family: var(--font-mono); font-size: 28px; font-weight: 700; flex: 1; letter-spacing: -.01em; }
.fatura-info    { display: flex; flex-direction: column; gap: 3px; text-align: right; }
.fatura-venc    { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }
.fatura-actions { display: flex; gap: 8px; align-items: center; }

.fatura-mes-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.fatura-mes-nav button:not(.btn) {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text-muted);
  width: 28px; height: 28px; border-radius: 7px; cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur) var(--ease);
}
.fatura-mes-nav button:not(.btn):hover { border-color: var(--accent); color: var(--accent); }
.fatura-mes-label { font-family: var(--font-mono); font-size: 13px; font-weight: 500; min-width: 110px; text-align: center; }

.parcela-preview {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 14px;
  font-size: 12px; font-family: var(--font-mono); color: var(--accent);
  margin-top: 4px; min-height: 36px; display: flex; align-items: center;
}

.status-select {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 5px 10px; border-radius: 8px; font-size: 12px; font-family: var(--font-sans);
  cursor: pointer; outline: none; appearance: none;
}
.status-select:focus { border-color: var(--accent); }

/* ══════════════════════════════════════════════════════
   MULTI-SELECT
══════════════════════════════════════════════════════ */
.multi-select-wrap { position: relative; min-width: 190px; }
.multi-select-trigger {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 13px; color: var(--text);
  user-select: none; height: 36px;
}
.multi-select-trigger:hover { border-color: var(--border-hi); }
.multi-select-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; z-index: 100; min-width: 100%;
  max-height: 260px; overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.multi-select-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; font-size: 13px; cursor: pointer;
  transition: background .1s;
}
.multi-select-item:hover { background: var(--bg3); }
.multi-select-item input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }
.multi-select-badge {
  display: inline-block; background: var(--accent);
  color: #07080f; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px; margin-left: 4px;
}

/* ══════════════════════════════════════════════════════
   TOGGLE SWITCH
══════════════════════════════════════════════════════ */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.toggle-label { font-size: 13px; color: var(--text); }
.toggle-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--bg4); border: 1px solid var(--border);
  border-radius: 22px; transition: .2s var(--ease);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 15px; height: 15px; left: 3px; bottom: 3px;
  background: var(--text-muted); border-radius: 50%;
  transition: .2s var(--ease);
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); background: #07080f; }

/* ══════════════════════════════════════════════════════
   SALDO RESIDUAL CARD
══════════════════════════════════════════════════════ */
.residual-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid;
  margin-bottom: 16px;
  animation: fadeUp .3s var(--ease) both;
}

.residual-card.positivo {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.residual-card.negativo {
  background: var(--red-dim);
  border-color: var(--red);
}

.residual-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  flex-shrink: 0;
}

.residual-card.positivo .residual-icon { color: var(--accent); background: var(--accent-dim); }
.residual-card.negativo .residual-icon { color: var(--red);    background: var(--red-dim); }

.residual-body    { flex: 1; min-width: 0; }
.residual-label   { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; }
.residual-label strong { color: var(--text-dim); }

.residual-valor {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.residual-card.positivo .residual-valor { color: var(--accent); }
.residual-card.negativo .residual-valor { color: var(--red); }

/* Badge residual na tabela de lançamentos */
.badge-residual {
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 500;
  vertical-align: middle;
}

/* ══════════════════════════════════════════════════════
   BOTTOM NAV  (mobile only — shown via media query)
══════════════════════════════════════════════════════ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 90;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-inner {
  display: flex;
  height: var(--bottom-nav-h);
}

.bottom-nav .nav-item {
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  border-radius: 0;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
  color: var(--text-muted);
}
.bottom-nav .nav-item svg { width: 22px; height: 22px; }
.bottom-nav .nav-item span.nav-label { display: inline; font-size: 10px; line-height: 1; }
.bottom-nav .nav-item:hover  { background: transparent; color: var(--text-dim); }
.bottom-nav .nav-item.active { color: var(--accent); background: transparent; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */

/* ── Tablet: icon-only sidebar ── */
@media (max-width: 1024px) {
  .sidebar { width: var(--sidebar-icon); }
  .sidebar-logo { justify-content: center; padding: 0; }
  .sidebar-logo-text,
  .sidebar-logo-sep { display: none; }
  .nav-item span:not(.nav-label) { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .sidebar-bottom { padding: 8px; }
  .form-row { grid-template-columns: 1fr 1fr; }
}

/* ── Mobile: bottom nav ── */
@media (max-width: 767px) {
  body { flex-direction: column; }

  .sidebar { display: none; }

  .bottom-nav { display: flex; flex-direction: column; }

  .topbar { padding: 0 16px; height: 54px; }
  .topbar .tema-switcher { display: flex; }

  .month-label { min-width: 110px; font-size: 12.5px; }

  .content {
    padding: 14px 16px;
    padding-bottom: calc(var(--bottom-nav-h) + 14px);
  }

  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
  }
  .card { padding: 14px 16px; }
  .card-value { font-size: 21px; }

  .caixinhas-grid { grid-template-columns: 1fr; }
  .cartoes-grid   { grid-template-columns: 1fr; }
  .cat-grid       { grid-template-columns: 1fr; }

  .chart-wrap { padding: 14px; }

  /* Bottom-sheet modals on mobile */
  .modal-overlay { align-items: flex-end; }
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: fixed; bottom: 0; left: 0; right: 0;
    max-width: 100%; width: 100%;
    max-height: 92dvh;
    animation: sheetUp .24s var(--ease) both;
  }
  @keyframes sheetUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: none; opacity: 1; }
  }

  .form-row { grid-template-columns: 1fr; }
  .detalhe-header { flex-wrap: wrap; gap: 10px; }

  .toast-container {
    bottom: calc(var(--bottom-nav-h) + 12px);
    right: 16px; left: 16px;
  }

  .filters { gap: 6px; }
  .filter-select { font-size: 12px; padding: 6px 10px; }
}

/* ══════════════════════════════════════════════════════
   LOGIN
══════════════════════════════════════════════════════ */
#tela-login {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  width: 100%;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl, 16px);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
}

.login-logo {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -.02em;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* ── Usuario info na topbar ── */
.usuario-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

#usuario-nome {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
