/* ============================================================
 *  Dishtro Restaurants Panel — Common CSS
 *  File: /restaurants/assets/css/main.css
 * ============================================================
 *  Theme : Light dashboard, Emerald green primary
 *  Layout: Mobile  → body scrolls, bottom nav
 *          Desktop → fixed left sidebar + scrollable main area
 *  Loaded by: layout/header.php (auto)
 * ============================================================ */


/* ============================================================
 *  1. CSS VARIABLES
 * ============================================================ */
:root {
    /* Brand — Emerald green */
    --d-primary:        #10b981;
    --d-primary-dark:   #047857;
    --d-primary-soft:   #d1fae5;
    --d-primary-tint:   #ecfdf5;

    /* Functional */
    --d-success:        #10b981;
    --d-warning:        #f59e0b;
    --d-warning-soft:   #fef3c7;
    --d-danger:         #ef4444;
    --d-danger-soft:    #fee2e2;
    --d-info:           #3b82f6;
    --d-info-soft:      #dbeafe;

    /* Surfaces */
    --shell-bg:         #f7f8fa;
    --card-bg:          #ffffff;
    --card-bd:          rgba(15, 23, 42, 0.08);
    --card-shadow:      0 1px 2px rgba(15, 23, 42, 0.04),
                        0 1px 3px rgba(15, 23, 42, 0.06);
    --card-shadow-h:    0 4px 6px rgba(15, 23, 42, 0.05),
                        0 10px 15px rgba(15, 23, 42, 0.08);

    /* Text */
    --d-text:           #0f172a;
    --d-text-2:         #334155;
    --d-muted:          #64748b;
    --d-muted-2:        #94a3b8;

    /* Inputs */
    --input-bg:         #ffffff;
    --input-bd:         #e2e8f0;
    --input-bd-focus:   var(--d-primary);

    /* Sizes */
    --sidebar-w:        248px;
    --topbar-h:         64px;
    --bottom-nav-h:     68px;
    --pad-x:            18px;
    --radius-sm:        8px;
    --radius:           12px;
    --radius-lg:        16px;

    /* Dynamic viewport height */
    --vh-100:           100vh;
}
@supports (height: 100dvh) {
    :root { --vh-100: 100dvh; }
}


/* ============================================================
 *  2. RESET + WIDTH SAFETY
 * ============================================================ */
*, *::before, *::after {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    max-width: 100%;
}

body, p, span, h1, h2, h3, h4, h5, h6, li, a, label, div, td {
    overflow-wrap: anywhere;
    word-break: break-word;
}

img, video, svg, picture, canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

input, textarea, select, button {
    font-family: inherit;
    max-width: 100%;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100vw;
    background: var(--shell-bg);
    color: var(--d-text);
    scrollbar-width: none;
    -ms-overflow-style: none;
}
*::-webkit-scrollbar { display: none; width: 0; height: 0; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--d-primary-dark); text-decoration: none; }
a:hover { color: var(--d-primary); }


/* ============================================================
 *  3. STAGE LAYOUT
 *  Mobile: body scrolls, stage = block
 *  Desktop: stage = grid [sidebar | main]
 * ============================================================ */

.stage {
    min-height: var(--vh-100);
    display: flex;
    flex-direction: column;
    background: var(--shell-bg);
}

.scroll-area {
    flex: 1;
    width: 100%;
    padding: 16px var(--pad-x) calc(var(--bottom-nav-h) + 32px);
    display: flex;
    flex-direction: column;
}

/* When sidebar/nav is hidden (login pages) center content */
.stage.no-nav {
    min-height: var(--vh-100);
    display: grid;
    place-items: center;
}
.stage.no-nav .scroll-area {
    padding: 24px var(--pad-x);
    max-width: 440px;
    margin: 0 auto;
}

/* ===== Desktop layout (≥901px): sidebar + main ===== */
@media (min-width: 901px) {
    .stage {
        display: grid;
        grid-template-columns: var(--sidebar-w) 1fr;
        grid-template-rows: 1fr;
        height: var(--vh-100);
        overflow: hidden;
    }

    .scroll-area {
        grid-column: 2;
        overflow-y: auto;
        padding: 24px 32px 32px;
        max-width: 1200px;
        margin: 0 auto;
        width: 100%;
    }

    .stage.no-nav {
        display: grid;
        place-items: center;
        grid-template-columns: 1fr;
    }
}


/* ============================================================
 *  4. SIDEBAR (desktop) + BOTTOM-NAV (mobile)
 * ============================================================ */

/* ----- Sidebar (desktop only) ----- */
.sidebar {
    display: none;  /* hidden on mobile */
}

@media (min-width: 901px) {
    .sidebar {
        display: flex;
        flex-direction: column;
        grid-column: 1;
        background: #fff;
        border-right: 1px solid var(--card-bd);
        height: var(--vh-100);
        position: sticky;
        top: 0;
        padding: 22px 14px;
        gap: 4px;
    }

    .sidebar-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 4px 10px 22px;
        margin-bottom: 6px;
        border-bottom: 1px solid var(--card-bd);
    }
    .sidebar-brand .logo-dot {
        width: 36px; height: 36px;
        border-radius: 10px;
        background: linear-gradient(135deg, var(--d-primary), var(--d-primary-dark));
        display: grid; place-items: center;
        color: #fff; font-size: 18px;
        box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
    }
    .sidebar-brand .brand-text {
        font-weight: 800;
        font-size: 16px;
        color: var(--d-text);
        line-height: 1.1;
    }
    .sidebar-brand .brand-sub {
        font-size: 11px;
        color: var(--d-muted);
        font-weight: 500;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: column;
        gap: 2px;
        margin-top: 10px;
        flex: 1;
    }
    .sidebar-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 11px 14px;
        border-radius: 10px;
        color: var(--d-text-2);
        font-weight: 600;
        font-size: 13.5px;
        transition: background 0.15s, color 0.15s;
    }
    .sidebar-item i {
        font-size: 18px;
        color: var(--d-muted);
        transition: color 0.15s;
    }
    .sidebar-item:hover {
        background: #f1f5f9;
        color: var(--d-text);
    }
    .sidebar-item.active {
        background: var(--d-primary-tint);
        color: var(--d-primary-dark);
    }
    .sidebar-item.active i {
        color: var(--d-primary-dark);
    }

    .sidebar-footer {
        margin-top: auto;
        padding-top: 14px;
        border-top: 1px solid var(--card-bd);
    }
    .sidebar-user {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px;
        border-radius: 10px;
    }
    .sidebar-user .avatar {
        width: 36px; height: 36px;
        border-radius: 50%;
        background: var(--d-primary-tint);
        color: var(--d-primary-dark);
        display: grid; place-items: center;
        font-weight: 700;
        font-size: 14px;
        flex-shrink: 0;
    }
    .sidebar-user .meta {
        min-width: 0;
        flex: 1;
    }
    .sidebar-user .meta .nm {
        font-weight: 700; font-size: 13px;
        color: var(--d-text);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .sidebar-user .meta .em {
        font-size: 11px; color: var(--d-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .sidebar-user .logout-btn {
        background: transparent;
        border: none;
        color: var(--d-muted);
        font-size: 18px;
        padding: 6px;
        border-radius: 8px;
        cursor: pointer;
    }
    .sidebar-user .logout-btn:hover {
        background: var(--d-danger-soft);
        color: var(--d-danger);
    }
}

/* ----- Mobile top bar ----- */
.mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px var(--pad-x);
    background: #fff;
    border-bottom: 1px solid var(--card-bd);
    position: sticky;
    top: 0;
    z-index: 50;
}
.mobile-topbar .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 15px;
    color: var(--d-text);
}
.mobile-topbar .brand .logo-dot {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--d-primary), var(--d-primary-dark));
    display: grid; place-items: center;
    color: #fff;
    font-size: 16px;
}
.mobile-topbar .topbar-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
.topbar-icon-btn {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--shell-bg);
    border: 1px solid var(--card-bd);
    display: grid; place-items: center;
    color: var(--d-text-2);
    font-size: 17px;
    cursor: pointer;
    text-decoration: none;
}
.topbar-icon-btn:hover { background: #eef2f6; color: var(--d-text); }

@media (min-width: 901px) {
    .mobile-topbar { display: none; }
}

/* ----- Bottom nav (mobile only) ----- */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    background: #fff;
    border-top: 1px solid var(--card-bd);
    display: flex;
    align-items: stretch;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.04);
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--d-muted);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    padding: 6px 4px;
    position: relative;
}
.bottom-nav-item i {
    font-size: 22px;
    transition: transform 0.15s;
}
.bottom-nav-item.active {
    color: var(--d-primary-dark);
}
.bottom-nav-item.active i {
    color: var(--d-primary-dark);
    transform: scale(1.05);
}
.bottom-nav-item .badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    background: var(--d-danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    padding: 0 4px;
    border: 2px solid #fff;
}

@media (min-width: 901px) {
    .bottom-nav { display: none; }
    .scroll-area { padding-bottom: 32px; }
}


/* ============================================================
 *  5. PAGE HEADER + COMMON BLOCKS
 * ============================================================ */

.page-head {
    margin-bottom: 18px;
}
.page-head h1 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 4px;
    color: var(--d-text);
    letter-spacing: -0.02em;
}
.page-head p {
    font-size: 13px;
    color: var(--d-muted);
    margin: 0;
}

.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--d-text);
    margin: 22px 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.section-title .link-more {
    font-size: 12px;
    font-weight: 600;
    color: var(--d-primary-dark);
}


/* ============================================================
 *  6. CARDS
 * ============================================================ */

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-bd);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--card-shadow);
}
.card-flush { padding: 0; overflow: hidden; }


/* ===== Stat cards (dashboard) ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
@media (min-width: 640px) {
    .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-bd);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.stat-card .stat-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--d-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stat-card .stat-label i {
    font-size: 14px;
    color: var(--d-primary);
}
.stat-card .stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--d-text);
    line-height: 1;
    letter-spacing: -0.02em;
}
.stat-card .stat-sub {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--d-muted);
}
.stat-card .stat-sub.up    { color: var(--d-success); }
.stat-card .stat-sub.down  { color: var(--d-danger); }


/* ============================================================
 *  7. BUTTONS
 * ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s, border-color 0.15s;
    min-height: 44px;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--d-primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(16, 185, 129, 0.25);
}
.btn-primary:hover  { background: var(--d-primary-dark); color: #fff; }

.btn-ghost {
    background: #fff;
    color: var(--d-text);
    border-color: var(--input-bd);
}
.btn-ghost:hover { background: #f8fafc; }

.btn-danger {
    background: var(--d-danger);
    color: #fff;
}
.btn-danger:hover { background: #b91c1c; }

.btn-block { width: 100%; }
.btn-sm    { padding: 8px 14px; min-height: 36px; font-size: 13px; }


/* ============================================================
 *  8. FORM CONTROLS
 * ============================================================ */

.form-group {
    margin-bottom: 14px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--d-text-2);
    margin-bottom: 6px;
}
.input,
.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--input-bd);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--d-text);
    font-size: 14px;
    font-weight: 500;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-height: 46px;
}
.input:focus,
.form-input:focus {
    outline: none;
    border-color: var(--input-bd-focus);
    box-shadow: 0 0 0 3px var(--d-primary-soft);
}
.input.has-error { border-color: var(--d-danger); }

.input-with-icon {
    position: relative;
}
.input-with-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--d-muted);
    font-size: 17px;
}
.input-with-icon .input { padding-left: 42px; }

.form-help {
    font-size: 12px;
    color: var(--d-muted);
    margin-top: 6px;
}
.form-error {
    font-size: 12px;
    color: var(--d-danger);
    margin-top: 6px;
    font-weight: 600;
    display: none;
}
.form-error.show { display: block; }


/* ============================================================
 *  9. BADGES / PILLS
 * ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.badge-success { background: var(--d-primary-soft); color: var(--d-primary-dark); }
.badge-warning { background: var(--d-warning-soft); color: #a16207; }
.badge-danger  { background: var(--d-danger-soft);  color: #b91c1c; }
.badge-info    { background: var(--d-info-soft);    color: #1d4ed8; }
.badge-muted   { background: #f1f5f9; color: var(--d-muted); }


/* ============================================================
 * 10. ORDER LIST ROWS
 * ============================================================ */

.list {
    background: var(--card-bg);
    border: 1px solid var(--card-bd);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}
.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--card-bd);
    text-decoration: none;
    color: inherit;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: #f8fafc; }

.list-row .icon-wrap {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--d-primary-tint);
    color: var(--d-primary-dark);
    display: grid; place-items: center;
    font-size: 18px;
    flex-shrink: 0;
}
.list-row .meta {
    min-width: 0;
    flex: 1;
}
.list-row .meta .t1 {
    font-weight: 700;
    font-size: 14px;
    color: var(--d-text);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.list-row .meta .t2 {
    font-size: 12.5px;
    color: var(--d-muted);
}
.list-row .right {
    text-align: right;
    flex-shrink: 0;
}
.list-row .right .amount {
    font-weight: 800;
    font-size: 14px;
    color: var(--d-text);
}
.list-row .right .time {
    font-size: 11.5px;
    color: var(--d-muted);
    margin-top: 2px;
}


.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--d-muted);
}
.empty-state i {
    font-size: 42px;
    color: var(--d-muted-2);
    margin-bottom: 10px;
}
.empty-state .title {
    font-weight: 700;
    font-size: 15px;
    color: var(--d-text-2);
    margin-bottom: 4px;
}


/* ============================================================
 * 11. SHOP STATUS TOGGLE
 * ============================================================ */

.shop-status-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card-bg);
    border: 1px solid var(--card-bd);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--card-shadow);
    margin-bottom: 18px;
}
.shop-status-card .status-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.shop-status-card.is-open .status-dot {
    background: var(--d-success);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
    animation: pulse-dot 1.8s ease-in-out infinite;
}
.shop-status-card.is-closed .status-dot {
    background: var(--d-danger);
}
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18); }
    50%      { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.06); }
}
.shop-status-card .status-meta { flex: 1; min-width: 0; }
.shop-status-card .status-meta .t1 {
    font-weight: 700;
    font-size: 14px;
    color: var(--d-text);
}
.shop-status-card .status-meta .t2 {
    font-size: 12px;
    color: var(--d-muted);
    margin-top: 2px;
}


/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}
.switch input { display: none; }
.switch .slider {
    position: absolute; inset: 0;
    background: #cbd5e1;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s;
}
.switch .slider::before {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 22px; height: 22px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.switch input:checked + .slider { background: var(--d-primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }


/* ============================================================
 * 12. SKELETON LOADERS  (shimmer placeholders)
 * ============================================================ */

.skel {
    background: linear-gradient(90deg,
        #eef2f6 0%,
        #f7f8fa 50%,
        #eef2f6 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: 8px;
    display: block;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skel-line   { height: 12px; margin-bottom: 8px; }
.skel-line.short { width: 40%; }
.skel-line.med   { width: 70%; }
.skel-card   { height: 96px; border-radius: 12px; margin-bottom: 10px; }
.skel-circle { width: 40px; height: 40px; border-radius: 50%; }

/* Show / hide via body.loaded toggle */
.content-block  { display: none; }
.skeleton-block { display: block; }
body.loaded .content-block  { display: block; }
body.loaded .skeleton-block { display: none; }


/* ============================================================
 * 13. TOASTS
 * ============================================================ */

.toast-host {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + 14px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}
@media (min-width: 901px) {
    .toast-host { bottom: 22px; }
}
.toast {
    background: var(--d-text);
    color: #fff;
    padding: 11px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
    pointer-events: auto;
    max-width: 90vw;
    animation: toast-in 0.25s ease;
}
.toast.t-error   { background: var(--d-danger); }
.toast.t-success { background: var(--d-success); }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ============================================================
 * 14. BOTTOM SHEET / MODAL (replaces native alert/confirm)
 * ============================================================ */

.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 8000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.sheet-overlay.open {
    opacity: 1;
    visibility: visible;
}

.sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 22px 22px max(22px, env(safe-area-inset-bottom));
    z-index: 8500;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    max-width: 540px;
    margin: 0 auto;
    box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.18);
}
.sheet.open { transform: translateY(0); }

@media (min-width: 901px) {
    .sheet {
        left: 50%;
        right: auto;
        bottom: 50%;
        transform: translate(-50%, calc(50% + 20px));
        opacity: 0;
        border-radius: 16px;
        width: min(420px, 92vw);
        transition: transform 0.22s, opacity 0.22s;
    }
    .sheet.open {
        transform: translate(-50%, 50%);
        opacity: 1;
    }
}

.sheet h3 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 800;
    color: var(--d-text);
}
.sheet p {
    margin: 0 0 16px;
    font-size: 13.5px;
    color: var(--d-muted);
    line-height: 1.5;
}
.sheet-actions {
    display: flex;
    gap: 10px;
}
.sheet-actions .btn { flex: 1; }


/* ============================================================
 * 15. UTILITIES
 * ============================================================ */

.text-muted   { color: var(--d-muted); }
.text-primary { color: var(--d-primary-dark); }
.text-danger  { color: var(--d-danger); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.fw-700       { font-weight: 700; }
.fw-800       { font-weight: 800; }

.mt-0  { margin-top: 0; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0  { margin-bottom: 0; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex      { display: flex; }
.flex-col  { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.w-100  { width: 100%; }


/* ============================================================
 * 16. ANIMATIONS (entrance)
 * ============================================================ */

.anim-up {
    opacity: 0;
    transform: translateY(8px);
    animation: animUp 0.45s ease forwards;
}
.anim-up.d1 { animation-delay: 0.05s; }
.anim-up.d2 { animation-delay: 0.12s; }
.anim-up.d3 { animation-delay: 0.20s; }
.anim-up.d4 { animation-delay: 0.28s; }
.anim-up.d5 { animation-delay: 0.36s; }
@keyframes animUp {
    to { opacity: 1; transform: translateY(0); }
}
/* ============================================================
 * 16. MOBILE DRAWER (slide-in sidebar for phones)
 *     Added because the bottom-nav only shows 4 items — drawer
 *     gives access to all 11 nav items on mobile.
 *     Desktop: hidden entirely (real sidebar is always visible).
 * ============================================================ */

/* ============================================================
 * 16. MOBILE DRAWER (slide-in sidebar for phones)
 *     Added because the bottom-nav only shows 4 items — drawer
 *     gives access to all 11 nav items on mobile.
 *     Desktop: hidden entirely (real sidebar is always visible).
 * ============================================================ */

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 8800;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s, visibility 0.22s;
}
.drawer-backdrop.open { opacity: 1; visibility: visible; }

.mobile-drawer {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: min(82vw, 320px);
    background: #fff;
    z-index: 8900;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 6px 0 30px rgba(15, 23, 42, 0.22);
    overflow: hidden;
}
.mobile-drawer.open { transform: translateX(0); }

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--card-bd);
    flex-shrink: 0;
}
.drawer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.drawer-brand .logo-dot {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--d-primary), var(--d-primary-dark));
    display: grid; place-items: center;
    color: #fff; font-size: 18px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}
.drawer-brand .brand-text { font-weight: 800; font-size: 16px; color: var(--d-text); line-height: 1.1; }
.drawer-brand .brand-sub  { font-size: 11px; color: var(--d-muted); font-weight: 600; }

.drawer-close-btn {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--shell-bg);
    border: 1px solid var(--card-bd);
    color: var(--d-text-2);
    font-size: 20px;
    display: grid; place-items: center;
    cursor: pointer;
}
.drawer-close-btn:hover { background: #eef2f6; }

.drawer-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 14px 6px;
    padding: 12px;
    background: var(--d-primary-tint);
    border: 1px solid rgba(16, 185, 129, 0.18);
    border-radius: 12px;
}
.drawer-user .avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--d-primary), var(--d-primary-dark));
    color: #fff;
    display: grid; place-items: center;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
}
.drawer-user .meta { min-width: 0; flex: 1; }
.drawer-user .meta .nm { font-weight: 700; font-size: 13.5px; color: var(--d-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-user .meta .em { font-size: 11.5px; color: var(--d-primary-dark); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px 16px;
    flex: 1;
    overflow-y: auto;
}
.drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--d-text-2);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.drawer-item i {
    font-size: 19px;
    color: var(--d-muted);
    transition: color 0.15s;
}
.drawer-item:hover { background: #f1f5f9; color: var(--d-text); }
.drawer-item.active {
    background: var(--d-primary-tint);
    color: var(--d-primary-dark);
}
.drawer-item.active i { color: var(--d-primary-dark); }
.drawer-item .nav-badge {
    margin-left: auto;
    background: var(--d-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    padding: 0 5px;
    display: inline-grid;
    place-items: center;
    line-height: 1;
}

.drawer-foot {
    border-top: 1px solid var(--card-bd);
    padding: 14px;
    flex-shrink: 0;
}
.drawer-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--d-danger);
    background: var(--d-danger-soft);
    font-weight: 700;
    font-size: 13.5px;
    text-decoration: none;
}
.drawer-logout:hover { background: #fecaca; }

@media (min-width: 901px) {
    .mobile-drawer,
    .drawer-backdrop,
    .drawer-open-btn { display: none !important; }
}


/* ============================================================
 * 17. NEW-ORDER POPUP (queue model — one popup at a time)
 *     Renders ONE slide-down modal at a time; remaining orders
 *     are queued. After accept/reject, next one slides in.
 *     Audio loop runs until queue is empty (NO mute button).
 * ============================================================ */

.order-pop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    z-index: 9500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.order-pop-overlay.open { opacity: 1; visibility: visible; }

.order-pop-stack {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9600;
    pointer-events: none;
    padding: 60px 14px 14px;     /* top padding leaves room for queue badge */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.order-pop {
    pointer-events: auto;
    width: 100%;
    max-width: 480px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    box-shadow:
        0 30px 60px -20px rgba(15, 23, 42, 0.45),
        0 12px 28px -8px rgba(15, 23, 42, 0.18);
    transform: translateY(-120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s;
    overflow: hidden;
    position: relative;
}
.order-pop.show { transform: translateY(0); opacity: 1; }
.order-pop.dismiss { transform: translateY(-120%); opacity: 0; }

/* Red flashing edge — grabs attention even peripherally */
.order-pop::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 18px;
    border: 3px solid var(--d-danger);
    pointer-events: none;
    animation: pop-flash 1s ease-in-out infinite;
}
@keyframes pop-flash {
    0%, 100% { opacity: 0.0; }
    50%      { opacity: 0.9; }
}

.order-pop-head {
    background: linear-gradient(135deg, var(--d-primary), var(--d-primary-dark));
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.order-pop-head .bell-wrap {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    display: grid; place-items: center;
    font-size: 22px;
    flex-shrink: 0;
    animation: bell-ring 0.7s ease-in-out infinite;
}
@keyframes bell-ring {
    0%, 100% { transform: rotate(0); }
    25%      { transform: rotate(-15deg); }
    75%      { transform: rotate(15deg); }
}
.order-pop-head .titles { flex: 1; min-width: 0; }
.order-pop-head .t1 {
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -0.01em;
    margin-bottom: 2px;
}
.order-pop-head .t2 {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 600;
}
.order-pop-head .pop-time {
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 999px;
    flex-shrink: 0;
}

.order-pop-body { padding: 16px 18px; }

.pop-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    font-size: 13px;
}
.pop-row + .pop-row { border-top: 1px dashed var(--card-bd); }
.pop-row .lbl { color: var(--d-muted); font-weight: 600; flex-shrink: 0; }
.pop-row .val { color: var(--d-text); font-weight: 700; text-align: right; word-break: break-word; }
.pop-row .val .small { display: block; font-size: 11.5px; color: var(--d-muted); font-weight: 600; margin-top: 2px; }

.pop-items {
    background: var(--shell-bg);
    border-radius: 12px;
    padding: 10px 12px;
    margin: 10px 0 4px;
}
.pop-items .it {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12.5px;
    padding: 5px 0;
}
.pop-items .it + .it { border-top: 1px solid var(--card-bd); }
.pop-items .it .nm  { color: var(--d-text); font-weight: 700; min-width: 0; flex: 1; }
.pop-items .it .qty { color: var(--d-muted); font-weight: 700; flex-shrink: 0; }

.pop-grand {
    background: var(--d-primary-tint);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 14px;
}
.pop-grand .lbl { font-weight: 700; color: var(--d-primary-dark); }
.pop-grand .val { font-weight: 800; color: var(--d-text); font-size: 18px; letter-spacing: -0.01em; }

.order-pop-actions {
    display: flex;
    gap: 8px;
    padding: 12px 14px 16px;
    border-top: 1px solid var(--card-bd);
    background: #fafbfc;
}
.pop-btn {
    flex: 1;
    padding: 13px 14px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 13.5px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 48px;
    transition: transform 0.05s, box-shadow 0.2s;
    font-family: inherit;
}
.pop-btn.accept {
    background: linear-gradient(135deg, var(--d-primary), var(--d-primary-dark));
    color: #fff;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}
.pop-btn.reject {
    background: #fff;
    color: var(--d-danger);
    border: 1.5px solid #fecaca;
}
.pop-btn.accept:hover { box-shadow: 0 12px 26px rgba(16, 185, 129, 0.5); }
.pop-btn.reject:hover { background: var(--d-danger-soft); }
.pop-btn:active { transform: translateY(1px); }
.pop-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ----- Reject-reason picker (inside the popup) ----- */
.pop-reject-wrap {
    padding: 14px 18px 16px;
    border-top: 1px solid var(--card-bd);
    background: #fff7f7;
    display: none;
}
.pop-reject-wrap.open { display: block; }
.pop-reject-wrap .title {
    font-size: 13px;
    font-weight: 800;
    color: #991b1b;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.reason-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
}
.reason-chip {
    background: #fff;
    border: 1.5px solid #fecaca;
    color: #7f1d1d;
    font-size: 12px;
    font-weight: 700;
    padding: 9px 10px;
    border-radius: 9px;
    cursor: pointer;
    text-align: left;
    line-height: 1.3;
    transition: background 0.12s, border-color 0.12s;
    font-family: inherit;
}
.reason-chip:hover  { background: #fef2f2; }
.reason-chip.active { background: var(--d-danger); border-color: var(--d-danger); color: #fff; }

.pop-reject-wrap textarea {
    width: 100%;
    min-height: 64px;
    padding: 10px 12px;
    border: 1.5px solid #fecaca;
    border-radius: 10px;
    background: #fff;
    color: var(--d-text);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 10px;
    display: none;
}
.pop-reject-wrap textarea.open { display: block; }
.pop-reject-wrap textarea:focus { outline: none; border-color: var(--d-danger); }

.pop-reject-wrap .reject-actions {
    display: flex;
    gap: 8px;
}
.pop-reject-wrap .btn-cancel-reject,
.pop-reject-wrap .btn-confirm-reject {
    flex: 1;
    padding: 11px 12px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 13px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    min-height: 44px;
}
.pop-reject-wrap .btn-cancel-reject {
    background: #fff;
    color: var(--d-text-2);
    border: 1px solid var(--card-bd);
}
.pop-reject-wrap .btn-confirm-reject {
    background: var(--d-danger);
    color: #fff;
}
.pop-reject-wrap .btn-confirm-reject:disabled { opacity: 0.5; cursor: not-allowed; }

/* Page-wide red attention glow when popup is open */
body.has-new-order { animation: page-attention 1.4s ease-in-out infinite; }
@keyframes page-attention {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0); }
    50%      { box-shadow: inset 0 0 40px 8px rgba(239, 68, 68, 0.35); }
}