/* ==========================================================
   RESTAURANT POS - NAVY & GOLD LUXURY THEME
   ========================================================== */
:root {
    --navy: #232962;
    --navy-dark: #161b45;
    --navy-deep: #0e1233;
    --gold: #d4af37;
    --gold-dark: #b8932a;
    --gold-light: #e6c75a;

    --primary: var(--navy);
    --accent: var(--navy);               /* text/icon accent: navy (light) / gold (dark) */
    --primary-soft: rgba(35, 41, 98, .07);

    --bg: #f5f5f7;
    --surface: #ffffff;
    --text: #141a3a;
    --muted: #6b7194;
    --border: #e6e7ef;
    --topbar-bg: rgba(255, 255, 255, .88);

    --sidebar-bg: var(--navy-deep);
    --sidebar-w: 268px;
    --sidebar-w-mini: 80px;
    --topbar-h: 70px;
    --bottom-h: 64px;

    --radius: 16px;
    --shadow-sm: 0 1px 2px rgba(22, 27, 69, .04), 0 6px 18px rgba(22, 27, 69, .06);
    --shadow-md: 0 12px 34px rgba(22, 27, 69, .14);

    --font-display: 'Playfair Display', Georgia, serif;

    /* Bootstrap overrides */
    --bs-primary: #232962;
    --bs-primary-rgb: 35, 41, 98;
    --bs-link-color: #232962;
    --bs-link-color-rgb: 35, 41, 98;
    --bs-link-hover-color-rgb: 184, 147, 42;
}

[data-bs-theme="dark"] {
    --accent: var(--gold);
    --primary-soft: rgba(212, 175, 55, .12);

    --bg: #0b0e24;
    --surface: #141a3d;
    --text: #e8eaf6;
    --muted: #9aa1c9;
    --border: #252c5a;
    --topbar-bg: rgba(20, 26, 61, .88);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 12px 34px rgba(0, 0, 0, .5);

    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-primary-rgb: 212, 175, 55;
    --bs-link-color-rgb: 212, 175, 55;
    --bs-link-hover-color-rgb: 230, 199, 90;
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: .925rem;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
.text-gold { color: var(--gold) !important; }

.app-wrapper { min-height: 100vh; }

/* ==========================================================
   SIDEBAR
   ========================================================== */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    background-image:
        radial-gradient(circle at 0 0, rgba(212, 175, 55, .13), transparent 42%),
        linear-gradient(180deg, var(--navy-dark) 0%, var(--navy-deep) 100%);
    border-right: 1px solid rgba(212, 175, 55, .12);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: width .25s ease, transform .3s ease;
}

.sidebar-brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    color: #fff;
    border-bottom: 1px solid rgba(212, 175, 55, .18);
    flex-shrink: 0;
}
.brand-logo {
    width: 42px; height: 42px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--gold-light), var(--gold) 55%, var(--gold-dark));
    display: grid; place-items: center;
    color: var(--navy-dark); font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 6px 18px rgba(212, 175, 55, .4);
}
.brand-logo.sm {
    width: 36px; height: 36px; font-size: 1.05rem; border-radius: 11px; box-shadow: none;
}
.brand-text { line-height: 1.15; white-space: nowrap; }
.brand-text strong {
    display: block;
    font-family: var(--font-display);
    font-size: 1.15rem; font-weight: 700;
    letter-spacing: .2px;
}
.brand-text small {
    color: var(--gold); font-size: .66rem; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase;
}

.sidebar-close {
    margin-left: auto;
    width: 36px; height: 36px;
    border: 0; border-radius: 10px;
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 14px 12px; }

.menu-label {
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: rgba(212, 175, 55, .75);
    font-weight: 700;
    padding: 18px 14px 8px;
    white-space: nowrap;
}

.menu-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    margin-bottom: 4px;
    border-radius: 12px;
    color: #a9b0dc;
    font-weight: 600;
    font-size: .9rem;
    white-space: nowrap;
    transition: all .2s;
}
.menu-link i { font-size: 1.15rem; width: 22px; text-align: center; flex-shrink: 0; }
.menu-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.menu-link.active {
    background: linear-gradient(90deg, rgba(212, 175, 55, .22), rgba(212, 175, 55, .06));
    color: var(--gold-light);
}
.menu-link.active::before {
    content: "";
    position: absolute; left: 0; top: 9px; bottom: 9px;
    width: 3px; border-radius: 0 4px 4px 0;
    background: var(--gold);
    box-shadow: 0 0 12px rgba(212, 175, 55, .8);
}
.menu-badge {
    margin-left: auto;
    background: var(--gold);
    color: var(--navy-dark);
    font-size: .68rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 20px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(212, 175, 55, .2);
    color: #fff;
    flex-shrink: 0;
}
.user-info { line-height: 1.2; white-space: nowrap; }
.user-info strong { display: block; font-size: .88rem; }
.user-info small { color: var(--gold); font-size: .7rem; font-weight: 600; }
.logout-btn { margin-left: auto; color:var(--accent); font-size: 1.15rem; background-color: var(--gold); }
.logout-btn:hover { color: red; }

.avatar {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
    color: var(--navy-dark); font-weight: 800;
    display: grid; place-items: center;
    flex-shrink: 0;
}
.avatar.sm { width: 34px; height: 34px; border-radius: 10px; font-size: .85rem; }

.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(8, 10, 34, .65);
    backdrop-filter: blur(3px);
    z-index: 1045;
}

/* ==========================================================
   MAIN AREA + TOPBAR
   ========================================================== */
.main-area {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

.topbar {
    position: sticky; top: 0;
    z-index: 1030;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px;
    padding: 0 26px;
    background: var(--topbar-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.topbar-title h1 {
    font-family: var(--font-display);
    font-size: 1.35rem; font-weight: 700;
    margin: 0; line-height: 1.2;
    color: var(--text);
}
.topbar-title span { font-size: .75rem; color: var(--muted); font-weight: 500; }

.topbar-search {
    margin-left: 24px;
    flex: 1; max-width: 420px;
    align-items: center; gap: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0 14px; height: 42px;
    color: var(--muted);
    transition: all .2s;
}
.topbar-search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(212, 175, 55, .15); }
.topbar-search input {
    border: 0; background: transparent; outline: 0;
    width: 100%; color: var(--text); font-size: .88rem;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 13px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 1.15rem;
    position: relative;
    cursor: pointer;
    transition: all .2s;
}
.icon-btn:hover { background: rgba(212, 175, 55, .14); border-color: var(--gold); color: var(--gold-dark); }
[data-bs-theme="dark"] .icon-btn:hover { color: var(--gold); }
.notif-dot {
    position: absolute; top: 9px; right: 10px;
    width: 9px; height: 9px;
    background: #ef4444; border-radius: 50%;
    border: 2px solid var(--surface);
}

.user-btn {
    display: flex; align-items: center; gap: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 13px;
    padding: 3px 12px 3px 4px;
    font-weight: 600; height: 42px;
}

.mobile-brand { display: flex; align-items: center; gap: 10px; color: #fff; line-height: 1.15; }
.mobile-brand strong { display: block; font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.mobile-brand small {
    font-size: .64rem; color: var(--gold);
    font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}

.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    padding: 8px;
    background: var(--surface);
}
.dropdown-item { border-radius: 9px; font-weight: 500; padding: 8px 12px; color: var(--text); }
.dropdown-item:hover { background: var(--primary-soft); color: var(--text); }

.notif-menu { width: 300px; padding: 0; overflow: hidden; }
.notif-head { padding: 14px 16px; font-weight: 800; border-bottom: 1px solid var(--border); }
.notif-item {
    display: flex; gap: 12px; align-items: center;
    padding: 12px 16px; color: var(--text);
    border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--primary-soft); }
.notif-item strong { display: block; font-size: .85rem; }
.notif-item small { color: var(--muted); font-size: .72rem; }
.n-icon {
    width: 38px; height: 38px; border-radius: 12px;
    display: grid; place-items: center; color: #fff; flex-shrink: 0;
}
.bg-ready { background: #22c55e; }
.bg-kot { background: #3b82f6; }
.bg-bill { background: #8b5cf6; }

.content { flex: 1; padding: 26px; }
.app-footer {
    padding: 16px 24px;
    text-align: center;
    color: var(--muted);
    font-size: .78rem;
}

/* ==========================================================
   COMPONENTS
   ========================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--text);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    font-weight: 800;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-body { padding: 20px; }

.btn { border-radius: 12px; font-weight: 700; padding: .55rem 1.1rem; }

/* Primary = navy */
.btn-primary {
    background: linear-gradient(135deg, #2e3680, var(--navy));
    border: 0; color: #fff;
    box-shadow: 0 6px 16px rgba(35, 41, 98, .3);
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, var(--navy), var(--navy-dark));
    color: #fff;
}
[data-bs-theme="dark"] .btn-primary { background: linear-gradient(135deg, #2e3680, #232962); border: 1px solid rgba(212, 175, 55, .35); }

/* Gold = main call-to-action */
.btn-gold {
    background: linear-gradient(135deg, var(--gold-light), var(--gold) 55%, var(--gold-dark));
    color: var(--navy-dark);
    border: 0;
    box-shadow: 0 8px 20px rgba(212, 175, 55, .38);
    position: relative; z-index: 1;
}
.btn-gold:hover, .btn-gold:focus {
    filter: brightness(1.07);
    color: var(--navy-dark);
    transform: translateY(-1px);
}
.btn-gold:active { transform: scale(.97); }

.btn-light-glass {
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .25);
    position: relative; z-index: 1;
}
.btn-light-glass:hover { background: rgba(255, 255, 255, .22); color: #fff; }

.btn-outline-primary { --bs-btn-color: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--navy); --bs-btn-hover-border-color: var(--navy); --bs-btn-hover-color: #fff; }

.form-control, .form-select {
    border-radius: 12px;
    border-color: var(--border);
    padding: .62rem .9rem;
    background-color: var(--surface);
    color: var(--text);
    font-size: 13px !important;
}
.form-control:focus, .form-select:focus {
    border-color: var(--gold);
    background-color: var(--surface);
    color: var(--text);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, .18);
}
.form-check-input:checked { background-color: var(--navy); border-color: var(--navy); }

/* Hero */
.hero-card {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 55%, #2f3a94 100%);
    color: #fff;
    border-radius: 22px;
    padding: 28px;
    border: 1px solid rgba(212, 175, 55, .3);
    box-shadow: 0 18px 40px rgba(35, 41, 98, .32);
}
.hero-card::before, .hero-card::after {
    content: ""; position: absolute; border-radius: 50%;
}
.hero-card::before { width: 240px; height: 240px; right: -70px; top: -100px; background: rgba(212, 175, 55, .14); }
.hero-card::after { width: 150px; height: 150px; right: 100px; bottom: -85px; border: 2px solid rgba(212, 175, 55, .35); }
.hero-card h2 { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; margin: 0 0 4px; position: relative; }
.hero-card p { margin: 0 0 20px; opacity: .8; position: relative; }

/* Stats */
.stat-card { display: flex; align-items: center; gap: 14px; padding: 18px; height: 100%; }
.stat-icon {
    width: 52px; height: 52px; border-radius: 16px;
    display: grid; place-items: center;
    color: #fff; font-size: 1.4rem; flex-shrink: 0;
}
.g-navy, .g-indigo { background: linear-gradient(135deg, #3a44a0, var(--navy)); }
.g-gold, .g-orange { background: linear-gradient(135deg, var(--gold-light), var(--gold-dark)); color: var(--navy-dark); }
.g-blue { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.g-green { background: linear-gradient(135deg, #34d399, #16a34a); }
.stat-value { font-size: 1.55rem; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .76rem; font-weight: 600; }

/* Filter chips */
.chip-row {
    display: flex; gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    border-radius: 30px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 600; font-size: .8rem;
    white-space: nowrap; cursor: pointer;
    transition: all .2s;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted)); }
.chip .count { background: var(--bg); border-radius: 20px; padding: 0 8px; font-size: .72rem; }
.chip:hover { border-color: var(--gold); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.active .count { background: rgba(255, 255, 255, .22); }
[data-bs-theme="dark"] .chip.active { background: var(--gold); border-color: var(--gold); color: var(--navy-dark); }
[data-bs-theme="dark"] .chip.active .count { background: rgba(22, 27, 69, .2); }

/* Table boxes */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}
.table-box {
    --c: #22c55e; --c-rgb: 34, 197, 94; --c-text: var(--c);
    position: relative; display: block; overflow: hidden;
    padding: 16px;
    border-radius: 20px;
    background: var(--surface);
    border: 1.5px solid rgba(var(--c-rgb), .4);
    color: var(--text);
    transition: transform .2s, box-shadow .2s;
}
.table-box::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(160deg, rgba(var(--c-rgb), .18), transparent 65%);
    pointer-events: none;
}
.table-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(var(--c-rgb), .28);
    color: var(--text);
}
.table-box:active { transform: scale(.97); }
.tb-top { position: relative; display: flex; justify-content: space-between; align-items: center; }
.tb-icon {
    width: 40px; height: 40px; border-radius: 13px;
    background: rgba(var(--c-rgb), .2);
    color: var(--c-text);
    display: grid; place-items: center; font-size: 1.1rem;
}
.tb-cap { font-size: .75rem; color: var(--muted); font-weight: 600; }
.tb-number { position: relative; font-size: 1.6rem; font-weight: 800; line-height: 1; margin-top: 14px; }
.tb-meta { position: relative; font-size: .75rem; color: var(--muted); min-height: 18px; margin-top: 4px; }
.tb-status {
    position: relative;
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 8px;
    padding: 4px 11px;
    border-radius: 20px;
    background: rgba(var(--c-rgb), .2);
    color: var(--c-text);
    font-size: .72rem; font-weight: 700;
}
.tb-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }

.st-available { --c: #22c55e; --c-rgb: 34, 197, 94; --c-text: #16a34a; }
.st-occupied  { --c: #f97316; --c-rgb: 249, 115, 22; --c-text: #ea580c; }
.st-kot_sent  { --c: #3b82f6; --c-rgb: 59, 130, 246; --c-text: #2563eb; }
.st-ready     { --c: #2b6741; --c-rgb: 134, 239, 172; --c-text: #1e5432; }
.st-billing   { --c: #8b5cf6; --c-rgb: 139, 92, 246; --c-text: #7c3aed; }
[data-bs-theme="dark"] .st-available { --c-text: #4ade80; }
[data-bs-theme="dark"] .st-occupied  { --c-text: #fb923c; }
[data-bs-theme="dark"] .st-kot_sent  { --c-text: #60a5fa; }
[data-bs-theme="dark"] .st-ready     { --c-text: #86efac; }
[data-bs-theme="dark"] .st-billing   { --c-text: #a78bfa; }

/* KOT list */
.kot-item {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 0;
    border-bottom: 1px dashed var(--border);
}
.kot-item:last-child { border-bottom: 0; padding-bottom: 0; }
.kot-no {
    width: 44px; height: 44px; border-radius: 14px;
    background: var(--primary-soft); color: var(--accent);
    border: 1px solid rgba(212, 175, 55, .35);
    display: grid; place-items: center;
    font-weight: 800; flex-shrink: 0;
}
.kot-info { flex: 1; min-width: 0; line-height: 1.3; }
.kot-info strong { display: block; font-size: .88rem; }
.kot-info small { color: var(--muted); font-size: .75rem; }
.pill {
    font-size: .7rem; font-weight: 700;
    padding: 4px 11px; border-radius: 20px; white-space: nowrap;
}
.pill-new { background: rgba(59, 130, 246, .15); color: #3b82f6; }
.pill-preparing { background: rgba(249, 115, 22, .15); color: #f97316; }
.pill-ready { background: rgba(34, 197, 94, .15); color: #22c55e; }
.pill-served { background: rgba(100, 116, 139, .15); color: #64748b; }

/* ==========================================================
   MOBILE BOTTOM NAVIGATION (app style)
   ========================================================== */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 1030;
    height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: flex; align-items: center; justify-content: space-around;
    background: var(--topbar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 28px rgba(22, 27, 69, .1);
}
.bn-item {
    position: relative;
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: 0;
    color: var(--muted);
    font-size: .68rem; font-weight: 700;
    padding: 8px 0;
    transition: color .2s;
}
.bn-item i { font-size: 1.3rem; transition: transform .2s; }
.bn-item.active { color: var(--accent); }
.bn-item.active i { transform: translateY(-2px); }
.bn-item.active::before {
    content: "";
    position: absolute; top: -1px; left: 50%;
    width: 28px; height: 3px; margin-left: -14px;
    border-radius: 0 0 4px 4px;
    background: var(--gold);
    box-shadow: 0 2px 10px rgba(212, 175, 55, .7);
}
.bn-fab {
    flex: 0 0 auto;
    width: 58px; height: 58px;
    margin: -32px 6px 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-light), var(--gold) 55%, var(--gold-dark));
    color: var(--navy-dark); font-size: 1.6rem;
    display: grid; place-items: center;
    border: 4px solid var(--bg);
    box-shadow: 0 10px 24px rgba(212, 175, 55, .55);
}
.bn-fab:active { transform: scale(.92); color: var(--navy-dark); }

/* ==========================================================
   RESPONSIVE
   ========================================================== */

/* Desktop: collapsible sidebar (icon rail) */
@media (min-width: 992px) {
    body.sidebar-collapsed .sidebar { width: var(--sidebar-w-mini); }
    body.sidebar-collapsed .main-area { margin-left: var(--sidebar-w-mini); }
    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .menu-text,
    body.sidebar-collapsed .menu-label,
    body.sidebar-collapsed .menu-badge,
    body.sidebar-collapsed .user-info,
    body.sidebar-collapsed .logout-btn { display: none; }
    body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
    body.sidebar-collapsed .menu-link { justify-content: center; padding: 12px; }
    body.sidebar-collapsed .sidebar-user { justify-content: center; margin: 12px 8px; padding: 10px 0; }
}

/* Tablet and below: sidebar becomes a drawer */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); width: 285px; }
    body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, .55); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .main-area { margin-left: 0; }
    .topbar { padding: 0 18px; }
    .content { padding: 18px; }
}

/* Mobile: native app look */
@media (max-width: 767.98px) {
    :root { --topbar-h: 60px; }

    body { font-size: .9rem; }

    .topbar {
        height: calc(var(--topbar-h) + env(safe-area-inset-top));
        padding: env(safe-area-inset-top) 14px 0;
        background: linear-gradient(135deg, var(--navy-dark), var(--navy));
        border-bottom: 1px solid rgba(212, 175, 55, .45);
        box-shadow: 0 8px 22px rgba(22, 27, 69, .3);
        backdrop-filter: none;
    }
    .topbar .icon-btn {
        background: rgba(255, 255, 255, .1);
        border-color: rgba(255, 255, 255, .12);
        color: #fff;
        width: 40px; height: 40px;
    }
    .notif-dot { border-color: var(--navy); }
    .notif-menu { width: calc(100vw - 28px); }

    .content {
        padding: 14px 14px calc(var(--bottom-h) + env(safe-area-inset-bottom) + 28px);
    }
    .app-footer { display: none; }

    .hero-card { border-radius: 20px; padding: 20px; }
    .hero-card h2 { font-size: 1.35rem; }
    .hero-card p { font-size: .82rem; margin-bottom: 14px; }

    .stat-card { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
    .stat-icon { width: 44px; height: 44px; font-size: 1.2rem; border-radius: 14px; }
    .stat-value { font-size: 1.35rem; }

    .card { border-radius: 18px; }
    .card-header { padding: 14px 16px; }
    .card-body { padding: 16px; }

    .tables-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .table-box { padding: 14px; border-radius: 18px; }
    .tb-number { font-size: 1.45rem; }

    /* Bigger touch targets in forms */
    .form-control, .form-select, .btn { min-height: 46px; }
    .dropdown-menu { border-radius: 16px; }
}

/* ==========================================================
   MASTER PAGES (lists, tables, modals)
   ========================================================== */
.min-w-0 { min-width: 0; }

.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    margin-bottom: 18px;
}
.page-sub { margin: 0; color: var(--muted); font-weight: 600; }

.mini-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-stat {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 30px;
    background: var(--surface); border: 1px solid var(--border);
    font-size: .8rem; font-weight: 600; color: var(--muted);
}
.mini-stat b { color: var(--text); font-size: .95rem; }
.mini-stat.on b { color: #16a34a; }
.mini-stat.off b { color: #ef4444; }

/* Search input with icon (reuses .input-icon) */
.input-icon { position: relative; }
.input-icon > i.lead-ic {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    color: var(--muted); pointer-events: none;
}

/* Tables */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-hover-bg: var(--primary-soft);
    --bs-table-hover-color: var(--text);
}
.data-table thead th {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted); font-weight: 700;
    background: var(--bg);
    padding: 14px 18px; white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.data-table tbody td { padding: 14px 18px; }
.data-table tbody tr:last-child td { border-bottom: 0; }

.cat-pill {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    background: rgba(212, 175, 55, .15); color: var(--gold-dark);
    font-size: .75rem; font-weight: 700;
}
[data-bs-theme="dark"] .cat-pill { color: var(--gold); }

.badge-soft {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px;
    font-size: .72rem; font-weight: 700;
}
.badge-soft::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-soft.on { background: rgba(34, 197, 94, .15); color: #16a34a; }
.badge-soft.off { background: rgba(239, 68, 68, .14); color: #ef4444; }

/* Gold switches */
.form-switch .form-check-input { width: 2.6em; height: 1.4em; cursor: pointer; }
.form-switch .form-check-input:checked { background-color: var(--gold); border-color: var(--gold); }
.form-switch .form-check-input:focus { box-shadow: 0 0 0 4px rgba(212, 175, 55, .2); border-color: var(--gold); }

/* Action buttons */
.row-actions { display: flex; align-items: center; gap: 6px; }
.action-btn {
    width: 36px; height: 36px; border-radius: 11px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); display: grid; place-items: center;
    transition: all .2s; cursor: pointer;
}
.action-btn:hover { background: var(--primary-soft); border-color: var(--gold); color: var(--gold-dark); }
.action-btn.danger:hover { background: rgba(239, 68, 68, .12); border-color: #ef4444; color: #ef4444; }

/* List rows (categories) */
.list-row {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--primary-soft); }
.row-icon {
    width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
    display: grid; place-items: center; font-size: 1.15rem;
    background: rgba(212, 175, 55, .15); color: var(--gold-dark);
    border: 1px solid rgba(212, 175, 55, .35);
}
[data-bs-theme="dark"] .row-icon { color: var(--gold); }

/* Mobile product cards */
.p-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 18px; margin-bottom: 12px;
    box-shadow: var(--shadow-sm); overflow: hidden;
}
.p-card-main { display: flex; align-items: center; gap: 12px; padding: 14px; }
.p-price { font-weight: 800; font-size: 1rem; }
.p-card-actions {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-top: 1px dashed var(--border);
    background: var(--bg);
}

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state i { font-size: 1rem; color: var(--accent); opacity: .8; }
.empty-state h6 { font-weight: 800; margin: 12px 0 4px; }
.empty-state p { color: var(--muted); margin-bottom: 18px; }

/* Modals */
.modal-content {
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: 22px;
    box-shadow: var(--shadow-md);
}
.modal-header, .modal-footer { border-color: var(--border); padding: 18px 22px; }
.modal-body { padding: 22px; }
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; }
.modal-backdrop.show { opacity: .6; }
[data-bs-theme="dark"] .btn-close { filter: invert(1); }
.btn-light { background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.btn-light:hover { background: var(--primary-soft); color: var(--text); }
.input-group-text { background: var(--bg); border-color: var(--border); color: var(--muted); font-weight: 700; }
.input-group > .form-control { border-radius: 0 12px 12px 0; }
.input-group > .input-group-text:first-child { border-radius: 12px 0 0 12px; }
.input-group > .form-control:not(:last-child) { border-radius: 12px 0 0 12px; }
.input-group > .input-group-text:last-child { border-radius: 0 12px 12px 0; }

.field-error { color: #ef4444; font-size: .78rem; font-weight: 600; margin-top: 6px; }
.form-control.is-invalid, .form-select.is-invalid { border-color: #ef4444; background-image: none; }

.price-preview {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-radius: 14px;
    background: rgba(212, 175, 55, .12); border: 1px dashed rgba(212, 175, 55, .6);
    font-weight: 600;
}
.price-preview strong { font-size: 1.15rem; color: var(--gold-dark); }
[data-bs-theme="dark"] .price-preview strong { color: var(--gold); }

.del-icon {
    width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px;
    background: rgba(239, 68, 68, .14); color: #ef4444;
    display: grid; place-items: center; font-size: 1.6rem;
}

/* Toast position (below the topbar) */
.flash-container { z-index: 1100; margin-top: calc(var(--topbar-h) + env(safe-area-inset-top)); }

/* Pagination */
.pagination { margin: 0; gap: 4px; flex-wrap: wrap; justify-content: center; }
.page-link {
    border-radius: 10px !important; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-weight: 600;
}
.page-link:hover { background: var(--primary-soft); color: var(--text); }
.page-item.active .page-link { background: var(--navy); border-color: var(--navy); color: #fff; }
[data-bs-theme="dark"] .page-item.active .page-link { background: var(--gold); border-color: var(--gold); color: var(--navy-dark); }
.page-item.disabled .page-link { background: var(--bg); color: var(--muted); }

/* Phone: modals become bottom sheets (app style) */
@media (max-width: 575.98px) {
    .modal-dialog.sheet {
        position: fixed; left: 0; right: 0; bottom: 0;
        margin: 0; max-width: none; width: 100%;
        min-height: 0; display: block;
    }
    .modal.fade .modal-dialog.sheet { transform: translateY(100%); transition: transform .3s ease; }
    .modal.show .modal-dialog.sheet { transform: none; }
    .modal-dialog.sheet .modal-content {
        border-radius: 26px 26px 0 0; border-bottom: 0;
        max-height: 92vh; overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .modal-dialog.sheet .modal-content::before {
        content: ""; display: block; width: 44px; height: 5px;
        border-radius: 5px; background: var(--border); margin: 10px auto 0;
    }
    .list-row { padding: 12px 14px; }
}
/* ==========================================================
   TABLES MASTER
   ========================================================== */
.tm-foot {
    position: relative;
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 12px; padding-top: 10px;
    border-top: 1px dashed rgba(var(--c-rgb), .45);
}
.tm-foot .form-switch .form-check-input { margin: 0; }
.tm-foot .form-check-input:disabled { opacity: .45; cursor: not-allowed; }

.action-btn.sm { width: 32px; height: 32px; border-radius: 10px; font-size: .85rem; }

.table-box.tm-off { opacity: .55; filter: grayscale(.7); }
.table-box.tm-off:hover { transform: none; box-shadow: none; }

/* capacity stepper */
.stepper { display: flex; gap: 8px; }
.stepper .form-control { text-align: center; font-weight: 800; font-size: 1.15rem; }
.btn-step {
    width: 52px; flex-shrink: 0;
    display: grid; place-items: center;
    font-size: 1.1rem; border-radius: 12px;
}
.stepper input[type=number]::-webkit-outer-spin-button,
.stepper input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input[type=number] { -moz-appearance: textfield; }

.lock-hint {
    margin-top: 10px; padding: 10px 14px; border-radius: 12px;
    background: rgba(249, 115, 22, .12); color: #ea580c;
    font-size: .8rem; font-weight: 600;
}

/* ==========================================================
   LIVE DASHBOARD
   ========================================================== */
.live-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 20px;
    background: rgba(34, 197, 94, .14); color: #16a34a;
    font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.live-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #22c55e; animation: livePulse 1.6s infinite;
}
@keyframes livePulse {
    0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); }
    70%  { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tb-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kot-no { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }

@media (max-width: 575.98px) {
    #liveStamp { display: none; }
}

/* ==========================================================
   BILLING / POS
   ========================================================== */
[hidden] { display: none !important; }

.pos-table-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 14px;
    background: rgba(var(--c-rgb, 34, 197, 94), .14);
    border: 1px solid rgba(var(--c-rgb, 34, 197, 94), .4);
    color: var(--c-text, #16a34a);
    font-weight: 800;
}
.page-head .tb-status { margin-top: 0; }

.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 20px;
    align-items: start;
}

/* ----- menu ----- */
.prod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
    padding-top: 6px;
}
.prod-card {
    position: relative;
    display: flex; flex-direction: column; gap: 4px;
    min-height: 108px; padding: 14px;
    text-align: left;
    border-radius: 16px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    transition: transform .15s, border-color .15s, box-shadow .15s;
}
.prod-card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.prod-card:active { transform: scale(.96); }
.prod-card.in-cart { border-color: var(--gold); background: rgba(212, 175, 55, .09); }
.pc-name { font-weight: 800; font-size: .9rem; line-height: 1.25; }
.pc-cat { font-size: .7rem; color: var(--muted); font-weight: 600; }
.pc-foot { margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; }
.pc-foot b { font-size: .95rem; }
.pc-add {
    width: 30px; height: 30px; border-radius: 10px;
    display: grid; place-items: center; font-size: .85rem;
    background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
    color: var(--navy-dark);
}
.pc-qty {
    position: absolute; top: -8px; right: -6px;
    min-width: 26px; height: 26px; padding: 0 7px;
    border-radius: 13px; display: grid; place-items: center;
    background: var(--navy); color: #fff;
    font-size: .75rem; font-weight: 800;
    border: 2px solid var(--surface);
}
[data-bs-theme="dark"] .pc-qty { background: var(--gold); color: var(--navy-dark); }

/* ----- order panel ----- */
.pos-cart {
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
    max-height: calc(100vh - var(--topbar-h) - 32px);
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.cart-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.cart-head strong { display: block; font-family: var(--font-display); font-size: 1.15rem; }
.cart-head small { color: var(--muted); font-weight: 600; }
.cart-scroll { flex: 1; overflow-y: auto; padding: 16px; }
.cart-foot { padding: 16px; border-top: 1px solid var(--border); background: var(--bg); }

.cart-empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.cart-empty i { font-size: 2.2rem; color: var(--gold); }
.cart-empty p { margin: 8px 0 0; font-size: .85rem; }

.cart-alert {
    padding: 10px 14px; margin-bottom: 12px; border-radius: 12px;
    background: rgba(239, 68, 68, .12); color: #ef4444;
    font-size: .83rem; font-weight: 700;
}

.ex-items {
    border: 1px dashed var(--border); border-radius: 14px;
    padding: 10px 12px; margin-bottom: 14px; background: var(--bg);
}
.ex-items summary {
    cursor: pointer; list-style: none;
    display: flex; justify-content: space-between; gap: 8px;
    font-weight: 700; font-size: .84rem;
}
.ex-items summary::-webkit-details-marker { display: none; }
.ex-line { display: flex; justify-content: space-between; gap: 8px; padding-top: 7px; font-size: .8rem; color: var(--muted); }

.cl {
    padding: 12px; margin-bottom: 10px;
    border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
}
.cl-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.cl-name { font-weight: 700; font-size: .88rem; min-width: 0; }
.cl-name small { display: block; color: var(--muted); font-size: .72rem; font-weight: 500; }
.cl-del, .cl-note-btn {
    width: 32px; height: 32px; flex-shrink: 0;
    border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg); color: var(--muted);
    display: grid; place-items: center;
}
.cl-del:hover { color: #ef4444; border-color: #ef4444; }
.cl-note-btn:hover { color: var(--gold-dark); border-color: var(--gold); }
.cl-bot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.cl-total { margin-left: auto; }
.cl-note { margin-top: 8px; border-radius: 10px; font-size: .82rem; }

.qty-ctl {
    display: inline-flex; align-items: center;
    border: 1px solid var(--border); border-radius: 11px;
    background: var(--bg); overflow: hidden;
}
.qty-ctl button {
    width: 36px; height: 34px; border: 0; background: none;
    color: var(--text); display: grid; place-items: center; font-size: 1.1rem;
}
.qty-ctl button:active { background: var(--primary-soft); }
.qty-ctl span { min-width: 30px; text-align: center; font-weight: 800; }

.disc-type { max-width: 84px; }

.tot-row {
    display: flex; justify-content: space-between;
    padding: 3px 0; font-size: .87rem; color: var(--muted); font-weight: 600;
}
.tot-row b { color: var(--text); }
.tot-grand {
    display: flex; justify-content: space-between; align-items: center;
    margin: 8px 0 12px; padding: 12px 14px; border-radius: 14px;
    background: linear-gradient(135deg, var(--navy-dark), var(--navy));
    color: #fff; font-weight: 700;
}
.tot-grand strong { font-size: 1.4rem; color: var(--gold-light); }
.btn-send { height: 52px; font-size: 1rem; }
.btn-send:disabled { opacity: .55; box-shadow: none; filter: grayscale(.3); }

/* ----- floating order bar + sheet (tablet and phone) ----- */
.cart-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(8, 10, 34, .6); backdrop-filter: blur(2px);
    z-index: 1055;
}
.cart-backdrop.show { display: block; }

.cart-fab {
    position: fixed; left: 14px; right: 14px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 1040;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 18px;
    border: 1px solid rgba(212, 175, 55, .55);
    border-radius: 18px;
    background: linear-gradient(135deg, var(--navy-dark), var(--navy));
    color: #fff; font-weight: 700; font-size: .88rem;
    box-shadow: 0 12px 30px rgba(22, 27, 69, .45);
}
.cart-fab strong { color: var(--gold-light); font-size: 1.05rem; }
.cart-fab .fab-link { color: var(--gold); font-size: .78rem; }

@media (max-width: 991.98px) {
    .pos-layout { grid-template-columns: 1fr; }
    .pos-menu { padding-bottom: 76px; }

    .pos-cart {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto;
        max-height: 90vh;
        border-radius: 26px 26px 0 0; border-bottom: 0;
        z-index: 1060;
        transform: translateY(105%);
        transition: transform .3s ease;
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -14px 40px rgba(0, 0, 0, .3);
    }
    .pos-cart.open { transform: none; }
    .pos-cart::before {
        content: ""; display: block; width: 44px; height: 5px;
        border-radius: 5px; background: var(--border); margin: 10px auto 0;
    }
}

@media (max-width: 767.98px) {
    .cart-fab { bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 12px); }
    .cart-fab .fab-link { display: none; }
    .prod-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .prod-card { min-height: 100px; padding: 12px; border-radius: 14px; }
    .pos-cart .form-control, .pos-cart .form-select,
    #prodSearch { font-size: 16px; }   /* stops iPhone zoom on focus */
}

/* ==========================================================
   KOT BOARD + HISTORY
   ========================================================== */
.ks-new       { --c: #3b82f6; }
.ks-preparing { --c: #f97316; }
.ks-ready     { --c: #22c55e; }

.kot-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 16px;
    align-items: start;
}

.kot-card, .kc-new, .kc-preparing, .kc-ready { --kc: #3b82f6; --kc-rgb: 59, 130, 246; }
.kc-preparing { --kc: #f97316; --kc-rgb: 249, 115, 22; }
.kc-ready     { --kc: #22c55e; --kc-rgb: 34, 197, 94; }
.kc-served    { --kc: #64748b; --kc-rgb: 100, 116, 139; }

.kot-card {
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 4px solid var(--kc);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.kc-head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(var(--kc-rgb), .12), transparent);
}
.kc-table {
    width: 56px; height: 56px; flex-shrink: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--navy), var(--navy-dark));
    border: 1px solid rgba(212, 175, 55, .45);
    color: #fff; text-align: center; line-height: 1;
    display: grid; place-content: center; gap: 3px;
}
.kc-table small { font-size: .56rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); font-weight: 700; }
.kc-table b { font-size: 1.15rem; font-weight: 800; }
.kc-meta { flex: 1; min-width: 0; line-height: 1.3; }
.kc-meta strong { display: block; font-size: 1rem; }
.kc-meta small { color: var(--muted); font-size: .74rem; }

.kc-time {
    flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 11px; border-radius: 20px;
    background: rgba(var(--kc-rgb), .14); color: var(--kc);
    font-size: .76rem; font-weight: 800;
}
.kc-time.late { background: rgba(239, 68, 68, .15); color: #ef4444; animation: lateBlink 1.6s infinite; }
@keyframes lateBlink { 50% { opacity: .55; } }

.kc-items { list-style: none; margin: 0; padding: 6px 16px 4px; }
.kc-items li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.kc-items li:last-child { border-bottom: 0; }
.kc-qty {
    min-width: 40px; height: 30px; padding: 0 6px; flex-shrink: 0;
    border-radius: 9px; display: grid; place-items: center;
    background: rgba(var(--kc-rgb), .14); color: var(--kc);
    font-size: .85rem; font-weight: 800;
}
.kc-items b { font-size: .93rem; line-height: 1.3; }
.kc-items em {
    display: block; margin-top: 2px;
    font-style: normal; font-size: .78rem; font-weight: 600;
    color: var(--gold-dark);
}
[data-bs-theme="dark"] .kc-items em { color: var(--gold); }

.kc-note {
    margin: 4px 16px 0; padding: 10px 12px; border-radius: 12px;
    background: rgba(212, 175, 55, .12); border: 1px dashed rgba(212, 175, 55, .65);
    font-size: .82rem; font-weight: 600;
}
.kc-note i { color: var(--gold-dark); margin-right: 4px; }

.kc-foot { display: flex; gap: 8px; padding: 14px 16px 16px; margin-top: auto; }
.kc-back {
    width: 48px; height: 48px; flex-shrink: 0;
    border-radius: 12px; border: 1px solid var(--border);
    background: var(--bg); color: var(--muted);
    display: grid; place-items: center; font-size: 1.1rem;
}
.kc-back:hover { color: var(--text); border-color: var(--gold); }
.kc-action {
    flex: 1; height: 48px; border: 0; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    color: #fff; font-weight: 800; font-size: .95rem;
    transition: transform .15s, filter .15s;
}
.kc-action:hover { filter: brightness(1.08); }
.kc-action:active { transform: scale(.97); }
.kc-action:disabled, .kc-back:disabled { opacity: .55; pointer-events: none; }
.kc-action.to-preparing { background: linear-gradient(135deg, #fb923c, #f97316); box-shadow: 0 8px 18px rgba(249, 115, 22, .3); }
.kc-action.to-ready     { background: linear-gradient(135deg, #4ade80, #16a34a); box-shadow: 0 8px 18px rgba(34, 197, 94, .3); }
.kc-action.to-served    { background: linear-gradient(135deg, var(--navy), var(--navy-dark)); border: 1px solid rgba(212, 175, 55, .55); }

/* small toast used by the kitchen board */
.toast-lite {
    position: fixed; left: 50%; z-index: 2000;
    top: calc(var(--topbar-h) + env(safe-area-inset-top) + 10px);
    transform: translate(-50%, -14px); opacity: 0;
    display: inline-flex; align-items: center; gap: 10px;
    max-width: calc(100vw - 28px);
    padding: 12px 18px; border-radius: 14px;
    color: #fff; font-weight: 700; font-size: .88rem;
    box-shadow: var(--shadow-md);
    transition: opacity .25s, transform .25s;
}
.toast-lite.show { opacity: 1; transform: translate(-50%, 0); }
.toast-lite.ok  { background: #16a34a; }
.toast-lite.err { background: #ef4444; }

/* history */
.hist-row { cursor: pointer; }
.hist-row .bi-chevron-down { transition: transform .2s; }
.hist-row[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }
.hist-detail { padding: 6px 20px 18px; background: var(--bg); border-bottom: 1px solid var(--border); }
.hist-detail .kc-items { padding: 4px 0; }
.hist-times {
    display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px;
    font-size: .78rem; color: var(--muted); font-weight: 600;
}
.hist-times i { color: var(--gold-dark); margin-right: 4px; }
.hist-item:last-child .hist-detail { border-bottom: 0; }

@media (max-width: 575.98px) {
    .kot-board { grid-template-columns: 1fr; gap: 14px; }
    .hist-detail { padding: 6px 14px 16px; }
}

/* ==========================================================
   FINAL BILL + PAYMENT
   ========================================================== */
.badge-soft.mid { background: rgba(249, 115, 22, .15); color: #f97316; }
.row-icon.sm { width: 38px; height: 38px; border-radius: 12px; font-size: 1rem; }
a.list-row { text-decoration: none; }

.bill-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 20px;
    align-items: start;
}

/* ----- receipt (always paper-white, also in dark mode) ----- */
.receipt-wrap { display: flex; justify-content: center; }
.receipt {
    position: relative; width: 100%; max-width: 460px;
    padding: 28px 26px 24px;
    background: #fff; color: #1b1f3a;
    border-radius: 8px; border-top: 6px solid var(--gold);
    box-shadow: var(--shadow-md);
}
.rc-head { text-align: center; padding-bottom: 14px; border-bottom: 2px dashed #cfd2e4; }
.rc-logo {
    width: 48px; height: 48px; margin: 0 auto 8px; border-radius: 14px;
    display: grid; place-items: center; font-size: 1.35rem;
    background: linear-gradient(135deg, var(--navy), var(--navy-dark)); color: var(--gold);
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.rc-head h3 { margin: 0; font-family: var(--font-display); font-size: 1.4rem; }
.rc-head p {
    margin: 3px 0 0; font-size: .7rem; font-weight: 700;
    letter-spacing: .16em; text-transform: uppercase; color: #7a809f;
}
.rc-info {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
    padding: 14px 0; border-bottom: 2px dashed #cfd2e4;
}
.rc-info small {
    display: block; font-size: .64rem; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; color: #7a809f;
}
.rc-info b { font-size: .86rem; }

.rc-table { width: 100%; margin: 6px 0; border-collapse: collapse; }
.rc-table th {
    padding: 8px 0; text-align: right; font-size: .64rem; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; color: #7a809f;
    border-bottom: 1px solid #e6e8f2;
}
.rc-table td {
    padding: 9px 0; text-align: right; vertical-align: top;
    font-size: .86rem; border-bottom: 1px dotted #e3e5ef;
}
.rc-table th:first-child, .rc-table td:first-child { text-align: left; padding-right: 8px; }
.rc-table td small { display: block; font-size: .7rem; color: #7a809f; }

.rc-totals { margin-top: 6px; padding-top: 10px; border-top: 2px dashed #cfd2e4; }
.rc-row {
    display: flex; justify-content: space-between; gap: 10px;
    padding: 3px 0; font-size: .88rem; font-weight: 600; color: #4b5173;
}
.rc-row.grand {
    margin: 8px 0; padding: 11px 14px; border-radius: 10px;
    background: var(--navy); color: #fff; font-size: 1rem; font-weight: 800;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.rc-row.grand span:last-child { color: var(--gold-light); font-size: 1.2rem; }
.rc-row.paid { color: #16a34a; }
.rc-row.due { color: #ef4444; font-weight: 800; }
.rc-foot {
    margin-top: 18px; padding-top: 12px; text-align: center;
    border-top: 2px dashed #cfd2e4;
    font-size: .78rem; font-weight: 600; color: #7a809f;
}
.rc-stamp {
    position: absolute; top: 22px; right: 16px;
    padding: 3px 12px; border: 3px solid; border-radius: 10px;
    font-size: .85rem; font-weight: 900; letter-spacing: .12em;
    transform: rotate(10deg); opacity: .85;
}
.rc-stamp.paid { color: #16a34a; }
.rc-stamp.partial { color: #f97316; }
.rc-stamp.unpaid { color: #ef4444; }

/* ----- payment panel ----- */
.pay-panel { position: sticky; top: calc(var(--topbar-h) + 16px); }
.pay-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pay-tile { padding: 10px 8px; border-radius: 14px; background: var(--bg); text-align: center; min-width: 0; }
.pay-tile small { display: block; font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pay-tile b { display: block; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; }
.pay-tile.ok b { color: #16a34a; }
.pay-tile.due b { color: #ef4444; }

.method-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.method-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 12px 4px; cursor: pointer;
    border: 1.5px solid var(--border); border-radius: 14px;
    background: var(--surface); color: var(--text);
    font-size: .74rem; font-weight: 700;
    transition: all .15s;
}
.method-btn i { font-size: 1.3rem; }
.method-btn:hover { border-color: var(--gold); }
.btn-check:checked + .method-btn {
    border-color: var(--gold); background: rgba(212, 175, 55, .13); color: var(--gold-dark);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, .2);
}
[data-bs-theme="dark"] .btn-check:checked + .method-btn { color: var(--gold); }
.btn-check:focus-visible + .method-btn { outline: 2px solid var(--gold); outline-offset: 2px; }

.amt-input { font-weight: 800; font-size: 1.1rem; }
.change-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 10px; padding: 10px 14px; border-radius: 12px;
    background: rgba(34, 197, 94, .12); color: #16a34a; font-weight: 700;
}
.change-row strong { font-size: 1.1rem; }

.pay-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.pay-row:last-child { border-bottom: 0; }

.done-icon {
    width: 70px; height: 70px; margin: 0 auto 14px; border-radius: 50%;
    display: grid; place-items: center; font-size: 2rem;
    background: rgba(34, 197, 94, .15); color: #16a34a;
}

@media (max-width: 991.98px) {
    .bill-layout { grid-template-columns: 1fr; }
    .pay-panel { position: static; }
}
@media (max-width: 575.98px) {
    .receipt { padding: 22px 16px 20px; }
    .pay-panel .form-control, .pay-panel .form-select { font-size: 16px; }
    .method-btn { padding: 10px 2px; }
}

/* ----- printing: only the receipt ----- */
@media print {
    @page { margin: 8mm; }
    body { background: #fff !important; }
    .sidebar, .sidebar-backdrop, .topbar, .bottom-nav, .app-footer,
    .page-head, .no-print, .toast-container, .toast-lite { display: none !important; }
    .main-area { margin: 0 !important; }
    .content { padding: 0 !important; }
    .bill-layout { display: block; }
    .receipt-wrap { display: block; }
    .receipt { max-width: 100%; border-radius: 0; box-shadow: none; border-top: 0; }
}

/* ==========================================================
   CREATE ORDER v2 (mobile fix + half/full) and BILL fixes
   ========================================================== */
[hidden] { display: none !important; }

/* Root cause of the broken mobile page: grid tracks must be allowed to shrink */
.pos-layout, .bill-layout { grid-template-columns: minmax(0, 1fr) 400px; }
.pos-menu, .receipt-wrap, .pay-panel, .content { min-width: 0; }

@media (max-width: 991.98px) {
    .pos-layout, .bill-layout { grid-template-columns: minmax(0, 1fr); }
}

/* Request Bill button */
.rb-form { margin-left: auto; }

/* Search + categories stay visible while scrolling the menu */
.pos-menu .card-body { padding: 0 16px 16px; }
.menu-tools {
    position: sticky;
    top: calc(var(--topbar-h) + env(safe-area-inset-top));
    z-index: 6;
    margin: 0 -16px 12px;
    padding: 16px 16px 6px;
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
}
.menu-tools .chip-row { padding-bottom: 6px; }

/* Product card with Half / Full buttons */
.prod-card {
    position: relative;
    display: flex; flex-direction: column; gap: 10px;
    min-height: 0; padding: 14px;
    border-radius: 16px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-align: left;
    cursor: default;
}
.prod-card:active { transform: none; }
.pc-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pc-name { font-weight: 800; font-size: .92rem; line-height: 1.25; overflow-wrap: anywhere; }
.pc-cat { font-size: .7rem; color: var(--muted); font-weight: 600; }
.pc-opts { display: flex; gap: 8px; margin-top: auto; }

.pc-opt {
    position: relative;
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    min-height: 52px; padding: 6px 8px;
    border-radius: 12px;
    border: 1.5px solid rgba(212, 175, 55, .55);
    background: rgba(212, 175, 55, .1);
    color: var(--text);
    transition: background .15s, transform .1s;
}
.pc-opt small {
    font-size: .62rem; font-weight: 800; letter-spacing: .08em;
    text-transform: uppercase; color: var(--gold-dark);
}
[data-bs-theme="dark"] .pc-opt small { color: var(--gold); }
.pc-opt b { font-size: .92rem; }
.pc-opt:hover { background: rgba(212, 175, 55, .22); }
.pc-opt:active { transform: scale(.95); }
.pc-opt.in-cart {
    background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
    border-color: var(--gold-dark);
    color: var(--navy-dark);
}
.pc-opt.in-cart small { color: var(--navy-dark); }

/* Phone: the menu becomes a compact list */
@media (max-width: 767.98px) {
    .pos-menu .card-body { padding: 0 12px 12px; }
    .menu-tools { margin: 0 -12px 10px; padding: 12px 12px 4px; }

    .prod-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .prod-card {
        flex-direction: row; align-items: center; justify-content: space-between;
        gap: 12px; padding: 12px 14px; border-radius: 14px;
    }
    .pc-info { flex: 1; }
    .pc-opts { flex: 0 0 auto; margin-top: 0; }
    .pc-opt { flex: 0 0 auto; min-width: 82px; min-height: 54px; }

    /* products with Half + Full: name on top, two big buttons below */
    .prod-card.has-half { flex-direction: column; align-items: stretch; gap: 10px; }
    .prod-card.has-half .pc-opts { width: 100%; }
    .prod-card.has-half .pc-opt { flex: 1; }

    .page-head .rb-form { width: 100%; margin-left: 0; }
    .page-head .rb-form .btn { width: 100%; }

    .pos-menu { padding-bottom: 84px; }
}

/* Order sheet on phones */
@media (max-width: 991.98px) {
    .pos-cart { max-height: 90vh; max-height: 90dvh; }
    .cart-scroll { overscroll-behavior: contain; }
}
/* KOT board: cards never wider than the screen */
.kot-board { grid-template-columns: repeat(auto-fill, minmax(min(310px, 100%), 1fr)); }
.kc-meta, .kc-items li > div { min-width: 0; overflow-wrap: anywhere; }
.kc-head { flex-wrap: nowrap; }

/* Add-items panel on the bill page */
.add-panel { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.method-btn b { font-size: .9rem; }
#addPanel .method-btn { padding: 12px 8px; }
#addPanel .method-btn i { font-size: 1.3rem; }

/* Add-items popup */
#addModal .method-btn { padding: 12px 8px; }
#addModal .method-btn i { font-size: 1.3rem; }
@media (max-width: 767.98px) {
    #addModal .form-control, #addModal .form-select { font-size: 16px; }
}
/* Clickable dashboard cards */
a.stat-link {
    position: relative;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
a.stat-link:hover {
    color: var(--text);
    transform: translateY(-3px);
    border-color: var(--gold);
    box-shadow: var(--shadow-md);
}
a.stat-link:active { transform: scale(.97); }
a.stat-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.stat-arrow {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: .85rem;
    color: var(--muted);
    opacity: .55;
    transition: opacity .18s, transform .18s, color .18s;
}
a.stat-link:hover .stat-arrow {
    opacity: 1;
    color: var(--gold-dark);
    transform: translate(2px, -2px);
}
[data-bs-theme="dark"] a.stat-link:hover .stat-arrow { color: var(--gold); }

.form-check-label{
    margin-left: 10px !important;
}

/* ==========================================================
   EXPENSES
   ========================================================== */
.badge-soft.cash   { background: rgba(34, 197, 94, .15);  color: #16a34a; }
.badge-soft.online { background: rgba(59, 130, 246, .15); color: #3b82f6; }

.exp-cat-row {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 0; border-bottom: 1px dashed var(--border);
}
.exp-cat-row:last-child { border-bottom: 0; }
.exp-cat-name { width: 130px; flex-shrink: 0; font-weight: 700; font-size: .86rem; }
.exp-bar { flex: 1; height: 9px; border-radius: 9px; background: var(--bg); overflow: hidden; }
.exp-bar span {
    display: block; height: 100%; border-radius: 9px;
    background: linear-gradient(90deg, var(--gold-light), var(--gold-dark));
}
.exp-cat-amt { width: 112px; flex-shrink: 0; text-align: right; font-weight: 800; font-size: .86rem; }

@media (max-width: 575.98px) {
    .exp-cat-name { width: 92px; }
    .exp-cat-amt  { width: 92px; }
    #expenseModal .form-control, #expenseModal .form-select { font-size: 16px; }   /* no iPhone zoom */
}