/* ReunionThreads — mobile-first, no build step. */
:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5f6672;
  --border: #ddd8cf;
  --primary: #1d5e8c;
  --primary-text: #ffffff;
  --primary-hover: #164a6f;
  --success-bg: #e5f4ea;
  --success-text: #1c5b31;
  --error-bg: #fdecea;
  --error-text: #8a1c12;
  --info-bg: #e8f1f8;
  --info-text: #1d4560;
  --radius: 10px;
  --tap: 48px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --surface: #1e2329;
    --text: #e8eaed;
    --muted: #a3aab4;
    --border: #353c45;
    --primary: #5aa7dd;
    --primary-text: #0d1a24;
    --primary-hover: #7bb9e5;
    --success-bg: #183524;
    --success-text: #a6dfb6;
    --error-bg: #3d1915;
    --error-text: #f4b4ab;
    --info-bg: #172a3a;
    --info-text: #b5d4ec;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 1rem 0 .75rem; }
h2 { font-size: 1.2rem; margin: 0 0 .5rem; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; margin: -.25rem 0 0; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 1.05rem; }
.main-nav { display: flex; gap: 4px; }
.main-nav a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 10px; text-decoration: none; font-weight: 600; border-radius: var(--radius); }
.main-nav a:hover { background: var(--bg); }
.badge { background: var(--primary); color: var(--primary-text); border-radius: 999px; padding: 0 8px; margin-left: 4px; font-size: .85rem; }

/* Buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 0 18px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-large { width: 100%; font-size: 1.1rem; }
.btn-pair { display: flex; gap: 8px; }
.btn-pair .btn { flex: 1 1 0; width: auto; padding-left: 8px; padding-right: 8px; }
.btn-link { border: none; background: none; padding: 0 4px; color: var(--primary); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.danger { color: var(--error-text); }
.stack { display: flex; flex-direction: column; gap: .6rem; }
label { font-weight: 600; }
input[type=text], input[type=email], input[type=tel], input[type=number], input:not([type]) {
  width: 100%; min-height: var(--tap); padding: 8px 12px; font: inherit;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
}
input:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
fieldset { border: none; padding: 0; margin: 0 0 .5rem; }
legend { font-weight: 700; margin-bottom: .4rem; }
.field-error { color: var(--error-text); margin: 0; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.choice { position: relative; font-weight: 400; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.choice span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; padding: 6px; text-align: center;
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer;
}
.choice input:checked + span { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary) inset; }
.choice input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border); }

/* Flash */
.flash { padding: 12px 14px; border-radius: var(--radius); margin: 1rem 0; }
.flash-success { background: var(--success-bg); color: var(--success-text); }
.flash-error { background: var(--error-bg); color: var(--error-text); }
.flash-info { background: var(--info-bg); color: var(--info-text); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.narrow { max-width: 420px; }

/* Home */
.hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 1rem; }
.hero-img { width: 100%; max-height: 320px; object-fit: cover; }
.hero-text { padding: 16px 16px 20px; }
.hero-text h1 { margin-top: 0; }
.event-meta { font-weight: 600; margin: .2rem 0; }
.deadline { background: var(--info-bg); color: var(--info-text); padding: 8px 12px; border-radius: var(--radius); }
.how-it-works { margin-top: 1.5rem; }
.how-it-works ol { padding-left: 1.25rem; }

/* Shop */
.product-grid { list-style: none; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.product-card { padding: 0; overflow: hidden; }
.product-card-link { color: inherit; text-decoration: none; display: block; }
.product-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--bg); }
.product-card-body { padding: 14px 16px 16px; }
.price { font-weight: 700; font-size: 1.1rem; }
.product-detail { display: grid; gap: 20px; }
.product-images { display: grid; gap: 8px; }
.product-images img { border-radius: var(--radius); }
.live-price { font-size: 1.15rem; font-weight: 700; min-height: 1.5em; }

/* Cart */
.cart-lines { list-style: none; padding: 0; display: grid; gap: 12px; }
.cart-line-head { display: flex; justify-content: space-between; gap: 12px; }
.cart-line-head p { margin: 0; }
.line-total { font-weight: 700; white-space: nowrap; }
.cart-line-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 10px; }
.cart-line-form label { display: flex; flex-direction: column; font-size: .9rem; }
.cart-line-form input[type=number] { width: 84px; }
.cart-line-form .grow { flex: 1 1 180px; }
.cart-summary { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.cart-summary p { margin: 0; }
.order-total { font-size: 1.25rem; }

/* Checkout */
.checkout { display: grid; gap: 16px; }
table.review { width: 100%; border-collapse: collapse; }
.review th, .review td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.review .num { text-align: right; white-space: nowrap; }
.review tfoot th, .review tfoot td { border-bottom: none; font-size: 1.1rem; }
.payment-note { background: var(--bg); border-radius: var(--radius); padding: 10px 12px; }
.payment-note h3 { margin: 0 0 .25rem; font-size: 1rem; }
.payment-note p { margin: 0; }

/* Admin */
.admin-nav { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.admin-nav a { padding: 12px 12px; white-space: nowrap; text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; }
.admin-nav a[aria-current=page] { border-bottom-color: var(--primary); color: var(--text); }
.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label { color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.6rem; font-weight: 700; }

.site-footer { color: var(--muted); font-size: .9rem; padding-top: 2rem; padding-bottom: 2rem; }

@media (min-width: 760px) {
  h1 { font-size: 2.1rem; }
  .product-detail { grid-template-columns: 1fr 1fr; align-items: start; }
  .checkout { grid-template-columns: 3fr 2fr; align-items: start; }
  .btn-large { width: auto; }
  .cart-summary { align-items: flex-end; }
}

/* Orders */
.edit-banner { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: var(--info-bg); color: var(--info-text); border-radius: var(--radius); padding: 4px 4px 4px 14px; margin-top: 1rem; }
.status-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1rem; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); font-weight: 600; font-size: .9rem; }
.pill-unpaid { background: var(--error-bg); color: var(--error-text); border-color: transparent; }
.pill-partially_paid { background: var(--info-bg); color: var(--info-text); border-color: transparent; }
.pill-paid { background: var(--success-bg); color: var(--success-text); border-color: transparent; }
.payment-box { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.payment-box h2, .payment-box h3, .payment-box p { margin: 0; }
.payment-box h3 { font-size: 1rem; margin-top: .5rem; }
.sign-out { margin-top: 1.5rem; }
.merge-box { background: var(--info-bg); color: var(--info-text); border-radius: var(--radius); padding: 12px; margin-top: .5rem; }
.merge-box p { margin: 0; }
.choices { margin: 1rem 0; }

/* Admin */
.inline-form { display: flex; align-items: center; gap: 8px; }
.admin-who { font-size: .9rem; }
.admin-header .admin-nav { border-bottom: none; margin-bottom: 0; }
.alert-card { border-color: var(--error-text); background: var(--error-bg); color: var(--error-text); margin: 1rem 0; }
.ordering-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 1rem 0; }
.ordering-card h2, .ordering-card p { margin: 0; }
.progress { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--primary); }
.plain-list { list-style: none; padding: 0; display: grid; gap: 6px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 1rem; }
.filter-bar label { display: flex; flex-direction: column; font-size: .9rem; }
.filter-bar .grow { flex: 1 1 220px; }
select, textarea, input[type=search], input[type=password], input[type=url], input[type=datetime-local], input[type=file] {
  min-height: var(--tap); padding: 8px 12px; font: inherit; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text); max-width: 100%;
}
input[type=search], input[type=password], input[type=url], input[type=datetime-local], textarea { width: 100%; }
.order-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.order-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; }
.order-row-main { flex: 1 1 220px; display: flex; flex-direction: column; gap: 6px; }
.order-row-link { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.order-row .status-row { margin: 0; }
.btn-done { background: var(--success-bg); color: var(--success-text); border-color: transparent; }
.pill-warn { background: var(--info-bg); color: var(--info-text); border-color: transparent; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; min-height: var(--tap); }
.check input { width: 20px; height: 20px; }
.edit-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.edit-grid { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.edit-grid label { display: flex; flex-direction: column; font-size: .9rem; }
.edit-grid .grow { flex: 1 1 180px; }
.edit-grid input[type=number] { width: 84px; }
.edit-table input { min-height: 40px; padding: 4px 8px; }
.edit-table input[type=number] { width: 70px; }
.edit-table { display: block; overflow-x: auto; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.image-grid figure { margin: 0; }
.image-grid img { border-radius: var(--radius); border: 1px solid var(--border); }
.settings-hero { max-height: 160px; width: auto; border-radius: var(--radius); }
body.admin .stat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 16px; }
body.admin main > .card, body.admin main > section, body.admin .checkout { margin-bottom: 16px; }
.merge-card { border-color: var(--info-text); }
.merge-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
