:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef2ea;
  --border: #d9ddd4;
  --text: #1f2a20;
  --muted: #5a6a58;
  --accent: #16a34a;
  --accent-dark: #116633;
  --accent-soft: #e4f5e8;
  --danger: #b93b3b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 40, 20, 0.05), 0 8px 24px rgba(20, 40, 20, 0.06);
  --max-width: 1100px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.site-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--muted);
  font-weight: 500;
}
.site-nav a:hover { color: var(--accent-dark); text-decoration: none; }

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
  padding: 56px 0 32px;
  align-items: start;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 3.4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.lede {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 56ch;
}
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.hero-card h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}
.checklist {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.checklist li {
  position: relative;
  padding-left: 22px;
  color: var(--muted);
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--accent-dark); text-decoration: none; }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--border);
}
.btn-danger:hover { border-color: var(--danger); }

.splitter {
  padding: 32px 0 56px;
  display: grid;
  gap: 24px;
}
.splitter-head h2 {
  margin: 0 0 6px;
  font-size: 1.6rem;
}
.splitter-head p {
  margin: 0;
  color: var(--muted);
}

.household-panel,
.receipt-meta,
.line-form,
.receipt-wrap,
.totals-panel,
.history-panel,
.walkthrough,
.faq,
.notes {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}
.field input,
.field select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.field input:focus,
.field select:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
  border-color: var(--accent);
}
.hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.household-panel {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 16px;
  align-items: end;
}
.household-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.receipt-meta {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.line-form {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr 1.2fr auto;
  gap: 12px;
  align-items: end;
}

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.receipt-header h3 {
  margin: 0;
  font-size: 1.1rem;
}
.empty-state {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.receipt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.receipt-table th,
.receipt-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.receipt-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
.receipt-table td:nth-child(2),
.receipt-table td:nth-child(4),
.receipt-table td:nth-child(5),
.receipt-table tfoot td:nth-child(2),
.receipt-table tfoot td:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.receipt-table tfoot td {
  border-bottom: none;
  padding-top: 12px;
}
.col-remove { width: 40px; text-align: center; }
.remove-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 1.1rem;
}
.remove-btn:hover { background: var(--surface-2); color: var(--danger); }

.totals-panel h3,
.history-panel h3,
.walkthrough h2,
.faq h2,
.notes h2 {
  margin: 0 0 16px;
  font-size: 1.2rem;
}
.totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.total-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.total-card .name {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.total-card .amount {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.total-card .detail {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}
.totals-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.history-item .meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.history-item .title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item .sub {
  font-size: 0.8rem;
  color: var(--muted);
}
.history-item .actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.walkthrough p { color: var(--muted); margin: 0 0 16px; }
.walk-list {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}
.walk-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 16px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.walk-list li strong {
  grid-column: 1;
  grid-row: 1 / span 2;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  height: fit-content;
}
.walk-list li span { grid-column: 2; color: var(--muted); }

.example-table-wrap { margin-top: 16px; }
.example-table-wrap h3 { margin: 0 0 10px; font-size: 1rem; }
.example-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.example-table th,
.example-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.example-table td:nth-child(2),
.example-table td:nth-child(4),
.example-table td:nth-child(5),
.example-table tfoot td:nth-child(2),
.example-table tfoot td:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.example-table tfoot td { border-bottom: none; padding-top: 10px; }
.example-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0 0;
}
.example-totals > div {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.example-totals dt { color: var(--muted); font-size: 0.9rem; }
.example-totals dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

.faq-grid,
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.faq-item,
.note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.faq-item h3,
.note h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}
.faq-item p,
.note ul {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.note ul {
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.site-footer {
  margin-top: 56px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 32px 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 24px;
}
.footer-grid p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.footer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 32px; }
  .household-panel { grid-template-columns: 1fr; }
  .receipt-meta { grid-template-columns: 1fr 1fr; }
  .line-form { grid-template-columns: 1fr 1fr; }
  .line-form .btn { grid-column: 1 / -1; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .site-header .container { height: auto; padding: 12px 24px; flex-wrap: wrap; }
  .site-nav { gap: 12px; }
  .receipt-meta { grid-template-columns: 1fr; }
  .line-form { grid-template-columns: 1fr; }
  .totals-actions .btn { flex: 1; }
  .history-item { flex-direction: column; align-items: flex-start; }
  .history-item .actions { width: 100%; justify-content: flex-end; }
}

@media print {
  .site-header, .site-footer, .hero, .walkthrough, .faq, .notes,
  .household-actions, .totals-actions, .history-panel, .line-form,
  .receipt-meta, .receipt-header .btn, .remove-btn { display: none !important; }
  body { background: #fff; color: #000; }
  .container { max-width: 100%; padding: 0; }
  .receipt-table { font-size: 0.85rem; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
