:root {
  --bg: #e8efe9;
  --bg-deep: #d5e2d8;
  --ink: #1a2b24;
  --muted: #5a6f66;
  --panel: rgba(255, 252, 248, 0.92);
  --line: rgba(26, 43, 36, 0.12);
  --accent: #1f6b52;
  --accent-2: #c45c26;
  --ok: #1f6b52;
  --danger: #a33b3b;
  --shadow: 0 18px 50px rgba(26, 43, 36, 0.08);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #b7d4c4 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, #f0d7c4 0%, transparent 45%),
    linear-gradient(160deg, var(--bg), var(--bg-deep));
  background-attachment: fixed;
}

.hidden { display: none !important; }
h1, h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}
h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
h2 { font-size: 1.35rem; }
p { margin: 0 0 0.75rem; }
button, input, select, textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 0.7rem 1.2rem;
  font-weight: 600;
}
button:hover { filter: brightness(1.05); }
button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(163, 59, 59, 0.35);
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}
label {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: #fff;
  color: var(--ink);
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 500;
}
.checkbox input { width: auto; }

.brand-mark {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.25rem;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 2rem;
  backdrop-filter: blur(8px);
}
.lede { color: var(--muted); }
.error { color: var(--danger); font-weight: 600; }

.main-view {
  width: min(1120px, calc(100% - 2rem));
  margin: 1.25rem auto 3rem;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.25rem;
}
.topbar-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.user-label {
  color: var(--muted);
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.35rem;
  background: rgba(255, 252, 248, 0.55);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
}
.tab {
  background: transparent;
  color: var(--muted);
  padding: 0.55rem 1rem;
}
.tab.active {
  background: var(--ink);
  color: #fff;
}

.panel { display: none; }
.panel.active { display: block; animation: rise 0.35s ease; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.stat, .form-card, .list li {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat { padding: 1.1rem 1.2rem; }
.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}
.stat-value {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
}

.split {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.25rem;
  align-items: start;
}
.form-card { padding: 1.2rem; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}
.list li {
  padding: 0.95rem 1.05rem;
  display: grid;
  gap: 0.35rem;
}
.list-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}
.amount {
  font-family: var(--font-display);
  font-weight: 700;
  white-space: nowrap;
}
.meta {
  color: var(--muted);
  font-size: 0.9rem;
}
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(31, 107, 82, 0.12);
  color: var(--accent);
}
.muted { color: var(--muted); }

.bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}
.bars li {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.bar-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  font-weight: 600;
}
.bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(26, 43, 36, 0.08);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: inherit;
  width: 0;
  transition: width 0.5s ease;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(26, 43, 36, 0.08);
  overflow: hidden;
  margin-top: 0.35rem;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.inline-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: 1fr; }
  .tabs { border-radius: 18px; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: start; }
}
