:root {
  --bg: #faf6f1; --card: #fff; --ink: #1a1a1a; --muted: #6b6b6b; --line: #e4e0d8;
  --brand: #6b3e26; --brand-ink: #fff; --accent: #c8873f;
  --header: #6b3e26; --header-ink: #fff; --footer: transparent; --footer-ink: #7a6a5e;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --heading-case: none; --ok: #2f7d4f; --err: #b3261e; --warn: #9a6400;
  --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1; width: 100%; }
h1, h2, .g-name { text-transform: var(--heading-case); letter-spacing: -.01em; }
button, input, select, textarea { font-family: inherit; }
a { color: var(--brand); }
h1 { font-size: 1.8rem; line-height: 1.2; margin: 0 0 .3rem; }
h2 { font-size: 1.2rem; margin: 1.8rem 0 .7rem; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1200px; }
main.wrap { padding-top: 24px; padding-bottom: 64px; }
.top { background: var(--header); color: var(--header-ink); border-bottom: 1px solid rgba(0, 0, 0, .1); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 16px; flex-wrap: wrap; }
.brand { color: inherit; text-decoration: none; font-weight: 700; font-size: 1.05rem; display: inline-flex; align-items: center; gap: 10px; }
.brand img { height: 40px; max-width: min(320px, 60vw); object-fit: contain; display: block; }
.top nav { display: flex; gap: 18px; align-items: center; }
.top nav a, .top nav .link { color: var(--header-ink); opacity: .85; text-decoration: none; font-size: .95rem; }
.top nav form { margin: 0; }
.demo { background: #fff4d6; color: #6b4a00; text-align: center; padding: 6px 16px; font-size: .9rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.flush { padding: 0; overflow-x: auto; }
.card.narrow { max-width: 460px; margin: 24px auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small, small { font-size: .85rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--accent); margin: 0 0 4px; }
.eyebrow a { color: inherit; text-decoration: none; }
.sub { color: var(--muted); margin: 0; }
.right { text-align: right; } .nowrap { white-space: nowrap; }
.row-between { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 14px; }
label small { font-weight: 400; color: var(--muted); }
input, textarea, select { display: block; width: 100%; margin-top: 5px; font: inherit; padding: 10px 12px; border: 1px solid #d4d0c8; border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { font-family: ui-monospace, Menlo, monospace; font-size: .88rem; }
label.check { display: flex; gap: 8px; align-items: center; }
label.check input { width: auto; margin: 0; }
code { background: #f1e8de; padding: 1px 5px; border-radius: 5px; font-size: .88em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 6px;
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.btn.block { width: 100%; padding: 14px; font-size: 1.05rem; }
.btn.danger { background: var(--err); }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.link.small { font-size: .85rem; }
.danger { color: var(--err); }
.mobile-bar { display: none; }
.error { color: var(--err); font-weight: 600; }
.flash { padding: 10px 14px; border-radius: 10px; background: #e5f3ea; color: var(--ok); font-weight: 600; }
.flash.err { background: #fbe9e7; color: var(--err); }
.flash.warn { background: #fff4d6; color: var(--warn); }

/* Public footer with the staff login link */
.foot { background: var(--footer); color: var(--footer-ink); border-top: 1px solid var(--line); font-size: .9rem; margin-top: 24px; width: 100%; }
.foot .wrap { display: flex; justify-content: space-between; gap: 12px; padding-top: 18px; padding-bottom: 28px; }
.foot a { color: var(--footer-ink); opacity: .85; }

/* Teacher page */
.hero { margin-bottom: 20px; }
.facts { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.facts div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; }
.facts span { display: block; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.note { background: #fff; border-left: 4px solid var(--accent); padding: 8px 14px; border-radius: 6px; }
.order-grid { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
.cart { position: sticky; top: 16px; }
.cart h2 { margin-top: 0; }
.cat { margin-top: 1.2rem; }
.cat:first-child { margin-top: 0; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.item { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: 2px; min-height: 84px; }
.item:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(107, 62, 38, .08); }
.i-name { font-weight: 700; }
.i-desc { font-size: .85rem; color: var(--muted); }
.i-price { margin-top: auto; color: var(--brand); font-weight: 600; }
.cart-list { list-style: none; padding: 0; margin: 0 0 12px; }
.cart-list li, .receipt li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line-actions { display: flex; gap: 12px; margin-top: 2px; }
.tips { border: 0; padding: 0; margin: 0 0 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tips legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.tips label { margin: 0; }
.tips input { position: absolute; opacity: 0; width: 1px; }
.tips span { display: block; text-align: center; border: 1px solid #d4d0c8; border-radius: 10px; padding: 8px 0; font-weight: 600; cursor: pointer; }
.tips input:checked + span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.tips input:focus-visible + span { outline: 2px solid var(--accent); }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0 0 14px; }
.totals dd { margin: 0; text-align: right; }
.totals .grand { font-weight: 800; font-size: 1.1rem; padding-top: 6px; border-top: 1px solid var(--line); }
.receipt { list-style: none; padding: 0; margin: 16px 0; }

dialog { border: 0; border-radius: 18px; padding: 0; width: min(480px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(43, 29, 20, .45); }
dialog form { padding: 20px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg-head h2 { margin: 0; }
.x { background: none; border: 0; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--muted); }
.opt { border: 0; padding: 0; margin: 14px 0; }
.opt legend { font-weight: 700; margin-bottom: 6px; }
.chip { display: inline-block; margin: 0 6px 6px 0; font-weight: 500; }
.chip input { position: absolute; opacity: 0; width: 1px; }
.chip span { display: inline-block; border: 1px solid #d4d0c8; border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.chip input:checked + span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip input:checked + span small { color: inherit; opacity: .8; }
.chip.off span { opacity: .4; cursor: not-allowed; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); }
.dlg-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.qty { display: flex; align-items: center; border: 1px solid #d4d0c8; border-radius: 10px; }
.qty button { background: none; border: 0; font-size: 1.3rem; width: 40px; height: 40px; cursor: pointer; color: var(--brand); }
.qty output { min-width: 24px; text-align: center; font-weight: 700; }

/* Branding page */
.label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 5px; }
.color-field { display: flex; gap: 8px; margin-top: 5px; }
.color-field input[type=color] { width: 56px; height: 44px; padding: 3px; margin: 0; cursor: pointer; }
.color-field input[type=text] { margin: 0; font-family: ui-monospace, Menlo, monospace; }
.logo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.logo-preview { min-width: 120px; height: 56px; border: 1px dashed #d4d0c8; border-radius: 6px; display: flex; align-items: center; justify-content: center; padding: 6px; background: var(--header); }
.logo-preview img { max-height: 44px; max-width: 200px; }
.file-btn { margin: 0; } .file-btn input { display: none; }
.brand-preview { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 5px; }
.pv-top { background: var(--ph); color: var(--phi); border-bottom: 1px solid rgba(0,0,0,.1); padding: 10px 14px; display: flex; align-items: center; gap: 8px; }
.pv-top img { height: 26px; max-width: 140px; object-fit: contain; }
.pv-body { background: var(--pg); padding: 12px 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pv-eyebrow { color: var(--pa); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; width: 100%; }
.pv-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-weight: 700; }
.pv-h { width: 100%; font-size: 1.15rem; }
.pv-foot { background: var(--pf); color: var(--pfi); padding: 8px 14px; font-size: .8rem; text-align: right; }
.pv-btn { background: var(--pb); color: var(--pi); border-radius: 8px; padding: 6px 12px; font-weight: 700; }

/* Emails page */
.email-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
textarea.prose { font-family: inherit; font-size: .95rem; line-height: 1.5; }
.placeholders { list-style: none; padding: 0; margin: 0 0 16px; font-size: .88rem; color: var(--muted); columns: 2; }
.placeholders li { margin-bottom: 4px; break-inside: avoid; }
.email-preview { width: 100%; height: 760px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-top: 5px; }
@media (max-width: 860px) { .email-grid { grid-template-columns: 1fr; } .placeholders { columns: 1; } .email-preview { height: 640px; } }

/* Menu help */
.menu-help { margin-bottom: 18px; }
.menu-help p { margin: 0 0 10px; }
.menu-help .table td { padding: 8px 10px; vertical-align: middle; }
.menu-help code { overflow-wrap: anywhere; }

/* Photos */
.photo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 5px 0 14px; }
.photo-preview { width: 150px; height: 96px; border: 1px dashed #d4d0c8; border-radius: 6px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #fff; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.photo-actions .check { margin: 0; }
.mi-body { display: grid; grid-template-columns: 1fr auto; gap: 0 20px; align-items: start; }
.item.has-photo { padding: 0 0 14px; overflow: hidden; }
.item.has-photo > span { padding: 0 14px; }
.i-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; margin-bottom: 10px; background: var(--line); }
.dlg-photo { width: calc(100% + 40px); margin: -20px -20px 14px; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.group-banner { width: 100%; aspect-ratio: 4 / 1; min-height: 140px; object-fit: cover; border-radius: var(--radius); display: block; margin-bottom: 18px; }
.group-card.has-photo { padding-top: 0; overflow: hidden; }
.g-photo { width: calc(100% + 40px); margin: 0 -20px 8px; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--line); }
.hero-photo { position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; min-height: 260px; display: flex; align-items: flex-end;
  background: linear-gradient(to top, rgba(0,0,0,.65), rgba(0,0,0,.05) 70%), var(--hero) center / cover no-repeat; }
.hero-photo .hero-inner { padding: 28px; color: #fff; }
.hero-photo h1, .hero-photo .sub { color: #fff; }
.hero-photo .eyebrow { color: #fff; opacity: .9; }
@media (max-width: 860px) {
  .mi-body { grid-template-columns: 1fr; }
  .hero-photo { min-height: 200px; }
  .hero-photo .hero-inner { padding: 20px; }
  .group-banner { aspect-ratio: 5 / 2; }
}

/* Homepage */
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.group-card { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; text-decoration: none; color: inherit; }
.group-card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(107, 62, 38, .1); }
.g-name { font-size: 1.25rem; font-weight: 800; }
.g-title { color: var(--muted); margin-top: -4px; }
.g-row { display: flex; justify-content: space-between; gap: 12px; font-size: .92rem; border-top: 1px solid var(--line); padding-top: 6px; }
.g-row span { color: var(--muted); }
.g-row b { text-align: right; }
.g-go { margin-top: 6px; color: var(--brand); font-weight: 700; }

/* Admin */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table td.w { width: 70px; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; vertical-align: middle; text-transform: uppercase; letter-spacing: .04em; }
.pill.open { background: #e5f3ea; color: var(--ok); }
.pill.closed { background: #eee7e0; color: var(--muted); }
.pill.late { background: #fff0d6; color: var(--warn); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stats .card { padding: 14px 16px; }
.stats span { display: block; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stats b { font-size: 1.6rem; display: block; }
.stats b.smaller { font-size: 1.05rem; padding: 6px 0 2px; }
.stats small { color: var(--muted); }
.share { display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; }
.share > div:first-child { flex: 1; min-width: 260px; }
.copy { display: flex; gap: 8px; margin: 4px 0 6px; }
.copy input { margin: 0; font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
form.inline { display: inline; margin-left: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.span2 { grid-column: 1 / -1; }
fieldset.sub-grid { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset[hidden] { display: none; }
.kind { border: 0; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kind legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.kind label { margin: 0; }
.kind input { position: absolute; opacity: 0; width: 1px; }
.kind span { display: block; border: 1px solid #d4d0c8; border-radius: 12px; padding: 12px 14px; cursor: pointer; height: 100%; }
.kind span small { display: block; font-weight: 400; color: var(--muted); }
.kind input:checked + span { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: color-mix(in srgb, var(--brand) 7%, #fff); }
.kind input:focus-visible + span { outline: 2px solid var(--accent); }
.menu-item { margin-bottom: 12px; }
.menu-item.inactive { opacity: .6; }
.mi-main { display: grid; grid-template-columns: 2fr 1.3fr 1fr .6fr auto; gap: 0 12px; align-items: end; }
.danger-zone { margin-top: 40px; color: var(--muted); }
.danger-zone summary { cursor: pointer; }

@media (max-width: 860px) {
  .order-grid { grid-template-columns: 1fr; }
  .cart { position: static; scroll-margin-top: 12px; }
  .items { grid-template-columns: 1fr 1fr; }
  .mobile-bar:not([hidden]) { display: flex; justify-content: space-between; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 5;
    background: var(--brand); color: var(--brand-ink); padding: 14px 18px; border-radius: 12px; text-decoration: none; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
  main.wrap { padding-bottom: 32px; }
  body:has(.mobile-bar:not([hidden])) .foot .wrap { padding-bottom: 96px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .form-grid, .kind { grid-template-columns: 1fr; }
  .mi-main { grid-template-columns: 1fr 1fr; }
  .table th, .table td { padding: 10px 12px; }
  h1 { font-size: 1.5rem; }
}
