/* ===================================
   PUNTO DE VENTA - MINIMARKET CHILE
   Estilos CSS Principales
   =================================== */

:root {
    /* Colores principales - Refinado Azul e Índigo B2B */
    --primary-color: #3f51b5; /* Azul Índigo */
    --primary-dark: #1a237e;  /* Índigo Oscuro */
    --primary-light: #757de8; /* Índigo Claro */
    --secondary-color: #ff9100; /* Naranja de acento */
    --accent-color: #00b0ff;   /* Azul Cyan */
    
    /* Colores de fondo */
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-dark: #121824;        /* Slate oscuro */
    
    /* Colores de texto */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #ffffff;
    
    /* Colores de estado */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    /* Espaciado */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Bordes y sombras */
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --box-shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    
    /* Transiciones */
    --transition: all 0.3s ease;
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===================================
   Soporte Twemoji (Compatibilidad Windows 7 y Offline)
   =================================== */
img.emoji {
    height: 1.15em;
    width: 1.15em;
    margin: 0 0.1em;
    vertical-align: -0.18em;
    display: inline-block;
}

.product-icon img.emoji {
    height: 52px;
    width: 52px;
    vertical-align: middle;
    object-fit: contain;
}

.product-icon .product-thumb {
    max-height: 58px;
    max-width: 66px;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block;
    border-radius: 6px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
    transition: transform 0.2s ease;
}

.product-icon .product-fallback-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    line-height: 1;
}

.products-table td .product-thumb {
    max-height: 26px;
    max-width: 26px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 6px;
    display: inline-block;
    border-radius: 3px;
}

.product-fallback-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.logo-icon img.emoji {
    height: 1.3em;
    width: 1.3em;
    vertical-align: -0.22em;
}

.nav-btn img.emoji {
    height: 1.25em;
    width: 1.25em;
    margin-right: 4px;
    vertical-align: -0.2em;
}

.cart-title img.emoji,
.empty-state-icon img.emoji {
    height: 1.2em;
    width: 1.2em;
    vertical-align: -0.15em;
}

.quick-emoji-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.quick-emoji-chip {
    background: var(--bg-primary);
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.quick-emoji-chip:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

/* Encabezado */
header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: var(--text-light);
    padding: 5px var(--spacing-lg);
    box-shadow: var(--box-shadow);
    flex-shrink: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.15rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.logo-icon {
    font-size: 1.35rem;
}

.header-info {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.info-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.8rem;
}

.info-icon {
    font-size: 0.95rem;
}

/* Navegación */
nav {
    background-color: var(--bg-dark);
    padding: 3px 0;
    flex-shrink: 0;
    z-index: 99;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: 0 var(--spacing-md);
}

.nav-btn {
    background-color: transparent;
    border: none;
    color: var(--text-light);
    padding: 3px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.82rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.nav-btn:hover {
    background-color: rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

.nav-btn.active {
    background-color: var(--primary-light);
    font-weight: bold;
}

/* Announcement Banner Compacto */
.announcement-banner {
    background: #1e293b;
    color: #e2e8f0;
    padding: 2px 14px;
    font-size: 0.74rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
    z-index: 90;
}
.announcement-banner .banner-badge {
    background: #3b82f6;
    color: white;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.65rem;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.announcement-banner .banner-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.announcement-banner .banner-link,
.announcement-banner .banner-guide-link {
    color: #60a5fa;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}
.announcement-banner .banner-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-left: 6px;
}

/* Contenedor principal */
main {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    display: none;
    box-sizing: border-box;
}

main.active {
    display: block;
}

/* Vistas con Scroll de Página Completa */
#inventory-section.active,
#customers-section.active,
#reports-section.active,
#settings-section.active,
#guide-section.active {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    padding-top: 8px;
    padding-bottom: 30px;
}

/* Sección de POS con Scroll Independiente de Doble Panel (Two-Pane Independent Scroll) */
#pos-section.active {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    margin: 0 auto;
    padding: 6px var(--spacing-md);
    overflow: hidden;
    box-sizing: border-box;
}

.pos-container {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 12px;
    height: 100%;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

/* Panel Izquierdo: Catálogo de Productos con Scroll Independiente */
.products-section {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.products-section .search-section {
    flex-shrink: 0;
}

/* Buscador y filtros */
.search-section {
    background-color: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 10px;
}

.search-bar {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: 6px;
}

.search-input {
    flex: 1;
    padding: 6px 10px 6px 32px;
    border: 1.5px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 0.88rem;
    transition: var(--transition);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.category-filters {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 3px 10px;
    border: 1.5px solid var(--primary-color);
    background-color: transparent;
    color: var(--primary-color);
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: var(--transition);
}

.filter-btn:hover {
    background-color: var(--primary-light);
    color: white;
    transform: translateY(-1px);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* Catálogo de productos con CSS Grid: 5 columnas proporcionales y scroll independiente */
.products-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    padding: 6px 4px 20px 4px;
    align-content: start;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.products-grid::-webkit-scrollbar {
    width: 6px;
}
.products-grid::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
.products-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.products-grid::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.product-card {
    background-color: var(--bg-secondary);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
    border: 1px solid #e2e8f0;
    cursor: pointer;
    min-height: 168px;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    padding: 10px 8px;
    box-sizing: border-box;
    transition: var(--transition);
    user-select: none;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-light);
}

.product-card:hover .product-thumb {
    transform: scale(1.06);
}

.product-icon {
    font-size: 2.2rem;
    line-height: 1.1;
    margin: 2px 0 6px 0;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.product-image {
    width: 100%;
    height: 70px;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-secondary);
}

.product-info {
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    gap: 3px;
}

.product-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 2.5em;
    word-break: break-word;
}

.product-category {
    font-size: 0.72rem;
    color: #64748b;
    margin-bottom: 1px;
}

.product-barcode {
    font-size: 0.74rem;
    color: #64748b;
    line-height: 1.1;
}

.product-price {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color, #1e3a8a);
    margin: 2px 0;
}

.product-stock {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 0;
    line-height: 1.1;
}

.product-stock.low {
    color: var(--warning, #e65100);
    font-weight: 600;
}

.product-stock.out {
    color: var(--error, #c62828);
    font-weight: 600;
}

/* Carrito de compras con scroll independiente y checkout fijo */
.cart-section {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 12px;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    top: 0;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1.5px solid #f1f5f9;
    flex-shrink: 0;
}

.cart-title {
    font-size: 1.15rem;
    font-weight: bold;
    color: var(--primary-dark);
}

.cart-count {
    background-color: var(--secondary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 0.85rem;
}

.cart-items {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    margin-bottom: 6px;
    padding-right: 4px;
}

.cart-items::-webkit-scrollbar {
    width: 6px;
}
.cart-items::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}
.cart-items::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.cart-items::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Bloque Inferior Fijo de Totales y Botón Cobrar (Two-Pane Checkout) */
.cart-checkout-block {
    flex-shrink: 0;
    border-top: 1px solid #e2e8f0;
    padding-top: 6px;
    background: var(--bg-secondary);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.cart-checkout-block .cart-total {
    padding: 6px 10px;
    margin-bottom: 6px;
    background-color: var(--bg-primary);
    border-radius: 6px;
}

.cart-checkout-block .total-row {
    margin-bottom: 2px;
    font-size: 0.85rem;
}

.cart-checkout-block .total-row.final {
    font-size: 1.15rem;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1.5px solid #e2e8f0;
}

.cart-checkout-block .cart-workflow-buttons {
    margin-bottom: 6px;
    display: flex;
    gap: 6px;
}

.cart-checkout-block .workflow-btn {
    padding: 6px 8px;
    font-size: 0.78rem;
}

.cart-checkout-block .checkout-btn {
    padding: 8px 12px;
    font-size: 1rem;
    border-radius: 6px;
}

.cart-checkout-block .clear-cart-btn {
    padding: 5px 8px;
    font-size: 0.78rem;
    margin-top: 4px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid #eee;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: var(--spacing-xs);
}

.cart-item-price {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cart-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.cart-btn.minus {
    background-color: var(--error);
    color: white;
}

.cart-btn.plus {
    background-color: var(--success);
    color: white;
}

.cart-btn.delete-item {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.cart-btn.delete-item:hover {
    opacity: 1;
    transform: scale(1.15);
}

.cart-btn:hover {
    transform: scale(1.1);
}

.cart-qty-input-wrapper {
    display: inline-flex;
    align-items: center;
    background: var(--bg-primary);
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 2px 5px;
    gap: 3px;
    transition: var(--transition);
    max-width: 95px;
}

.cart-qty-input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(63, 81, 181, 0.2);
    background: var(--bg-secondary);
}

.cart-qty-input {
    width: 54px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    padding: 2px 0;
    -moz-appearance: textfield;
}

.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-qty-unit {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    user-select: none;
    text-transform: lowercase;
}

.cart-item-calc {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.cart-item-subtotal-val {
    color: var(--primary-dark);
    font-weight: 700;
    margin-left: 6px;
}

.badge-weight {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #059669 !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    font-size: 0.72rem !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 2px !important;
}

.cart-total {
    background-color: var(--bg-primary);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-lg);
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
    font-size: 0.95rem;
}

.total-row.final {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-dark);
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 2px solid #ddd;
}

.checkout-btn {
    width: 100%;
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-lg);
}

.checkout-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.clear-cart-btn {
    width: 100%;
    padding: var(--spacing-sm);
    background-color: transparent;
    color: var(--error);
    border: 2px solid var(--error);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.clear-cart-btn:hover {
    background-color: var(--error);
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    padding: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition);
}

.close-btn:hover {
    transform: rotate(90deg);
}

.modal-body {
    padding: var(--spacing-xl);
}

.modal-footer {
    padding: var(--spacing-lg);
    border-top: 2px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

/* Formularios */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: bold;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-select {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
}

.btn-primary {
    padding: var(--spacing-md) var(--spacing-xl);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

.btn-secondary {
    padding: var(--spacing-md) var(--spacing-xl);
    background-color: var(--text-secondary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background-color: var(--text-primary);
}

/* Gestión de inventario */
.inventory-section {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: var(--spacing-xl);
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.inventory-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-dark);
}

.add-product-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: var(--spacing-md);
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: white;
}

.products-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
    font-size: 0.92rem;
}

.products-table th,
.products-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.products-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 2;
}

.products-table tr:hover {
    background-color: var(--bg-primary);
}

.products-table td.actions-cell,
.products-table th.actions-header {
    text-align: right;
    white-space: nowrap;
    width: 260px;
    min-width: 240px;
}

.action-btn {
    padding: 5px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-right: 0;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.action-btn.edit {
    background-color: var(--accent-color);
    color: white;
}

.action-btn.delete {
    background-color: var(--error);
    color: white;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

/* Reportes */
.reports-section {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: var(--spacing-xl);
}

.reports-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.reports-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-dark);
}

.reports-filters {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.stats-grid.main-kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 12px 14px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 92px;
    position: relative;
    overflow: visible;
}

.stat-card.primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.stat-card.secondary {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
}

.stat-card.tertiary {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.stat-card.quaternary {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
}

.stat-card.fiado-card {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}

.stat-card.margin-card {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.stat-card.cross-selling-card {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

.stat-card.inventory-value-card {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
}

.stat-card.runway-card {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
}

.stat-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    margin-bottom: 4px;
    gap: 6px;
}

.stat-label {
    font-size: 0.74rem;
    font-weight: 700;
    opacity: 0.95;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* ==========================================================================
   Tooltips Didácticos Flotantes (Glassmorphic Popovers)
   ========================================================================== */
.kpi-info-wrapper {
    position: relative;
    display: inline-block;
    line-height: 1;
    flex-shrink: 0;
}

.kpi-info-btn {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ffffff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.kpi-info-btn:hover,
.kpi-info-btn:focus {
    background: rgba(255, 255, 255, 0.38);
    border-color: #38bdf8;
    transform: scale(1.12);
    outline: none;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

.kpi-popover {
    position: absolute;
    top: calc(100% + 8px);
    width: 320px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.55), 0 0 20px rgba(56, 189, 248, 0.18);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
    pointer-events: none;
    text-align: left;
    color: #f1f5f9;
}

/* Alineación hacia el centro de la pantalla según posición de la tarjeta */
/* Tarjetas del sector izquierdo (Ventas Totales, Ticket Promedio, etc.): despliegan hacia la derecha (hacia el centro) */
.kpi-popover.popover-to-center,
.stat-card:first-child .kpi-popover,
.stat-card:nth-child(6) .kpi-popover,
.stat-card.primary .kpi-popover,
.stat-card.tertiary .kpi-popover {
    left: -15px;
    right: auto;
}

/* Tarjetas del sector derecho: despliegan hacia la izquierda (hacia el centro) */
.kpi-popover,
.kpi-popover.popover-to-left,
.stat-card.margin-card .kpi-popover,
.stat-card.cross-selling-card .kpi-popover {
    right: 0;
    left: auto;
}

/* Mostrar popover al hacer hover o al estar activado con tap/click */
.kpi-info-wrapper:hover .kpi-popover,
.kpi-info-wrapper:focus-within .kpi-popover,
.kpi-popover.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.kpi-popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding-bottom: 7px;
    margin-bottom: 10px;
}

.kpi-popover-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: #38bdf8;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

.kpi-popover-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.15s;
}

.kpi-popover-close:hover {
    color: #ffffff;
}

.kpi-popover-body {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.kpi-popover-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.kpi-popover-tag {
    font-size: 0.70rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 4px;
    padding: 2px 7px;
    width: fit-content;
    letter-spacing: 0.2px;
}

.kpi-popover-tag.tag-blue {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
}

.kpi-popover-tag.tag-green {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.35);
}

.kpi-popover-tag.tag-amber {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.kpi-popover-desc {
    font-size: 0.77rem;
    line-height: 1.35;
    color: #cbd5e1;
    margin: 0;
}

/* Modal inferior en móviles/tablets para no desbordar */
@media (max-width: 768px) {
    .kpi-popover {
        position: fixed;
        top: auto;
        bottom: 20px;
        left: 16px;
        right: 16px;
        width: auto;
        max-width: 440px;
        margin: 0 auto;
        transform: translateY(20px);
        box-shadow: 0 20px 45px rgba(0, 0, 0, 0.85), 0 0 0 9999px rgba(0, 0, 0, 0.5);
    }
    
    .kpi-popover.active {
        transform: translateY(0);
    }
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.15;
}

.stat-subdetail {
    margin-top: 5px;
    font-size: 0.68rem;
    opacity: 0.92;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

.sub-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.sub-badge.liquid {
    background: rgba(255, 255, 255, 0.22);
}

.sub-badge.fiado {
    background: rgba(220, 38, 38, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

/* Semáforo de Exposición al Fiado */
.semaforo-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 0.71rem;
    transition: all 0.2s ease;
}

.semaforo-badge.semaforo-safe {
    background: rgba(16, 185, 129, 0.25);
    color: #a7f3d0;
    border: 1px solid rgba(16, 185, 129, 0.55);
}

.semaforo-badge.semaforo-warning {
    background: rgba(245, 158, 11, 0.28);
    color: #fde68a;
    border: 1px solid rgba(245, 158, 11, 0.55);
}

.semaforo-badge.semaforo-danger {
    background: rgba(239, 68, 68, 0.38);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.65);
    animation: pulseDanger 1.8s infinite;
}

@keyframes pulseDanger {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 8px 2px rgba(239, 68, 68, 0.6);
    }
}

.sub-text {
    font-size: 0.68rem;
    opacity: 0.90;
}

.sales-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--spacing-lg);
}

.sales-table th,
.sales-table td {
    padding: var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid #eee;
}

.sales-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

.sales-table tr:hover {
    background-color: var(--bg-primary);
}

/* ==========================================================================
   COMPONENTES AVANZADOS DE ANALÍTICA (PRODUCTOS ANCLA E HISTOGRAMA HORARIO)
   ========================================================================== */
.reports-analytics-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
    margin-top: 25px;
    align-items: stretch;
}

.analytics-card {
    background: #ffffff;
    border-radius: var(--border-radius);
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    padding: 18px;
    display: flex;
    flex-direction: column;
}

.analytics-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.analytics-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.analytics-badge-info {
    font-size: 0.72rem;
    font-weight: 600;
    background: #e0f2fe;
    color: #0369a1;
    padding: 3px 8px;
    border-radius: 12px;
    letter-spacing: 0.2px;
}

.analytics-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.35;
}

.anchor-products-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.anchor-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.anchor-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.06);
}

.anchor-item.rank-1 {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}

.anchor-item.rank-2 {
    border-left: 4px solid #94a3b8;
    background: #f8fafc;
}

.anchor-item.rank-3 {
    border-left: 4px solid #b45309;
    background: #faf5ee;
}

.anchor-rank {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.anchor-details {
    flex: 1;
    min-width: 0;
}

.anchor-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}

.anchor-meta {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 2px;
}

.anchor-rate {
    text-align: right;
    flex-shrink: 0;
}

.anchor-pct {
    font-size: 1.08rem;
    font-weight: 800;
    color: #0284c7;
}

.anchor-item.rank-1 .anchor-pct {
    color: #d97706;
}

.anchor-bar-bg {
    height: 5px;
    width: 100%;
    background: #e2e8f0;
    border-radius: 4px;
    margin-top: 5px;
    overflow: hidden;
}

.anchor-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #0284c7);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.anchor-item.rank-1 .anchor-bar-fill {
    background: linear-gradient(90deg, #fbbf24, #d97706);
}

/* Barra Secundaria de Acompañamiento vs Solo (Cross-Selling Attachment) */
.anchor-crosssell-section {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #e2e8f0;
}

.anchor-crosssell-labels {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.70rem;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.crosssell-label.accompanied {
    color: #059669;
    font-weight: 600;
}

.crosssell-label.solo {
    color: #d97706;
    font-weight: 600;
}

.anchor-warning-badge {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 4px;
    padding: 1px 6px;
    font-weight: 700;
    font-size: 0.67rem;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    animation: pulseWarning 2s infinite;
}

@keyframes pulseWarning {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.75;
    }
}

.anchor-crosssell-bar-bg {
    height: 6px;
    width: 100%;
    background: #e2e8f0;
    border-radius: 4px;
    display: flex;
    overflow: hidden;
}

.anchor-crosssell-bar-acc {
    background: linear-gradient(90deg, #34d399, #10b981);
    height: 100%;
    transition: width 0.4s ease;
}

.anchor-crosssell-bar-solo {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    height: 100%;
    transition: width 0.4s ease;
}

.peak-legend {
    font-size: 0.75rem;
    color: #475569;
    display: flex;
    align-items: center;
}

.legend-item {
    display: inline-flex;
    align-items: center;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.legend-dot.peak {
    background-color: #ff5722;
    box-shadow: 0 0 4px rgba(255, 87, 34, 0.4);
}

.legend-dot.valley {
    background-color: #60a5fa;
}

.chart-wrapper {
    position: relative;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chart-empty-msg {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Componente: Distribución de Medios de Pago & Control de Liquidez */
.payment-distribution-card {
    background: #ffffff;
    border-radius: var(--border-radius);
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    padding: 18px;
    margin-top: 20px;
}

.payment-distribution-body {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 25px;
    align-items: center;
}

.payment-chart-box {
    position: relative;
    height: 220px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.payment-methods-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.payment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
    transition: transform 0.2s;
}

.payment-row:hover {
    transform: translateX(2px);
}

.payment-row.is-fiado {
    border-left: 4px solid #dc2626;
    background: #fef2f2;
}

.payment-row.is-liquid {
    border-left: 4px solid #10b981;
}

.payment-method-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.payment-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.payment-method-name {
    font-weight: 600;
    color: var(--text-primary);
}

.payment-amount-info {
    text-align: right;
}

.payment-amount-val {
    font-weight: 700;
    color: var(--text-primary);
}

.payment-pct-badge {
    font-size: 0.74rem;
    font-weight: 600;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 4px;
}

.payment-pct-badge.liquid {
    background: #e0f2fe;
    color: #0369a1;
}

.payment-pct-badge.fiado {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    font-weight: 700;
}

.financial-flow-legend {
    font-size: 0.74rem;
    color: #475569;
    display: flex;
    align-items: center;
}

.legend-dot.liquid-dot {
    background-color: #10b981;
}

.legend-dot.fiado-dot {
    background-color: #dc2626;
    box-shadow: 0 0 4px rgba(220, 38, 38, 0.4);
}

@media (max-width: 1024px) {
    .stats-grid.main-kpis-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .payment-distribution-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .reports-analytics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 540px) {
    .stats-grid.main-kpis-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .pos-container {
        grid-template-columns: 1fr;
    }
    
    .cart-section {
        position: static;
    }
}

@media (max-width: 1100px) {
    .products-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 6px;
    }
    
    .header-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .nav-container {
        flex-wrap: wrap;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
    
    .product-image {
        height: 60px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1rem;
    }
    
    .nav-btn {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }
}

/* Utilidades */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.1rem;
}

.badge {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.badge-success {
    background-color: var(--success);
    color: white;
}

.badge-warning {
    background-color: var(--warning);
    color: white;
}

.badge-error {
    background-color: var(--error);
    color: white;
}

/* --- ALERTA DE VENCIMIENTOS & SEMÁFORO --- */
.expiration-warning-box {
    background-color: #fff9c4;
    border: 2px solid #fbc02d;
    color: #bf360c;
    padding: 10px 15px;
    border-radius: 12px;
    margin-left: 20px;
    flex: 1;
    min-width: 250px;
    max-height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.expiration-warning-box h4 { margin: 0 0 5px 0; font-size: 0.95rem; font-weight: bold; }
.expiration-warning-box ul { margin: 0; padding-left: 20px; font-size: 0.85rem; }

/* Animación de Latido (Pulse) para el botón rojo */
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(244, 67, 54, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 67, 54, 0); }
}

@media (max-width: 768px) {
    .expiration-warning-box { margin-left: 0; margin-top: 15px; width: 100%; }
}

/* --- ESTILOS DE CONEXIÓN Y SINCRONIZACIÓN --- */
.connection-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.connection-badge.online {
    border-color: #a5d6a7;
    background-color: rgba(76, 175, 80, 0.25);
    color: #e8f5e9;
}

.connection-badge.offline {
    border-color: #ef9a9a;
    background-color: rgba(244, 67, 54, 0.25);
    color: #ffebee;
    animation: pulse 2s infinite;
}

.connection-badge.syncing,
.connection-badge.warning {
    border-color: #ffe082;
    background-color: rgba(255, 152, 0, 0.25);
    color: #fffde7;
}

/* --- CONTENEDORES Y BOTONES DE PESTAÑAS (REPORTES) --- */
.report-tabs {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 2px;
}

.report-tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

.report-tab-btn:hover {
    color: var(--primary-color);
}

.report-tab-btn.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

/* --- MULTISESIÓN (TICKET TABS) --- */
.ticket-sessions-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    background-color: var(--bg-primary);
    padding: 6px;
    border-radius: var(--border-radius);
    border: 1px solid #e2e8f0;
}

.ticket-sessions {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex-grow: 1;
    scrollbar-width: none; /* Firefox */
}

.ticket-sessions::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.ticket-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.ticket-tab:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
}

.ticket-tab.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.ticket-tab .close-tab {
    font-size: 0.75rem;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-weight: bold;
    padding: 2px;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ticket-tab .close-tab:hover {
    background-color: rgba(0, 0, 0, 0.15);
}

.ticket-tab.active .close-tab:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

.add-session-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    background-color: #fff;
    color: var(--text-secondary);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.add-session-btn:hover {
    background-color: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
    transform: scale(1.05);
}

/* --- BOTONES DE FLUJO DE TRABAJO (PAGOS PENDIENTES) --- */
.cart-workflow-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
    margin-bottom: 12px;
}

.workflow-btn {
    padding: 10px 8px;
    border-radius: var(--border-radius);
    border: 1px solid #cbd5e1;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}

.workflow-btn.hold {
    background-color: #fef3c7;
    color: #d97706;
    border-color: #fde68a;
}

.workflow-btn.hold:hover:not(:disabled) {
    background-color: #fde68a;
    transform: translateY(-1px);
}

.workflow-btn.hold:disabled {
    background-color: #f1f5f9;
    color: #cbd5e1;
    border-color: #e2e8f0;
    cursor: not-allowed;
}

.workflow-btn.pending-list {
    background-color: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
    position: relative;
}

.workflow-btn.pending-list:hover {
    background-color: #dbeafe;
    transform: translateY(-1px);
}

.workflow-btn.pending-list .badge {
    background-color: #ef4444;
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 2px;
    font-weight: bold;
}

/* ===================================
   ACCESSO RESTRINGIDO (LOGIN GATE)
   =================================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(18, 24, 36, 0.92); /* Slate oscuro */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
}

.login-overlay.active {
    display: flex;
}

.login-box {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: var(--spacing-xl);
    width: 100%;
    max-width: 420px;
    animation: loginScaleUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes loginScaleUp {
    from { transform: scale(0.9) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.login-logo {
    margin-bottom: var(--spacing-xl);
    text-align: center;
}

.login-logo .logo-icon {
    font-size: 3.5rem;
    display: block;
    margin-bottom: var(--spacing-xs);
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.login-logo h2 {
    margin: 0;
    font-size: 1.6rem;
    color: var(--text-primary);
    font-weight: 800;
    letter-spacing: -0.5px;
}

.login-logo p {
    margin: var(--spacing-xs) 0 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.login-error-msg {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #b91c1c;
    border-radius: var(--border-radius);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
    margin-bottom: var(--spacing-lg);
    display: none;
    text-align: left;
    align-items: center;
    gap: var(--spacing-xs);
    font-weight: 500;
}

.login-error-msg.active {
    display: flex;
}

.login-box .form-group {
    text-align: left;
    margin-bottom: var(--spacing-md);
}

.login-box .form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.login-box .form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    background-color: #f8fafc;
    transition: var(--transition);
}

.login-box .form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(63, 81, 181, 0.15);
}

/* ==========================================================================
   TABLAS DE REPORTES CON SCROLL INDEPENDIENTE Y STICKY HEADER
   ========================================================================== */
.report-table-scroll-container {
    max-height: 440px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: var(--bg-secondary);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
    margin-bottom: 16px;
    position: relative;
}

.report-table-scroll-container::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
.report-table-scroll-container::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}
.report-table-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.report-table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.report-table-scroll-container .sales-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0;
}

.report-table-scroll-container .sales-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.report-table-scroll-container .sales-table thead th {
    position: sticky;
    top: 0;
    background: #1e293b;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 11px 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    z-index: 5;
    border-bottom: 2px solid #0f172a;
    white-space: nowrap;
}

.report-table-scroll-container .sales-table tbody tr:hover {
    background-color: #f8fafc;
}

/* ==========================================================================
   GRÁFICO RENDIMIENTO SEMANAL (DASHBOARD BI)
   ========================================================================== */
.weekly-chart-card {
    background: var(--bg-secondary);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 22px;
}

.weekly-chart-card .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
}

.weekly-chart-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   TURNOS DE CAJA & CENTRO DE COSTOS (ARQUEO Y MARGEN)
   ========================================================================== */
.shift-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.shift-btn.shift-closed {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
}

.shift-btn.shift-closed:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(245, 158, 11, 0.4);
}

.shift-btn.shift-open {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    animation: pulse-shift 2.5s infinite;
}

@keyframes pulse-shift {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.shift-btn.shift-open:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(16, 185, 129, 0.5);
}

.margin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}

.margin-badge.high {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.margin-badge.mid {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.margin-badge.low {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.margin-badge.neg {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #f87171;
}

.shift-receipt-container {
    background: #ffffff;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.88rem;
    color: #1e293b;
}

.shift-receipt-header {
    text-align: center;
    border-bottom: 1px dashed #cbd5e1;
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.shift-receipt-row {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
}

.shift-diff-box {
    margin-top: 12px;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    font-size: 1rem;
}

.shift-diff-box.cuadrado {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.shift-diff-box.sobrante {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.shift-diff-box.faltante {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* =============================================================================
   COMPONENTE ANALÍTICO: GRÁFICA DE PARETO (COSTOS Y MÁRGENES DE UTILIDAD)
   ============================================================================= */
.pareto-chart-card {
    background: #ffffff;
    border-radius: var(--border-radius);
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    padding: 20px;
    margin-top: 24px;
    margin-bottom: 30px;
    transition: box-shadow 0.2s ease;
}

.pareto-chart-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
}

.pareto-kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.pareto-kpi-badge {
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.15s ease;
}

.pareto-kpi-badge:hover {
    transform: translateY(-1px);
}

.pareto-chart-body {
    position: relative;
    width: 100%;
    min-height: 420px;
    padding: 8px 0;
}

@media (max-width: 768px) {
    .pareto-controls {
        width: 100%;
        justify-content: flex-start;
        margin-top: 10px;
    }
    .pareto-chart-body {
        min-height: 340px;
    }
}
/* ==============================================================================
   PUNTO VITALIS: ESTILOS PARA TALLER, ENCARGOS, BOTONERA RÁPIDA Y RECETAS
   ============================================================================== */
.quick-service-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    border: 1px solid rgba(0, 176, 255, 0.3);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
}
.quick-service-pill:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.12);
}
.quick-service-pill .quick-service-price {
    background: rgba(0, 176, 255, 0.15);
    color: var(--primary-dark);
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
}
.quick-service-pill:hover .quick-service-price {
    background: white;
    color: var(--primary-dark);
}
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.custom-order-card {
    transition: all 0.2s ease;
}
.custom-order-card:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.cart-item-note-row {
    margin-top: 4px;
}
