:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-sidebar: #0a0f1e;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --sidebar-width: 240px;
  --sidebar-collapsed: 68px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --transition: all 0.25s ease;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: var(--transition);
  z-index: 1000;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
}
.logo i { font-size: 1.3rem; flex-shrink: 0; }
.sidebar.collapsed .logo span { display: none; }

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--border); color: var(--text-primary); }

.nav-menu { list-style: none; padding: 12px 0; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  border-left: 3px solid transparent;
  font-size: 0.875rem;
}
.nav-item:hover { background: rgba(99,102,241,0.1); color: var(--text-primary); }
.nav-item.active {
  background: rgba(99,102,241,0.15);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.nav-item i { font-size: 1rem; flex-shrink: 0; width: 18px; text-align: center; }
.sidebar.collapsed .nav-item span { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}
.logout-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
}
.logout-btn:hover { background: rgba(239,68,68,0.1); color: #f87171; }
.logout-btn i { font-size: 1rem; flex-shrink: 0; width: 18px; text-align: center; }
.sidebar.collapsed .logout-btn span { display: none; }
.sidebar.collapsed .logout-btn { justify-content: center; padding: 10px; }

/* ── Main ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  transition: var(--transition);
  min-height: 100vh;
  background: var(--bg-primary);
}
.main-content.expanded { margin-left: var(--sidebar-collapsed); }

/* ── Sections ── */
.section { display: none; padding: 28px 32px; animation: fadeIn 0.3s ease; }
.section.active { display: block; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.section-header h1 { font-size: 1.6rem; font-weight: 700; }

/* ── Currency Selector ── */
.currency-selector {
  display: flex;
  gap: 6px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.currency-btn {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  background: transparent;
  color: var(--text-secondary);
  transition: var(--transition);
}
.currency-btn.active { background: var(--primary); color: white; }

/* ── Cards ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: var(--transition);
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.net-worth-card .card-icon { background: rgba(99,102,241,0.15); color: var(--primary); }
.income-card .card-icon { background: rgba(34,197,94,0.15); color: var(--success); }
.expenses-card .card-icon { background: rgba(239,68,68,0.15); color: var(--danger); }
.savings-card .card-icon { background: rgba(245,158,11,0.15); color: var(--warning); }

.card-info h3 {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.card-value { font-size: 1.3rem; font-weight: 700; margin-bottom: 3px; line-height: 1.2; }
.card-sub { font-size: 0.72rem; color: var(--text-muted); }

/* ── Charts ── */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}
.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
}
.chart-card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 18px; }
.chart-card.full-width { margin-bottom: 18px; }

/* ── Overview Row ── */
.overview-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.overview-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
}
.overview-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.mini-list .mini-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.mini-list .mini-item:last-child { border-bottom: none; }
.mini-item-name { color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.mini-item-value { font-weight: 600; }
.color-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ── Wallets Grid ── */
.wallets-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
}
@media (max-width: 1400px) {
  .wallets-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1100px) {
  .wallets-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .wallets-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .wallets-grid { grid-template-columns: 1fr; }
}
.wallet-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.wallet-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,0,0,0.3); }
.wallet-card-bg {
  position: absolute;
  top: -20px; right: -20px;
  width: 110px; height: 110px;
  border-radius: 50%;
  opacity: 0.12;
}
.wallet-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}
.wallet-name { font-size: 0.95rem; font-weight: 600; }
.wallet-currency-pill {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.15);
  white-space: nowrap;
  flex-shrink: 0;
}
.wallet-type-badge {
  font-size: 0.67rem;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 600;
  background: var(--bg-primary);
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-top: 4px;
  display: inline-block;
}
.wallet-balance { font-size: 1.7rem; font-weight: 700; margin-bottom: 2px; }
.wallet-native  { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 2px; }
.wallet-currency { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 14px; }
.wallet-converted {
  display: flex;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.wallet-converted-item { display: flex; flex-direction: column; gap: 2px; }
.wallet-converted-label { font-size: 0.67rem; color: var(--text-muted); text-transform: uppercase; }
.wallet-converted-value { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); }
.wallet-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ── Tables ── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table thead th {
  background: var(--bg-secondary);
  padding: 12px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(99,102,241,0.05); }
.data-table td { padding: 12px 14px; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-success { background: rgba(34,197,94,0.15); color: #22c55e; }
.badge-danger  { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-warning { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-info    { background: rgba(59,130,246,0.15); color: #3b82f6; }
.badge-secondary { background: rgba(100,116,139,0.15); color: #64748b; }
.badge-purple  { background: rgba(139,92,246,0.15); color: #8b5cf6; }

/* ── Summary Bar ── */
.income-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.summary-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 20px;
  border: 1px solid var(--border);
  flex: 1;
  min-width: 150px;
}
.summary-item .label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.summary-item .value { font-size: 1.05rem; font-weight: 700; }
.summary-item .value.highlight { color: var(--primary); }

/* ── Filters ── */
.expense-filters { display: flex; gap: 8px; margin-bottom: 18px; }
.filter-btn {
  padding: 7px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ── Assets ── */
.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.asset-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.asset-card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.asset-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.asset-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.asset-icon.property { background: rgba(59,130,246,0.15); color: #3b82f6; }
.asset-icon.gold     { background: rgba(245,158,11,0.15); color: #f59e0b; }
.asset-icon.commodity{ background: rgba(139,92,246,0.15); color: #8b5cf6; }
.asset-icon.other    { background: rgba(100,116,139,0.15); color: #64748b; }
.asset-name { font-size: 1rem; font-weight: 600; margin-bottom: 3px; }
.asset-value { font-size: 1.45rem; font-weight: 700; margin-bottom: 3px; }
.asset-detail { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 14px; }
.asset-conversions {
  display: flex;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ── Projections ── */
.projection-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.proj-tab {
  padding: 9px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}
.proj-tab.active { background: var(--primary); border-color: var(--primary); color: white; }

.projection-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.projection-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
}
.projection-card h4 {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.proj-value { font-size: 1.2rem; font-weight: 700; }
.proj-value.positive { color: var(--success); }
.proj-value.negative { color: var(--danger); }

.projection-controls select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  cursor: pointer;
}

.projection-table-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
}
.projection-table-container h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 14px; }

/* ── Settings ── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}
.settings-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
}
.settings-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-card h3 i { color: var(--primary); }
.settings-card.danger-zone { border-color: rgba(239,68,68,0.3); }
.settings-card.danger-zone h3 i { color: var(--danger); }
.settings-card p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 16px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 11px; font-size: 0.78rem; }
.btn-icon {
  padding: 7px;
  min-width: 32px;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-icon:hover { background: var(--border); color: var(--text-primary); }
.btn-icon.delete:hover {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.3);
  color: var(--danger);
}

/* ── Modals ── */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal.open { display: flex; }
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  animation: slideUp 0.25s ease;
}
.modal-sm { max-width: 360px; }
.modal-lg { max-width: 680px; }

/* ── Transaction Modal ── */
.tx-add-form {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
}
.tx-type-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.tx-type-btn {
  flex: 1;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.tx-type-btn[data-type="credit"].active { background: rgba(34,197,94,.15); border-color: #22c55e; color: #22c55e; }
.tx-type-btn[data-type="debit"].active  { background: rgba(239,68,68,.15); border-color: #ef4444; color: #ef4444; }

.tx-form-row {
  display: flex;
  gap: 10px;
}
.tx-form-row .form-group { margin-bottom: 10px; }

/* ── Transaction List ── */
.tx-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.tx-filter-tabs { display: flex; gap: 6px; }
.tx-filter {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: var(--transition);
}
.tx-filter.active { background: var(--primary); border-color: var(--primary); color: white; }

.tx-list {
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tx-loading, .tx-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.tx-empty i { font-size: 1.8rem; display: block; margin-bottom: 8px; opacity: 0.3; }

.tx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  gap: 10px;
}
.tx-row.credit { border-left: 3px solid #22c55e; }
.tx-row.debit  { border-left: 3px solid #ef4444; }

.tx-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.tx-type-badge {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.tx-type-badge.credit { background: rgba(34,197,94,.15); color: #22c55e; }
.tx-type-badge.debit  { background: rgba(239,68,68,.15);  color: #ef4444; }

.tx-info { min-width: 0; }
.tx-notes {
  font-size: 0.83rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-date { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

.tx-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.tx-amount { font-size: 0.9rem; font-weight: 700; white-space: nowrap; }
.tx-amount.credit { color: #22c55e; }
.tx-amount.debit  { color: #ef4444; }
.tx-orig { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
@keyframes slideUp { from { opacity:0; transform:translateY(24px); } to { opacity:1; transform:translateY(0); } }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-size: 1rem;
}
.modal-close:hover { background: var(--border); color: var(--text-primary); }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-group textarea { min-height: 72px; resize: vertical; }
.form-group input[type="color"] { height: 40px; cursor: pointer; padding: 3px; }
.checkbox-group label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: normal; }
.checkbox-group input[type="checkbox"] { width: auto; }
.info-text { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; font-style: italic; }
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3000;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 360px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  animation: slideInRight 0.3s ease;
  font-size: 0.85rem;
}
@keyframes slideInRight { from { opacity:0; transform:translateX(100%); } to { opacity:1; transform:translateX(0); } }
.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.success i { color: var(--success); }
.toast.error   i { color: var(--danger); }
.toast.warning i { color: var(--warning); }

/* ── Misc ── */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.6rem; margin-bottom: 12px; opacity: 0.3; display: block; }
.empty-state p { font-size: 0.875rem; }

.positive { color: var(--success) !important; }
.negative { color: var(--danger) !important; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .charts-row { grid-template-columns: 1fr; }
  .overview-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .overview-row { grid-template-columns: 1fr; }
  .section { padding: 16px; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
}
@media (max-width: 480px) {
  .cards-grid { grid-template-columns: 1fr; }
  .income-summary { flex-direction: column; }
}

/* ── AI Analyst ── */
.ai-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
  max-width: 680px;
}
.ai-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 20px;
  color: var(--text-muted);
}
.ai-empty i { font-size: 2.5rem; opacity: 0.4; }
.ai-empty p { font-size: 0.95rem; }
.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 20px;
  color: var(--primary);
}
.ai-loading i { font-size: 2.5rem; }
.ai-loading p { font-size: 0.95rem; color: var(--text-muted); }
.ai-result {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.ai-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.ai-meta i { color: var(--primary); }
.ai-body {
  padding: 24px 28px;
  line-height: 1.75;
  color: var(--text-primary);
  font-size: 0.92rem;
}
.ai-body h1, .ai-body h2 {
  color: var(--text-primary);
  margin: 24px 0 10px;
  font-size: 1.05rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.ai-body h3 { color: var(--primary); margin: 18px 0 8px; font-size: 0.97rem; }
.ai-body p  { margin: 0 0 12px; }
.ai-body ul, .ai-body ol { padding-left: 20px; margin: 0 0 12px; }
.ai-body li { margin-bottom: 6px; }
.ai-body strong { color: var(--text-primary); }
.ai-body code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}
.ai-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}
.ai-error {
  padding: 16px 20px;
  background: rgba(239,68,68,0.1);
  border-left: 3px solid #ef4444;
  color: #f87171;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  border-radius: 0;
}

/* ── Snapshot ── */
.snapshot-output {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.snapshot-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.snapshot-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.snapshot-copy-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.snapshot-copy-inline:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
#snapshotPre {
  margin: 0;
  padding: 20px 24px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--text-primary);
  white-space: pre;
  overflow-x: auto;
  max-height: 70vh;
  overflow-y: auto;
  background: transparent;
  scrollbar-width: thin;
}
.btn-success { background: var(--success) !important; border-color: var(--success) !important; }
