:root {
  --sienna: #b4532a;
  --sienna-dark: #8f3f1d;
  --sienna-tint: #f6e6dc;
  --olive: #5c6630;
  --olive-dark: #434a22;
  --olive-tint: #eceedd;
  --bg: #faf8f3;
  --card: #ffffff;
  --text: #2a2722;
  --muted: #6f6a60;
  --line: #e3ded2;
  --err: #a12d22;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; line-height: 1.2; }
h1 { font-size: 1.8rem; margin: 0 0 .4rem; }
h2 { font-size: 1.3rem; margin: 2rem 0 .75rem; color: var(--olive-dark); }
h3 { font-size: 1.05rem; margin: 0 0 .5rem; color: var(--sienna-dark); }
a { color: var(--sienna); }
.wrap { max-width: 820px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 6rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
code { background: var(--olive-tint); padding: 0 .3em; border-radius: 4px; }

/* header */
.top { background: var(--olive-dark); color: #fff; margin-bottom: 1.5rem; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 56px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-family: Georgia, serif; font-size: 1.15rem; font-weight: 600; }
.top nav { display: flex; gap: .25rem; }
.top nav a { color: #e7e9d6; text-decoration: none; padding: .4rem .7rem; border-radius: 6px; font-size: .95rem; }
.top nav a.on, .top nav a:hover { background: rgba(255,255,255,.14); color: #fff; }

/* generic bits */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.card h2:first-child { margin-top: 0; }
.card.narrow { max-width: 380px; margin: 2rem auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.crumb { margin: 0 0 .5rem; font-size: .9rem; }
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin: 1rem 0; }
.flash.ok { background: var(--olive-tint); border: 1px solid #cfd3b0; }
.flash.err { background: #fbe9e6; border: 1px solid #efc2bb; color: var(--err); }
.flash ul { margin: 0; padding-left: 1.2rem; }

button, .button {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--sienna); color: #fff; border: 0; border-radius: 8px;
  padding: .6rem 1.1rem; text-decoration: none; line-height: 1.3;
}
button:hover, .button:hover { background: var(--sienna-dark); }
button.secondary, .button.secondary { background: #fff; color: var(--olive-dark); border: 1px solid #c9cdb0; }
button.secondary:hover, .button.secondary:hover { background: var(--olive-tint); }
button.link { background: none; color: var(--sienna); padding: .25rem 0; font-weight: 500; }
button.link.danger { color: var(--err); }
.small-btn { padding: .35rem .7rem; font-size: .875rem; }

input, select, textarea {
  font: inherit; color: inherit; background: #fff;
  border: 1px solid #cbc5b7; border-radius: 8px; padding: .55rem .7rem; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--olive); outline-offset: 1px; border-color: var(--olive); }
.stack { display: grid; gap: .4rem; }
.stack label { font-weight: 600; margin-top: .5rem; }
.stack button { justify-self: start; margin-top: .75rem; }
.inline-form { display: flex; gap: .5rem; margin: 1rem 0; }
.inline-form input { flex: 1; }
.inline-form select { width: auto; }

/* order page */
.pricing { margin: .25rem 0; }
.deadline { margin: .5rem 0; padding: .5rem .75rem; background: var(--olive-tint); border-radius: 8px; display: inline-block; }
.deadline.closed { background: var(--sienna-tint); color: var(--sienna-dark); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled .dish { opacity: .7; }
.opt-tag { font: 500 .75rem system-ui, sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; margin-left: .25rem; }
.dishes { display: grid; gap: .5rem; }
.dish { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s, box-shadow .15s; }
.dish-head { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; cursor: pointer; }
.dish-head input { width: 1.15rem; height: 1.15rem; margin: .2rem 0 0; flex: none; accent-color: var(--sienna); }
.dish-text { display: grid; gap: .15rem; }
.dish-name { font-weight: 600; }
.dish-desc { color: var(--muted); font-size: .9rem; }
.dish-note { color: var(--muted); font-size: .8rem; font-style: italic; }
.dish.none .dish-name { font-weight: 500; color: var(--muted); }
.dish:has(> .dish-head input:checked) { border-color: var(--sienna); box-shadow: 0 0 0 1px var(--sienna); }
.dish:has(> .dish-head input:checked) .dish-name { color: var(--sienna-dark); }
.tag { display: inline-block; font: 700 .65rem/1 system-ui, sans-serif; text-decoration: none; color: #fff; background: var(--olive); border-radius: 999px; padding: .25em .45em; vertical-align: .15em; }
.tag.vegan { background: #2f6b3a; }

.opts { display: none; padding: 0 1rem 1rem 2.9rem; gap: .75rem; }
.dish:has(> .dish-head input:checked) > .opts { display: grid; }
.opt { display: grid; gap: .35rem; }
.opt-label { font-size: .85rem; font-weight: 600; color: var(--olive-dark); }
.opt select { width: auto; min-width: 5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-block; padding: .4rem .75rem; border: 1px solid #c9cdb0; border-radius: 999px; font-size: .9rem; background: #fff; }
.chip input:checked + span { background: var(--olive); border-color: var(--olive); color: #fff; }
.chip input[type="checkbox"] + span::before { content: "+"; display: inline-block; width: 1em; font-weight: 700; }
.chip input[type="checkbox"]:checked + span::before { content: "✓"; }
.chip input:focus-visible + span { outline: 2px solid var(--sienna); outline-offset: 2px; }

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem max(16px, calc((100vw - 820px) / 2 + 16px));
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.price { font-weight: 600; }
.price.warn { color: var(--sienna-dark); font-weight: 500; }

/* orders page */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 1rem 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; display: grid; }
.stat-n { font: 600 1.5rem Georgia, serif; color: var(--olive-dark); }
.stat-n small { font-size: 1rem; color: var(--muted); }
.stat-l { font-size: .8rem; color: var(--muted); }
.missing { background: var(--sienna-tint); padding: .6rem .9rem; border-radius: 8px; }
.totals-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.totals-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.totals { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.totals > li { display: flex; gap: .5rem; }
.totals .n { font-weight: 700; color: var(--sienna-dark); min-width: 2rem; }
.variants { list-style: none; padding: 0; margin: .15rem 0 0; font-size: .85rem; color: var(--muted); }
.notes { padding-left: 1.2rem; }
table.people { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.people th, .people td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .92rem; }
.people th { background: var(--olive-tint); color: var(--olive-dark); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.people .num { text-align: right; white-space: nowrap; }
.people tr.note-row td { background: #fdf6f1; color: var(--sienna-dark); font-size: .85rem; padding-top: .35rem; }
.print-only { display: none; }

/* admin */
.people-admin { display: grid; border-top: 1px solid var(--line); }
.pa-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pa-main { display: grid; min-width: 0; flex: 1 1 260px; }
.pa-main .small { color: var(--muted); }
.pa-main .pending { color: var(--sienna-dark); }
.pa-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.role-form select { width: auto; padding: .3rem .5rem; font-size: .875rem; }
.more { position: relative; font-size: .875rem; }
.more summary { cursor: pointer; color: var(--muted); padding: .3rem .4rem; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more[open] { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; flex-basis: 100%; }
.rename-form { display: flex; gap: .4rem; align-items: center; }
.rename-form input { width: 11rem; padding: .3rem .5rem; font-size: .875rem; }
.changes { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; font-size: .92rem; }

@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: span 2; }
  .totals-grid { grid-template-columns: 1fr; }
  .opts { padding-left: 1rem; }
  table.people, .people tbody, .people tr, .people td { display: block; }
  .people thead { display: none; }
  .people tr { border-bottom: 1px solid var(--line); padding: .4rem 0; }
  .people td { border: 0; padding: .15rem .75rem; display: flex; gap: .5rem; }
  .people td::before { content: attr(data-label); min-width: 4.5rem; color: var(--muted); font-size: .8rem; }
  .people td.num { text-align: left; }
  .people tr.note-row { padding-top: 0; }
  .people tr.note-row td::before { content: none; }
  .inline-form { flex-wrap: wrap; }
}

@media print {
  body { background: #fff; font-size: 11pt; }
  .top, .no-print { display: none !important; }
  .print-only { display: block; }
  main.wrap { padding: 0; max-width: none; }
  .stat, .totals-col, table.people { border-color: #999; }
  .totals-col, .people tr { break-inside: avoid; }
  h2 { margin-top: 1.2rem; }
}
