dialog { border: 0; padding: 0; color: var(--ink); max-width: none; max-height: none; }
dialog::backdrop { background: rgba(12, 11, 10, .62); backdrop-filter: blur(3px); }

.sheet__close {
  position: absolute; right: 12px; top: 10px; z-index: 3;
  width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: var(--paper);
  font: 400 1.7rem/1 var(--font-text); transition: transform .45s var(--ease), background .2s;
}
.sheet__close:hover { transform: rotate(90deg); background: var(--ketchup); }

/* Personalizar */
.sheet { width: min(560px, 100vw); max-height: min(92dvh, 900px); margin: auto; background: var(--paper); border-radius: 12px; overflow: hidden auto; overscroll-behavior: contain; }
.sheet[open] { animation: rise .55s var(--ease); }
@keyframes rise { from { transform: translateY(46px) rotate(1.2deg); opacity: 0; } }
.sheet__inner { position: relative; padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; }
.sheet__img { display: grid; place-items: center; height: 210px; margin: -20px -22px 8px; background: var(--cheddar); }
.sheet__img:empty { display: none; }
.sheet__img img { max-height: 190px; width: auto; object-fit: contain; filter: drop-shadow(0 14px 12px rgba(0, 0, 0, .3)); }
.sheet .display { font-size: clamp(2.3rem, 7vw, 3.6rem); padding-right: 50px; }
.sheet__desc { font-size: .92rem; color: var(--ink-soft); }
.opt-group { border-top: 2px solid var(--ink); padding: 10px 0 14px; margin-top: 8px; }
.opt-group legend { float: left; width: 100%; margin-bottom: 8px; font: 400 1.25rem var(--font-display); text-transform: uppercase; }
.opt-group legend small { font: 600 .7rem var(--font-text); color: var(--ink-soft); margin-left: 6px; }
.opts { clear: both; display: flex; flex-wrap: wrap; gap: 6px; }
.opt { position: relative; }
.opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.opt span {
  display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 7px 13px; border: 1.5px solid var(--ink); border-radius: 30px;
  font-size: .87rem; font-weight: 600; transition: background .2s, color .2s, transform .35s var(--ease);
}
.opt em { font-style: normal; opacity: .68; font-weight: 500; }
.opt input:hover + span { transform: translateY(-2px); }
.opt input:checked + span { background: var(--ink); color: var(--paper); }
.opt input:focus-visible + span { outline: 3px solid var(--ketchup); outline-offset: 2px; }

/* Cajón del pedido */
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(500px, 100vw); height: 100dvh; background: var(--paper); overflow: hidden; }
.drawer[open] { animation: slide .55s var(--ease); }
@keyframes slide { from { transform: translateX(100%); } }
.drawer__inner { display: flex; flex-direction: column; height: 100%; }
.drawer__head { position: relative; padding: 16px 20px 14px; border-bottom: 2px solid var(--ink); }
.drawer__head .display { font-size: 2.6rem; }
.drawer__body { flex: 1; overflow-y: auto; padding: 4px 20px 20px; overscroll-behavior: contain; }
.drawer__foot { padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 2px solid var(--ink); background: var(--paper); }
.drawer__total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font: 400 1.5rem var(--font-display); text-transform: uppercase; }
.drawer__total strong { font-weight: 400; font-size: 2.1rem; }
.drawer__fine { margin-top: 8px; font-size: .72rem; line-height: 1.3; color: var(--ink-soft); }

.line { display: grid; grid-template-columns: 62px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line__img { width: 62px; height: 62px; object-fit: contain; }
.line__ph { display: grid; place-items: center; width: 62px; height: 62px; background: var(--bone); border-radius: 8px; font: 400 1.3rem var(--font-display); color: var(--ketchup); }
.line__name { font: 400 1.2rem/1.05 var(--font-display); text-transform: uppercase; }
.line__opts { font-size: .78rem; line-height: 1.28; color: var(--ink-soft); }
.line__end { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.line__price { font-weight: 800; font-size: .92rem; white-space: nowrap; }
.qty { display: flex; align-items: center; border: 1.5px solid var(--ink); border-radius: 30px; }
.qty button { width: 34px; height: 34px; font-size: 1.1rem; font-weight: 600; border-radius: 50%; transition: background .2s, color .2s; }
.qty button:hover { background: var(--ink); color: var(--paper); }
.qty output { min-width: 18px; text-align: center; font-weight: 700; font-size: .88rem; }

.empty { display: flex; flex-direction: column; gap: 20px; padding: 44px 0; }
.empty .display { font-size: 3.6rem; }
.empty[hidden], .order[hidden] { display: none; }

.order { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; }
.segmented legend { float: left; width: 100%; padding: 8px 10px; border-bottom: 2px solid var(--ink); grid-column: 1 / -1; }
.segmented label { position: relative; clear: both; }
.segmented input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.segmented span { display: grid; place-items: center; height: 52px; font: 400 1.25rem var(--font-display); text-transform: uppercase; transition: background .25s, color .25s; }
.segmented input:checked + span { background: var(--ink); color: var(--paper); }
.segmented input:focus-visible + span { outline: 3px solid var(--ketchup); outline-offset: -5px; }
.order__hint { font-size: .84rem; font-weight: 500; color: var(--ink-soft); }
.order__closed { padding: 8px 12px; background: var(--cheddar); border-radius: 6px; font-size: .84rem; font-weight: 700; }
.order__closed[hidden] { display: none; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; background: #fff; border: 1.5px solid var(--ink); border-radius: 6px; font-size: 1rem;
}
.field textarea { resize: vertical; }
.field [aria-invalid="true"] { border-color: var(--ketchup); box-shadow: inset 0 0 0 1px var(--ketchup); }
.field-row { display: grid; grid-template-columns: 3fr 2fr; gap: 10px; }
.field__error { font-style: normal; font-size: .82rem; font-weight: 700; color: var(--ketchup-deep); }
.field__error:empty { display: none; }
.drawer__foot > .field__error { margin-bottom: 8px; }

/* Barra móvil */
.mobilebar {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 45;
  display: flex; justify-content: space-between; align-items: center; height: 58px; padding: 0 20px;
  background: var(--ketchup); color: #fff; border-radius: 10px; font-weight: 700;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35); transform: translateY(0); transition: transform .5s var(--ease);
}
.mobilebar[hidden] { display: flex; transform: translateY(170%); pointer-events: none; visibility: hidden; }
.mobilebar strong { font: 400 1.5rem var(--font-display); }
@media (min-width: 900px) { .mobilebar { display: none !important; } }

@media (max-width: 559px) {
  .sheet { width: 100vw; max-height: 94dvh; margin: auto 0 0; border-radius: 14px 14px 0 0; }
}
