/* ============================================
   Budget Buddy - Design System
   Material Design Mobile App Styling
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables */
:root {
  --primary: #4CAF50;
  --primary-dark: #388E3C;
  --primary-light: #C8E6C9;
  --primary-ripple: rgba(76, 175, 80, 0.2);
  --secondary: #8BC34A;
  --secondary-dark: #689F38;
  --accent: #CDDC39;
  --accent-dark: #AFB42B;

  --bg: #F5F5F5;
  --surface: #FFFFFF;
  --surface-variant: #F0F0F0;
  --on-primary: #FFFFFF;
  --on-surface: #1C1C1E;
  --on-surface-secondary: #6B6B6B;
  --on-surface-tertiary: #9E9E9E;
  --divider: #E0E0E0;
  --error: #F44336;
  --error-light: #FFEBEE;
  --warning: #FF9800;
  --income: #4CAF50;
  --expense: #F44336;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.05);
  --shadow-fab: 0 6px 16px rgba(76,175,80,0.35);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50%;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --appbar-height: 56px;
  --bottomnav-height: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--on-surface);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

/* App Shell */
.app-shell {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
}

/* Top App Bar */
.app-bar {
  height: var(--appbar-height);
  min-height: var(--appbar-height);
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  position: relative;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.app-bar__title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.app-bar__action {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--on-primary);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 20px;
}

.app-bar__back {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--on-primary);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 22px;
}

/* Screen Container */
.screen-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 80px;
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  background: var(--bg);
}

.screen.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  z-index: 1;
}

.screen.slide-left {
  transform: translateX(-30px);
}

/* Bottom Navigation */
.bottom-nav {
  height: var(--bottomnav-height);
  min-height: var(--bottomnav-height);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid var(--divider);
  position: relative;
  z-index: 100;
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 0;
  border: none;
  background: transparent;
  color: var(--on-surface-tertiary);
  cursor: pointer;
  transition: color 0.2s ease;
  position: relative;
  min-height: 48px;
}

.bottom-nav__item.active {
  color: var(--primary);
}

.bottom-nav__icon {
  font-size: 24px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.bottom-nav__item.active .bottom-nav__icon {
  transform: scale(1.1);
}

.bottom-nav__label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* FAB */
.fab {
  position: fixed;
  bottom: calc(var(--bottomnav-height) + 16px + var(--safe-bottom));
  right: calc(50% - 240px + 16px);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  box-shadow: var(--shadow-fab);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  z-index: 90;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (max-width: 480px) {
  .fab {
    right: 16px;
  }
}

.fab:active {
  transform: scale(0.92);
  box-shadow: 0 3px 8px rgba(76,175,80,0.3);
}

.fab.hidden {
  transform: scale(0);
  pointer-events: none;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin: 8px 16px;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-md);
}

.card--elevated {
  box-shadow: var(--shadow-md);
}

/* Dashboard Styles */
.dashboard-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--on-primary);
  padding: 20px 16px;
  margin: 0;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  position: relative;
  overflow: hidden;
}

.dashboard-header::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}

.dashboard-greeting {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.dashboard-balance-label {
  font-size: 13px;
  opacity: 0.8;
  margin-bottom: 4px;
}

.dashboard-balance {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.dashboard-summary {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.summary-card {
  flex: 1;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  padding: 12px;
}

.summary-card__icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.summary-card__label {
  font-size: 11px;
  opacity: 0.85;
}

.summary-card__value {
  font-size: 18px;
  font-weight: 600;
  margin-top: 2px;
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}

.section-header__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--on-surface);
}

.section-header__action {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

/* Transaction List Item */
.transaction-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 12px;
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease;
}

.transaction-item:active {
  background: var(--surface-variant);
}

.transaction-item + .transaction-item {
  border-top: 1px solid var(--divider);
}

.transaction-item__icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.transaction-item__info {
  flex: 1;
  min-width: 0;
}

.transaction-item__title {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transaction-item__subtitle {
  font-size: 12px;
  color: var(--on-surface-secondary);
  margin-top: 2px;
}

.transaction-item__amount {
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}

.transaction-item__amount.income {
  color: var(--income);
}

.transaction-item__amount.expense {
  color: var(--expense);
}

.transaction-item__chevron {
  color: var(--on-surface-tertiary);
  font-size: 18px;
  flex-shrink: 0;
}

/* Category Icons */
.cat-food { background: #FFF3E0; color: #E65100; }
.cat-transport { background: #E3F2FD; color: #1565C0; }
.cat-shopping { background: #FCE4EC; color: #AD1457; }
.cat-entertainment { background: #F3E5F5; color: #7B1FA2; }
.cat-bills { background: #E8EAF6; color: #283593; }
.cat-health { background: #E8F5E9; color: #2E7D32; }
.cat-salary { background: #E8F5E9; color: #2E7D32; }
.cat-investment { background: #FFF8E1; color: #F57F17; }
.cat-other { background: #ECEFF1; color: #455A64; }

/* Search Bar */
.search-bar {
  margin: 12px 16px;
  position: relative;
}

.search-bar__input {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--surface);
  padding: 0 16px 0 44px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--on-surface);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: box-shadow 0.2s ease;
}

.search-bar__input:focus {
  box-shadow: var(--shadow-md);
}

.search-bar__input::placeholder {
  color: var(--on-surface-tertiary);
}

.search-bar__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--on-surface-tertiary);
}

/* Filter Chips */
.filter-chips {
  display: flex;
  gap: 8px;
  padding: 0 16px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  border: 1.5px solid var(--divider);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--on-surface-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chip.active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

/* Bottom Sheet / Modal */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 100%);
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 201;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bottom-sheet.active {
  transform: translate(-50%, 0);
}

.bottom-sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--divider);
  margin: 10px auto 0;
}

.bottom-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
}

.bottom-sheet__title {
  font-size: 18px;
  font-weight: 600;
}

.bottom-sheet__close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--surface-variant);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 18px;
  color: var(--on-surface-secondary);
}

.bottom-sheet__body {
  padding: 8px 20px 32px;
}

/* Form Controls */
.form-group {
  position: relative;
  margin-bottom: 20px;
}

.form-group__input {
  width: 100%;
  height: 52px;
  border: 1.5px solid var(--divider);
  border-radius: var(--radius-md);
  padding: 16px 14px 0;
  font-size: 15px;
  font-family: var(--font);
  color: var(--on-surface);
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s ease;
}

.form-group__input:focus {
  border-color: var(--primary);
}

.form-group__input.error {
  border-color: var(--error);
}

.form-group__label {
  position: absolute;
  left: 14px;
  top: 16px;
  font-size: 15px;
  color: var(--on-surface-tertiary);
  pointer-events: none;
  transition: all 0.2s ease;
  background: var(--surface);
  padding: 0 4px;
}

.form-group__input:focus ~ .form-group__label,
.form-group__input.has-value ~ .form-group__label {
  top: -8px;
  font-size: 12px;
  color: var(--primary);
}

.form-group__input.error ~ .form-group__label {
  color: var(--error);
}

.form-group__error {
  font-size: 12px;
  color: var(--error);
  margin-top: 4px;
  padding-left: 14px;
  display: none;
}

.form-group__input.error ~ .form-group__error {
  display: block;
}

.form-group select.form-group__input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%239E9E9E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 40px;
}

select.form-group__input option {
  font-family: var(--font);
}

.form-group textarea.form-group__input {
  height: 80px;
  resize: none;
  padding-top: 20px;
}

/* Category select chips in form */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.category-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--divider);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 11px;
  font-family: var(--font);
  color: var(--on-surface-secondary);
}

.category-chip .cat-icon {
  font-size: 22px;
}

.category-chip.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* Type Toggle */
.type-toggle {
  display: flex;
  background: var(--surface-variant);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 20px;
}

.type-toggle__btn {
  flex: 1;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  color: var(--on-surface-secondary);
  transition: all 0.25s ease;
}

.type-toggle__btn.active {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--on-surface);
}

.type-toggle__btn.active.expense-active {
  color: var(--expense);
}

.type-toggle__btn.active.income-active {
  color: var(--income);
}

/* Primary Button */
.btn-primary {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  margin-top: 8px;
}

.btn-primary:active {
  transform: scale(0.98);
  background: var(--primary-dark);
}

.btn-secondary {
  width: 100%;
  height: 50px;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--primary);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--error);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-danger:active {
  transform: scale(0.98);
}

/* Dialog */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 24px;
}

.dialog-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 320px;
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.dialog-overlay.active .dialog {
  transform: scale(1);
}

.dialog__title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.dialog__message {
  font-size: 14px;
  color: var(--on-surface-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.dialog__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.dialog__btn {
  height: 38px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.dialog__btn--cancel {
  background: transparent;
  color: var(--on-surface-secondary);
}

.dialog__btn--danger {
  background: var(--error);
  color: #fff;
}

.dialog__btn--primary {
  background: var(--primary);
  color: var(--on-primary);
}

/* Snackbar */
.snackbar {
  position: fixed;
  bottom: calc(var(--bottomnav-height) + 16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #323232;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 400;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: calc(100% - 32px);
  text-align: center;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}

.snackbar.active {
  transform: translateX(-50%) translateY(0);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
}

.empty-state__icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--on-surface);
  margin-bottom: 8px;
}

.empty-state__message {
  font-size: 14px;
  color: var(--on-surface-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.empty-state__btn {
  height: 42px;
  padding: 0 24px;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-line--short {
  width: 60%;
}

.skeleton-circle {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
}

/* Budget Card */
.budget-card {
  padding: 16px;
}

.budget-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.budget-card__category {
  display: flex;
  align-items: center;
  gap: 10px;
}

.budget-card__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.budget-card__name {
  font-size: 15px;
  font-weight: 500;
}

.budget-card__amount {
  font-size: 13px;
  color: var(--on-surface-secondary);
}

.budget-card__progress {
  height: 8px;
  background: var(--surface-variant);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.budget-card__bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.budget-card__bar--safe { background: var(--primary); }
.budget-card__bar--warning { background: var(--warning); }
.budget-card__bar--danger { background: var(--error); }

.budget-card__footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--on-surface-secondary);
}

/* Reports */
.report-period {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
}

.period-btn {
  height: 34px;
  padding: 0 16px;
  border: 1.5px solid var(--divider);
  border-radius: 17px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--on-surface-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.period-btn.active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

/* Chart containers */
.chart-card {
  padding: 16px;
}

.chart-card__title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-chart__item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-chart__label {
  width: 80px;
  font-size: 12px;
  color: var(--on-surface-secondary);
  text-align: right;
  flex-shrink: 0;
}

.bar-chart__track {
  flex: 1;
  height: 22px;
  background: var(--surface-variant);
  border-radius: 11px;
  overflow: hidden;
}

.bar-chart__fill {
  height: 100%;
  border-radius: 11px;
  transition: width 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  min-width: 30px;
}

/* Donut chart (CSS) */
.donut-container {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 0;
}

.donut {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.donut__center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut__center-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--on-surface);
}

.donut__center-label {
  font-size: 10px;
  color: var(--on-surface-secondary);
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-value {
  margin-left: auto;
  font-weight: 600;
  font-size: 13px;
}

/* Detail View */
.detail-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: 480px;
  left: 50%;
  transform: translateX(-50%) translateX(100%);
  background: var(--bg);
  z-index: 150;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

@media (max-width: 480px) {
  .detail-screen {
    left: 0;
    transform: translateX(100%);
    max-width: 100%;
  }
  .detail-screen.active {
    transform: translateX(0);
  }
}

@media (min-width: 481px) {
  .detail-screen.active {
    transform: translateX(-50%);
  }
}

.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.detail-amount {
  text-align: center;
  padding: 24px 0;
}

.detail-amount__value {
  font-size: 36px;
  font-weight: 700;
}

.detail-amount__value.income { color: var(--income); }
.detail-amount__value.expense { color: var(--expense); }

.detail-amount__type {
  font-size: 13px;
  color: var(--on-surface-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-fields {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.detail-field {
  display: flex;
  padding: 14px 16px;
  gap: 12px;
}

.detail-field + .detail-field {
  border-top: 1px solid var(--divider);
}

.detail-field__icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  color: var(--on-surface-secondary);
}

.detail-field__content {
  flex: 1;
}

.detail-field__label {
  font-size: 12px;
  color: var(--on-surface-tertiary);
  margin-bottom: 2px;
}

.detail-field__value {
  font-size: 15px;
  font-weight: 500;
}

.detail-actions {
  display: flex;
  gap: 12px;
  padding: 16px;
  margin-top: 24px;
}

.detail-actions .btn-secondary,
.detail-actions .btn-danger {
  height: 44px;
  font-size: 14px;
}

/* Stat Cards row */
.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 16px;
  margin-bottom: 4px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.stat-card__label {
  font-size: 12px;
  color: var(--on-surface-secondary);
  margin-bottom: 4px;
}

.stat-card__value {
  font-size: 20px;
  font-weight: 700;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 16px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 4px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: transform 0.15s ease;
}

.quick-action:active {
  transform: scale(0.95);
}

.quick-action__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.quick-action__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--on-surface-secondary);
  text-align: center;
}

/* Month nav for budgets/reports */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 16px;
}

.month-nav__btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--on-surface-secondary);
}

.month-nav__label {
  font-size: 16px;
  font-weight: 600;
  min-width: 140px;
  text-align: center;
}

/* Total budget summary at top */
.budget-summary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--on-primary);
  margin: 0 16px;
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-md);
}

.budget-summary__row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.budget-summary__label {
  font-size: 13px;
  opacity: 0.85;
}

.budget-summary__value {
  font-size: 13px;
  font-weight: 600;
}

.budget-summary__total {
  font-size: 22px;
  font-weight: 700;
  margin: 8px 0;
  text-align: center;
}

.budget-summary__progress {
  height: 8px;
  background: rgba(255,255,255,0.25);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.budget-summary__bar {
  height: 100%;
  border-radius: 4px;
  background: rgba(255,255,255,0.9);
  transition: width 0.5s ease;
}

/* Scrollbar hide */
.screen::-webkit-scrollbar {
  width: 0;
  display: none;
}

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

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

.animate-in {
  animation: slideUp 0.3s ease forwards;
}

/* Date group header */
.date-group {
  padding: 12px 16px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface-secondary);
}

/* Reports summary boxes */
.report-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 0 16px;
  margin-bottom: 8px;
}

.report-summary__item {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.report-summary__label {
  font-size: 11px;
  color: var(--on-surface-secondary);
}

.report-summary__value {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
}

/* Alert badge */
.alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.alert-badge--warning {
  background: #FFF3E0;
  color: #E65100;
}

.alert-badge--danger {
  background: #FFEBEE;
  color: #C62828;
}

.alert-badge--safe {
  background: #E8F5E9;
  color: #2E7D32;
}
