/* =====================================================
   Budget Buddy - Mobile App CSS
   ===================================================== */

/* --- CSS Variables --- */
:root {
  --primary: #4CAF50;
  --primary-dark: #388E3C;
  --primary-light: #C8E6C9;
  --secondary: #FFEB3B;
  --secondary-dark: #F9A825;
  --accent: #F44336;
  --accent-light: #FFCDD2;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --surface2: #F0F4F0;
  --on-primary: #FFFFFF;
  --text-primary: #1A1A2E;
  --text-secondary: #666E7A;
  --text-hint: #9EA5B0;
  --divider: #E8ECEF;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --bar-height: 56px;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 0; }

/* --- Utility --- */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }

/* =====================================================
   TOP APP BAR
   ===================================================== */
.app-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--bar-height);
  background: var(--primary);
  display: flex;
  align-items: center;
  padding: 0 4px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(76,175,80,0.25);
}

.app-bar-title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--on-primary);
  letter-spacing: 0.2px;
}

.app-bar-actions {
  display: flex;
  align-items: center;
}

/* =====================================================
   ICON BUTTONS
   ===================================================== */
.icon-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--on-primary);
  transition: background var(--transition);
  position: relative;
  overflow: hidden;
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:active { background: rgba(255,255,255,0.2); }

.icon-btn-sm {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 14px;
  transition: background var(--transition);
}
.icon-btn-sm svg { width: 18px; height: 18px; }
.icon-btn-sm:active { background: var(--divider); }

/* =====================================================
   SEARCH BAR
   ===================================================== */
.search-bar-container {
  position: fixed;
  top: var(--bar-height);
  left: 0; right: 0;
  background: var(--primary-dark);
  padding: 8px 12px;
  z-index: 99;
  transform: translateY(-100%);
  transition: transform var(--transition);
}
.search-bar-container.visible {
  transform: translateY(0);
}
.search-bar {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.15);
  border-radius: 24px;
  padding: 0 12px;
  gap: 8px;
}
.search-icon { width: 18px; height: 18px; color: rgba(255,255,255,0.7); flex-shrink: 0; }
.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: white;
  padding: 10px 0;
  outline: none;
}
.search-input::placeholder { color: rgba(255,255,255,0.6); }

/* =====================================================
   SIDE DRAWER
   ===================================================== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.drawer-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.side-drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 290px;
  background: var(--surface);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}
.side-drawer.open { transform: translateX(0); }

.drawer-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 48px 20px 20px;
}
.drawer-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.drawer-logo-icon {
  font-size: 36px;
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,0.2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.drawer-app-name {
  font-size: 20px;
  font-weight: 700;
  color: white;
}
.drawer-app-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  margin-top: 2px;
}

.drawer-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-hint);
  padding: 16px 20px 6px;
}

.drawer-nav {
  list-style: none;
}

.drawer-nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  cursor: pointer;
  border-radius: 0 28px 28px 0;
  margin-right: 12px;
  transition: background var(--transition), color var(--transition);
  color: var(--text-secondary);
  font-weight: 500;
  position: relative;
  overflow: hidden;
}
.drawer-nav-item:hover { background: var(--surface2); }
.drawer-nav-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}
.drawer-nav-item.active .drawer-nav-icon { color: var(--primary); }

.drawer-nav-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.drawer-nav-icon svg { width: 22px; height: 22px; }
.drawer-nav-label { font-size: 14px; }

/* =====================================================
   MAIN CONTENT & SCREENS
   ===================================================== */
.main-content {
  position: fixed;
  top: var(--bar-height);
  bottom: var(--bar-height);
  left: 0; right: 0;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(20px);
  transition: opacity var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
}

.screen-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}

.screen--chat {
  display: flex;
  flex-direction: column;
}

/* =====================================================
   BOTTOM NAVIGATION
   ===================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bar-height);
  background: var(--surface);
  display: flex;
  border-top: 1px solid var(--divider);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.07);
  z-index: 100;
}

.nav-item {
  flex: 1;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: var(--text-hint);
  transition: color var(--transition);
  position: relative;
  padding: 6px 4px;
}
.nav-item::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
  transition: width var(--transition);
}
.nav-item.active::before { width: 40px; }
.nav-item.active { color: var(--primary); }
.nav-item.active .nav-icon { background: var(--primary-light); }

.nav-icon {
  width: 36px;
  height: 26px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.nav-icon svg { width: 20px; height: 20px; }
.nav-label { font-size: 10px; font-weight: 600; }

/* =====================================================
   CARDS & SURFACES
   ===================================================== */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px 6px;
}
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.text-btn {
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}

/* =====================================================
   STAT CARDS
   ===================================================== */
.stats-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.stat-card {
  flex: 1;
  border-radius: var(--radius-md);
  padding: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stat-card--green { background: linear-gradient(135deg, #43A047, #66BB6A); color: white; }
.stat-card--red   { background: linear-gradient(135deg, #E53935, #EF5350); color: white; }
.stat-card--blue  { background: linear-gradient(135deg, #1E88E5, #42A5F5); color: white; }
.stat-card--yellow{ background: linear-gradient(135deg, #F9A825, #FFCA28); color: white; }

.stat-label { font-size: 11px; font-weight: 600; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 22px; font-weight: 800; margin-top: 4px; }
.stat-icon { position: absolute; right: 12px; top: 12px; font-size: 26px; opacity: 0.3; }

/* =====================================================
   AI COMPONENTS
   ===================================================== */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #6C63FF, #9C27B0);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.ai-card {
  background: linear-gradient(135deg, #1A1A2E 0%, #16213E 100%);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 10px;
  border: 1px solid rgba(108,99,255,0.3);
}
.ai-card-content { color: rgba(255,255,255,0.9); font-size: 14px; line-height: 1.6; min-height: 60px; }
.ai-placeholder {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.45);
  font-size: 13px;
}
.ai-placeholder svg { opacity: 0.5; flex-shrink: 0; }

.ai-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #6C63FF, #9C27B0);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: transform 0.1s, opacity 0.15s;
}
.ai-btn:active { transform: scale(0.97); opacity: 0.9; }

.ai-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  overflow-x: auto;
}
.ai-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #6C63FF, #9C27B0);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.1s;
}
.ai-action-btn:active { transform: scale(0.97); }

.ai-result-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border-left: 4px solid #6C63FF;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.ai-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ai-result-content {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 14px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--divider);
  border-top-color: #6C63FF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Shimmer */
.shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.ai-suggestions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 8px;
  overflow-x: auto;
}
.ai-suggestions-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
}
.ai-suggestions-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

/* =====================================================
   FILTER CHIPS
   ===================================================== */
.filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}
.chip {
  border: 1.5px solid var(--divider);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.chip--active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.chip--ai {
  background: linear-gradient(135deg, #6C63FF20, #9C27B020);
  border-color: #6C63FF40;
  color: #6C63FF;
  font-weight: 600;
}

/* =====================================================
   TOTAL BAR
   ===================================================== */
.total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 14px;
}
.total-amount {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
}
.total-amount--green { color: var(--primary); }

/* =====================================================
   TRANSACTION LIST ITEMS
   ===================================================== */
.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  position: relative;
  overflow: hidden;
}
.tx-item:active { transform: scale(0.99); box-shadow: none; }

.tx-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.tx-icon--expense { background: #FFEBEE; }
.tx-icon--income  { background: #E8F5E9; }

.tx-info { flex: 1; min-width: 0; }
.tx-category { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.tx-date { font-size: 12px; color: var(--text-hint); margin-top: 2px; }
.tx-notes { font-size: 12px; color: var(--text-secondary); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tx-amount {
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.tx-amount--expense { color: var(--accent); }
.tx-amount--income  { color: var(--primary); }

.tx-chevron {
  color: var(--text-hint);
  flex-shrink: 0;
}
.tx-chevron svg { width: 16px; height: 16px; }

/* Ripple */
.tx-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.04);
  opacity: 0;
  transition: opacity 0.15s;
}
.tx-item:active::after { opacity: 1; }

/* =====================================================
   BUDGET COMPONENTS
   ===================================================== */
.budget-summary-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.budget-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-secondary);
}
.budget-summary-row--total {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}
.budget-divider {
  height: 1px;
  background: var(--divider);
  margin: 4px 0;
}
.amount-green { color: var(--primary); font-weight: 700; }
.amount-red   { color: var(--accent); font-weight: 700; }

.budget-goal-item {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.budget-goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.budget-goal-category { font-weight: 700; font-size: 14px; }
.budget-goal-amounts { font-size: 13px; color: var(--text-secondary); }
.budget-goal-amounts span { font-weight: 700; color: var(--text-primary); }
.budget-goal-actions { display: flex; gap: 4px; }

.progress-bar-track {
  height: 8px;
  background: var(--divider);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}
.progress-bar-fill--safe   { background: var(--primary); }
.progress-bar-fill--warn   { background: var(--secondary-dark); }
.progress-bar-fill--danger { background: var(--accent); }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-hint);
  margin-top: 4px;
}

/* =====================================================
   CHARTS
   ===================================================== */
.chart-card { overflow: hidden; }
.chart-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; }

/* Bar Chart */
.bar-chart-container, .mini-bar-chart {
  width: 100%;
  overflow: hidden;
}
.bar-chart-svg { width: 100%; }

/* Horizontal Bar Chart */
.h-bar-chart-container { width: 100%; }
.h-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.h-bar-label { font-size: 12px; color: var(--text-secondary); width: 90px; flex-shrink: 0; font-weight: 500; }
.h-bar-track { flex: 1; height: 10px; background: var(--divider); border-radius: 5px; overflow: hidden; }
.h-bar-fill { height: 100%; border-radius: 5px; background: var(--primary); transition: width 0.5s ease; }
.h-bar-value { font-size: 12px; font-weight: 700; color: var(--text-primary); width: 60px; text-align: right; flex-shrink: 0; }

/* Line Chart */
.line-chart-container { width: 100%; }

/* Donut Chart */
.donut-chart-container {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.donut-svg { flex-shrink: 0; }
.donut-legend { flex: 1; min-width: 120px; }
.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}
.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.donut-legend-label { flex: 1; color: var(--text-secondary); }
.donut-legend-value { font-weight: 700; color: var(--text-primary); }

/* =====================================================
   EMPTY STATES
   ===================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 8px;
}
.empty-icon { font-size: 52px; margin-bottom: 4px; }
.empty-title { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.empty-sub { font-size: 13px; color: var(--text-hint); line-height: 1.5; max-width: 220px; }
.empty-state .btn { margin-top: 12px; }

.empty-inline {
  text-align: center;
  padding: 16px;
  color: var(--text-hint);
  font-size: 13px;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 24px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s, background 0.15s;
  min-height: 44px;
}
.btn:active { transform: scale(0.97); opacity: 0.9; }
.btn--primary { background: var(--primary); color: white; box-shadow: 0 3px 10px rgba(76,175,80,0.35); }
.btn--outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn--danger  { background: var(--accent); color: white; box-shadow: 0 3px 10px rgba(244,67,54,0.25); }
.btn--text    { background: transparent; color: var(--text-secondary); }
.btn--sm      { padding: 8px 16px; font-size: 13px; min-height: 36px; }

/* =====================================================
   FAB
   ===================================================== */
.fab {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(244,67,54,0.45);
  z-index: 10;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fab svg { width: 26px; height: 26px; }
.fab:active { transform: scale(0.93); box-shadow: 0 2px 8px rgba(244,67,54,0.3); }

/* =====================================================
   MODALS & BOTTOM SHEETS
   ===================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.bottom-sheet {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 8px 16px 32px;
  animation: slideUp 0.28s cubic-bezier(0.4,0,0.2,1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.bottom-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--divider);
  border-radius: 2px;
  margin: 8px auto 4px;
}
.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 14px;
}
.bottom-sheet-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Dialog */
.modal-overlay.dialog-overlay {
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.dialog-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px;
  width: 100%;
  max-width: 340px;
  animation: scaleIn 0.2s cubic-bezier(0.4,0,0.2,1);
}
@keyframes scaleIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.dialog-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.dialog-body { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* =====================================================
   FORMS
   ===================================================== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  border: 2px solid var(--divider);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition);
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus { border-color: var(--primary); }
.form-input.error { border-color: var(--accent); }
.form-textarea { resize: none; min-height: 70px; }

.input-with-prefix {
  display: flex;
  align-items: center;
  border: 2px solid var(--divider);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition);
}
.input-with-prefix:focus-within { border-color: var(--primary); }
.input-prefix {
  padding: 12px 10px 12px 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface2);
  border-right: 2px solid var(--divider);
}
.input-with-prefix .form-input { border: none; padding-left: 10px; }
.input-with-prefix .form-input:focus { border: none; }

.select-wrapper {
  position: relative;
}
.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}
.form-select { cursor: pointer; padding-right: 36px; }

.field-error { display: block; font-size: 12px; color: var(--accent); margin-top: 4px; font-weight: 500; }
.field-hint { display: block; font-size: 12px; color: var(--text-hint); margin-top: 4px; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.form-actions .btn { flex: 1; }

/* =====================================================
   DETAIL VIEW
   ===================================================== */
.detail-content { padding: 8px 0 12px; }
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
  gap: 12px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 12px; color: var(--text-hint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-value { font-size: 15px; font-weight: 600; color: var(--text-primary); text-align: right; flex: 1; }
.detail-amount { font-size: 28px; font-weight: 800; text-align: center; padding: 16px 0; }
.detail-amount--expense { color: var(--accent); }
.detail-amount--income  { color: var(--primary); }

.detail-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  justify-content: flex-end;
}

/* =====================================================
   CATEGORY BADGE
   ===================================================== */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}
.cat-row:last-child { border-bottom: none; }
.cat-info { display: flex; align-items: center; gap: 10px; }
.cat-icon { font-size: 22px; }
.cat-name { font-size: 14px; font-weight: 600; }
.cat-count { font-size: 12px; color: var(--text-hint); }
.cat-amount { font-weight: 700; font-size: 15px; }

/* =====================================================
   AI CHAT
   ===================================================== */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.chat-bubble {
  display: flex;
  gap: 10px;
  max-width: 85%;
  align-items: flex-end;
}
.chat-bubble--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-bubble--ai { align-self: flex-start; }

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: var(--primary-light);
}

.chat-text {
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
}
.chat-bubble--ai .chat-text {
  background: var(--surface);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}
.chat-bubble--user .chat-text {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-typing .chat-text {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 18px;
}
.typing-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-hint);
  animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-top: 1px solid var(--divider);
  align-items: center;
}
.chat-input {
  flex: 1;
  border: 2px solid var(--divider);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: var(--bg);
  transition: border-color var(--transition);
}
.chat-input:focus { border-color: var(--primary); }
.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s, opacity 0.15s;
}
.chat-send-btn:active { transform: scale(0.9); }
.chat-send-btn svg { width: 20px; height: 20px; }
.chat-send-btn:disabled { background: var(--text-hint); cursor: not-allowed; }

/* =====================================================
   SNACKBAR
   ===================================================== */
.snackbar {
  position: fixed;
  bottom: calc(var(--bar-height) + 12px);
  left: 16px;
  right: 16px;
  background: #323232;
  color: white;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  z-index: 500;
  box-shadow: var(--shadow-md);
  animation: snackSlide 0.3s cubic-bezier(0.4,0,0.2,1);
}
@keyframes snackSlide { from { transform: translateY(100px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.snackbar.hidden { display: none; }
.snackbar-action {
  background: transparent;
  border: none;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: 8px;
}

/* =====================================================
   USAGE PROGRESS BARS
   ===================================================== */
.usage-progress-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}
.usage-progress-item:last-child { border-bottom: none; }
.usage-progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}
.usage-progress-label { color: var(--text-primary); }
.usage-progress-pct { color: var(--text-secondary); }
