/* ============================================================
   POS Design System — FrontPad-style
   ============================================================ */
:root {
    --bg: #eef1f7;
    --surface: #ffffff;
    --ink: #101426;
    --muted: #6b7590;
    --line: #e3e8f2;
    --accent: #6366f1;
    --accent-2: #8b5cf6;
    --green: #16a34a;
    --green-bg: #eafaf0;
    --amber: #f59e0b;
    --amber-bg: #fef3e2;
    --red: #ef4444;
    --red-bg: #fdeeee;
    --blue: #3b82f6;
    --blue-bg: #eaf2fe;
    --dark: #12162a;
    --radius: 18px;
    --radius-s: 12px;
    --shadow: 0 8px 28px rgba(23, 30, 63, .08);
    --shadow-lift: 0 14px 40px rgba(23, 30, 63, .16);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --tb-h: 62px;
    --mnav-h: 0px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    overflow: hidden;
}
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 15px; color: var(--ink); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c6cddd; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ================= Topbar ================= */
.topbar {
    height: 62px;
    background: linear-gradient(120deg, #141832 0%, #1d2145 55%, #26204d 100%);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 18px;
    position: relative;
    z-index: 50;
    box-shadow: 0 4px 24px rgba(10, 12, 34, .35);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: .4px; white-space: nowrap; }
.brand .logo {
    width: 38px; height: 38px; border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: grid; place-items: center; font-size: 19px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, .45);
}
.brand .sub { display: block; font-size: 10px; font-weight: 600; color: #9aa3c7; letter-spacing: 1.6px; }

.nav { display: flex; gap: 4px; margin-left: 12px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 16px; border-radius: 11px;
    color: #aeb6d8; text-decoration: none; font-weight: 650; font-size: 14px;
    transition: .18s; white-space: nowrap; position: relative;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav a.active { color: #fff; background: rgba(255,255,255,.13); }
.nav a .badge {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
    background: var(--amber); color: #fff; font-size: 11.5px; font-weight: 800;
    display: grid; place-items: center;
}
.nav a .badge.blue { background: var(--blue); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; color: #cdd4f0; text-align: center; line-height: 1.15; }
.clock small { display: block; font-size: 10.5px; font-weight: 600; color: #8891b8; }
.lang-btn { padding: 7px 12px; border-radius: 10px; font-weight: 800; font-size: 12.5px; background: rgba(255,255,255,.1); color: #fff; letter-spacing: .5px; }
.lang-btn:hover { background: rgba(255,255,255,.2); }
.kt-fail-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 9px; border-radius: 10px; font-weight: 800; font-size: 12.5px;
    background: rgba(239, 68, 68, .16); color: #ffd7d7;
    border: 1.5px solid rgba(248, 113, 113, .45); white-space: nowrap;
    animation: ktf-pulse 2.4s ease-in-out infinite;
}
.kt-fail-btn:hover { background: rgba(239, 68, 68, .3); }
.kt-fail-btn .kt-fail-x { font-size: 10.5px; opacity: .85; }
.kt-fail-btn .kt-fail-cnt {
    min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
    display: grid; place-items: center; font-size: 11.5px; font-variant-numeric: tabular-nums;
    background: var(--red); color: #fff;
}
@keyframes ktf-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, .55); }
    60% { box-shadow: 0 0 0 6px rgba(248, 113, 113, 0); }
}

/* ---- kitchen inner menu (orders / stop list / not-printed) ---- */
.kt-shell { position: relative; padding: 0; }
.kt-tabs {
    position: sticky; top: 8px; z-index: 30;
    display: flex; align-items: center; gap: 5px;
    width: 100%; box-sizing: border-box;
    padding: 5px; margin: 0 0 16px;
    border-radius: 15px;
    background: #f1f4fb;
    border: 1px solid var(--line);
    box-shadow: 0 5px 18px rgba(23, 30, 63, .07);
}
.kt-tabs a.kt-tab {
    flex: 1 1 0; min-width: 0;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 12px; border-radius: 11px;
    font-weight: 780; font-size: 13.5px; letter-spacing: .2px; line-height: 1;
    color: var(--muted); text-decoration: none; white-space: nowrap;
    transition: .18s;
}
.kt-tabs a.kt-tab .ic { font-size: 16px; line-height: 1; }
.kt-tabs a.kt-tab .lb { display: inline-block; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.kt-tabs a.kt-tab:hover { color: var(--ink); background: rgba(255,255,255,.75); }
.kt-tabs a.kt-tab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 6px 16px rgba(99,102,241,.38);
}
.kt-body { min-height: 120px; }
.kt-tabs + .kt-body { margin-top: 0; }

/* ---- admin: excel import ---- */
.imp-drop {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 34px 16px; border: 2px dashed #cfd7e6; border-radius: 14px;
    background: #fafbfe; text-align: center; transition: .16s;
}
.imp-drop.imp-over { border-color: var(--accent); background: #eef0ff; }
.imp-drop .imp-drop-ic { font-size: 34px; line-height: 1; }
.imp-drop-tx { font-weight: 800; }
.imp-drop-hint { color: #94a3b8; font-size: 11.5px; line-height: 1.55; max-width: 430px; }
.imp-bar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.imp-bar-l { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.imp-defcat { min-height: 38px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; font-weight: 700; background: #fff; }
.imp-count { color: var(--muted); font-weight: 750; font-size: 12.5px; }
.imp-tblwrap { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.imp-tblwrap table { margin: 0; }
.imp-inp {
    width: 100%; box-sizing: border-box; min-width: 0;
    padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px;
    background: #fff; color: var(--ink);
}
.imp-inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.13); }
.imp-inp.imp-warn { border-color: #ef4444; }
.imp-num { text-align: right; }
.imp-no { color: #94a3b8; font-weight: 700; }
tr.imp-off td { opacity: .45; }
.imp-catbox { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }
.imp-catbox .imp-catinput { width: 190px; flex: 1; min-width: 0; min-height: 38px; font-size: 14px; padding-right: 34px; }
.imp-catbox .imp-catinput.imp-new { padding-left: 36px; border-style: dashed; border-color: var(--accent-2); }
.imp-catpick {
    position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px;
    background: transparent; color: var(--muted); font-weight: 800; font-size: 13px; line-height: 1; cursor: pointer;
}
.imp-catpick:active { background: var(--blue-bg); color: var(--ink); }
.imp-nc {
    position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
    width: 20px; height: 20px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
    border: 1.5px dashed var(--accent-2); border-radius: 6px; color: var(--accent-2);
    font-weight: 900; font-size: 11px; line-height: 1; background: #f5f3ff; cursor: pointer;
}
.imp-nc:active { background: #ebe7ff; }
.imp-catmenu {
    position: fixed; z-index: 200; margin: 0; padding: 5px; box-sizing: border-box;
    display: flex; flex-direction: column; max-height: 300px; overflow: auto;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 14px 40px rgba(23, 30, 63, .18);
}
.imp-catmenu[hidden] { display: none; }
.imp-catopt {
    display: flex; align-items: center; gap: 8px; padding: 9px 10px;
    border: 0; background: none; color: var(--ink); font: inherit; font-weight: 650;
    text-align: left; border-radius: 8px; cursor: pointer;
}
.imp-catopt:hover { background: var(--blue-bg); }
.imp-catempty { color: var(--muted); cursor: default; }
.ktf-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lift); }
.user-chip {
    display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 7px;
    border-radius: 999px; background: rgba(255,255,255,.09); cursor: pointer; transition: .18s;
}
.user-chip:hover { background: rgba(255,255,255,.17); }
.user-chip .ava {
    width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center;
    font-weight: 800; font-size: 13px; color: #fff;
}
.user-chip .nm { font-size: 13.5px; font-weight: 700; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { display: block; font-size: 10.5px; color: #9aa3c7; font-weight: 600; }

/* ================= Layout ================= */
.view { height: calc(100vh - 62px); overflow: auto; position: relative; }
.view.printmode { height: 100vh; }

.page-pad { padding: 22px; max-width: 1500px; margin: 0 auto; }

h2.page-title { font-size: 21px; font-weight: 800; margin-bottom: 4px; }
p.page-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ================= Buttons ================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 20px; border-radius: 13px; font-weight: 750; font-size: 14.5px;
    transition: .16s; user-select: none; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn.big { padding: 16px 30px; font-size: 16px; font-weight: 820; border-radius: 15px; box-shadow: 0 10px 26px rgba(99,102,241,.5); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 6px 18px rgba(99,102,241,.38); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,.28) inset, 0 6px 16px rgba(22,163,74,.35);
    border: 1px solid rgba(15,110,42,.35);
}
.btn.success:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.28) inset, 0 8px 20px rgba(22,163,74,.42); }
.btn.warn {
    background: linear-gradient(135deg, #ea8a04, #f59e0b);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,.3) inset, 0 6px 16px rgba(245,158,11,.35);
    border: 1px solid rgba(180,105,0,.35);
}
.btn.warn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.3) inset, 0 8px 20px rgba(245,158,11,.42); }
.btn.danger { background: var(--red-bg); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.ghost {
    background: linear-gradient(180deg, #fff, #f6f8fb);
    border: 1.5px solid var(--line); color: #334155;
    box-shadow: 0 1px 2px rgba(15,23,42,.06);
}
.btn.ghost:hover { border-color: #c9d2e5; background: linear-gradient(180deg, #fff, #eef2f7); transform: translateY(-1px); }
.btn.dark { background: var(--dark); color: #fff; }
.btn.big { padding: 16px 24px; font-size: 16px; border-radius: 15px; }
.btn.sm { padding: 8px 13px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.block { width: 100%; }

.icon-btn {
    width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
    background: #fff; border: 1.5px solid var(--line); font-size: 17px; transition: .15s;
}
.icon-btn:hover { background: #f4f6fb; }
.icon-btn.danger:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* ================= Login ================= */
.login-wrap {
    min-height: calc(100vh - 62px); display: grid; place-items: center;
    background:
        radial-gradient(700px 380px at 12% 0%, rgba(99,102,241,.16), transparent 60%),
        radial-gradient(700px 420px at 95% 90%, rgba(139,92,246,.14), transparent 60%),
        var(--bg);
    padding: 26px; overflow: auto;
}
.login-card { width: 100%; max-width: 430px; text-align: center; }
.login-logo {
    width: 84px; height: 84px; margin: 0 auto 16px; border-radius: 26px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: grid; place-items: center; font-size: 42px;
    box-shadow: 0 18px 44px rgba(99,102,241,.45);
}
.login-title { font-size: 24px; font-weight: 850; }
.login-sub { color: var(--muted); margin: 6px 0 26px; font-size: 14px; }
.pw-toggle {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px; border: none; background: transparent; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    font-size: 18px; line-height: 1; color: #94a3b8; transition: background .15s, color .15s, transform .1s;
    padding: 0; flex-shrink: 0;
}
.pw-toggle:hover { background: rgba(15, 23, 42, .07); color: #334155; }
.pw-toggle:active { transform: translateY(-50%) scale(.92); }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.staff-card {
    background: #fff; border-radius: 16px; padding: 16px 10px 13px; box-shadow: var(--shadow);
    display: flex; flex-direction: column; align-items: center; gap: 9px; transition: .18s;
    border: 2px solid transparent;
}
.staff-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--accent); }
.staff-card .ava {
    width: 56px; height: 56px; border-radius: 999px; display: grid; place-items: center;
    color: #fff; font-weight: 850; font-size: 21px; box-shadow: 0 8px 20px rgba(15,23,42,.22);
}
.staff-card .nm { font-weight: 750; font-size: 14px; }
.staff-card small { color: var(--muted); font-size: 11.5px; font-weight: 650; }

.pin-display { display: flex; gap: 13px; justify-content: center; margin: 26px 0 22px; }
.pin-dot {
    width: 58px; height: 64px; border-radius: 14px; background: #fff; border: 2px solid var(--line);
    display: grid; place-items: center; font-size: 27px; font-weight: 850; box-shadow: var(--shadow);
    transition: .15s;
}
.pin-dot.filled { border-color: var(--accent); color: var(--accent); animation: pop .18s; }
@keyframes pop { 50% { transform: scale(1.14); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; max-width: 330px; margin: 0 auto; }
.pin-key {
    height: 66px; border-radius: 16px; background: #fff; box-shadow: var(--shadow);
    font-size: 24px; font-weight: 800; transition: .13s; border: 2px solid transparent;
}
.pin-key:hover { border-color: var(--accent); color: var(--accent); }
.pin-key:active { transform: scale(.94); }
.pin-key.util { background: var(--red-bg); color: var(--red); font-size: 17px; }
.pin-key.ok { background: linear-gradient(135deg, #16a34a, #22c55e); color: #fff; font-size: 21px; }

/* ---- desktop two-column login ---- */
@media (pointer: fine) and (min-width: 840px) {
    .login-split { max-width: 920px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 28px; background: #fff; box-shadow: var(--shadow-lift); overflow: hidden; }
    .login-left {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
        padding: 54px 44px; background: linear-gradient(155deg, var(--accent), var(--accent-2)); color: #fff;
        text-align: center;
    }
    .login-left .login-title { color: #fff; font-size: 28px; }
    .login-left .login-sub { color: rgba(255,255,255,.78); margin: 4px 0 22px; }
    .login-left #switchRest { color: #fff; border: 1.5px solid rgba(255,255,255,.5); border-radius: 999px; padding: 9px 22px; font-weight: 700; }
    .login-left #switchRest:hover { background: rgba(255,255,255,.15); }
    .login-right { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 40px; }
    .login-right .staff-grid { grid-template-columns: repeat(3, minmax(116px, 1fr)); width: 100%; }
    .login-right .pin-pad { max-width: 310px; }
}

/* ================= Tables ================= */
.hall-tabs { display: flex; gap: 9px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.orders-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.orders-head .hall-tabs { margin-bottom: 0; }
.tab-cnt {
    display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px;
    padding: 0 6px; margin-left: 7px; border-radius: 999px; background: rgba(0,0,0,.14);
    font-size: 12px; font-weight: 850; color: inherit; vertical-align: middle;
}
.hall-tab.active .tab-cnt { background: rgba(255,255,255,.28); }
.tab-cnt.bump { animation: cntBump .5s cubic-bezier(.2,.8,.3,1.2); }
@keyframes cntBump {
    0% { transform: scale(1); }
    35% { transform: scale(1.45); background: var(--accent); color: #fff; }
    100% { transform: scale(1); }
}
.hall-tab {
    padding: 11px 22px; border-radius: 999px; background: #fff; box-shadow: var(--shadow);
    font-weight: 750; font-size: 14.5px; color: var(--muted); transition: .18s; border: 2px solid transparent;
}
.hall-tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 22px rgba(99,102,241,.4); }
.hall-tab:not(.active):hover { color: var(--ink); }

.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 15px; }
.table-card {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px; cursor: pointer; transition: .18s; position: relative; overflow: hidden;
    border: 2px solid transparent; min-height: 132px; display: flex; flex-direction: column;
}
.table-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--green); }
.table-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.table-card.free::before { background: var(--green); }
.table-card.busy { background: linear-gradient(160deg, #fff, #fffafc); }
.table-card.busy::before { background: var(--amber); animation: glowpulse 2.2s infinite; }
.table-card.alert::before { background: var(--red); }
.table-card.ready-all::before { background: var(--blue); }
@keyframes glowpulse { 50% { opacity: .55; } }
.table-card .t-name { font-size: 17.5px; font-weight: 820; }
.table-card .t-seats { color: var(--muted); font-size: 12.5px; font-weight: 650; margin-top: 2px; }
.table-card .t-status {
    margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.table-card .t-total { font-size: 20px; font-weight: 850; margin-top: 12px; font-variant-numeric: tabular-nums; }
.table-card .t-meta { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.chip {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
    font-size: 11.5px; font-weight: 750;
}
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.amber { background: var(--amber-bg); color: #b45309; }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.blue { background: var(--blue-bg); color: var(--blue); }
.chip.gray { background: #eef1f7; color: var(--muted); }
.chip.pulse { animation: glowpulse 1.6s infinite; }

.fastfood-row { margin-top: 22px; display: flex; gap: 12px; flex-wrap: wrap; }
.neworder-btns { display: flex; gap: 10px; margin-bottom: 18px; }
.no-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 16px 14px; border: 2px solid var(--line); border-radius: 14px;
    background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 700;
    cursor: pointer; transition: .15s; user-select: none;
}
.no-btn:hover { border-color: var(--accent); color: var(--accent); }
.no-btn.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(99,102,241,.35);
}
.no-btn.disabled { opacity: .35; cursor: default; pointer-events: none; }
.hours-banner {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    z-index: 9998; background: #dc2626; color: #fff; text-align: center;
    padding: 7px 20px; font-size: 12.5px; font-weight: 700;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -4px 16px rgba(220,38,38,.4);
}

/* ================= Order page ================= */
.order-layout { display: flex; gap: 0; height: 100%; }
.menu-side { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 4px 8px 0; }
.cart-side {
    width: 392px; flex-shrink: 0; background: var(--surface); box-shadow: -12px 0 34px rgba(23,30,63,.07);
    display: flex; flex-direction: column; z-index: 5;
}
.search-row { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.search-box {
    flex: 0 0 390px; display: flex; align-items: center; gap: 7px; background: #fff;
    border: 2px solid var(--line); border-radius: 11px; padding: 0 11px; transition: .15s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(99,102,241,.12); }
.search-box input { flex: 1; border: 0; outline: 0; padding: 8.5px 0; font-size: 14px; background: none; min-width: 60px; }
.clear-search-btn {
    flex: 0 0 auto; width: 20px; height: 20px; margin-left: 4px; border: 0; border-radius: 50%;
    background: #e3e6f0; color: #596280; font-size: 11px; line-height: 1; padding: 0; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.clear-search-btn:hover { background: #d0d4e4; }
.clear-search-btn:active { background: #b7bdda; }
.clear-search-btn[hidden] { display: none; }
.cart-head-inline { flex: 1; min-width: 0; max-width: 550px; }
.cart-head-inline-inner {
    display: flex; align-items: center; gap: 8px; background: #fff;
    border: 2px solid var(--line); border-radius: 11px; padding: 5px 11px;
    font-size: 13px; overflow: hidden; white-space: nowrap;
}
.cart-head-inline-inner .t-name { font-weight: 800; font-size: 14px; }
#moveBtn:hover .t-name { color: var(--accent); }

/* vertical category column between menu and cart */
.cat-side {
    width: 172px; flex-shrink: 0; background: var(--surface);
    border-left: 1.5px solid var(--line);
    box-shadow: -10px 0 28px rgba(23,30,63,.05);
    overflow-y: auto; padding: 14px 2px;
    display: flex; flex-direction: column; gap: 9px; z-index: 4;
}
.cat-item {
    display: flex; align-items: center; gap: 2px; text-align: left;
    padding: 11px 2px; border-radius: 13px; background: #f4f6fb;
    border: 2px solid transparent; font-weight: 720; font-size: 13.5px;
    color: var(--ink); transition: .14s; flex-shrink: 0; line-height: 1.25;
}
.cat-item:hover { background: #e9edf5; }
.cat-item.active { background: var(--dark); color: #fff; border-color: var(--dark); }
.cat-item .ct-ico { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }
.cat-item .ct-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item .ct-cnt {
    min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px;
    background: rgba(15,23,42,.08); display: grid; place-items: center;
    font-size: 11px; font-weight: 800;
}
.cat-item.active .ct-cnt { background: rgba(255,255,255,.18); }

.products-grid {
    flex: 1; overflow-y: auto; display: grid; gap: 9px; padding-bottom: 18px;
    grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
    align-content: start;
}
.product-tile {
    background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 10px 11px;
    display: flex; flex-direction: column; gap: 6px; min-height: 82px; cursor: pointer;
    transition: .15s; border: 2px solid transparent; text-align: left; position: relative;
}
.product-tile:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.product-tile:active { transform: scale(.96); }
.product-tile .p-name {
    font-weight: 730; font-size: 12.5px; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-tile .p-price { margin-top: auto; font-weight: 830; font-size: 14px; color: var(--accent); font-variant-numeric: tabular-nums; }
.product-tile.stopped { opacity: .5; pointer-events: none; }
.product-tile.stopped::after {
    content: '⛔'; position: absolute; top: 9px; right: 9px; font-size: 15px;
}
.p-limit {
    position: absolute; bottom: 8px; right: 8px; font-size: 11.5px; font-weight: 850;
    color: var(--red); border-radius: 999px; padding: 1px 4px;
    font-variant-numeric: tabular-nums; background: #eef2ff;
    /*box-shadow: 0 0 0 3px rgba(239, 68, 68, .55);*/
	box-shadow: 0 0 0 1px rgb(0 0 0 / 97%);
}
.p-cnt {
    position: absolute; top: 8px; right: 8px; font-size: 11.5px; font-weight: 850;
    color: #fff; background: var(--green); border-radius: 999px; padding: 1px 5px;
    font-variant-numeric: tabular-nums; box-shadow: 0 1px 3px rgba(22, 163, 74, .45);
}
.stop-limit-inp {
    width: 74px; padding: 7px 8px; border: 1.5px solid var(--line); border-radius: 9px;
    font-size: 14px; font-weight: 700; background: #fff; color: var(--ink);
}

/* ---- cart ---- */
.cart-tabs {
    display: flex; gap: 6px; padding: 10px 10px 0;
    background: var(--surface); border-bottom: 1.5px solid var(--line); z-index: 2;
}
.ctab {
    flex: 1; padding: 11px 8px 12px; font-weight: 800; font-size: 13.5px; color: var(--muted);
    border-radius: 10px 10px 0 0; border-bottom: 2.5px solid transparent; transition: .14s;
}
.ctab:hover { color: var(--ink); }
.ctab.active { color: var(--ink); background: #f4f6fb; border-bottom-color: var(--accent); }
.cart-tabbody { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.client-form { padding: 12px 14px; overflow-y: auto; }
.cl-compact .field { margin-bottom: 8px; }
.cl-compact .field label { font-size: 11px; margin-bottom: 2px; }
.cl-compact .field input { padding: 7px 10px; font-size: 13px; }
.cl-row2 { display: grid; grid-template-columns: 1fr 80px; gap: 8px; }
.cl-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cl-results-title { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.cl-result {
    display: block; width: 100%; text-align: left; padding: 8px 10px;
    border-radius: 9px; background: #f4f6fb; font-weight: 720; font-size: 12.5px;
    margin-bottom: 5px; border: 1.5px solid transparent; transition: .14s;
}
.cl-result:hover { border-color: var(--accent); background: #eef1f8; }

.cart-head { padding: 17px 18px 13px; border-bottom: 1.5px solid var(--line); }
.cart-head .row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cart-head .t-name { font-weight: 830; font-size: 17.5px; }
.cart-head .waiter { color: var(--muted); font-size: 12.5px; font-weight: 650; margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.guests-stepper { display: flex; align-items: center; gap: 10px; margin-top: 11px; }
.guests-stepper .lbl { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.step-btn {
    width: 31px; height: 31px; border-radius: 9px; background: #eef1f7; font-weight: 850; font-size: 16px;
    display: grid; place-items: center; transition: .13s;
}
.step-btn:hover { background: var(--accent); color: #fff; }

.cart-items { flex: 1; overflow-y: auto; padding: 10px 14px; }
.cart-item {
    display: flex; gap: 10px; align-items: stretch; padding: 10px 8px; border-radius: 13px;
    transition: .14s; position: relative;
}
.cart-item:hover { background: #f6f8fc; }
.cart-item + .cart-item { border-top: 1px solid #eef1f7; }
.ci-main { flex: 1; min-width: 0; }
.ci-name { font-weight: 740; font-size: 14px; line-height: 1.3; }
.ci-note { color: var(--amber); font-size: 12px; font-weight: 650; margin-top: 2px; cursor: pointer; }
.ci-sub { color: var(--muted); font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ci-sub .ci-status-chip { margin-top: 0; display: inline-flex; }
.ci-sub .cook-min {
    color: var(--red); background: var(--red-bg); font-weight: 800;
    padding: 2px 8px; border-radius: 999px; font-size: 11px;
    display: inline-flex; align-items: center; gap: 4px;
}
.ci-sub .cook-min::before { content: '🔥'; font-size: 11px; }
.ci-status-chip { margin-top: 5px; }
.ci-right { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.ci-sum { font-weight: 820; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qty-box { display: flex; align-items: center; gap: 7px; }
.qty-val { min-width: 22px; text-align: center; font-weight: 820; font-size: 15px; }
.mini-step {
    width: 26px; height: 26px; border-radius: 8px; background: #eef1f7; font-weight: 850;
    display: grid; place-items: center; font-size: 14px; transition: .12s;
}
.mini-step:hover { background: var(--accent); color: #fff; }
.ci-del { position: absolute; left: -6px; top: -6px; width: 22px; height: 22px; border-radius: 999px;
    background: var(--red); color: #fff; font-size: 12px; font-weight: 900; display: none; place-items: center;
    box-shadow: 0 3px 9px rgba(239,68,68,.5); }
.cart-item:hover .ci-del.new { display: grid; }

.cart-empty { text-align: center; color: var(--muted); padding: 46px 20px; font-weight: 650; }
.cart-empty .big { font-size: 46px; margin-bottom: 10px; }

.totals-block { border-top: 1.5px solid var(--line); padding: 3px 18px 8px; cursor: pointer; transition: background .15s; }
.totals-block:hover { background: #f6f8fc; }
.tm-preview {
    margin-top: 15px; padding: 11px 14px; border-radius: 12px; background: #f4f6fb;
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 750; color: #475569; font-size: 13.5px;
}
.tm-preview b { color: var(--ink); font-weight: 870; font-size: 19px; }
.tot-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); font-weight: 680; padding: 2.5px 0; }
.tot-row.grand { font-size: 21px; color: var(--ink); font-weight: 850; padding-top: 1px; }
.tot-row.grand span:last-child { font-variant-numeric: tabular-nums; }
.disc-edit { color: var(--accent); cursor: pointer; font-weight: 800; }

.cart-actions { padding: 2px 6px 3px; display: flex; flex-direction: column; gap: 9px; }
.action-row { display: flex; gap: 9px; }
.action-row .btn { flex: 1; padding: 18px 12px; font-size: 13.5px; }

/* ================= Kitchen ================= */
.kitchen-board { height: 100%; overflow-y: auto; padding: 18px; }
.kitchen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(305px, 1fr)); gap: 15px; }
.k-card {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
    display: flex; flex-direction: column; border-top: 5px solid var(--green);
}
.k-card.warn { border-top-color: var(--amber); }
.k-card.late { border-top-color: var(--red); }
.k-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px 10px; gap: 8px; }
.k-order-no { font-weight: 850; font-size: 16.5px; }
.k-table { color: var(--muted); font-weight: 700; font-size: 13px; }
.k-mins { font-weight: 850; font-size: 14px; padding: 5px 12px; border-radius: 999px; }
.k-mins.ok { background: var(--green-bg); color: var(--green); }
.k-mins.warn { background: var(--amber-bg); color: #b45309; }
.k-mins.late { background: var(--red-bg); color: var(--red); animation: glowpulse 1.4s infinite; }
.k-items { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 7px; }
.k-item-row { display: flex; gap: 7px; align-items: stretch; }
.k-back {
    flex: 0 0 52px; min-height: 44px; display: grid; place-items: center;
    border-radius: 12px; border: 2px solid var(--line); background: #fff;
    font-size: 19px; font-weight: 800; color: var(--muted); cursor: pointer; transition: .14s;
}
.k-back:hover { border-color: var(--accent); color: var(--accent); }
.k-item {
    display: flex; align-items: center; gap: 10px; background: #f4f6fb; border-radius: 12px;
    padding: 11px 12px; cursor: pointer; transition: .14s; border: 2px solid transparent;
    text-align: left; flex: 1; min-width: 0;
}
.k-item:hover { border-color: var(--accent); }
.k-item .qty {
    min-width: 34px; height: 34px; border-radius: 9px; background: var(--dark); color: #fff;
    font-weight: 850; display: grid; place-items: center; font-size: 14px;
}
.k-item .nm { flex: 1; font-weight: 740; font-size: 14.5px; line-height: 1.25; }
.k-item .nt { display: block; color: var(--amber); font-size: 12px; font-weight: 700; }
.k-item.cooking .qty { background: var(--amber); }
.k-item.done { background: var(--green-bg); opacity: .85; }
.k-item.done .qty { background: var(--green); }
.k-item.done .nm { text-decoration: line-through; opacity: .65; }
.k-note-global { margin: 0 15px 13px; background: var(--amber-bg); color: #92400e; border-radius: 10px; padding: 8px 12px; font-size: 12.5px; font-weight: 650; }

/* ================= Orders list ================= */
.orders-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.order-card { padding: 17px; cursor: pointer; transition: .17s; position: relative; }
.order-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.order-card .oc-top { display: flex; justify-content: space-between; align-items: baseline; }
.order-card .oc-no { font-weight: 830; font-size: 16px; }
.order-card .oc-table { color: #111827; font-weight: 700; font-size: 13px; }
.order-card .oc-table.oc-tk { color: #dc2626; }
.order-card .oc-sum { font-size: 14px; font-weight: 850; margin-top: 10px; font-variant-numeric: tabular-nums; }
.order-card .oc-items {
    margin-top: 9px; font-size: 11.5px; font-weight: 650; color: var(--muted);
    line-height: 1.5; word-break: break-word; letter-spacing: .1px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.order-card .oc-items b { color: #475569; font-weight: 800; }
.order-card .oc-items.one { -webkit-line-clamp: 1; }
.order-card .oc-client {
    margin-top: 3px; font-size: 11px; font-weight: 700; color: #dc2626;
    line-height: 1.5; letter-spacing: .1px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}

/* closed orders card design */
.oc-closed-card { display: flex; flex-direction: column; gap: 9px;  }
.oc-closed-card.is-canceled { filter: grayscale(.9); opacity: .6; }
.oc-closed-card .oc-row1 { display: flex; align-items: center; gap: 10px; }
.oc-closed-card .oc-no { font-weight: 850; font-size: 16px; letter-spacing: .3px; }
.oc-waiter { color: var(--muted); font-size: 12.5px; font-weight: 650; }
.oc-tbl { font-weight: 740; font-size: 14.5px; margin-left: auto; text-align: right; }
.oc-tbl.oc-tk { color: #dc2626; }
.oc-closed-card .oc-row2 { display: flex; align-items: center; gap: 10px; }
.oc-sit {
    display: inline-flex; align-items: center; gap: 4px;
    background: linear-gradient(135deg, #eef2ff, #e6ecff); color: var(--accent);
    font-size: 12px; font-weight: 750; padding: 3px 10px; border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(99,102,241,.12); white-space: nowrap;
}
.oc-sit b { font-size: 13px; font-weight: 850; }
.oc-pm { font-size: 12.5px; letter-spacing: .5px; }
.oc-right { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; white-space: nowrap; }
.oc-closed-card .oc-sum { font-size: 18px; font-weight: 850; font-variant-numeric: tabular-nums; }
.oc-sum.struck { text-decoration: line-through; color: var(--muted); }

/* ================= Admin ================= */
.admin-nav { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

/* ---- admin side burger menu ---- */
.admin-wrap { --side-w: 232px; display: flex; align-items: flex-start; }
.admin-sidenav {
    position: sticky; top: 16px; z-index: 5;
    width: var(--side-w); flex: 0 0 var(--side-w); margin-right: 18px;
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 14px 10px; display: flex; flex-direction: column; gap: 3px;
    height: calc(100vh - var(--tb-h) - 32px); overflow-y: auto;
    transition: width .2s ease, flex-basis .2s ease, opacity .2s ease, margin .2s ease, padding .2s ease;
}
.admin-side-ttl {
    font-size: 11px; font-weight: 850; letter-spacing: .8px; text-transform: uppercase;
    color: var(--muted); padding: 6px 12px 10px; white-space: nowrap;
}
.admin-side-link {
    display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 11px;
    font-weight: 720; font-size: 14px; color: var(--ink); text-decoration: none;
    white-space: nowrap; transition: .14s;
}
.admin-side-link:hover { background: var(--blue-bg); }
.admin-side-link.active {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #fff; box-shadow: 0 6px 16px rgba(99, 102, 241, .35);
}
.admin-wrap.collapsed .admin-sidenav { width: 0; flex-basis: 0; padding-left: 0; padding-right: 0; margin-right: 0; opacity: 0; }
.admin-main { flex: 1; min-width: 0; }
.admin-side-sep { margin: 6px 10px 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.admin-install {
    margin: auto 2px 0; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px; border-radius: 12px; font-weight: 800; font-size: 13.5px; color: var(--accent);
    background: var(--blue-bg); border: 1.5px dashed var(--accent); cursor: pointer;
    white-space: nowrap; transition: .15s;
}
.admin-install:hover { background: #e2e7ff; border-color: var(--accent-2); }
.admin-install:active { transform: scale(.97); }
.admin-burger {
    position: sticky; top: 16px; z-index: 30;
    flex: 0 0 42px; width: 42px; height: 42px; margin: 0 0 0 -39px;
    border-radius: 12px; display: grid; place-items: center;
    font-size: 19px; line-height: 1; background: var(--surface); border: 1.5px solid var(--line);
    box-shadow: var(--shadow); transition: .15s, margin-left .2s ease;
}
.admin-burger:hover { border-color: var(--accent); background: var(--blue-bg); }
.admin-wrap.collapsed .admin-burger { margin-left: 0; }

/* ---- staff QR quick-login modal ---- */
.staff-cell-qt { border-radius: 8px; transition: background .12s; }
.staff-cell-qt:hover { background: var(--blue-bg); }
.qr-wrap { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 4px 0 2px; }
.qr-ava { width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 26px; box-shadow: var(--shadow); }
.qr-name { font-size: 19px; font-weight: 850; }
.qr-role { font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.qr-imgbox { width: 250px; height: 250px; display: grid; place-items: center; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-s); padding: 8px; box-shadow: var(--shadow); }
.qr-imgbox img { width: 232px; height: 232px; image-rendering: pixelated; }
.qr-loading, .qr-hint { color: var(--muted); }
.qr-hint { font-size: 13.5px; font-weight: 650; line-height: 1.45; margin: 6px 0; max-width: 340px; }
.qr-link { width: 100%; max-width: 380px; background: var(--bg); border: 1.5px dashed var(--line); border-radius: 12px; padding: 11px 13px; font-size: 12.5px; font-weight: 650; color: var(--ink); word-break: break-all; user-select: all; margin: 6px 0 12px; }
.qr-wrap .btn { width: 100%; }

.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 13px 15px; background: #f7f9fd; border-bottom: 1.5px solid var(--line); }
.data-table td { padding: 12px 15px; border-bottom: 1px solid #eef1f7; font-weight: 620; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: #fafbff; }

/* ---- admin menu toolbar / pager ---- */
.adm-toolbar { display: flex; gap: 12px; margin-bottom: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.adm-toolbar-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.adm-toolbar .search-box { width: 220px; }
.adm-count { font-weight: 820; margin: 0; white-space: nowrap; }
.pg-size { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 750; color: var(--muted); white-space: nowrap; }
.pg-size select { padding: 7px 8px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 13px; background: #fff; }
.pager { display: flex; gap: 6px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.pg-info { font-size: 12.5px; color: var(--muted); font-weight: 750; margin-right: 6px; }
.pg-btn {
    min-width: 34px; height: 34px; padding: 0 9px; border: 1.5px solid var(--line); border-radius: 10px;
    background: #fff; font-size: 13.5px; font-weight: 780; cursor: pointer; transition: .12s; color: var(--ink);
}
.pg-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--blue-bg); }
.pg-btn:disabled { opacity: .45; cursor: default; }
.pg-btn.pg-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pg-dots { color: var(--muted); font-weight: 750; padding: 0 2px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { padding: 18px; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-card .sc-label { color: var(--muted); font-size: 12.5px; font-weight: 720; }
.stat-card .sc-value { font-size: 26px; font-weight: 850; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-card .sc-icon { position: absolute; right: 14px; top: 14px; font-size: 24px; opacity: .85; }
.bar-chart { display: flex; align-items: flex-end; gap: 5px; height: 170px; padding: 12px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bar-col .bar { width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 7px 7px 3px 3px; min-height: 3px; transition: .3s; }
.bar-col .bar-lbl { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.rep-cards { display: flex; gap: 16px; flex-wrap: wrap; }
.rep-list { padding: 16px 18px; }
.rep-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; font-weight: 750; border-bottom: 1px dashed var(--line); }
.rep-row:last-child { border-bottom: 0; }
.rep-row > span:first-child { min-width: 0; flex: 1; }
.rep-row small { color: var(--muted); font-weight: 620; }
.rep-row .rep-meta { display: block; font-size: 12px; font-weight: 620; margin-top: 1px; color: var(--muted); }

.switch { position: relative; width: 42px; height: 24px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch .sl::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 999px; background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.switch input:checked + .sl { background: var(--green); }
.switch input:checked + .sl::after { transform: translateX(18px); }

/* ================= Modal ================= */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(13, 17, 38, .52); backdrop-filter: blur(3px);
    display: grid; place-items: center; z-index: 200; padding: 22px; animation: fadein .16s;
}
@keyframes fadein { from { opacity: 0; } }
.modal {
    background: #fff; border-radius: 22px; width: 400px; box-shadow: 0 30px 80px rgba(10,14,40,.4);
    max-height: calc(100vh - 60px); display: flex; flex-direction: column; animation: rise .2s;
}
@keyframes rise { from { transform: translateY(16px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 19px 22px 0; }
.modal-title { font-size: 18px; font-weight: 830; }
.modal-close { width: 34px; height: 34px; border-radius: 10px; background: #eef1f7; font-size: 15px; font-weight: 800; }
.modal-close:hover { background: var(--red); color: #fff; }
.modal-body { padding: 4px 22px; overflow-y: auto; }
.modal-foot { padding: 0 22px 20px; display: flex; gap: 10px; justify-content: flex-end; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; font-weight: 750; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
    width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 11px; outline: none;
    transition: .15s; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px rgba(99,102,241,.13); }

/* ---- emoji picker ---- */
.icon-field { display: flex; gap: 8px; }
.icon-field input { flex: 1; min-width: 0; }
.emoji-pick-btn {
    width: 46px; border: 1.5px solid var(--line); border-radius: 11px; background: #fff;
    font-size: 18px; cursor: pointer; transition: .15s; flex: 0 0 auto;
}
.emoji-pick-btn:hover { border-color: var(--accent); background: var(--blue-bg); }
.emoji-grid {
    display: none; margin-top: 8px; border: 1.5px solid var(--line); border-radius: 12px;
    overflow: hidden; background: #fff; box-shadow: var(--shadow);
}
.emoji-search {
    width: 100%; padding: 10px 12px; border: 0; border-bottom: 1.5px solid var(--line);
    outline: none; font-size: 14px; background: #f8fafc;
}
.emoji-scroll { max-height: 265px; overflow-y: auto; padding: 4px 10px 12px; overscroll-behavior: contain; }

/* ---- printer picker (departments) ---- */
.printer-field { position: relative; }
.printer-field input { padding-right: 46px; }
.printer-caret {
    position: absolute; top: 1px; right: 1px; bottom: 1px; width: 42px;
    border: 0; border-left: 1.5px solid var(--line); border-radius: 0 10px 10px 0;
    background: #f8fafc; cursor: pointer; font-size: 12px; color: var(--muted);
}
.printer-caret:hover { background: var(--blue-bg); }
.dept-printer-list {
    position: absolute; z-index: 250; max-height: 310px;
    border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden;
    background: #fff; box-shadow: var(--shadow);
}
.dept-printer-bar { position: absolute; top: 6px; right: 6px; z-index: 1; }
.dept-printer-refresh {
    width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid var(--line);
    background: #fff; cursor: pointer; font-size: 13px; transition: .12s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .14);
}
.dept-printer-refresh:hover { background: var(--blue-bg); border-color: var(--accent); }
.dept-printer-rows { max-height: 290px; overflow-y: auto; overscroll-behavior: contain; }
.dept-printer-row:first-child { margin-top: 40px; }
.dept-printer-row {
    display: flex; flex-direction: column; gap: 2px; padding: 10px 13px;
    border-bottom: 1px solid var(--line); cursor: pointer; transition: .12s;
}
.dept-printer-row:last-child { border-bottom: 0; }
.dept-printer-row:hover { background: var(--blue-bg); }
.dept-printer-row span { color: #94a3b8; font-size: 11.5px; }
.dept-printer-loading { padding: 14px 13px; color: #94a3b8; font-size: 12.5px; text-align: center; }
.emoji-group { margin-top: 8px; }
.emoji-gtitle { font-size: 11.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin: 6px 0; }
.emoji-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 5px; }
.emoji-item {
    height: 42px; border: 0; border-radius: 10px; background: #f4f6fb; font-size: 22px;
    display: grid; place-items: center; cursor: pointer; transition: .12s;
}
.emoji-item:hover { background: var(--green-bg); transform: scale(1.12); }
.emoji-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 0 10px; font-weight: 600; }

/* ---- product colors ---- */
.color-row { display: flex; gap: 10px; }
.color-cell { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.color-cell .cc-name { font-size: 12px; font-weight: 700; color: var(--muted); }
.color-input-wrap {
    height: 46px; border-radius: 11px; border: 1.5px solid var(--line); overflow: hidden;
    display: flex; align-items: center; justify-content: center; cursor: pointer; transition: .15s;
}
.color-input-wrap:focus-within, .color-input-wrap:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.13); }
.color-input-wrap input[type="color"] {
    width: 42px; height: 42px; padding: 0; border: 0; background: transparent; cursor: pointer;
}
.color-input-wrap input[type="color"]::-webkit-color-swatch-wrapper { padding: 4px; }
.color-input-wrap input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 8px; }
.prod-preview {
    margin: 10px 0; border-radius: 12px; padding: 10px 12px; min-height: 58px;
    display: flex; flex-direction: column; gap: 5px; box-shadow: var(--shadow);
    border: 2px solid transparent;
}
.prod-preview .p-name { font-weight: 730; font-size: 12.5px; }
.prod-preview .p-price { font-weight: 830; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.prod-swatch {
    display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px;
    font-size: 10px; font-weight: 800; margin-right: 8px; vertical-align: middle;
    border: 1px solid rgba(0,0,0,.08);
}

/* ---- payment ---- */
.pay-total { text-align: center; padding: 4px 0 1px; }
.pay-total .pt-label { color: var(--muted); font-weight: 720; font-size: 13px; }
.pay-total .pt-value { font-size: 40px; font-weight: 870; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.method-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }
.method-btn { padding: 15px; border-radius: 14px; border: 2px solid var(--line); font-weight: 800; font-size: 15px; transition: .15s; background: #fff; }
.method-btn.active.cash { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.method-btn.active.card { border-color: var(--blue); background: var(--blue-bg); color: var(--blue); }
.quick-cash { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 13px; }
.cash-row { display: flex; align-items: center; gap: 10px; }
.quick-btn { padding: 13px 6px; border-radius: 11px; background: #f4f6fb; font-weight: 800; font-size: 14.5px; transition: .13s; font-variant-numeric: tabular-nums; }
.quick-btn:hover { background: var(--dark); color: #fff; }
.pay-added { margin: 6px 0 4px; display: flex; flex-direction: column; gap: 7px; }
.pay-added .pa-row { display: flex; justify-content: space-between; align-items: center; background: #f8fafc; border: 1.5px dashed var(--line); border-radius: 10px; padding: 9px 13px; font-weight: 720; font-size: 14px; }
.pay-added .pa-row .rm { color: var(--red); font-weight: 900; padding: 0 5px; }
.pay-change { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding: 13px 16px; border-radius: 12px; font-weight: 800; }
.pay-change.ok { background: var(--green-bg); color: var(--green); }
.pay-change.bad { background: var(--red-bg); color: var(--red); }
.pay-change .pc-val { font-size: 22px; font-variant-numeric: tabular-nums; }

.note-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.note-chip { padding: 8px 14px; border-radius: 999px; background: #f4f6fb; font-weight: 720; font-size: 13px; transition: .13s; }
.note-chip:hover, .note-chip.active, .note-chip.on { background: var(--amber); color: #fff; }

/* ================= Toast ================= */
.toast-zone { position: fixed; top: 74px; right: 18px; z-index: 400; display: flex; flex-direction: column; gap: 9px; }
.toast {
    background: var(--dark); color: #fff; padding: 13px 18px; border-radius: 13px; font-weight: 700;
    font-size: 14px; box-shadow: var(--shadow-lift); display: flex; gap: 9px; align-items: center;
    animation: slidein .22s; max-width: 340px;
}
.toast.err { background: #b91c1c; }
.toast.okk { background: #15803d; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }

/* ================= Print receipt ================= */
.receipt-wrap { background: #525659; min-height: calc(100vh - 62px); display: grid; place-items: start center; padding: 26px 10px; overflow: auto; }
.m-receipt-actions { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 9px; z-index: 10; }
.receipt {
    background: #fff; width: 302px; padding: 14px 16px 18px; font-family: 'Courier New', monospace;
    font-size: 13px; line-height: 1.45; color: #000; box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.receipt.w80 { width: 302px; }
.receipt.w58 { width: 219px; font-size: 11.5px; padding: 10px 10px 14px; }
.receipt.w58 h1 { font-size: 13.5px; }
.seg-toggle {
    display: inline-flex; gap: 4px; background: #eef1f6; border-radius: 12px; padding: 4px;
}
.seg-btn {
    padding: 9px 18px; border-radius: 9px; font-weight: 780; font-size: 13.5px;
    color: var(--muted); transition: .15s;
}
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 5px rgba(23,30,63,.15); }
.receipt h1 { font-size: 17px; text-align: center; letter-spacing: 1px; }
.receipt .r-center { text-align: center; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 8px 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { vertical-align: top; padding: 1.5px 0; }
.receipt .r-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.receipt .r-bold { font-weight: 800; }
.receipt .kt-cancel td { color: #b91c1c; }
.receipt .kt-cancel .kt-reason { color: #b91c1c; }
.receipt .kt-inc td { color: #15803d; }
.receipt .kt-inc .kt-reason { color: #15803d; }
.receipt .kt-reason { font-weight: 700; }
@media print {
    .topbar, .receipt-actions, .toast-zone { display: none !important; }
    body { overflow: visible; background: #fff; }
    .receipt-wrap { padding: 0; background: #fff; display: block; }
    .receipt { box-shadow: none; margin: 0 auto !important; }
    .receipt + .receipt { page-break-before: always; break-before: page; margin-top: 0 !important; }
    .receipt.w80 { width: 100%; max-width: 80mm; font-size: 13px; }
    .receipt.w58 { width: 100%; max-width: 58mm; font-size: 11.5px; }
    .view { height: auto; overflow: visible; }
}

/* move-table modal */
.hall-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.hall-tab {
    padding: 7px 16px; border-radius: 9px; border: 2px solid var(--line); background: #fff;
    font-weight: 700; font-size: 13px; cursor: pointer; transition: .15s;
}
.hall-tab.active { border-color: var(--accent); background: #eef2ff; color: var(--accent); }
.hall-tab:hover:not(.active) { border-color: #c7d2fe; }
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 9px; }
.table-pick {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 14px 8px; border-radius: 11px; border: 2px solid var(--line); background: #fff;
    cursor: pointer; transition: .15s;
}
.table-pick:hover:not(.busy) { border-color: var(--accent); background: #f5f3ff; }
.table-pick.busy { opacity: .45; cursor: default; }
.tp-name { font-weight: 800; font-size: 15px; }
.tp-free { font-size: 11px; color: #16a34a; font-weight: 700; }
.tp-order { font-size: 10px; color: var(--muted); }

/* responsive */
@media (max-width: 1020px) {
    .order-layout { flex-direction: column-reverse; }
    .cart-side { width: 100%; box-shadow: 0 -10px 30px rgba(23,30,63,.08); max-height: 46vh; }
    .cat-side {
        width: 100%; flex-direction: row; overflow-x: auto; overflow-y: hidden;
        border-left: 0; border-bottom: 1.5px solid var(--line); box-shadow: none; padding: 9px 10px;
    }
    .cat-item .ct-cnt { display: none; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
}

/* ============================================================
   MOBILE / TOUCH LAYER
   ============================================================ */
.m-sheet-handle { display: none; }

/* ---- touch devices (phone + tablet + touch monitor) ---- */
@media (pointer: coarse) {
    body { -webkit-tap-highlight-color: transparent; }
    button, a, label, .no-btn, .hall-tab, .staff-card, .table-card, .table-pick,
    .product-tile, .cat-item, .k-item, .cl-result, .ctab, .seg-btn, .note-chip { touch-action: manipulation; }
    .view, .cart-items, .products-grid, .cat-side, .kitchen-board, .modal-body,
    .client-form, .login-wrap, .receipt-wrap { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

    .btn { min-height: 48px; }
    .btn.sm { min-height: 40px; padding: 9px 14px; }
    .nav a { min-height: 44px; }
    .icon-btn { width: 48px; height: 48px; font-size: 18px; }
    .modal-close { width: 44px; height: 44px; font-size: 17px; }
    .lang-btn { min-height: 40px; }
    .mini-step { width: 38px; height: 38px; font-size: 18px; border-radius: 10px; }
    .step-btn { width: 44px; height: 44px; font-size: 19px; border-radius: 11px; }
    .qty-val { min-width: 32px; font-size: 17px; }
    .qty-box { gap: 10px; }
    .cart-item { padding: 12px 8px 12px 34px; }
    .cart-item .ci-del.new {
        display: grid; left: 2px; top: 50%; transform: translateY(-50%);
        width: 28px; height: 28px; font-size: 13px;
    }
    .quick-btn, .method-btn, .note-chip, .seg-btn, .hall-tab, .ctab { min-height: 48px; }
    .cat-item { padding: 13px 4px; }
    .k-item { min-height: 56px; }
    .k-item .qty { min-width: 40px; height: 40px; font-size: 15px; }
    .pin-key { height: 70px; }
    .pin-key:hover { border-color: transparent; color: inherit; }
    .switch { width: 54px; height: 32px; }
    .switch .sl::after { width: 26px; height: 26px; }
    .switch input:checked + .sl::after { transform: translateX(22px); }
    .cl-result { padding: 12px 12px; }
    .field input, .field select, .field textarea { min-height: 46px; }
    .data-table td { padding: 14px 15px; }
}

/* ---- tablet ---- */
@media (max-width: 1020px) {
    :root { --tb-h: 58px; --mnav-h: 0px; }
    .topbar { height: var(--tb-h); padding: 0 12px; gap: 10px; }
    .view { height: calc(100vh - var(--tb-h)); }
    .clock small { display: none; }
    .page-pad { padding: 16px 14px 24px; }
    .tables-grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
    .kitchen-grid { grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); }
    .staff-grid { grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); }
    .search-box { flex: 1 1 200px; }
    .cart-head-inline { max-width: none; }
    .admin-nav, .hall-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 3px; }
    .admin-nav::-webkit-scrollbar, .hall-tabs::-webkit-scrollbar { display: none; }
    .admin-nav > *, .hall-tabs > * { flex: 0 0 auto; }
    .stat-cards { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

/* ---- phone (portrait + short landscape) ---- */
@media (max-width: 640px), (max-height: 520px) and (orientation: landscape) {
    :root { --tb-h: 54px; --mnav-h: 62px; --m-sheet-h: 176px; }
    body.m-nochrome { --tb-h: 0px; --mnav-h: 0px; }
    input, select, textarea { font-size: 16px; }
    .view { height: calc(100vh - var(--tb-h) - var(--mnav-h)); }
    .page-pad { padding: 14px 12px 22px; }
    h2.page-title { font-size: 18px; }
    p.page-sub { font-size: 13px; margin-bottom: 14px; }

    /* topbar compact */
    .topbar { height: var(--tb-h); padding: 0 10px; gap: 8px; }
    .brand { gap: 8px; font-size: 14px; min-width: 0; }
    .brand > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .brand .logo { width: 34px; height: 34px; border-radius: 10px; font-size: 17px; }
    .brand .sub { display: none; }
    .clock { display: none; }
    .topbar-right { gap: 6px; }
    .lang-btn { min-width: 46px; padding: 0 10px; }
    .user-chip { padding: 5px; gap: 0; }
    .user-chip > div { display: none; }
    .user-chip .ava { width: 34px; height: 34px; }

    /* main nav -> bottom bar */
    .nav {
        position: fixed; left: 0; right: 0; bottom: 0; margin: 0; z-index: 60;
        display: flex; gap: 2px; overflow-x: auto;
        padding: 4px 4px env(safe-area-inset-bottom);
        min-height: calc(var(--mnav-h) + env(safe-area-inset-bottom));
        background: linear-gradient(180deg, #1b1f40, #141832);
        border-top: 1px solid rgba(255,255,255,.08);
        box-shadow: 0 -6px 22px rgba(10,12,34,.4);
    }
    .nav a {
        flex: 1 1 0; min-width: 60px; flex-direction: column; justify-content: center;
        gap: 2px; padding: 6px 4px; border-radius: 12px;
        font-size: 10.5px; font-weight: 750; line-height: 1.15; text-align: center;
    }
    .nav a > span:first-child { font-size: 21px; line-height: 1; }
    .nav a > span:nth-child(2) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .nav a .badge { position: absolute; top: 1px; right: 6px; }

    .toast-zone { top: calc(var(--tb-h) + 8px); left: 12px; right: 12px; }
    .toast { max-width: none; }
    .hours-banner { bottom: calc(var(--mnav-h) + env(safe-area-inset-bottom)); font-size: 11.5px; padding: 6px 14px; }

    /* login + pin */
    .login-wrap { min-height: 100vh; padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); place-items: stretch; }
    .login-card { max-width: none; display: flex; flex-direction: column; min-height: 100%; }
    .login-logo { width: 64px; height: 64px; font-size: 32px; border-radius: 20px; margin-bottom: 12px; }
    .login-title { font-size: 20px; }
    .login-sub { font-size: 13px; margin: 5px 0 18px; }
    .staff-grid { grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); gap: 10px; }
    .staff-card { padding: 13px 7px 11px; border-radius: 14px; }
    .staff-card .ava { width: 48px; height: 48px; font-size: 18px; }
    .staff-card .nm { font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .staff-card small { font-size: 11px; }
    #pinArea { margin-top: auto; padding-top: 10px; }
    .pin-display { gap: 10px; margin: 14px 0 16px; }
    .pin-dot { width: 52px; height: 58px; font-size: 24px; }
    .pin-pad { gap: 9px; max-width: 340px; }
    .pin-key { height: 66px; font-size: 23px; }

    /* tables + new order */
    .neworder-btns { flex-wrap: wrap; gap: 8px; }
    .no-btn { min-height: 56px; font-size: 14px; padding: 12px 10px; flex: 1 1 46%; }
    .orders-head { gap: 10px; margin-bottom: 14px; }
    .orders-head #newOrderBtn { flex: 1 1 100%; justify-content: center; min-height: 56px; font-size: 17px; }
    .tables-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .table-card { min-height: 118px; padding: 13px; }
    .table-card .t-name { font-size: 16px; }
    .table-card .t-total { font-size: 18px; margin-top: 9px; }
    .hall-tab { padding: 11px 16px; font-size: 13.5px; }
    .kt-tabs { top: 6px; gap: 4px; padding: 4px; border-radius: 14px; }
    .kt-tabs a.kt-tab { font-size: 12px; gap: 5px; padding: 9px 8px; }
    .kt-tabs a.kt-tab .ic { font-size: 14px; }

    /* order screen: cart as bottom sheet */
    .order-layout { flex-direction: column; }
    .cat-side { order: 1; padding: 8px; gap: 7px; }
    .menu-side { order: 2; flex: 1; min-height: 0; padding: 6px 8px 0; }
    .search-row { flex-wrap: wrap; gap: 6px; }
    .search-box { flex: 1 1 auto; min-width: 0; }
    .cart-head-inline { flex: 1 0 100%; max-width: none; }
    .cart-head-inline-inner { overflow-x: auto; scrollbar-width: none; }
    .cart-head-inline-inner::-webkit-scrollbar { display: none; }
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
        padding-bottom: calc(var(--m-sheet-h) + 24px);
    }
    .product-tile { min-height: 76px; padding: 9px 10px; }

    .cart-side {
        position: fixed; left: 0; right: 0; z-index: 30;
        bottom: calc(var(--mnav-h) + env(safe-area-inset-bottom));
        width: auto; max-height: 78vh; overflow: hidden;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -14px 34px rgba(23,30,63,.24);
    }
    .cart-side > .cart-tabs, .cart-side > .cart-tabbody { display: none; }
    .order-layout.m-sheet-open .cart-side > .cart-tabs { display: flex; }
    .order-layout.m-sheet-open .cart-side > .cart-tabbody { display: flex; }
    .m-sheet-handle {
        display: flex; align-items: center; gap: 10px;
        width: 100%; min-height: 42px; padding: 10px 14px 4px;
        color: var(--muted); font-weight: 780; font-size: 12.5px;
    }
    .m-sheet-handle .m-sheet-grip { width: 38px; height: 4px; border-radius: 99px; background: #cbd5e1; flex-shrink: 0; }
    .m-sheet-handle .m-sheet-lbl { flex: 1; min-width: 0; text-align: left; color: var(--ink); font-size: 13.5px; font-weight: 820; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .m-sheet-handle .m-sheet-arrow { font-size: 11px; transition: transform .18s; }
    .order-layout.m-sheet-open .m-sheet-handle .m-sheet-arrow { transform: rotate(180deg); }
    .cart-items { padding: 8px 12px; }
    .totals-block { padding: 3px 14px 6px; }
    .tot-row.grand { font-size: 19px; }
    .cart-actions { padding: 2px 10px calc(8px + env(safe-area-inset-bottom)); }
    .action-row { gap: 7px; }
    .action-row .btn { padding: 14px 8px; font-size: 13px; min-height: 52px; }

    /* kitchen */
    .kitchen-board { padding: 12px; }
    .kitchen-grid { grid-template-columns: 1fr; gap: 12px; }
    .k-order-no { font-size: 15.5px; }
    .k-mins { font-size: 13.5px; padding: 6px 11px; }
    .k-item .nm { font-size: 14px; }

    /* orders list */
    .orders-grid { grid-template-columns: 1fr; gap: 10px; }
    .order-card { padding: 14px; }

    /* admin + reports */
    .admin-nav { gap: 6px; margin-bottom: 14px; }
    .admin-wrap { display: block; }
    .admin-burger {
        position: fixed; top: calc(var(--tb-h) + 8px); left: 12px; z-index: 70;
        width: 40px; height: 40px; margin: 0;
    }
    .admin-main { padding-top: 54px; }
    .admin-sidenav {
        position: fixed; left: 0; top: 0; bottom: 0; z-index: 65;
        width: 272px; max-width: 86vw; flex: none; overflow-y: auto; height: 100%;
        border-radius: 0 18px 18px 0; padding: 22px 12px calc(16px + env(safe-area-inset-bottom));
        transform: translateX(-103%); transition: transform .24s ease; box-shadow: none;
    }
    .admin-wrap.menu-open .admin-sidenav { transform: none; box-shadow: var(--shadow-lift); }
    .admin-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 45, .5); z-index: 62; }
    .m-adm-split { gap: 12px; }
    .m-adm-cats { width: 100% !important; flex-direction: row !important; overflow-x: auto; scrollbar-width: none; padding-bottom: 3px; }
    .m-adm-cats::-webkit-scrollbar { display: none; }
    .m-adm-cats > * { flex: 0 0 auto; }
    .m-adm-cats > .card { min-width: 190px; }
    .m-adm-depts { flex-direction: column !important; overflow-x: visible; }
    .m-adm-depts > * { flex: none; width: 100% !important; }
    .m-adm-prods { min-width: 0 !important; width: 100%; }
    .m-min0 { min-width: 0 !important; }
    .field.m-min0 { flex: 1 1 100% !important; }
    .m-row-wrap { flex-wrap: wrap; }
    .m-row-wrap > .search-box { flex: 1 1 100% !important; }
    .m-row-wrap > .btn { flex: 1 1 auto; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
    .stat-card { padding: 14px; }
    .stat-card .sc-value { font-size: 20px; }
    .stat-card .sc-icon { font-size: 18px; right: 11px; top: 11px; }
    .rep-cards { flex-direction: column; }
    .rep-cards > .card { flex: 1 1 auto !important; min-width: 0 !important; width: 100%; }
    .bar-chart { height: 150px; overflow-x: auto; }
    .bar-col { min-width: 16px; }

    .data-table { display: block; background: transparent; box-shadow: none; }
    .data-table thead { display: none; }
    .data-table tbody { display: flex; flex-direction: column; gap: 10px; }
    .data-table tr { display: block; background: #fff; border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 4px 13px; }
    .data-table tr:hover td { background: transparent; }
    .data-table td {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        width: auto; padding: 11px 0; border-bottom: 1px solid #eef1f7; text-align: right;
    }
    .data-table td::before {
        content: attr(data-label); flex: 0 0 auto; text-align: left;
        color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
    }
    .data-table td:not([data-label])::before { content: none; }
    .data-table td:not([data-label]) { justify-content: flex-end; }
    .data-table td:empty { display: none; }
    .data-table tr td:last-child { border-bottom: 0; }

    /* modals as bottom sheets */
    .modal-overlay { padding: 0; place-items: end stretch; }
    .modal {
        width: 100%; max-width: none !important; max-height: 92vh;
        border-radius: 22px 22px 0 0; animation: mrise .22s;
    }
    @keyframes mrise { from { transform: translateY(28px); opacity: 0; } }
    .modal-head { padding: 15px 16px 0; }
    .modal-title { font-size: 16.5px; }
    .modal-body { padding: 4px 16px; }
    .modal-foot {
        position: sticky; bottom: 0; background: #fff; flex-wrap: wrap;
        padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
    }
    .modal-foot .btn { flex: 1 1 auto; }
    .pay-total .pt-value { font-size: 32px; }
    .quick-cash { grid-template-columns: repeat(2, 1fr); }
    .cash-row { flex-wrap: wrap; }
    .cash-row .btn { flex: 1 1 100%; }
    .table-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
    .cl-row3 { grid-template-columns: 1fr 1fr; }

    /* receipt */
    .receipt-wrap { padding: 74px 6px calc(20px + env(safe-area-inset-bottom)); min-height: 100vh; }
    .m-receipt-actions { top: 12px; left: 12px; right: 12px; transform: none; }
    .m-receipt-actions .btn { flex: 1; }
    .receipt { width: 100%; max-width: 320px; margin-top: 0 !important; }
    .receipt.w80 { width: 100%; max-width: 320px; }
    .receipt.w58 { width: 100%; max-width: 250px; }
}

@supports (height: 100dvh) {
    @media (max-width: 640px), (max-height: 520px) and (orientation: landscape) {
        .view { height: calc(100dvh - var(--tb-h) - var(--mnav-h)); }
        .view.printmode, body.m-nochrome .view { height: 100dvh; }
        .login-wrap { min-height: 100dvh; }
        .receipt-wrap { min-height: 100dvh; }
    }
}

/* ---- phone landscape ---- */
@media (max-height: 520px) and (orientation: landscape) {
    :root { --tb-h: 46px; --mnav-h: 52px; }
    .topbar { height: var(--tb-h); }
    .nav { min-height: calc(var(--mnav-h) + env(safe-area-inset-bottom)); }
    .nav a { font-size: 10px; }
    .nav a > span:first-child { font-size: 17px; }
    .login-wrap { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
    .login-logo { width: 46px; height: 46px; font-size: 23px; border-radius: 15px; margin-bottom: 7px; }
    .login-title { font-size: 17px; }
    .login-sub { margin: 3px 0 10px; }
    .staff-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
    .staff-card { padding: 9px 6px 8px; }
    .staff-card .ava { width: 38px; height: 38px; font-size: 15px; }
    .pin-display { gap: 8px; margin: 8px 0 9px; }
    .pin-dot { width: 42px; height: 44px; font-size: 19px; border-radius: 11px; }
    .pin-pad { gap: 7px; max-width: 300px; }
    .pin-key { height: 46px; font-size: 19px; border-radius: 12px; }
    .cart-side { max-height: 88vh; }
    .modal { max-height: 96vh; }
    .modal-body { padding: 2px 16px; }
    .kitchen-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .products-grid { padding-bottom: calc(var(--m-sheet-h) + 12px); }
}
