/* ===== TOKENS ===== */
:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 999px;

  --accent: #6366F1;
  --accent-hover: #4F46E5;
  --accent-soft: rgba(99, 102, 241, 0.14);

  --income: #10B981;
  --income-soft: rgba(16, 185, 129, 0.13);
  --expense: #F43F5E;
  --expense-soft: rgba(244, 63, 94, 0.13);
  --warn: #F59E0B;
  --warn-soft: rgba(245, 158, 11, 0.14);

  --sidebar-w: 248px;
  --topbar-h: 64px;
  --transition: 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0B0E14;
  --bg-subtle: #0F131C;
  --surface: #131823;
  --surface-hover: #192030;
  --surface-elevated: #1A2131;
  --border: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --text-faint: #64748B;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.18);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.65);
  --backdrop: rgba(5, 8, 14, 0.72);
}

[data-theme="light"] {
  --bg: #F4F6FA;
  --bg-subtle: #EDF0F7;
  --surface: #FFFFFF;
  --surface-hover: #F8FAFC;
  --surface-elevated: #FFFFFF;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0F172A;
  --text-muted: #475569;
  --text-faint: #94A3B8;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.05);
  --shadow-modal: 0 24px 64px rgba(15, 23, 42, 0.22);
  --backdrop: rgba(15, 23, 42, 0.45);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 10px 22px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
  flex-shrink: 0;
}
.brand-mark.sm { width: 30px; height: 30px; border-radius: 9px; }
.brand-name { display: block; font-weight: 800; font-size: 0.98rem; letter-spacing: -0.02em; }
.brand-sub { display: block; font-size: 0.74rem; color: var(--text-muted); }

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  text-align: left;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
[data-theme="dark"] .nav-item.active { color: #A5B4FC; }

.nav-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.nav-badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}

.sidebar-footer {
  padding: 14px 10px 4px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.storage-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.dot-live {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--income);
  box-shadow: 0 0 0 3px var(--income-soft);
}
.shortcut-hint { font-size: 0.74rem; color: var(--text-faint); }
kbd {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-h);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.mobile-brand { display: none; align-items: center; gap: 8px; }

.month-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px;
}
.month-label {
  font-weight: 700;
  font-size: 0.88rem;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  min-width: 144px;
  text-align: center;
  text-transform: capitalize;
  transition: background var(--transition);
}
.month-label:hover { background: var(--surface-hover); }

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

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition), border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn.sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 8px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.28);
}
.btn-primary:hover { background: var(--accent-hover); }

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

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

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

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }

.link-btn {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 6px;
}
[data-theme="dark"] .link-btn { color: #A5B4FC; }
.link-btn:hover { background: var(--accent-soft); }

/* ===== DEMO BANNER ===== */
.demo-banner {
  margin: 16px 28px 0;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.demo-banner-text { font-size: 0.86rem; color: var(--text); }
.demo-banner-text strong { font-weight: 700; }
.demo-banner-actions { display: flex; gap: 8px; align-items: center; }

/* ===== CONTENT ===== */
.content {
  padding: 24px 28px 48px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.view { display: none; animation: fadeIn 180ms ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.view-header h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.025em; }
.view-sub { font-size: 0.86rem; color: var(--text-muted); margin-top: 3px; }
.view-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== CARDS & GRIDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kpi-balance {
  background: linear-gradient(155deg, rgba(99, 102, 241, 0.14) 0%, var(--surface) 62%);
  border-color: rgba(99, 102, 241, 0.25);
}
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.kpi-foot { font-size: 0.76rem; color: var(--text-muted); }
.kpi-dot { width: 9px; height: 9px; border-radius: 50%; }
.kpi-dot.income { background: var(--income); box-shadow: 0 0 0 3px var(--income-soft); }
.kpi-dot.expense { background: var(--expense); box-shadow: 0 0 0 3px var(--expense-soft); }

.kpi-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-elevated);
  color: var(--text-muted);
}
.kpi-badge.up { background: var(--income-soft); color: var(--income); }
.kpi-badge.down { background: var(--expense-soft); color: var(--expense); }

.money {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
body.privacy-on .money {
  filter: blur(7px);
  user-select: none;
}
.text-income { color: var(--income); }
.text-expense { color: var(--expense); }
.text-warn { color: var(--warn); }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.panel { padding: 20px; }
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel h2 { font-size: 1rem; font-weight: 700; letter-spacing: -0.015em; }
.panel-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.panel-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ===== PROGRESS BARS ===== */
.progress-track {
  width: 100%;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-track.sm { height: 6px; }
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--income);
  transition: width 320ms cubic-bezier(0.2, 0.8, 0.2, 1), background var(--transition);
}
.progress-fill.warn { background: var(--warn); }
.progress-fill.danger { background: var(--expense); }
.progress-fill.accent { background: var(--accent); }

/* ===== CHARTS ===== */
.donut-layout {
  display: grid;
  grid-template-columns: 184px 1fr;
  gap: 20px;
  align-items: center;
}
.donut-svg-wrap { position: relative; width: 184px; height: 184px; margin: 0 auto; }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}
.donut-center-label { font-size: 0.72rem; color: var(--text-muted); }
.donut-center-val { font-size: 1.02rem; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 256px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 9px;
  font-size: 0.84rem;
  transition: background var(--transition);
  text-align: left;
  width: 100%;
}
.legend-row:hover { background: var(--surface-hover); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-name { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-pct { font-size: 0.76rem; color: var(--text-muted); font-family: var(--font-mono); }
.legend-val { font-weight: 700; font-size: 0.84rem; }

.chart-legend-inline {
  display: flex;
  gap: 12px;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.chart-legend-inline span { display: inline-flex; align-items: center; gap: 5px; }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 3px; }
.swatch.income { background: var(--income); }
.swatch.expense { background: var(--expense); }

.bar-chart-wrap { width: 100%; }
.bar-chart-svg { width: 100%; height: 210px; display: block; overflow: visible; }
.bar-group { cursor: pointer; }
.bar-group:hover rect.bar-bg { fill: var(--surface-hover); }

/* ===== ALERTS & STACKS ===== */
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-md { display: flex; flex-direction: column; gap: 14px; }

.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}
.alert-item.danger { border-color: rgba(244, 63, 94, 0.35); background: var(--expense-soft); }
.alert-item.warn { border-color: rgba(245, 158, 11, 0.32); background: var(--warn-soft); }
.alert-title { font-weight: 700; }
.alert-sub { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }

/* ===== TRANSACTIONS ===== */
.filters-bar {
  padding: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}
.search-field {
  flex: 1;
  min-width: 210px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--text-muted);
}
.search-field input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 9px 0;
  font-size: 0.88rem;
  color: var(--text);
  outline: none;
}
.filter-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-controls select {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.84rem;
  color: var(--text);
  outline: none;
}

.tx-groups { display: flex; flex-direction: column; gap: 16px; }
.tx-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: capitalize;
}
.tx-day-card { overflow: hidden; }

.tx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.tx-row:last-child { border-bottom: none; }
.tx-row:hover { background: var(--surface-hover); }

.tx-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.9rem;
}
.tx-main { flex: 1; min-width: 0; }
.tx-title {
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tx-meta {
  font-size: 0.77rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tx-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.tx-amount { font-weight: 800; font-size: 0.94rem; text-align: right; }

.pill-status {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  transition: opacity var(--transition);
}
.pill-status.paid { background: var(--income-soft); color: var(--income); }
.pill-status.pending { background: var(--warn-soft); color: var(--warn); }
.pill-installment {
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}
[data-theme="dark"] .pill-installment { color: #A5B4FC; }

.tx-compact-list .tx-row { padding: 10px 4px; }
.tx-compact-list .tx-row:hover { background: transparent; }

/* ===== BUDGETS & GOALS ===== */
.savings-goal-card { margin-bottom: 16px; display: flex; flex-direction: column; gap: 12px; }
.savings-goal-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.savings-goal-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); flex-wrap: wrap; gap: 8px; }

.budget-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.budget-item:last-child { border-bottom: none; padding-bottom: 0; }
.budget-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.budget-cat { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 0.9rem; }
.budget-limit-input {
  width: 118px;
  text-align: right;
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  font-size: 0.82rem;
  font-family: var(--font-mono);
}
.budget-nums { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-muted); }

.goal-card {
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.goal-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.goal-name { font-weight: 700; font-size: 0.94rem; }
.goal-deadline { font-size: 0.75rem; color: var(--text-muted); }
.goal-actions { display: flex; gap: 6px; align-items: center; }

/* ===== RECURRING ===== */
.recurring-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}
.rec-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rec-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rec-title { font-weight: 700; font-size: 0.95rem; }
.rec-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.rec-amount { font-size: 1.15rem; font-weight: 800; }
.rec-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

/* ===== BACKUP ===== */
.backup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.danger-panel { border-color: rgba(244, 63, 94, 0.25); }
.file-btn { cursor: pointer; }

/* ===== MODALS ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 60;
}
.modal {
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  animation: modalIn 170ms ease;
}
.modal.sm { max-width: 380px; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 1.05rem; font-weight: 800; }
.modal-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.seg-btn {
  padding: 9px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.seg-btn.active.expense { background: var(--expense-soft); color: var(--expense); }
.seg-btn.active.income { background: var(--income-soft); color: var(--income); }

.amount-hero {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}
.currency-prefix { font-size: 1.1rem; font-weight: 700; color: var(--text-muted); }
.amount-hero input {
  width: 190px;
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  border: none;
  background: transparent;
  outline: none;
  text-align: left;
}

.field { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.field label { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); }
.field input[type="text"],
.field input[type="date"],
.field input[type="month"],
.field input[type="number"],
.field select,
.input-money {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  font-size: 0.88rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.field input:focus, .field select:focus, .input-money:focus { border-color: var(--accent); }
.input-money.sm { width: 130px; padding: 7px 10px; font-family: var(--font-mono); }
.color-input { width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg-subtle); padding: 3px; cursor: pointer; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.cat-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}
.cat-chip:hover { border-color: var(--border-strong); color: var(--text); }
.cat-chip.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}
.cat-chip-dot { width: 8px; height: 8px; border-radius: 50%; }

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.modal-foot-right { display: flex; gap: 8px; }

/* ===== EMPTY STATES ===== */
.empty-box {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.empty-box strong { display: block; color: var(--text); font-size: 0.98rem; margin-bottom: 4px; }

/* ===== TOASTS ===== */
.toast-wrap {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-modal);
  animation: fadeIn 180ms ease;
}

/* ===== MOBILE NAV ===== */
.mobile-nav { display: none; }
.mobile-only-btn { display: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .backup-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .desktop-add-btn { display: none; }
  .mobile-brand { display: flex; }
  .mobile-brand .brand-name { display: none; }
  .mobile-only-btn { display: grid; }
  .topbar { padding: 0 12px; height: 56px; gap: 8px; }
  .topbar-left { gap: 8px; min-width: 0; }
  .topbar-actions { gap: 2px; flex-shrink: 0; }
  .topbar .icon-btn { width: 32px; height: 32px; }
  .month-switcher { padding: 2px; gap: 0; }
  .month-label { min-width: 0; font-size: 0.78rem; padding: 4px 6px; white-space: nowrap; }
  .demo-banner { margin: 12px 14px 0; }
  .content { padding: 16px 14px 96px; }
  .kpi-grid { gap: 10px; }
  .kpi-card { padding: 13px; }
  .kpi-head { flex-wrap: wrap; gap: 4px; }
  .kpi-badge { font-size: 0.66rem; padding: 2px 6px; white-space: nowrap; }
  .kpi-value { font-size: 1.2rem; }
  .donut-layout { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .toast-wrap { bottom: 84px; right: 14px; left: 14px; }

  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 66px;
    padding: 0 6px env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 40;
  }
  .m-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    height: 100%;
  }
  .m-nav-item.active { color: var(--accent); }
  [data-theme="dark"] .m-nav-item.active { color: #A5B4FC; }

  .m-fab {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: #fff;
    display: grid;
    place-items: center;
    margin: 0 auto;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.42);
    transform: translateY(-6px);
  }
}
