/* OFFMENU — panel del bar y administración. Pensado primero para móvil. */
:root {
  --bg: #f6eddf;
  --bg-2: #efe2cd;
  --paper: #fffaf2;
  --ink: #231a12;
  --ink-soft: #4a3d31;
  --mute: #7a6b5c;
  --tomato: #d6452a;
  --tomato-dk: #b5361f;
  --mustard: #e9b23a;
  --olive: #56663a;
  --line: rgba(35, 26, 18, .14);
  --r: 16px;
  --f-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--tomato-dk); }
h1, h2, h3 { font-family: var(--f-display); letter-spacing: -.02em; line-height: 1.15; margin: 0 0 .4rem; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.15rem; }
p { margin: 0 0 .6rem; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }
.muted { color: var(--mute); }
.small { font-size: .88rem; }
.block { display: block; }
.strong { font-weight: 700; color: var(--ink); text-decoration: none; }
.opt { font-weight: 400; color: var(--mute); font-size: .88em; }
.big-emoji { font-size: 2.6rem; margin: 0 0 .4rem; }

/* Logo */
.logo { font-family: var(--f-display); font-weight: 800; letter-spacing: -.03em; color: var(--ink); white-space: nowrap; }
.logo-off { background: var(--tomato); color: var(--paper); padding: 0 .25em .05em; border-radius: 6px; margin-right: .1em; display: inline-block; transform: rotate(-4deg); }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .8em 1.3em; min-height: 46px;
  border-radius: 999px; border: 2px solid var(--ink);
  background: var(--ink); color: var(--paper);
  font-weight: 600; text-decoration: none; line-height: 1.1;
  box-shadow: 0 3px 0 var(--tomato);
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--tomato); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--tomato); }
.btn-ghost { background: var(--paper); color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.btn-ghost:hover { box-shadow: 0 4px 0 var(--ink); }
.btn-danger { background: var(--tomato); border-color: var(--tomato-dk); box-shadow: 0 3px 0 var(--tomato-dk); }
.btn-sm { padding: .5em 1em; min-height: 38px; font-size: .9rem; }
.btn-block { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); text-decoration: none; font-size: 1.05rem;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn.sm { width: 32px; height: 32px; font-size: .9rem; }

/* Mensajes */
.flash { padding: .85rem 1rem; border-radius: 12px; margin-bottom: 1rem; font-weight: 500; border: 1px solid; }
.flash-ok { background: #eef2e4; border-color: #b9c79a; color: #34421d; }
.flash-err { background: #fbe7e2; border-color: #ecb2a4; color: #8a2614; }

/* Formularios */
.form { display: grid; gap: 1rem; }
.form label, .form .label { display: block; font-weight: 600; font-size: .92rem; }
.form label > input:not([type=checkbox]), .form label > select, .form label > textarea, .form label > .hint { display: block; margin-top: .35rem; }
.form label > .copy-row { margin-top: .35rem; }
.photo-field .photo-row { margin-top: .4rem; }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=tel], .form select, .form textarea {
  width: 100%; font: inherit; font-weight: 400; font-size: 1rem;
  padding: .7em .85em; min-height: 46px;
  border: 1.5px solid rgba(35,26,18,.28); border-radius: 12px;
  background: #fff; color: var(--ink);
}
.form textarea { resize: vertical; min-height: 0; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(233,178,58,.5); }
.form input[type=color] { width: 72px; height: 46px; padding: 3px; border: 1.5px solid rgba(35,26,18,.28); border-radius: 12px; background: #fff; }
.form .check, .check { display: flex !important; align-items: center; gap: .55rem; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--tomato); flex-shrink: 0; margin: 0; }
.hint { font-weight: 400; font-size: .82rem; color: var(--mute); }
.row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.row > .grow { flex: 1 1 220px; }
.row-end { justify-content: flex-end; align-items: center; }
.row-end .check { margin-right: auto; }
.row-center { justify-content: center; }
.w-price { flex: 0 0 120px; }
.w-plan { flex: 0 0 170px; }
.w-color { flex: 0 0 auto; }
fieldset { border: 0; padding: 0; margin: 0; }
fieldset.box { border: 1px solid var(--line); border-radius: 14px; padding: 1rem; }
legend { font-weight: 700; font-size: .92rem; padding: 0 .3rem; margin-bottom: .5rem; }
.copy-row { display: flex; gap: .5rem; align-items: center; }
.copy-row input { flex: 1; }

/* Alérgenos */
.al {
  display: inline-grid; place-items: center;
  min-width: 24px; height: 24px; padding: 0 4px; border-radius: 999px;
  font-size: .68rem; font-weight: 700; text-decoration: none; letter-spacing: 0;
  color: #fff; background: var(--al, #888); vertical-align: middle;
}
.al-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .4rem; }
.al-opt { display: flex !important; align-items: center; gap: .45rem; font-weight: 500 !important; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.al-opt:has(input:checked) { border-color: var(--ink); background: #fff6e2; }
.al-opt input { width: 18px; height: 18px; accent-color: var(--tomato); margin: 0; }

/* Fotos */
.photo-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.photo-row > div { display: grid; gap: .4rem; }
.photo-preview { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.photo-preview[hidden] { display: none; }
.logo-preview { object-fit: contain; }

/* Página simple (acceso) */
body.simple { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.simple-box { width: 100%; max-width: 420px; background: var(--paper); border: 2px solid var(--ink); border-radius: 22px; padding: 28px 24px; box-shadow: 8px 8px 0 var(--tomato); }
.simple-box.center { text-align: center; }
.simple-logo { font-size: 1.5rem; margin-bottom: 1.2rem; }

/* App */
.support-bar { background: var(--mustard); color: var(--ink); text-align: center; padding: .55rem 16px; font-size: .9rem; }
.support-bar a { color: var(--ink); font-weight: 700; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { max-width: 860px; margin: 0 auto; padding: .7rem 16px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.topbar-brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); font-family: var(--f-display); font-weight: 800; font-size: 1.15rem; min-width: 0; }
.topbar-brand img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }
.topbar-brand span:not(.logo):not(.logo-off):not(.tag) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user { font-size: .88rem; color: var(--mute); }
.tag { font-family: var(--f-body); font-size: .72rem; font-weight: 700; background: var(--ink); color: var(--paper); border-radius: 6px; padding: .15em .5em; text-transform: uppercase; letter-spacing: .06em; }
.tabs { max-width: 860px; margin: 0 auto; padding: 0 8px; display: flex; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: .65rem .85rem; color: var(--mute); text-decoration: none; font-weight: 600; font-size: .95rem; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.is-on { color: var(--ink); border-color: var(--tomato); }
.page { max-width: 860px; margin: 0 auto; padding: 20px 16px 40px; }
.foot { text-align: center; color: var(--mute); font-size: .85rem; padding: 0 16px 32px; }
.back { font-weight: 600; text-decoration: none; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 20px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.card.danger { border-color: #ecb2a4; background: #fff7f4; }
.empty { text-align: center; padding: 32px 20px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin: 28px 0 14px; }
.section-head p { margin: 0; }
.pill { display: inline-block; font-size: .78rem; font-weight: 700; padding: .25em .7em; border-radius: 999px; background: var(--bg-2); color: var(--mute); }
.pill-on { background: var(--olive); color: #fff; }
.out-count { color: var(--tomato-dk); }

/* Plato del día */
.today { border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.today.is-live { box-shadow: 6px 6px 0 var(--olive); }

/* Categorías y platos */
.cat { padding: 0; overflow: hidden; }
.cat-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: 14px 14px 14px 20px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.cat-head h3 { margin: 0; }
.count { font-family: var(--f-body); font-size: .8rem; font-weight: 600; color: var(--mute); background: var(--paper); border-radius: 999px; padding: .1em .6em; vertical-align: middle; }
.tools, .moves { display: flex; gap: 6px; align-items: center; }
.tools form, .moves form, .dish-tools form { margin: 0; }
.pad { padding: 14px 20px 0; }
.dishes { list-style: none; margin: 0; padding: 0; }
.dish { display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 14px; border-bottom: 1px solid var(--line); }
.dish:target { background: #fff6e2; }
.dish-main { flex: 1; display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.thumb-empty { display: grid; place-items: center; background: var(--bg); color: var(--mute); font-size: 1.2rem; }
.dish-text { display: grid; gap: 3px; min-width: 0; }
.dish-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.dish-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: .9rem; }
.dish-meta b { margin-right: 4px; }
.dish-meta .al { min-width: 20px; height: 20px; font-size: .6rem; }
.out-tag { display: none; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--tomato); color: #fff; border-radius: 6px; padding: .1em .45em; }
.dish.is-out .dish-name { text-decoration: line-through; color: var(--mute); }
.dish.is-out .thumb { opacity: .45; filter: grayscale(1); }
.dish.is-out .out-tag { display: inline-block; }
.dish-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.add-dish { display: block; padding: 14px 20px; font-weight: 600; text-decoration: none; }
.add-dish:hover { background: var(--bg); }

/* Interruptor disponible / agotado */
.switch {
  width: 54px; height: 32px; border-radius: 999px; border: 0; padding: 0;
  background: rgba(35,26,18,.22); position: relative; transition: background .2s;
  flex-shrink: 0;
}
.switch::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s;
}
.switch.is-on { background: var(--olive); }
.switch.is-on::after { transform: translateX(22px); }
.switch[disabled] { opacity: .6; }

/* QR */
.qr-card { text-align: center; }
.qr-card .muted { max-width: 520px; margin-inline: auto; }
.qr-sheet { margin: 18px auto; max-width: 360px; background: #fff; border: 2px solid var(--ink); border-radius: 22px; padding: 26px 22px 22px; }
.qr-bar { font-family: var(--f-display); font-weight: 800; font-size: 1.5rem; margin: 0 0 12px; }
.qr-box { width: 240px; height: 240px; margin: 0 auto; display: grid; place-items: center; }
.qr-box svg, .qr-box img { width: 100%; height: 100%; }
.qr-cta { font-weight: 700; font-size: 1.05rem; margin: 14px 0 2px; }
.qr-url { font-size: .82rem; color: var(--mute); margin: 0; word-break: break-all; }
.copy-url { margin-top: 22px; text-align: left; }
.copy-url label { display: grid; gap: .4rem; font-weight: 600; font-size: .92rem; }
.copy-url input { font: inherit; padding: .6em .8em; border: 1.5px solid rgba(35,26,18,.28); border-radius: 12px; min-height: 42px; background: #fff; }

/* Admin: tabla */
.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); padding: 12px 14px; background: var(--bg-2); }
.table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr.is-off td { opacity: .6; }
.t-actions { text-align: right; }
.t-actions form { margin: 0; }

@media (max-width: 680px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 14px; border-top: 1px solid var(--line); }
  .table td { border: 0; padding: 3px 0; }
  .table td[data-l]::before { content: attr(data-l) ": "; color: var(--mute); font-size: .82rem; }
  .table td[data-l="Bar"]::before { content: none; }
  .t-actions { text-align: left; padding-top: 8px !important; }
  .dish { padding: 10px 10px 10px 12px; }
  .thumb { width: 44px; height: 44px; }
  .moves { flex-direction: column; gap: 2px; }
  .icon-btn.sm { width: 28px; height: 24px; font-size: .8rem; }
}

@media print {
  body { background: #fff; }
  .topbar, .tabs, .foot, .support-bar, .flash, .no-print, .qr-card > h2, .qr-card > p { display: none !important; }
  .page { padding: 0; }
  .card { border: 0; padding: 0; }
  .qr-sheet { margin-top: 40px; max-width: 520px; border-width: 3px; }
  .qr-box { width: 360px; height: 360px; }
  .qr-bar { font-size: 2.2rem; }
  .qr-cta { font-size: 1.4rem; }
}

/* Selector de alérgenos: botones que se pinchan */
.al-picker { border: 0; padding: 0; margin: 0; }
.al-picker legend { font-weight: 600; font-size: .92rem; padding: 0; margin-bottom: .5rem; }
.al-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.form .al-chip, .al-chip { display: block; position: relative; cursor: pointer; font-weight: 500; }
.al-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.al-chip-body {
  display: flex; align-items: center; gap: .5rem;
  min-height: 48px; padding: .5rem .7rem;
  border: 1.5px solid rgba(35,26,18,.18); border-radius: 12px; background: #fff;
  transition: background .15s, border-color .15s, box-shadow .15s;
  -webkit-user-select: none; user-select: none;
}
.al-chip-body .al { opacity: .55; filter: grayscale(.6); transition: opacity .15s, filter .15s; }
.al-chip-name { flex: 1; font-size: .93rem; line-height: 1.2; }
.al-chip-tick {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  font-size: .75rem; font-weight: 800; color: transparent; border: 1.5px solid rgba(35,26,18,.2);
}
.al-chip:hover .al-chip-body { border-color: var(--al); }
.al-chip input:checked + .al-chip-body {
  border-color: var(--al); border-width: 2px;
  background: #fff6e2;
  background: color-mix(in srgb, var(--al) 14%, #fff);
  box-shadow: 0 2px 0 var(--al);
  font-weight: 700;
}
.al-chip input:checked + .al-chip-body .al { opacity: 1; filter: none; }
.al-chip input:checked + .al-chip-body .al-chip-tick { background: var(--al); border-color: var(--al); color: #fff; }
.al-chip input:focus-visible + .al-chip-body { outline: 3px solid var(--mustard); outline-offset: 2px; }
.al-picker .hint { margin-top: .5rem; }

/* Fuera de carta en el panel */
.specials { margin: 10px -20px 16px; border-top: 1px solid var(--line); }
.specials .dish { padding-left: 20px; padding-right: 20px; }
.thumb-chalk { background: #20291f; color: #f0c04a; font-size: 1.1rem; }
.btn-block-sm { margin-top: 4px; }
@media (max-width: 680px) {
  .btn-block-sm { width: 100%; }
  .al-chips { grid-template-columns: 1fr 1fr; }
  .specials .dish { padding-left: 12px; padding-right: 10px; }
}

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pdf-card .row { margin-top: .4rem; }

/* Idiomas */
.lang-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.form .lang-opt, .lang-opt { display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; border: 1.5px solid rgba(35,26,18,.18); border-radius: 12px; background: #fff; font-weight: 500; cursor: pointer; }
.lang-opt:has(input:checked) { border-color: var(--ink); background: #fff6e2; font-weight: 700; }
.lang-opt input { width: 18px; height: 18px; margin: 0; accent-color: var(--tomato); }
.lang-opt.is-base { opacity: .7; cursor: default; }
.lang-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; scrollbar-width: none; }
.lang-tabs a { flex-shrink: 0; padding: .5rem .9rem; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: .92rem; }
.lang-tabs a.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.lang-tabs a.is-on .count { background: var(--tomato); color: #fff; }
.progress { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin: 6px 0 14px; }
.progress span { display: block; height: 100%; background: var(--olive); border-radius: 999px; }
.tr-group { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 4px; margin-bottom: 14px; }
.tr-group legend { font-family: var(--f-display); font-weight: 800; font-size: 1.05rem; padding: 0 6px; }
.tr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; padding: 8px 0 12px; border-bottom: 1px dashed var(--line); }
.tr-row:last-child { border-bottom: 0; }
.tr-src { margin: 0; font-size: .95rem; padding-top: .55em; }
.tr-label { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); margin-bottom: 2px; }
.tr-row.is-missing input, .tr-row.is-missing textarea { border-style: dashed; background: #fffdf8; }
.tr-row.is-stale input, .tr-row.is-stale textarea { border-color: var(--mustard); background: #fff6dc; }
.tr-save { position: sticky; bottom: 12px; z-index: 5; }
.tr-save .btn { box-shadow: 0 3px 0 var(--tomato), 0 10px 24px rgba(0,0,0,.18); }
@media (max-width: 680px) {
  .tr-row { grid-template-columns: 1fr; gap: 4px; }
  .tr-src { padding-top: 0; }
}

.topbar .btn { white-space: nowrap; flex-shrink: 0; }
