/* ═══════════════════════════════════════════════════════════════
   SUPER POS — Estilos del Punto de Venta
   ═══════════════════════════════════════════════════════════════ */

:root {
    --sp-blue: #003366;
    --sp-red: #E60000;
    --sp-bg: #f0f2f5;
    --sp-surface: #ffffff;
    --sp-text: #1e293b;
    --sp-text-muted: #64748b;
    --sp-border: #e2e8f0;
    --sp-success: #10b981;
    --sp-danger: #ef4444;
    --sp-warning: #f59e0b;
    --sp-info: #3b82f6;
    --sp-radius: 14px;
    --sp-radius-sm: 10px;
    --sp-shadow: 0 2px 12px rgba(0,0,0,0.05);
    --sp-shadow-md: 0 8px 25px rgba(0,0,0,0.1);
    --sp-transition: 0.2s cubic-bezier(0.4,0,0.2,1);

    /* Legacy vars — keep for HTML that still references these */
    --primary: #003366;
    --accent: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-light: #64748b;
}

* { box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background: var(--bg-body);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: var(--text-main);
}

/* ═══════════════ HEADER ═══════════════ */
header {
    background: linear-gradient(135deg, var(--sp-blue) 0%, #001a33 100%) !important;
    color: white;
    padding: 0 20px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 20px rgba(0,51,102,0.25);
    z-index: 50;
    position: relative;
    border-bottom: none;
}
.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.burger-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 38px;
    height: 38px;
    border-radius: var(--sp-radius-sm);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--sp-transition);
}
.burger-btn:hover { background: rgba(255,255,255,0.18); }
.brand-title {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.3px;
}
.user-info {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
}

/* ═══════════════ MAIN LAYOUT ═══════════════ */
.main-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 62px);
    overflow: hidden;
}
.products-panel {
    flex: 1;
    padding: 15px;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}
.search-container {
    position: relative;
    margin-bottom: 12px;
}
.search-box input {
    width: 100%;
    padding: 11px 12px 11px 40px;
    font-size: 1rem;
    border: 2px solid var(--sp-border);
    border-radius: 50px;
    background: var(--sp-surface);
    font-family: 'Poppins', sans-serif;
    transition: var(--sp-transition);
}
.search-box input:focus {
    border-color: var(--sp-info);
    box-shadow: 0 0 0 4px rgba(59,130,246,0.1);
}
.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

/* ═══════════════ PRODUCT GRID ═══════════════ */
.grid-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    overflow-y: auto;
    padding: 5px;
    padding-bottom: 80px;
}
.card {
    background: linear-gradient(180deg, #ffffff 0%, #ffffff 48%, #f0f3f8 65%, #e8ecf4 100%);
    padding: 10px;
    text-align: center;
    border-radius: var(--sp-radius);
    cursor: pointer;
    box-shadow: var(--sp-shadow);
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    backface-visibility: hidden;
    position: relative;
}
.card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--sp-blue), transparent);
    opacity: 0.3;
    border-radius: 0 0 var(--sp-radius) var(--sp-radius);
}
.card:hover {
    border-color: var(--sp-info);
    transform: translateY(-3px);
    box-shadow: var(--sp-shadow-md);
}
.card img {
    width: 100%;
    height: 70px;
    object-fit: contain;
    margin-bottom: 8px;
}
.card h4 {
    margin: 0 0 5px 0;
    font-size: 0.82rem;
    height: auto !important;
    min-height: 32px;
    overflow: visible !important;
    display: block !important;
    -webkit-line-clamp: unset !important;
}
.card .price {
    color: var(--sp-red);
    font-weight: 800;
    font-size: 1rem;
}

/* ═══════════════ CART PANEL ═══════════════ */
.cart-panel {
    width: 380px;
    background: var(--sp-surface);
    border-left: 1px solid var(--sp-border);
    display: flex;
    flex-direction: column;
    z-index: 40;
}
.cart-header {
    padding: 12px 15px;
    background: linear-gradient(135deg, var(--sp-blue), #001a33);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.95rem;
}
.cart-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    list-style: none;
    margin: 0;
}
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}
.cart-item:hover { background: #fafbfc; }
.qty-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}
.btn-qty {
    background: #f8fafc;
    border: none;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--sp-blue);
    font-size: 0.8rem;
    transition: background 0.2s;
}
.btn-qty:hover { background: #e2e8f0; }
.btn-qty:active { background: #cbd5e1; }
.qty-input {
    width: 35px;
    text-align: center;
    border: none;
    border-left: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
    -moz-appearance: textfield;
}

.cart-footer {
    padding: 20px;
    background: #f8fafc;
    border-top: 1px solid var(--sp-border);
}
.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 15px;
}
.btn-pay {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: var(--sp-transition);
    color: white;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 4px 14px rgba(22,163,74,0.35);
}
.btn-pay:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 20px rgba(22,163,74,0.5);
}
.btn-pay:disabled {
    background: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
    filter: none;
}

/* ═══════════════ CREDIT BUTTON ═══════════════ */
.credit-btn {
    background: var(--sp-warning) !important;
    color: white !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    width: auto !important;
    min-width: 65px;
    padding: 0 12px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-weight: 800 !important;
    font-size: 0.9rem !important;
}
.credit-btn:hover {
    background: #d97706 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(245,158,11,0.4);
}

/* ═══════════════ MODAL OVERLAY ═══════════════ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

/* SweetAlert2 debe mostrarse por encima de los modales */
.swal2-container { z-index: 9999 !important; }

.modal-content {
    background: var(--sp-surface);
    width: 90%;
    max-width: 450px;
    padding: 25px;
    border-radius: var(--sp-radius);
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
}
.pay-input {
    width: 100%;
    padding: 15px;
    font-size: 2rem;
    font-family: 'Poppins', sans-serif;
    text-align: center;
    border: 2px solid var(--sp-blue);
    border-radius: var(--sp-radius-sm);
    box-sizing: border-box;
    margin-bottom: 10px;
}

/* ═══════════════ AUTOCOMPLETE ═══════════════ */
.autocomplete-wrapper {
    position: relative;
    flex: 1;
}
.autocomplete-input {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1.5px solid var(--sp-border);
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
}
.autocomplete-list {
    position: absolute;
    border: 1px solid #d4d4d4;
    border-bottom: none;
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0; right: 0;
    max-height: 200px;
    overflow-y: auto;
    background-color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 0 0 var(--sp-radius-sm) var(--sp-radius-sm);
}
.autocomplete-list div {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.92rem;
    transition: background 0.1s;
}
.autocomplete-list div:hover { background-color: #eff6ff; }
.autocomplete-list strong { color: var(--sp-blue); }
.autocomplete-active {
    background-color: #dbeafe !important;
    color: var(--sp-blue);
    font-weight: 600;
}

.search-wrapper {
    position: relative;
    flex: 1;
}
#buscar-cliente {
    width: 100%;
    padding: 10px;
    border: 1.5px solid var(--sp-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
}
#lista-clientes {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: none;
    border-radius: 0 0 var(--sp-radius-sm) var(--sp-radius-sm);
}
.cliente-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}
.cliente-item:hover {
    background-color: #eff6ff;
    color: var(--sp-blue);
}
.cliente-item strong { color: var(--sp-blue); }

/* ═══════════════ CAJA MODAL ═══════════════ */
.caja-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}
.caja-modal {
    background: var(--sp-surface);
    width: 400px;
    padding: 30px;
    border-radius: var(--sp-radius);
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
    text-align: center;
    border: 1px solid var(--sp-border);
    animation: fadeIn 0.3s ease;
}
.caja-titulo {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--sp-blue);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.caja-input {
    width: 100%;
    padding: 15px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid var(--sp-info);
    border-radius: var(--sp-radius-sm);
    margin: 15px 0;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    color: var(--sp-text);
}
.caja-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: var(--sp-transition);
}
.denominacion {
    width: 100%;
    padding: 8px;
    border: 1.5px solid var(--sp-border);
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    color: var(--sp-text);
    font-family: 'Poppins', sans-serif;
    transition: var(--sp-transition);
}
.denominacion:focus {
    border-color: var(--sp-info);
    background: #fff;
}

/* ═══════════════ ADMIN / OPERATION BUTTONS ═══════════════ */
.admin-btn {
    background: #4f46e5 !important;
    color: white !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}
.admin-btn:hover {
    background: #4338ca !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(79,70,229,0.4);
}
.calc-header-btn {
    background: var(--sp-info) !important;
}
.calc-header-btn:hover {
    background: #2563eb !important;
    box-shadow: 0 4px 8px rgba(59,130,246,0.4);
}
.caja-btn-verde {
    background: var(--sp-success);
    color: white;
}
.caja-btn-verde:hover { background: #059669; }
.caja-btn-rojo {
    background: var(--sp-red);
    color: white;
}
.caja-btn-rojo:hover { background: #cc0000; }
.caja-info-box {
    background: #f8fafc;
    padding: 15px;
    border-radius: var(--sp-radius-sm);
    margin-bottom: 20px;
    text-align: left;
    font-size: 0.92rem;
    border: 1px solid var(--sp-border);
}
.caja-fila {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px dashed var(--sp-border);
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.caja-chip {
    background: var(--sp-surface);
    border: 2px solid var(--sp-border);
    padding: 6px 16px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--sp-text);
    font-family: 'Poppins', sans-serif;
    transition: var(--sp-transition);
}
.caja-chip:hover {
    background: var(--sp-blue);
    color: white;
    border-color: var(--sp-blue);
}
.caja-alerta {
    padding: 12px;
    border-radius: var(--sp-radius-sm);
    font-weight: 700;
    margin: 10px 0;
    text-align: center;
    font-size: 1.05rem;
}
.caja-alerta.cuadre {
    background: #d1fae5;
    color: #059669;
    border: 2px solid var(--sp-success);
}
.caja-alerta.sobrante {
    background: #fef3c7;
    color: #b45309;
    border: 2px solid var(--sp-warning);
}
.caja-alerta.faltante {
    background: #fee2e2;
    color: #dc2626;
    border: 2px solid var(--sp-danger);
}

/* ═══════════════ NOTIFICATIONS ═══════════════ */
.notif-btn {
    position: relative;
    background: rgba(255,255,255,0.1);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: var(--sp-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 15px;
    transition: var(--sp-transition);
    border: none;
}
.notif-btn:hover { background: rgba(255,255,255,0.2); }
.notif-badge {
    position: absolute;
    top: -5px; right: -5px;
    background: var(--sp-danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--sp-blue);
    display: none;
}
.pulse-red { animation: pulse-red-anim 1.5s infinite; }
.pulse-green { animation: pulse-green-anim 1.5s infinite; border-color: var(--sp-success) !important; }
@keyframes pulse-red-anim {
    0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
@keyframes pulse-green-anim {
    0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.7); }
    70% { box-shadow: 0 0 0 10px rgba(16,185,129,0); }
    100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* ═══════════════ MINI ORDERS ═══════════════ */
.mini-order-item {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s;
}
.mini-order-item:hover { background: #f8fafc; }

/* ═══════════════ PRODUCT AUTOCOMPLETE ═══════════════ */
.autocomplete-list-prod {
    position: absolute;
    border: 1px solid #d4d4d4;
    border-top: none;
    z-index: 999;
    top: 100%;
    left: 0; right: 0;
    background-color: white;
    max-height: 300px;
    overflow-y: auto;
    border-radius: 0 0 var(--sp-radius-sm) var(--sp-radius-sm);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    display: none;
}
.prod-item {
    padding: 12px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    font-family: 'Poppins', sans-serif;
}
.prod-item:hover { background-color: #eff6ff; }
.prod-active {
    background-color: var(--sp-blue) !important;
    color: white !important;
}
.prod-active span { color: white !important; }

/* ═══════════════ CATEGORY BAR ═══════════════ */
.btn-catalogo {
    background: linear-gradient(135deg, var(--sp-blue), #001a33);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--sp-transition);
    white-space: nowrap;
}
.btn-catalogo:hover {
    box-shadow: 0 6px 20px rgba(0,51,102,0.3);
    transform: translateY(-1px);
}
.category-bar {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 5px;
    scrollbar-width: none;
}
.category-bar::-webkit-scrollbar { display: none; }
.cat-chip {
    background: white;
    border: 1.5px solid var(--sp-border);
    color: var(--sp-text);
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.cat-chip:hover {
    border-color: var(--sp-info);
    color: var(--sp-info);
    background: #eff6ff;
}
.cat-chip.active {
    background: var(--sp-blue);
    color: white;
    border-color: var(--sp-blue);
    box-shadow: 0 4px 12px rgba(0,51,102,0.3);
}
select.cat-chip {
    border: 2px solid var(--sp-border) !important;
    font-weight: 700 !important;
    -webkit-appearance: none;
    appearance: none;
}
select.cat-chip:focus {
    border-color: var(--sp-info) !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.3) !important;
}
select.cat-chip option {
    color: #1e293b !important;
    background-color: #ffffff !important;
    font-weight: 600 !important;
}
select.cat-chip.active {
    background-color: var(--sp-blue) !important;
    color: white !important;
}
select.cat-chip:not(.active) {
    color: var(--sp-text) !important;
}

.badge-fav {
    position: absolute;
    top: -5px;
    right: auto !important;
    left: -5px !important;
    background: var(--sp-warning);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 5;
}
.badge-stock {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--sp-blue);
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
}

/* ═══════════════ CATALOGO MODAL ═══════════════ */
.modal-catalogo {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: row;
    padding: 0;
    overflow: hidden;
    border-radius: var(--sp-radius);
    background: var(--sp-surface);
    box-shadow: 0 25px 60px rgba(0,0,0,0.5) !important;
    border: 2px solid var(--sp-border) !important;
}
.cat-sidebar {
    width: 250px;
    background: #f8fafc;
    border-right: 1px solid var(--sp-border);
    display: flex;
    flex-direction: column;
}
.cat-sidebar-header {
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--sp-blue), #001a33);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.cat-sidebar-list { flex: 1; overflow-y: auto; }
.cat-sidebar-item {
    padding: 14px 20px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    color: var(--sp-text);
    transition: var(--sp-transition);
}
.cat-sidebar-item:hover { background: #eff6ff; color: var(--sp-info); }
.cat-sidebar-item.active {
    background: #eff6ff;
    color: var(--sp-blue);
    border-left: 4px solid var(--sp-blue);
}
.cat-main { flex: 1; display: flex; flex-direction: column; }
.cat-main-header {
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid var(--sp-border);
    display: flex;
    gap: 15px;
    align-items: center;
}

/* ═══════════════ TOAST ═══════════════ */
#toast-pos {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--sp-success);
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    font-size: 1.05rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: 0.3s;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
}
#toast-pos.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ═══════════════ KEYBOARD NAVIGATION ═══════════════ */
.card.focused {
    border-color: var(--sp-info) !important;
    transform: translateY(-5px) !important;
    box-shadow: 0 8px 25px rgba(59,130,246,0.3) !important;
    background: #eff6ff !important;
}
#lista-productos-busqueda { display: none !important; }

/* ═══════════════ HEADER NAVIGATION BUTTONS ═══════════════ */
.btn-nav-header {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #cbd5e1;
    padding: 8px 12px;
    border-radius: var(--sp-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    height: 38px;
    white-space: nowrap;
}
.btn-nav-header i { font-size: 1rem; }
.btn-nav-header:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    transform: translateY(-1px);
}

/* ═══════════════ OPERATION BUTTONS (F-keys) ═══════════════ */
.btn-op {
    border: none;
    font-weight: 700;
    color: #fff !important;
}
.btn-f8 { background: #f59e0b !important; }
.btn-f10 { background: var(--sp-red) !important; }
.btn-f11 { background: var(--sp-success) !important; }
.btn-f12 { background: #ef4444 !important; }
.btn-op span {
    background: rgba(0,0,0,0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-left: 4px;
}

/* ═══════════════ HEADER TOOLS GROUP ═══════════════ */
.header-tools-group {
    display: flex;
    background: rgba(0,0,0,0.2);
    padding: 4px;
    border-radius: var(--sp-radius-sm);
    gap: 4px;
    margin-left: 10px;
}
.btn-tool {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--sp-transition);
}
.btn-tool:hover {
    background: rgba(255,255,255,0.1);
    color: var(--sp-info);
}

/* ═══════════════ USER PILL ═══════════════ */
.user-pill {
    background: rgba(255,255,255,0.08);
    padding: 5px 15px;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.1);
    margin-left: 8px;
}

/* ═══════════════ CAJA MODAL AMPLIADO ═══════════════ */
.caja-modal.ampliado {
    max-width: 900px !important;
    width: 95% !important;
    display: flex;
    flex-direction: column;
}
.caja-modal.ampliado #panel-desglose {
    display: block !important;
    flex: 1;
}

/* ═══════════════ CALCULATOR WIDGET ═══════════════ */
.calc-widget {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 260px;
    background: white;
    border-radius: var(--sp-radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    border: 2px solid var(--sp-info);
    z-index: 8000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.calc-header {
    background: linear-gradient(135deg, var(--sp-blue), #001a33);
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 0.95rem;
}
.calc-display {
    width: 100%;
    background: #f8fafc;
    border: none;
    border-bottom: 1px solid var(--sp-border);
    padding: 15px;
    font-size: 2rem;
    text-align: right;
    color: var(--text-main);
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    outline: none;
    box-sizing: border-box;
}
.calc-display:focus { background: #fff; }
.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--sp-border);
}
.calc-btn {
    background: #fff;
    border: none;
    padding: 15px 0;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: 0.1s;
    color: var(--text-main);
}
.calc-btn:hover { background: #f1f5f9; }
.calc-btn.op { background: #eff6ff; color: var(--sp-info); }
.calc-btn.eq { background: var(--sp-success); color: white; grid-row: span 2; }
.calc-btn.clear { color: var(--sp-red); }

/* ═══════════════ ACTIONS DROPDOWN (móvil) ═══════════════ */
.btn-actions-toggle {
    display: none; /* oculto en desktop */
}
.header-actions-group {
    display: flex;
    gap: 6px;
    position: relative;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — PANTALLAS PEQUEÑAS Y CUADRADAS
   ═══════════════════════════════════════════════════════════════ */

/* ── 1024px: Transición suave ───────────────────────────────── */
@media (max-width: 1024px) {
    .cart-panel { width: 300px; }
    .grid-products { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
    .card { padding: 8px; }
    .card img { height: 55px; }
    .card h4 { font-size: 0.75rem; }
    .card .price { font-size: 0.9rem; }

    /* Header: ocultar iconos de nav tool, mantener solo texto abreviado */
    .btn-nav-header { padding: 6px 10px; font-size: 0.75rem; gap: 5px; }
    .btn-nav-header i { font-size: 0.85rem; }
    .header-tools-group { gap: 2px; padding: 3px; }
    .btn-tool { width: 30px; height: 30px; }

    /* Modal catálogo */
    .modal-catalogo { max-width: 100%; }
    .cat-sidebar { width: 200px; }
    .cat-sidebar-item { padding: 10px 15px; font-size: 0.85rem; }
}

/* ── 860px: Compacto intermedio ───────────────────────────────── */
@media (max-width: 860px) {
    .cart-panel { width: 270px; font-size: 0.85rem; }
    .cart-item { padding: 8px 10px; }
    .total-row { font-size: 1.2rem; }

    /* Header collapse: solo iconos en botones de acción */
    .btn-nav-header { font-size: 0; gap: 0; padding: 6px 8px; }
    .btn-nav-header i { font-size: 1rem; }
    .btn-nav-header span { display: none; }
    .btn-op span { display: inline !important; font-size: 0.6rem; padding: 1px 4px; }

    .header-tools-group { margin-left: 4px; gap: 1px; }

    /* Grid 3 cols */
    .grid-products { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
    .card img { height: 48px; }
    .card h4 { font-size: 0.7rem; }
    .card .price { font-size: 0.85rem; }
}

/* ── 768px: Reflow total — carrito se vuelve drawer inferior ── */
@media (max-width: 768px) {
    /* Main: column layout, fills viewport minus header */
    .main-container { flex-direction: column; height: calc(100vh - 62px); }
    .products-panel { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; }

    /* Cart abajo siempre visible */
    .cart-panel {
        width: 100%;
        flex-shrink: 0;
        border-left: none;
        border-top: 2px solid var(--sp-blue);
        position: relative;
        z-index: 100;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.15);
        max-height: 42vh;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
    .cart-panel .cart-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        max-height: calc(42vh - 170px);
    }
    /* Clase cart-collapsed se conserva solo por compatibilidad, no se usa por defecto */
    .cart-panel.cart-collapsed { max-height: 50px; overflow: hidden; }
    .cart-panel.cart-collapsed .cart-list,
    .cart-panel.cart-collapsed .cart-footer { display: none; }
    .cart-panel.cart-collapsed .cart-header {
        border-radius: 18px 18px 0 0;
        cursor: pointer;
    }

    .cart-header {
        padding: 10px 15px;
        border-radius: 0;
        font-size: 0.9rem;
    }

    /* Products grid: 3 columnas fijas */
    .grid-products { grid-template-columns: repeat(3, 1fr); gap: 8px; overflow: visible; padding-bottom: 10px; }
    .card { padding: 6px; border-radius: 10px; }
    .card img { height: 44px; }
    .card h4 { font-size: 0.7rem; min-height: 28px; }
    .card .price { font-size: 0.8rem; }

    /* Header: dropdown de acciones */
    .btn-actions-toggle {
        display: flex !important;
        align-items: center;
        gap: 6px;
        background: rgba(255,255,255,0.12);
        border: 1px solid rgba(255,255,255,0.2);
        color: #fff;
        padding: 8px 14px;
        border-radius: var(--sp-radius-sm);
        cursor: pointer;
        font-weight: 600;
        font-size: 0.85rem;
        font-family: 'Poppins', sans-serif;
        white-space: nowrap;
        height: 38px;
        transition: background 0.2s;
    }
    .btn-actions-toggle:hover { background: rgba(255,255,255,0.22); }

    .header-actions-group {
        position: relative;
        gap: 0;
    }
    .header-actions-group > .btn-nav-header {
        display: none;
    }
    .header-actions-group.open > .btn-nav-header {
        display: flex;
        position: absolute;
        top: 44px;
        right: 0;
        z-index: 5000;
        width: 180px;
        border-radius: 0;
        margin: 0;
        background: #1e293b !important;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        font-size: 0.85rem;
        padding: 12px 15px;
        height: auto;
        justify-content: flex-start;
        animation: slideDown 0.15s ease;
    }
    .header-actions-group.open > .btn-nav-header:first-of-type {
        border-radius: 10px 10px 0 0;
    }
    .header-actions-group.open > .btn-nav-header:last-of-type {
        border-radius: 0 0 10px 10px;
    }
    /* Espaciado vertical entre items del dropdown */
    .header-actions-group.open > .btn-nav-header:nth-child(1) { top: 44px; }
    .header-actions-group.open > .btn-nav-header:nth-child(2) { top: 88px; }
    .header-actions-group.open > .btn-nav-header:nth-child(3) { top: 132px; }
    .header-actions-group.open > .btn-nav-header:nth-child(4) { top: 176px; }
    .header-actions-group.open > .btn-nav-header:nth-child(5) { top: 220px; }

    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-5px); }
        to { opacity: 1; transform: translateY(0); }
    }

    /* Ocultar resto del header */
    .header-left > span { display: none; }
    .btn-nav-header:not(.btn-op, .btn-actions-toggle) { display: none; }
    .header-tools-group { display: none; }
    .btn-qr-portatil { display: none; }

    /* Search + buttons */
    .search-container { gap: 6px; margin-bottom: 6px; }
    .btn-catalogo { padding: 8px 12px; font-size: 0.78rem; }

    /* Category bar compacta */
    .category-bar { padding: 8px 5px; }
    .cat-chip { padding: 6px 12px; font-size: 0.78rem; }

    /* Modal catálogo: reflow vertical */
    .modal-catalogo { flex-direction: column; height: 92vh; }
    .cat-sidebar { width: 100%; height: auto; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 2px solid var(--sp-border); }
    .cat-sidebar-header { display: none; }
    .cat-sidebar-list { display: flex; flex-direction: row; }
    .cat-sidebar-item { white-space: nowrap; padding: 8px 14px; font-size: 0.78rem; border-bottom: none; border-right: 1px solid #f1f5f9; }
    .cat-sidebar-item.active { border-left: none; border-bottom: 3px solid var(--sp-blue); }
    .cat-main { height: 0; flex: 1; }

    /* Modal cierre de caja: columna única */
    .caja-modal.ampliado { width: 98% !important; }
    .caja-modal.ampliado > div:first-of-type { flex-direction: column !important; }
    #panel-desglose { flex: none !important; }
    .denominacion { padding: 6px; font-size: 0.8rem; }

    .cart-footer { padding: 12px; }
    .btn-pay { padding: 12px; font-size: 1rem; }
}

/* ── 480px: Ultra compacto ──────────────────────────────────── */
@media (max-width: 480px) {
    header { padding: 0 8px; height: 50px; }
    .burger-btn { width: 32px; height: 32px; }

    .main-container { height: calc(100vh - 50px); }
    .products-panel { padding: 6px; }
    .cart-panel .cart-list { max-height: calc(42vh - 150px); }

    .grid-products { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .card { padding: 4px; border-radius: 8px; }
    .card img { height: 38px; }
    .card h4 { font-size: 0.65rem; min-height: 24px; }
    .card .price { font-size: 0.72rem; }

    .search-box input { padding: 8px 8px 8px 32px; font-size: 0.85rem; }
    .search-icon { left: 10px; }

    .cat-chip { padding: 4px 10px; font-size: 0.7rem; }
    .cat-chip i { font-size: 0.7rem; }

    /* Cart items compactos */
    .cart-item { padding: 6px 8px; font-size: 0.78rem; }
    .qty-input { width: 28px; font-size: 0.78rem; }
    .btn-qty { width: 24px; height: 24px; font-size: 0.7rem; }
    .cart-footer { padding: 10px; }
    .total-row { font-size: 1.1rem; margin-bottom: 8px; }
    .btn-pay { padding: 10px; font-size: 0.9rem; }

    /* Modal cierre caja en pantalla chica */
    .caja-modal { width: 95% !important; padding: 15px; }
    .caja-input { padding: 10px; font-size: 1.2rem; }
    .caja-btn { padding: 10px; font-size: 0.95rem; }

    /* Categoria select mas pequeño */
    select.cat-chip { min-width: 130px; font-size: 0.7rem; }
}

/* ── Aspect-ratio cuadrado (< 1.2:1) ─────────────────────────── */
@media (aspect-ratio: 1/1), (max-aspect-ratio: 1/1) {
    .main-container { flex-direction: column; height: calc(100vh - 62px); }

    .products-panel { flex: 0.52; min-height: 0; overflow-y: auto; }
    .cart-panel { width: 100%; flex: 0.48; border-left: none; border-top: 2px solid var(--sp-blue); overflow-y: auto; }

    .grid-products { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    /* Header más compacto */
    .btn-nav-header { padding: 6px 8px; font-size: 0; gap: 0; }
    .btn-nav-header i { font-size: 1rem; }
    .btn-nav-header span { display: none; }
    .btn-op span { display: inline !important; font-size: 0.6rem; padding: 1px 4px; }
    .header-tools-group { display: none; }
}

/* ── Muy angosto + cuadrado ──────────────────────────────────── */
@media (max-width: 600px) and (max-aspect-ratio: 1/1) {
    .products-panel { flex: 0.5; min-height: 0; overflow-y: auto; }
    .cart-panel { flex: 0.5; overflow-y: auto; }
    .grid-products { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .card img { height: 40px; }
    .card h4 { font-size: 0.65rem; }
    .card .price { font-size: 0.75rem; }
}
