/* OrderBot — brand UI system
   Palette is taken directly from the OrderBot logo: the brand green of the
   mark/wordmark (#0C6C3C -> #3C9C3C) and the slate of the "Bot" lettering
   (#2F4854). Light is the default surface; dark is an opt-in preference. */
:root {
    /* --- brand --- */
    --brand-700: #0b5c31;
    --brand-600: #0f6b39;
    --brand-500: #157a3a;
    --brand-400: #2e9440;
    --brand-300: #58b45f;
    --brand-50:  #eef6f0;

    --accent: var(--brand-500);
    --accent-hover: var(--brand-600);
    --accent-light: rgba(21, 122, 58, 0.10);
    --accent-grad: linear-gradient(135deg, #2e9440 0%, #0c6c3c 100%);

    /* status colours, desaturated to sit calmly beside the brand green */
    --success: #157a3a;
    --warning: #b45309;
    --danger: #c02626;
    --info: #1f6feb;
    --purple: #6d5bd0;
    --cyan: #0e7490;

    /* restrained geometry — squarer than the previous rounded style */
    --radius: 10px;
    --radius-sm: 7px;
    --radius-lg: 14px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bottom-nav-height: 66px;
    --content-max: 1240px;

    /* --- LIGHT theme (default) --- */
    color-scheme: light;
    --bg-primary: #f4f6f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-elevated: #f7f9f8;
    --bg-input: #ffffff;
    --bg-hover: #eef2f0;
    --text-primary: #17242c;
    --text-secondary: #4c5b66;
    --text-muted: #7d8b95;
    --border: #e0e6e3;
    --border-soft: rgba(23, 36, 44, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.88);
    --sunken: rgba(23, 36, 44, 0.035);
    --shadow-sm: 0 1px 2px rgba(23,36,44,0.05);
    --shadow: 0 4px 12px -4px rgba(23,36,44,0.10);
    --shadow-lg: 0 14px 32px -12px rgba(23,36,44,0.16);
    /* no decorative page glows — the surface stays flat and clean */
    --glow-1: transparent;
    --glow-2: transparent;
}

/* --- DARK theme (opt-in) --- */
[data-theme="dark"] {
    color-scheme: dark;
    --bg-primary: #0e1714;
    --bg-secondary: #13201c;
    --bg-card: #152420;
    --bg-elevated: #1c2f28;
    --bg-input: #16251f;
    --bg-hover: #22362e;
    --text-primary: #e7efe9;
    --text-secondary: #a3b4aa;
    --text-muted: #71847a;
    --border: #24382f;
    --border-soft: rgba(255, 255, 255, 0.07);
    --glass-bg: rgba(19, 32, 28, 0.86);
    --sunken: rgba(0, 0, 0, 0.20);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.30);
    --shadow: 0 6px 16px -6px rgba(0,0,0,0.45);
    --shadow-lg: 0 18px 40px -12px rgba(0,0,0,0.50);
    --glow-1: transparent;
    --glow-2: transparent;
    --accent: var(--brand-400);
    --accent-hover: var(--brand-300);
    --accent-light: rgba(46, 148, 64, 0.16);
}

/* smooth theme switch */
body, .card, .stat-card, .sidebar, .bottom-nav, .page-header,
.form-control, .btn-secondary, .tab, table, th, .order-card,
.kitchen-card, .delivery-card, .modal, .theme-toggle {
    transition: background-color 0.28s ease, color 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Typography */
h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; font-weight: 700; }
a { color: var(--accent); }
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--bg-elevated);
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.85em;
}
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent); }

/* Layout */
.app-container {
    padding-bottom: calc(var(--bottom-nav-height) + 16px);
    min-height: 100vh;
}

.page-header {
    padding: 16px;
    position: sticky;
    top: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 50;
    border-bottom: 1px solid var(--border-soft);
}

.page-header h1 { display: flex; align-items: center; gap: 10px; }
.page-header h1 svg { width: 24px; height: 24px; flex-shrink: 0; color: var(--accent); }

.page-content { padding: 18px 16px; }

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    padding: 18px 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, border-color 0.2s;
}
.stat-card:hover { border-color: var(--border); box-shadow: var(--shadow); }

.stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
}

/* Colorful stat cards */
.stat-card { position: relative; overflow: hidden; }
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--c, var(--accent));
}
.stat-card { background: var(--bg-card); }
.stat-card .stat-value { color: var(--c, var(--text-primary)); }
.stat-ico {
    width: 46px; height: 46px;
    margin: 2px auto 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: var(--cbg, var(--bg-elevated));
}
.stat-card.c-accent  { --c: #157a3a; --cbg: rgba(21,122,58,0.10); }
.stat-card.c-success { --c: #157a3a; --cbg: rgba(21,122,58,0.10); }
.stat-card.c-warning { --c: #b45309; --cbg: rgba(180,83,9,0.10); }
.stat-card.c-info    { --c: #1f6feb; --cbg: rgba(31,111,235,0.10); }
.stat-card.c-purple  { --c: #6d5bd0; --cbg: rgba(109,91,208,0.10); }

/* Theme toggle (injected into .page-header) */
.theme-toggle {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
}
.theme-toggle:hover { background: var(--bg-hover); border-color: var(--accent); }

/* Entrance reveal (staggered) */
.reveal { opacity: 1; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s, opacity 0.2s;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--accent-grad);
    color: #fff;
    box-shadow: 0 6px 16px -6px rgba(21,122,58,0.28);
}
.btn-primary:hover { box-shadow: 0 10px 22px -6px rgba(21,122,58,0.32); }

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-success { background: var(--success); color: #06230f; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-info { background: var(--info); color: #fff; }

.btn-sm { padding: 7px 13px; min-height: 34px; font-size: 0.8rem; }
.btn-lg { padding: 15px 28px; min-height: 52px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; min-width: 40px; min-height: 40px; }

.btn:disabled, .btn.loading {
    opacity: 0.55;
    pointer-events: none;
    box-shadow: none;
}

/* Forms */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-control:hover { border-color: var(--bg-hover); }
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 84px; line-height: 1.6; }

input[type="file"].form-control { padding: 9px 12px; }

/* Formatting toolbar (welcome editor etc.) */
.fmt-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.fmt-toolbar .btn { min-height: 32px; padding: 5px 11px; }

/* Toggle Switch */
.toggle {
    position: relative;
    width: 46px;
    height: 26px;
    cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider { background: var(--accent-grad); border-color: transparent; }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Tables */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: var(--bg-card);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

th {
    text-align: left;
    padding: 12px 14px;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}

tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    padding: 6px 6px calc(env(safe-area-inset-bottom, 0px));
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 600;
    padding: 7px 10px;
    border-radius: 14px;
    transition: all 0.2s;
    min-width: 56px;
    gap: 3px;
}

.nav-item svg { width: 22px; height: 22px; }

.nav-item.active {
    color: var(--accent);
    background: var(--accent-light);
}
.nav-item.active svg { stroke: var(--accent); }

/* More Menu */
.nav-more-menu {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 6px);
    right: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    display: none;
    min-width: 176px;
    box-shadow: var(--shadow-lg);
    z-index: 101;
}

.nav-more-menu.show { display: block; animation: popUp 0.18s ease; }
@keyframes popUp { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.nav-more-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.88rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.nav-more-menu a:hover { background: var(--bg-hover); }
.nav-more-menu a svg { width: 18px; height: 18px; }

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    padding: 34px 26px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo img { width: 210px; max-width: 68%; height: auto; display: block; margin: 0 auto; }
.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 6px;
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    left: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 13px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 340px;
    transition: opacity 0.3s, transform 0.3s;
}

.toast-success { background: var(--success); color: #06230f; }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: #1e293b; }
.toast-info { background: var(--info); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 22px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-soft);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 1.3rem;
    line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Order Cards */
.order-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.order-card:hover { transform: translateY(-2px); border-color: var(--accent-light); box-shadow: var(--shadow); }
.order-card:active { border-color: var(--accent); }

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.order-number {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--accent);
}

.order-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.order-items-preview {
    font-size: 0.83rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.45;
}

.order-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
}

.order-total {
    font-weight: 800;
    font-size: 1.05rem;
}

/* Kitchen Display */
.kitchen-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    border-left: 4px solid var(--accent);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.kitchen-card.preparing { border-left-color: var(--purple); }
.kitchen-card.ready { border-left-color: var(--success); }

.kitchen-items {
    list-style: none;
    margin: 10px 0;
}

.kitchen-items li {
    padding: 8px 0;
    font-size: 1rem;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
}

.kitchen-items li:last-child { border-bottom: none; }

.item-qty {
    font-weight: 800;
    color: var(--accent);
    min-width: 34px;
}

/* Delivery Card */
.delivery-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.delivery-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.delivery-actions .btn { flex: 1; }

/* Tabs */
.tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.tab:hover { color: var(--text-primary); border-color: var(--bg-hover); }

.tab.active {
    background: var(--accent-grad);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 14px -6px rgba(21,122,58,0.28);
}

.tab .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 5px;
    padding: 0 5px;
}

/* Kanban Board */
.kanban-scroll {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.kanban-scroll::-webkit-scrollbar { display: none; }

.kanban-column {
    min-width: 280px;
    max-width: 320px;
    flex-shrink: 0;
}

.kanban-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius) var(--radius) 0 0;
    border: 1px solid var(--border-soft);
    border-bottom: none;
    font-weight: 700;
    font-size: 0.85rem;
}

.kanban-body {
    background: var(--sunken);
    border: 1px solid var(--border-soft);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 10px;
    min-height: 200px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Star Rating */
.star-rating { display: flex; gap: 5px; }

.star-rating .star {
    cursor: pointer;
    font-size: 1.6rem;
    color: var(--text-muted);
    transition: color 0.2s, transform 0.15s;
}
.star-rating .star:hover { transform: scale(1.15); }
.star-rating .star.active { color: var(--warning); }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 52px;
    height: 52px;
    margin-bottom: 14px;
    opacity: 0.5;
}

.empty-state p { font-size: 0.92rem; }

/* Pulse Animation (for new orders) */
.pulse { animation: pulse 2s infinite; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(21,122,58,0.35); }
    70% { box-shadow: 0 0 0 12px rgba(21,122,58,0); }
    100% { box-shadow: 0 0 0 0 rgba(21,122,58,0); }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Search */
.search-bar {
    position: relative;
    margin-bottom: 16px;
}

.search-bar input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.92rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.search-bar svg {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

/* Utility */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.p-3 { padding: 12px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.settings-tab { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.hidden { display: none !important; }

/* Image preview */
.img-preview {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }

/* Responsive card grid — list pages flow into columns on wider screens.
   Cards stay full-width on mobile; the grid self-adjusts column count to width. */
.card-grid > *:last-child { margin-bottom: 0; }

@media (min-width: 768px) {
    .card-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 14px;
        align-items: start;
    }
    /* gap replaces per-card margins inside the grid */
    .card-grid > * { margin-bottom: 0 !important; }
    /* placeholders / empty states span the whole row */
    .card-grid > .empty-state,
    .card-grid > .card-grid-full { grid-column: 1 / -1; }
}

/* ============ TABLET ( >=768px ) : sidebar appears ============ */
@media (min-width: 768px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }

    .bottom-nav, .nav-more-menu { display: none; }

    .app-container {
        padding-bottom: 0;
        padding-left: 244px;
    }

    .sidebar {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 244px;
        background: var(--glass-bg);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-right: 1px solid var(--border-soft);
        z-index: 100;
        padding: 22px 0;
        overflow-y: auto;
    }

    .sidebar-logo {
        padding: 0 22px 20px;
        border-bottom: 1px solid var(--border-soft);
        margin-bottom: 14px;
    }

    .sidebar-logo h2 {
        font-size: 1.35rem;
        font-weight: 800;
        background: var(--accent-grad);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .sidebar-nav { flex: 1; padding: 0 10px; }

    .sidebar-nav a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 11px 14px;
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 0.88rem;
        font-weight: 600;
        border-radius: var(--radius-sm);
        margin-bottom: 3px;
        position: relative;
        transition: all 0.18s;
    }

    .sidebar-nav a:hover { background: var(--bg-hover); color: var(--text-primary); }
    .sidebar-nav a.active {
        background: var(--accent-light);
        color: var(--accent);
    }
    .sidebar-nav a.active::before {
        content: '';
        position: absolute;
        left: -10px;
        top: 8px;
        bottom: 8px;
        width: 3px;
        border-radius: 3px;
        background: var(--accent);
    }
    .sidebar-nav a svg { width: 20px; height: 20px; flex-shrink: 0; }

    .sidebar-footer {
        padding: 14px 22px;
        border-top: 1px solid var(--border-soft);
        margin-top: auto;
    }
    .sidebar-footer svg { width: 18px; height: 18px; flex-shrink: 0; }

    .modal { border-radius: var(--radius-lg); }
    .modal-overlay { align-items: center; }

    .page-content { padding: 24px; }
    .toast-container { left: auto; }
}

/* ============ DESKTOP ( >=1024px ) : center + wider ============ */
@media (min-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }

    .app-container { padding-left: 260px; }
    .sidebar { width: 260px; }

    /* Centre content on wide screens for readability */
    .page-header, .page-content {
        max-width: var(--content-max);
        margin-left: auto;
        margin-right: auto;
    }
    .page-header { padding: 18px 24px; }
    .page-content { padding: 24px; }
}

@media (min-width: 1440px) {
    :root { --content-max: 1320px; }
}

/* Two-column content layouts (reports side-by-side cards, detail pages) */
@media (min-width: 1024px) {
    .two-col {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
        align-items: start;
    }
    .two-col > * { margin-bottom: 0; }

    /* Detail page: wide main column + narrower aside */
    .detail-grid {
        display: grid;
        grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
        gap: 16px;
        align-items: start;
    }
    .detail-grid > .detail-full { grid-column: 1 / -1; margin-bottom: 0; }
    .detail-grid .detail-col { display: flex; flex-direction: column; }
    .detail-grid .detail-col > *:last-child { margin-bottom: 0; }
}

/* ============ MOBILE ( <768px ) ============ */
@media (max-width: 767px) {
    .sidebar { display: none !important; }
    .desktop-only { display: none !important; }
}

/* Print */
@media print {
    .bottom-nav, .sidebar, .page-header, .nav-more-menu, .tabs { display: none !important; }
    .app-container { padding: 0 !important; }
    body { background: #fff; color: #000; }
    .card, .order-card, .kitchen-card { box-shadow: none; border-color: #ccc; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    .reveal { opacity: 1 !important; transform: none !important; }
}

/* ============================================================
   BRAND REFINEMENTS
   Tightens the interface into something that reads as a business
   tool rather than a consumer app: flat surfaces, a single accent,
   clear hierarchy and restrained motion.
   ============================================================ */

/* Buttons: solid brand primary, quiet secondary */
.btn {
    font-weight: 600;
    letter-spacing: 0;
    box-shadow: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary {
    background: var(--brand-500);
    border: 1px solid var(--brand-500);
    color: #fff;
}
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--text-muted); }
.btn-success { background: var(--brand-500); border: 1px solid var(--brand-500); color: #fff; }
.btn-danger  { background: var(--danger);  border: 1px solid var(--danger);  color: #fff; }

/* Cards: hairline borders, minimal shadow */
.card,
.order-card,
.kitchen-card,
.delivery-card,
.stat-card,
.login-card {
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius);
}
.card-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 14px;
}
.card-header h3 { font-size: .95rem; font-weight: 650; letter-spacing: -.01em; }

/* Stats: number-first, brand-tinted rule on top */
.stat-value { font-weight: 750; letter-spacing: -.03em; color: var(--text-primary); }
.stat-label { color: var(--text-muted); font-weight: 500; letter-spacing: .01em; text-transform: none; }
.stat-ico { opacity: .75; }
.stat-card.c-accent  { --c: var(--brand-500); }
.stat-card.c-success { --c: var(--success); }
.stat-card.c-warning { --c: var(--warning); }
.stat-card.c-info    { --c: var(--info); }

/* Page header: a plain title bar, not a floating glass panel */
.page-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.page-header h1 { font-size: 1.22rem; font-weight: 700; letter-spacing: -.02em; }

/* Sidebar: brand-marked, quiet nav with a solid active state */
.sidebar { background: var(--bg-secondary); border-right: 1px solid var(--border); }
.sidebar-logo {
    border-bottom: 1px solid var(--border);
    padding-bottom: 18px;
    display: flex;
    align-items: center;
}
.sidebar-logo img { width: 148px; max-width: 100%; height: auto; display: block; }
.sidebar-logo h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text-primary);
    margin-top: 10px;
}
.sidebar-nav a {
    border-radius: var(--radius-sm);
    font-weight: 550;
    color: var(--text-secondary);
}
.sidebar-nav a:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-nav a.active {
    background: var(--brand-500);
    color: #fff;
}
.sidebar-nav a.active svg { color: #fff; }

/* Bottom nav (mobile) */
.bottom-nav { background: var(--bg-secondary); border-top: 1px solid var(--border); backdrop-filter: none; }
.nav-item.active { color: var(--brand-500); }

/* Tables: the workhorse surface — make them legible and dense */
table { font-size: .88rem; }
th {
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: .74rem;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
td { border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--bg-hover); }

/* Inputs: clear focus ring in brand green */
.form-control, input, select, textarea { border-radius: var(--radius-sm); }
.form-control:focus, input:focus, select:focus, textarea:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--accent-light);
    outline: none;
}

/* Badges: flat, readable */
.badge { font-weight: 600; letter-spacing: .01em; border-radius: 5px; }

/* Tabs */
/* Pill tabs: solid brand fill, white label. Overrides the old gradient +
   coloured glow, which left dark text sitting on a dark background. */
.tab {
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.tab.active {
    background: var(--brand-500);
    color: #fff;
    border-color: var(--brand-500);
    box-shadow: none;
}
.tab.active:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.tab .count { background: rgba(255,255,255,.22); color: inherit; }

/* Links */
a { color: var(--brand-500); }
a:hover { color: var(--brand-600); }

/* Respect reduced-motion, and keep motion minimal regardless */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Stat icons use the same SVG set as the navigation, tinted per card */
.stat-ico svg { width: 20px; height: 20px; color: var(--c, var(--brand-500)); }

/* The impersonation banner sits above everything; the fixed sidebar and the
   sticky page header have to start below it rather than under it. */
body.is-impersonating .sidebar { top: 38px; }
body.is-impersonating .page-header { top: 38px; }
@media (max-width: 900px) {
    body.is-impersonating .sidebar { top: 0; }
}
