/* Pedidos — shared styles. Mobile-first: works from 320 px up.
   Customer pages keep the warm paper palette; the admin (body.admin) uses the
   Despelia chrome (navy + amber). One spacing scale, one radius scale. */

:root {
  --paper: #f7f3ec;
  --paper-2: #efe9df;
  --card: #fffdf9;
  --ink: #23201c;
  --ink-2: #5a544c;
  --line: #ddd4c6;
  --accent: #a63d2a;
  --accent-hover: #8f3424;
  --accent-ink: #ffffff;
  --accent-soft: #f3e1dc;
  --focus: #e0a493;
  --ok: #2f6b3a;
  --ok-soft: #e1eedf;
  --warn: #8a5a00;
  --warn-soft: #f6ead0;
  --danger: #9b2c1c;
  --danger-soft: #f8e3de;
  --danger-line: #d6a597;

  /* Spacing scale (4 px base) */
  --s-1: .25rem;
  --s-2: .5rem;
  --s-3: .75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;

  /* Radius scale */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --radius: var(--r);

  --tap: 44px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Admin and superadmin: Despelia chrome. */
body.admin {
  --paper: #f4f5f7;
  --paper-2: #e8ebf0;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #4b5567;
  --line: #d9dee6;
  --accent: #0f172a;
  --accent-hover: #1e293b;
  --accent-ink: #ffffff;
  --accent-soft: #e8ebf0;
  --brand: #f6a623;
  --focus: #f6a623;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: break-word;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; overflow-wrap: anywhere; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
img, svg, video { max-width: 100%; }

.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 600; color: var(--ink-2); margin-bottom: var(--s-1); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.break { overflow-wrap: anywhere; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (min-width: 760px) {
  h1 { font-size: 1.65rem; }
  h2 { font-size: 1.25rem; }
}

/* ---------- Top bar (admin) ---------- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--ink); color: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .18);
}
.topbar__inner {
  position: relative;
  max-width: 1100px; margin: 0 auto; padding: var(--s-1) var(--s-4);
  min-height: 56px; display: flex; align-items: center; gap: var(--s-3);
}
.brand {
  display: flex; align-items: center; gap: var(--s-2); min-width: 0; min-height: var(--tap);
  color: #fff; font-weight: 800; text-decoration: none; font-size: 1.05rem;
}
.brand__mark { color: var(--brand, #f6a623); flex: 0 0 auto; }
.brand__bar {
  font-weight: 500; color: #cbd5e1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-toggle {
  display: none; flex: 0 0 auto; align-items: center; gap: var(--s-2); margin-left: auto;
  min-height: var(--tap); min-width: var(--tap); padding: 0 var(--s-3);
  border: 1px solid #334155; border-radius: var(--r-sm); background: transparent;
  color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.nav-toggle__icon, .nav-toggle__icon::before, .nav-toggle__icon::after {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.nav-toggle__icon { position: relative; }
.nav-toggle__icon::before, .nav-toggle__icon::after { content: ""; position: absolute; left: 0; }
.nav-toggle__icon::before { transform: translateY(-6px); }
.nav-toggle__icon::after { transform: translateY(6px); }
.nav-toggle[aria-expanded="true"] .nav-toggle__icon { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__icon::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__icon::after { transform: rotate(-45deg); }

.nav { display: flex; align-items: center; gap: 0 var(--s-1); flex-wrap: wrap; margin-left: auto; }
.nav a, .nav .linklike {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-2);
  color: #e2e8f0; text-decoration: none; font-size: .95rem; border-radius: var(--r-sm);
}
.nav a:hover, .nav .linklike:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -3px 0 var(--brand, #f6a623); }
.nav__logout { margin: 0; }
.nav .linklike { text-decoration: none; }

/* Below 900 px the nav becomes a drop-down panel under the sticky bar. */
@media (max-width: 899px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%;
    display: grid; gap: 2px; padding: var(--s-2) var(--s-4) var(--s-4);
    background: var(--ink); border-top: 1px solid #1e293b;
    box-shadow: 0 12px 24px rgba(15, 23, 42, .3);
    max-height: calc(100vh - 56px); overflow-y: auto; overscroll-behavior: contain;
    opacity: 0; transform: translateY(-8px); visibility: hidden; pointer-events: none;
    transition: opacity .2s var(--ease), transform .2s var(--ease), visibility 0s linear .2s;
  }
  .topbar.is-open .nav {
    opacity: 1; transform: none; visibility: visible; pointer-events: auto;
    transition: opacity .2s var(--ease), transform .2s var(--ease), visibility 0s;
  }
  .nav a, .nav .linklike { width: 100%; min-height: 48px; padding: 0 var(--s-3); font-size: 1rem; text-align: left; }
  .nav a[aria-current="page"] { background: rgba(246, 166, 35, .14); box-shadow: inset 3px 0 0 var(--brand, #f6a623); }
  .nav__logout { border-top: 1px solid #1e293b; margin-top: var(--s-2); padding-top: var(--s-2); }
}

/* ---------- Page layout ---------- */

.page { max-width: 1100px; margin: 0 auto; padding: var(--s-4) var(--s-4) var(--s-6); }
.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.narrow-lg { max-width: 760px; margin-left: auto; margin-right: auto; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.page-head h1 { margin: 0; min-width: 0; }
.page-head__intro { flex: 1 1 100%; margin: 0; }
@media (max-width: 759px) {
  .page-head > .btn { width: 100%; }
}

.back-link { display: inline-flex; align-items: center; min-height: var(--tap); margin-bottom: var(--s-2); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--s-4); margin-bottom: var(--s-4); min-width: 0;
}
.card > :last-child { margin-bottom: 0; }
@media (min-width: 760px) { .card { padding: 1.25rem; } }
.card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-3); }
.card__head h2 { margin: 0; }

.grid { display: grid; gap: var(--s-4); }
.grid > * { min-width: 0; }
@media (min-width: 800px) { .grid--2 { grid-template-columns: 1fr 1fr; } .grid--3 { grid-template-columns: repeat(3, 1fr); } }

.row { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.row--between { justify-content: space-between; }
.stack > * + * { margin-top: var(--s-3); }

.empty {
  text-align: center; color: var(--ink-2); padding: var(--s-5) var(--s-4);
  border: 2px dashed var(--line); border-radius: var(--r); background: var(--paper);
}
.empty strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: var(--s-1); }
.empty p { margin: 0; }

/* ---------- Flash ---------- */

.flash { padding: var(--s-3) var(--s-4); border-radius: var(--r); border: 1px solid var(--line); background: var(--card); overflow-wrap: anywhere; }
.flash > :last-child { margin-bottom: 0; }
.flash--ok { background: var(--ok-soft); border-color: #bcd6b8; color: var(--ok); }
.flash--error { background: var(--danger-soft); border-color: #e2b9ae; color: var(--danger); }
.flash--info { background: var(--warn-soft); border-color: #e6d2a6; color: var(--warn); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap); padding: .55rem 1.1rem; border-radius: var(--r-sm);
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer;
  transition: transform .15s var(--ease), opacity .15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn--ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--paper-2); border-color: var(--ink-2); }
.btn--small { min-height: 38px; padding: .3rem .8rem; font-size: .9rem; }
.btn--block { width: 100%; }
.btn--danger { background: var(--card); color: var(--danger); border-color: var(--danger-line); }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.inline-form { display: inline; margin: 0; }

/* Touch layouts: every control at least 44 px tall. */
@media (max-width: 759px), (pointer: coarse) {
  .btn--small { min-height: var(--tap); font-size: .95rem; }
}

.form-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); }
.form-actions--sticky {
  position: sticky; bottom: 0; z-index: 5;
  margin: var(--s-4) calc(-1 * var(--s-4)) calc(-1 * var(--s-4));
  padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r);
}
@media (max-width: 759px) {
  .form-actions > .btn, form > .btn:not(.btn--small):last-child { width: 100%; }
}
@media (min-width: 760px) {
  .form-actions--sticky { margin: var(--s-4) -1.25rem -1.25rem; padding: var(--s-3) 1.25rem; }
}

/* ---------- Forms ---------- */

label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field { margin-bottom: var(--s-4); min-width: 0; }
.field__hint { font-weight: 400; color: var(--ink-2); font-size: .875rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="tel"],
input[type="time"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; max-width: 100%; min-height: var(--tap); padding: .55rem .7rem;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; color: var(--ink);
  font: inherit; font-size: 16px; /* 16 px stops iOS from zooming in on focus */
}
input[type="file"] { max-width: 100%; font: inherit; font-size: .95rem; min-height: var(--tap); }
input:focus, select:focus, textarea:focus { border-color: var(--ink-2); }
textarea { min-height: 88px; resize: vertical; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 400; margin-bottom: var(--s-1); min-height: var(--tap); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; flex: 0 0 auto; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 var(--s-4); }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s-3) var(--s-4); margin: 0 0 var(--s-4); min-width: 0; }
legend { font-weight: 700; padding: 0 .3rem; }

/* Settings-style sections: a heading, a hint, then the fields. */
fieldset.section { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: var(--s-5) 0 0; margin: var(--s-5) 0 0; }
fieldset.section > legend { float: left; width: 100%; padding: 0; margin: 0 0 var(--s-2); font-size: 1.1rem; }
fieldset.section > legend + * { clear: both; }
fieldset.section--first { border-top: 0; padding-top: 0; margin-top: var(--s-2); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.list { width: 100%; border-collapse: collapse; background: var(--card); }
table.list th, table.list td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: .8125rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; }
table.list td.cell-actions { text-align: right; }
table.list td.cell-actions .inline-form { display: inline-block; margin: 2px 0; }

/* Below 900 px (phones and portrait tablets, same breakpoint as the admin menu)
   a data table becomes a list of cards: one card per row, "label  value" lines
   from data-label, actions as full-width buttons. */
@media (max-width: 899px) {
  .table-wrap { overflow: visible; }
  table.list--cards, table.list--cards tbody, table.list--cards tr, table.list--cards td,
  table.list--cards tbody th[scope="row"] { display: block; width: 100%; }
  table.list--cards { background: transparent; }
  table.list--cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  table.list--cards tr {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
    padding: var(--s-1) var(--s-3); margin-bottom: var(--s-3);
  }
  table.list--cards tr.is-off { background: var(--paper-2); }
  table.list--cards td, table.list--cards tbody th[scope="row"] {
    border: 0; padding: var(--s-2) 0; text-align: left; white-space: normal; overflow-wrap: anywhere; background: transparent;
  }
  table.list--cards td + td { border-top: 1px dashed var(--line); }
  table.list--cards td[data-label] { position: relative; padding-left: 40%; min-height: calc(var(--tap) - 4px); }
  table.list--cards td[data-label]::before {
    content: attr(data-label); position: absolute; left: 0; top: var(--s-2); width: calc(40% - var(--s-3));
    font-size: .8125rem; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em;
  }
  table.list--cards td.num { text-align: left; }
  table.list--cards td.cell-actions { display: flex; flex-direction: column; align-items: stretch; gap: var(--s-2); padding-top: var(--s-3); text-align: left; }
  table.list--cards td.cell-actions form { display: block; margin: 0; }
  table.list--cards td.cell-actions .btn { width: 100%; }
  table.list--cards td.card-title { font-size: 1.05rem; }
  table.list--cards td:empty { display: none; }
  /* Plain links inside cards (product names, "Ver carta") get a full touch target. */
  table.list--cards td a:not(.btn) { display: inline-flex; align-items: center; min-height: var(--tap); }
}

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8125rem; font-weight: 600; background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--accent { background: var(--danger-soft); color: var(--danger); }

.secret { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 1.1rem; background: var(--paper-2); padding: .2rem .5rem; border-radius: 6px; user-select: all; overflow-wrap: anywhere; }

/* ---------- Admin helpers ---------- */

.grow { flex: 1 1 12rem; min-width: 0; }
.w-sort, .w-num { width: 5.5rem; }
.w-money { width: 6.5rem; text-align: right; }
.w-label { width: 11rem; }
.input-title { font-weight: 700; font-size: 1.05rem; }
.error { color: var(--danger); }
.is-off td { color: var(--ink-2); background: var(--paper-2); }
.stat { margin-bottom: 0; }
.stat__value { font-size: 1.75rem; font-weight: 800; margin: 0; overflow-wrap: anywhere; }
.check-inline { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; margin: 0; min-height: var(--tap); }
.check-inline input { width: 5rem; }
.group-pick { border-bottom: 1px dashed var(--line); padding: .35rem 0; }
.group-pick:last-child { border-bottom: 0; }
details > summary { cursor: pointer; list-style: none; padding: .25rem 0; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: var(--s-3); }
.summary-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); }
.summary-row__toggle { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-3); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: .9rem; font-weight: 600; background: var(--card); }
details[open] .summary-row__toggle { background: var(--paper-2); }
.edit-box { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s-3); margin-bottom: var(--s-3); background: var(--paper); }
.options-table input[type="text"], .options-table input[type="number"] { min-height: 40px; }
.options-table input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }
.new-row td { background: var(--paper); }

@media (max-width: 759px) {
  .w-label, .w-money { width: 100%; }
  .options-table input[type="text"], .options-table input[type="number"] { min-height: var(--tap); }
  table.list--cards .new-row { border-style: dashed; background: var(--paper); }
  table.list--cards .new-row td { background: transparent; }
  .row > .btn { flex: 1 1 auto; }
}

/* ---------- Printable QR sheet ---------- */

.print-page { background: #fff; }
.print-toolbar { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: space-between; align-items: center; padding: var(--s-4); max-width: 900px; margin: 0 auto; }
.print-toolbar a { display: inline-flex; align-items: center; min-height: var(--tap); }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: var(--s-4); max-width: 900px; margin: 0 auto; padding: 0 var(--s-4) var(--s-6); }
.qr-card { border: 2px solid var(--ink); border-radius: 14px; padding: 1.25rem var(--s-4) var(--s-4); text-align: center; break-inside: avoid; page-break-inside: avoid; }
.qr-card__bar { font-weight: 700; font-size: 1.1rem; margin: 0 0 var(--s-2); overflow-wrap: anywhere; }
.qr-card__code { width: 200px; height: 200px; max-width: 100%; margin: 0 auto; }
.qr-card__code svg { width: 100%; height: 100%; display: block; }
.qr-card__table { font-size: 1.6rem; font-weight: 800; margin: var(--s-2) 0 .15rem; color: var(--accent); overflow-wrap: anywhere; }
.qr-card__hint { margin: 0; color: var(--ink-2); }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .qr-grid { grid-template-columns: 1fr 1fr; gap: 10mm; padding: 0; max-width: none; }
  .qr-card { border-color: #000; }
  .qr-card__table { color: #000; }
}

/* ---------- Opening hours editor ---------- */

.schedule th[scope="row"] { white-space: nowrap; }
.schedule__slot { white-space: nowrap; }
.schedule__slot input[type="time"] { width: 7.2rem; min-height: 40px; padding: .3rem .4rem; }
@media (max-width: 759px) {
  table.schedule tbody th[scope="row"] { font-size: 1.05rem; text-transform: none; letter-spacing: 0; color: var(--ink); }
  .schedule__slot { white-space: normal; }
  table.schedule td.schedule__slot[data-label] { display: flex; align-items: center; gap: var(--s-2); padding-left: 0; }
  table.schedule td.schedule__slot[data-label]::before { position: static; flex: 0 0 4.5rem; width: auto; }
  .schedule__slot input[type="time"] { flex: 1 1 0; width: auto; min-width: 0; min-height: var(--tap); }
}

.status-list { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: var(--s-2) var(--s-4); margin: 0 0 var(--s-4); align-items: center; }
.status-list dt { font-weight: 600; }
.status-list dd { margin: 0; }

/* ---------- Settings: logo / cover upload ---------- */

.branding__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); }
.branding__row label { flex: 1 0 100%; }
.branding__row input[type="file"] { flex: 1 1 14rem; min-width: 0; }
.branding__preview { display: block; border: 1px solid var(--line); background: var(--paper-2); object-fit: cover; }
.branding__preview--logo { width: 64px; height: 64px; border-radius: var(--r); }
.branding__preview--cover { width: 192px; height: 64px; border-radius: 6px; }
.links-inline { display: flex; flex-wrap: wrap; gap: 0 var(--s-3); }
.links-inline a { display: inline-flex; align-items: center; min-height: var(--tap); }

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Dish photos (admin) ---------- */

.prod-cell { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.prod-cell__thumb { width: 48px; height: 48px; flex: 0 0 48px; border-radius: var(--r-sm); object-fit: cover; background: var(--paper-2); }
.prod-cell__text { min-width: 0; }
.photo-field__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.photo-field__preview, .photo-field__empty { width: 88px; height: 88px; flex: 0 0 88px; border-radius: var(--r); object-fit: cover; border: 1px solid var(--line); }
.photo-field__empty { display: grid; place-items: center; background: var(--paper); color: var(--ink-2); font-size: .8125rem; border-style: dashed; }
.photo-field__inputs { flex: 1 1 12rem; min-width: 0; }

/* ---------- Allergen icons (shared): one tint + ink per allergen ---------- */

.al-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.al--gluten { --al-fg: #855600; --al-bg: #f6e7c1; }
.al--crustaceans { --al-fg: #a8361c; --al-bg: #fde0d9; }
.al--eggs { --al-fg: #7f6200; --al-bg: #fff0bd; }
.al--fish { --al-fg: #1f5f8b; --al-bg: #dcecf7; }
.al--peanuts { --al-fg: #7a4f25; --al-bg: #f1e3d3; }
.al--soybeans { --al-fg: #46661c; --al-bg: #e3efd5; }
.al--milk { --al-fg: #2f5d8a; --al-bg: #e3edf8; }
.al--nuts { --al-fg: #6d4325; --al-bg: #efe0d0; }
.al--celery { --al-fg: #2b6b3c; --al-bg: #dcf0df; }
.al--mustard { --al-fg: #7d6300; --al-bg: #faedbd; }
.al--sesame { --al-fg: #66553a; --al-bg: #f1e9dc; }
.al--sulphites { --al-fg: #8a2f5c; --al-bg: #f5e0ea; }
.al--lupin { --al-fg: #5b3f8f; --al-bg: #e9e2f5; }
.al--molluscs { --al-fg: #1d6764; --al-bg: #d9efee; }
.al-icon {
  display: inline-block; flex: 0 0 auto; width: 22px; height: 22px; padding: 3px; border-radius: 999px;
  color: var(--al-fg, var(--ink-2)); background: var(--al-bg, var(--paper-2)); vertical-align: middle;
}
.check--al { gap: var(--s-2); }
.checks--al { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

/* ---------- Admin polish ---------- */

body.admin .card { box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.stat { position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand, var(--accent)); }
.stat--sales::before { background: #16a34a; }
.stat--tables::before { background: #2563eb; }
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: var(--s-3); margin: var(--s-4) 0; }
.quick-link {
  display: flex; flex-direction: column; gap: 2px; min-height: 64px; padding: var(--s-3) var(--s-4);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05); transition: transform .15s var(--ease);
}
.quick-link strong::after { content: " →"; color: var(--brand, var(--accent)); }
.quick-link span { color: var(--ink-2); font-size: .875rem; }
.quick-link:hover { border-color: var(--ink-2); }
.quick-link:active { transform: translateY(1px); }

/* ---------- Image pickers (product photo, logo, cover) ----------
   Without JS the native file input stays visible. With JS (html.js) it is
   visually hidden but still focusable, and a styled label opens it. */

.file-pick__box { flex: 0 0 auto; }
.file-pick__preview { display: block; width: 88px; height: 88px; border-radius: var(--r); object-fit: cover; border: 1px solid var(--line); background: var(--paper-2); }
.file-pick__box--logo .file-pick__preview { width: 64px; height: 64px; }
.file-pick__box--cover .file-pick__preview { width: 192px; height: 64px; border-radius: 6px; }
.file-pick__btn { display: none; margin: 0; }
.js .file-pick__btn { display: inline-flex; }
.js .file-pick__input {
  position: absolute !important; width: 1px; height: 1px; min-height: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; opacity: 0;
}
.js .file-pick__input:focus-visible + .file-pick__btn { outline: 3px solid var(--focus); outline-offset: 2px; }
.file-pick__status {
  margin: var(--s-1) 0 0; max-width: 100%; font-size: .875rem; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-pick__status:empty { display: none; }
.branding__controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); flex: 1 1 12rem; min-width: 0; }
.branding__controls .file-pick__status { flex: 1 0 100%; margin: 0; }
.branding__empty {
  display: grid; place-items: center; height: 64px; border: 1px dashed var(--line); background: var(--paper);
  color: var(--ink-2); font-size: .8125rem; text-align: center;
}
.branding__empty--logo { width: 64px; border-radius: var(--r); }
.branding__empty--cover { width: 192px; border-radius: 6px; }
.photo-field__inputs { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-1); }
.photo-field__inputs .file-pick__status { align-self: stretch; }

/* ---------- Carta: category sections, reveal forms, switches ---------- */

.page-head__actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s-2); }
.reveal > summary.btn { list-style: none; padding: .55rem 1.1rem; }
.reveal[open] > summary { margin-bottom: 0; }
.reveal[open] > summary.btn { background: var(--paper-2); }
.reveal__panel {
  margin-top: var(--s-2); padding: var(--s-4); width: min(26rem, calc(100vw - 2 * var(--s-4)));
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
}
.reveal__panel .field { margin-bottom: var(--s-3); }
@media (max-width: 759px) {
  .page-head__actions { width: 100%; flex-direction: column; align-items: stretch; }
  .page-head__actions > .btn, .reveal > summary.btn { width: 100%; }
  .reveal__panel { width: 100%; }
}

.cat-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-3); }
.cat-head__title { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-2); min-width: 0; flex: 1 1 12rem; }
.cat-head__title h2 { margin: 0; font-size: 1.3rem; }
.cat-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.cat-head__actions .inline-form { display: inline-flex; }
.btn--icon { min-width: var(--tap); padding-left: 0; padding-right: 0; font-size: 1.15rem; line-height: 1; }
.js-only { display: none !important; }
.js .js-only { display: inline-flex !important; }
.cat-edit { display: grid; gap: var(--s-3); }
.js .cat-edit:not(.is-open) { display: none; }
.cat-edit__form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--s-3); align-items: start; }
.cat-edit__form .field { margin-bottom: var(--s-3); }
.cat-edit__form > .btn { grid-column: 1 / -1; justify-self: start; }
.cat-edit__delete { border-top: 1px dashed var(--line); padding-top: var(--s-3); }
.cat-edit__delete .field__hint { margin: var(--s-1) 0 0; }
@media (max-width: 759px) {
  .cat-head__actions { width: 100%; }
  .cat-head__actions > .btn:last-child { flex: 1 1 auto; }
  .cat-edit__form { grid-template-columns: 1fr; }
  .cat-edit__form > .btn, .cat-edit__delete .btn { width: 100%; }
}

.badge--off { background: var(--danger-soft); color: var(--danger); }

/* Availability switch: a real button (same form/endpoint) with role=switch. */
.switch {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-2) 0 0;
  border: 0; background: none; font: inherit; font-weight: 600; color: var(--danger); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.switch__track {
  position: relative; flex: 0 0 auto; width: 44px; height: 26px; border-radius: 999px;
  background: #cbd2dc; transition: background-color .2s var(--ease);
}
.switch__thumb {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .3); transition: transform .2s var(--ease);
}
.switch.is-on { color: var(--ok); }
.switch.is-on .switch__track { background: #16a34a; }
.switch.is-on .switch__thumb { transform: translateX(18px); }
.switch:hover .switch__track { box-shadow: 0 0 0 3px rgba(15, 23, 42, .08); }

/* Compact allergen icons in the admin list (labels for screen readers + title). */
.al-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.al-list li { display: inline-flex; }
.al-list .al-icon { width: 26px; height: 26px; padding: 4px; }

/* Admin > Mesas: session state of each table. */
.table-session { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); }
.table-session__info { color: var(--ink-2); font-size: .9375rem; }
.table-session__due { color: var(--danger); font-weight: 700; font-size: .9375rem; }

/* ---------- Demo bar (Demo): banner, notes, disabled groups ---------- */
.plain-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset[disabled] input, fieldset[disabled] select, fieldset[disabled] textarea { opacity: .6; cursor: not-allowed; }
.demo-banner {
  margin: 0; padding: var(--s-2) var(--s-4); background: #f6ead0; color: #5c3d00;
  border-bottom: 1px solid #e6d2a6; font-size: .9375rem; text-align: center; overflow-wrap: anywhere;
}
.demo-banner strong { display: inline-block; margin-right: var(--s-2); padding: 0 .5rem; border-radius: 999px; background: #8a5a00; color: #fff; font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; }
.demo-banner a { color: inherit; font-weight: 700; }
.demo-note { margin: var(--s-2) 0; }

/* ---------- Public demo page (/demo): four big role buttons, phone first ---------- */
.demo { padding-top: var(--s-4); }
.demo__brand { margin: 0 0 var(--s-1); font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.demo__title { margin: 0 0 var(--s-3); font-size: 2rem; line-height: 1.15; }
.demo__lead { margin: 0 0 var(--s-4); }
.demo__roles { display: grid; gap: var(--s-3); margin-bottom: var(--s-4); }
.demo__form { margin: 0; }
.demo-role {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  width: 100%; min-height: 76px; padding: var(--s-3) var(--s-4);
  border: 2px solid var(--ink); border-radius: var(--r-lg); background: var(--card); color: var(--ink);
  font: inherit; text-align: left; text-decoration: none; cursor: pointer;
  box-shadow: 0 2px 0 var(--ink); transition: transform .12s var(--ease), box-shadow .12s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.demo-role:hover { background: var(--paper-2); }
.demo-role:active { transform: translateY(2px); box-shadow: 0 0 0 var(--ink); }
.demo-role:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.demo-role__name { font-size: 1.35rem; font-weight: 800; }
.demo-role__line { color: var(--ink-2); font-size: 1rem; }
.demo-role--client { background: var(--accent); border-color: var(--accent-hover); color: var(--accent-ink); box-shadow: 0 2px 0 var(--accent-hover); }
.demo-role--client:hover { background: var(--accent-hover); }
.demo-role--client .demo-role__line { color: var(--accent-ink); opacity: .9; }
.demo__note { padding: var(--s-3) var(--s-4); border-radius: var(--r); background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.demo__foot { margin-top: var(--s-4); }
@media (min-width: 600px) {
  .demo__roles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .demo-role { min-height: 104px; }
}
