:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f1e8;
  color: #18221d;
  --ink: #18221d;
  --muted: #5a655f;
  --paper: #fffdf8;
  --line: #cfd7d1;
  --accent: #0f6b4f;
  --accent-dark: #084c38;
  --soft: #e4f2eb;
  --danger: #8b2e2e;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
main { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 72px; }
.hero { max-width: 760px; margin-bottom: 32px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 0.82rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2.7rem, 8vw, 5.4rem); letter-spacing: -0.06em; line-height: 0.95; }
.lede { margin: 18px 0 0; color: var(--muted); font-size: clamp(1.05rem, 2.5vw, 1.3rem); line-height: 1.55; }
.panel { margin-top: 20px; padding: clamp(20px, 4vw, 36px); border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: 0 16px 46px rgb(24 34 29 / 0.07); }
.section-heading, .expense-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
h2, h3 { margin-top: 0; }
h2 { margin-bottom: 8px; font-size: 1.55rem; }
h3 { margin: 28px 0 12px; font-size: 1.05rem; }
p { line-height: 1.5; }
.section-heading p { margin: 0; color: var(--muted); }
.setup-grid { display: grid; grid-template-columns: minmax(160px, 0.45fr) minmax(260px, 1fr); gap: 18px; margin-top: 28px; }
label { display: grid; gap: 7px; color: #34423b; font-size: 0.85rem; font-weight: 750; }
input, textarea, select, button { font: inherit; }
input, textarea, select { width: 100%; border: 1px solid #aebbb4; border-radius: 10px; background: #fff; color: var(--ink); padding: 11px 12px; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 3px solid #8fd5b8; outline-offset: 2px; }
.expenses { display: grid; gap: 12px; }
.expense-row { display: grid; grid-template-columns: 1.2fr 0.8fr 0.65fr 1.25fr auto; gap: 12px; align-items: end; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fafbf8; }
.expense-row legend { padding: 0 6px; color: var(--muted); font-size: 0.8rem; font-weight: 800; }
button { min-height: 44px; border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 800; }
.primary { margin-top: 20px; background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.secondary { border: 1px solid #aebbb4; background: #fff; color: var(--ink); }
.secondary:hover { background: var(--soft); }
.privacy-note { margin: 18px 0 0; color: var(--muted); font-size: 0.9rem; }
.result { border-color: #93c8b1; }
.summary { color: var(--muted); font-weight: 650; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 11px 10px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.transfers { display: grid; gap: 8px; padding-left: 24px; }
.transfers li { padding: 10px 12px; border-radius: 10px; background: var(--soft); font-weight: 700; }
details { margin-top: 24px; }
summary { cursor: pointer; font-weight: 800; }
pre { max-height: 420px; overflow: auto; padding: 16px; border-radius: 12px; background: #101814; color: #dcefe6; font: 0.83rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.error { border-color: #d5a6a6; background: #fff8f6; color: var(--danger); }
.error p { margin-bottom: 0; }

@media (max-width: 860px) {
  .expense-row { grid-template-columns: 1fr 1fr; }
  .expense-row .remove-expense { justify-self: start; }
}

@media (max-width: 620px) {
  main { width: min(100% - 20px, 1080px); padding-top: 28px; }
  .section-heading, .expense-heading { align-items: stretch; flex-direction: column; }
  .setup-grid, .expense-row { grid-template-columns: 1fr; }
  .panel { border-radius: 16px; }
}
