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

body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f4f4f4;
  color: #333;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.dark-mode {
  background: #1a1a2e;
  color: #e0e0e0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #888; border-radius: 3px; }
.dark-mode ::-webkit-scrollbar-thumb { background: #555; }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes checkmark {
  0% { stroke-dashoffset: 50; }
  100% { stroke-dashoffset: 0; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fade-in { animation: fadeIn 0.4s ease-out forwards; }
.animate-fade-in-scale { animation: fadeInScale 0.3s ease-out forwards; }
.animate-slide-left { animation: slideInLeft 0.3s ease-out forwards; }
.animate-slide-right { animation: slideInRight 0.3s ease-out forwards; }
.animate-count-up { animation: countUp 0.6s ease-out forwards; }

.skeleton {
  background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
.dark-mode .skeleton {
  background: linear-gradient(90deg, #2a2a4a 25%, #3a3a5a 50%, #2a2a4a 75%);
  background-size: 200% 100%;
}

/* Card hover */
.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.dark-mode .card-hover:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

/* Focus */
*:focus-visible {
  outline: 2px solid #0056b3;
  outline-offset: 2px;
}

/* Overlay */
.modal-overlay {
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}

/* Transaction row */
.tx-row { transition: background-color 0.15s ease; }
.tx-row:hover { background-color: rgba(0,86,179,0.04); }
.dark-mode .tx-row:hover { background-color: rgba(255,255,255,0.04); }

/* Category chips */
.chip {
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
}
.chip:hover { transform: scale(1.05); }
.chip.active {
  background: #012169;
  color: white;
}
.dark-mode .chip.active {
  background: #0056b3;
}

/* Buttons */
.btn-primary {
  background: #012169;
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
  font-family: inherit;
  font-size: 14px;
}
.btn-primary:hover { background: #0056b3; }
.btn-primary:active { transform: scale(0.98); }
.dark-mode .btn-primary { background: #0056b3; }
.dark-mode .btn-primary:hover { background: #0067d6; }

.btn-secondary {
  background: transparent;
  color: #012169;
  border: 1.5px solid #012169;
  padding: 8px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  font-size: 14px;
}
.btn-secondary:hover { background: #012169; color: white; }
.dark-mode .btn-secondary { color: #6da3e0; border-color: #6da3e0; }
.dark-mode .btn-secondary:hover { background: #0056b3; color: white; border-color: #0056b3; }

/* Input */
.input-field {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: white;
  color: #333;
}
.input-field:focus {
  border-color: #0056b3;
  box-shadow: 0 0 0 3px rgba(0,86,179,0.1);
  outline: none;
}
.dark-mode .input-field {
  background: #1e2a4a;
  border-color: #3a4a6a;
  color: #e0e0e0;
}
.dark-mode .input-field:focus {
  border-color: #6da3e0;
  box-shadow: 0 0 0 3px rgba(109,163,224,0.15);
}

/* Progress bar */
.progress-bar {
  height: 8px;
  border-radius: 4px;
  background: #e0e0e0;
  overflow: hidden;
}
.dark-mode .progress-bar { background: #2a2a4a; }
.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease-out;
}

/* Mobile nav */
@media (max-width: 639px) {
  .desktop-nav { display: none; }
}
@media (min-width: 640px) {
  .mobile-menu-btn { display: none; }
}

/* Tab indicator */
.tab-active {
  border-bottom: 3px solid white;
  padding-bottom: 1px;
}
.dark-mode .tab-active {
  border-bottom-color: #6da3e0;
}