/* ── Table chip (above the MY ORDER button) ────────────────────── */
.table-order-chip {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    max-width: min(17rem, calc(100vw - 2rem));
    padding: .4rem .9rem .4rem .4rem;
    border: 1px solid rgba(15, 23, 42, .06);
    border-radius: 999px;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(8px);
    color: #0f172a;
    font: inherit;
    text-align: start;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .16);
    transition: transform .2s, box-shadow .2s;
}
[dir="rtl"].table-order-chip { padding: .4rem .4rem .4rem .9rem; }
.table-order-chip:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(15, 23, 42, .2); }
.toc-icon {
    position: relative;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 999px;
    background: var(--brand, #BD7561);
    color: #fff;
    font-size: .85rem;
}
.toc-dot {
    position: absolute;
    bottom: -1px;
    inset-inline-end: -1px;
    width: .7rem;
    height: .7rem;
    border-radius: 999px;
    background: #22c55e;
    border: 2px solid #fff;
    animation: tocPulse 2s infinite;
}
@keyframes tocPulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); }
    70% { box-shadow: 0 0 0 .45rem rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.toc-text { display: grid; min-width: 0; line-height: 1.2; }
.toc-text small {
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
}
.toc-line { display: flex; align-items: baseline; gap: .4rem; min-width: 0; white-space: nowrap; }
.toc-line strong { font-size: .9rem; font-weight: 800; }
.toc-place {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .74rem;
    font-weight: 600;
    color: #64748b;
}
.toc-place::before { content: '·'; margin-inline-end: .4rem; color: #cbd5e1; }
.toc-meta {
    display: block;
    margin-top: .12rem;
    font-size: .68rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.table-order-chip--reserved .toc-icon { background: #8b5cf6; }
.table-order-chip--reserved .toc-dot { background: #8b5cf6; }
.table-order-chip--reserved .toc-text small { color: #6d28d9; }
.table-order-chip--off .toc-icon { background: #f59e0b; }
.table-order-chip--off .toc-dot { background: #f59e0b; animation: none; }
.table-order-chip--off .toc-text small { color: #b45309; }
@media (prefers-reduced-motion: reduce) { .toc-dot { animation: none; } }

/* ── Table banner (top of "My order") ──────────────────────────── */
.tbl-banner {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: .35rem .85rem;
    margin: 0 1.5rem .85rem;
    padding: .85rem 1rem;
    border-radius: 1rem;
    background: color-mix(in srgb, var(--brand, #BD7561) 7%, #fff);
    border: 1px solid color-mix(in srgb, var(--brand, #BD7561) 18%, #fff);
    flex-shrink: 0;
}
.tbl-banner__icon {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 2.9rem;
    height: 2.9rem;
    border-radius: .9rem;
    background: var(--brand, #BD7561);
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--brand, #BD7561) 30%, transparent);
}
.tbl-banner__copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem; min-width: 0; }
.tbl-banner__label {
    width: 100%;
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--brand, #BD7561) 70%, #0f172a);
}
.tbl-banner__name { font-size: 1.15rem; font-weight: 800; line-height: 1.2; color: #0f172a; }
.tbl-banner__place { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 600; color: #64748b; }
.tbl-banner__place i { font-size: .7rem; }
.tbl-banner__status {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    justify-self: start;
    padding: .25rem .6rem;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.35;
}
.tbl-banner--off { background: #fffbeb; border-color: #fde68a; }
.tbl-banner--off .tbl-banner__icon { background: #f59e0b; box-shadow: none; }
.tbl-banner--off .tbl-banner__status { background: #fef3c7; color: #92400e; }

/* ── Order popup layout: one scrolling body, total + send pinned at the bottom ── */
#orderModal .order-inner { display: flex; flex-direction: column; overflow: hidden; }
#orderModal .order-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
#orderModal .order-card { flex: none; overflow: visible; }
#orderModal #orderItemsList { flex: none; overflow: visible; }
#orderModal .order-body > .tbl-banner { margin-top: .85rem; }
#orderModal .order-card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.order-add-more {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .38rem .75rem;
    border: 1.5px solid color-mix(in srgb, var(--brand, #BD7561) 30%, #fff);
    border-radius: 999px;
    background: #fff;
    color: var(--brand, #BD7561);
    font: inherit;
    font-size: .74rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.order-add-more:hover { background: var(--brand, #BD7561); color: #fff; }
.order-add-more i { font-size: .65rem; }
#orderModal .order-foot {
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    background: #fff;
    box-shadow: 0 -10px 24px rgba(15, 23, 42, .08);
}
/* With table ordering, the total becomes a light line above the send button. */
#orderModal .order-foot:has(.tos-actions) .order-total-row {
    padding: .8rem 1.25rem .2rem;
    background: #fff;
}
#orderModal .order-foot:has(.tos-actions) .order-total-row > span:first-child { color: #64748b; letter-spacing: .1em; }
#orderModal .order-foot:has(.tos-actions) .order-total-row .order-total-price { color: #0f172a; text-shadow: none; font-size: 1.35rem; }

/* ── Details (name, phone, note) ───────────────────────────────── */
.table-order-send { padding: .9rem 1.25rem 1rem; }
.tos-form { display: grid; gap: .7rem; }
.tos-form[hidden] { display: none; }
.tos-toggle {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    padding: .75rem .85rem;
    border: 1.5px dashed #cbd5e1;
    border-radius: .95rem;
    background: #f8fafc;
    color: #0f172a;
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.tos-toggle:hover { border-color: color-mix(in srgb, var(--brand, #BD7561) 45%, #fff); background: #fff; }
.tos-toggle[aria-expanded="true"] { border-style: solid; border-color: #e2e8f0; background: #fff; }
.tos-toggle.has-value { border-style: solid; border-color: color-mix(in srgb, var(--brand, #BD7561) 30%, #fff); background: color-mix(in srgb, var(--brand, #BD7561) 5%, #fff); }
.tos-toggle__icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: .75rem;
    background: color-mix(in srgb, var(--brand, #BD7561) 12%, #fff);
    color: var(--brand, #BD7561);
    font-size: .85rem;
}
.tos-toggle__text { display: grid; gap: .1rem; min-width: 0; flex: 1; }
.tos-toggle__text b { font-size: .88rem; font-weight: 800; }
.tos-toggle__text small { font-size: .74rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tos-toggle.has-value .tos-toggle__text small { color: #0f172a; font-weight: 700; }
.tos-toggle__chev { color: #94a3b8; font-size: .75rem; transition: transform .25s; }
.tos-toggle[aria-expanded="true"] .tos-toggle__chev { transform: rotate(180deg); }
.tos-fields { display: grid; gap: .7rem; animation: tosPop .3s cubic-bezier(.22, 1, .36, 1) both; }
.tos-fields[hidden] { display: none; }
.tos-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: .7rem; }
.tos-field { display: grid; gap: .3rem; min-width: 0; }
.tos-field label { font-size: .72rem; font-weight: 800; color: #475569; }

.tos-input,
.tos-phone {
    display: flex;
    align-items: center;
    min-height: 2.9rem;
    border: 1.5px solid #e2e8f0;
    border-radius: .8rem;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.tos-input:focus-within,
.tos-phone:focus-within,
.table-order-send textarea:focus {
    border-color: var(--brand, #BD7561);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand, #BD7561) 14%, transparent);
}
.tos-input > i { padding-inline: .8rem .1rem; color: #94a3b8; font-size: .8rem; }
.tos-input input,
.tos-phone input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: none;
    background: transparent;
    padding: .6rem .75rem;
    font: inherit;
    font-size: 1rem; /* 16px keeps iOS from zooming in on focus */
    color: #0f172a;
}
.tos-phone input { letter-spacing: .02em; }
.tos-code {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    align-self: stretch;
    padding: 0 .7rem;
    border-right: 1.5px solid #eef2f7;
    border-radius: .75rem 0 0 .75rem;
    background: #f8fafc;
    font-size: .92rem;
    font-weight: 800;
    color: #0f172a;
    cursor: pointer;
}
.tos-code i { font-size: .6rem; color: #94a3b8; }
.tos-code select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; font-size: 1rem; }
.tos-code:focus-within { background: color-mix(in srgb, var(--brand, #BD7561) 8%, #fff); }

.table-order-send textarea {
    width: 100%;
    min-height: 3.6rem;
    resize: vertical;
    border: 1.5px solid #e2e8f0;
    border-radius: .8rem;
    padding: .65rem .8rem;
    background: #fff;
    font: inherit;
    font-size: 1rem;
    line-height: 1.45;
    color: #0f172a;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.tos-input input::placeholder,
.tos-phone input::placeholder,
.table-order-send textarea::placeholder { color: #a3aec0; }

/* ── Pinned actions ────────────────────────────────────────────── */
.tos-actions {
    display: grid;
    gap: .55rem;
    padding: .55rem 1.25rem calc(.85rem + env(safe-area-inset-bottom, 0px));
}
.tos-submit {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    min-height: 3.2rem;
    border: 0;
    border-radius: 1rem;
    padding: .8rem 1rem;
    background: var(--brand, #BD7561);
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--brand, #BD7561) 28%, transparent);
    transition: transform .15s, filter .2s, box-shadow .2s, opacity .2s;
}
.tos-submit:hover { filter: brightness(1.06); }
.tos-submit:active { transform: scale(.98); }
.tos-submit:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }
.tos-submit.is-busy { opacity: .8; cursor: wait; }
.tos-submit .fa-spinner { animation: tosSpin .8s linear infinite; }
@keyframes tosSpin { to { transform: rotate(360deg); } }

.table-order-msg {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    margin: 0;
    padding: .6rem .8rem;
    border-radius: .75rem;
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.45;
}
.table-order-msg[hidden] { display: none; }
.table-order-msg::before { font-family: 'Font Awesome 6 Free'; font-weight: 900; }
.table-order-msg.is-err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.table-order-msg.is-err::before { content: '\f06a'; }
.table-order-msg.is-ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.table-order-msg.is-ok::before { content: '\f058'; }

.table-order-clear { margin: 0; text-align: center; font-size: .72rem; color: #94a3b8; }
.table-order-clear a { font-weight: 800; color: #64748b; text-decoration: underline; text-underline-offset: 2px; }
.table-order-clear a:hover { color: #0f172a; }

/* ── Success panel ─────────────────────────────────────────────── */
.tos-success {
    display: grid;
    justify-items: center;
    gap: .55rem;
    padding: 1.5rem .25rem .5rem;
    text-align: center;
    animation: tosPop .45s cubic-bezier(.22, 1, .36, 1) both;
}
.tos-success[hidden] { display: none; }
@keyframes tosPop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.tos-success__icon {
    display: grid;
    place-items: center;
    width: 4.25rem;
    height: 4.25rem;
    margin-bottom: .35rem;
    border-radius: 999px;
    background: #10b981;
    color: #fff;
    font-size: 1.7rem;
    box-shadow: 0 0 0 .55rem #d1fae5, 0 14px 30px rgba(16, 185, 129, .35);
    animation: tosCheck .5s .1s cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes tosCheck { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tos-success__title { margin: 0; font-size: 1.35rem; font-weight: 800; color: #0f172a; }
.tos-success__text { margin: 0; max-width: 24rem; font-size: .88rem; line-height: 1.55; color: #475569; }
.tos-success__meta { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; margin: .25rem 0; }
.tos-success__meta span {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .8rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #e2e8f0;
    font-size: .8rem;
    color: #475569;
}
.tos-success__meta i { color: var(--brand, #BD7561); font-size: .75rem; }
.tos-success__meta b { color: #0f172a; font-weight: 800; }
.tos-success__hint { margin: 0 0 .4rem; font-size: .76rem; color: #94a3b8; }

/* After sending, the success panel takes the whole popup. */
#orderModal.is-sent #orderCard,
#orderModal.is-sent #orderFoot { display: none; }
#orderModal.is-sent .order-body { display: grid; align-content: center; padding-bottom: 1rem; }

/* ── Phones: a bottom sheet that is easy to reach with one hand ── */
@media (max-width: 560px) {
    #orderModal.order-overlay { align-items: flex-end; padding: 0; }
    #orderModal .order-inner {
        max-width: none;
        max-height: 94dvh;
        border-radius: 1.4rem 1.4rem 0 0;
        transform: translateY(24px);
        transition: transform .3s cubic-bezier(.22, 1, .36, 1);
    }
    #orderModal.open .order-inner { transform: none; }
    #orderModal .order-header { position: relative; padding-top: 1.35rem; }
    #orderModal .order-header::before {
        content: '';
        position: absolute;
        top: .5rem;
        left: 50%;
        width: 2.6rem;
        height: 4px;
        border-radius: 999px;
        background: #e2e8f0;
        transform: translateX(-50%);
    }
    .tbl-banner { margin: 0 1rem .7rem; padding: .7rem .8rem; }
    #orderModal .order-body > .tbl-banner { margin-top: .75rem; }
    .tbl-banner__icon { width: 2.5rem; height: 2.5rem; font-size: .95rem; }
    .tbl-banner__name { font-size: 1.02rem; }
    .table-order-send { padding: .8rem 1rem .9rem; }
    .tos-actions { padding-inline: 1rem; }
    #orderModal .order-foot:has(.tos-actions) .order-total-row { padding-inline: 1rem; }
    .tos-grid { grid-template-columns: 1fr; gap: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
    .tos-success, .tos-success__icon, .tos-fields { animation: none; }
    #orderModal .order-inner { transition: none; }
}

/* focus-ring: field inside a ringed box (generated) */
.tos-code :is(input, select, textarea):focus,
.tos-input :is(input, select, textarea):focus,
.tos-phone :is(input, select, textarea):focus { outline: none; }
