/* ============================================================
   AppFont POS - La Fontana Cox
   Professional POS System - Complete UI
   ============================================================ */

:root {
    /* Brand */
    --primary: #c62828;
    --primary-dark: #8e0000;
    --primary-light: #ff5f52;
    --primary-bg: #fef2f2;

    /* Semantic */
    --green: #2e7d32;
    --green-light: #4caf50;
    --green-bg: #f0fdf4;
    --orange: #ef6c00;
    --orange-bg: #fff7ed;
    --blue: #1565c0;
    --blue-bg: #eff6ff;
    --yellow: #f9a825;
    --purple: #7b1fa2;

    /* Neutrals */
    --bg: #f5f5f5;
    --bg-card: #ffffff;
    --bg-hover: #fafafa;
    --border: #e5e7eb;
    --border-dark: #d1d5db;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --white: #ffffff;

    /* Dimensions */
    --sidebar-w: 220px;
    --sidebar-collapsed: 68px;
    --topbar-h: 56px;
    --bnav-h: 60px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow: 0 2px 8px rgba(0,0,0,.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,.15);
    --shadow-xl: 0 16px 50px rgba(0,0,0,.2);

    /* Font */
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;

    /* Transitions */
    --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; -webkit-box-sizing: border-box; box-sizing: border-box; }
html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 15px;
    background: #f5f5f5;
    color: #1f2937;
    height: 100%;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}
input, button, select, textarea { font-family: inherit; font-size: inherit; }
a { color: #1565c0; text-decoration: none; }
.hidden { display: none !important; }

/* ============================================================
   SCREENS
   ============================================================ */
.screen { display: none; height: 100%; }
.screen.active { display: -webkit-box; display: -webkit-flex; display: flex; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-container {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; -webkit-box-align: center; -webkit-align-items: center; align-items: center;
    -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center; height: 100%; width: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffffff; padding: 20px;
}
.login-brand { text-align: center; margin-bottom: 36px; }
.login-logo-icon { margin-bottom: 12px; }
.login-brand h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -1px; }
.login-brand p { opacity: .6; font-size: .95rem; margin-top: 4px; }
.pin-display { display: -webkit-box; display: -webkit-flex; display: flex; gap: 16px; margin-bottom: 32px; }
.pin-dot {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.35);
    -webkit-transition: all .2s cubic-bezier(.4, 0, .2, 1); transition: all .2s cubic-bezier(.4, 0, .2, 1);
}
.pin-dot.filled { background: #ffffff; border-color: #ffffff; -webkit-transform: scale(1.15); transform: scale(1.15); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 74px); gap: 12px; }
.pin-btn {
    width: 74px; height: 74px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.2); background: rgba(255,255,255,.07);
    color: #ffffff; font-size: 1.5rem; font-weight: 600;
    cursor: pointer; -webkit-transition: all .15s cubic-bezier(.4, 0, .2, 1); transition: all .15s cubic-bezier(.4, 0, .2, 1);
    -webkit-user-select: none; -webkit-user-select: none; user-select: none;
}
.pin-btn:active { background: rgba(255,255,255,.25); -webkit-transform: scale(.9); transform: scale(.9); }
.pin-special { font-size: 1.1rem; font-weight: 700; }
.login-compact .login-brand { margin-bottom: 20px; }
.login-compact .login-brand h1 { font-size: 1.6rem; }
.pin-pad-compact { gap: 8px; }
.pin-pad-compact .pin-btn { width: 62px; height: 62px; font-size: 1.3rem; }
.login-error { color: #fca5a5; margin-top: 20px; min-height: 22px; font-size: .9rem; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
#app-screen {
    -webkit-box-orient: vertical; -webkit-box-direction: normal;
    -webkit-flex-direction: column; flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ============================================================
   SIDEBAR (desktop >= 900px)
   ============================================================ */
.sidebar {
    display: none;
    -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
    width: 220px;
    background: #1e293b;
    color: #ffffff;
    -webkit-flex-shrink: 0; flex-shrink: 0;
    z-index: 30;
    overflow: hidden;
}
.sidebar-brand {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 10px;
    padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
    width: 36px; height: 36px; border-radius: 10px;
    background: #c62828; color: #ffffff;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    font-weight: 800; font-size: 1.1rem; -webkit-flex-shrink: 0; flex-shrink: 0;
}
.sidebar-name { font-weight: 700; font-size: 1rem; white-space: nowrap; }
.sidebar-nav { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; padding: 8px; overflow-y: auto; }
.nav-item {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 12px;
    width: 100%; padding: 12px 14px; border: none;
    background: transparent; color: rgba(255,255,255,.6);
    border-radius: 10px; cursor: pointer;
    font-size: .9rem; font-weight: 600; -webkit-transition: all .15s cubic-bezier(.4, 0, .2, 1); transition: all .15s cubic-bezier(.4, 0, .2, 1);
    text-align: left; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.85); }
.nav-item.active { background: #c62828; color: #ffffff; }
.nav-icon { font-size: 1.15rem; width: 24px; text-align: center; -webkit-flex-shrink: 0; flex-shrink: 0; }
.nav-label { white-space: nowrap; }
.sidebar-footer {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between;
    padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 8px; }
.sidebar-user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,.15); display: -webkit-box; display: -webkit-flex; display: flex;
    -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    font-weight: 700; font-size: .85rem;
}
.sidebar-user-name { font-size: .85rem; font-weight: 600; opacity: .8; }
.sidebar-logout {
    width: 34px; height: 34px; border: none; border-radius: 50%;
    background: rgba(255,255,255,.08); color: rgba(255,255,255,.5);
    cursor: pointer; font-size: 1rem; -webkit-transition: all .15s; transition: all .15s;
}
.sidebar-logout:hover { background: #c62828; color: #ffffff; }

/* ============================================================
   TOPBAR (mobile)
   ============================================================ */
.topbar {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between;
    padding: 0 12px; height: 56px;
    background: #ffffff; border-bottom: 1px solid #e5e7eb;
    -webkit-flex-shrink: 0; flex-shrink: 0; z-index: 20;
}
.topbar-menu {
    width: 40px; height: 40px; border: none; background: none;
    font-size: 1.3rem; cursor: pointer; color: #1f2937;
    border-radius: 10px;
}
.topbar-menu:active { background: #f5f5f5; }
.topbar-title { font-size: 1.1rem; font-weight: 700; }
.topbar-actions { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 10px; }
.topbar-clock { font-size: .82rem; color: #6b7280; font-weight: 600; font-variant-numeric: tabular-nums; }
.topbar-user {
    width: 32px; height: 32px; border-radius: 50%;
    background: #c62828; color: #ffffff;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    font-weight: 700; font-size: .8rem;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
    overflow: hidden; min-width: 0;
}
.tab-content {
    display: none; -webkit-box-flex: 1; -webkit-flex: 1; flex: 1;
    overflow-y: auto; overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
.tab-content.active { display: block; }

/* ============================================================
   BOTTOM NAV (mobile)
   ============================================================ */
.bottom-nav {
    display: -webkit-box; display: -webkit-flex; display: flex; height: 60px;
    background: #ffffff; border-top: 1px solid #e5e7eb;
    -webkit-flex-shrink: 0; flex-shrink: 0; z-index: 20;
}
.bnav-item {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
    -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    border: none; background: none; color: #9ca3af;
    font-size: .65rem; font-weight: 600; cursor: pointer;
    gap: 2px; -webkit-transition: color .15s; transition: color .15s;
    -webkit-user-select: none; -webkit-user-select: none; user-select: none;
}
.bnav-item.active { color: #c62828; }
.bnav-icon { font-size: 1.25rem; }
.bnav-label { line-height: 1; }

/* ============================================================
   GENERIC COMPONENTS
   ============================================================ */

/* Buttons */
.btn {
    display: inline-flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    gap: 6px; padding: 10px 18px; border: none; border-radius: 10px;
    font-size: .9rem; font-weight: 700; cursor: pointer;
    -webkit-transition: all .15s cubic-bezier(.4, 0, .2, 1); transition: all .15s cubic-bezier(.4, 0, .2, 1);
    -webkit-user-select: none; -webkit-user-select: none; user-select: none;
    white-space: nowrap;
}
.btn:active { -webkit-transform: scale(.96); transform: scale(.96); }
.btn-primary { background: #c62828; color: #ffffff; }
.btn-primary:hover { background: #8e0000; }
.btn-primary:disabled { background: #9ca3af; cursor: not-allowed; -webkit-transform: none; transform: none; }
.btn-accent { background: #1565c0; color: #ffffff; }
.btn-accent:hover { background: #0d47a1; }
.btn-success { background: #2e7d32; color: #ffffff; }
.btn-success:hover { background: #1b5e20; }
.btn-outline { background: none; border: 2px solid #d1d5db; color: #1f2937; }
.btn-outline:hover { border-color: #c62828; color: #c62828; }
.btn-ghost { background: none; border: none; color: #6b7280; padding: 8px 12px; }
.btn-ghost:hover { color: #c62828; background: #fef2f2; }
.btn-sm { padding: 7px 12px; font-size: .8rem; border-radius: 8px; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; border-radius: 14px; width: 100%; }
.btn-icon-round {
    width: 42px; height: 42px; border: 2px solid #e5e7eb;
    border-radius: 50%; background: #ffffff; cursor: pointer;
    font-size: 1.1rem; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    -webkit-flex-shrink: 0; flex-shrink: 0; -webkit-transition: all .15s; transition: all .15s;
}
.btn-icon-round:active { background: #f5f5f5; -webkit-transform: scale(.93); transform: scale(.93); }

/* Inputs */
.input-field {
    width: 100%; padding: 12px 14px; border: 2px solid #e5e7eb;
    border-radius: 10px; font-size: .95rem; outline: none;
    background: #ffffff; color: #1f2937;
    -webkit-transition: border-color .2s; transition: border-color .2s;
}
.input-field:focus { border-color: #c62828; }
.input-field::placeholder { color: #9ca3af; }
.input-sm { padding: 8px 10px; font-size: .85rem; width: auto; }
.input-lg { padding: 16px; font-size: 1.2rem; text-align: center; }
.input-search {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; padding: 12px 16px; border: 2px solid #e5e7eb;
    border-radius: 24px; font-size: .95rem; outline: none;
    background: #f5f5f5; -webkit-transition: all .2s; transition: all .2s;
}
.input-search:focus { border-color: #c62828; background: #ffffff; box-shadow: 0 0 0 3px #fef2f2; }
.select-sm {
    padding: 8px 12px; border: 2px solid #e5e7eb;
    border-radius: 8px; font-size: .85rem; font-weight: 600;
    background: #ffffff; color: #1f2937; cursor: pointer;
    outline: none;
}
.select-sm:focus { border-color: #c62828; }
.field-label {
    display: block; font-size: .82rem; font-weight: 700;
    color: #6b7280; margin: 12px 0 6px;
    text-transform: uppercase; letter-spacing: .5px;
}
.field-label:first-child { margin-top: 0; }

/* Cards */
.card {
    background: #ffffff; border-radius: 14px;
    padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
    border: 1px solid #e5e7eb;
}
.card-title {
    font-size: .78rem; font-weight: 700; color: #6b7280;
    text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px;
}

/* Text colors */
.text-green { color: #2e7d32; }
.text-red { color: #c62828; }
.text-blue { color: #1565c0; }
.text-orange { color: #ef6c00; }
.text-muted { color: #9ca3af; }

/* ============================================================
   SECTION HEADERS (shared pattern)
   ============================================================ */
.section-header, .panel-header, .cash-header, .reports-header, .kds-header-bar {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between;
    padding: 14px 16px; -webkit-flex-shrink: 0; flex-shrink: 0;
    background: #ffffff; border-bottom: 1px solid #e5e7eb;
    gap: 10px; -webkit-flex-wrap: wrap; flex-wrap: wrap;
}
.section-header h3, .panel-header h3, .cash-header h3, .reports-header h3, .kds-header-bar h3 {
    font-size: 1.05rem; font-weight: 700;
}
.section-header-actions, .cash-header-actions, .reports-controls {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 8px; -webkit-flex-wrap: wrap; flex-wrap: wrap;
}

/* ============================================================
   ORDERS TAB
   ============================================================ */
.orders-layout {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; display: -webkit-box; display: -webkit-flex; display: flex; overflow: hidden;
}
.orders-panel {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; overflow: hidden;
}
.orders-list-panel { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; min-width: 0; }
.orders-detail-panel {
    display: none; /* hidden on mobile */
    width: 420px; -webkit-flex-shrink: 0; flex-shrink: 0;
    border-left: 1px solid #e5e7eb;
    background: #f5f5f5;
}
.orders-filters {
    padding: 10px 12px; -webkit-flex-shrink: 0; flex-shrink: 0;
    background: #ffffff; border-bottom: 1px solid #e5e7eb;
}
.filter-tabs {
    display: -webkit-box; display: -webkit-flex; display: flex; gap: 4px; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}
.filter-tab {
    padding: 7px 14px; border: none; border-radius: 20px;
    font-size: .8rem; font-weight: 700; cursor: pointer;
    background: #f5f5f5; color: #6b7280;
    white-space: nowrap; -webkit-flex-shrink: 0; flex-shrink: 0;
    -webkit-transition: all .15s cubic-bezier(.4, 0, .2, 1); transition: all .15s cubic-bezier(.4, 0, .2, 1);
}
.filter-tab:hover { background: #e5e7eb; }
.filter-tab.active { background: #c62828; color: #ffffff; }
.filter-row { margin-top: 8px; display: -webkit-box; display: -webkit-flex; display: flex; gap: 8px; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-flex-wrap: wrap; flex-wrap: wrap; }
.orders-list {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; overflow-y: auto; padding: 8px;
    -webkit-overflow-scrolling: touch;
}

/* Order Card */
.order-card {
    background: #ffffff; border-radius: 10px;
    padding: 14px; margin-bottom: 8px;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #9ca3af;
    cursor: pointer; -webkit-transition: all .15s cubic-bezier(.4, 0, .2, 1); transition: all .15s cubic-bezier(.4, 0, .2, 1);
}
.order-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.order-card.selected { border-color: #c62828; box-shadow: 0 0 0 2px #fef2f2; }
.order-card.st-pending { border-left-color: #f9a825; }
.order-card.st-preparing { border-left-color: #ef6c00; }
.order-card.st-ready { border-left-color: #4caf50; }
.order-card.st-delivering { border-left-color: #1565c0; }
.order-card.st-delivered { border-left-color: #9ca3af; }
.order-card.st-cancelled { border-left-color: #c62828; opacity: .6; }

.order-top { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 8px; -webkit-flex-wrap: wrap; flex-wrap: wrap; margin-bottom: 6px; }
.order-num { font-weight: 800; font-size: 1.05rem; }
.order-time { font-size: .78rem; color: #9ca3af; }
.order-total { font-weight: 800; color: #c62828; margin-left: auto; }
.order-badge {
    display: inline-flex; padding: 3px 8px; border-radius: 6px;
    font-size: .68rem; font-weight: 700; color: #ffffff;
    letter-spacing: .3px;
}
.badge-dine_in { background: #2e7d32; }
.badge-pickup { background: #ef6c00; }
.badge-delivery { background: #c62828; }
.badge-online { background: #1565c0; }
.badge-pending { background: #f9a825; color: #1f2937; }
.badge-preparing { background: #ef6c00; }
.badge-ready { background: #4caf50; -webkit-animation: pulse-badge 1.5s infinite; animation: pulse-badge 1.5s infinite; }
.badge-delivering { background: #1565c0; }
.badge-delivered { background: #9ca3af; }
.badge-cancelled { background: #c62828; }
@keyframes pulse-badge { 0%,100% { opacity:1; } 50% { opacity:.5; } }

.order-client { font-size: .85rem; font-weight: 600; }
.order-addr { font-size: .8rem; color: #1565c0; }
.order-items-preview { font-size: .8rem; color: #6b7280; line-height: 1.4; margin-top: 4px; }
.order-note { font-size: .78rem; color: #ef6c00; font-style: italic; margin-top: 4px; }

/* Quick Actions */
.quick-actions {
    display: -webkit-box; display: -webkit-flex; display: flex; gap: 6px; margin-top: 10px;
    padding-top: 10px; border-top: 1px solid #e5e7eb;
    -webkit-flex-wrap: wrap; flex-wrap: wrap;
}
.qbtn {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; min-width: 60px; padding: 10px 8px;
    border: none; border-radius: 8px;
    font-size: .82rem; font-weight: 700;
    cursor: pointer; color: #ffffff;
    -webkit-transition: all .12s cubic-bezier(.4, 0, .2, 1); transition: all .12s cubic-bezier(.4, 0, .2, 1);
    text-align: center;
}
.qbtn:active { -webkit-transform: scale(.95); transform: scale(.95); }
.qbtn-green { background: #2e7d32; }
.qbtn-blue { background: #1565c0; }
.qbtn-orange { background: #ef6c00; }
.qbtn-gray { background: #6b7280; font-size: .75rem; }
.qbtn-red { background: #c62828; }
.btn-success { background: #2e7d32; color: #fff; border: none; }

/* Half pizza toggle */
.half-toggle {
    display: -webkit-box; display: -webkit-flex; display: flex;
    gap: 6px; margin-bottom: 12px; padding: 4px;
    background: #f5f5f5; border-radius: 10px;
}
.half-btn {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1;
    padding: 10px 8px; border: 2px solid transparent; border-radius: 8px;
    background: transparent; cursor: pointer; text-align: center;
    font-size: .82rem; font-weight: 700; color: #6b7280;
    -webkit-transition: all .12s; transition: all .12s;
}
.half-btn.active {
    background: #fff; border-color: #c62828; color: #c62828;
    box-shadow: 0 2px 6px rgba(198,40,40,.15);
}
.half-btn:active { -webkit-transform: scale(.95); transform: scale(.95); }

/* Order Type Picker - Full screen overlay for mobile */
.order-type-picker {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: #ffffff; z-index: 15;
    display: block;
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.order-type-picker.hidden { display: none; }
.otp-inner { width: 100%; max-width: 400px; text-align: center; margin: 0 auto; }
.otp-title { font-size: 1.2rem; font-weight: 800; color: #c62828; margin-bottom: 2px; }
.otp-sub { font-size: .78rem; color: #6b7280; margin-bottom: 10px; }
.otp-buttons {
    display: -webkit-box; display: -webkit-flex; display: flex;
    gap: 8px; margin-bottom: 10px;
}
.otp-btn {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1;
    padding: 12px 6px; border: 3px solid #e5e7eb; border-radius: 12px;
    background: #fff; cursor: pointer; text-align: center;
    -webkit-transition: all .12s; transition: all .12s;
    min-height: 60px;
}
.otp-btn:active { -webkit-transform: scale(.95); transform: scale(.95); }
.otp-btn.active {
    border-color: #c62828; background: #fef2f2;
    box-shadow: 0 0 0 2px rgba(198,40,40,.2);
}
.otp-icon { display: block; font-size: 1.8rem; margin-bottom: 4px; }
.otp-label { display: block; font-size: .85rem; font-weight: 700; color: #1f2937; }
.otp-fields { margin-top: 10px; text-align: left; }
.otp-fields .input-field { margin-bottom: 6px; padding: 10px; font-size: .9rem; }
.otp-field-label { font-size: .75rem; font-weight: 600; color: #6b7280; margin-bottom: 4px; }
.otp-start { width: 100%; margin-top: 10px; padding: 14px; font-size: 1.05rem; font-weight: 800; border-radius: 10px; letter-spacing: .5px; position: sticky; bottom: 0; }
.otp-start:active { -webkit-transform: scale(.97); transform: scale(.97); }
.otp-table-grid {
    display: -webkit-box; display: -webkit-flex; display: flex;
    -webkit-flex-wrap: wrap; flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
}
.otp-table-btn {
    padding: 8px 14px; border: 2px solid #e5e7eb; border-radius: 8px;
    background: #fff; cursor: pointer; font-size: .82rem; font-weight: 600;
}
.otp-table-btn.active { border-color: #c62828; background: #fef2f2; color: #c62828; }
.otp-table-btn.occupied { opacity: .4; }
.otp-zones {
    display: -webkit-box; display: -webkit-flex; display: flex;
    -webkit-flex-wrap: wrap; flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
}
.otp-zone-btn {
    padding: 8px 14px; border: 2px solid #e5e7eb; border-radius: 8px;
    background: #fff; cursor: pointer; font-size: .82rem; font-weight: 600;
}
.otp-zone-btn.active { border-color: #c62828; background: #fef2f2; color: #c62828; }

/* Hide picker on desktop (cart panel is visible) */
@media (min-width: 900px) {
    .order-type-picker { display: none !important; }
}
.qbtn-pay {
    background: #ffffff; color: #1f2937;
    border: 2px solid #e5e7eb;
}
.qbtn-pay:active { background: #2e7d32; color: #ffffff; border-color: #2e7d32; }
.qselect {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; min-width: 90px; padding: 9px 10px;
    border: 2px solid #e5e7eb; border-radius: 8px;
    font-size: .82rem; font-weight: 600;
}
.pay-label { font-size: .78rem; font-weight: 700; color: #6b7280; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; }
.pay-done { font-size: .82rem; color: #2e7d32; font-weight: 700; margin-top: 8px; }

/* Order Detail Panel */
.detail-placeholder {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; -webkit-box-align: center; -webkit-align-items: center; align-items: center;
    -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center; height: 100%; color: #9ca3af;
    gap: 10px;
}
.detail-placeholder-icon { font-size: 3rem; opacity: .3; }
.detail-placeholder p { font-size: .9rem; }
.order-detail-content { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; overflow-y: auto; padding: 16px; }

.detail-section {
    background: #ffffff; border-radius: 10px;
    padding: 16px; margin-bottom: 12px;
    border: 1px solid #e5e7eb;
}
.detail-section-title {
    font-size: .75rem; font-weight: 700; color: #6b7280;
    text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px;
}
.detail-row {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between; -webkit-box-align: center; -webkit-align-items: center; align-items: center;
    padding: 6px 0; font-size: .9rem;
}
.detail-row + .detail-row { border-top: 1px solid #f5f5f5; }

.od-item {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between; padding: 8px 0;
    font-size: .9rem; border-bottom: 1px solid #f5f5f5;
}
.od-option { padding: 3px 0 3px 20px; font-size: .82rem; color: #6b7280; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between; }
.od-note { padding: 3px 0 3px 20px; font-size: .82rem; color: #ef6c00; }
.od-total {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between; font-weight: 800;
    font-size: 1.15rem; border-top: 2px solid #1f2937;
    margin-top: 8px; padding-top: 10px;
}
.detail-actions { display: -webkit-box; display: -webkit-flex; display: flex; gap: 8px; margin-top: 12px; }
.detail-actions .btn { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; }

/* ============================================================
   NEW ORDER TAB
   ============================================================ */
.new-order-layout {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; display: -webkit-box; display: -webkit-flex; display: flex; overflow: hidden;
}
.menu-panel {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
    min-width: 0; overflow: hidden;
}
.menu-header {
    padding: 10px 12px; -webkit-flex-shrink: 0; flex-shrink: 0;
    background: #ffffff; border-bottom: 1px solid #e5e7eb;
}
.menu-search { display: -webkit-box; display: -webkit-flex; display: flex; gap: 8px; margin-bottom: 8px; }
.categories-bar {
    display: -webkit-box; display: -webkit-flex; display: flex; gap: 6px; overflow-x: auto;
    padding: 4px 0; -webkit-overflow-scrolling: touch;
}
.cat-btn {
    padding: 7px 16px; border: none; border-radius: 20px;
    font-size: .82rem; font-weight: 700;
    background: #f5f5f5; color: #6b7280;
    cursor: pointer; white-space: nowrap; -webkit-flex-shrink: 0; flex-shrink: 0;
    -webkit-transition: all .15s cubic-bezier(.4, 0, .2, 1); transition: all .15s cubic-bezier(.4, 0, .2, 1);
}
.cat-btn:hover { background: #e5e7eb; }
.cat-btn.active { background: #c62828; color: #ffffff; }

.products-grid {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px; padding: 10px;
    overflow-y: auto; align-content: start;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 80px;
}
.product-btn {
    padding: 14px 8px; border: none; border-radius: 10px;
    background: #ffffff; border: 1px solid #e5e7eb;
    cursor: pointer; text-align: center;
    -webkit-transition: all .12s cubic-bezier(.4, 0, .2, 1); transition: all .12s cubic-bezier(.4, 0, .2, 1);
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; -webkit-box-align: center; -webkit-align-items: center; align-items: center;
    gap: 4px; min-height: 80px; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
}
.product-btn:hover { border-color: #c62828; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.product-btn:active { -webkit-transform: scale(.95); transform: scale(.95); }
.product-code {
    font-size: .6rem; font-weight: 800; color: #c62828;
    background: #fef2f2; padding: 2px 6px; border-radius: 4px;
}
.product-name { font-size: .78rem; font-weight: 600; line-height: 1.2; word-break: break-word; }
.product-price { font-size: .85rem; font-weight: 800; color: #2e7d32; }

/* CART PANEL (desktop - always visible on right) */
.cart-panel {
    display: none; /* hidden on mobile; shown on desktop */
    width: 360px; -webkit-flex-shrink: 0; flex-shrink: 0;
    -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
    background: #ffffff;
    border-left: 1px solid #e5e7eb;
    overflow: hidden;
}
.cart-header {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid #e5e7eb;
}
.cart-header h3 { font-size: 1rem; font-weight: 700; }
.cart-type-selector {
    display: -webkit-box; display: -webkit-flex; display: flex; gap: 4px; padding: 10px 12px;
    background: #f5f5f5; border-bottom: 1px solid #e5e7eb;
}
.type-btn {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; padding: 10px 6px; border: 2px solid transparent;
    border-radius: 10px; background: #ffffff;
    font-size: .78rem; font-weight: 700; cursor: pointer;
    text-align: center; -webkit-transition: all .15s cubic-bezier(.4, 0, .2, 1); transition: all .15s cubic-bezier(.4, 0, .2, 1);
    color: #6b7280;
}
.type-btn:hover { border-color: #d1d5db; }
.type-btn.active { border-color: #c62828; color: #c62828; background: #fef2f2; }

.cart-customer {
    padding: 10px 12px; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
    gap: 8px; border-bottom: 1px solid #e5e7eb;
    position: relative;
}
.cart-customer .input-field { padding: 10px 12px; font-size: .88rem; }

.zone-selector { display: -webkit-box; display: -webkit-flex; display: flex; gap: 4px; }
.zone-chip {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; text-align: center; cursor: pointer;
}
.zone-chip input { display: none; }
.zone-chip span {
    display: block; padding: 8px 4px; border-radius: 8px;
    font-size: .82rem; font-weight: 700;
    background: #f5f5f5; color: #6b7280;
    -webkit-transition: all .15s; transition: all .15s;
}
.zone-chip input:checked + span {
    background: #c62828; color: #ffffff;
}

.cart-items {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; overflow-y: auto; padding: 8px 12px;
    -webkit-overflow-scrolling: touch;
}
.cart-empty {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; -webkit-box-align: center; -webkit-align-items: center; align-items: center;
    -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center; height: 200px;
    color: #9ca3af; gap: 8px;
}
.cart-empty span { font-size: 2.5rem; opacity: .4; }
.cart-empty p { font-size: .9rem; }

.cart-item {
    padding: 10px 0; border-bottom: 1px solid #e5e7eb;
}
.cart-item-top { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between; -webkit-box-align: flex-start; -webkit-align-items: flex-start; align-items: flex-start; gap: 8px; }
.cart-item-info { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; min-width: 0; }
.cart-item-name { font-weight: 700; font-size: .9rem; }
.cart-item-name small { font-weight: 400; color: #6b7280; }
.cart-item-opts { font-size: .78rem; color: #6b7280; margin-top: 2px; }
.cart-item-note { font-size: .78rem; color: #ef6c00; margin-top: 2px; }
.cart-item-price { font-weight: 800; color: #c62828; white-space: nowrap; }
.cart-item-actions { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 4px; margin-top: 6px; }
.cart-act {
    height: 32px; min-width: 32px; padding: 0 8px;
    border: 1px solid #e5e7eb; border-radius: 6px;
    background: #ffffff; font-size: .85rem; font-weight: 700;
    cursor: pointer; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    -webkit-transition: all .1s; transition: all .1s;
}
.cart-act:active { -webkit-transform: scale(.93); transform: scale(.93); }
.ca-minus { color: #c62828; }
.ca-plus { color: #2e7d32; }
.ca-edit { color: #1565c0; }
.ca-del { color: #ffffff; background: #c62828; border-color: #c62828; }
.cart-qty { font-weight: 800; min-width: 20px; text-align: center; font-size: .9rem; }

.cart-notes { padding: 8px 12px; border-top: 1px solid #e5e7eb; }
.cart-notes .input-field { padding: 8px 10px; font-size: .85rem; resize: none; }
.cart-totals { padding: 8px 16px; border-top: 1px solid #e5e7eb; }
.cart-row { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between; padding: 4px 0; font-size: .9rem; }
.cart-row-total { font-size: 1.3rem; font-weight: 800; padding: 8px 0; }
.cart-actions {
    display: -webkit-box; display: -webkit-flex; display: flex; gap: 8px; padding: 12px 16px;
    border-top: 1px solid #e5e7eb; -webkit-box-align: center; -webkit-align-items: center; align-items: center;
}
.cart-actions .btn-lg { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; }

/* FAB Cart (mobile only) */
.fab-cart {
    position: fixed; bottom: calc(60px + 16px); right: 16px;
    background: #c62828; color: #ffffff;
    border: none; border-radius: 28px; padding: 12px 20px;
    font-size: .95rem; font-weight: 700; box-shadow: 0 8px 30px rgba(0,0,0,.15);
    cursor: pointer; z-index: 15;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 10px;
    -webkit-animation: fab-in .3s cubic-bezier(.4, 0, .2, 1); animation: fab-in .3s cubic-bezier(.4, 0, .2, 1);
}
.fab-cart:active { -webkit-transform: scale(.93); transform: scale(.93); }
.fab-count {
    background: #ffffff; color: #c62828;
    width: 26px; height: 26px; border-radius: 50%;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    font-size: .85rem; font-weight: 800;
}
@keyframes fab-in { from { opacity:0; -webkit-transform: translateY(20px); transform: translateY(20px); } }

/* ============================================================
   KITCHEN DISPLAY (KDS)
   ============================================================ */
.kds-counter { font-size: .85rem; color: #6b7280; font-weight: 600; }
.kds-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px; padding: 12px; -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; overflow-y: auto;
    align-content: start; -webkit-overflow-scrolling: touch;
}
.kds-empty {
    grid-column: 1/-1; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
    -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    color: #9ca3af; padding: 80px 20px;
    font-size: 1.1rem; gap: 8px;
}
.kds-card {
    background: #ffffff; border-radius: 14px;
    padding: 16px; border: 1px solid #e5e7eb;
    border-left: 5px solid #ef6c00;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.kds-card.kds-urgent { border-left-color: #c62828; background: #fef2f2; }
.kds-top { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 8px; -webkit-flex-wrap: wrap; flex-wrap: wrap; margin-bottom: 10px; }
.kds-num { font-weight: 800; font-size: 1.4rem; }
.kds-time { font-size: .8rem; color: #9ca3af; margin-left: auto; font-weight: 600; }
.kds-client { font-weight: 700; font-size: .9rem; margin-bottom: 8px; color: #1f2937; }
.kds-items { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; margin-bottom: 10px; }
.kds-item {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: flex-start; -webkit-align-items: flex-start; align-items: flex-start; gap: 8px;
    padding: 8px 6px; font-size: .95rem; cursor: pointer;
    border-bottom: 1px solid #f5f5f5; border-radius: 6px;
    -webkit-transition: background .15s; transition: background .15s;
}
.kds-item:hover { background: rgba(0,0,0,.03); }
.kds-item-check { font-size: 1.2rem; -webkit-flex-shrink: 0; flex-shrink: 0; margin-top: 2px; }
.kds-item-body { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; }
.kds-item-name { font-size: 1rem; }
.kds-item-name b { font-weight: 900; }
.kds-item-done { opacity: .35; }
.kds-item-done .kds-item-name { text-decoration: line-through; }
.kds-opt {
    display: block; padding: 2px 0 2px 16px;
    font-size: .85rem; font-weight: 600; margin-top: 2px;
}
.kds-opt-add { color: #2e7d32; }
.kds-opt-add::before { content: ''; }
.kds-opt-remove { color: #c62828; }
.kds-opt-remove::before { content: ''; }
.kds-item-note { color: #ef6c00; font-size: .82rem; font-weight: 600; margin-top: 3px; padding-left: 16px; }
.kds-note { color: #ef6c00; font-size: .82rem; font-weight: 600; margin-top: 2px; }
.kds-order-note {
    background: #ef6c00; color: #ffffff;
    padding: 8px 12px; border-radius: 8px;
    font-size: .85rem; font-weight: 700; margin-bottom: 10px;
}
.kds-done {
    padding: 14px; border: none; border-radius: 10px;
    background: #2e7d32; color: #ffffff;
    font-size: 1.05rem; font-weight: 800; cursor: pointer;
    -webkit-transition: all .12s cubic-bezier(.4, 0, .2, 1); transition: all .12s cubic-bezier(.4, 0, .2, 1);
}
.kds-done:active { -webkit-transform: scale(.96); transform: scale(.96); }
.kds-done:hover { background: #1b5e20; }

/* ============================================================
   CASH TAB
   ============================================================ */
.cash-grid {
    display: grid; grid-template-columns: 1fr;
    gap: 12px; padding: 12px; -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; overflow-y: auto;
    align-content: start; -webkit-overflow-scrolling: touch;
}
.cash-card {
    background: #ffffff; border-radius: 14px;
    padding: 18px; border: 1px solid #e5e7eb;
}
.cash-card h4 {
    font-size: .75rem; font-weight: 700; color: #6b7280;
    text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px;
}
.cash-big {
    font-size: 2.4rem; font-weight: 800; color: #c62828;
    margin-bottom: 6px;
}
.cash-row {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between;
    padding: 6px 0; font-size: .9rem;
    border-bottom: 1px solid #f5f5f5;
}
.cash-row-label { color: #6b7280; }
.cash-row-value { font-weight: 700; }

/* ============================================================
   REPORTS TAB
   ============================================================ */
.report-content {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; overflow-y: auto; padding: 12px;
    -webkit-overflow-scrolling: touch;
}
.rpt-card {
    background: #ffffff; border-radius: 14px;
    padding: 18px; margin-bottom: 12px;
    border: 1px solid #e5e7eb;
}
.rpt-card h4 {
    font-size: .75rem; font-weight: 700; color: #6b7280;
    text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px;
}
.rpt-big { font-size: 2.4rem; font-weight: 800; color: #c62828; margin-bottom: 8px; }
.rpt-row {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between;
    padding: 6px 0; font-size: .9rem;
    border-bottom: 1px solid #f5f5f5;
}
.rpt-row span:last-child { font-weight: 700; }
.rpt-highlight {
    border-top: 2px solid #1f2937; margin-top: 4px;
    padding-top: 8px; font-weight: 800; font-size: 1rem;
}
.rpt-highlight span:last-child { color: #c62828; }
.rpt-driver { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 2px solid #e5e7eb; }
.rpt-bar-row { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 8px; padding: 4px 0; font-size: .85rem; }
.rpt-bar-label { width: 48px; text-align: right; color: #6b7280; font-weight: 600; -webkit-flex-shrink: 0; flex-shrink: 0; }
.rpt-bar { height: 22px; background: #c62828; border-radius: 4px; min-width: 4px; -webkit-transition: width .4s cubic-bezier(.4, 0, .2, 1); transition: width .4s cubic-bezier(.4, 0, .2, 1); }
.rpt-bar-val { font-size: .78rem; color: #6b7280; white-space: nowrap; }

/* ============================================================
   CUSTOMERS TAB
   ============================================================ */
.data-list {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; overflow-y: auto; padding: 12px;
    -webkit-overflow-scrolling: touch;
}
.data-item {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between;
    padding: 14px 16px; background: #ffffff; border-radius: 10px;
    margin-bottom: 6px; border: 1px solid #e5e7eb;
    gap: 12px; -webkit-transition: box-shadow .15s; transition: box-shadow .15s;
}
.data-item:hover { box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.data-item-info { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; min-width: 0; }
.data-item-info b { font-size: .95rem; }
.data-item-info span { display: block; font-size: .82rem; color: #6b7280; margin-top: 2px; }
.data-item-actions { display: -webkit-box; display: -webkit-flex; display: flex; gap: 4px; -webkit-flex-shrink: 0; flex-shrink: 0; }

/* ============================================================
   CONFIG TAB
   ============================================================ */
.config-layout {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; overflow-y: auto; padding: 16px;
    -webkit-overflow-scrolling: touch;
}
.config-section {
    background: #ffffff; border-radius: 14px;
    margin-bottom: 16px; border: 1px solid #e5e7eb;
    overflow: hidden;
}
.config-section-header {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between;
    padding: 16px 18px; border-bottom: 1px solid #e5e7eb;
}
.config-section-header h4 { font-size: .95rem; font-weight: 700; }
.config-section-body { padding: 16px 18px; }
.config-list { padding: 8px; }
.config-item {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between;
    padding: 12px 14px; border-radius: 10px;
    margin-bottom: 4px; -webkit-transition: background .15s; transition: background .15s;
    gap: 10px;
}
.config-item:hover { background: #f5f5f5; }
.config-item.inactive { opacity: .45; }
.config-item-info { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 10px; -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; min-width: 0; }
.config-item-info b { font-size: .9rem; }
.config-item-detail { font-size: .82rem; color: #6b7280; }
.config-item-actions { display: -webkit-box; display: -webkit-flex; display: flex; gap: 4px; -webkit-flex-shrink: 0; flex-shrink: 0; }
.badge-role {
    display: inline-flex; padding: 3px 8px; border-radius: 6px;
    font-size: .68rem; font-weight: 700; color: #ffffff;
}
.badge-admin { background: #c62828; }
.badge-staff { background: #1565c0; }
.badge-driver { background: #ef6c00; }
.zone-price-badge {
    font-weight: 800; color: #2e7d32; font-size: 1rem;
}
.sync-status { margin-top: 12px; font-size: .9rem; }

/* ============================================================
   MODALS
   ============================================================ */
.modal {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 200;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    padding: 16px;
}
.modal.hidden { display: none; }
.modal-backdrop {
    position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0,0,0,.45);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.modal-dialog {
    position: relative; background: #ffffff;
    border-radius: 20px; width: 100%; max-width: 440px;
    max-height: 90vh; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
    box-shadow: 0 16px 50px rgba(0,0,0,.2); overflow: hidden;
    -webkit-animation: modal-in .25s cubic-bezier(.4, 0, .2, 1); animation: modal-in .25s cubic-bezier(.4, 0, .2, 1);
}
.modal-sm .modal-dialog, .modal-dialog.modal-sm { max-width: 380px; }
.modal-lg .modal-dialog, .modal-dialog.modal-lg { max-width: 560px; }
@keyframes modal-in { from { opacity:0; -webkit-transform: scale(.95) translateY(10px); transform: scale(.95) translateY(10px); } }
.modal-header {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #e5e7eb;
    -webkit-flex-shrink: 0; flex-shrink: 0;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
    width: 34px; height: 34px; border: none;
    background: #f5f5f5; border-radius: 50%;
    font-size: 1.2rem; cursor: pointer; color: #6b7280;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    -webkit-transition: all .15s; transition: all .15s;
}
.modal-close:hover { background: #e5e7eb; color: #1f2937; }
.modal-body {
    padding: 16px 20px; overflow-y: auto; -webkit-box-flex: 1; -webkit-flex: 1; flex: 1;
    -webkit-overflow-scrolling: touch;
}
.modal-footer {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-pack: flex-end; -webkit-justify-content: flex-end; justify-content: flex-end; -webkit-box-align: center; -webkit-align-items: center; align-items: center;
    padding: 12px 20px; border-top: 1px solid #e5e7eb;
    gap: 8px; -webkit-flex-shrink: 0; flex-shrink: 0;
}

/* Product Modal Options */
.option-group { margin-bottom: 16px; }
.option-group-title {
    font-size: .82rem; font-weight: 800; color: #6b7280;
    text-transform: uppercase; letter-spacing: .3px; margin-bottom: 6px;
}
.option-item {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; padding: 10px 8px;
    border-radius: 8px; cursor: pointer; gap: 8px;
}
.option-item:active { background: #f5f5f5; }
.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    width: 20px; height: 20px;  -webkit-flex-shrink: 0; flex-shrink: 0;
}
.option-item label { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; cursor: pointer; font-size: .92rem; }
.option-price { font-size: .82rem; color: #6b7280; white-space: nowrap; }
.notes-input {
    width: 100%; padding: 10px 12px; border: 2px solid #e5e7eb;
    border-radius: 10px; font-size: .9rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    resize: none; outline: none;
}
.notes-input:focus { border-color: #ef6c00; }

/* Qty Control */
.qty-control { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 4px; }
.qty-btn {
    width: 44px; height: 44px; border: 2px solid #e5e7eb;
    border-radius: 10px; background: #ffffff; font-size: 1.3rem;
    font-weight: 700; cursor: pointer;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    -webkit-transition: all .12s; transition: all .12s;
}
.qty-btn:active { background: #f5f5f5; -webkit-transform: scale(.93); transform: scale(.93); }
.qty-control > span {
    font-size: 1.25rem; font-weight: 800; min-width: 32px; text-align: center;
}
.btn-add { padding: 12px 24px; font-size: .95rem; border-radius: 14px; }

/* Discount Modal */
.discount-types { display: -webkit-box; display: -webkit-flex; display: flex; gap: 6px; margin-bottom: 16px; }
.discount-type-option {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; text-align: center; cursor: pointer;
}
.discount-type-option input { display: none; }
.discount-type-option span {
    display: block; padding: 12px; border-radius: 10px;
    font-size: .9rem; font-weight: 700;
    border: 2px solid #e5e7eb; -webkit-transition: all .15s; transition: all .15s;
}
.discount-type-option input:checked + span {
    border-color: #c62828; background: #fef2f2; color: #c62828;
}

/* ============================================================
   BOTTOM SHEET (mobile cart)
   ============================================================ */
.bottom-sheet {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; -webkit-box-pack: flex-end; -webkit-justify-content: flex-end; justify-content: flex-end;
}
.bottom-sheet.hidden { display: none; }
.sheet-backdrop {
    position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,.45);
}
.sheet-content {
    position: relative; background: #ffffff;
    border-radius: 20px 20px 0 0;
    max-height: 85vh; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
    -webkit-animation: sheet-up .3s cubic-bezier(.4, 0, .2, 1); animation: sheet-up .3s cubic-bezier(.4, 0, .2, 1);
}
@keyframes sheet-up { from { -webkit-transform: translateY(100%); transform: translateY(100%); } }
.sheet-handle {
    width: 40px; height: 4px; border-radius: 2px;
    background: #d1d5db; margin: 8px auto 0;
}
.sheet-header {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between; -webkit-box-align: center; -webkit-align-items: center; align-items: center;
    padding: 12px 18px; border-bottom: 1px solid #e5e7eb;
}
.sheet-header h3 { font-size: 1.1rem; font-weight: 700; }
.cart-sheet-footer {
    padding: 12px 18px; border-top: 1px solid #e5e7eb;
    -webkit-flex-shrink: 0; flex-shrink: 0;
}
.cart-sheet-footer .btn-lg { margin-top: 8px; }

/* Customer Suggestions */
.customer-suggestions {
    position: absolute; left: 12px; right: 12px; top: 100%;
    background: #ffffff; border: 2px solid #1565c0;
    border-radius: 10px; max-height: 200px;
    overflow-y: auto; z-index: 10; box-shadow: 0 8px 30px rgba(0,0,0,.15);
}
.sug-title {
    font-size: .78rem; color: #6b7280;
    padding: 8px 12px; border-bottom: 1px solid #e5e7eb;
    font-weight: 700;
}
.sug-item {
    padding: 10px 12px; cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; gap: 6px; -webkit-box-align: center; -webkit-align-items: center; align-items: center;
    -webkit-transition: background .1s; transition: background .1s;
}
.sug-item:hover { background: #f5f5f5; }
.sug-item b { font-size: .9rem; }
.sug-item span { font-size: .82rem; color: #6b7280; }
.sug-item small { font-size: .78rem; color: #9ca3af; width: 100%; }
.sug-orders {
    background: #1565c0; color: #ffffff;
    padding: 1px 8px; border-radius: 10px; font-size: .68rem; font-weight: 700;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
    position: fixed; bottom: calc(60px + 10px);
    left: 50%; -webkit-transform: translateX(-50%); transform: translateX(-50%);
    z-index: 300; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; gap: 8px;
    pointer-events: none; width: 90%; max-width: 360px;
}
.toast {
    padding: 12px 20px; border-radius: 10px;
    color: #ffffff; font-weight: 700; font-size: .88rem;
    -webkit-animation: toast-in .3s cubic-bezier(.4, 0, .2, 1); animation: toast-in .3s cubic-bezier(.4, 0, .2, 1);
    text-align: center; pointer-events: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,.15);
}
.toast-success { background: #2e7d32; }
.toast-error { background: #c62828; }
.toast-info { background: #1565c0; }
@keyframes toast-in { from { opacity:0; -webkit-transform: translateY(15px); transform: translateY(15px); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablets */
@media (min-width: 640px) {
    .products-grid { grid-template-columns: repeat(4, 1fr); }
    .cash-grid { grid-template-columns: repeat(2, 1fr); }
    .modal-dialog { border-radius: 20px; }
    .sheet-content { max-width: 480px; margin: 0 auto; }
}

/* Desktop */
@media (min-width: 900px) {
    /* Switch to row layout for sidebar */
    #app-screen { -webkit-flex-direction: row; flex-direction: row; }
    /* Show sidebar, hide bottom nav and mobile topbar-menu */
    .sidebar { display: -webkit-box; display: -webkit-flex; display: flex; }
    .bottom-nav { display: none; }
    .topbar-menu { display: none; }
    .topbar { border-bottom: 1px solid #e5e7eb; }

    /* Remove bnav height from calculations */
    :root { --bnav-h: 0px; }

    /* Products grid */
    .products-grid { grid-template-columns: repeat(4, 1fr); padding-bottom: 10px; }

    /* Show cart panel on desktop */
    .cart-panel { display: -webkit-box; display: -webkit-flex; display: flex; }

    /* Hide mobile FAB on desktop */
    .fab-cart { display: none !important; }

    /* Show order detail panel */
    .orders-detail-panel { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; }

    /* Cash grid 2 cols */
    .cash-grid { grid-template-columns: repeat(2, 1fr); }

    /* Config layout 2 cols */
    .config-layout {
        display: grid; grid-template-columns: repeat(2, 1fr);
        gap: 16px; align-content: start;
    }
    .config-section:first-child { grid-column: 1 / -1; }

    /* Toast position */
    .toast-container { bottom: 20px; }
}

@media (min-width: 1200px) {
    .products-grid { grid-template-columns: repeat(5, 1fr); }
    .orders-detail-panel { width: 480px; }
    .cart-panel { width: 380px; }
    .kds-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1600px) {
    .products-grid { grid-template-columns: repeat(6, 1fr); }
    .kds-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ============ LOGIN TABS ============ */
.login-tabs { display: -webkit-box; display: -webkit-flex; display: flex; gap: 4px; margin-bottom: 16px; background: rgba(255,255,255,.1); border-radius: 10px; padding: 3px; }
.login-tab { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; padding: 8px; border: none; background: transparent; color: rgba(255,255,255,.6); font-weight: 600; font-size: .85rem; border-radius: 8px; cursor: pointer; }
.login-tab.active { background: rgba(255,255,255,.2); color: #fff; }
.login-input { width: 100%; padding: 14px 16px; border: 2px solid rgba(255,255,255,.2); border-radius: 10px; background: rgba(255,255,255,.1); color: #fff; font-size: 1rem; margin-bottom: 8px; outline: none; }
.login-input::placeholder { color: rgba(255,255,255,.4); }
.login-input:focus { border-color: rgba(255,255,255,.5); }

/* ============ CONFIG FIELDS ============ */
.config-field { margin-bottom: 10px; }
.config-field label { font-size: .88rem; }
.config-section-body { padding: 12px 16px; }

/* ============ KDS MULTI-SCREEN ============ */
.kds-header-bar { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 12px; -webkit-flex-wrap: wrap; flex-wrap: wrap; }
.kds-screen-tabs { display: -webkit-box; display: -webkit-flex; display: flex; gap: 4px; }
.kds-screen-btn {
    padding: 6px 14px; border: 1px solid #e5e7eb; border-radius: 20px;
    background: #ffffff; font-size: .8rem; font-weight: 600; cursor: pointer;
    -webkit-transition: all .15s; transition: all .15s;
}
.kds-screen-btn:hover { border-color: #ff5f52; }
.kds-screen-btn.active { background: #c62828; color: #fff; border-color: #c62828; }
.kds-item { cursor: pointer; padding: 4px 6px; border-radius: 6px; -webkit-transition: all .15s; transition: all .15s; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: flex-start; -webkit-align-items: flex-start; align-items: flex-start; gap: 6px; }
.kds-item:hover { background: rgba(0,0,0,.05); }
.kds-item-check { font-size: 1rem; -webkit-flex-shrink: 0; flex-shrink: 0; }
.kds-item-done { opacity: .45; text-decoration: line-through; }
.kds-all-done { opacity: .6; border: 2px solid #2e7d32 !important; }
.kds-actions { margin-top: 8px; }
.kds-done-dim { opacity: .6; }

/* ============ VIEW TOGGLES & SORT ============ */
.filter-row-views { display: -webkit-box; display: -webkit-flex; display: flex; gap: 8px; -webkit-box-align: center; -webkit-align-items: center; align-items: center; }
.view-toggles { display: -webkit-box; display: -webkit-flex; display: flex; gap: 2px; background: #f5f5f5; border-radius: 8px; padding: 2px; }
.view-btn {
    width: 32px; height: 32px; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    border: none; background: transparent; border-radius: 6px; cursor: pointer;
    font-size: 1.1rem; color: #9ca3af; -webkit-transition: all .15s; transition: all .15s;
}
.view-btn:hover { background: #fafafa; color: #1f2937; }
.view-btn.active { background: #ffffff; color: #c62828; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Orders list - VIEW: LIST (default) */
.orders-list.view-list .order-card { display: block; }

/* Orders list - VIEW: GRID */
.orders-list.view-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px;
}
.orders-list.view-grid .order-card {
    border-radius: 10px; border: 1px solid #e5e7eb;
    background: #ffffff; padding: 10px;
}

/* Orders list - VIEW: COMPACT */
.orders-list.view-compact .order-card {
    padding: 6px 12px; margin-bottom: 2px; border-radius: 6px;
}
.orders-list.view-compact .order-card .order-items-preview,
.orders-list.view-compact .order-card .order-addr,
.orders-list.view-compact .order-card .order-note,
.orders-list.view-compact .order-card .quick-actions { display: none; }
.orders-list.view-compact .order-top { font-size: .82rem; }

/* Orders list - VIEW: KANBAN (columns by status) */
.orders-list.view-kanban {
    display: -webkit-box; display: -webkit-flex; display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px;
    min-height: 300px;
}
.kanban-col {
    min-width: 240px; max-width: 300px; -webkit-box-flex: 1; -webkit-flex: 1; flex: 1;
    background: #f5f5f5; border-radius: 10px; padding: 8px;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; gap: 8px;
}
.kanban-col-title {
    font-weight: 700; font-size: .82rem; text-transform: uppercase;
    padding: 4px 8px; border-radius: 6px; text-align: center;
    color: #fff;
}
.kanban-col-title.st-preparing { background: #ef6c00; }
.kanban-col-title.st-ready { background: #2e7d32; }
.kanban-col-title.st-delivering { background: #1565c0; }
.kanban-col-title.st-delivered { background: #9ca3af; }
.kanban-col-title.st-pending { background: #f9a825; color: #1f2937; }
.kanban-col .order-card { margin: 0; border-radius: 8px; padding: 8px; font-size: .85rem; }
.kanban-col .order-card .order-items-preview { font-size: .78rem; }

/* ============ DRIVERS BAR ============ */
.drivers-bar {
    display: -webkit-box; display: -webkit-flex; display: flex; gap: 8px; padding: 8px 12px; background: #eff6ff;
    border: 1px solid #1565c0; border-radius: 10px; margin-bottom: 8px;
    overflow-x: auto; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-flex-wrap: nowrap; flex-wrap: nowrap;
}
.drivers-bar-title { font-size: .78rem; font-weight: 700; color: #1565c0; white-space: nowrap; margin-right: 4px; }
.driver-chip {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 6px; padding: 5px 12px;
    background: #ffffff; border: 1px solid #e5e7eb; border-radius: 20px;
    font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.driver-chip .driver-avatar {
    width: 22px; height: 22px; border-radius: 50%; background: #1565c0;
    color: #fff; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    font-size: .65rem; font-weight: 800;
}
.driver-chip .driver-count { color: #9ca3af; font-size: .72rem; }

/* ============ DELIVERY MAP ============ */
.delivery-map-container {
    margin-bottom: 12px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}
.delivery-map-container #delivery-map { height: 350px; min-height: 250px; }
@media (max-width: 768px) {
    .delivery-map-container #delivery-map { height: 300px; }
}
/* Fix: el reset global rompe los tiles de Leaflet */
.leaflet-tile-pane img {
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.leaflet-container img {
    max-width: none !important;
    max-height: none !important;
}
.leaflet-control-container .leaflet-control {
    margin: 10px !important;
}
.delivery-map-container .leaflet-popup-content { font-size: .85rem; line-height: 1.4; }
.delivery-map-container .leaflet-popup-content b { color: #c62828; }
.map-popup-actions { display: -webkit-box; display: -webkit-flex; display: flex; gap: 6px; margin-top: 6px; }
.map-popup-actions a {
    display: inline-block; padding: 4px 10px; border-radius: 6px;
    font-size: .75rem; font-weight: 600; text-decoration: none; color: #fff;
}
.map-nav-google { background: #4285f4; }
.map-nav-waze { background: #33ccff; }

/* ============ PAYMENT MODAL ============ */
.payment-quick-btns { display: -webkit-box; display: -webkit-flex; display: flex; gap: 8px; }
.split-row { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 8px; margin-bottom: 6px; }
.split-row label { width: 70px; font-size: .85rem; font-weight: 600; }
.split-row input { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; }

/* ============ CASH SESSION BAR ============ */
.cash-session-bar {
    padding: 12px 16px; border-radius: 10px; margin-bottom: 12px;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 12px; -webkit-flex-wrap: wrap; flex-wrap: wrap;
}
.cash-session-bar.session-closed {
    background: #fff7ed; border: 1px solid #ef6c00;
}
.cash-session-bar.session-open {
    background: #f0fdf4; border: 1px solid #2e7d32;
}
.cash-session-info { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; font-size: .9rem; }
.cash-session-info b { font-size: 1rem; }

/* ============ TABLE SELECTOR ============ */
.table-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px 0;
}
.table-btn {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    padding: 10px 6px; border: 2px solid #e5e7eb; border-radius: 10px;
    background: #ffffff; cursor: pointer; -webkit-transition: all .15s; transition: all .15s;
    font-size: .85rem; font-weight: 600; color: #1f2937;
}
.table-btn:hover { border-color: #ff5f52; background: #fef2f2; }
.table-btn.selected { border-color: #c62828; background: #fef2f2; color: #c62828; }
.table-btn.occupied { border-color: #ef6c00; background: #fff7ed; }
.table-btn.occupied.selected { border-color: #c62828; background: #fef2f2; }
.table-btn .table-cap { font-size: .7rem; color: #9ca3af; font-weight: 400; }
.table-btn .table-occ { font-size: .65rem; color: #ef6c00; font-weight: 500; }

/* ============ ORDER CARD ITEMS (detailed) ============ */
.oc-items { margin: 6px 0; }
.oc-item { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between; -webkit-box-align: baseline; -webkit-align-items: baseline; align-items: baseline; padding: 2px 0; font-size: .85rem; }
.oc-item-name { font-weight: 600; }
.oc-item-price { color: #9ca3af; font-size: .8rem; white-space: nowrap; margin-left: 8px; }
.oc-opt { padding: 1px 0 1px 14px; font-size: .8rem; font-weight: 600; }
.oc-opt-add { color: #2e7d32; }
.oc-opt-remove { color: #c62828; }
.oc-item-note { padding: 1px 0 1px 14px; font-size: .78rem; color: #ef6c00; font-weight: 600; }
.qbtn-lg { padding: 12px 16px !important; font-size: .95rem !important; width: 100%; }

/* ============ DRIVER ASSIGN MODAL ============ */
.driver-assign-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 8px 0;
}
.driver-assign-btn {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    padding: 20px 12px; border: 2px solid #e5e7eb; border-radius: 14px;
    background: #ffffff; cursor: pointer; -webkit-transition: all .15s; transition: all .15s; min-height: 80px;
}
.driver-assign-btn:hover { border-color: #1565c0; background: #eff6ff; }
.driver-assign-btn .da-avatar {
    width: 40px; height: 40px; border-radius: 50%; background: #1565c0;
    color: #fff; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    font-size: 1.1rem; font-weight: 800; margin-bottom: 6px;
}
.driver-assign-btn .da-name { font-weight: 700; font-size: .95rem; }
.driver-assign-btn .da-stats { font-size: .75rem; color: #9ca3af; }

/* Zone selector big (delivery) */
.zone-selector-big {
    display: -webkit-box; display: -webkit-flex; display: flex; gap: 8px; padding: 8px 0;
}
.zone-chip-big {
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    cursor: pointer;
}
.zone-chip-big input { display: none; }
.zone-chip-big span {
    display: block; width: 100%; text-align: center;
    padding: 12px 8px; border-radius: 10px;
    border: 2px solid #e5e7eb; background: #ffffff;
    font-weight: 700; font-size: .95rem; color: #1f2937;
    -webkit-transition: all .15s cubic-bezier(.4, 0, .2, 1); transition: all .15s cubic-bezier(.4, 0, .2, 1);
}
.zone-chip-big input:checked + span {
    border-color: #c62828; background: #fef2f2;
    color: #c62828; box-shadow: 0 2px 8px rgba(198,40,40,.15);
}

/* Driver account cards */
.driver-account-card:hover { background: #fafafa; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.driver-account-card:active { -webkit-transform: scale(.99); transform: scale(.99); }
.driver-pay-chip {
    display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px;
    border-radius: 12px; white-space: nowrap;
}
.chip-cash { background: #f0fdf4; color: #2e7d32; }
.chip-card { background: #eff6ff; color: #1565c0; }
.chip-bizum { background: #f3e8ff; color: #7b1fa2; }
.chip-online { background: #fff7ed; color: #ef6c00; }

/* Config cards */
.config-card {
    background: #ffffff; border-radius: 14px;
    margin-bottom: 16px; border: 1px solid #e5e7eb;
    overflow: hidden;
}
.config-card-header {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between;
    padding: 16px 18px; border-bottom: 1px solid #e5e7eb;
    gap: 10px;
}
.config-card-header > div:first-of-type { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 12px; }
.config-card-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: #fef2f2; color: #c62828;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    font-size: 1.3rem; -webkit-flex-shrink: 0; flex-shrink: 0;
}
.config-card-header h4 { font-size: .95rem; font-weight: 700; margin: 0; }
.config-card-desc { font-size: .8rem; color: #6b7280; margin-top: 2px; }
.config-card-body { padding: 16px 18px; }

/* Config section labels */
.config-section-label {
    font-size: .82rem; font-weight: 700; color: #c62828;
    text-transform: uppercase; letter-spacing: .5px;
    padding-bottom: 6px; border-bottom: 1px solid #e5e7eb;
    margin-bottom: 8px;
}
.config-checks-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 4px 12px;
}
.config-checks-grid label {
    font-size: .85rem; padding: 4px 0; cursor: pointer;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 6px;
}
.config-checks-grid input[type="checkbox"] { margin: 0; }

/* Ticket preview */
.ticket-preview {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 16px; font-family: 'Courier New', monospace; font-size: 11px;
    line-height: 1.4; white-space: pre-wrap; max-height: 400px; overflow-y: auto;
    box-shadow: inset 0 2px 4px rgba(0,0,0,.05);
}

/* GPS pulse */
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(21,101,192,.4); } 50% { box-shadow: 0 0 0 10px rgba(21,101,192,0); } }

/* Print */
@media print {
    .sidebar, .topbar, .bottom-nav, .modal, .toast-container,
    .fab-cart, .bottom-sheet { display: none !important; }
    .main-content { overflow: visible; }
    .tab-content { overflow: visible; display: block; }
}

/* ============================================================
   CARTA PUBLICA - La Fontana
   ============================================================ */
#public-screen { display: none; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; }
#public-screen.active { display: -webkit-box; display: -webkit-flex; display: flex; }

.pub-wrapper {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; height: 100%;
    background: #faf7f5; overflow-y: auto; overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Header */
.pub-header {
    position: sticky; top: 0; z-index: 20;
    background: rgba(30,20,15,.97); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.pub-header-inner {
    max-width: 1100px; margin: 0 auto; padding: 12px 20px;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between;
}
.pub-brand { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 12px; }
.pub-logo {
    width: 44px; height: 44px; border-radius: 12px;
    background: #c62828; color: #fff;
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
    font-size: 1.6rem; font-weight: 900;
}
.pub-title { color: #fff; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
.pub-subtitle { color: rgba(255,255,255,.5); font-size: .8rem; font-weight: 400; }
.pub-header-right { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 8px; }
.pub-phone-btn {
    background: #c62828; color: #fff; border: none; border-radius: 20px;
    padding: 8px 16px; font-size: .85rem; font-weight: 600; cursor: pointer;
    text-decoration: none; -webkit-transition: transform .15s; transition: transform .15s;
}
.pub-phone-btn:hover { -webkit-transform: scale(1.04); transform: scale(1.04); color: #fff; }
.pub-staff-btn {
    width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.35); font-size: 1rem; cursor: pointer;
    -webkit-transition: all .2s; transition: all .2s;
}
.pub-staff-btn:hover { background: rgba(255,255,255,.12); color: rgba(255,255,255,.6); }

/* Hero */
.pub-hero {
    background: linear-gradient(135deg, #1a0f0a 0%, #2d1810 40%, #3d1f12 100%);
    text-align: center; padding: 48px 20px 40px;
    position: relative; overflow: hidden;
}
.pub-hero::before {
    content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    background: radial-gradient(circle at 30% 70%, rgba(198,40,40,.15) 0%, transparent 60%),
                radial-gradient(circle at 80% 20%, rgba(255,152,0,.08) 0%, transparent 50%);
}
.pub-hero-inner { position: relative; z-index: 1; }
.pub-hero h2 { color: #fff; font-size: 2rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 8px; }
.pub-hero p { color: rgba(255,255,255,.55); font-size: 1rem; max-width: 420px; margin: 0 auto; line-height: 1.5; }

/* Category nav */
.pub-cats {
    position: sticky; top: 68px; z-index: 15;
    background: rgba(250,247,245,.95); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0,0,0,.06);
}
.pub-cats-inner {
    max-width: 1100px; margin: 0 auto; padding: 12px 16px;
    display: -webkit-box; display: -webkit-flex; display: flex; gap: 8px; overflow-x: auto;
    -webkit-overflow-scrolling: touch; 
}
.pub-cats-inner::-webkit-scrollbar { display: none; }
.pub-cat-btn {
    -webkit-flex-shrink: 0; flex-shrink: 0; padding: 8px 18px; border-radius: 24px;
    border: 1.5px solid #e5e7eb; background: #fff;
    font-size: .88rem; font-weight: 600; color: #6b7280;
    cursor: pointer; -webkit-transition: all .2s cubic-bezier(.4, 0, .2, 1); transition: all .2s cubic-bezier(.4, 0, .2, 1);
    white-space: nowrap;
}
.pub-cat-btn:hover { border-color: #ff5f52; color: #c62828; }
.pub-cat-btn.active {
    background: #c62828; color: #fff; border-color: #c62828;
    box-shadow: 0 2px 8px rgba(198,40,40,.25);
}
.pub-cat-emoji { margin-right: 4px; }
.pub-loading { color: #9ca3af; padding: 8px; font-size: .9rem; }

/* Product grid */
.pub-main { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; }
.pub-products {
    max-width: 1100px; margin: 0 auto; padding: 24px 16px 40px;
}
.pub-section-title {
    font-size: 1.3rem; font-weight: 800; color: #1f2937;
    padding: 16px 0 12px; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; gap: 8px;
    border-bottom: 2px solid #c62828; margin-bottom: 16px;
}
.pub-section-emoji { font-size: 1.5rem; }
.pub-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px; margin-bottom: 32px;
}
.pub-card {
    background: #fff; border-radius: 14px; padding: 16px 18px;
    border: 1px solid rgba(0,0,0,.05);
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    -webkit-transition: all .2s cubic-bezier(.4, 0, .2, 1); transition: all .2s cubic-bezier(.4, 0, .2, 1); display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; gap: 4px;
}
.pub-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); -webkit-transform: translateY(-2px); transform: translateY(-2px); }
.pub-card-top { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-pack: space-between; -webkit-justify-content: space-between; justify-content: space-between; -webkit-box-align: flex-start; -webkit-align-items: flex-start; align-items: flex-start; gap: 8px; }
.pub-card-name {
    font-weight: 700; font-size: 1rem; color: #1f2937; line-height: 1.3;
    -webkit-box-flex: 1; -webkit-flex: 1; flex: 1;
}
.pub-card-price {
    font-weight: 800; font-size: 1.1rem; color: #c62828;
    white-space: nowrap; -webkit-flex-shrink: 0; flex-shrink: 0;
}
.pub-card-desc {
    font-size: .82rem; color: #6b7280; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pub-card-tags { display: -webkit-box; display: -webkit-flex; display: flex; gap: 4px; -webkit-flex-wrap: wrap; flex-wrap: wrap; margin-top: 2px; }
.pub-tag {
    font-size: .7rem; padding: 2px 8px; border-radius: 10px;
    background: #f0fdf4; color: #2e7d32; font-weight: 600;
}
.pub-card-sizes {
    font-size: .78rem; color: #9ca3af; margin-top: 2px;
}
.pub-card-options {
    font-size: .78rem; color: #9ca3af; font-style: italic;
}
.pub-empty {
    text-align: center; padding: 60px 20px; color: #9ca3af;
    font-size: 1.1rem;
}

/* Footer */
.pub-footer {
    background: #1e140f; color: rgba(255,255,255,.6); padding: 32px 20px;
}
.pub-footer-inner {
    max-width: 1100px; margin: 0 auto; text-align: center;
}
.pub-footer-info { margin-bottom: 16px; line-height: 1.7; font-size: .9rem; }
.pub-footer-info b { color: #fff; font-size: 1.05rem; }
.pub-footer-links {
    display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center; gap: 20px; -webkit-flex-wrap: wrap; flex-wrap: wrap;
    margin-bottom: 20px; font-size: .85rem;
}
.pub-footer-login {
    background: none; border: 1px solid rgba(255,255,255,.1); border-radius: 6px;
    color: rgba(255,255,255,.25); font-size: .75rem; padding: 6px 14px;
    cursor: pointer; -webkit-transition: all .2s; transition: all .2s;
}
.pub-footer-login:hover { border-color: rgba(255,255,255,.3); color: rgba(255,255,255,.5); }

/* Login back button */
.login-back-btn {
    background: none; border: none; color: rgba(255,255,255,.35);
    font-size: .85rem; cursor: pointer; margin-top: 16px; padding: 8px;
    -webkit-transition: color .2s; transition: color .2s;
}
.login-back-btn:hover { color: rgba(255,255,255,.7); }

/* Responsive public */
@media (max-width: 600px) {
    .pub-hero { padding: 32px 16px 28px; }
    .pub-hero h2 { font-size: 1.5rem; }
    .pub-hero p { font-size: .88rem; }
    .pub-grid { grid-template-columns: 1fr; }
    .pub-phone-btn { padding: 6px 12px; font-size: .8rem; }
    .pub-footer-links { -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column; gap: 8px; }
}

/* === Grid fallback for very old browsers (no CSS Grid support) === */
@supports not (display: grid) {
    .pin-pad {
        display: -webkit-box; display: -webkit-flex; display: flex;
        -webkit-flex-wrap: wrap; flex-wrap: wrap;
        -webkit-justify-content: center; justify-content: center;
        max-width: 250px; margin: 0 auto;
    }
    .pin-pad .pin-btn { margin: 6px; }
    .products-grid {
        display: -webkit-box; display: -webkit-flex; display: flex;
        -webkit-flex-wrap: wrap; flex-wrap: wrap;
    }
    .products-grid > * {
        width: 48%; margin: 1%;
    }
    .pub-grid {
        display: -webkit-box; display: -webkit-flex; display: flex;
        -webkit-flex-wrap: wrap; flex-wrap: wrap;
    }
    .pub-grid > * {
        width: 100%; margin-bottom: 8px;
    }
    .kds-grid {
        display: -webkit-box; display: -webkit-flex; display: flex;
        -webkit-flex-wrap: wrap; flex-wrap: wrap;
    }
    .kds-grid > * {
        width: 100%; margin-bottom: 8px;
    }
    .cash-grid {
        display: -webkit-box; display: -webkit-flex; display: flex;
        -webkit-flex-wrap: wrap; flex-wrap: wrap;
    }
    .cash-grid > * {
        width: 100%; margin-bottom: 8px;
    }
    .driver-assign-grid {
        display: -webkit-box; display: -webkit-flex; display: flex;
        -webkit-flex-wrap: wrap; flex-wrap: wrap;
    }
    .driver-assign-grid > * {
        width: 48%; margin: 1%;
    }
    .zone-selector {
        display: -webkit-box; display: -webkit-flex; display: flex;
        -webkit-flex-wrap: wrap; flex-wrap: wrap;
    }
    .zone-selector > * { margin: 4px; }
}

/* === Gap fallback for old browsers === */
/* Flex gap is not supported in Chrome < 84 / Safari < 14.1 */
/* These rules add spacing via margins as fallback */
@supports not (gap: 1px) {
    .pin-display > * + * { margin-left: 16px; }
    .pin-pad > * { margin: 4px; }
    .topbar-actions > * + * { margin-left: 10px; }
    .sidebar-brand > * + * { margin-left: 10px; }
    .nav-item > * + * { margin-left: 12px; }
    .sidebar-user > * + * { margin-left: 8px; }
    .filter-row > * + * { margin-left: 8px; }
    .order-top > * + * { margin-left: 8px; }
    .quick-actions > * + * { margin-left: 6px; }
    .detail-actions > * + * { margin-left: 8px; }
    .menu-search > * + * { margin-left: 8px; }
    .cart-item-actions > * + * { margin-left: 4px; }
    .type-selector > * + * { margin-left: 8px; }
}


/* ============================================================
   SUNMI V2 & SMALL ANDROID POS SCREENS
   Viewport: ~360x640 CSS pixels (720x1280 physical)
   ============================================================ */

/* --- Small width (< 480px) --- */
@media (max-width: 480px) {
    html, body { font-size: 13px; }

    /* Topbar compact */
    .topbar { height: 44px; padding: 0 8px; }
    .topbar-title { font-size: .95rem; }
    .topbar-clock { font-size: .72rem; }
    .topbar-user { width: 26px; height: 26px; font-size: .7rem; }
    .topbar-menu { width: 32px; height: 32px; font-size: 1rem; }

    /* Bottom nav - bigger touch targets */
    .bottom-nav { height: 56px; border-top: 2px solid #e5e7eb; }
    .bnav-item { font-size: .7rem; padding: 6px 2px; min-width: 54px; }
    .bnav-icon { font-size: 1.2rem; }
    .bnav-label { font-size: .62rem; margin-top: 2px; font-weight: 700; }
    .bnav-item.active { background: #fef2f2; border-radius: 8px; }

    /* Content area */
    .tab-content { padding: 6px; }

    /* Filter bar */
    .filter-bar { padding: 4px 6px; }
    .filter-tab { padding: 4px 8px; font-size: .7rem; border-radius: 5px; }
    .filter-row { gap: 4px; margin-top: 4px; }
    .filter-row select, .filter-row input { font-size: .75rem; padding: 4px 6px; height: 30px; }

    /* Section/Panel headers */
    .section-header, .panel-header { padding: 6px 8px; }
    .section-header h3, .panel-header h3 { font-size: .9rem; }

    /* Buttons */
    .btn { padding: 7px 12px; font-size: .8rem; border-radius: 6px; }
    .btn-sm { padding: 3px 8px; font-size: .7rem; }
    .btn-lg { padding: 10px 16px; font-size: .9rem; }

    /* Inputs */
    .input-field { padding: 7px 9px; font-size: .82rem; height: 34px; border-radius: 6px; }
    .field-label { font-size: .75rem; margin-bottom: 2px; }
    textarea.input-field { height: auto; min-height: 50px; }

    /* Order cards */
    .order-card { padding: 8px; margin-bottom: 5px; border-radius: 7px; }
    .order-top { gap: 3px; margin-bottom: 3px; }
    .order-num { font-size: .82rem; }
    .order-badge { font-size: .58rem; padding: 1px 5px; border-radius: 4px; }
    .order-time { font-size: .68rem; }
    .order-total { font-size: .88rem; }
    .order-client { font-size: .75rem; }
    .order-addr { font-size: .7rem; }
    .oc-items { font-size: .75rem; }
    .oc-item { padding: 1px 0; }
    .oc-opt { font-size: .68rem; }

    /* Quick actions */
    .quick-actions { margin-top: 8px; padding-top: 8px; gap: 5px; }
    .qbtn { padding: 10px 8px; font-size: .78rem; min-width: 55px; border-radius: 7px; min-height: 38px; }
    .qbtn:active { -webkit-transform: scale(.93); transform: scale(.93); opacity: .8; }
    .qbtn-lg { padding: 12px 12px; font-size: .85rem; }

    /* Detail view */
    .detail-section { margin-bottom: 6px; }
    .detail-section-title { font-size: .8rem; }
    .detail-row { font-size: .78rem; padding: 2px 0; }
    .detail-actions { gap: 4px; }

    /* Products grid - 3 cols on 360px */
    .products-grid { grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 6px; padding-bottom: 70px; }
    .product-btn { padding: 10px 6px; min-height: 68px; border-radius: 8px; border-width: 2px; }
    .product-btn:active { -webkit-transform: scale(.92); transform: scale(.92); background: #fef2f2; }
    .product-name { font-size: .68rem; line-height: 1.2; }
    .product-price { font-size: .78rem; }
    .product-code { font-size: .5rem; }

    /* Categories */
    .categories-bar { gap: 3px; padding: 4px 6px; }
    .cat-btn { padding: 4px 8px; font-size: .7rem; border-radius: 5px; }
    .menu-search { margin-bottom: 4px; gap: 4px; }
    .menu-search input { height: 32px; font-size: .82rem; }

    /* Type selector */
    .type-selector { gap: 3px; }
    .type-btn { padding: 6px 8px; font-size: .72rem; }

    /* Cart */
    .cart-item { padding: 6px; }
    .cart-item-name { font-size: .78rem; }
    .cart-item-price { font-size: .82rem; }
    .cart-item-actions { gap: 2px; }
    .cart-act { width: 26px; height: 26px; font-size: .7rem; }
    .cart-total-row { padding: 6px 8px; font-size: .9rem; }

    /* Product modal */
    .modal { padding: 6px; }
    .modal-dialog { border-radius: 12px; max-height: 92vh; }
    .modal-header { padding: 10px 12px; }
    .modal-title { font-size: .95rem; }
    .modal-body { padding: 10px 12px; }
    .modal-footer { padding: 8px 12px; }
    .option-group { margin-bottom: 6px; }
    .option-group-title { font-size: .78rem; margin-bottom: 3px; }
    .option-item { padding: 5px 0; font-size: .78rem; }
    .option-price { font-size: .72rem; }

    /* KDS Kitchen */
    .kds-grid { grid-template-columns: 1fr; gap: 6px; padding: 6px; }
    .kds-card { padding: 8px; }
    .kds-num { font-size: .95rem; }
    .kds-time { font-size: .72rem; }
    .kds-item { padding: 3px 0; font-size: .78rem; }
    .kds-opt { font-size: .68rem; padding-left: 14px; }
    .kds-done { padding: 8px; font-size: .82rem; }

    /* Cash */
    .cash-card { padding: 8px; margin-bottom: 6px; border-radius: 7px; }
    .cash-card h4 { font-size: .85rem; }
    .cash-big { font-size: 1.4rem; }
    .cash-row { font-size: .78rem; padding: 2px 0; }
    .cash-session-bar { padding: 6px 8px; font-size: .78rem; }

    /* Config */
    .config-item { padding: 6px 8px; }
    .config-item-info b { font-size: .82rem; }
    .config-item-info span { font-size: .7rem; }
    .config-item-actions .btn { font-size: .68rem; padding: 3px 7px; }

    /* Reports */
    .rpt-card { padding: 8px; margin-bottom: 6px; }
    .rpt-big { font-size: 1.3rem; }
    .rpt-row { font-size: .78rem; }

    /* Drivers bar */
    .drivers-bar { padding: 4px 6px; font-size: .72rem; }
    .driver-chip { padding: 3px 6px; font-size: .68rem; }

    /* Toast */
    .toast-container { bottom: 52px; padding: 0 6px; }
    .toast { padding: 7px 12px; font-size: .75rem; border-radius: 6px; }

    /* Bottom sheet */
    .sheet-content { border-radius: 12px 12px 0 0; }
    .sheet-header { padding: 8px 12px; }

    /* Map */
    #delivery-map { height: 260px !important; min-height: 200px !important; }

    /* Kanban */
    .kanban-col { min-width: 200px; }
    .orders-list.view-kanban { min-height: 200px; }

    /* Zone selector */
    .zone-chip-big { padding: 5px 8px; font-size: .75rem; }

    /* FAB cart */
    .fab-cart { bottom: 54px; right: 8px; }

    /* Public menu */
    .pub-header-inner { padding: 6px 10px; }
    .pub-title { font-size: 1.1rem; }
    .pub-subtitle { font-size: .72rem; }
    .pub-hero { padding: 16px 10px; }
    .pub-hero h2 { font-size: 1.1rem; }
    .pub-hero p { font-size: .78rem; }
    .pub-card { padding: 8px; }
    .pub-card-name { font-size: .85rem; }
    .pub-card-price { font-size: .9rem; }
    .pub-cat-btn { padding: 4px 8px; font-size: .72rem; }
}

/* --- Short height (Sunmi V2 at 640px CSS height) --- */
@media (max-height: 640px) {
    .login-brand { margin-bottom: 12px; }
    .login-brand h1 { font-size: 1.3rem; }
    .login-brand p { font-size: .78rem; margin-top: 2px; }
    .login-brand svg { width: 36px; height: 36px; }
    .pin-display { gap: 10px; margin-bottom: 16px; }
    .pin-dot { width: 13px; height: 13px; }
    .pin-pad { grid-template-columns: repeat(3, 56px); gap: 7px; }
    .pin-btn { width: 56px; height: 56px; font-size: 1.1rem; border-width: 1px; }
    .login-error { margin-top: 10px; font-size: .82rem; }
    .login-tabs { margin-bottom: 10px; }
    .login-tab { padding: 6px; font-size: .78rem; }
    .login-input { padding: 10px 12px; font-size: .9rem; margin-bottom: 6px; }
}

/* --- Very narrow (< 360px, ancient phones) --- */
@media (max-width: 359px) {
    html, body { font-size: 12px; }
    .products-grid { grid-template-columns: repeat(2, 1fr); }
    .pin-pad { grid-template-columns: repeat(3, 50px); gap: 5px; }
    .pin-btn { width: 50px; height: 50px; font-size: 1rem; }
    .order-badge { font-size: .52rem; padding: 1px 3px; }
    .filter-tab { font-size: .62rem; padding: 3px 5px; }
    .bnav-label { display: none; }
}
