/* =========================================================
   PANEL PIDOVER — admin/css/admin.css
   CSS centralizado del panel de administración.
   Paleta de marca:
     Blanco #f6f7fa · Naranja #fe6b35 · Azul oscuro #1b2a4a
   Regla: sobre fondos claros → azul oscuro; sobre fondos
   oscuros (sidebar, header, KDS) → naranja de acento.
   Páginas: index.html + comandas.html (claras),
   cocina.html (body.pg-cocina, oscura), motorizado.html
   (body.pg-motorizado, clara con header oscuro).
   ========================================================= */

:root {
    /* Marca Pidover */
    --marca-azul: #1b2a4a;
    --marca-azul-medio: #2d4470;
    --marca-azul-noche: #12203a;
    --marca-naranja: #fe6b35;
    --marca-blanco: #f6f7fa;

    /* Tokens del panel (páginas claras) */
    --primary: #1b2a4a;        /* acciones sobre fondo claro: azul oscuro */
    --primary-dark: #12203a;   /* hover/pressed */
    --accent: #fe6b35;         /* acento SOLO sobre fondos oscuros */
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #6c757d;
    --border: #e9ecef;
}

/* ================= DASHBOARD (index.html) ================= */
* { box-sizing: border-box; }
        /* Editor de configuración: previews de imagen */
        .img-preview {
            width: 350px;
            max-width: 100%;
            border: 5px solid hsl(220 15% 80% / 1);
            border-radius: 5px;
        }
        .compuesto-img .img-preview { width: 200px; }
        .compuesto-img .img-field { margin-top: 0 !important; width: 212px; }
        #editor-body .compuesto-img input[type=file].form-control-sm { max-width: 212px !important; width: 212px; }
        #editor-body input.form-control.form-control-sm { max-width: 360px !important; }
        /* Lista de productos compacta */
        #editor-body details.border { margin-bottom: 0.35rem !important; }
        #editor-body details > summary { padding: 0.3rem 0.75rem !important; font-size: 0.9rem; }
        #editor-body details > div.p-2 { padding: 0.6rem 0.75rem !important; }
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--bg);
            color: var(--text);
            margin: 0;
            padding: 0;
        }
        .sidebar {
            position: fixed;
            top: 0;
            left: 0;
            width: 250px;
            height: 100vh;
            background: linear-gradient(180deg, #1b2a4a 0%, #12203a 100%);
            color: white;
            padding: 20px 0;
            overflow-y: auto;
            z-index: 100;
        }
        .sidebar-header {
            padding: 0 20px 20px;
            border-bottom: 1px solid rgba(255,255,255,0.1);
            margin-bottom: 20px;
        }
        .sidebar-header h3 {
            margin: 0;
            font-size: 1.3rem;
            color: var(--accent);
        }
        .sidebar-header small {
            color: rgba(255,255,255,0.6);
            font-size: 0.8rem;
        }
        .nav-item {
            padding: 12px 20px;
            cursor: pointer;
            transition: all 0.2s;
            border-left: 3px solid transparent;
            display: flex;
            align-items: center;
            gap: 10px;
            text-decoration: none;
            color: rgba(255,255,255,0.8);
        }
        .nav-item:hover {
            background: rgba(255,255,255,0.05);
            border-left-color: var(--accent);
            color: white;
        }
        .nav-item.active {
            background: rgba(254, 107, 53, 0.15);
            border-left-color: var(--accent);
            color: var(--accent);
        }
        .main-content {
            margin-left: 250px;
            padding: 30px;
            min-height: 100vh;
            max-width: 100%;
        }
        /* ---- HEADER superior (misma estética que comandas.html) ---- */
        .header {
            background: linear-gradient(135deg, #1b2a4a 0%, #12203a 100%);
            color: white;
            padding: 20px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 15px;
            position: sticky;
            top: 0;
            z-index: 100;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            margin-left: 250px;
        }
        .header h1 {
            margin: 0;
            font-size: 1.5rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .header h1 i {
            color: var(--accent);
        }
        .header-actions {
            display: flex;
            gap: 10px;
            align-items: center;
            flex-wrap: wrap;
        }
        @media (max-width: 768px) {
            .header { margin-left: 0; padding: 15px; }
        }
        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
            flex-wrap: wrap;
            gap: 15px;
        }
        .page-header h1 {
            font-size: 1.8rem;
            margin: 0;
            color: var(--text);
        }
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }
        .stat-card {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
            border-left: 4px solid var(--primary);
        }
        .stat-card .label {
            color: var(--text-light);
            font-size: 0.85rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .stat-card .value {
            font-size: 2rem;
            font-weight: bold;
            color: var(--text);
            margin-top: 5px;
        }
        .stat-card .icon {
            font-size: 2rem;
            color: var(--primary);
            opacity: 0.3;
            float: right;
        }
        .content-card {
            background: var(--card-bg);
            border-radius: 12px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
            overflow: hidden;
        }
        .content-card .card-header {
            padding: 15px 20px;
            border-bottom: 1px solid var(--border);
            background: #f8f9fa;
        }
        .content-card .card-header h5 {
            margin: 0;
            font-size: 1.1rem;
        }
        .content-card .card-body {
            padding: 0;
        }
        .table-responsive {
            overflow-x: auto;
        }
        .table {
            margin: 0;
        }
        .table thead {
            background: #f1f3f5;
        }
        .table th {
            font-weight: 600;
            color: var(--text);
            padding: 12px;
            border: none;
            font-size: 0.9rem;
        }
        .table td {
            padding: 12px;
            vertical-align: middle;
            border-color: var(--border);
        }
        .badge-estado {
            padding: 5px 10px;
            border-radius: 20px;
            font-size: 0.75rem;
            font-weight: 600;
        }
        .badge-pendiente { background: #fff3cd; color: #856404; }
        .badge-pago_verificado { background: #d0f0e0; color: #0a6b3d; }
        .badge-en_produccion { background: #cfe2ff; color: #084298; }
        .badge-listo { background: #e9d5ff; color: #5b21b6; }
        .badge-en_camino { background: #fed7aa; color: #9a3412; }
        .badge-entregado { background: #d1e7dd; color: #0f5132; }
        .badge-dinero_recibido { background: #d1f2eb; color: #0b6e4f; border: 1px solid #0b6e4f33; font-weight: 600; }
        .badge-cancelado { background: #f8d7da; color: #842029; }
        .btn-primary {
            background: var(--primary);
            border: none;
            border-radius: 8px;
            padding: 8px 16px;
            font-weight: 600;
        }
        .btn-primary:hover {
            background: var(--primary-dark);
        }
        .btn-outline-primary {
            color: var(--primary);
            border-color: var(--primary);
            border-radius: 8px;
        }
        .btn-outline-primary:hover {
            background: var(--primary);
            border-color: var(--primary);
            color: white;
        }
        .empty-state {
            text-align: center;
            padding: 60px 20px;
            color: var(--text-light);
        }
        .empty-state i {
            font-size: 4rem;
            opacity: 0.3;
            margin-bottom: 15px;
        }
        .action-btn {
            padding: 4px 8px;
            margin: 0 2px;
            border-radius: 6px;
            border: none;
            cursor: pointer;
            font-size: 0.85rem;
        }
        .action-btn.view { background: #e3f2fd; color: #1976d2; }
        .action-btn.view:hover { background: #bbdefb; }
        .iframe-container {
            height: calc(100vh - 120px);
            border-radius: 12px;
            overflow: hidden;
            background: white;
        }
        .iframe-container iframe {
            width: 100%;
            height: 100%;
            border: none;
        }
        /* SPA unificado: secciones iframe a pantalla completa, sin recargas */
        .spa-frame-wrap { margin: -30px; height: 100vh; }
        .spa-frame-wrap iframe { width: 100%; height: 100%; border: none; display: block; }
        body.frame-activo .header { display: none; }
        @media (max-width: 768px) {
            .sidebar { width: 100%; height: auto; position: relative; }
            .main-content { margin-left: 0; padding: 15px; }
            .iframe-container { height: 60vh; }
            .spa-frame-wrap { margin: -15px; height: 100vh; }
        }
        /* ---- Vista del Menú: selector con previews a escala ---- */
        .vista-opcion {
            display: block;
            border: 2px solid #dfe6f0;
            border-radius: 12px;
            padding: 12px;
            cursor: pointer;
            transition: border-color .2s, box-shadow .2s;
            background: #fff;
            margin: 0;
        }
        .vista-opcion:hover { border-color: #9db9e0; }
        .vista-opcion.activa { border-color: #1f5aad; box-shadow: 0 0 0 3px rgba(31,90,173,.15); }
        .vista-opcion input[type="radio"] { margin-top: .25rem; }
        .vista-opcion > span { display: inline-block; margin-bottom: 10px; color: #121d2b; }
        .vista-preview {
            background: #ecf1f8;
            border-radius: 8px;
            padding: 8px;
            margin-bottom: 8px;
        }
        .vista-preview:last-child { margin-bottom: 0; }
        .pv-titulo { font-size: .6rem; font-weight: 700; color: #121d2b; margin-bottom: 5px; }
        .pv-lista-fila {
            display: flex; align-items: center; gap: 6px;
            background: #fff; border-radius: 6px; padding: 5px 7px; margin-bottom: 4px;
            box-shadow: 0 1px 2px rgba(0,0,0,.05);
        }
        .pv-lista-fila:last-child { margin-bottom: 0; }
        .pv-thumb { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; flex-shrink: 0; border: 1.5px solid #e8f0fb; }
        .pv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
        .pv-txt { flex: 1; min-width: 0; }
        .pv-nombre { font-size: .58rem; font-weight: 700; color: #121d2b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .pv-linea { height: 3px; background: #dfe6f0; border-radius: 2px; margin-top: 3px; width: 90%; }
        .pv-linea.w70 { width: 70%; }
        .pv-precio { font-size: .58rem; font-weight: 700; color: #1f5aad; flex-shrink: 0; }
        .pv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #ecf1f8; }
        .pv-card { background: #fff; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
        .pv-card-img { height: 34px; overflow: hidden; }
        .pv-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
        .pv-sin-foto { background: linear-gradient(135deg, #dfe6f0, #c8d4e6); }
        .pv-card-txt { padding: 4px 6px 6px; }
        .pv-escala-label { font-size: .55rem; color: #6b7686; text-align: right; margin-bottom: 2px; }
        /* ob6: parpadeo rojo en campos mal rellenados al fallar el guardado */
        .campo-mal { border-color: #dc3545 !important; box-shadow: 0 0 0 3px rgba(220,53,69,.25) !important; animation: campo-mal-parpadeo 0.6s ease-in-out 6; }
        @keyframes campo-mal-parpadeo { 0%,100% { background-color: #fff; } 50% { background-color: #fde2e4; } }
        /* 📊 monitor de ventas: pulso "EN VIVO" + grid responsive */
        .ventas-pulso { animation: ventas-pulso 1.6s ease-in-out infinite; }
        @keyframes ventas-pulso { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
        @media (max-width: 900px) {
            .ventas-grid { grid-template-columns: 1fr !important; }
        }

/* ================= COMANDAS (comandas.html) ================= */
* { box-sizing: border-box; }
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--bg);
            color: var(--text);
            margin: 0;
            padding: 0;
        }
        .header {
            background: linear-gradient(135deg, #1b2a4a 0%, #12203a 100%);
            color: white;
            padding: 20px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 15px;
            position: sticky;
            top: 0;
            z-index: 100;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            margin-left: 250px;
        }
        .header h1 {
            margin: 0;
            font-size: 1.5rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .header h1 i {
            color: var(--accent);
        }
        .header-actions {
            display: flex;
            gap: 10px;
            align-items: center;
            flex-wrap: wrap;
        }
        .auto-refresh-indicator {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.85rem;
            color: rgba(255,255,255,0.7);
            background: rgba(255,255,255,0.1);
            padding: 6px 12px;
            border-radius: 20px;
        }
        .pulse-dot {
            width: 8px;
            height: 8px;
            background: #4ade80;
            border-radius: 50%;
            animation: pulse 2s infinite;
        }
        @keyframes pulse {
            0% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.5; transform: scale(0.8); }
            100% { opacity: 1; transform: scale(1); }
        }
        .main-content {
            padding: 30px;
            max-width: 100%;
            margin: 0 auto;
            margin-left: 250px;
        }
        /* ---- SIDEBAR (misma estética que index.html) ---- */
        .sidebar {
            position: fixed;
            top: 0;
            left: 0;
            width: 250px;
            height: 100vh;
            background: linear-gradient(180deg, #1b2a4a 0%, #12203a 100%);
            color: white;
            padding: 20px 0;
            overflow-y: auto;
            z-index: 1000;
            display: flex;
            flex-direction: column;
        }
        .sidebar-header {
            padding: 0 20px 20px;
            border-bottom: 1px solid rgba(255,255,255,0.1);
            margin-bottom: 20px;
        }
        .sidebar-header h3 {
            margin: 0;
            font-size: 1.3rem;
            color: var(--accent);
        }
        .sidebar-header small {
            color: rgba(255,255,255,0.6);
            font-size: 0.8rem;
        }
        .nav-item {
            padding: 12px 20px;
            cursor: pointer;
            transition: all 0.2s;
            border-left: 3px solid transparent;
            display: flex;
            align-items: center;
            gap: 10px;
            text-decoration: none;
            color: rgba(255,255,255,0.8);
        }
        .nav-item:hover {
            background: rgba(255,255,255,0.05);
            border-left-color: var(--accent);
            color: white;
        }
        .nav-item.active {
            background: rgba(254, 107, 53, 0.15);
            border-left-color: var(--accent);
            color: var(--accent);
        }
        .filter-bar {
            background: var(--card-bg);
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
            margin-bottom: 20px;
        }
        .filter-bar .row > div {
            margin-bottom: 10px;
        }
        .form-control, .form-select {
            border-radius: 8px;
            border: 1px solid var(--border);
            padding: 8px 12px;
        }
        .form-control:focus, .form-select:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 0.2rem rgba(254, 107, 53, 0.15);
        }
        .btn-primary {
            background: var(--primary);
            border: none;
            border-radius: 8px;
            padding: 8px 16px;
            font-weight: 600;
        }
        .btn-primary:hover {
            background: var(--primary-dark);
        }
        .btn-outline-primary {
            color: var(--primary);
            border-color: var(--primary);
            border-radius: 8px;
        }
        button.btn.btn-outline-primary.w-100 {
          width: 42px !important;
          height: 42px;
        }
        .btn-outline-primary:hover {
            background: var(--primary);
            border-color: var(--primary);
            color: white;
        }
        .comandas-table {
            background: var(--card-bg);
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        }
        .comandas-table table {
            margin: 0;
        }
        .comandas-table thead {
            background: #f1f3f5;
        }
        .comandas-table th {
            font-weight: 600;
            color: var(--text);
            padding: 12px;
            border: none;
            font-size: 0.9rem;
        }
        .comandas-table td {
            padding: 12px;
            vertical-align: middle;
            border-color: var(--border);
        }
        .badge-estado {
            padding: 5px 10px;
            border-radius: 20px;
            font-size: 0.75rem;
            font-weight: 600;
        }
        .badge-pendiente { background: #fff3cd; color: #856404; }
        .badge-pago_verificado { background: #d0f0e0; color: #0a6b3d; }
        .badge-en_produccion { background: #cfe2ff; color: #084298; }
        .badge-listo { background: #e9defc; color: #5b21b6; }
        .badge-en_camino { background: #d3eefc; color: #075985; }
        .badge-procesando { background: #cfe2ff; color: #084298; }
        .badge-enviar_a_sr { background: #e2d9f3; color: #59359a; }
        .badge-enviada_sr { background: #d5c9f7; color: #3d1f8f; }
        .badge-error_sr { background: #fde3cf; color: #9a3412; }
        .badge-entregado { background: #d1e7dd; color: #0f5132; }
        .badge-dinero_recibido { background: #d1f2eb; color: #0b6e4f; border: 1px solid #0b6e4f33; font-weight: 600; }
        .badge-cancelado { background: #f8d7da; color: #842029; }
        .badge-cobro-pendiente { background: #ffe0b3; color: #9a3412; animation: parpadeo-cobro 1.6s infinite; }
        @keyframes parpadeo-cobro { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
        .badge-pago {
            padding: 4px 8px;
            border-radius: 6px;
            font-size: 0.75rem;
            font-weight: 600;
        }
        .badge-pago-registrado { background: #d1e7dd; color: #0f5132; }
        .badge-pago-efectivo { background: #fff3cd; color: #856404; }
        .action-btn {
            padding: 4px 8px;
            margin: 0 2px;
            border-radius: 6px;
            border: none;
            cursor: pointer;
            font-size: 0.85rem;
            transition: all 0.2s;
        }
        .action-btn:hover {
            transform: translateY(-1px);
            opacity: 0.9;
        }
        .action-btn.view { background: #e3f2fd; color: #1976d2; }
        .action-btn.status { background: #e8f5e9; color: #2e7d32; }
        .action-btn.delete { background: #ffebee; color: #c62828; }
        .empty-state {
            text-align: center;
            padding: 60px 20px;
            color: var(--text-light);
        }
        .empty-state i {
            font-size: 4rem;
            opacity: 0.3;
            margin-bottom: 15px;
        }
        /* Animación para nuevas comandas */
        @keyframes highlightNew {
            0% { background-color: rgba(254, 107, 53, 0.2); }
            100% { background-color: transparent; }
        }
        .new-comanda {
            animation: highlightNew 2s ease-out;
        }
        /* Notificación toast */
        .toast-container {
            position: fixed;
            bottom: 20px;
            right: 20px;
            z-index: 1000;
        }
        .custom-toast {
            background: var(--primary);
            color: white;
            padding: 12px 20px;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.2);
            display: flex;
            align-items: center;
            gap: 10px;
            margin-top: 10px;
            opacity: 0;
            transform: translateY(20px);
            transition: all 0.3s ease;
        }
        .custom-toast.show {
            opacity: 1;
            transform: translateY(0);
        }
        /* Modal */
        .modal-custom .modal-content {
            border-radius: 15px;
            border: none;
        }
        .modal-custom .modal-header {
            background: var(--primary);
            color: white;
            border-radius: 15px 15px 0 0;
            border: none;
        }
        .modal-custom .btn-close {
            filter: brightness(0) invert(1);
        }
        .comanda-detail {
            max-height: 60vh;
            overflow-y: auto;
        }
        .detail-section {
            background: #f8f9fa;
            border-radius: 10px;
            padding: 15px;
            margin-bottom: 15px;
        }
        .detail-section h6 {
            color: var(--primary);
            margin-bottom: 10px;
            font-weight: 700;
            border-bottom: 2px solid var(--primary);
            padding-bottom: 5px;
        }
        .detail-row {
            display: flex;
            justify-content: space-between;
            padding: 6px 0;
            border-bottom: 1px dashed #ddd;
        }
        .detail-row:last-child { border-bottom: none; }
        .detail-row strong { color: var(--text); }
        .detail-row span { color: var(--text-light); }
        .item-detail {
            background: white;
            border-radius: 8px;
            padding: 10px;
            margin-bottom: 8px;
            border-left: 3px solid var(--primary);
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .item-detail .item-thumb {
            width: 46px;
            height: 46px;
            border-radius: 8px;
            object-fit: cover;
            flex-shrink: 0;
        }
        img.zoomable { cursor: zoom-in; }
        .item-detail .item-detail-info { flex: 1; min-width: 0; }
        .item-detail .name { font-weight: 600; }
        .item-detail .options {
            font-size: 0.85rem;
            color: var(--text-light);
            font-style: italic;
            margin-top: 3px;
        }
        .item-detail .price {
            color: var(--primary);
            font-weight: 700;
            float: none;
            white-space: nowrap;
        }
        .stats-mini {
            display: flex;
            gap: 20px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }
        .stat-mini {
            background: var(--card-bg);
            padding: 15px 20px;
            border-radius: 10px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
            display: flex;
            align-items: center;
            gap: 15px;
        }
        .stat-mini .icon {
            width: 40px;
            height: 40px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
        }
        .stat-mini .value {
            font-size: 1.5rem;
            font-weight: bold;
            margin: 0;
        }
        .stat-mini .label {
            font-size: 0.8rem;
            color: var(--text-light);
            margin: 0;
        }
        @media (max-width: 768px) {
            .main-content { padding: 15px; margin-left: 0; }
            .header { padding: 15px; margin-left: 0; }
            .sidebar { width: 100%; height: auto; position: relative; }
            .stats-mini { flex-direction: column; }
        }

/* ================= COCINA / KDS (cocina.html — página oscura) ================= */
body.pg-cocina {
    --primary: #fe6b35;      /* página oscura: naranja permitido */
    --bg: #14181d;
    --card-bg: #1f262e;
    --verde: #22c55e;
    --ambar: #f59e0b;
    --rojo: #ef4444;
    --text: #f1f5f9;
    --text-dim: #94a3b8;
}
body.pg-cocina * { box-sizing: border-box; }
body.pg-cocina {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--bg);
            color: var(--text);
            margin: 0;
            min-height: 100vh;
        }
body.pg-cocina .kds-header {
            background: #0f1317;
            padding: 14px 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
            position: sticky;
            top: 0;
            z-index: 100;
            border-bottom: 2px solid var(--primary);
        }
body.pg-cocina .kds-header h1 { margin: 0; font-size: 1.5rem; display: flex; align-items: center; gap: 10px; }
body.pg-cocina .kds-header h1 span { color: var(--primary); }
body.pg-cocina .kds-meta { display: flex; gap: 14px; align-items: center; font-size: .85rem; color: var(--text-dim); }
body.pg-cocina .badge-sound {
            cursor: pointer; user-select: none;
            background: rgba(255,255,255,.08); padding: 5px 12px; border-radius: 16px;
        }
body.pg-cocina .grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
            gap: 18px;
            padding: 22px;
            max-width: 1800px;
            margin: 0 auto;
        }
body.pg-cocina .kcard {
            background: var(--card-bg);
            border-radius: 14px;
            border-left: 8px solid var(--verde);
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            animation: aparecer .3s ease;
        }
body.pg-cocina .kcard.ambar { border-left-color: var(--ambar); }
body.pg-cocina .kcard.rojo { border-left-color: var(--rojo); background: #2b1c19; }
body.pg-cocina .kcard.nueva { box-shadow: 0 0 0 3px var(--primary), 0 0 24px rgba(254,107,53,.5); }
body.pg-cocina .kcard.listo-marcar { border-left-color: #38bdf8; }
@keyframes aparecer { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
body.pg-cocina .kcard-top {
            display: flex; justify-content: space-between; align-items: center;
        }
body.pg-cocina .kcard-num { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
body.pg-cocina .kcard-timer {
            font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums;
            padding: 4px 12px; border-radius: 10px; background: rgba(255,255,255,.07);
        }
body.pg-cocina .timer-verde { color: var(--verde); }
body.pg-cocina .timer-ambar { color: var(--ambar); }
body.pg-cocina .timer-rojo { color: var(--rojo); }
body.pg-cocina .kcard-tags { display: flex; gap: 6px; flex-wrap: wrap; }
body.pg-cocina .tag {
            font-size: .72rem; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
            padding: 3px 10px; border-radius: 10px; background: rgba(255,255,255,.08); color: var(--text-dim);
        }
body.pg-cocina .tag.modalidad { background: rgba(254,107,53,.18); color: var(--primary); }
body.pg-cocina .tag.mesa { background: rgba(56,189,248,.15); color: #38bdf8; }
body.pg-cocina .tag.estado { background: rgba(34,197,94,.15); color: var(--verde); }
body.pg-cocina .tag.estado.l { background: rgba(56,189,248,.15); color: #38bdf8; }
body.pg-cocina .kcard-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
body.pg-cocina .kcard-items li {
            background: rgba(255,255,255,.04);
            padding: 9px 12px; border-radius: 9px; font-size: .95rem; line-height: 1.35;
        }
body.pg-cocina .kcard-items li .qty {
            display: inline-block; min-width: 26px; text-align: center;
            background: var(--primary); color: #fff; font-weight: 800;
            border-radius: 6px; padding: 1px 6px; margin-right: 8px; font-size: .85rem;
        }
body.pg-cocina .kcard-items li.item-nuevo {
            border: 1px dashed var(--primary);
            background: rgba(254,107,53,.12);
        }
body.pg-cocina .kcard-items li.item-nuevo::after {
            content: 'NUEVO'; font-size: .62rem; font-weight: 800; color: var(--primary);
            margin-left: 8px; vertical-align: middle; letter-spacing: .5px;
        }
body.pg-cocina .item-nota { display: block; font-size: .78rem; color: var(--text-dim); margin-top: 3px; margin-left: 42px; }
body.pg-cocina .btn-listo {
            margin-top: auto;
            padding: 16px;
            border: none; border-radius: 11px;
            background: var(--verde); color: #06230f;
            font-size: 1.15rem; font-weight: 800; letter-spacing: .5px;
            cursor: pointer; transition: filter .15s;
        }
body.pg-cocina .btn-listo:hover { filter: brightness(1.1); }
body.pg-cocina .btn-listo:disabled { background: #38bdf8; color: #06202e; cursor: default; }
body.pg-cocina .vacio {
            grid-column: 1 / -1; text-align: center; padding: 90px 20px;
            color: var(--text-dim); font-size: 1.15rem;
        }
body.pg-cocina .vacio .emoji { font-size: 3.2rem; display: block; margin-bottom: 14px; }
body.pg-cocina #toast-kds {
            position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
            background: #0f1317; color: var(--text); border: 1px solid var(--primary);
            padding: 12px 22px; border-radius: 12px; font-size: .95rem; z-index: 9999;
            display: none; box-shadow: 0 8px 30px rgba(0,0,0,.5);
        }
body.pg-cocina .refresh-dot { width: 9px; height: 9px; background: var(--verde); border-radius: 50%; animation: pulso 2s infinite; }
@keyframes pulso { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* ================= MOTORIZADO (motorizado.html) ================= */
body.pg-motorizado {
    --bg: #f4f5f7;
    --verde: #22c55e;
    --azul: #4a5fd2;
    --text: #22303c;
    --dim: #6b7a89;
    --accent: #fe6b35;
}
body.pg-motorizado * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body.pg-motorizado {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--bg); color: var(--text); margin: 0; min-height: 100vh;
        }
body.pg-motorizado .m-header {
            background: linear-gradient(135deg, #1b2a4a 0%, #12203a 100%);
            color: #fff; padding: 16px 18px;
            position: sticky; top: 0; z-index: 100;
            display: flex; justify-content: space-between; align-items: center; gap: 10px;
            border-bottom: 3px solid var(--accent);
        }
body.pg-motorizado .m-header h1 { margin: 0; font-size: 1.5rem; }
body.pg-motorizado .m-header h1 span { color: var(--accent); }
body.pg-motorizado .m-header .meta { font-size: .78rem; color: rgba(255,255,255,.7); text-align: right; }
body.pg-motorizado .lista { padding: 16px; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
body.pg-motorizado .ecard {
            background: #fff; border-radius: 16px; padding: 16px;
            box-shadow: 0 2px 10px rgba(0,0,0,.07);
            animation: aparecer .25s ease;
        }
body.pg-motorizado .ecard.recien { box-shadow: 0 0 0 3px var(--accent), 0 4px 18px rgba(254,107,53,.35); }
body.pg-motorizado .ec-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
body.pg-motorizado .ec-num { font-size: 1.4rem; font-weight: 800; color: var(--primary); }
body.pg-motorizado .ec-tag {
            font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
            padding: 3px 10px; border-radius: 10px;
        }
body.pg-motorizado .tag-camino { background: rgba(74,95,210,.12); color: #3648a8; }
body.pg-motorizado .tag-cobra { background: rgba(34,197,94,.15); color: #15803d; }
body.pg-motorizado .tag-ya { background: rgba(107,122,137,.15); color: var(--dim); }
body.pg-motorizado .ec-cliente { font-size: 1rem; font-weight: 600; margin-bottom: 2px; }
body.pg-motorizado .ec-dir { font-size: .88rem; color: var(--dim); margin-bottom: 8px; line-height: 1.4; }
body.pg-motorizado .ec-total { font-size: 1.25rem; font-weight: 800; margin-bottom: 10px; }
body.pg-motorizado .ec-total small { font-size: .75rem; color: var(--dim); font-weight: 500; display: block; }
body.pg-motorizado .ec-items { font-size: .85rem; color: var(--dim); margin-bottom: 12px; }
body.pg-motorizado .acciones { display: flex; gap: 10px; flex-wrap: wrap; }
body.pg-motorizado .btn-m {
            flex: 1; min-width: 140px; padding: 15px 10px; border: none; border-radius: 12px;
            font-size: 1rem; font-weight: 700; cursor: pointer; color: #fff;
        }
body.pg-motorizado .btn-entregar { background: var(--verde); }
body.pg-motorizado .btn-caja { background: #b45309; }
body.pg-motorizado .btn-ruta { background: var(--azul); color: #ffffff; }
body.pg-motorizado .btn-wa { background: #25d366; color: #fff; }
body.pg-motorizado .btn-m:disabled { opacity: .5; }
body.pg-motorizado .monto-escrito { font-size: .82rem; color: #64748b; margin: 6px 0 0; line-height: 1.55; }
body.pg-motorizado .monto-escrito b { color: #1e293b; }
body.pg-motorizado .vacio { text-align: center; padding: 70px 20px; color: var(--dim); }
body.pg-motorizado .vacio .emoji { font-size: 3rem; display: block; margin-bottom: 12px; }
body.pg-motorizado #toast-m {
            position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
            background: #22303c; color: #fff; padding: 12px 22px; border-radius: 12px;
            font-size: .92rem; z-index: 9999; display: none; max-width: 92%;
            box-shadow: 0 8px 24px rgba(0,0,0,.35);
        }
body.pg-motorizado .entregada-banner {
            background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.4);
            color: #15803d; border-radius: 10px; padding: 10px; font-size: .88rem; font-weight: 600;
        }