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

:root {
  --primary: #2e7d32;
  --primary-dark: #1b5e20;
  --primary-light: #4caf50;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #212121;
  --text-secondary: #757575;
  --border: #e0e0e0;
  --error: #d32f2f;
  --success: #388e3c;
  --donated: #9e9e9e;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 32px;
}

.hidden {
  display: none !important;
}

/* Login Screen */
#login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
}

#login-screen h1 {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

#login-form {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#login-form input {
  padding: 14px 16px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

#login-form input:focus {
  border-color: var(--primary);
}

#login-form button {
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

#login-form button:hover {
  background: var(--primary-dark);
}

.error {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 8px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

header h1 {
  font-size: 1.5rem;
  color: var(--primary);
}

.icon-btn {
  padding: 8px 12px;
  font-size: 0.875rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--border);
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h2 {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.card h3 {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 12px;
}

/* Current Month Display */
.amount-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

#current-total {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
}

.currency {
  font-size: 1.5rem;
  color: var(--text-secondary);
}

.entry-count {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* Quick Add Buttons */
.quick-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.quick-btn {
  padding: 12px 8px;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--primary-light);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-btn:hover {
  background: var(--primary);
  transform: scale(1.02);
}

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

#custom-amount-form {
  display: flex;
  gap: 8px;
}

#custom-amount-form input {
  flex: 1;
  padding: 10px 12px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  outline: none;
}

#custom-amount-form input:focus {
  border-color: var(--primary);
}

#custom-amount-form button {
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#custom-amount-form button:hover {
  background: var(--primary-dark);
}

/* Entry List */
.entry-list {
  list-style: none;
}

.entry-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.entry-list li:last-child {
  border-bottom: none;
}

.entry-time {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.entry-amount {
  font-weight: 600;
}

.entry-delete {
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.875rem;
  opacity: 0.6;
}

.entry-delete:hover {
  opacity: 1;
}

.empty-message {
  color: var(--text-secondary);
  font-style: italic;
  text-align: center;
  padding: 16px 0;
}

/* History */
.history-month {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.history-month:last-child {
  border-bottom: none;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.history-month-name {
  font-weight: 600;
}

.history-amount {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.history-amount.donated {
  color: var(--donated);
  text-decoration: line-through;
}

.history-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.donate-btn {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.donate-btn:hover {
  background: var(--primary-dark);
}

.donated-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #e8f5e9;
  color: var(--success);
  border-radius: 4px;
}

/* Loading Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive */
@media (max-width: 360px) {
  .quick-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

  #current-total {
    font-size: 2.5rem;
  }
}
