:root {
    --sidebar-width: 250px;
    --topbar-height: 60px;
    --primary: #6f42c1;
    --primary-dark: #5533a0;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --bg-light: #f4f6f9;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-light);
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #2d1b69 0%, #1a0f3c 100%);
    color: #fff;
    z-index: 1000;
    transition: transform 0.3s;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px;
    font-size: 1.4rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-nav {
    padding: 10px 0;
    list-style: none;
}

.sidebar-nav .nav-item {
    padding: 0;
}

.sidebar-nav .nav-link {
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-left-color: #fff;
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar-section {
    padding: 8px 20px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    margin-top: 10px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.page-content {
    padding: 24px;
}

/* ===== CARDS ===== */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.85rem;
}

/* ===== GAME PAGE ===== */
.game-page {
    background: linear-gradient(135deg, #2d1b69 0%, #1a0f3c 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.game-container {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* ===== GAME BOARD ===== */
.memory-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.memory-card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #6f42c1, #5533a0);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.memory-card.flipped {
    background: #fff;
    border: 2px solid #6f42c1;
    color: #6f42c1;
    transform: rotateY(180deg);
}

.memory-card.matched {
    background: #28a745;
    border-color: #28a745;
    color: #fff;
    cursor: default;
    opacity: 0.7;
}

.memory-card:not(.flipped):not(.matched):hover {
    transform: scale(1.05);
}

/* ===== DISCOUNT RESULT ===== */
.discount-display {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary);
}

.discount-badge {
    display: inline-block;
    padding: 20px 40px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: #fff;
    border-radius: 20px;
    font-size: 3rem;
    font-weight: 800;
}

/* ===== TABLES ===== */
.table-container {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
}

/* ===== ALERTS ===== */
.alert-subscription {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

/* ===== BOTTOM NAV BAR ===== */
.nav-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    border-top: 1px solid #e9ecef;
    z-index: 1030;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.nav-bar-inner {
    display: flex;
    height: 100%;
    align-items: stretch;
}
.nav-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #6c757d;
    font-size: 0.6rem;
    font-weight: 500;
    gap: 2px;
    padding: 2px 0;
    transition: color 0.15s;
    border: none;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.nav-bar-item i {
    font-size: 1.2rem;
    line-height: 1;
}
.nav-bar-item.active {
    color: var(--primary);
}
.nav-bar-item:active {
    opacity: 0.6;
}

/* ===== SIDE DRAWER ===== */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.2s;
}
.drawer-overlay.open {
    display: block;
    opacity: 1;
}
.drawer-panel {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: linear-gradient(180deg, #2d1b69 0%, #1a0f3c 100%);
    color: #fff;
    z-index: 1041;
    transition: right 0.25s ease;
    overflow-y: auto;
}
.drawer-panel.open {
    right: 0;
}
.drawer-header {
    padding: 20px 20px 12px;
    font-size: 1.3rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}
.drawer-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 1.4rem;
    cursor: pointer;
}
.drawer-nav {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}
.drawer-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.15s;
    min-height: 48px;
}
.drawer-nav li a:active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.drawer-section {
    padding: 8px 20px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.35);
    margin-top: 8px;
}

/* ===== CARD LIST (replaces tables on mobile) ===== */
.card-list-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    min-height: 52px;
    gap: 12px;
    transition: background 0.15s;
}
.card-list-item:active {
    background: #f8f4ff;
}
.card-list-item:last-child {
    border-bottom: none;
}
.card-list-item .cl-main {
    flex: 1;
    min-width: 0;
}
.card-list-item .cl-title {
    font-weight: 600;
    font-size: 0.95rem;
}
.card-list-item .cl-sub {
    font-size: 0.8rem;
    color: #6c757d;
}
.card-list-item .cl-end {
    text-align: right;
    flex-shrink: 0;
}
.card-list-item .cl-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===== MENU CARDS (Customer) ===== */
.menu-category { padding:0; overflow:hidden; }
.menu-category-header { display:flex; align-items:center; gap:10px; padding:16px 16px 0; }
.menu-category-emoji { font-size:1.5rem; }
.menu-category-title { font-weight:700; font-size:1.05rem; margin:0; flex:1; color:#333; }
.menu-category-count { font-size:0.7rem; color:#999; background:#f0e8d8; padding:2px 10px; border-radius:20px; font-weight:600; }
.menu-item { display:flex; align-items:center; gap:12px; padding:12px 16px; border-bottom:1px solid #f5f0e8; position:relative; min-height:80px; animation:menuFadeIn 0.3s ease both; }
.menu-item:last-child { border-bottom:none; }
.menu-item:active { background:#fdf8f0; }
.menu-item-img { width:68px; height:68px; border-radius:12px; overflow:hidden; flex-shrink:0; }
.menu-item-img img { width:100%; height:100%; object-fit:cover; display:block; }
.menu-item-placeholder { width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size:1.6rem; background:linear-gradient(135deg,#f0e8d8,#e8dcc8); color:#b8a888; border-radius:12px; }
.menu-item-body { flex:1; min-width:0; }
.menu-item-top { display:flex; align-items:center; gap:6px; }
.menu-item-name { font-weight:600; font-size:0.95rem; color:#333; }
.menu-item-veg { font-size:0.5rem; color:#28a745; line-height:1; }
.menu-item-veg::before { content:'● '; }
.menu-item-desc { font-size:0.78rem; color:#888; margin-top:2px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; line-height:1.4; }
.menu-item-end { text-align:right; flex-shrink:0; }
.menu-item-price { font-weight:700; font-size:1rem; color:var(--cust-primary); }
.menu-item-pts { font-size:0.65rem; color:#999; margin-top:1px; }
.menu-item-soldout { position:absolute; top:8px; left:-24px; background:#dc3545; color:#fff; font-size:0.6rem; font-weight:700; padding:2px 28px; transform:rotate(-45deg); text-transform:uppercase; letter-spacing:0.5px; box-shadow:0 2px 4px rgba(0,0,0,0.15); }
@keyframes menuFadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.menu-item:nth-child(2) { animation-delay:0.05s; }
.menu-item:nth-child(3) { animation-delay:0.1s; }
.menu-item:nth-child(4) { animation-delay:0.15s; }
.menu-item:nth-child(5) { animation-delay:0.2s; }
.menu-item:nth-child(6) { animation-delay:0.25s; }
.menu-item:nth-child(7) { animation-delay:0.3s; }
.menu-item:nth-child(8) { animation-delay:0.35s; }
.menu-item:nth-child(9) { animation-delay:0.4s; }
.menu-item:nth-child(10) { animation-delay:0.45s; }

/* ===== TOUCH SIZING ===== */
.touch {
    min-height: 44px;
}
.touch-lg {
    min-height: 52px;
}
.touch-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

/* ===== STEP ACCORDION ===== */
.step-panel {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
    background: #fff;
}
.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
    background: #fff;
    transition: background 0.15s;
}
.step-header:active {
    background: #f8f4ff;
}
.step-header .step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.step-header .step-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}
.step-header .step-arrow {
    margin-left: auto;
    transition: transform 0.2s;
    font-size: 0.8rem;
    color: #6c757d;
}
.step-panel.open .step-arrow {
    transform: rotate(180deg);
}
.step-body {
    display: none;
    padding: 0 16px 16px;
    border-top: 1px solid #f0f0f0;
}
.step-panel.open .step-body {
    display: block;
}

/* ===== QUICK ACTIONS ===== */
.quick-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}
.quick-action {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 8px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #e9ecef;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.15s;
    box-shadow: var(--card-shadow);
    min-height: 72px;
}
.quick-action:active {
    background: #f8f4ff;
    border-color: var(--primary);
    color: var(--primary);
}
.quick-action i {
    font-size: 1.5rem;
    color: var(--primary);
}

/* ===== GAME STATUS BANNER ===== */
.game-banner {
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 0.95rem;
}
.game-banner.active {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}
.game-banner.inactive {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
}
.game-banner i {
    font-size: 1.5rem;
}

/* ===== STATS ROW (horizontal scroll) ===== */
.stats-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 16px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.stats-scroll::-webkit-scrollbar {
    display: none;
}
.stat-chip {
    flex-shrink: 0;
    background: #fff;
    border-radius: 12px;
    padding: 14px 18px;
    min-width: 120px;
    box-shadow: var(--card-shadow);
    border: 1px solid #f0f0f0;
}
.stat-chip .sc-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}
.stat-chip .sc-label {
    font-size: 0.7rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== TIMELINE LIST ===== */
.tl-item {
    padding: 14px 16px;
    border-left: 3px solid var(--primary);
    margin-bottom: 8px;
    background: #fff;
    border-radius: 0 10px 10px 0;
    box-shadow: var(--card-shadow);
}
.tl-item .tl-date {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
}
.tl-item .tl-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 2px 0;
}
.tl-item .tl-meta {
    font-size: 0.8rem;
    color: #6c757d;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
    .sidebar {
        display: none;
    }
    .nav-bar {
        display: block;
    }
    .main-content {
        margin-left: 0;
        padding-bottom: 64px;
    }
    .page-content {
        padding: 16px;
    }
    .topbar {
        padding: 0 16px;
        height: 52px;
    }
    .memory-board {
        grid-template-columns: repeat(3, 1fr);
    }
    .topbar .d-flex.align-items-center.gap-3 {
        gap: 8px;
    }
    .table-container {
        padding: 14px;
    }
    .table thead {
        display: none;
    }
    .table tbody tr {
        display: block;
        padding: 12px 0;
        border-bottom: 1px solid #f0f0f0;
    }
    .table tbody tr:last-child {
        border-bottom: none;
    }
    .table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border: none;
        font-size: 0.9rem;
    }
    .table tbody td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        font-size: 0.75rem;
        margin-right: 12px;
        flex-shrink: 0;
    }
}

@media (min-width: 992px) {
    .nav-bar {
        display: none !important;
    }
    .drawer-overlay {
        display: none !important;
    }
    .drawer-panel {
        display: none !important;
    }
    .sidebar {
        display: block;
    }
    .main-content {
        margin-left: var(--sidebar-width);
    }
    .table-mobile-card {
        display: none;
    }
}

/* ===== LARGE TOGGLE / CHECKBOX ===== */
.form-check-input-lg {
    width: 1.3em;
    height: 1.3em;
    margin-top: 0.15em;
}
.form-switch-lg .form-check-input {
    width: 2.5em;
    height: 1.3em;
}

/* ===== BUBBLE POP ===== */
.bp-container { position:relative; width:100%; }
.bp-canvas { position:relative; width:100%; height:380px; background:linear-gradient(180deg,#e8f4fd,#b3d9f2); border-radius:16px; overflow:hidden; cursor:pointer; }
.bp-bubble { position:absolute; border-radius:50%; cursor:pointer; transition:transform 0.1s; z-index:2; box-shadow:inset -4px -4px 8px rgba(0,0,0,0.15); }
.bp-bubble:hover { transform:scale(1.1); }
.bp-bomb { box-shadow:inset -4px -4px 8px rgba(0,0,0,0.3); }
.bp-popped { transform:scale(1.5) !important; opacity:0; transition:all 0.15s; }

/* ===== TILE FLIP ===== */
.tf-board { display:grid; gap:8px; margin:10px 0; }
.tf-card { aspect-ratio:1; background:linear-gradient(135deg,#6f42c1,#5533a0); border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:2rem; color:#fff; cursor:pointer; transition:all 0.3s; user-select:none; position:relative; }
.tf-card .tf-back { font-weight:700; font-size:1.2rem; color:rgba(255,255,255,0.5); }
.tf-card .tf-front { display:none; }
.tf-card.flipped { background:#fff; border:2px solid #6f42c1; transform:rotateY(180deg); }
.tf-card.flipped .tf-back { display:none; }
.tf-card.flipped .tf-front { display:block; color:#6f42c1; }
.tf-card.matched { background:#28a745; border-color:#28a745; opacity:0.6; cursor:default; }
.tf-card.matched .tf-front { color:#fff; }

/* ===== SPEED TAP ===== */
.st-container { text-align:center; }
.st-item-area { width:100%; height:200px; background:linear-gradient(135deg,#2d1b69,#1a0f3c); border-radius:20px; display:flex; align-items:center; justify-content:center; margin:10px 0; }
.st-item { font-size:2.5rem; font-weight:800; color:#fff; padding:20px 40px; border-radius:16px; cursor:pointer; transition:all 0.2s; user-select:none; }
.st-item-show { background:#6f42c1; transform:scale(1); animation:st-pulse 0.5s ease; }
.st-item-show:hover { background:#5533a0; transform:scale(1.05); }
.st-item-miss { background:#dc3545 !important; transform:scale(0.9); opacity:0; }
@keyframes st-pulse { 0%{transform:scale(0.8);opacity:0} 50%{transform:scale(1.05)} 100%{transform:scale(1);opacity:1} }
.st-feedback { font-size:1.1rem; font-weight:700; min-height:28px; transition:all 0.2s; }

/* ===== SIMON SAYS ===== */
.ss-board { display:grid; grid-template-columns:1fr 1fr; gap:10px; max-width:300px; margin:0 auto; }
.ss-pad { aspect-ratio:1; border-radius:20px; cursor:pointer; transition:opacity 0.15s, transform 0.1s; box-shadow:0 4px 12px rgba(0,0,0,0.2); }
.ss-pad:active { transform:scale(0.95); }
.ss-active { opacity:1 !important; filter:brightness(1.4); transform:scale(0.95); box-shadow:0 0 20px rgba(255,255,255,0.6); }
.ss-pad:not(.ss-active) { opacity:0.6; }

/* ===== TRIVIA ===== */
.tr-question { font-size:1.2rem; font-weight:600; margin-bottom:16px; min-height:48px; }
.tr-options { display:flex; flex-direction:column; gap:8px; }
.tr-option { padding:12px 16px; border:2px solid #e0e0e0; border-radius:12px; background:#fff; font-size:1rem; text-align:left; cursor:pointer; transition:all 0.15s; }
.tr-option:hover { border-color:#6f42c1; background:#f8f4ff; }

/* ===== SPIN WHEEL ===== */
.sw-wheel-group {
    transform-origin: 200px 200px;
}

.sw-segment {
    transition: opacity 0.3s;
    cursor: default;
}

.sw-segment-hit {
    filter: brightness(1.2) drop-shadow(0 0 8px rgba(255,215,0,0.8));
}

.sw-spin-btn {
    background: linear-gradient(135deg, #6f42c1, #5533a0);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(111, 66, 193, 0.4);
    transition: all 0.2s;
    cursor: pointer;
}

.sw-spin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(111, 66, 193, 0.5);
    color: #fff;
}

.sw-spin-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.sw-result-display {
    font-size: 3rem;
    font-weight: 800;
    color: #6f42c1;
    display: inline-block;
    padding: 10px 30px;
    border-radius: 16px;
    background: #f0e8ff;
}

/* ===== MISC ===== */
.table-number {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    z-index: 100;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    background: linear-gradient(135deg, #2d1b69 0%, #1a0f3c 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
