:root {
  --bg: #f7efe2;
  --surface: #fffaf2;
  --card: #fffdf9;
  --line: #dbc5ab;
  --text: #3d2a1d;
  --muted: #6e5a4b;
  --brand: #be5a24;
  --brand-strong: #8b3f17;
  --accent: #e58d2f;
  --success: #2f7a3f;
  --error: #b43226;
  --warning: #b06c11;
  --radius: 14px;
  --shadow: 0 8px 22px rgba(95, 58, 25, 0.12);
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top, #fff6ea 0, var(--bg) 58%);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand-strong); }
a:hover { color: var(--brand); }
h1,h2,h3,p { margin-top: 0; }
input,textarea,select,button { font: inherit; }
button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: .55rem .85rem;
  background: var(--brand);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
}
button:hover { background: var(--brand-strong); }
button.secondary { background: #f3e3cb; border-color: var(--line); color: var(--text); }
button.danger { background: #b83e2a; }
button:disabled { opacity: .62; cursor: not-allowed; }
input,textarea,select {
  max-width: 100%;
  min-width: 0;
  width: 100%;
  padding: .58rem .64rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
textarea { min-height: 72px; resize: vertical; }
label { display: block; font-size: .92rem; margin-bottom: .65rem; }
.app-header {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(6px);
  background: rgba(255,247,235,.94);
  border-bottom: 1px solid var(--line);
}
.app-header__inner {
  max-width: 1100px; margin: 0 auto; padding: .75rem .95rem;
  display: flex; flex-direction: column; align-items: stretch; gap: .75rem;
}
.app-header__left {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.brand-link { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; }
.site-logo {
  width: clamp(100px, 30vw, 120px);
  max-width: 180px;
  max-height: 180px;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
}
.site-logo--hero {
  width: min(320px, 75vw);
  max-width: 320px;
}
.brand-title { font-weight: 800; letter-spacing: .02em; }
.brand-subtitle { font-size: .78rem; color: var(--muted); }
.app-nav, .appnav { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.app-nav a, .appnav a {
  text-decoration: none; color: var(--text); font-weight: 600; font-size: .88rem;
  border: 1px solid var(--line); padding: .34rem .62rem; border-radius: 999px; background: #fff7ea;
}
.app-nav a.is-active, .appnav a.is-active { background: #f6d6ac; border-color: #ca995f; }
.app-shell { max-width: 1100px; margin: 0 auto; padding: 1rem .9rem 2rem; }
.app-shell,
.card {
  width: 100%;
  min-width: 0;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .9rem;
  box-shadow: var(--shadow);
  margin-bottom: .8rem;
}
.grid { display:grid; gap:.7rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); }
.hidden { display: none !important; }
.muted,.small { color: var(--muted); }
.small { font-size: .85rem; }
.pill, .badge {
  padding: .2rem .55rem; border-radius: 999px; border: 1px solid var(--line);
  background: #fff2df; color: #5b3f2c; font-size: .75rem; font-weight: 700;
}
.status {
  display: inline-block; padding: .26rem .58rem; border-radius: 999px;
  font-size: .74rem; font-weight: 700; letter-spacing: .02em; border: 1px solid transparent;
  text-transform: uppercase;
}
.status.submitted { color: #70540d; background: #f7e9b0; border-color: #e2cb73; }
.status.paid { color: #114f72; background: #d7ecfa; border-color: #87bfdc; }
.status.packed { color: #7a3e11; background: #f8dfc7; border-color: #dea879; }
.status.en_route { color: #334f11; background: #e3f1c4; border-color: #b4d17a; }
.status.delivered { color: #165e2f; background: #d8f0df; border-color: #96ccaa; }
.status.cancelled { color: #7a2432; background: #f5d7de; border-color: #d8a0ac; }
.status.problem { color: #812814; background: #f8d8cf; border-color: #dfa59a; }

.status.event-open { color: #165e2f; background: #d8f0df; border-color: #96ccaa; }
.status.event-closed { color: #6b2a1d; background: #f6ded6; border-color: #dba292; }
.status.event-closed-early { color: #7a2432; background: #f5d7de; border-color: #d8a0ac; }
.status.event-inactive { color: #52525b; background: #e6e6eb; border-color: #c4c4cd; }
.status.event-not-open-yet { color: #4e3a09; background: #f7e9b0; border-color: #e2cb73; }
.table-wrap { overflow:auto; }
table { width:100%; border-collapse: collapse; }
th,td { border-bottom:1px solid var(--line); padding:.55rem .5rem; text-align:left; vertical-align: top; font-size: .9rem; }
tr:last-child td { border-bottom: 0; }
.message {
  color: #2f1f12;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  padding: .65rem .75rem;
  opacity: 1;
  transition: opacity .3s ease;
}
.message.error {
  color: #7a2432;
  background: #fff1f4;
  border-color: #d8a0ac;
}
.message.success {
  color: #165e2f;
  background: #e9f9ef;
  border-color: #96ccaa;
}
.fade-out { opacity: 0; }
.sticky-cart { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; }
.app-footer { border-top: 1px solid var(--line); color: var(--muted); padding: 1rem .9rem; text-align: center; font-size: .84rem; }
.rr-toast {
  position: fixed; right: .8rem; bottom: .8rem; z-index: 120;
  background: #3f2a1d; color: #fff; padding: .55rem .7rem; border-radius: 10px;
  box-shadow: 0 12px 25px rgba(0,0,0,.2);
}

/* Home + order */
.hero { text-align: center; padding-top: 1.2rem; }
.menu-item { border:1px solid var(--line); border-radius: 12px; padding: .7rem; background: #fff; }
.menu-item-head, .row { display:flex; gap:.6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.qty-row { display:flex; align-items:center; gap:.55rem; }
.qty-row button { width: 36px; height: 36px; padding: 0; }

/* Admin */
.rr-admin-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
  flex-wrap: wrap;
}
.rr-admin-login {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.35;
}
.link-card { display:block; border:1px solid var(--line); border-radius:12px; text-decoration:none; color:inherit; background:#fff8ef; padding:.75rem; }

.audit-json-wrap {
  margin-top: .35rem;
}

.audit-json-pre {
  margin: .35rem 0 0;
  padding: .65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff6ea;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .82rem;
  overflow-x: auto;
}

.event-items-list {
  display: grid;
  gap: .8rem;
  max-width: 100%;
  min-width: 0;
}
.event-item-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff8ef;
  padding: .75rem;
  display: grid;
  gap: .7rem;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: normal;
}
.event-item-main-fields,
.event-item-meta-fields {
  display: grid;
  gap: .65rem;
  max-width: 100%;
}
.event-item-field {
  margin: 0;
  min-width: 0;
}
.event-item-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  font-weight: 650;
  margin-bottom: .32rem;
}
.event-item-help {
  font-size: .8rem;
  color: var(--muted);
  margin-top: .28rem;
  overflow-wrap: anywhere;
}
.event-item-required,
.event-item-optional {
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: .68rem;
  font-weight: 700;
  line-height: 1;
  padding: .14rem .42rem;
}
.event-item-required {
  background: #f9dfcb;
  border-color: #dba57f;
}
.event-item-optional {
  background: #f8edd8;
}
.event-item-field--toggle {
  align-self: stretch;
}
.event-item-toggle {
  margin: 0;
  display: inline-flex;
  gap: .45rem;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}
.event-item-toggle input {
  width: auto;
}
.event-item-actions {
  display: flex;
  justify-content: flex-end;
}

.admin-form-grid,
.admin-event-form,
.form-actions,
.event-item-row,
.event-item-main-fields,
.event-item-meta-fields {
  min-width: 0;
}
.admin-event-form {
  width: 100%;
  max-width: 100%;
}
.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem .95rem;
  width: 100%;
  max-width: 100%;
}
.admin-form-field {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}
.admin-form-field--full {
  grid-column: 1 / -1;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.checkbox-label input {
  width: auto;
  flex: 0 0 auto;
}
.checkbox-label,
.checkbox-label > span,
.admin-form-field.checkbox-label {
  min-width: 0;
}
.form-actions {
  width: 100%;
  align-items: flex-start;
  justify-content: flex-start;
  gap: .6rem;
  flex-wrap: wrap;
}

.admin-event-form > .form-actions {
  margin-top: 1rem;
}

.form-actions button,
.form-actions .small {
  max-width: 100%;
}

.event-selector-field {
  margin-bottom: 0;
}

.event-selector-actions {
  margin-top: .85rem;
}


.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  margin-bottom: .7rem;
}
.card-header-row h3 {
  margin: 0;
}
.card-toggle {
  white-space: nowrap;
}
.collapsible-card.is-collapsed .collapsible-card-body {
  display: none;
}
.collapsible-card.is-collapsed {
  padding-bottom: .7rem;
}
.event-save-status {
  min-height: 1.2rem;
}
.admin-event-page,
.admin-event-page .row,
.admin-event-page .grid,
.admin-event-page .table-wrap,
.admin-event-page table,
.admin-event-page label,
.admin-event-page select {
  min-width: 0;
  max-width: 100%;
}

.admin-event-page .table-wrap {
  width: 100%;
}

.admin-event-page .row {
  width: 100%;
}

.admin-event-page input,
.admin-event-page textarea,
.admin-event-page select {
  width: 100%;
  max-width: 100%;
}

.event-item-actions {
  flex-wrap: wrap;
  max-width: 100%;
}

.admin-orders-toolbar {
  margin-top: 10px;
}

.order-list {
  padding: 1rem;
}

.order-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .95rem;
}

.order-card + .order-card {
  margin-top: 1rem;
}

.order-card .items,
.order-card .thumb,
.order-card > .small {
  margin-top: .7rem;
}

.order-card .thumb {
  display: block;
  width: auto;
  max-width: min(100%, 220px);
  max-height: 220px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: zoom-in;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .78);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1200;
}

.photo-lightbox.open {
  display: flex;
}

.photo-lightbox img {
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}

body.is-modal-open {
  overflow: hidden;
}

.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .8rem;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
}

.order-actions > * {
  max-width: 100%;
}

.order-actions .btn,
.order-actions button {
  white-space: normal;
}

.order-actions .btn.is-locked,
.order-actions button.is-locked {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
  filter: saturate(.6);
}

.order-actions .btn.is-locked:hover,
.order-actions button.is-locked:hover {
  transform: none;
  box-shadow: none;
}

@media (max-width: 860px){
  .grid.two,
  .admin-form-grid {
    grid-template-columns: 1fr;
  }
}
@media (min-width: 760px) {
  .event-item-main-fields {
    grid-template-columns: minmax(220px, 2fr) minmax(220px, 2fr);
  }
  .event-item-meta-fields {
    grid-template-columns: minmax(140px, 1.1fr) minmax(120px, .9fr) minmax(170px, 1fr);
    align-items: start;
  }
}
@media (max-width: 759px) {
  .event-item-main-fields,
  .event-item-meta-fields {
    grid-template-columns: 1fr;
  }
  .event-item-actions {
    justify-content: flex-start;
  }
}
@media (max-width: 420px) {
  .event-item-toggle,
  .checkbox-label {
    white-space: normal;
  }
}
@media (min-width: 768px) {
  .app-header__inner {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: .8rem 1rem;
  }
  .app-header__left {
    flex: 1 1 680px;
    min-width: 0;
  }
  .site-logo {
    width: clamp(140px, 14vw, 180px);
  }
  .rr-admin-meta {
    flex: 0 1 320px;
    text-align: right;
  }
}

@media (max-width: 767px) {
  .rr-admin-meta {
    justify-content: flex-start;
  }
}
@media (min-width: 768px){
  .sticky-cart{ position: sticky; max-width: 760px; margin: .8rem auto 0; border: 1px solid var(--line); border-radius: 12px; }
}
@media print {
  .app-header, .app-footer, .sticky-cart, button { display: none !important; }
}

.kv{display:grid;grid-template-columns:120px 1fr;gap:.3rem .7rem;}
.items{display:grid;gap:.45rem;}
.item{display:flex;justify-content:space-between;gap:.6rem;border-bottom:1px dashed var(--line);padding:.35rem 0;}
.section-h{margin-top:.9rem;font-weight:700;font-size:.88rem;color:var(--muted);text-transform:uppercase;}
.section-sep {
  margin-top: 1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
}
.photo{max-width:100%;border-radius:12px;border:1px solid var(--line);}
.btn{background:var(--brand);color:#fff;}
.btn.primary{background:var(--brand);}
.err{color:var(--error);}


/* Legal pages */
.privacy-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 1rem;
}
.privacy-page h1 {
  margin-bottom: .35rem;
  font-size: clamp(1.55rem, 2.2vw, 2rem);
  line-height: 1.2;
}
.privacy-page h2 {
  margin: 1.15rem 0 .45rem;
  font-size: .92rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.privacy-page p,
.privacy-page li {
  font-size: 1rem;
  line-height: 1.65;
}
.privacy-page ul {
  margin: .4rem 0 .9rem;
  padding-left: 1.3rem;
}
.privacy-page ul ul {
  margin-top: .45rem;
}
.privacy-page a {
  font-weight: 600;
}

/* Driver */
.next-stop { border: 2px solid #b4d17a; background: #fbfff2; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}


/* Terms & Conditions page */
.tac-page {
  max-width: 820px;
  margin-inline: auto;
}
.tac-page h2 {
  margin-top: 1.2rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .83rem;
  color: var(--muted);
}
.tac-box {
  margin-top: .4rem;
  margin-bottom: .8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff7ea;
  padding: .7rem .8rem;
}
.tac-box p:last-child {
  margin-bottom: 0;
}

.rr-notify-root {
  position: fixed;
  right: .8rem;
  bottom: .8rem;
  z-index: 250;
  display: grid;
  gap: .5rem;
  width: min(92vw, 360px);
}
.rr-toast {
  background: #3f2a1d;
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 25px rgba(0,0,0,.25);
  padding: .6rem .7rem;
  border: 1px solid rgba(255,255,255,.16);
}
.rr-toast-success { background: #2d5a3d; }
.rr-toast-error { background: #7a2432; }
.rr-toast-close { margin-top: .45rem; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); }

.pm-grid {
  display:grid;
  gap:10px;
  margin-top:10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

@media (max-width: 680px) {
  .pm-grid { grid-template-columns: minmax(0, 1fr); }
}

.pm-grid .payment-card,
.pm-grid .pm-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pm-cards .payment-card,
.pm-cards .pm-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pm-actions { margin:0; }
.pm-link { display:inline-block; padding:8px 10px; border-radius:10px; background:var(--brand); color:#fff; text-decoration:none; font-weight:600; }
.pm-empty { color:var(--muted); border: 1px dashed var(--line); border-radius: 10px; padding: .7rem; }
.pm-fallback { background: #fff4dd; color: #5b3f2c; border-color: #e2cb73; }

.payment-card,
.pm-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .55rem;
  align-content: start;
  height: 100%;
  overflow: hidden;
}

.payment-card__actions,
.payment-card__main {
  min-height: 0;
}

.payment-card__header,
.pm-head,
.payment-card__actions,
.payment-card__main,
.payment-card__footer {
  width: 100%;
  text-align: center;
}

.payment-card__actions.is-empty,
.payment-card__main.is-empty {
  display: none;
}

.payment-card__actions {
  display: flex;
  justify-content: center;
}

.payment-card__main {
  display: grid;
  gap: .65rem;
  min-width: 0;
  justify-items: center;
}

.payment-card__notes-wrap {
  margin-top: auto;
  display: flex;
  justify-content: center;
}

.payment-card__header,
.pm-head {
  display:flex;
  gap:10px;
  align-items:center;
  justify-content: center;
}

.payment-card__title,
.pm-title {
  font-weight: 700;
  font-size: 1.02rem;
}

.payment-card__notes {
  margin-top: 0;
  border: 1px solid #e4d8c7;
  background: #f8f5ef;
  border-radius: 10px;
  padding: .55rem .65rem;
  width: min(100%, 22rem);
  margin-inline: auto;
}

.payment-card__notes-label {
  color: #6b5a4d;
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: .15rem;
  white-space: nowrap;
}

.payment-card__notes-body {
  color: #3f2a1d;
  font-size: .92rem;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.payment-card__profile,
.pm-profile {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--line);
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
}

.payment-card__qr,
.pm-qr {
  width: min(220px, 100%);
  max-height: 240px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
}

.pm-qr-wrap { margin:0; }
.payment-card__qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
}
.payment-card__qr-caption { font-size: .82rem; color: var(--muted); }
.payment-qr { gap: .35rem; }
.payment-qr-label {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.3;
}

.pm-cards { display:grid; gap:.7rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items:stretch; }
.method { border:1px solid var(--line); border-radius:12px; padding:.7rem; background:#fff8ef; display:flex; flex-direction:column; height:100%; }
.method-head { display:flex; justify-content:space-between; align-items:center; gap:.5rem; }
.pm-admin-preview {
  margin-top: .6rem;
  gap: .85rem;
}

.pm-admin-preview .payment-card__profile {
  width: 60px;
  height: 60px;
  border-radius: 999px;
}
.pm-admin-preview .payment-card__qr {
  width: min(220px, 100%);
}
.pm-grid-fields { display:grid; gap:.6rem; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); }
.pm-field-full { grid-column: 1 / -1; }
.pm-image-grid { display:grid; gap:.8rem; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); margin-top:.5rem; }
.pm-warning-banner { background:#ffe9bd; border:1px solid #d9b165; color:#6b4209; border-radius:10px; padding:.65rem .75rem; margin:.5rem 0 .85rem; font-weight:700; }
.pm-dialog { border:1px solid var(--line); border-radius:12px; max-width:560px; width:92%; }
.pm-modal-warning { background:#ffe4d8; border:1px solid #dba292; border-radius:10px; padding:.55rem .65rem; color:#7a2432; font-weight:700; }

@media (min-width: 760px) {
  .pm-admin-preview { max-width: 360px; }
}
