:root {
  --bg: #f3efe4;
  --ink: #1b1914;
  --muted: #5e584e;
  --card: #fffdf8;
  --line: #e3d9c6;
  --accent: #8f3d1b;
  --keep: #1e4632;
  --highlight: #fff4e8;
  --warn: #6b4a12;
  --shadow: 0 1px 0 rgba(27, 25, 20, 0.04);
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 "Segoe UI", system-ui, sans-serif;
}

header, main, footer {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

header {
  padding: 28px 0 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.35rem;
  color: #0F6B5C;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand:hover {
  color: #0A5247;
}

.keep-mark {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.tagline {
  margin: 10px 0 6px;
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.lede, .meta, .disclaimer, .blurb, small, .monthly, .bank-aside {
  color: var(--muted);
}

.lede { margin: 0 0 8px; max-width: 68ch; }

.meta { margin: 0; font-size: 0.95rem; }

.meta a { color: #0F6B5C; }
.meta a:hover { color: #0A5247; }

form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

label, legend {
  font-weight: 650;
  font-size: 0.92rem;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0;
  padding: 10px 12px 12px;
}

.choice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-weight: 450;
  margin-top: 6px;
}

input[type="number"], input[type="text"] {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid #cfc4ae;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: inherit;
}

input:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hint { display: block; font-weight: 450; color: var(--muted); margin-top: 4px; }

#error, #form-error {
  min-height: 1.2em;
  margin: 0;
  color: var(--accent);
  font-weight: 650;
}

#gst-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: #f8f1dc;
  border-left: 4px solid var(--warn);
  color: var(--ink);
}

.results {
  margin-top: 16px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.card.match {
  background: var(--highlight);
  border-color: #e4b48a;
}

.card h2 {
  margin: 0;
  font-size: 1.15rem;
  font-family: Palatino, Georgia, serif;
}

.badge {
  display: inline-block;
  margin: 8px 0 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3d7c3;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.blurb { margin: 8px 0; font-size: 0.88rem; }

.lines {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.lines li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.lines small {
  grid-column: 1 / -1;
  font-size: 0.78rem;
}

.amt {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amt.aside { color: var(--muted); }

.totals { margin: 10px 0 0; }

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
}

.totals dt { font-weight: 650; }

.totals dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.keep dd { color: var(--keep); font-size: 1.15rem; }

.monthly {
  margin: 10px 0 0;
  font-size: 0.85rem;
}

footer {
  padding: 8px 0 36px;
}

.disclaimer {
  font-size: 0.92rem;
  max-width: 78ch;
}

#sources {
  padding-left: 1.1rem;
  margin: 6px 0 0;
}

#sources a { color: var(--accent); }

.compare-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}
