:root {
  --olive-900: #2f3817;
  --olive-700: #4f5d26;
  --olive-500: #6b7d35;
  --olive-100: #e4e9cf;
  --cream: #f7f4e9;
  --pink-500: #e7588f;
  --pink-600: #d24379;
  --pink-300: #f4a6c3;
  --pink-100: #fde4ee;
  --ink: #26301a;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Header */
.top {
  background: var(--olive-700);
  color: var(--cream);
  padding: 28px 0 40px;
  border-bottom: 6px solid var(--pink-300);
}
.top h1 { margin: 0; font-family: "Fraunces", serif; font-size: 2.2rem; }
.top h1 span { color: var(--pink-300); }
.tagline { margin: 4px 0 0; opacity: 0.85; }

/* Layout */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: -20px;
  padding-bottom: 30px;
}
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 6px 18px rgba(47, 56, 23, 0.1);
}
.card.wide { grid-column: 1 / -1; }
.card h2 {
  margin: 0 0 14px;
  font-family: "Fraunces", serif;
  color: var(--olive-700);
  font-size: 1.25rem;
}

/* Summary */
.summary { background: var(--olive-100); }
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.month-nav h2 { margin: 0; }
.icon-btn {
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: #fff; color: var(--olive-700);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--pink-100); color: var(--pink-600); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.numbers { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-bottom: 14px; }
.label { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--olive-500); }
.numbers strong { font-size: 1.5rem; color: var(--olive-900); }
.numbers strong.over { color: var(--pink-600); }

.bar { height: 14px; background: #fff; border-radius: 999px; overflow: hidden; }
.bar-fill {
  height: 100%; width: 0;
  background: var(--olive-500);
  border-radius: 999px;
  transition: width 0.4s ease, background 0.4s ease;
}
.bar-fill.warn { background: var(--pink-300); }
.bar-fill.over { background: var(--pink-500); }

.alert {
  margin: 10px 0 0; padding: 8px 12px;
  border-radius: 10px;
  background: var(--pink-100); color: #9b1f55;
  font-weight: 500;
}
.budget-field { display: block; margin-top: 16px; }

/* Forms */
form { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: 0.9rem; font-weight: 500; }
label.inline { display: block; }
input, select {
  font: inherit;
  padding: 10px 12px;
  border: 2px solid var(--olive-100);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus, .btn:focus-visible, .del:focus-visible,
.edit:focus-visible, .icon-btn:focus-visible {
  outline: 3px solid var(--pink-300);
  outline-offset: 1px;
  border-color: var(--pink-500);
}

.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }

.btn {
  font: inherit; font-weight: 700;
  padding: 12px;
  border: 2px solid var(--pink-500);
  border-radius: 12px;
  background: var(--pink-500); color: #fff;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease;
}
.btn:hover { background: var(--pink-600); border-color: var(--pink-600); }
.btn:active { transform: scale(0.98); }
.btn.ghost { background: transparent; color: var(--olive-700); border-color: var(--olive-500); }
.btn.ghost:hover { background: var(--olive-100); border-color: var(--olive-500); }
.btn.danger { background: transparent; color: var(--pink-600); border-color: var(--pink-300); }
.btn.danger:hover { background: var(--pink-100); border-color: var(--pink-500); }
.btn.small { padding: 8px 14px; font-size: 0.9rem; }

/* Chart + breakdown */
.chart-wrap { position: relative; height: 210px; margin-bottom: 16px; }
.cat-row { margin-bottom: 12px; }
.cat-head { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 4px; }
.cat-track { height: 10px; background: var(--olive-100); border-radius: 999px; overflow: hidden; }
.cat-fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.swatch {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 6px;
}

/* List */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.list-head h2 { margin: 0; }
.list-head label { width: 190px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--olive-100);
}
.list li.editing { background: var(--pink-100); border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.pill {
  background: var(--pink-100); color: #9b1f55;
  padding: 2px 10px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; white-space: nowrap;
}
.info { flex: 1; min-width: 0; }
.info span { display: block; overflow-wrap: anywhere; }
.info small { display: block; color: var(--olive-500); }
.amt { font-weight: 700; color: var(--olive-900); white-space: nowrap; }
.edit, .del {
  border: 0; background: transparent;
  font-size: 1.1rem; cursor: pointer;
  border-radius: 8px; padding: 4px 8px;
}
.edit { color: var(--olive-500); }
.edit:hover { background: var(--olive-100); }
.del { color: var(--pink-500); }
.del:hover { background: var(--pink-100); }
.empty { color: var(--olive-500); text-align: center; margin: 10px 0; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 16px; padding-top: 16px;
  border-top: 2px dashed var(--olive-100);
}

.foot { text-align: center; padding: 20px; color: var(--olive-500); font-size: 0.9rem; }

[hidden] { display: none !important; }

/* Mobile */
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .numbers strong { font-size: 1.3rem; }
  .list-head { flex-direction: column; align-items: stretch; }
  .list-head label { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
