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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #ffffff;
  color: #000000;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
  scrollbar-gutter: stable;
}

/* Container */
.container {
  max-width: 90%;
  margin: 40px auto 0 auto;
  padding: 15px 30px;
}

@media (max-width: 1024px) {
  .container {
    max-width: 95%;
    margin: 40px auto 0 auto;
    padding: 15px 25px;
  }
}

@media (max-width: 768px) {
  .container {
    max-width: 90%;
    margin: 8px auto 0 auto;
    padding: 15px 20px;
    padding-bottom: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .card {
    width: 100%;
    max-width: none;
    margin-bottom: 20px;
  }

  .card:first-of-type {
    padding: 30px 25px;
    margin-bottom: 0px;
  }

  .card:first-of-type h2 {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .card:first-of-type #totalBalance {
    font-size: 48px;
    font-weight: bold;
  }
}

/* Current Balance - Desktop */
@media (min-width: 769px) {
  .card:first-of-type #totalBalance {
    font-size: 52px;
    font-weight: bold;
  }
}

/* Navigation Bar */
nav {
  background: #ffffff;
  border-bottom: 1px solid #e0e0e0;
  padding: 8px 0;
  margin-bottom: 15px;
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 100%;
}

nav .logo {
  font-weight: 600;
  font-size: 13px;
  color: #000000;
  letter-spacing: -0.5px;
}

nav .nav-links {
  display: flex;
  gap: 10px;
  list-style: none;
}

nav a {
  text-decoration: none;
  color: #666666;
  font-size: 16px;
  transition: color 0.2s;
  cursor: pointer;
}

nav a:hover {
  color: #000000;
}

nav a.active {
  color: #000000;
}

/* Mobile Navigation Bar */
@media (max-width: 768px) {
  nav {
    padding: 2px 0;
    margin-bottom: 2px;
  }

  nav .container {
    gap: 8px;
    padding: 0 10px;
  }

  nav .logo {
    font-size: 12px;
    flex-shrink: 0;
  }

  nav .logo i {
    font-size: 20px;
    margin-right: 4px;
  }

  nav .nav-links {
    gap: 15px;
    justify-content: center;
    flex: 1;
  }

  nav a {
    font-size: 25px;
  }
}

/* Cards */
.card {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 15px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-color: #d0d0d0;
}

.card h2 {
  margin-bottom: 15px;
  color: #000000;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

/* Grid Layout */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* Buttons */
button, .btn {
  padding: 10px 18px;
  border: 1px solid #333333;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  font-weight: 500;
  background: #ffffff;
  color: #000000;
}

button:hover, .btn:hover {
  background: #f5f5f5;
  border-color: #000000;
}

button:active {
  background: #e0e0e0;
}

.btn-primary {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}

.btn-primary:hover {
  background: #333333;
  border-color: #333333;
}

.btn-success {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}

.btn-success:hover {
  background: #333333;
}

.btn-danger {
  background: #333333;
  color: #ffffff;
  border-color: #333333;
}

.btn-danger:hover {
  background: #000000;
}

.btn-secondary {
  background: #f5f5f5;
  color: #000000;
  border-color: #e0e0e0;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.btn-small {
  padding: 8px 14px;
  font-size: 12px;
  border-radius: 10px;
}

/* Forms */
input, textarea, select {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #ffffff;
  color: #000000;
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #333333;
  box-shadow: inset 0 0 0 1px #000000;
}

label {
  display: block;
  margin-top: 10px;
  font-weight: 500;
  color: #000000;
  font-size: 13px;
}

.form-group {
  margin-bottom: 15px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  max-height: 85vh;
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: auto;
  pointer-events: auto;
}

#addTransactionModal .modal-content {
  max-width: 80%;
  max-height: 85vh;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666666;
  padding: 0;
  line-height: 1;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 14px;
}

th, td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

th {
  background: #f5f5f5;
  font-weight: 600;
  color: #000000;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:hover {
  background: #f9f9f9;
}

/* Stats Boxes */
.stat-box {
  background: #ffffff;
  padding: 15px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stat-label {
  font-size: 11px;
  color: #999999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 20px;
  font-weight: 600;
  color: #000000;
  margin-top: 8px;
}

/* Colors by type */
.income {
  color: #28a745;
  font-weight: 600;
}

.expense {
  color: #dc3545;
  font-weight: 600;
}

.transfer {
  color: #6c757d;
  font-weight: 500;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.tab-button {
  background: none;
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #999999;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-bottom-color 0.2s;
}

.tab-button.active {
  color: #000000;
  border-bottom-color: #000000;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Progress Bar */
.progress {
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  margin: 10px 0;
}

.progress-bar {
  height: 100%;
  background: #000000;
  transition: width 0.3s;
}

/* Alerts */
.alert {
  padding: 12px 15px;
  margin: 10px 0;
  border-radius: 8px;
  font-size: 14px;
  border-left: 3px solid #000000;
}

.alert-success {
  background: #f5f5f5;
  color: #000000;
  border-left-color: #000000;
}

.alert-danger {
  background: #f5f5f5;
  color: #000000;
  border-left-color: #333333;
}

.alert-info {
  background: #f5f5f5;
  color: #000000;
  border-left-color: #666666;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 30px 20px;
  color: #999999;
}

.empty-state i {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: 0.3;
}

/* Color swatch */
.color-swatch {
  display: inline-block;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #333333;
  vertical-align: middle;
  margin-right: 10px;
}