:root {
  --bg: #14161a;
  --surface: #1e2127;
  --text-primary: #f2f2f0;
  --text-muted: #9a9ea6;
  --spending: #e0a95c;
  --saving: #5cb98a;
  --giving: #c58cd8;
  --success: #5cb98a;
  --pending: #e0a95c;
  --danger: #d97575;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.muted {
  color: var(--text-muted);
}

.total-card {
  display: inline-block;
}

.total-amount {
  font-size: 2rem;
  font-weight: 700;
}

nav {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
}

main {
  padding: 1.5rem;
  max-width: 720px;
  margin: 0 auto;
}

label {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

input,
select {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
}

button {
  margin-top: 1rem;
  padding: 0.6rem 1.2rem;
  background: var(--saving);
  border: none;
  border-radius: 8px;
  color: #0c1410;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.error-text {
  color: var(--danger);
  min-height: 1.2em;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
}

th {
  color: var(--text-muted);
  font-weight: 500;
}

.amount-positive {
  color: var(--success);
}

.amount-negative {
  color: var(--danger);
}

.forms-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.forms-row .card {
  flex: 1;
  min-width: 220px;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.list-row .grow {
  flex: 1;
}

.list-row button {
  margin-top: 0;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

button.secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

button.danger {
  background: var(--danger);
  color: #2a0d0d;
}

section {
  margin-bottom: 2rem;
}

section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.goal-card {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.goal-image {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
}

.goal-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.goal-body {
  flex: 1;
  min-width: 0;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 5px;
  background: var(--bg);
  overflow: hidden;
  margin: 0.4rem 0;
}

.progress-fill {
  height: 100%;
  background: var(--saving);
  border-radius: 5px;
  transition: width 0.3s ease;
}

.goal-inline-form {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.5rem;
}

.goal-inline-form input {
  width: 110px;
  margin-top: 0;
  padding: 0.35rem 0.5rem;
}

.goal-inline-form button {
  margin-top: 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}

.achieved-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--saving);
  font-weight: 600;
}

@keyframes confetti-pop {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  60% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.confetti-burst {
  animation: confetti-pop 0.5s ease-out;
}

@media print {
  nav,
  .no-print {
    display: none !important;
  }
}
