/* ============================================================
   FinanceApp — main.css
   Design inspirado em Mobills / Organizze
   ============================================================ */

/* ── VARIÁVEIS E RESET ──────────────────────────────────── */
:root {
  --primary:       #6C63FF;
  --primary-dark:  #5A52E0;
  --primary-light: #EAE9FF;
  --success:       #10B981;
  --success-light: #D1FAE5;
  --danger:        #EF4444;
  --danger-light:  #FEE2E2;
  --warning:       #F59E0B;
  --warning-light: #FEF3C7;
  --info:          #3B82F6;
  --info-light:    #DBEAFE;

  --bg:            #F1F5F9;
  --bg-card:       #FFFFFF;
  --bg-sidebar:    #1E293B;
  --bg-input:      #F8FAFC;

  --text:          #1E293B;
  --text-2:        #64748B;
  --text-3:        #94A3B8;
  --text-inv:      #FFFFFF;

  --border:        #E2E8F0;
  --border-2:      #CBD5E1;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.14);

  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     20px;
  --sidebar-w:     260px;
  --topbar-h:      64px;
  --transition:    .22s cubic-bezier(.4,0,.2,1);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg:            #0F172A;
  --bg-card:       #1E293B;
  --bg-sidebar:    #0B1120;
  --bg-input:      #273548;
  --text:          #F1F5F9;
  --text-2:        #94A3B8;
  --text-3:        #64748B;
  --border:        #334155;
  --border-2:      #475569;
  --shadow:        0 1px 3px rgba(0,0,0,.3);
  --shadow-md:     0 4px 16px rgba(0,0,0,.4);
  --primary-light: #2D2A5E;
  --success-light: #052E16;
  --danger-light:  #450A0A;
  --warning-light: #431407;
  --info-light:    #0C1A3A;
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
img { max-width: 100%; }

/* ── UTILITÁRIOS ─────────────────────────────────────────── */
.hidden    { display: none !important; }
.flex      { display: flex; }
.flex-col  { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2   { gap: .5rem; }
.gap-4   { gap: 1rem; }
.gap-6   { gap: 1.5rem; }
.text-sm { font-size: .813rem; }
.text-xs { font-size: .75rem; }
.font-bold { font-weight: 700; }
.font-semi { font-weight: 600; }
.mt-auto { margin-top: auto; }
.w-full  { width: 100%; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ── SCROLL ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

/* ── AUTH SCREEN ─────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1rem;
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .4s ease;
}
@keyframes slideUp {
  from { opacity:0; transform: translateY(20px); }
  to   { opacity:1; transform: translateY(0); }
}
.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-logo .logo-icon {
  width: 56px; height: 56px;
  background: var(--primary);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  color: #fff;
}
.auth-logo .logo-icon svg { width: 28px; height: 28px; }
.auth-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.auth-logo p  { color: var(--text-2); margin-top: .25rem; }
.auth-form .form-group { margin-bottom: 1.25rem; }
.auth-form label { display: block; font-weight: 600; margin-bottom: .5rem; font-size: .875rem; }
.auth-links { text-align: right; margin-bottom: 1.25rem; font-size: .813rem; }
.auth-switch { text-align: center; margin-top: 1.25rem; color: var(--text-2); font-size: .875rem; }
.auth-switch a { color: var(--primary); font-weight: 600; }

/* ── INPUTS ─────────────────────────────────────────────── */
.input-icon {
  position: relative;
  display: flex; align-items: center;
}
/* Ícone decorativo esquerdo — oculto: evita sobreposição com texto */
.input-icon > svg:not(.toggle-pass svg),
.input-icon > i { display: none; }
/* Remove o padding extra que era reservado para o ícone esquerdo */
.input-icon input,
.input-icon select { padding-left: .9rem; }
/* Botão de toggle senha (olho) — continua visível à direita */
.input-icon .toggle-pass {
  position: absolute; right: 10px;
  color: var(--text-3); padding: 4px;
  display: flex; align-items: center;
}
.input-icon .toggle-pass svg { width: 18px; height: 18px; }
/* Padding direito para não sobrepor o botão olho */
.input-icon input[type="password"] { padding-right: 2.5rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-size: .875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
input::placeholder { color: var(--text-3); }
select option { background: var(--bg-card); color: var(--text); }
textarea { resize: vertical; min-height: 80px; }

/* ── BOTÕES ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem;
  padding: .6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: .875rem;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(108,99,255,.4); }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover  { background: #059669; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-danger:hover   { background: #DC2626; }
.btn-outline  { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover  { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-ghost    { background: transparent; color: var(--text-2); }
.btn-ghost:hover    { background: var(--border); color: var(--text); }
.btn-full     { width: 100%; }
.btn-sm       { padding: .4rem .9rem; font-size: .813rem; }
.btn-xs       { padding: .3rem .65rem; font-size: .75rem; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); transition: all var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--border); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.btn-loader {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  position: absolute;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── APP LAYOUT ─────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  color: #fff;
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}
.sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
  display: flex; align-items: center; gap: .65rem;
  font-size: 1.1rem; font-weight: 700; color: #fff;
}
.sidebar-logo svg { color: var(--primary); width: 24px; height: 24px; }
.sidebar-close { color: rgba(255,255,255,.5); display: none; padding: 4px; }
.sidebar-close svg { width: 20px; height: 20px; }

.sidebar-nav { padding: 1rem .75rem; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.6);
  cursor: pointer;
  transition: all var(--transition);
  font-size: .875rem;
  font-weight: 500;
  user-select: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover  { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(108,99,255,.5); }

.sidebar-footer {
  padding: 1rem .75rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-info {
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem;
  border-radius: var(--radius-sm);
  margin-bottom: .5rem;
}
.user-avatar {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; color: #fff;
  flex-shrink: 0;
}
.user-name  { font-size: .875rem; font-weight: 600; color: #fff; }
.user-email { font-size: .75rem; color: rgba(255,255,255,.45); }
.sidebar-actions { display: flex; gap: .5rem; }
.sidebar-actions .icon-btn { color: rgba(255,255,255,.5); }
.sidebar-actions .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 99; animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin var(--transition);
}

/* ── TOPBAR ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.menu-btn { color: var(--text-2); display: none; padding: 6px; border-radius: 8px; }
.menu-btn:hover { background: var(--border); }
.menu-btn svg { width: 22px; height: 22px; }
.page-title { font-size: 1.125rem; font-weight: 700; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--danger); color: #fff;
  font-size: .65rem; font-weight: 700;
  width: 17px; height: 17px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

/* ── PAGE CONTENT ────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 1.75rem 1.75rem 3rem;   /* bottom padding evita que o último card fique colado */
  max-width: 1400px;
  width: 100%;
}
.page { animation: fadeIn .25s; }
.page.hidden { display: none; }

/* ── CARDS ─────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.card-title { font-size: .875rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }

/* ── STAT CARDS ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  display: flex; align-items: flex-start; gap: 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  min-width: 0;   /* evita overflow em grid */
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.purple { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.red    { background: var(--danger-light);  color: var(--danger); }
.stat-icon.blue   { background: var(--info-light);    color: var(--info); }
.stat-icon.amber  { background: var(--warning-light); color: var(--warning); }
.stat-label { font-size: .813rem; color: var(--text-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; margin-top: .2rem; word-break: break-word; }
.stat-sub   { font-size: .75rem; color: var(--text-3); margin-top: .2rem; }

/* ── GRID LAYOUTS ────────────────────────────────────────── */
.grid-2    { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3    { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 1.25rem; }

/* ── TRANSACTION LIST ────────────────────────────────────── */
.tx-list { display: flex; flex-direction: column; gap: .5rem; }
.tx-item {
  display: flex; align-items: center; gap: .9rem;
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: background var(--transition);
  cursor: default;
  min-width: 0;
  overflow: hidden;
}
.tx-item:hover { background: var(--bg); }
.tx-cat-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tx-cat-icon svg { width: 18px; height: 18px; }
.tx-info { flex: 1; min-width: 0; overflow: hidden; }
.tx-desc { font-weight: 600; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: .75rem; color: var(--text-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amount { font-weight: 700; font-size: .9rem; white-space: nowrap; flex-shrink: 0; padding-left: .5rem; }
.tx-amount.income  { color: var(--success); }
.tx-amount.expense { color: var(--danger); }
.tx-actions { display: flex; gap: .25rem; opacity: 0; transition: opacity var(--transition); flex-shrink: 0; }
.tx-item:hover .tx-actions { opacity: 1; }

/* ── FILTERS BAR ─────────────────────────────────────────── */
.filters-bar {
  display: flex; align-items: center; gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  background: var(--bg-card);
  padding: .9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.filters-bar input[type="search"],
.filters-bar select { max-width: 180px; }
.month-nav { display: flex; align-items: center; gap: .5rem; }
.month-nav span { font-weight: 600; font-size: .875rem; min-width: 120px; text-align: center; }

/* ── MODAL ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn .2s;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-card); z-index: 1;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex; gap: .75rem; justify-content: flex-end;
  padding-top: 1.25rem;
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* ── FORM STYLES ─────────────────────────────────────────── */
.form-group   { margin-bottom: 1.1rem; }
.form-label   { display: block; font-weight: 600; margin-bottom: .4rem; font-size: .875rem; }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint    { font-size: .75rem; color: var(--text-3); margin-top: .3rem; }
.form-error   { font-size: .75rem; color: var(--danger); margin-top: .3rem; }
.type-toggle  { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.type-btn {
  padding: .6rem; text-align: center; font-weight: 600; font-size: .875rem;
  cursor: pointer; transition: all var(--transition);
  color: var(--text-2);
}
.type-btn.income.active  { background: var(--success); color: #fff; }
.type-btn.expense.active { background: var(--danger);  color: #fff; }
.radio-group { display: flex; gap: .75rem; flex-wrap: wrap; }
.radio-chip {
  display: flex; align-items: center; gap: .4rem;
  padding: .4rem .9rem; border-radius: 99px;
  border: 1.5px solid var(--border);
  cursor: pointer; font-size: .813rem; font-weight: 500;
  transition: all var(--transition); color: var(--text-2);
}
.radio-chip input { display: none; }
.radio-chip:has(input:checked) { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

/* ── PROGRESS BAR ────────────────────────────────────────── */
.progress-bar {
  height: 8px; border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  transition: width .8s cubic-bezier(.4,0,.2,1);
}

/* ── GOAL CARDS ─────────────────────────────────────────── */
.goal-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: .9rem;
}
.goal-header { display: flex; align-items: center; gap: .75rem; }
.goal-icon {
  width: 44px; height: 44px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.goal-icon svg { width: 22px; height: 22px; }
.goal-name   { font-weight: 700; font-size: .95rem; }
.goal-status { font-size: .75rem; color: var(--text-2); }
.goal-amounts { display: flex; justify-content: space-between; font-size: .813rem; }
.goal-current { font-weight: 700; color: var(--primary); }
.goal-target  { color: var(--text-2); }
.goal-footer { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; }

/* ── INVESTMENT CARDS ────────────────────────────────────── */
.inv-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.inv-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.inv-info { flex: 1; min-width: 0; }
.inv-name { font-weight: 600; font-size: .875rem; }
.inv-type { font-size: .75rem; color: var(--text-2); }
.inv-amount { font-weight: 700; font-size: .95rem; }
.inv-pct   { font-size: .75rem; color: var(--text-2); text-align: right; }

/* ── ALERT ITEMS ─────────────────────────────────────────── */
.alert-item {
  display: flex; gap: .9rem;
  padding: .9rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--border);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: opacity var(--transition);
}
.alert-item.warning { border-left-color: var(--warning); background: var(--warning-light); }
.alert-item.danger  { border-left-color: var(--danger);  background: var(--danger-light); }
.alert-item.info    { border-left-color: var(--info);    background: var(--info-light); }
.alert-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.alert-dot.warning { background: var(--warning); }
.alert-dot.danger  { background: var(--danger); }
.alert-dot.info    { background: var(--info); }
.alert-title   { font-weight: 600; font-size: .875rem; }
.alert-message { font-size: .8rem; color: var(--text-2); margin-top: 2px; }

/* ── TABLE ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { text-align: left; padding: .75rem 1rem; color: var(--text-2); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── CHARTS ─────────────────────────────────────────────── */
.chart-container { position: relative; height: 240px; }
.chart-container canvas { border-radius: var(--radius-sm); }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 1.5rem;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.empty-icon { width: 64px; height: 64px; color: var(--text-3); }
.empty-icon svg { width: 100%; height: 100%; }
.empty-title { font-size: 1.1rem; font-weight: 700; }
.empty-desc  { color: var(--text-2); max-width: 320px; }

/* ── BADGE CHIPS ─────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .65rem; border-radius: 99px;
  font-size: .75rem; font-weight: 600;
}
.chip.green  { background: var(--success-light); color: var(--success); }
.chip.red    { background: var(--danger-light);  color: var(--danger); }
.chip.gray   { background: var(--border);        color: var(--text-2); }
.chip.purple { background: var(--primary-light); color: var(--primary); }
.chip.amber  { background: var(--warning-light); color: var(--warning); }

/* ── TOAST ─────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: .5rem;
  z-index: 999; max-width: 340px;
}
.toast {
  display: flex; align-items: flex-start; gap: .75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .9rem 1.1rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease;
}
@keyframes toastIn {
  from { opacity:0; transform: translateX(20px); }
  to   { opacity:1; transform: translateX(0); }
}
.toast-icon svg { width: 18px; height: 18px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    .toast-icon { color: var(--info); }
.toast-content { flex: 1; }
.toast-title   { font-weight: 700; font-size: .875rem; }
.toast-msg     { font-size: .813rem; color: var(--text-2); }

/* ── COLOR PICKER ────────────────────────────────────────── */
.color-swatch {
  display: flex; gap: .5rem; flex-wrap: wrap;
  align-items: center;
}
.color-swatch input[type="color"] {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  padding: 2px; cursor: pointer; background: none;
}
.swatch {
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  transition: transform var(--transition), border-color var(--transition);
}
.swatch:hover, .swatch.active { transform: scale(1.2); border-color: var(--text); }

/* ── LOADING ─────────────────────────────────────────────── */
.page-loader {
  display: flex; align-items: center; justify-content: center;
  padding: 4rem;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-input) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── SECTION HEADER ─────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title { font-size: 1.1rem; font-weight: 700; }

/* ── ACCOUNTS CARD ─────────────────────────────────────── */
.account-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  transition: transform var(--transition), box-shadow var(--transition);
}
.account-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.acc-icon {
  width: 44px; height: 44px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #fff;
}
.acc-icon svg { width: 22px; height: 22px; }
.acc-info { flex: 1; min-width: 0; }
.acc-name    { font-weight: 700; font-size: .875rem; }
.acc-type    { font-size: .75rem; color: var(--text-2); }
.acc-balance { font-weight: 700; font-size: 1.05rem; }
.acc-balance.positive { color: var(--success); }
.acc-balance.negative { color: var(--danger); }

/* ── CATEGORIES ─────────────────────────────────────────── */
.cat-list { display: flex; flex-direction: column; gap: .5rem; }
.cat-item {
  display: flex; align-items: center; gap: .9rem;
  padding: .8rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}
.cat-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.cat-icon-wrap {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cat-icon-wrap svg { width: 18px; height: 18px; }
.cat-name  { flex: 1; font-weight: 600; font-size: .875rem; }
.cat-type  { font-size: .75rem; }
.cat-type.income  { color: var(--success); }
.cat-type.expense { color: var(--danger); }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 1.25rem 1.25rem 3rem; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 280px; }
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .sidebar-overlay.open { display: flex; }
  .main-content { margin-left: 0; }
  .menu-btn { display: flex; }
  .page-content { padding: 1rem 1rem 4rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; gap: .75rem; }
  .form-row { grid-template-columns: 1fr; }
  .hide-xs { display: none; }
  .topbar { padding: 0 1rem; }
  .filters-bar { flex-direction: column; align-items: stretch; gap: .5rem; }
  .filters-bar input[type="search"],
  .filters-bar select { max-width: none; }
  .stat-value { font-size: 1.15rem; }
  .section-header { flex-wrap: wrap; gap: .75rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; gap: .75rem; }
  .modal { max-height: 95vh; border-radius: var(--radius) var(--radius) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .auth-card { padding: 2rem 1.25rem; }
  .toast-container { left: .75rem; right: .75rem; bottom: .75rem; max-width: none; }
  .topbar .btn-sm span { display: none; }
  .topbar .btn-sm { padding: .4rem .6rem; }
}

/* ── REPORT PAGE ─────────────────────────────────────────── */
.report-tabs { display: flex; gap: .5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab-btn {
  padding: .5rem 1.1rem; border-radius: 99px;
  font-size: .875rem; font-weight: 600;
  border: 1.5px solid var(--border);
  color: var(--text-2); transition: all var(--transition);
}
.tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── PAGINATION ─────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .5rem; justify-content: center; margin-top: 1rem; }
.pagination button {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1.5px solid var(--border);
  color: var(--text-2); font-weight: 600; font-size: .875rem;
  transition: all var(--transition);
}
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination button:disabled { opacity: .4; cursor: default; }

/* ── CREDIT CARD VISUAL ──────────────────────────────────── */
.cc-card {
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  min-height: 130px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.cc-card::before {
  content: '';
  position: absolute;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  right: -40px; top: -40px;
}
.cc-card::after {
  content: '';
  position: absolute;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  right: 60px; bottom: -30px;
}
.cc-name { font-weight: 700; font-size: 1rem; }
.cc-limit { font-size: .8rem; opacity: .8; }
.cc-usage { display: flex; justify-content: space-between; align-items: flex-end; }
.cc-used  { font-size: 1.3rem; font-weight: 700; }
.cc-avail { font-size: .75rem; opacity: .8; text-align: right; }

/* ── SETTINGS PAGE ──────────────────────────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.settings-nav {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: calc(var(--topbar-h) + 1.75rem);
}
.settings-nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1.1rem;
  cursor: pointer;
  color: var(--text-2);
  font-size: .875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition);
}
.settings-nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.settings-nav-item:hover  { background: var(--bg); color: var(--text); }
.settings-nav-item.active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.settings-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .6rem;
}
.settings-section-title svg { width: 20px; height: 20px; color: var(--primary); }
.avatar-upload {
  display: flex; align-items: center; gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.avatar-big {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.danger-zone {
  border: 1.5px solid var(--danger-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--danger-light);
}
.danger-zone h4 { color: var(--danger); margin-bottom: .5rem; }
.danger-zone p { font-size: .875rem; color: var(--text-2); margin-bottom: 1rem; }
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.theme-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
}
.theme-card:hover { border-color: var(--primary); }
.theme-card.active { border-color: var(--primary); background: var(--primary-light); }
.theme-preview {
  height: 60px; border-radius: 6px; margin-bottom: .5rem;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 600;
}
.theme-preview.light { background: #F1F5F9; color: #1E293B; border: 1px solid #E2E8F0; }
.theme-preview.dark  { background: #1E293B; color: #F1F5F9; }

/* ── 50/30/20 REPORT ────────────────────────────────────── */
.budget-ring {
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.budget-legend {
  display: flex; flex-direction: column; gap: .75rem;
}
.budget-legend-item {
  display: flex; align-items: center; gap: .75rem;
}
.budget-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
}
.budget-bar-wrap { flex: 1; }
.budget-bar-label {
  display: flex; justify-content: space-between; font-size: .813rem; margin-bottom: .3rem;
}
.budget-status {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; font-weight: 600;
  padding: .15rem .5rem; border-radius: 99px;
}
.budget-status.ok      { background: var(--success-light); color: var(--success); }
.budget-status.over    { background: var(--danger-light);  color: var(--danger); }
.budget-status.warning { background: var(--warning-light); color: var(--warning); }

@media (max-width: 768px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; }
  .settings-nav { display: flex; overflow-x: auto; border-radius: var(--radius-sm); }
  .settings-nav-item { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
  .settings-nav-item.active { border-bottom-color: var(--primary); border-left-color: transparent; }
}
