        /* ═══════════════════════════════════════════════════════════════
           Design System — alineado con el bot "Carga de Cajas"
           Superficie #121418 · Primario periwinkle #79a1f2 (texto #002967)
           Verde #10b981 · Glass + neon-glow · Material Symbols
           ═══════════════════════════════════════════════════════════════ */
        :root {
            --bg-primary: #191d24;
            --bg-secondary: #121418;
            --surface-2: #1b1f27;
            --surface-3: rgba(255, 255, 255, 0.05);
            --card-bg: rgba(255, 255, 255, 0.05);
            --card-border: 1px solid rgba(255, 255, 255, 0.08);
            --card-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.55);

            --text-primary: #e2e4e9;
            --text-secondary: #bec2cb;
            --text-hint: #8b93a3;

            --accent-color: #79a1f2;
            --accent-soft: rgba(121, 161, 242, 0.14);
            --accent-gradient: linear-gradient(135deg, #8fb2f7 0%, #6187e8 100%);
            --on-accent: #00234f;

            --btn-bg: #79a1f2;
            --btn-text: #00234f;

            --success-color: #10b981;
            --success-soft: rgba(16, 185, 129, 0.14);
            --success-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);

            --warning-color: #f5b544;
            --warning-soft: rgba(245, 181, 68, 0.14);
            --warning-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);

            --danger-color: #f87171;
            --danger-soft: rgba(248, 113, 113, 0.14);
            --danger-gradient: linear-gradient(135deg, #f87171 0%, #dc2626 100%);

            --neon-glow: 0 0 15px rgba(121, 161, 242, 0.45), 0 0 30px rgba(121, 161, 242, 0.18);
            --glass-blur: blur(16px);
            --transition-speed: 0.22s;
            --radius-sm: 10px;
            --radius-md: 12px;
            --radius-lg: 14px;
            --radius-xl: 18px;

            --safe-area-bottom: env(safe-area-inset-bottom, 0px);
            --safe-area-top: env(safe-area-inset-top, 0px);
        }

        .dark {
            --bg-primary: #191d24;
            --bg-secondary: #121418;
        }

        /* Íconos Material Symbols (mismo set que el bot de cajas) */
        .material-symbols-outlined {
            font-family: 'Material Symbols Outlined';
            font-weight: normal;
            font-style: normal;
            line-height: 1;
            letter-spacing: normal;
            text-transform: none;
            display: inline-block;
            white-space: nowrap;
            direction: ltr;
            -webkit-font-feature-settings: 'liga';
            -webkit-font-smoothing: antialiased;
            font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
            vertical-align: middle;
            user-select: none;
        }
        .mi { font-size: 1.15rem; }
        .mi-sm { font-size: 1rem; }
        .mi-lg { font-size: 1.4rem; }
        .neon-glow { box-shadow: var(--neon-glow); }

        /* Reset & General Styles */
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-secondary);
            background: radial-gradient(circle at top, var(--bg-primary) 0%, var(--bg-secondary) 100%);
            color: var(--text-primary);
            min-height: 100vh;
            min-height: 100dvh;
            line-height: 1.5;
            padding-bottom: calc(90px + var(--safe-area-bottom));
            overflow-x: hidden;
            transition: background-color 0.3s ease, color 0.3s ease;
            -webkit-text-size-adjust: 100%;
            -webkit-tap-highlight-color: transparent;
        }

        h1, h2, h3, h4 {
            font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
            font-weight: 700;
        }

        /* Custom Scrollbar */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }
        ::-webkit-scrollbar-track {
            background: transparent;
        }
        ::-webkit-scrollbar-thumb {
            background: rgba(156, 163, 175, 0.3);
            border-radius: 9999px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: rgba(156, 163, 175, 0.5);
        }

        /* Banner de instalación PWA (ver pwaInstall en app.js) */
        .pwa-install-banner {
            display: none;
            align-items: center;
            gap: 10px;
            padding: calc(10px + var(--safe-area-top)) 14px 10px;
            background: var(--card-bg);
            border-bottom: var(--card-border);
            backdrop-filter: var(--glass-blur);
            -webkit-backdrop-filter: var(--glass-blur);
        }
        .pwa-install-banner.active {
            display: flex;
        }
        .pwa-install-icon {
            font-size: 1.4rem;
            flex: 0 0 auto;
        }
        .pwa-install-text {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-width: 0;
        }
        .pwa-install-text strong {
            font-size: 0.84rem;
        }
        .pwa-install-text span {
            font-size: 0.72rem;
            color: var(--text-hint);
        }
        .pwa-install-btn {
            flex: 0 0 auto;
            background: var(--btn-bg);
            color: var(--btn-text);
            border: none;
            border-radius: var(--radius-md, 10px);
            padding: 8px 14px;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
        }
        .pwa-install-close {
            flex: 0 0 auto;
            font-size: 1.2rem;
            line-height: 1;
            color: var(--text-hint);
            padding: 4px 2px;
            cursor: pointer;
        }

        /* App Container & Header */
        .app-container {
            max-width: 600px;
            margin: 0 auto;
            /* viewport-fit=cover deja que el contenido vaya bajo el notch/Dynamic Island en
               PWA standalone en iOS — sin este padding el header queda pegado al status bar. */
            padding: calc(16px + var(--safe-area-top)) 16px 16px;
        }

        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 24px;
            background: var(--card-bg);
            padding: 18px 20px;
            border-radius: var(--radius-xl);
            box-shadow: var(--card-shadow);
            border: var(--card-border);
            backdrop-filter: var(--glass-blur);
            -webkit-backdrop-filter: var(--glass-blur);
            transition: all var(--transition-speed) ease;
        }

        .header-title {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .header-title h1 {
            font-size: 1.35rem;
            font-weight: 700;
            background: var(--accent-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .user-badge {
            background: rgba(156, 163, 175, 0.1);
            padding: 8px 16px;
            border-radius: 9999px;
            font-size: 0.8rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 8px;
            border: 1px solid rgba(156, 163, 175, 0.15);
            transition: all 0.2s ease;
        }

        .user-badge .role-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--accent-color);
        }

        .user-badge.admin-dot .role-dot {
            background: var(--danger-color);
        }

        /* Glassmorphic Cards */
        .card {
            background: var(--card-bg);
            border-radius: var(--radius-xl);
            padding: 22px;
            margin-bottom: 16px;
            box-shadow: var(--card-shadow);
            border: var(--card-border);
            backdrop-filter: var(--glass-blur);
            -webkit-backdrop-filter: var(--glass-blur);
            transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1), 
                        box-shadow var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1),
                        border-color var(--transition-speed) ease;
        }

        @media (hover: hover) and (pointer: fine) {
            .card:hover {
                transform: translateY(-2px);
                box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
                border-color: rgba(255, 255, 255, 0.2);
            }
        }
        .card:active {
            transform: scale(0.98);
        }

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

        /* Routing Tab Views */
        .view {
            display: none;
            animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .view.active {
            display: block;
        }

        .view.active.fullscreen-msg {
            display: flex;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(12px); }
            to { opacity: 1; transform: translateY(0); }
        }

        /* Buttons & Forms */
        .btn {
            background: var(--btn-bg);
            color: var(--btn-text);
            border: none;
            padding: 14px 26px;
            border-radius: var(--radius-lg);
            font-family: 'Outfit', sans-serif;
            font-size: 0.98rem;
            font-weight: 700;
            cursor: pointer;
            width: 100%;
            min-height: 48px;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 8px;
            box-shadow: var(--neon-glow);
            -webkit-appearance: none;
            touch-action: manipulation;
        }

        @media (hover: hover) and (pointer: fine) {
            .btn:hover {
                filter: brightness(1.06);
                transform: translateY(-1px);
                box-shadow: 0 0 18px rgba(121, 161, 242, 0.55), 0 0 34px rgba(121, 161, 242, 0.22);
            }
        }

        .btn:active {
            transform: scale(0.97);
            box-shadow: 0 2px 8px rgba(121, 161, 242, 0.25);
        }

        .btn-secondary {
            background: rgba(156, 163, 175, 0.1);
            color: var(--text-primary);
            border: var(--card-border);
            box-shadow: none;
        }
        .btn-secondary:hover {
            background: rgba(156, 163, 175, 0.15);
            box-shadow: none;
            border-color: rgba(156, 163, 175, 0.3);
            transform: none;
        }
        .btn-secondary:active {
            transform: scale(0.98);
        }

        .btn-danger {
            background: var(--danger-gradient);
            box-shadow: 0 4px 14px rgba(239, 68, 68, 0.2);
        }
        .btn-danger:hover {
            box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
        }

        .btn-success {
            background: var(--success-gradient);
            box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2);
        }
        .btn-success:hover {
            box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-primary);
            opacity: 0.9;
        }

        .form-input, select, textarea {
            width: 100%;
            background-color: rgba(0, 0, 0, 0.03);
            border: 1.5px solid rgba(156, 163, 175, 0.2);
            color: var(--text-primary);
            padding: 12px 14px;
            border-radius: var(--radius-md);
            font-size: 16px; /* >= 16px prevents iOS auto-zoom */
            font-family: inherit;
            outline: none;
            transition: all 0.25s ease;
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.01);
            -webkit-appearance: none;
            appearance: none;
        }
        .dark .form-input, .dark select, .dark textarea {
            background-color: rgba(255, 255, 255, 0.03);
            border: 1.5px solid rgba(255, 255, 255, 0.08);
        }

        .form-input:focus, select:focus, textarea:focus {
            border-color: rgba(121, 161, 242, 0.8);
            background-color: var(--bg-primary);
            box-shadow: 0 0 15px rgba(121, 161, 242, 0.3);
        }
        input { color-scheme: dark; }

        /* Day Selection Pills */
        .pills-container {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
        }

        .pill-btn {
            flex: 1;
            background: rgba(156, 163, 175, 0.08);
            border: 1px solid rgba(156, 163, 175, 0.15);
            color: var(--text-primary);
            padding: 12px 10px;
            border-radius: var(--radius-md);
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            text-align: center;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .pill-btn:hover {
            border-color: var(--accent-color);
        }

        .pill-btn.active {
            background: var(--btn-bg);
            color: var(--on-accent);
            border-color: transparent;
            box-shadow: var(--neon-glow);
            transform: translateY(-1px);
        }

        /* Cut List Items (Cocineros) */
        /* Encabezado de grupo por proveedor en el formulario del cocinero */
        .provider-group-header {
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 18px 0 10px;
            font-family: 'Outfit', sans-serif;
            font-size: 0.8rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.6px;
            color: var(--accent-color);
        }
        .provider-group-header:first-child { margin-top: 4px; }
        .provider-group-header::after {
            content: '';
            flex: 1;
            height: 1px;
            background: var(--card-border);
            opacity: 0.6;
        }
        .provider-group-badge {
            background: var(--accent-soft);
            color: var(--accent-color);
            border-radius: 9999px;
            padding: 2px 10px;
            font-size: 0.68rem;
            font-weight: 700;
        }

        /* Cut item: card-style row, each cut is self-contained */
        .cut-item {
            background: var(--bg-secondary);
            border-radius: var(--radius-lg);
            padding: 14px 16px;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 14px;
            border: 1px solid transparent;
            transition: border-color 0.2s ease;
        }
        .cut-item:last-child { margin-bottom: 0; }
        .cut-item:focus-within { border-color: var(--accent-color); }

        .cut-info {
            flex: 1;
            min-width: 0;
        }

        .cut-name {
            font-weight: 700;
            font-size: 1rem;
            color: var(--text-primary);
            display: block;
            margin-bottom: 4px;
        }

        .cut-meta {
            font-size: 0.72rem;
            color: var(--text-hint);
        }

        .cut-status-bar {
            height: 4px;
            background: rgba(156, 163, 175, 0.2);
            border-radius: 9999px;
            margin-top: 8px;
            overflow: hidden;
        }

        .cut-status-fill {
            height: 100%;
            width: 0%;
            border-radius: 9999px;
            transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s ease;
        }

        .cut-input-col {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            flex-shrink: 0;
        }

        .cut-input-label {
            font-size: 0.65rem;
            font-weight: 600;
            color: var(--text-hint);
            text-transform: uppercase;
            letter-spacing: 0.4px;
        }

        .cut-qty-input {
            width: 90px;
            text-align: center;
            font-weight: 700;
            font-size: 18px; /* >= 16px prevents iOS auto-zoom */
            border-radius: var(--radius-md);
            padding: 10px 8px;
            min-height: 52px;
        }

        .suggestion-chip {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            background: var(--accent-soft);
            color: var(--accent-color);
            border-radius: 9999px;
            padding: 2px 10px;
            font-size: 0.75rem;
            font-weight: 600;
            margin-top: 6px;
        }
        .dark .suggestion-chip {
            background: rgba(96, 165, 250, 0.15);
        }

        .suggestion-val {
            font-weight: 700;
        }

        /* Admin Dashboard & Navigation - Bottom Tab Bar (Mobile-First) */
        .admin-nav {
            display: flex;
            background: var(--card-bg);
            border: var(--card-border);
            padding: 8px;
            position: fixed;
            bottom: 12px;
            left: 12px;
            right: 12px;
            z-index: 900;
            gap: 4px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
            border-radius: var(--radius-xl);
            backdrop-filter: var(--glass-blur);
            -webkit-backdrop-filter: var(--glass-blur);
        }

        .admin-nav-item {
            flex: 1;
            text-align: center;
            padding: 8px 4px;
            border-radius: var(--radius-md);
            font-size: 0.65rem;
            font-weight: 600;
            color: var(--text-hint);
            cursor: pointer;
            transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            min-height: 48px;
            justify-content: center;
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
        }

        .admin-nav-item .nav-icon {
            font-size: 1.5rem;
            line-height: 1;
            transition: transform var(--transition-speed) ease;
        }

        .admin-nav-item .nav-label {
            font-size: 0.62rem;
            font-weight: 700;
            line-height: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%;
        }

        @media (hover: hover) and (pointer: fine) {
            .admin-nav-item:hover {
                color: var(--text-primary);
                background: rgba(255, 255, 255, 0.04);
            }
        }

        .admin-nav-item.active {
            color: var(--accent-color);
            background: var(--accent-soft);
        }
        .admin-nav-item.active .nav-icon {
            transform: translateY(-1px);
            font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
            text-shadow: 0 0 12px rgba(121, 161, 242, 0.6);
        }

        /* Sub-navegación segmentada (píldoras) por grupo */
        .admin-subnav {
            display: flex;
            gap: 8px;
            overflow-x: auto;
            scrollbar-width: none;
            -ms-overflow-style: none;
            padding: 2px 2px 4px;
            margin-bottom: 18px;
            scroll-snap-type: x proximity;
        }
        .admin-subnav::-webkit-scrollbar { display: none; }
        .admin-subnav:empty { display: none; }
        .subnav-pill {
            flex: 0 0 auto;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 9px 15px;
            border-radius: 9999px;
            font-family: 'Outfit', sans-serif;
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--text-secondary);
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.08);
            cursor: pointer;
            white-space: nowrap;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            scroll-snap-align: start;
            -webkit-tap-highlight-color: transparent;
        }
        .subnav-pill .material-symbols-outlined { font-size: 1.05rem; }
        .subnav-pill:active { transform: scale(0.96); }
        .subnav-pill.active {
            color: var(--on-accent);
            background: var(--btn-bg);
            border-color: transparent;
            box-shadow: var(--neon-glow);
        }
        .subnav-pill .subnav-count {
            font-size: 0.66rem;
            font-weight: 800;
            background: rgba(0, 0, 0, 0.18);
            border-radius: 9999px;
            padding: 1px 7px;
        }
        .subnav-pill.active .subnav-count { background: rgba(0, 0, 0, 0.22); }

        /* Encabezado de sección admin */
        .section-head {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            margin-bottom: 14px;
        }
        .section-head h2 {
            display: flex;
            align-items: center;
            gap: 9px;
            font-size: 1.12rem;
            font-weight: 700;
        }
        .section-head h2 .material-symbols-outlined {
            color: var(--accent-color);
            font-size: 1.35rem;
        }
        .section-sub {
            font-size: 0.78rem;
            color: var(--text-hint);
            margin: -6px 0 16px;
            line-height: 1.45;
        }

        /* Admin content needs bottom padding for fixed nav */
        #adminView {
            padding-bottom: calc(96px + var(--safe-area-bottom));
        }

        /* Order Cards (Admin View) */
        .order-card {
            border-left: 5px solid var(--accent-color);
            transition: all 0.25s ease;
        }
        
        .order-card.pending {
            border-left-color: var(--warning-color);
            background: linear-gradient(90deg, rgba(245, 158, 11, 0.03) 0%, var(--card-bg) 100%);
        }

        .order-card.confirmed {
            border-left-color: var(--success-color);
            background: linear-gradient(90deg, rgba(16, 185, 129, 0.03) 0%, var(--card-bg) 100%);
        }

        .order-card.rejected {
            border-left-color: var(--danger-color);
            background: linear-gradient(90deg, rgba(239, 68, 68, 0.03) 0%, var(--card-bg) 100%);
        }

        .badge {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 5px 10px;
            border-radius: 9999px;
            font-size: 0.7rem;
            font-weight: 700;
            letter-spacing: 0.3px;
            background: var(--accent-soft);
            color: var(--accent-color);
        }

        .badge-pending {
            background-color: rgba(245, 158, 11, 0.12);
            color: var(--warning-color);
        }

        .badge-confirmed {
            background-color: rgba(16, 185, 129, 0.12);
            color: var(--success-color);
        }

        .badge-rejected {
            background-color: rgba(239, 68, 68, 0.12);
            color: var(--danger-color);
        }

        /* Modifiers Section */
        .modifier-slider-container {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 20px;
        }

        .slider-header {
            display: flex;
            justify-content: space-between;
            font-size: 0.9rem;
            font-weight: 600;
        }

        .slider-value {
            color: var(--accent-color);
            font-weight: 700;
        }

        .slider-input {
            width: 100%;
            height: 8px;
            border-radius: 9999px;
            outline: none;
            -webkit-appearance: none;
            background: rgba(156, 163, 175, 0.2);
            transition: background 0.2s;
        }

        .slider-input::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: var(--accent-gradient);
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
            border: 2px solid var(--bg-primary);
            transition: transform 0.1s;
        }
        .slider-input::-webkit-slider-thumb:active {
            transform: scale(1.2);
        }

        /* User Item Card */
        .user-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 0;
            border-bottom: var(--card-border);
        }

        /* Modals & Loading */
        .modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.62);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            z-index: 1000;
            display: flex;
            justify-content: center;
            align-items: center;
            opacity: 0;
            pointer-events: none;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .modal.active {
            opacity: 1;
            pointer-events: auto;
        }

        .modal-content {
            background: var(--surface-2);
            border-radius: var(--radius-xl);
            padding: 24px;
            width: 90%;
            max-width: 480px;
            max-height: 88vh;
            overflow-y: auto;
            /* Ventana FIJA en horizontal. Ojo: poner overflow-y:auto promueve el otro eje
               de 'visible' a 'auto' implícitamente (regla de CSS), así que sin esta línea
               cualquier contenido más ancho que el modal lo vuelve arrastrable de lado.
               Lo que sí necesita scroll horizontal (.filter-bar, .admin-nav) lo maneja en
               su propio contenedor, no la ventana entera. */
            overflow-x: hidden;
            /* Al llegar al tope del scroll, el gesto no se propaga a la página de atrás. */
            overscroll-behavior: contain;
            /* Textos largos sin espacios (correos, nombres de producto) envuelven en vez
               de desbordar y quedar cortados por el overflow-x:hidden de arriba. */
            overflow-wrap: anywhere;
            box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.7);
            border: 1px solid rgba(255, 255, 255, 0.09);
            transform: scale(0.9) translateY(20px);
            transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

        .modal.active .modal-content {
            transform: scale(1) translateY(0);
        }

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

        .modal-header h3 {
            font-weight: 700;
            font-family: 'Outfit', sans-serif;
        }

        .modal-close {
            font-size: 1.75rem;
            cursor: pointer;
            color: var(--text-hint);
            line-height: 1;
            transition: color 0.2s;
        }
        .modal-close:hover {
            color: var(--text-primary);
        }

        /* Premium Table Styles for Summary */
        .summary-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 10px;
        }
        
        .summary-table th {
            padding: 10px 0;
            font-size: 0.8rem;
            color: var(--text-hint);
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            border-bottom: 2px solid rgba(156, 163, 175, 0.15);
        }
        
        .summary-table td {
            padding: 14px 0;
            font-size: 0.9rem;
            border-bottom: var(--card-border);
        }

        /* Fullscreen messages */
        .fullscreen-msg {
            flex-direction: column;
            justify-content: center;
            align-items: center;
            min-height: 70vh;
            text-align: center;
            padding: 24px;
        }

        .success-icon {
            width: 90px;
            height: 90px;
            border-radius: 50%;
            background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.2));
            border: 2px solid rgba(16, 185, 129, 0.25);
            color: var(--success-color);
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 3rem;
            margin-bottom: 24px;
            box-shadow: 0 8px 20px rgba(16, 185, 129, 0.15);
            animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

        @keyframes scaleIn {
            from { transform: scale(0); }
            to { transform: scale(1); }
        }

        .spinner {
            width: 44px;
            height: 44px;
            border: 4px solid rgba(156, 163, 175, 0.2);
            border-top: 4px solid var(--accent-color);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-bottom: 20px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* Responsive Layouts */
        @media (max-width: 480px) {
            .app-container {
                padding: calc(10px + var(--safe-area-top)) 10px 10px;
            }
            /* Con 6 grupos en la barra inferior las etiquetas se aprietan en
               pantallas chicas: se recorta el padding y el cuerpo de la etiqueta. */
            .admin-nav { padding: 6px 4px; gap: 2px; }
            .admin-nav-item { padding: 7px 2px; }
            .admin-nav-item .nav-icon { font-size: 1.35rem; }
            .admin-nav-item .nav-label { font-size: 0.55rem; }
            .card {
                padding: 16px;
                border-radius: var(--radius-lg);
            }
            header {
                padding: 14px 16px;
                border-radius: var(--radius-lg);
                margin-bottom: 16px;
            }
            .header-title h1 {
                font-size: 1.15rem;
            }
            .pills-container {
                gap: 6px;
            }
            .pill-btn {
                padding: 10px 8px;
                font-size: 0.85rem;
            }
            .cut-item {
                grid-template-columns: 1fr auto;
                gap: 10px;
            }
            .cut-qty-input {
                width: 90px;
            }

            /* Modales a pantalla completa en móvil: todo popup de configuración
               (local/proveedor/producto/usuario/cortes/resumen/revisión) sube como una
               hoja completa en vez de una ventanita centrada. Varios modales traen
               max-width inline (ej. 500px) — !important les gana. El header se saca del
               padding del contenedor con margin negativo y queda sticky arriba, para que
               el ✕ siempre esté visible mientras el resto hace scroll debajo.
               cropModal NO usa la clase .modal (ya es full-screen por diseño propio) y
               queda afuera de esta regla. */
            .modal-content {
                width: 100% !important;
                max-width: 100% !important;
                height: 100% !important;
                max-height: 100% !important;
                border-radius: 0 !important;
                padding: 20px !important;
                padding-bottom: calc(20px + var(--safe-area-bottom)) !important;
                display: flex;
                flex-direction: column;
                /* Hoja que sube desde abajo, mismo patrón que .bottom-sheet-content. */
                transform: translateY(100%) !important;
            }
            .modal.active .modal-content {
                transform: translateY(0) !important;
            }
            .modal-header {
                position: sticky;
                top: 0;
                z-index: 2;
                margin: -20px -20px 20px -20px;
                padding: calc(16px + var(--safe-area-top)) 20px 16px;
                background: var(--card-bg);
                border-bottom: 1px solid var(--bg-secondary);
            }
        }

        /* Hide scrollbar on admin nav for clean look */
        .admin-nav::-webkit-scrollbar { display: none; }
        .admin-nav { -ms-overflow-style: none; scrollbar-width: none; }

        /* Smooth scroll for everything */
        html {
            scroll-behavior: smooth;
        }

        /* Hidden utility */
        .hidden {
            display: none !important;
        }

        /* Dashboard KPI grid */
        .kpi-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
            margin-bottom: 14px;
        }
        .kpi-card {
            background: var(--card-bg);
            border: var(--card-border);
            border-radius: var(--radius-lg);
            padding: 14px 16px;
            box-shadow: var(--card-shadow);
        }
        .kpi-card .kpi-value {
            font-family: 'Outfit', sans-serif;
            font-size: 1.5rem;
            font-weight: 700;
            line-height: 1.1;
        }
        .kpi-card .kpi-label {
            font-size: 0.72rem;
            color: var(--text-hint);
            font-weight: 500;
            margin-top: 2px;
        }
        .kpi-card.accent .kpi-value { color: var(--accent-color); }
        .kpi-card.warn .kpi-value { color: var(--warning-color); }
        .kpi-card.ok .kpi-value { color: var(--success-color); }
        .kpi-card.danger .kpi-value { color: var(--danger-color); }

        /* Editable suggested-order input in the cook summary modal */
        .summary-ideal-input {
            width: 84px;
            padding: 7px 8px;
            border: 1px solid rgba(156, 163, 175, 0.35);
            border-radius: 10px;
            font-size: 0.9rem;
            font-weight: 700;
            text-align: right;
            color: var(--success-color);
            background: var(--bg-primary);
        }
        .summary-ideal-input:focus {
            outline: none;
            border-color: var(--accent-color);
        }

        /* Responsive Bottom Tab Options Drawer */
        .bottom-sheet {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            top: 0;
            z-index: 1100;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }
        .bottom-sheet.active {
            opacity: 1;
            pointer-events: auto;
        }
        .bottom-sheet-backdrop {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
        }
        .bottom-sheet-content {
            background: var(--bg-secondary);
            border-top: 1px solid rgba(255, 255, 255, 0.12);
            border-top-left-radius: 24px;
            border-top-right-radius: 24px;
            padding: 20px 20px calc(24px + var(--safe-area-bottom));
            z-index: 2;
            transform: translateY(100%);
            transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
            max-width: 600px;
            margin: 0 auto;
            width: 100%;
        }
        .bottom-sheet.active .bottom-sheet-content {
            transform: translateY(0);
        }
        .bottom-sheet-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            border-bottom: var(--card-border);
            padding-bottom: 12px;
        }
        .bottom-sheet-header h3 {
            font-size: 1.1rem;
            color: var(--text-primary);
            font-family: 'Outfit', sans-serif;
        }
        .bottom-sheet-close {
            font-size: 1.75rem;
            cursor: pointer;
            color: var(--text-hint);
            line-height: 1;
        }
        .more-options-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 12px;
        }
        .more-option-item {
            background: var(--card-bg);
            border: var(--card-border);
            border-radius: var(--radius-lg);
            padding: 16px 8px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
        }
        .more-option-item:active {
            transform: scale(0.95);
            background: rgba(156, 163, 175, 0.15);
        }
        .more-option-item .option-icon {
            font-size: 1.6rem;
        }
        .more-option-item .option-label {
            font-size: 0.72rem;
            font-weight: 600;
            color: var(--text-primary);
        }

        /* ═══════════════ Componentes nuevos (rediseño 2026) ═══════════════ */

        /* Entrada escalonada de listas (igual que el bot de cajas) */
        .stagger-item { animation: slideUpFade 0.45s cubic-bezier(0.16, 1, 0.3, 1) both; }
        @keyframes slideUpFade {
            from { opacity: 0; transform: translateY(16px); }
            to { opacity: 1; transform: translateY(0); }
        }

        /* Chips genéricos (proveedores en fichas de local, rubros, etc.) */
        .chip {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 5px 11px;
            border-radius: 9999px;
            font-size: 0.74rem;
            font-weight: 600;
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid rgba(255, 255, 255, 0.09);
            color: var(--text-secondary);
            white-space: nowrap;
        }
        .chip .material-symbols-outlined { font-size: 0.95rem; }
        .chip-accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-color); }
        .chip-success { background: var(--success-soft); border-color: transparent; color: var(--success-color); }
        .chip-warning { background: var(--warning-soft); border-color: transparent; color: var(--warning-color); }
        .chip-removable { padding-right: 6px; }
        .chip-removable .chip-x {
            display: inline-flex; align-items: center; justify-content: center;
            width: 18px; height: 18px; border-radius: 50%;
            background: rgba(0, 0, 0, 0.22); color: var(--text-secondary);
            cursor: pointer; font-size: 0.9rem; line-height: 1;
        }
        .chip-removable .chip-x:active { transform: scale(0.9); }

        /* Botón-ícono redondo para acciones en tarjetas */
        .icon-btn {
            display: inline-flex; align-items: center; justify-content: center;
            width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid rgba(255, 255, 255, 0.09);
            color: var(--text-secondary); cursor: pointer;
            transition: all 0.18s ease; -webkit-tap-highlight-color: transparent;
        }
        .icon-btn .material-symbols-outlined { font-size: 1.2rem; }
        .icon-btn:active { transform: scale(0.92); }
        @media (hover: hover) and (pointer: fine) {
            .icon-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.1); }
        }
        .icon-btn.danger { color: var(--danger-color); }
        .icon-btn.danger:hover { background: var(--danger-soft); }
        .icon-btn.accent { color: var(--accent-color); }
        .icon-btn.accent:hover { background: var(--accent-soft); }

        /* Ficha de local (rediseño) */
        .local-card { padding: 16px 16px 14px; }
        .local-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
        .local-card__title { font-size: 1.08rem; font-weight: 700; line-height: 1.2; }
        .local-card__addr {
            display: flex; align-items: center; gap: 5px;
            font-size: 0.78rem; color: var(--text-hint); margin-top: 3px;
        }
        .local-card__addr .material-symbols-outlined { font-size: 0.95rem; }
        .local-card__meta {
            display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px;
        }
        .local-card__providers {
            display: flex; flex-wrap: wrap; gap: 6px;
            margin-top: 12px; padding-top: 12px;
            border-top: 1px solid rgba(255, 255, 255, 0.06);
        }
        .local-card__label {
            width: 100%; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.5px;
            text-transform: uppercase; color: var(--text-hint); margin-bottom: 2px;
        }
        .local-card__actions {
            display: flex; gap: 7px; margin-top: 14px; flex-wrap: wrap;
        }

        /* Fila de producto (sección Productos) */
        .product-row {
            display: flex; align-items: center; gap: 12px;
            padding: 12px 14px; border-radius: var(--radius-lg);
            background: rgba(255, 255, 255, 0.035);
            border: 1px solid rgba(255, 255, 255, 0.06);
            transition: border-color 0.18s ease, background 0.18s ease;
        }
        @media (hover: hover) and (pointer: fine) {
            .product-row:hover { border-color: rgba(121,161,242,0.35); background: rgba(255,255,255,0.05); }
        }
        .product-row__icon {
            flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
            display: flex; align-items: center; justify-content: center; font-size: 1.15rem;
            background: var(--accent-soft);
        }
        .product-row__body { flex: 1; min-width: 0; }
        .product-row__name {
            font-size: 0.9rem; font-weight: 600; color: var(--text-primary);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .product-row__meta {
            font-size: 0.72rem; color: var(--text-hint); margin-top: 2px;
            display: flex; flex-wrap: wrap; gap: 4px 10px;
        }
        .product-row__price { font-weight: 700; color: var(--success-color); }

        /* Barra de filtros (rubro / proveedor) */
        .filter-bar { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; margin-bottom: 12px; }
        .filter-bar::-webkit-scrollbar { display: none; }
        .filter-chip {
            flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
            padding: 7px 13px; border-radius: 9999px; font-size: 0.78rem; font-weight: 600;
            color: var(--text-secondary); background: rgba(255,255,255,0.05);
            border: 1px solid rgba(255,255,255,0.08); cursor: pointer; white-space: nowrap;
            transition: all 0.18s ease; -webkit-tap-highlight-color: transparent;
        }
        .filter-chip.active { color: var(--on-accent); background: var(--btn-bg); border-color: transparent; }
        .filter-chip:active { transform: scale(0.96); }

        /* Estado vacío consistente */
        .empty-state {
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            text-align: center; padding: 40px 20px; color: var(--text-hint); gap: 10px;
        }
        .empty-state .material-symbols-outlined { font-size: 2.6rem; opacity: 0.5; }
        .empty-state p { font-size: 0.86rem; max-width: 260px; }

        /* Contador de sección en encabezado */
        .count-pill {
            font-size: 0.72rem; font-weight: 700; color: var(--accent-color);
            background: var(--accent-soft); border-radius: 9999px; padding: 2px 9px;
        }

        /* ═══════════════ Flujo de pedido del cocinero (rediseño) ═══════════════ */

        /* Progreso de pasos: Inventario → Pedido → Confirmar */
        .cook-stepper { display: flex; align-items: flex-start; margin: 2px 2px 20px; }
        .cook-step {
            flex: 1; display: flex; flex-direction: column; align-items: center;
            gap: 7px; position: relative; min-width: 0;
        }
        .cook-step:not(:last-child)::after {
            content: ''; position: absolute; top: 17px; left: 50%;
            width: 100%; height: 2px; background: rgba(255, 255, 255, 0.1); z-index: 0;
            transition: background 0.3s ease;
        }
        .cook-step.done:not(:last-child)::after { background: var(--success-color); }
        .cook-step__dot {
            position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 0.92rem;
            background: var(--bg-primary); border: 1.5px solid rgba(255, 255, 255, 0.14);
            color: var(--text-hint); transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
        }
        .cook-step__dot .material-symbols-outlined { font-size: 1.2rem; }
        .cook-step__label {
            font-size: 0.66rem; font-weight: 700; color: var(--text-hint);
            text-transform: uppercase; letter-spacing: 0.3px; text-align: center;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
        }
        .cook-step.active .cook-step__dot {
            background: var(--btn-bg); border-color: transparent; color: var(--on-accent);
            box-shadow: var(--neon-glow); transform: scale(1.08);
        }
        .cook-step.active .cook-step__label { color: var(--accent-color); }
        .cook-step.done .cook-step__dot {
            background: var(--success-soft); border-color: transparent; color: var(--success-color);
        }

        /* Banner del proveedor / rubro activo dentro del wizard */
        .cook-context-bar {
            display: flex; align-items: center; gap: 12px; padding: 12px 14px;
            border-radius: var(--radius-lg); margin-bottom: 16px;
            background: var(--accent-soft); border: 1px solid rgba(121, 161, 242, 0.2);
        }
        .cook-context-bar__icon {
            width: 40px; height: 40px; border-radius: 11px; flex: 0 0 auto;
            display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
            background: rgba(0, 0, 0, 0.18);
        }
        .cook-context-bar__body { flex: 1; min-width: 0; }
        .cook-context-bar__title { font-weight: 700; font-size: 0.95rem; }
        .cook-context-bar__sub { font-size: 0.72rem; color: var(--text-secondary); margin-top: 1px; }
        .cook-context-bar__change {
            flex: 0 0 auto; font-size: 0.74rem; font-weight: 700; color: var(--accent-color);
            background: rgba(0, 0, 0, 0.15); border: none; border-radius: 9999px;
            padding: 6px 12px; cursor: pointer; -webkit-tap-highlight-color: transparent;
        }
        .cook-context-bar__change:active { transform: scale(0.95); }

        /* Tarjeta de selección (rubro / proveedor) */
        .chooser-card {
            display: flex; align-items: center; gap: 14px; padding: 15px 16px;
            margin-bottom: 11px; cursor: pointer;
        }
        .chooser-card__icon {
            width: 50px; height: 50px; border-radius: 15px; flex: 0 0 auto;
            display: flex; align-items: center; justify-content: center; font-size: 1.7rem;
            background: var(--accent-soft);
        }
        .chooser-card__body { flex: 1; min-width: 0; }
        .chooser-card__title { font-size: 1.05rem; font-weight: 700; line-height: 1.2; }
        .chooser-card__sub { font-size: 0.76rem; color: var(--text-hint); margin-top: 4px; line-height: 1.35; }
        .chooser-card__arrow { flex: 0 0 auto; color: var(--accent-color); display: flex; }
        .chooser-card.disabled { opacity: 0.5; cursor: default; }
        .chooser-card.disabled .chooser-card__icon { background: rgba(255, 255, 255, 0.05); }
        .chooser-card.disabled .chooser-card__arrow { color: var(--text-hint); }

        /* Resultado de "Agregar producto del proveedor" (modal de búsqueda del cocinero).
           Antes era un <button> con style inline: sin :hover/:active/:focus-visible y con
           8px de padding vertical (bien por debajo de los 44px táctiles recomendados). */
        .product-pick {
            display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px;
            padding: 10px 14px; background: var(--bg-secondary); border: 1px solid transparent;
            border-radius: var(--radius-lg); text-align: left; cursor: pointer;
            color: var(--text-primary); font: inherit;
            transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
            -webkit-tap-highlight-color: transparent; touch-action: manipulation;
        }
        .product-pick:hover { border-color: var(--accent-color); }
        .product-pick:active { transform: scale(0.985); background: var(--accent-soft); }
        .product-pick:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
        .product-pick__body { flex: 1; min-width: 0; }
        .product-pick__name {
            font-weight: 600; font-size: 0.9rem; line-height: 1.25; color: var(--text-primary);
        }
        .product-pick__meta { font-size: 0.72rem; color: var(--text-hint); margin-top: 2px; }
        .product-pick__add {
            flex: 0 0 auto; width: 34px; height: 34px; border-radius: 11px;
            background: var(--accent-soft); color: var(--accent-color);
            display: flex; align-items: center; justify-content: center;
        }
        .product-pick__add .material-symbols-outlined { font-size: 1.15rem; }

        /* Quantity stepper estilo carrito (− valor +) */
        .qty-stepper {
            display: inline-flex; align-items: center; flex: 0 0 auto;
            background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 13px; overflow: hidden;
        }
        .qty-stepper button {
            width: 42px; height: 48px; background: transparent; border: none;
            color: var(--accent-color); display: flex; align-items: center; justify-content: center;
            cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
            transition: background 0.15s ease;
        }
        .qty-stepper button .material-symbols-outlined { font-size: 1.35rem; }
        .qty-stepper button:active { background: var(--accent-soft); }
        .qty-stepper button:disabled { color: var(--text-hint); opacity: 0.4; }
        .qty-stepper input {
            width: 56px; height: 48px; text-align: center; border: none; background: transparent;
            color: var(--text-primary); font-weight: 800; font-size: 17px;
            border-left: 1px solid rgba(255, 255, 255, 0.08);
            border-right: 1px solid rgba(255, 255, 255, 0.08);
            -webkit-appearance: none; appearance: none;
        }
        .qty-stepper input:focus { outline: none; background: rgba(121, 161, 242, 0.1); }
        .qty-stepper.filled { border-color: rgba(121, 161, 242, 0.5); }
        .qty-stepper.filled input { color: var(--accent-color); }

        /* Recibo del Paso 3 */
        .receipt-total {
            margin-top: 16px; padding: 16px; border-radius: var(--radius-lg);
            background: linear-gradient(135deg, rgba(121,161,242,0.12), rgba(121,161,242,0.05));
            border: 1px solid rgba(121, 161, 242, 0.2);
        }
        .receipt-total .receipt-line { display: flex; justify-content: space-between; font-size: 0.86rem; margin-bottom: 5px; }
        .receipt-total .receipt-line.muted { color: var(--text-hint); }
        .receipt-total .receipt-line.grand {
            font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.25rem;
            border-top: 1px solid rgba(255, 255, 255, 0.12); padding-top: 10px; margin-top: 8px; margin-bottom: 0;
        }
        .receipt-total .receipt-line.grand span:last-child { color: var(--accent-color); }

        /* ═══════════════ Asistente IA (chat + voz) ═══════════════ */

        .chat-log {
            display: flex;
            flex-direction: column;
            gap: 12px;
            /* El composer es sticky y flota sobre el log: sin este colchón el último
               mensaje queda tapado debajo de él al llegar al final de la conversación. */
            padding-bottom: 76px;
            min-height: 40vh;
        }

        .chat-msg {
            max-width: 88%;
            padding: 11px 14px;
            border-radius: var(--radius-lg);
            font-size: 0.9rem;
            line-height: 1.5;
            word-wrap: break-word;
            overflow-wrap: anywhere;
        }
        .chat-msg--user {
            align-self: flex-end;
            background: var(--btn-bg);
            color: var(--on-accent);
            font-weight: 600;
            border-bottom-right-radius: 4px;
        }
        .chat-msg--bot {
            align-self: flex-start;
            background: var(--card-bg);
            border: var(--card-border);
            color: var(--text-primary);
            border-bottom-left-radius: 4px;
        }
        .chat-msg--error {
            align-self: flex-start;
            background: var(--danger-soft);
            border: 1px solid rgba(248, 113, 113, 0.25);
            color: var(--danger-color);
            border-bottom-left-radius: 4px;
        }
        .chat-msg strong { color: var(--accent-color); font-weight: 700; }
        .chat-msg--user strong { color: inherit; }
        .chat-msg ul { margin: 6px 0 2px; padding-left: 18px; }
        .chat-msg li { margin-bottom: 3px; }

        /* Pie de trazabilidad: qué herramientas se consultaron */
        .chat-sources {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
            margin-top: 9px;
            padding-top: 8px;
            border-top: 1px solid rgba(255, 255, 255, 0.07);
        }
        .chat-sources .chip { font-size: 0.66rem; padding: 3px 8px; }

        /* Botón "Copiar" de las respuestas del asistente */
        .chat-copy {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            margin-left: auto;   /* empuja el botón a la derecha del pie */
            flex: 0 0 auto;
            padding: 5px 10px;
            border-radius: 9999px;
            font-family: inherit;
            font-size: 0.7rem;
            font-weight: 700;
            color: var(--text-hint);
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.09);
            cursor: pointer;
            transition: all 0.18s ease;
            -webkit-tap-highlight-color: transparent;
        }
        .chat-copy .material-symbols-outlined { font-size: 0.95rem; }
        .chat-copy:active { transform: scale(0.94); }
        @media (hover: hover) and (pointer: fine) {
            .chat-copy:hover { color: var(--accent-color); border-color: rgba(121, 161, 242, 0.4); }
        }
        .chat-copy.copiado {
            color: var(--success-color);
            background: var(--success-soft);
            border-color: transparent;
        }

        /* "Pensando…" */
        .chat-typing {
            align-self: flex-start;
            display: flex;
            align-items: center;
            gap: 5px;
            padding: 13px 16px;
            background: var(--card-bg);
            border: var(--card-border);
            border-radius: var(--radius-lg);
            border-bottom-left-radius: 4px;
        }
        .chat-typing span {
            width: 7px; height: 7px; border-radius: 50%;
            background: var(--accent-color);
            animation: chatBlink 1.3s infinite ease-in-out both;
        }
        .chat-typing span:nth-child(2) { animation-delay: 0.18s; }
        .chat-typing span:nth-child(3) { animation-delay: 0.36s; }
        @keyframes chatBlink {
            0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
            40%           { opacity: 1;    transform: scale(1); }
        }

        /* Chips de preguntas sugeridas (estado vacío) */
        .chat-suggestions {
            display: flex; flex-wrap: wrap; gap: 8px;
            justify-content: center; margin-top: 14px;
        }
        .chat-suggestions .chip {
            cursor: pointer;
            transition: all 0.18s ease;
            white-space: normal;
            text-align: left;
        }
        .chat-suggestions .chip:active { transform: scale(0.96); }
        @media (hover: hover) and (pointer: fine) {
            .chat-suggestions .chip:hover {
                border-color: rgba(121, 161, 242, 0.45);
                color: var(--accent-color);
            }
        }

        /* Composer: pegado sobre la barra de navegación fija (bottom:12px + ~64px) */
        .chat-composer {
            position: sticky;
            bottom: calc(88px + var(--safe-area-bottom));
            z-index: 5;
            display: flex;
            align-items: flex-end;
            gap: 8px;
            margin-top: 14px;
            padding: 10px;
            border-radius: var(--radius-xl);
            background: var(--surface-2);
            border: var(--card-border);
            box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.55);
            backdrop-filter: var(--glass-blur);
            -webkit-backdrop-filter: var(--glass-blur);
        }
        .chat-input {
            flex: 1;
            min-width: 0;
            resize: none;
            border: none;
            background: transparent;
            color: var(--text-primary);
            font-family: inherit;
            font-size: 16px; /* >= 16px evita el zoom automático de iOS */
            line-height: 1.45;
            padding: 10px 4px;
            max-height: 120px;
            outline: none;
        }
        .chat-input::placeholder { color: var(--text-hint); }

        .chat-send, .chat-mic { align-self: flex-end; }
        .chat-mic.recording {
            color: var(--danger-color);
            background: var(--danger-soft);
            border-color: transparent;
            animation: chatPulse 1.2s infinite;
        }
        @keyframes chatPulse {
            0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.45); }
            50%      { box-shadow: 0 0 0 9px rgba(248, 113, 113, 0); }
        }
        /* Contador de segundos mientras graba */
        .chat-rec-timer {
            font-size: 0.72rem;
            font-weight: 700;
            color: var(--danger-color);
            align-self: center;
            padding: 0 2px;
        }

        /* ============================================================
           Fotos de factura (conciliación visual)
           Miniatura dentro del modal de factura + visor a pantalla
           completa. La miniatura NUNCA puede pasarse de ancho: el modal
           está fijado en horizontal (ver .modal-content) y una imagen
           más ancha lo volvería arrastrable de lado.
           ============================================================ */
        .factura-fotos {
            display: flex;
            gap: 8px;
            overflow-x: auto;          /* varias fotos: scrollea la tira, no el modal */
            padding-bottom: 4px;
            -webkit-overflow-scrolling: touch;
        }
        .factura-foto-thumb {
            max-width: 100%;
            height: 120px;
            flex: 0 0 auto;
            object-fit: cover;
            border-radius: var(--radius-md, 10px);
            border: var(--card-border);
            cursor: zoom-in;
            background: var(--bg-secondary);
        }
        .factura-fotos-hint {
            font-size: 0.75rem;
            color: var(--text-hint);
            display: flex;
            align-items: center;
            gap: 6px;
        }

        #fotoViewer {
            display: none;             /* .open lo muestra (JS) */
            position: fixed;
            inset: 0;
            z-index: 10000;
            background: rgba(0, 0, 0, 0.94);
            flex-direction: column;
            /* El gesto de pellizco es del visor: sin esto el navegador (y el webview de
               Telegram) se queda con el toque para hacer scroll o cerrar la app. */
            touch-action: none;
            user-select: none;
            -webkit-user-select: none;
        }
        #fotoViewer.open { display: flex; }
        .foto-viewer-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 10px 12px;
            flex-shrink: 0;
            color: #fff;
            font-size: 0.76rem;
        }
        .foto-viewer-tools {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-shrink: 0;
        }
        .foto-viewer-tools > span {
            min-width: 44px;
            text-align: center;
            font-variant-numeric: tabular-nums;
        }
        .foto-viewer-btn {
            background: rgba(255, 255, 255, 0.14);
            color: #fff;
            border: none;
            width: 34px;
            height: 34px;
            border-radius: 50%;
            font-size: 1.2rem;
            line-height: 1;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }
        .foto-viewer-btn:active { background: rgba(255, 255, 255, 0.28); }
        /* Escenario del zoom: recorta, y la imagen se mueve por transform (no por
           scroll). Con scroll no se puede hacer pellizco fluido ni centrar el zoom en
           los dedos; con transform el gesto y el dibujo van siempre juntos. */
        .foto-viewer-stage {
            flex: 1;
            min-height: 0;
            position: relative;
            overflow: hidden;
            touch-action: none;
        }
        #fotoViewerImg {
            position: absolute;
            top: 0;
            left: 0;
            transform-origin: 0 0;     /* la matemática del zoom asume esquina, no centro */
            max-width: none;
            will-change: transform;
            -webkit-user-drag: none;
        }
        /* Solo se anima el volver a encajar (botón/doble toque); durante el gesto no,
           o la imagen "persigue" a los dedos con retraso. */
        #fotoViewerImg.animando { transition: transform 0.18s ease-out; }
        .foto-viewer-hint {
            flex-shrink: 0;
            text-align: center;
            color: rgba(255, 255, 255, 0.55);
            font-size: 0.7rem;
            padding: 6px 12px 14px;
            transition: opacity 0.3s;
        }
        .foto-viewer-hint.oculto { opacity: 0; }

        /* ============================================================
           Paneles del Paso 2 del cocinero: presupuesto vs pedido y
           comensales cubiertos. Números grandes y una barra por panel:
           la decisión es "¿me paso?" / "¿me alcanza?", y eso tiene que
           leerse sin leer.
           ============================================================ */
        .cook-panel {
            margin-bottom: 12px;
            padding: 12px 14px;
            background: var(--bg-secondary);
            border-radius: var(--radius-md, 12px);
            border: var(--card-border);
        }
        .cook-panel-head,
        .cook-panel-foot {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            gap: 10px;
        }
        .cook-panel-head { margin-bottom: 6px; }
        .cook-panel-foot { margin-top: 7px; }
        .cook-panel-label { font-size: 0.8rem; color: var(--text-hint); }
        .cook-panel-value {
            font-family: 'Outfit', sans-serif;
            font-size: 1.15rem;
            color: var(--accent-color);
            font-variant-numeric: tabular-nums;
        }
        .cook-panel-sub { font-size: 0.78rem; color: var(--text-secondary); }
        .cook-bar {
            height: 10px;
            border-radius: 5px;
            overflow: hidden;
            background: rgba(255, 255, 255, 0.1);
        }
        .cook-bar-fill {
            height: 100%;
            width: 0%;
            border-radius: 5px;
            background: var(--success-color);
            transition: width 0.3s ease, background-color 0.3s ease;
        }
        /* Chip del margen: es el número que decide si seguir cargando o frenar. */
        .cook-chip {
            font-size: 0.8rem;
            font-weight: 700;
            padding: 3px 10px;
            border-radius: 9999px;
            white-space: nowrap;
            font-variant-numeric: tabular-nums;
        }
        .cook-chip.ok     { color: var(--success-color); background: var(--success-soft); }
        .cook-chip.warn   { color: var(--warning-color); background: var(--warning-soft); }
        .cook-chip.danger { color: var(--danger-color);  background: var(--danger-soft); }

        .pax-grid {
            display: flex;
            align-items: stretch;
            gap: 10px;
            margin-bottom: 10px;
        }
        .pax-cell {
            flex: 1 1 0;
            min-width: 0;      /* sin esto un número largo desborda el panel */
            display: flex;
            flex-direction: column;
            gap: 1px;
        }
        .pax-sep {
            width: 1px;
            background: rgba(255, 255, 255, 0.1);
            flex: 0 0 auto;
        }
        .pax-label {
            font-size: 0.72rem;
            color: var(--text-hint);
            text-transform: uppercase;
            letter-spacing: 0.02em;
        }
        .pax-big {
            font-family: 'Outfit', sans-serif;
            font-size: 1.55rem;
            line-height: 1.15;
            font-variant-numeric: tabular-nums;
        }
        .pax-sub { font-size: 0.72rem; color: var(--text-hint); }
        .pax-veredicto {
            margin-top: 8px;
            font-size: 0.78rem;
            font-weight: 600;
            display: flex;
            align-items: flex-start;
            gap: 6px;
        }

        /* Sugerido del forecast bajo cada corte, en el modal de aprobación del admin. */
        .review-sug {
            font-size: 0.66rem;
            margin-top: 2px;
        }

        /* Lápiz para corregir a qué producto corresponde una línea de la factura. */
        .factura-linea-editar {
            font-size: 0.9rem;
            color: var(--text-hint);
            cursor: pointer;
            vertical-align: -2px;
            margin-left: 4px;
            padding: 2px;
        }
        .factura-linea-editar:active { color: var(--accent-color); }
