:root {
  --cream: #F5F1E8;
  --cream-soft: #ECE3CF;
  --stone-line: #DCD2B9;
  --ink: #263746;
  --wine: #536878;
  --wine-dark: #263746;
  --wine-light: #6b8194;
  --vine: #263746;
  --gold: #B0925A;
  --brass-text: #7A5E33;
  --muted: #5A6670;
  --danger: #9C4A3A;
  --radius: 1.1rem;
  --shadow: 0 1px 2px rgba(38, 55, 70, 0.07), 0 6px 20px rgba(38, 55, 70, 0.08);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.serif {
  font-family: Georgia, "Iowan Old Style", Cambria, serif;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 6rem;
}

header.page-head {
  text-align: center;
  margin-bottom: 2rem;
}

header.page-head h1 {
  font-family: Georgia, "Iowan Old Style", Cambria, serif;
  font-weight: 500;
  font-size: 1.9rem;
  letter-spacing: 0.01em;
  margin: 0 0 0.4rem;
  color: var(--wine-dark);
}

header.page-head p.tagline {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 1.02rem;
}

.vine-rule {
  height: 1px;
  width: 100%;
  margin: 1.6rem 0;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
  border: none;
}

.summary-pill {
  display: inline-block;
  background: var(--cream-soft);
  border: 1px solid var(--stone-line);
  color: var(--wine-dark);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.88rem;
}

.summary-pill strong { color: var(--wine); }

.day-heading {
  font-family: Georgia, "Iowan Old Style", Cambria, serif;
  font-size: 1.15rem;
  color: var(--wine-dark);
  margin: 2.2rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--stone-line);
}

.day-heading:first-of-type { margin-top: 0; }

.meal-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
  margin-bottom: 0.85rem;
  border: 1px solid rgba(38, 55, 70, 0.06);
}

.meal-card.available {
  border-left: 3px solid var(--wine-light);
}

.meal-card.partial {
  border-left: 3px solid var(--gold);
}

.meal-card.full {
  border-left: 3px solid var(--vine);
}

.meal-card.locked {
  background: var(--cream-soft);
  border-left: 3px solid var(--stone-line);
  box-shadow: none;
}

.meal-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.meal-type {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.meal-title {
  font-family: Georgia, "Iowan Old Style", Cambria, serif;
  font-size: 1.08rem;
  margin: 0.1rem 0 0.2rem;
  color: var(--ink);
}

.meal-card.locked .meal-title { color: var(--wine-dark); font-style: italic; }

.meal-note {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.status-tag {
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 600;
}

.status-tag.available { background: rgba(83, 104, 120, 0.10); color: var(--wine); }
.status-tag.partial { background: rgba(176, 146, 90, 0.20); color: var(--brass-text); }
.status-tag.full { background: rgba(38, 55, 70, 0.10); color: var(--vine); }
.status-tag.locked { background: transparent; color: var(--muted); border: 1px solid var(--stone-line); }

.signup-list { margin: 0.6rem 0 0; padding: 0; list-style: none; }

.signup-item {
  padding: 0.55rem 0;
  border-top: 1px solid var(--stone-line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
}

.signup-names {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.98rem;
}

.signup-desc {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.15rem;
}

.signup-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.82rem;
  color: var(--wine);
  text-decoration: underline;
  cursor: pointer;
}

.link-btn.danger { color: var(--danger); }

.btn {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.15rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.btn-primary {
  background: var(--wine);
  color: #fff;
}
.btn-primary:hover { background: var(--wine-dark); }
.btn-primary:disabled { opacity: 0.55; cursor: default; }

.btn-secondary {
  background: transparent;
  color: var(--wine);
  border: 1px solid var(--wine);
}

.btn-full { width: 100%; margin-top: 0.6rem; }
.btn-small { padding: 0.4rem 0.85rem; font-size: 0.85rem; }

.locked-note {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.3rem;
}

footer.page-foot {
  text-align: center;
  margin-top: 3rem;
  font-size: 0.82rem;
  color: var(--muted);
}

footer.page-foot a { color: var(--muted); }

/* Modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(38, 55, 70, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: 0;
}

@media (min-width: 640px) {
  .overlay { align-items: center; padding: 1rem; }
}

.modal {
  background: var(--cream);
  width: 100%;
  max-width: 440px;
  border-radius: 1.3rem 1.3rem 0 0;
  padding: 1.6rem 1.4rem calc(1.6rem + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(38, 55, 70, 0.22);
}

@media (min-width: 640px) {
  .modal { border-radius: 1.3rem; }
}

.modal h2 {
  font-family: Georgia, "Iowan Old Style", Cambria, serif;
  margin: 0 0 0.2rem;
  color: var(--wine-dark);
  font-size: 1.25rem;
}

.modal p.sub {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.field { margin-bottom: 0.9rem; }

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--wine-dark);
  margin-bottom: 0.3rem;
}

.field input, .field textarea, .field select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--stone-line);
  border-radius: 0.6rem;
  font-size: 1rem;
  background: #fff;
  font-family: inherit;
  color: var(--ink);
}

.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid var(--wine-light);
  outline-offset: 1px;
}

.field textarea { resize: vertical; min-height: 4.2rem; }

.modal-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.3rem;
}

.modal-actions .btn { flex: 1; }

.error-text {
  color: var(--danger);
  font-size: 0.86rem;
  margin: 0.5rem 0 0;
}

.confirm-box {
  background: var(--cream-soft);
  border: 1px solid var(--stone-line);
  border-radius: 0.8rem;
  padding: 0.9rem 1rem;
  font-size: 0.9rem;
  margin-top: 0.9rem;
}

.confirm-box a, .confirm-box button.link-btn { font-weight: 600; }

.loading-msg, .empty-msg {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
}

.hidden { display: none !important; }

/* Admin */
.admin-section {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem;
  margin-bottom: 1.2rem;
}

.admin-section h2 {
  font-family: Georgia, "Iowan Old Style", Cambria, serif;
  font-size: 1.1rem;
  color: var(--wine-dark);
  margin: 0 0 0.9rem;
}

.admin-meal-row {
  border-top: 1px solid var(--stone-line);
  padding: 0.9rem 0;
}
.admin-meal-row:first-of-type { border-top: none; padding-top: 0; }

.admin-meal-row .row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.admin-meal-row .row-head h3 {
  font-size: 0.95rem;
  margin: 0;
  font-weight: 600;
}

.admin-meal-row .row-head .meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.admin-grid .field.span-2 { grid-column: 1 / -1; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.checkbox-row input { width: auto; }

.admin-signup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-size: 0.88rem;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.top-bar a { color: var(--wine); font-size: 0.9rem; text-decoration: none; }

.toast {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--wine-dark);
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  z-index: 100;
  box-shadow: var(--shadow);
}
