:root {
  --primary-color: #4caf50;
  --primary-dark: #388e3c;
  --secondary-color: #ffc107;
  --debt-color: #f44336;
  --debt-bg: #ffebee;
  --filled-color: #a5d6a7;
  --bg-color: #f7f9fc;
  --card-bg: #ffffff;
  --text-color: #333;
  --light-gray: #e0e0e0;
  --border-radius: 8px;
  --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 1rem;
}

.app-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.8rem;
  margin: 0;
  color: var(--primary-dark);
}

.data-actions button,
.import-label {
  background-color: var(--card-bg);
  color: var(--primary-dark);
  border: 1px solid var(--primary-color);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.data-actions button:hover,
.import-label:hover {
  background-color: var(--primary-color);
  color: white;
}

#import-file {
  display: none;
}

/* --- Cards --- */
.summary-card,
.actions-card,
.history-card {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--box-shadow);
}

/* --- Summary & Progress --- */
.progress-bar {
  background-color: var(--light-gray);
  border-radius: 1rem;
  overflow: hidden;
  height: 20px;
}

.progress {
  background-color: var(--primary-color);
  height: 100%;
  width: 0%;
  transition: width 0.5s ease-in-out;
  border-radius: 1rem;
}

.stats {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  text-align: center;
}

.stats small {
  color: #666;
  font-size: 0.8rem;
}
.stats span {
  font-size: 1.2rem;
  font-weight: 600;
  display: block;
}

/* --- Grid --- */
.grid-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem;
  background-color: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

.grid-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.grid-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
  padding: 0.5rem 0;
  border-bottom: 2px solid var(--light-gray);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.grid-section-title.debt-section {
  color: var(--debt-color);
  border-bottom-color: var(--debt-color);
}

.grid-section-title.savings-section {
  color: var(--primary-dark);
  border-bottom-color: var(--primary-color);
}

.grid-section-title .icon {
  font-size: 1.2rem;
}

.grid-section-subtitle {
  font-size: 0.9rem;
  color: #666;
  margin: 0.2rem 0 0.8rem 0;
  font-weight: normal;
}

.grid-cells {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 8px;
}

.grid-cell {
  width: 100%;
  padding-bottom: 100%; /* Aspect ratio 1:1 */
  position: relative;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: all 0.3s ease;
}
.grid-cell.filled {
  background-color: var(--filled-color);
  border-color: var(--primary-color);
}
.grid-cell.debt {
  background-color: var(--debt-bg);
  border-color: var(--debt-color);
}
.grid-cell.debt.filled {
  background-color: var(--filled-color);
  border-color: var(--primary-color);
}
.grid-cell:hover {
  transform: scale(1.1);
  z-index: 10;
}

.grid-empty-message {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 2rem;
  border: 2px dashed #ddd;
  border-radius: var(--border-radius);
  background-color: #fafafa;
}

.zero-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  margin: 0.5rem 0;
  background: linear-gradient(90deg, var(--debt-color), var(--primary-color));
  border-radius: var(--border-radius);
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.zero-indicator .icon {
  margin-right: 0.5rem;
  font-size: 1.3rem;
}

/* --- Actions --- */
.actions-card h2 {
  margin-top: 0;
}
.form-group {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}
.form-group input {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid var(--light-gray);
  border-radius: var(--border-radius);
  font-size: 1rem;
}
.button-group {
  display: flex;
  gap: 1rem;
}
.button-group button {
  flex-grow: 1;
  padding: 0.8rem;
  border-radius: var(--border-radius);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}
#deposit-btn {
  background-color: var(--primary-color);
  color: white;
}
#deposit-btn:hover {
  background-color: var(--primary-dark);
}
#withdraw-btn {
  background-color: var(--secondary-color);
  color: var(--text-color);
}
#withdraw-btn:hover {
  background-color: #ffb300;
}

/* --- History --- */
.history-card h2 {
  margin-top: 0;
}
#history-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
}
#history-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 0.4rem;
  border-bottom: 1px solid var(--light-gray);
}
#history-list li:last-child {
  border-bottom: none;
}
.history-desc {
  font-weight: 500;
}
.history-amount {
  font-weight: 600;
}
.history-amount.deposit {
  color: var(--primary-dark);
}
.history-amount.withdraw {
  color: var(--debt-color);
}
.history-date {
  color: #888;
  font-size: 0.8rem;
  margin-left: 1rem;
}

.delete-btn {
  background: none;
  border: none;
  color: var(--debt-color);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  font-weight: bold;
  padding: 0 0.5rem;
  margin-left: 0.5rem;
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

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

/* --- Responsive --- */
@media (max-width: 600px) {
  body {
    padding: 0.5rem;
  }
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .form-group,
  .button-group {
    flex-direction: column;
  }
} 