:root {
  --bg: #f7f7f9;
  --surface: #ffffff;
  --ink: #1a1f2e;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #1e4d8f;
  --brand-dim: #345e9d;
  --brand-soft: #e8effa;
  --ok: #087a3f;
  --warn: #b45309;
  --err: #b91c1c;
  --shadow: 0 1px 2px rgba(20,30,50,.06), 0 8px 24px rgba(20,30,50,.06);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

.wrap { max-width: 1120px; margin: 0 auto; padding: 24px; }
.wrap-narrow { max-width: 800px; margin: 0 auto; padding: 24px; }

/* nav */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.nav-inner {
  max-width: 1120px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px;
}
.brand { font-weight: 700; color: var(--ink); font-size: 17px; letter-spacing: -0.01em; }
.brand span { color: var(--brand); }
.nav-links { margin-left: auto; display: flex; gap: 18px; align-items: center; }
.nav-links a { color: var(--muted); font-weight: 500; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.cart-badge {
  background: var(--brand); color: white; border-radius: 999px;
  padding: 2px 8px; font-size: 12px; font-weight: 600; margin-left: 4px;
}

/* hero */
.hero {
  padding: 72px 24px 56px;
  background: linear-gradient(180deg, #eef3fa 0%, var(--bg) 100%);
  text-align: center;
}
.hero h1 {
  font-size: 44px; line-height: 1.1; margin: 0 0 14px;
  letter-spacing: -0.02em; font-weight: 700;
}
.hero p { color: var(--muted); font-size: 18px; margin: 0 auto 26px; max-width: 640px; }

/* buttons */
.btn {
  display: inline-block; padding: 10px 18px;
  border-radius: 8px; border: 1px solid transparent;
  background: var(--surface); color: var(--ink); cursor: pointer;
  font-size: 14px; font-weight: 600; text-decoration: none;
  transition: background 120ms, transform 60ms;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: white; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dim); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* cards / grid */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow);
}
.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 800px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
}

/* value props */
.props { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.props .prop { text-align: left; padding: 20px; }
.prop h3 { margin: 0 0 6px; font-size: 16px; }
.prop p { color: var(--muted); margin: 0; font-size: 14px; }

/* county tile */
.county-tile {
  display: block; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: inherit;
  transition: border-color 120ms, transform 120ms;
}
.county-tile:hover {
  border-color: var(--brand); text-decoration: none;
  transform: translateY(-1px);
}
.county-tile h3 { margin: 0 0 4px; font-size: 17px; }
.county-tile .count { color: var(--brand); font-weight: 600; font-size: 14px; }
.county-tile .range { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* browse */
.filters {
  display: flex; gap: 12px; flex-wrap: wrap;
  padding: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 14px;
}
.filters label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.filters .field { min-width: 160px; }
input, select {
  width: 100%; padding: 8px 10px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }

/* table */
table.records { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
table.records th, table.records td { padding: 10px 12px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--line); }
table.records th { background: #f0f2f5; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.records tr:last-child td { border-bottom: none; }
table.records tr.in-cart { background: var(--brand-soft); }
.record-add { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

/* pagination */
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }

/* toasts */
.toast-host { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: grid; gap: 8px; }
.toast {
  background: var(--ink); color: white; padding: 10px 14px; border-radius: 8px;
  box-shadow: var(--shadow); font-size: 14px; min-width: 220px;
  animation: toast-in 180ms;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

/* status pills */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.stage-pill {
  display:inline-block; padding:2px 10px; border-radius:999px;
  background:var(--brand-soft); color:var(--brand); font-size:11px; font-weight:600;
  text-transform:uppercase; letter-spacing:.04em;
}
.pill-pending  { background: #fef3c7; color: var(--warn); }
.pill-paid     { background: #d1fae5; color: var(--ok); }
.pill-cancelled { background: #f3f4f6; color: var(--muted); }
.pill-fulfilled { background: var(--brand-soft); color: var(--brand); }

/* footer */
footer {
  margin-top: 60px; padding: 30px 24px; text-align: center;
  color: var(--muted); font-size: 13px; border-top: 1px solid var(--line);
}

.empty { padding: 40px; text-align: center; color: var(--muted); }
.error-box { background: #fee2e2; color: var(--err); padding: 12px 14px; border-radius: 8px; margin: 12px 0; }
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--brand-soft); border-top-color: var(--brand);
  border-radius: 50%; animation: spin 700ms linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg) } }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); }
h2 { font-size: 24px; letter-spacing: -0.01em; margin-top: 0; }
