:root {
  --bg: #f7f2e9;
  --surface: #fffdf9;
  --surface-2: #f1ebdf;
  --ink: #1f2923;
  --muted: #5e6a62;
  --line: #e3dbcc;
  --green: #2f5d46;
  --green-ink: #ffffff;
  --green-soft: #e3eee7;
  --cranberry: #a3283a;
  --cranberry-soft: #f7e3e5;
  --gold: #a87418;
  --gold-soft: #f6ead2;
  --focus: #1f6feb;
  --shadow: 0 1px 2px rgba(31, 41, 35, .06), 0 4px 16px rgba(31, 41, 35, .05);
  --radius: 14px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111613;
    --surface: #18201b;
    --surface-2: #1f2923;
    --ink: #ebe6dc;
    --muted: #a3ada6;
    --line: #2c3731;
    --green: #78b894;
    --green-ink: #0f1a14;
    --green-soft: #1e3227;
    --cranberry: #e7798a;
    --cranberry-soft: #3a1d22;
    --gold: #e0b45e;
    --gold-soft: #3a2f1a;
    --focus: #6ea8ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111613;
  --surface: #18201b;
  --surface-2: #1f2923;
  --ink: #ebe6dc;
  --muted: #a3ada6;
  --line: #2c3731;
  --green: #78b894;
  --green-ink: #0f1a14;
  --green-soft: #1e3227;
  --cranberry: #e7798a;
  --cranberry-soft: #3a1d22;
  --gold: #e0b45e;
  --gold-soft: #3a2f1a;
  --focus: #6ea8ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 8px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.3rem;
  letter-spacing: -.01em;
}
.brand-mark { width: 26px; height: 26px; color: var(--green); flex: none; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.tab {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: .95rem;
  padding: 6px 14px;
  border-radius: 999px;
}
.tab[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.event-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  scrollbar-width: none;
}
.event-pills:empty { display: none; }
.pill {
  flex: none;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.pill[aria-selected="true"] { background: var(--green); border-color: var(--green); color: var(--green-ink); }

/* ---------- general blocks ---------- */
.loading, .empty { color: var(--muted); padding: 32px 0; text-align: center; }
.event-head { padding: 24px 0 8px; }
.event-head h1 {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.15;
  margin: 0 0 4px;
  letter-spacing: -.015em;
}
.event-meta { color: var(--muted); margin: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 16px 0;
}
.card h2, .section-title {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.2rem;
  margin: 0 0 8px;
}
.hint { color: var(--muted); font-size: .9rem; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--green);
  background: var(--green);
  color: var(--green-ink);
  font-weight: 600;
  font-size: .92rem;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 38px;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: transparent; color: var(--green); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.danger { background: transparent; border-color: var(--cranberry); color: var(--cranberry); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { background: var(--cranberry-soft); color: var(--cranberry); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- forms ---------- */
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label, .field .label { font-weight: 600; font-size: .9rem; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 10px;
  padding: 9px 12px;
  min-height: 42px;
}
.field textarea { min-height: 70px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.form-error { color: var(--cranberry); font-size: .9rem; margin: 0 0 8px; }

/* ---------- menu ---------- */
.progress { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.progress-bar {
  flex: 1 1 200px;
  height: 10px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress-bar span { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.progress strong { font-variant-numeric: tabular-nums; }

.menu-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

.category { margin: 24px 0 8px; }
.category-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 6px;
  margin-bottom: 4px;
}
.category-head h2 { margin: 0; }
.dishes { list-style: none; margin: 0; padding: 0; }
.dish {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.dish:last-child { border-bottom: 0; }
.dish-main { min-width: 0; flex: 1; }
.dish-name { font-weight: 600; }
.dish-notes { color: var(--muted); font-size: .9rem; }
.people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.person {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--green-soft);
  color: var(--ink);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: .85rem;
  font-weight: 500;
}
.person .note { color: var(--muted); font-weight: 400; }
.person button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0 0 2px;
  font-size: 1rem;
  line-height: 1;
}
.person button:hover { color: var(--cranberry); }
.dish-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.dish-buttons { display: flex; align-items: center; gap: 6px; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.badge {
  font-size: .78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.open { background: var(--gold-soft); color: var(--gold); }
.badge.done { background: var(--green-soft); color: var(--green); }

.roster { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.roster li { display: flex; gap: 8px; flex-wrap: wrap; }
.roster strong { min-width: 110px; }
.roster span { color: var(--muted); }

/* ---------- availability ---------- */
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .85rem; margin: 4px 0 12px; }
.day-list { display: grid; gap: 6px; }
.day {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.day:last-child { border-bottom: 0; }
.day-label { display: flex; align-items: center; gap: 8px; font-weight: 600; flex-wrap: wrap; }
.day-label .holiday {
  font-size: .75rem;
  font-weight: 600;
  color: var(--cranberry);
  background: var(--cranberry-soft);
  padding: 1px 8px;
  border-radius: 999px;
}
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chip {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 10px;
  padding: 6px 4px;
  min-height: 40px;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  display: grid;
  line-height: 1.15;
}
.chip small { color: var(--muted); font-size: .72rem; font-weight: 400; }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.chip[aria-pressed="true"] small { color: inherit; opacity: .85; }
.chip.all { color: var(--muted); }
.chip.all[aria-pressed="true"] { color: var(--green-ink); }

@media (min-width: 620px) {
  .day { grid-template-columns: 170px 1fr; align-items: center; }
}

.save-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  margin: 12px -16px -16px;
  padding: 12px 16px;
  border-radius: 0 0 var(--radius) var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.best { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.best li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
  flex-wrap: wrap;
}
.best .when { font-weight: 600; }
.best .who { color: var(--muted); font-size: .9rem; }

.grid-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.heat { border-collapse: separate; border-spacing: 4px; width: 100%; min-width: 300px; }
.heat th { font-size: .8rem; font-weight: 600; color: var(--muted); text-align: left; padding: 0 4px; white-space: nowrap; }
.heat thead th { text-align: center; }
.heat td { padding: 0; }
.heat button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--muted);
}
.heat button[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.cell-detail { min-height: 1.5em; margin: 10px 0 0; color: var(--ink); }

.responses { list-style: none; margin: 0; padding: 0; }
.responses li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.responses li:last-child { border-bottom: 0; }
.responses .meta { color: var(--muted); font-size: .88rem; }

/* ---------- dialog + toast ---------- */
dialog form { padding: 20px; }
dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  width: min(460px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(17, 22, 19, .45); }
dialog h2 { font-family: var(--font-display); font-weight: 650; margin: 0 0 4px; font-size: 1.3rem; }
dialog .sub { color: var(--muted); margin: 0 0 16px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 32px);
  z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--cranberry); color: #fff; }

.site-footer { padding: 32px 16px 40px; text-align: center; font-size: .9rem; }
.site-footer a { color: var(--muted); }
.host-banner {
  background: var(--gold-soft);
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 12px;
  margin-top: 16px;
  font-size: .9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .dish { align-items: flex-start; flex-direction: column; gap: 8px; }
  .dish-actions { width: 100%; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
