/* Feast Planner - warm, calm, high contrast, phone-first. */
:root {
  --bg: #fffcf7;
  --surface: #ffffff;
  --surface-2: #fdf2e6;
  --text: #2a1a17;
  --muted: #6f5a50;
  --border: #f0e1cf;
  --accent: #a8243c;
  --accent-ink: #ffffff;
  --accent-soft: #f8dde2;
  --accent-text: #8e1c32;
  --green: #2c6a37;
  --green-soft: #ddefdf;
  --needs-bg: #ffe08a;
  --needs-text: #4a3300;
  --danger: #b42318;
  /* r367 round d: destructive buttons' own pale-red fill (white was too close to the cream page, distance 11). */
  --danger-soft: #fdecea;
  /* r367 (10/27/2026): the button edge - a mid warm grey, clearly stronger than the faint --border divider. */
  --btnline: #8a6f63;
  --shadow: 0 1px 2px rgba(60, 30, 20, .08), 0 6px 18px rgba(60, 30, 20, .08);
  --radius: 16px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
  overflow-x: hidden;
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
}
body.event { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 96px); }
body.sheet-open { overflow: hidden; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0; }
a { color: var(--accent-text); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.view { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.loading, .noscript { padding: 48px 0; text-align: center; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px;
  border-radius: 12px; border: 2px solid var(--btnline);
  background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: 17px; text-decoration: none;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* r367 (Kevin 10/27/2026): every button LOOKS like a button - a 2px --btnline edge and a fill that differs
   from the page/sheet. Quiet buttons were transparent with the faint divider line, i.e. text on a flat background. */
.btn-quiet { background: var(--surface-2); border-color: var(--btnline); color: var(--text); }
/* Destructive = same shape as the quiet buttons, red words + red edge (never a solid red slab). */
.btn-danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-danger-quiet { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-block { display: flex; width: 100%; }
.btn-small { min-height: 44px; padding: 6px 14px; font-size: 16px; }
.btn-hero { width: 100%; min-height: 60px; font-size: 20px; border-radius: 16px; margin: 8px 0 24px; box-shadow: var(--shadow); }
.btn-share { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); margin-top: 14px; min-height: 52px; font-size: 18px; }
/* r367: escape-hatch buttons (Cancel, Bring back, Throw it away, Delete, Go to all meals) are one uniform
   width, centered, not edge to edge. Only the filled primary (Save / Share / Plan a new meal) stays full width. */
.btn-quiet.btn-block, .btn-danger-quiet.btn-block, .btn-danger.btn-block { width: min(100%, 260px); margin-left: auto; margin-right: auto; justify-self: center; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.chip {
  min-height: 44px; padding: 8px 14px; border-radius: 999px;
  border: 2px solid var(--btnline); background: var(--surface-2); /* r367: chips with words get the clear button edge; round d: own warm fill (white on the cream page was distance 11) */
  font-weight: 700; font-size: 16px; cursor: pointer; color: var(--text);
}
/* A long one-word choice wraps inside the screen instead of widening the sheet. */
.chip { max-width: 100%; overflow-wrap: anywhere; }
/* A choice this phone added: the chip plus a rename (pencil) and a remove (×) button. */
.chip-own { display: inline-flex; align-items: stretch; gap: 2px; max-width: 100%; min-width: 0; }
.chip-own .chip { min-width: 0; }
.chip-tool { flex: 0 0 44px; min-height: 44px; border: 2px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 18px; cursor: pointer; }
.chip-tool:hover, .chip-tool:focus-visible { color: var(--text); background: var(--accent-soft); }
.chip-del:hover, .chip-del:focus-visible { color: var(--danger); }
.chip[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-me { min-height: 44px; font-size: 15px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-needs {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--needs-bg); color: var(--needs-text); font-weight: 700;
}

/* ---------- home ---------- */
.home-main { padding-bottom: calc(32px + var(--safe-b)); }
.hero { margin: 0 -16px; padding-top: var(--safe-t); background: var(--surface-2); }
.hero-img {
  display: block; width: 100%; height: 200px;
  object-fit: cover; object-position: 70% center;
}
@media (min-width: 560px) { .hero-img { height: auto; aspect-ratio: 1200 / 514; } }
.home-head { padding: 20px 0 8px; }
.brand { font-size: 34px; color: var(--accent-text); }
.lede { margin: 8px 0 12px; color: var(--muted); font-size: 18px; }
.home-section { margin-top: 8px; }
.section-title { font-size: 22px; margin: 20px 0 10px; }
.subhead { font-size: 18px; margin: 24px 0 8px; color: var(--muted); font-family: var(--font-body); }
.event-list { display: grid; gap: 10px; }
.event-card {
  display: grid; gap: 2px; padding: 14px 16px; min-height: 64px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow);
}
.event-card-holiday { font-size: 14px; font-weight: 700; color: var(--accent-text); text-transform: uppercase; letter-spacing: .04em; }
.event-card-title { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.event-card-date { color: var(--muted); }
.event-list-past .event-card { box-shadow: none; opacity: .85; }
.empty { color: var(--muted); margin: 8px 0; }
.empty-lead { padding: 16px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.gone { padding-top: 48px; }

/* ---------- event header ---------- */
.ev-head { padding: calc(8px + var(--safe-t)) 0 16px; border-bottom: 1px solid var(--border); }
.ev-topbar { display: flex; align-items: center; gap: 8px; justify-content: space-between; min-height: 52px; }
/* r367: "< All meals" is a Back action, so it is a bordered button, not a bare text link. */
.link-home { font-weight: 700; text-decoration: none; padding: 8px 14px; min-height: 44px; display: inline-flex; align-items: center; white-space: nowrap;
  border: 2px solid var(--btnline); border-radius: 12px; background: var(--surface-2); color: var(--text); }
.save-state { font-size: 14px; font-weight: 700; color: var(--muted); }
.save-saved { color: var(--green); }
.save-error { color: var(--danger); }
.ev-holiday { margin: 6px 0 2px; font-weight: 700; color: var(--accent-text); text-transform: uppercase; letter-spacing: .05em; font-size: 14px; }
.ev-title { font-size: 30px; overflow-wrap: anywhere; }
.ev-line { margin: 4px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.ev-when { color: var(--text); font-weight: 700; }
.ev-count { color: var(--text); font-size: 18px; }
.ev-count strong { font-size: 22px; color: var(--accent-text); }

.ev-main { padding-top: 12px; }
.tab-intro { color: var(--muted); margin: 4px 0 8px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 4px; }
.toolbar-text { margin: 0; font-weight: 700; }
.needs-text { color: var(--needs-text); background: var(--needs-bg); padding: 0 6px; border-radius: 6px; }

/* ---------- menu ---------- */
.course { margin-top: 20px; }
.course-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.course-art { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.course-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.course-title { font-size: 22px; flex: 1; }
.count {
  min-width: 36px; height: 36px; padding: 0 10px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-weight: 700;
}

.rows, .cards, .msgs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 10px;
  min-height: 64px; padding: 12px 12px 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.row:active { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.row-title { font-weight: 700; font-size: 18px; overflow-wrap: anywhere; }
.row-sub { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: var(--text); overflow-wrap: anywhere; }
.row-notes { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; white-space: pre-wrap; }
.confirmed { color: var(--green); font-weight: 700; background: var(--green-soft); padding: 0 8px; border-radius: 999px; }
.btn-claim { flex: 0 0 auto; min-height: 48px; padding: 8px 12px; font-size: 16px; background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.order-btns { display: flex; gap: 6px; flex: 0 0 auto; }
.order-btn { min-width: 48px; min-height: 48px; padding: 0; font-size: 16px; }

/* ---------- guests ---------- */
.summary-card { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.summary-big { margin: 0; font-size: 20px; }
.summary-big strong { font-size: 28px; color: var(--accent-text); }
.summary-small { margin: 4px 0 0; color: var(--muted); }
.rsvp { flex: 0 0 auto; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 15px; background: var(--surface-2); }
.rsvp-yes { background: var(--green-soft); color: var(--green); }
.rsvp-maybe { background: var(--needs-bg); color: var(--needs-text); }
.rsvp-no { color: var(--muted); text-decoration: none; }

/* ---------- requests ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-body { display: block; width: 100%; text-align: left; padding: 14px 16px; background: none; border: 0; cursor: pointer; }
.req-line { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.req-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.course-tag { padding: 2px 10px; border-radius: 999px; background: var(--surface-2); font-weight: 700; font-size: 15px; }
.status-ok { color: var(--green); font-weight: 700; }
.status-no { color: var(--muted); font-weight: 700; }
.card-actions { display: flex; gap: 8px; padding: 0 12px 12px; flex-wrap: wrap; }
.card-actions .btn { flex: 1 1 0; min-width: 90px; }
.req-declined .req-line { color: var(--muted); }

/* ---------- chat ---------- */
.msgs { gap: 10px; }
.msg { display: flex; }
.msg-mine { justify-content: flex-end; }
.msg-bubble {
  max-width: 88%; text-align: left; display: grid; gap: 4px;
  padding: 10px 14px; border-radius: 16px 16px 16px 4px;
  background: var(--surface-2); border: 2px solid var(--btnline); cursor: pointer; /* r367: the bubble opens Tweak message, so it gets the button edge; round d: own warm fill, not white on cream */
}
.msg-mine .msg-bubble { background: var(--accent-soft); border-color: var(--accent); border-radius: 16px 16px 4px 16px; }
.msg-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.msg-time { color: var(--muted); font-size: 14px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }


/* ---------- details ---------- */
.details-form { display: grid; gap: 4px; }
.details-form .btn-primary { margin-top: 8px; }
.details-extra { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.details-extra .btn-danger { margin-top: 20px; }

/* ---------- form fields ---------- */
.field { display: grid; gap: 6px; margin: 0 0 14px; min-width: 0; }
.field-label { font-weight: 700; }
.field-hint { margin: 0; color: var(--muted); font-size: 15px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input {
  width: 100%; min-width: 0; min-height: 50px; padding: 10px 12px;
  border: 2px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); font-size: 17px;
}
.input:focus { border-color: var(--accent); outline: none; }
.textarea { resize: vertical; min-height: 88px; }
input[type="date"].input, input[type="time"].input { -webkit-appearance: none; appearance: none; }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 48px; margin: 0 0 14px; font-weight: 700; cursor: pointer; }
.check-input { width: 28px; height: 28px; accent-color: var(--accent); flex: 0 0 auto; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper-btn { min-width: 52px; min-height: 52px; font-size: 24px; padding: 0; }
.stepper-value { min-width: 36px; text-align: center; font-size: 22px; font-weight: 700; }

/* ---------- tab bar + fab ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--surface); border-top: 1px solid var(--border);
  padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
}
.tab { /* btn-look-ok: bottom tab bar - navigation, active tab highlighted by tint and top bar */
  flex: 1 1 0; min-width: 0; min-height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: none; border: 0; border-top: 4px solid transparent;
  font-weight: 700; font-size: 15px; color: var(--muted); cursor: pointer; position: relative;
  -webkit-tap-highlight-color: transparent;
}
.tab[aria-current="page"] { color: var(--accent-text); border-top-color: var(--accent); background: var(--accent-soft); }
.tab-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }
.tab-badge {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--needs-bg); color: var(--needs-text); font-size: 13px; line-height: 22px;
}
.fab {
  position: fixed; z-index: 25;
  right: calc(16px + var(--safe-r));
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  min-height: 56px; padding: 0 22px; border-radius: 999px; border: 2px solid var(--accent);
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 18px; box-shadow: 0 6px 20px rgba(80, 20, 30, .35);
  cursor: pointer; max-width: calc(100vw - 32px);
}
body.sheet-open .fab { display: none; }

/* ---------- sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(20, 8, 10, .5); }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: var(--kb, 0px);
  /* keyboard-safe.js: --vvh = the part of the screen you can see, --kb = what the keyboard covers */
  max-height: calc(var(--vvh, 100dvh) - 24px - var(--safe-t)); overflow-y: auto; overscroll-behavior: contain;
  margin: 0 auto; max-width: 640px;
  background: var(--bg); border-radius: 20px 20px 0 0;
  padding: 0 calc(16px + var(--safe-r)) calc(20px + var(--safe-b)) calc(16px + var(--safe-l));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .25);
  animation: sheet-up .18s ease-out;
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet-head {
  position: sticky; top: 0; z-index: 1; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 14px;
}
.sheet-title { font-size: 24px; outline: none; }
.sheet-close { min-height: 44px; padding: 6px 14px; flex: 0 0 auto; }
.sheet-intro { margin: 0 0 14px; color: var(--muted); }
.sheet-actions { display: grid; gap: 10px; margin-top: 8px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 60; left: 16px; right: 16px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 84px);
  max-width: 560px; margin: 0 auto; padding: 14px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-weight: 700; box-shadow: var(--shadow);
}
body.home .toast { bottom: calc(24px + var(--safe-b)); }
.toast-error { background: var(--danger); color: #fff; }

@media (max-width: 380px) {
  .ev-title { font-size: 26px; }
  .tab { font-size: 13px; letter-spacing: -0.01em; }
  .tab-label { padding: 0; }
  .row { padding-left: 12px; }
  .btn-claim { padding: 8px 10px; font-size: 15px; }
}

/* ---------- Tweak mode ---------- */
.tweak-hint { margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); font-size: 15px; }
.section-tweak { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -2px 0 10px; }
.section-note { font-size: 14px; color: var(--muted); padding: 0 6px; }
.course-hidden .course-title, .course-hidden .course-art { opacity: .5; }

/* ---------- saved hosts and places ---------- */
.saved-wrap { position: relative; min-width: 0; }
.saved-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5;
  max-height: 220px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 2px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.saved-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--border); }
.saved-row:last-child { border-bottom: 0; }
.saved-pick { flex: 1; min-width: 0; min-height: 48px; padding: 8px 14px; text-align: left; background: none; border: 0; cursor: pointer; overflow-wrap: anywhere; }
.saved-pick:hover, .saved-pick:focus-visible { background: var(--accent-soft); }
.saved-del { flex: 0 0 48px; min-height: 48px; background: none; border: 0; border-left: 1px solid var(--border); font-size: 22px; color: var(--muted); cursor: pointer; }
.saved-del:hover, .saved-del:focus-visible { color: var(--danger); background: var(--accent-soft); }
/* ---------- "+ Add" in pick-lists (house rule r326) ---------- */
.chip-add { border-style: dashed; border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); } /* r367 round d: own fill */
.chip-add-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.chip-add-row .input { flex: 1; min-width: 0; }
/* r367: the "+ Add ..." row in a saved list is a button, not a caption: bordered, its own fill. */
.saved-pick.saved-add { color: var(--accent-text); font-weight: 700; margin: 6px; border: 2px solid var(--accent); border-radius: 10px; background: var(--accent-soft); text-align: center; }

/* ---------- "Throw away what you typed?" (asked by the phone's Back button) ---------- */
.ask-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(20, 8, 10, .5); }
.ask-sheet {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: var(--kb, 0px);
  max-height: calc(var(--vvh, 100dvh) - 24px - var(--safe-t)); overflow-y: auto; overscroll-behavior: contain;
  margin: 0 auto; max-width: 640px;
  background: var(--bg); border-radius: 20px 20px 0 0;
  padding: 0 calc(16px + var(--safe-r)) calc(20px + var(--safe-b)) calc(16px + var(--safe-l));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .25);
}
.ask-title { font-size: 22px; padding: 18px 0 6px; margin: 0; }
