/* ═══════════════════════════════════════════════════
   FINANZTOOL - Complete Stylesheet
   ═══════════════════════════════════════════════════ */

/* ─── CSS Variables ─── */
:root {
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 68px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --transition: 0.2s ease;
  --shadow: 0 1px 3px rgba(0,0,0,0.2), 0 2px 8px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.3);

  /* Dark Theme (default) */
  --bg: #0d1117;
  --surface: #161b22;
  --card: #1c2128;
  --card-hover: #21262d;
  --border: #30363d;
  --border-subtle: #21262d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-faint: #484f58;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --accent-light: #a5b4fc;

  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.12);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.12);

  --input-bg: #0d1117;
  --input-border: #30363d;
  --input-focus: #6366f1;

  --scrollbar: #30363d;
  --scrollbar-thumb: #484f58;
}

[data-theme="light"] {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --card: #ffffff;
  --card-hover: #f6f8fa;
  --border: #d0d7de;
  --border-subtle: #e8ecf0;
  --text: #1f2328;
  --text-muted: #656d76;
  --text-faint: #adb5bd;

  --accent: #4f46e5;
  --accent-hover: #3730a3;
  --accent-glow: rgba(79, 70, 229, 0.1);
  --accent-light: #818cf8;

  --success: #16a34a;
  --success-bg: rgba(22, 163, 74, 0.08);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.08);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.08);
  --info: #2563eb;
  --info-bg: rgba(37, 99, 235, 0.08);

  --input-bg: #ffffff;
  --input-border: #d0d7de;
  --input-focus: #4f46e5;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  --scrollbar: #e2e8f0;
  --scrollbar-thumb: #cbd5e1;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* ─── App Layout ─── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition);
  flex-shrink: 0;
  z-index: 100;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-height);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition);
}

.sidebar.collapsed .logo-text { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .sidebar-collapse svg { transform: rotate(180deg); }
#sidebar-collapse svg { transition: transform var(--transition); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
}

.nav-item:hover {
  background: var(--card-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent-light);
}

[data-theme="light"] .nav-item.active {
  color: var(--accent);
}

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

.nav-item span {
  opacity: 1;
  transition: opacity var(--transition);
  overflow: hidden;
}

.sidebar.collapsed .nav-item span { opacity: 0; width: 0; }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.sidebar-footer-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  transition: all var(--transition);
  white-space: nowrap;
}

.sidebar-footer-btn:hover { background: var(--card-hover); color: var(--text); }

.sidebar.collapsed .sidebar-footer-btn span { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .theme-label { display: none; }

/* Theme toggle icons */
.icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .theme-label::before { content: "Dark Mode"; }
.theme-label::before { content: "Light Mode"; }
.theme-label { font-size: 0; }

/* ─── Main Wrapper ─── */
#main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ─── Top Bar ─── */
.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}

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

.current-date {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Content ─── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── Sections ─── */
.section { display: contents; }
.section.hidden { display: none; }

/* ─── Cards ─── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* ─── Stats Grid ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-color, var(--accent));
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-change {
  font-size: 12px;
  font-weight: 500;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }
.stat-change.neutral { color: var(--text-muted); }

.stat-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-glow);
  color: var(--accent-light);
}

/* ─── Grid Layouts ─── */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ─── Charts ─── */
.chart-container {
  position: relative;
  width: 100%;
}

.chart-container canvas {
  max-width: 100%;
}

.chart-sm { max-height: 220px; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover { background: var(--card-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover { background: var(--card-hover); color: var(--text); }

.btn-ghost.active {
  background: var(--accent-glow);
  color: var(--accent-light);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 8px; font-size: 12px; }

.btn-group {
  display: flex;
  gap: 2px;
  background: var(--bg);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.icon-btn:hover { background: var(--card-hover); color: var(--text); }

/* ─── Data List / Table ─── */
.data-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.data-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}

.data-row:last-child { border-bottom: none; }
.data-row:hover { background: var(--card-hover); margin: 0 -8px; padding: 12px 8px; border-radius: var(--radius-xs); }

.data-row-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.data-row-main {
  flex: 1;
  min-width: 0;
}

.data-row-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-row-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.data-row-amount {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.data-row-amount.positive { color: var(--success); }
.data-row-amount.negative { color: var(--danger); }
.data-row-amount.neutral { color: var(--text); }

.data-row-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.data-row:hover .data-row-actions { opacity: 1; }

/* ─── Accounts Quick Overview ─── */
.accounts-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.account-quick-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: all var(--transition);
}

.account-quick-card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.account-quick-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.account-quick-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.account-quick-balance {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

/* ─── Accounts Full Grid ─── */
.accounts-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.account-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.account-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.account-card-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.account-card-name {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.account-card-institution {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.account-card-balance {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.account-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Account type colors */
.type-checking { background: var(--info-bg); color: var(--info); }
.type-savings { background: var(--success-bg); color: var(--success); }
.type-cash { background: var(--warning-bg); color: var(--warning); }
.type-credit { background: var(--danger-bg); color: var(--danger); }
.type-depot { background: var(--accent-glow); color: var(--accent-light); }

/* ─── Goals Grid ─── */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.goal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.goal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.goal-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.goal-icon {
  font-size: 28px;
  line-height: 1;
}

.goal-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.goal-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.goal-amounts {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.goal-current {
  font-size: 22px;
  font-weight: 800;
}

.goal-target {
  font-size: 13px;
  color: var(--text-muted);
}

.progress-bar-wrap {
  background: var(--border);
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  transition: width 0.6s ease;
}

.goal-progress-text {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* ─── Upcoming Payments ─── */
.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.upcoming-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.upcoming-item:last-child { border-bottom: none; }

.upcoming-day {
  width: 36px;
  height: 36px;
  background: var(--accent-glow);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-light);
  flex-shrink: 0;
}

.upcoming-day-label { font-size: 8px; font-weight: 500; opacity: 0.8; }

/* ─── Budget Overview ─── */
.budget-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.budget-item {}

.budget-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
}

.budget-cat { font-weight: 500; }
.budget-amounts { color: var(--text-muted); }

/* ─── Filters ─── */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-select {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 13px;
  padding: 5px 8px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

.filter-select:focus { border-color: var(--input-focus); }

/* ─── Forms ─── */
.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  padding: 10px 12px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group textarea { resize: vertical; min-height: 80px; }

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

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title { font-size: 18px; font-weight: 700; }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-close {
  width: 32px;
  height: 32px;
}

/* ─── Notifications ─── */
.notifications {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.notification {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
  max-width: 360px;
  pointer-events: all;
  animation: slideInRight 0.25s ease;
}

.notification.success { border-left: 3px solid var(--success); }
.notification.error { border-left: 3px solid var(--danger); }
.notification.info { border-left: 3px solid var(--info); }

/* ─── Tags / Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-green { background: var(--success-bg); color: var(--success); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-purple { background: var(--accent-glow); color: var(--accent-light); }

/* ─── Link Button ─── */
.link-btn {
  font-size: 13px;
  color: var(--accent-light);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}

.link-btn:hover { color: var(--accent); }

/* ─── Empty State ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  gap: 12px;
}

.empty-state svg { opacity: 0.3; }
.empty-state h4 { font-size: 15px; font-weight: 600; color: var(--text-faint); }
.empty-state p { font-size: 13px; }

/* ─── Crypto Perf ─── */
.crypto-perf-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crypto-perf-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.crypto-perf-symbol {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

/* ─── Forecast Table ─── */
.forecast-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.forecast-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.forecast-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.forecast-table tr:last-child td { border-bottom: none; }
.forecast-table tr:hover td { background: var(--card-hover); }

/* ─── Toggle Switch ─── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ─── Divider ─── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ─── Sidebar Overlay (mobile) ─── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.sidebar-overlay.hidden { display: none; }

/* ─── Mobile Utilities ─── */
.mobile-only { display: none; }

/* ─── Animations ─── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ─── Crypto colors ─── */
.crypto-btc { background: linear-gradient(135deg, #f7931a, #ff6b00); }
.crypto-eth { background: linear-gradient(135deg, #627eea, #3c5cc8); }
.crypto-ada { background: linear-gradient(135deg, #0033ad, #3162d1); }
.crypto-sol { background: linear-gradient(135deg, #9945ff, #14f195); }
.crypto-default { background: linear-gradient(135deg, #6366f1, #8b5cf6); }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform var(--transition), width var(--transition);
    width: var(--sidebar-width) !important;
    z-index: 200;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-header .icon-btn { display: none; }

  .mobile-only { display: flex; }

  #main-wrapper { width: 100%; }

  .topbar { padding: 0 16px; }

  .content { padding: 16px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }

  .stat-value { font-size: 22px; }

  .current-date { display: none; }

  .accounts-card-grid { grid-template-columns: 1fr; }

  .goals-grid { grid-template-columns: 1fr; }

  .form-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-right .btn span { display: none; }
}
