/* ==========================================================================
   ACOMeR · Carta PWA — base compartida
   Los temas solo cambian tokens, tipografía y disposición.
   ========================================================================== */

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

:root {
    --brand: #E2542C;
    --accent: #0F6B63;
    --bg: #FAF7F3;
    --surface: #FFFDFA;
    --surface-2: #F3EDE5;
    --ink: #1A1512;
    --muted: #6E6459;
    --line: #E5DACC;
    --radius: 18px;
    --radius-s: 12px;
    --radius-l: 26px;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Fraunces', Georgia, serif;
    --shadow: 0 10px 30px rgba(50, 33, 18, .10);
    --shadow-s: 0 2px 10px rgba(50, 33, 18, .06);
    --max: 560px;
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}

body.no-scroll { overflow: hidden; }

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }

.pwa-shell {
    position: relative;
    width: 100%;
    max-width: var(--max);
    min-height: 100dvh;
    margin: 0 auto;
    background: var(--bg);
    overflow-x: hidden;
    padding-bottom: 108px;
}

/* ── Portada ─────────────────────────────────────────────────────────────── */

.hero { position: relative; }

.hero-media {
    position: relative;
    height: 232px;
    overflow: hidden;
    background: linear-gradient(140deg, color-mix(in srgb, var(--brand) 76%, #000), color-mix(in srgb, var(--brand) 28%, #000));
}

.hero-media img { width: 100%; height: 100%; object-fit: cover; }

.hero-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(12, 8, 5, .46) 0%, rgba(12, 8, 5, .06) 42%, rgba(12, 8, 5, .58) 100%);
}

.topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 14px max(14px, env(safe-area-inset-top));
    color: #fff;
}

.topbar .spacer { flex: 1; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .22);
    background: rgba(16, 11, 8, .38);
    color: #fff;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    transition: background .2s;
}

.icon-btn:active { background: rgba(16, 11, 8, .6); }
.icon-btn svg { width: 18px; height: 18px; }

.table-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: #1A1512;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .01em;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}

.table-chip::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.hero-id {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    gap: 13px;
    margin: -46px 16px 0;
}

.hero-logo {
    flex: none;
    width: 76px;
    height: 76px;
    border-radius: 20px;
    border: 4px solid var(--bg);
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    overflow: hidden;
    box-shadow: var(--shadow-s);
}

.hero-logo img { width: 100%; height: 100%; object-fit: cover; }

.hero-name {
    padding-bottom: 4px;
    min-width: 0;
}

.hero-name h1 {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 5px;
    font-size: 12px;
    color: var(--muted);
}

.hero-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }

.hero-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-weight: 700;
}

.hero-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}

/* ── Herramientas: búsqueda, idioma, categorías ──────────────────────────── */

.tools { display: flex; gap: 8px; align-items: center; padding: 18px 16px 12px; }

.search-box {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 14px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--muted);
    box-shadow: var(--shadow-s);
}

.search-box svg { width: 16px; height: 16px; flex: none; }

.search-box input {
    width: 100%;
    border: 0;
    background: none;
    outline: none;
    font: inherit;
    color: var(--ink);
}

.search-box input::placeholder { color: var(--muted); }

.tools .icon-btn.solid {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

.lang-select {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    cursor: pointer;
}

.cats {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 8px;
    padding: 4px 16px 14px;
    overflow-x: auto;
    scrollbar-width: none;
    background: linear-gradient(180deg, var(--bg) 78%, transparent);
}

.cats::-webkit-scrollbar { display: none; }

.chip {
    flex: none;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    border-radius: 999px;
    padding: 9px 15px;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background .18s, color .18s, border-color .18s;
}

.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ── Destacados ──────────────────────────────────────────────────────────── */

.featured {
    display: flex;
    gap: 12px;
    padding: 2px 16px 20px;
    overflow-x: auto;
    scrollbar-width: none;
}

.featured::-webkit-scrollbar { display: none; }

.featured.is-hidden { display: none; }

.feat {
    flex: none;
    width: 172px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-s);
    cursor: pointer;
}

.feat-img { position: relative; height: 104px; background: var(--surface-2); }
.feat-img img { width: 100%; height: 100%; object-fit: cover; }

.feat-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 7px;
    border-radius: 7px;
    background: rgba(255, 255, 255, .94);
    color: #1A1512;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.feat-body { padding: 10px 11px 12px; }
.feat-body h3 { font-size: 13px; font-weight: 600; line-height: 1.25; }
.feat-body p { margin-top: 3px; font-size: 11px; color: var(--muted); line-height: 1.35; }

.feat-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    font-weight: 700;
    font-size: 13px;
}

/* ── Categorías y platillos ──────────────────────────────────────────────── */

.menu { padding: 0 16px; }

.cat { padding-bottom: 22px; scroll-margin-top: 64px; }
.cat.is-hidden { display: none; }

.cat-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 6px 0 12px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -.01em;
}

.cat-title small { font-family: var(--font-body); font-size: 11px; font-weight: 600; color: var(--muted); }

.sub-title {
    margin: 16px 0 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.menu-list { display: flex; flex-direction: column; gap: 12px; }

.dish {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-s);
    cursor: pointer;
    transition: transform .18s, box-shadow .18s;
}

.dish:active { transform: scale(.995); }
.dish.is-hidden { display: none; }

.dish-media {
    flex: none;
    width: 88px;
    height: 88px;
    border-radius: var(--radius-s);
    overflow: hidden;
    background: var(--surface-2);
}

.dish-media img { width: 100%; height: 100%; object-fit: cover; }

.dish-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.dish-head { display: flex; align-items: baseline; gap: 10px; }

.dish-head h3 {
    flex: 1;
    min-width: 0;
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.3;
}

.dish-price { flex: none; font-size: 13.5px; font-weight: 700; white-space: nowrap; }

.dish-desc {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dish-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .02em;
    padding: 3px 7px;
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--muted);
}

.tag.veg { color: #15803D; background: color-mix(in srgb, #15803D 12%, transparent); }
.tag.nonveg { color: #B45309; background: color-mix(in srgb, #B45309 12%, transparent); }
.tag.allergy { color: var(--muted); }

.dish-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
}

.dish-foot .hint { font-size: 10.5px; color: var(--muted); font-weight: 600; }

.add {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-left: auto;
    border: 0;
    border-radius: 11px;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 34%, transparent);
    transition: transform .15s;
}

.add:active { transform: scale(.94); }
.add svg { width: 16px; height: 16px; }

/* ── Barra del carrito ───────────────────────────────────────────────────── */

.cartbar {
    position: fixed;
    left: 50%;
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 60;
    width: calc(100% - 28px);
    max-width: calc(var(--max) - 28px);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 0;
    border-radius: 18px;
    background: var(--ink);
    color: var(--bg);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .3);
    transform: translate(-50%, 140%);
    transition: transform .32s cubic-bezier(.2, .7, .2, 1);
    cursor: pointer;
}

.cartbar.show { transform: translate(-50%, 0); }

.cartbar-count {
    flex: none;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    font-size: 12.5px;
    font-weight: 700;
}

.cartbar-text { flex: 1; text-align: left; font-size: 11.5px; opacity: .72; line-height: 1.2; }
.cartbar-text b { display: block; font-size: 13.5px; opacity: 1; margin-top: 2px; }

.cartbar-go {
    flex: none;
    padding: 9px 13px;
    border: 0;
    border-radius: 11px;
    background: var(--brand);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

/* ── Capas: carrito, producto, checkout ──────────────────────────────────── */

.backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(10, 8, 6, .55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}

.backdrop.show { opacity: 1; pointer-events: auto; }

.panel {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 90;
    width: 100%;
    max-width: var(--max);
    max-height: 92dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, .28);
    transform: translate(-50%, 102%);
    transition: transform .36s cubic-bezier(.2, .7, .2, 1);
    overflow: hidden;
}

.panel.show { transform: translate(-50%, 0); }

.panel-head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px 10px;
}

.panel-head h2 { flex: 1; font-family: var(--font-display); font-size: 20px; font-weight: 600; }

.panel-head .icon-btn { background: var(--surface-2); border-color: transparent; color: var(--ink); }

.panel-body { flex: 1; overflow-y: auto; padding: 4px 18px 18px; overscroll-behavior: contain; }

.panel-foot {
    flex: none;
    padding: 12px 18px max(16px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.handle {
    width: 42px;
    height: 5px;
    margin: 8px auto 2px;
    border-radius: 99px;
    background: var(--line);
}

/* Carrito */
.cart-line { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }

.cart-thumb { flex: none; width: 54px; height: 54px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }

.cart-info { flex: 1; min-width: 0; }
.cart-info h4 { font-size: 13.5px; font-weight: 600; }
.cart-info p { margin-top: 2px; font-size: 11px; color: var(--muted); line-height: 1.35; }
.cart-info .cart-price { margin-top: 5px; font-weight: 700; font-size: 13px; }

.cart-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 8px; }

.stepper {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px;
    border-radius: 10px;
    background: var(--surface-2);
}

.stepper button {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 7px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.stepper span { min-width: 14px; text-align: center; font-size: 12.5px; font-weight: 700; }

.link-danger { border: 0; background: none; color: var(--muted); font-size: 11px; cursor: pointer; text-decoration: underline; }

.empty { padding: 36px 10px; text-align: center; color: var(--muted); }
.empty svg { width: 38px; height: 38px; margin: 0 auto 10px; opacity: .5; }
.empty p { font-size: 13px; }
.empty small { display: block; margin-top: 4px; font-size: 11.5px; }

.total-row { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0 0; font-size: 13px; color: var(--muted); }
.total-row b { font-size: 19px; color: var(--ink); font-family: var(--font-display); }

/* Botones y formularios */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 16px;
    border: 0;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, opacity .15s;
}

.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .6; cursor: wait; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 12px 26px color-mix(in srgb, var(--brand) 32%, transparent); }
.btn-ghost { background: var(--surface-2); color: var(--ink); }
.btn-dark { background: var(--ink); color: var(--bg); }

.field { margin-bottom: 12px; }

.waiter-reasons {
    display: grid;
    gap: 6px;
}

.waiter-reasons label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.waiter-reasons input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--brand);
}

.waiter-reasons label:has(input:checked) {
    border-color: var(--brand);
    background: var(--surface-2);
}

.field label {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.field input, .field select, .field textarea {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    outline: none;
    transition: border-color .18s;
}

.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }
.field textarea { min-height: 72px; resize: vertical; }
.field .hint { margin-top: 4px; font-size: 10.5px; color: var(--muted); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }

.segmented label {
    margin: 0;
    padding: 10px 6px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    text-align: center;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink);
    cursor: pointer;
}

.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span { }
.segmented label:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, var(--surface)); color: var(--brand); }

.pay-options { display: grid; gap: 8px; }

.pay-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    font-size: 13px;
    cursor: pointer;
}

.pay-option input { accent-color: var(--brand); }
.pay-option:has(input:checked) { border-color: var(--brand); }

.form-error {
    display: none;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: color-mix(in srgb, #DC2626 12%, transparent);
    color: #B91C1C;
    font-size: 12px;
    white-space: pre-line;
}

.form-error.show { display: block; }

/* Hoja de producto */
.sheet-media { position: relative; height: 190px; margin: 0; border-radius: 18px; overflow: hidden; background: var(--surface-2); }
.sheet-media img { width: 100%; height: 100%; object-fit: cover; }
.sheet-media:empty { display: none; }

.sheet-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(16, 11, 8, .55);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(6px);
}

.sheet-title { margin-top: 16px; font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.sheet-desc { margin-top: 5px; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.sheet-price { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 12px 0 4px; }
.sheet-price b { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.sheet-price span { font-size: 11px; color: var(--muted); }

.option-title {
    margin: 18px 0 6px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--muted);
}

.option-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.option-row:last-child { border-bottom: 0; }
.option-row input { accent-color: var(--brand); width: 18px; height: 18px; }
.option-row .op-price { margin-left: auto; color: var(--muted); font-size: 12px; }

.sheet-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.sheet-actions .stepper { padding: 8px 10px; }
.sheet-actions .btn { flex: 1; }

/* Avisos */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(96px + env(safe-area-inset-bottom));
    z-index: 120;
    transform: translate(-50%, 20px);
    max-width: calc(100% - 40px);
    padding: 11px 16px;
    border-radius: 12px;
    background: var(--ink);
    color: var(--bg);
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Pie */
.site-foot {
    padding: 26px 16px 34px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.7;
    text-align: center;
}

.site-foot a { text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--muted) 40%, transparent); }
.site-foot .branding { margin-top: 8px; font-size: 10.5px; opacity: .8; }
.site-foot .branding a span { opacity: .62; font-weight: 500; }

.install-btn {
    display: none;
    position: fixed;
    right: 14px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    z-index: 50;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font-size: 11px;
    font-weight: 700;
    box-shadow: var(--shadow);
    cursor: pointer;
}

.install-btn.show { display: inline-flex; align-items: center; gap: 6px; }
.install-btn svg { width: 14px; height: 14px; }

/* Accesibilidad y movimiento */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

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

@media (min-width: 620px) {
    .pwa-shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
