        /* --- Badge de notificaciones sin leer en "Órdenes" — siempre visible, aunque el sidebar
             esté colapsado a solo íconos, para que una notificación vieja nunca se quede
             enterrada sin que staff se entere (pidió David, 2026-08-05). --- */
        .nav-badge-dot {
            position: absolute;
            top: -6px;
            right: -8px;
            background: #e11d48;
            color: #fff;
            font-size: 9px;
            font-weight: 800;
            line-height: 1;
            padding: 2px 4px;
            border-radius: 20px;
            min-width: 14px;
            text-align: center;
            box-shadow: 0 0 0 2px #253148;
        }

        /* --- SIDEBAR COLLAPSED STATE: center icons properly --- */
        #main-sidebar.w-20 .sidebar-item {
            justify-content: center !important;
            padding-left: 0 !important;
            padding-right: 0 !important;
            gap: 0 !important;
        }

        #main-sidebar.w-20 .sidebar-item .sidebar-text-container,
        #main-sidebar.w-20 .sidebar-text-container {
            display: none !important;
        }

        #main-sidebar.w-20 .sidebar-item i {
            margin: 0 !important;
            width: auto !important;
            font-size: 1.25rem;
        }

        #main-sidebar.w-20 .sidebar-item i {
            font-size: 1.25rem;
        }

        /* Make profile pics always round, not oval */
        .profile-pic,
        img.profile-pic {
            border-radius: 50% !important;
        }

        html,
        body {
            height: 100%;
            margin: 0;
            overflow: hidden;
            /* No scrollbars at body level - scroll handled by containers */
        }

        /* --- CUSTOM SCROLLBARS FOR PROFESSIONAL LOOK --- */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        ::-webkit-scrollbar-track {
            background: #f1f1f1;
        }

        ::-webkit-scrollbar-thumb {
            background: #ccc;
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: #aaa;
        }

        .dashboard-container {
            display: flex;
            width: 100%;
            height: 100%;

            /* Force minimum width to prevent breaking */
        }

        .sidebar {
            width: 260px;
            background-color: var(--sidebar-bg);
            color: var(--sidebar-text);
            display: flex;
            flex-direction: column;
            padding: 20px 0;
            flex-shrink: 0;
            height: 100%;
            overflow-x: hidden;
            /* No horizontal scroll */
            overflow-y: hidden;
            /* Vertical scroll handled by sidebar-nav */
        }

        .sidebar-header {
            padding: 0 25px;
            margin-bottom: 20px;
            flex-shrink: 0;
            /* Keep logo fixed at top */
        }


        .logo {
            font-size: 28px;
            font-weight: bold;
            color: var(--sidebar-text-hover);
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .logo-img {
            width: 40px;
            height: 40px;
        }


        .sidebar-nav {
            display: flex;
            flex-direction: column;
            flex-grow: 1;
            /* Take all remaining vertical space */
            overflow-y: auto;
            /* Scroll ONLY the nav items */
            overflow-x: hidden;
            /* FORCE NO HORIZONTAL SCROLL */
            min-height: 0;
            /* Important for flex child scrolling */
            width: 100%;
            /* Ensure it fits perfectly */
            box-sizing: border-box;
        }

        /* Custom scrollbar for sidebar */
        .sidebar-nav::-webkit-scrollbar {
            width: 4px;
            /* Thinner for elegance */
        }

        .sidebar-nav::-webkit-scrollbar-track {
            background: transparent;
        }

        .sidebar-nav::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.2);
            border-radius: 2px;
        }

        .sidebar-nav::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.4);
        }

        .nav-item {
            display: flex;
            align-items: center;
            padding: 15px 25px;
            color: var(--sidebar-text);
            text-decoration: none;
            cursor: pointer;
            border-left: 4px solid transparent;
            transition: all 0.2s ease;
            flex-shrink: 0;
            /* Prevent items from squishing */
            box-sizing: border-box;
            /* Ensure padding doesn't increase width */
            width: 100%;
            /* Fit container */
        }

        .nav-item i {
            font-size: 20px;
            width: 30px;
            margin-right: 15px;
        }

        .nav-item:hover {
            background-color: transparent;
            color: var(--sidebar-text-hover);
        }

        .nav-item.active {
            background-color: rgba(119, 81, 248, 0.15);
            color: #ffffff;
            border-left: 4px solid #7751f8;
            padding-left: 22px;
        }

        /* En modo colapsado, eliminamos el padding-left para que el icono se centre */
        #main-sidebar.w-20 .nav-item.active {
            padding-left: 0 !important;
            border-left-width: 5px;
        }

        .main-content {
            flex-grow: 1;
            padding: 40px;
            display: flex;
            flex-direction: column;
            min-width: 0;
        }

        .main-header {
            margin-bottom: 20px;
            flex-shrink: 0;
        }

        .main-header h1 {
            font-size: 32px;
            margin: 0 0 10px 0;
        }

        .main-header p {
            font-size: 18px;
            color: var(--secondary-text);
            margin: 0;
        }

        .content-area {
            flex-grow: 1;
            background-color: var(--card-bg);
            border-radius: 8px;
            box-shadow: var(--shadow);
            display: flex;
            flex-direction: column;
            min-height: 0;
            overflow-y: auto;
        }

        #chat-views-container {
            display: flex;
            flex-direction: column;
            flex-grow: 1;
            min-height: 0;
        }

        #inbox-view,
        #sales-view,
        #intents-view {
            display: flex;
            flex-direction: column;
            flex-grow: 1;
            min-height: 0;
        }


        .view-switcher {
            display: flex;
            gap: 5px;
            background-color: var(--primary-light);
            border-radius: 8px;
            padding: 5px;
            margin: 30px 30px 0 30px;
            flex-shrink: 0;
        }

        .view-btn {
            padding: 9px 18px;
            border: none;
            background-color: transparent;
            font-size: 13px;
            font-weight: 700;
            color: #64748b;
            border-radius: 10px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            white-space: nowrap;
            transition: all .2s ease;
        }

        .view-btn:hover:not(.active) {
            color: #334155;
            background-color: rgba(255, 255, 255, .7);
        }

        .view-btn.active {
            background-color: #ffffff;
            color: #7751f8;
            box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
        }

        .chat-filters {
            display: flex;
            gap: 10px;
            margin: 20px 30px 0 30px;
            flex-shrink: 0;
        }

        .filter-btn {
            background-color: #f4f2f7;
            color: var(--secondary-text);
            border: none;
            padding: 8px 16px;
            font-size: 14px;
            font-weight: 500;
            border-radius: 20px;
            cursor: pointer;
        }

        .filter-mode-btn {
            background-color: #f4f2f7;
            color: var(--secondary-text);
            border: none;
            padding: 8px 16px;
            font-size: 14px;
            font-weight: 500;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .filter-btn.active {
            background-color: white;
            color: var(--primary);
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
        }

        .filter-mode-btn.active {
            background-color: white;
            color: var(--primary);
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
        }

        .filter-input {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 14px;
            box-sizing: border-box;
        }

        .chat-list {
            list-style: none;
            padding: 0;
            margin: 0;
            flex-grow: 1;
            overflow-y: auto;
        }

        .chat-item {
            display: flex;
            align-items: center;
            padding: 10px 12px;
            border-radius: 12px;
            cursor: pointer;
            gap: 10px;
            transition: background 0.15s;
            margin-bottom: 2px;
        }

        .chat-item:hover {
            background-color: rgba(119, 81, 248, 0.06);
        }

        .chat-item.active {
            background-color: rgba(119, 81, 248, 0.1);
        }

        .profile-pic {
            width: 44px;
            height: 44px;
            min-width: 44px;
            border-radius: 50%;
            object-fit: cover;
            background: #e2e8f0;
        }

        .chat-details {
            flex-grow: 1;
            overflow: hidden;
        }

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

        .chat-message {
            font-size: 14px;
            color: var(--secondary-text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .channel-icon {
            font-size: 18px;
            color: #E1306C;
        }

        .kanban-board {
            display: flex;
            gap: 20px;
            padding: 20px;
            overflow-x: auto;
            flex-grow: 1;
        }

        .kanban-column {
            width: 300px;
            flex-shrink: 0;
            background-color: #f4f2f7;
            border-radius: 8px;
            display: flex;
            flex-direction: column;
            max-height: 100%;
        }

        .kanban-column-header {
            padding: 15px;
            font-weight: bold;
            border-bottom: 2px solid #e0e0e0;
            flex-shrink: 0;
        }

        .kanban-cards-container {
            padding: 10px;
            flex-grow: 1;
            overflow-y: auto;
            min-height: 100px;
        }

        .kanban-card {
            background-color: #ffffff;
            border-radius: 6px;
            padding: 15px;
            margin-bottom: 10px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
            cursor: grab;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .kanban-card>div {
            min-width: 0;
        }

        .kanban-card:active {
            cursor: grabbing;
        }

        .kanban-column.drag-over {
            background-color: #e6f7ff;
        }

        .kanban-card .profile-pic {
            width: 30px;
            height: 30px;
        }

        .conversation-main {
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            min-width: 0;
        }

        .conversation-header {
            display: flex;
            align-items: center;
            padding-bottom: 15px;
            margin-bottom: 15px;
            border-bottom: 1px solid #eee;
            flex-shrink: 0;
        }

        .back-btn {
            background: none;
            border: none;
            font-size: 20px;
            color: var(--secondary-text);
            cursor: pointer;
            margin-right: 15px;
        }

        .conversation-messages {
            flex-grow: 1;
            overflow-y: auto;
            padding: 10px;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .conversation-input-area {
            position: relative;
            margin-top: 15px;
            flex-shrink: 0;
        }

        .conversation-input {
            display: flex;
            align-items: center;
            gap: 5px;
            border: 1px solid #ddd;
            border-radius: 25px;
            padding: 5px 10px;
        }

        .message-input {
            flex-grow: 1;
            border: none;
            background-color: transparent;
            padding: 10px 5px;
            font-size: 15px;
            font-family: inherit;
            resize: none;
            overflow-y: hidden;
            outline: none;
        }

        .send-btn,
        .input-action-btn {
            background-color: transparent;
            color: var(--secondary-text);
            border: none;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            font-size: 18px;
            cursor: pointer;
            flex-shrink: 0;
        }

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

        .emoji-panel,
        .saved-replies-panel {
            position: absolute;
            bottom: calc(100% + 5px);
            left: 0;
            background-color: var(--card-bg);
            border-radius: 12px;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
            border: 1px solid #f0f0f0;
            z-index: 10;
            overflow: hidden;
        }

        .emoji-panel {
            width: 320px;
            height: 290px;
            display: flex;
            flex-direction: column;
            padding: 0;
        }

        .emoji-categories {
            display: flex;
            justify-content: space-around;
            padding: 5px;
            background-color: #f9f9f9;
            border-bottom: 1px solid #f0f0f0;
            flex-shrink: 0;
        }

        .emoji-category-btn {
            background: none;
            border: none;
            font-size: 22px;
            cursor: pointer;
            color: #888;
            padding: 6px;
            border-radius: 8px;
            transition: all 0.2s ease;
        }

        .emoji-category-btn:hover {
            background-color: #e9e9e9;
            color: #333;
        }

        .emoji-category-btn.active {
            color: var(--primary);
            background-color: var(--primary-light);
        }

        .emoji-grid {
            flex-grow: 1;
            overflow-y: auto;
            padding: 10px;
            display: grid;
            grid-template-columns: repeat(8, 1fr);
            gap: 2px;
        }

        .emoji-item {
            font-size: 24px;
            text-align: center;
            padding: 4px 0;
            border-radius: 8px;
            cursor: pointer;
            transition: background-color 0.15s ease;
        }

        .emoji-item:hover {
            background-color: #f0f0f0;
        }

        .emoji-grid::-webkit-scrollbar {
            width: 6px;
        }

        .emoji-grid::-webkit-scrollbar-thumb {
            background-color: #ccc;
            border-radius: 10px;
        }

        .emoji-grid::-webkit-scrollbar-thumb:hover {
            background-color: #aaa;
        }

        /* REEMPLAZA los estilos de .tracking-list y .tracking-item con esto */
        .tracking-panel h4 {
            text-align: center;
            margin: 0 0 20px 0;
            color: var(--secondary-text);
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .tracking-list {
            list-style: none;
            padding: 0;
            margin: 0;
            position: relative;
        }

        .tracking-list::before {
            content: '';
            position: absolute;
            left: 50%;
            top: 18px;
            bottom: 18px;
            width: 2px;
            background-color: #e0e0e0;
            transform: translateX(-50%);
            z-index: 0;
        }

        .tracking-item {
            margin-bottom: 25px;
            position: relative;
            cursor: pointer;
        }

        .tracking-icon {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background-color: #e0e0e0;
            border: 4px solid var(--primary-bg);
            z-index: 1;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            color: #aaa;
            transition: all 0.3s ease;
        }

        .tracking-item.completed .tracking-icon,
        .tracking-item.current .tracking-icon {
            background-color: var(--primary);
            color: white;
        }

        .tracking-item.current .tracking-icon {
            transform: scale(1.2);
        }

        /* Tooltip para el tracking */
        .tracking-item:hover::after {
            content: attr(data-stage-name);
            position: absolute;
            right: 120%;
            /* Muestra el tooltip a la izquierda del icono */
            top: 50%;
            transform: translateY(-50%);
            background-color: #333;
            color: white;
            padding: 5px 10px;
            border-radius: 4px;
            font-size: 14px;
            white-space: nowrap;
            z-index: 100;
        }

        .message {
            max-width: 75%;
            padding: 8px 15px;
            border-radius: 18px;
            line-height: 1.5;
            /* Un poco más de aire */
            word-wrap: break-word;
            white-space: pre-wrap;
            /* Mantiene los saltos de línea del markdown */
        }

        .message.received {
            background-color: #f0f2f5;
            align-self: flex-start;
            border-bottom-left-radius: 4px;
        }

        .message.sent {
            background-color: var(--primary);
            color: white;
            align-self: flex-end;
            border-bottom-right-radius: 4px;
        }

        .message.message--image {
            padding: 3px;
            background-color: transparent;
            line-height: 0;
        }

        .message.message--image img {
            max-width: 200px;
            border-radius: 15px;
            display: block;
        }

        /* --- MEJORAS VISUALES PARA MARKDOWN EN CHAT (Listas, Negritas, etc) --- */
        .message p {
            margin: 0 0 8px 0;
        }

        .message p:last-child {
            margin-bottom: 0;
        }

        .message ul,
        .message ol {
            margin: 5px 0 10px 0;
            padding-left: 20px;
            /* Indentación visual para listas */
        }

        .message li {
            margin-bottom: 4px;
        }

        .message strong {
            font-weight: 700;
        }

        .message a {
            color: inherit;
            text-decoration: underline;
            word-break: break-all;
            /* Romper links largos */
        }

        /* Ajuste específico para cuando la IA envía listas grandes */
        .message.sent {
            text-align: left;
            /* Alinear texto a la izquierda incluso si es enviado por "mí" (IA) */
        }

        /* --- ESTILOS PARA EL FORMULARIO DE PRODUCTOS --- */
        #product-form {
            padding: 20px;
            background-color: #fdfdfd;
            border-radius: 8px;
            border: 1px solid #f0f0f0;
        }

        .form-title {
            margin-top: 0;
            margin-bottom: 25px;
            font-size: 20px;
        }

        .form-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }

        .form-group {
            display: flex;
            flex-direction: column;
        }

        .grid-col-span-2 {
            grid-column: span 2;
        }

        #product-form label {
            margin-bottom: 8px;
            font-weight: 500;
            font-size: 14px;
            color: var(--secondary-text);
        }

        #product-form input[type="text"],
        #product-form input[type="number"],
        #product-form input[type="file"],
        #product-form textarea {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 15px;
            font-family: inherit;
            box-sizing: border-box;
        }

        #product-form textarea {
            resize: vertical;
            min-height: 80px;
        }

        .form-actions {
            margin-top: 30px;
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }

        .btn {
            padding: 10px 20px;
            border: none;
            border-radius: 6px;
            font-size: 15px;
            font-weight: 500;
            cursor: pointer;
        }

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

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

        .btn-secondary {
            background-color: #e0e0e0;
            color: var(--main-text);
        }

        #products-view {
            padding: 30px;
            display: flex;
            flex-direction: column;
            height: 100%;
            box-sizing: border-box;
            overflow-y: auto;
            /* <-- La propiedad clave para añadir el scroll */
        }

        /* --- ESTILOS PARA LA TABLA DE PRODUCTOS --- */
        .product-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
        }

        .product-table th,
        .product-table td {
            padding:
                12px 15px;
            text-align: left;
            border-bottom: 1px solid #f0f0f0;
        }

        .product-table th {
            background-color: #f8f9fa;
            font-weight: 500;
            color: var(--secondary-text);
        }

        .product-table tr:hover {
            background-color: #fdfaf3;
        }

        .product-table-img {
            width: 40px;
            height: 40px;
            border-radius: 4px;
            object-fit: cover;
            vertical-align: middle;
            margin-right: 10px;
        }

        .product-table .action-btn {
            background: none;
            border: none;
            cursor: pointer;
            font-size:
                16px;
            color: var(--secondary-text);
            margin: 0 5px;
        }

        .product-table .action-btn:hover {
            color: var(--primary);
        }

        /* --- ESTILOS PARA EL MODAL DE IMPORTACIÓN --- */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width:
                100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 100;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .modal-content {
            background-color: white;
            border-radius: 8px;
            padding: 30px;
            width:
                90%;
            max-width: 500px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }

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

        .modal-header h3 {
            margin: 0;
        }

        .modal-close-btn {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #aaa;
        }

        .csv-instructions {
            font-size: 14px;
            background-color: #f4f2f7;
            padding: 15px;
            border-radius: 6px;
        }

        .csv-instructions code {
            font-family: monospace;
            background-color: #e0e0e0;
            padding: 2px 4px;
            border-radius:
                3px;
        }

        #csv-upload-form input {
            margin-top: 15px;
        }

        #import-status {
            margin-top: 15px;
            font-weight: 500;
        }

        /*
        --- ESTILOS PARA EL BUSCADOR DE PRODUCTOS --- */
        /* REEMPLAZA los estilos de #conversation-view y
        .tracking-panel con esto */
        #conversation-view {
            display: none;
            flex-direction: row;
            flex-grow: 1;
            min-height:
                0;
            gap: 0;
            /* Quitamos el gap para controlar el borde nosotros */
            padding: 0;
            /* Quitamos el padding para que
        los paneles ocupen todo el espacio */
            box-sizing: border-box;
        }

        .conversation-main {
            flex-grow: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            padding: 30px;
            background-color: var(--card-bg);
        }

        .product-panel {
            width: 300px;
            flex-shrink: 0;
            padding: 30px 20px;
            border-left: 1px solid #e0e0e0;
            overflow-y: auto;
        }

        .tracking-panel {
            width: 200px;
            /* <-- Aumentamos el ancho */
            flex-shrink: 0;
            padding: 30px 20px;
            border-left:
                1px solid #e0e0e0;
            display: flex;
            flex-direction: column;
            align-items: stretch;
            /* <-- Cambiamos para que las
        tarjetas ocupen todo el ancho */
            overflow-y: auto;
            /* <-- Añadimos scroll por si hay muchas órdenes */
        }

        /* ---
        Fin del reemplazo --- */
        .product-search-container {
            /* Este contenedor ya no necesita propiedades complejas,
        simplemente un margen para separarse del tracking de arriba. */
            margin-top: 30px;
        }

        #product-search-input {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 14px;
            box-sizing:
                border-box;
            margin-bottom: 15px;
        }

        .product-search-item {
            display: flex;
            gap: 10px;
            padding: 10px 5px;
            border-bottom: 1px solid #f0f0f0;
        }

        .product-search-item img {
            width: 50px;
            height: 50px;
            border-radius: 4px;
            object-fit: cover;
        }

        .product-search-details {
            flex-grow: 1;
            font-size: 13px;
        }

        .product-search-details strong {
            display: block;
            font-size: 14px;
        }

        .product-search-actions {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .product-search-actions .action-btn {
            font-size: 14px;
            padding: 4px 8px;
        }

        /* --- ESTILOS PARA EL FORMULARIO DE
        PAGO --- */
        #payment-form .form-group label {
            margin-bottom: 8px;
            font-weight: 500;
            font-size: 14px;
            color:
                var(--secondary-text);
        }

        #payment-form input[type="text"],
        #payment-form input[type="file"],
        #payment-form select {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 15px;
            font-family: inherit;
            box-sizing: border-box;
            background-color: #fff;
            /* Asegura un fondo blanco */
        }

        /* ---
        ESTILOS PARA EL MENÚ COLAPSABLE --- */
        /* --- ESTILOS PARA EL MENÚ COLAPSABLE (VERSIÓN CORREGIDA) --- */
        .dashboard-container {
            display: flex;
            width: 100%;
            height: 100%;
        }

        .sidebar {
            position: relative;
            /* Esto es
        para posicionar el botón de colapsar */
            flex-shrink: 0;
            /* Evita que el menú se encoja */
            transition: width 0.3s ease;
            /* Aseguramos que no haya márgenes o posiciones extrañas */
            margin: 0;
            left: 0;
            top: 0;
        }

        .sidebar .nav-item span,
        .sidebar .logo span {
            transition: opacity 0.2s ease;
            white-space: nowrap;
        }

        .sidebar-toggle {
            position: absolute;
            top: 25px;
            right: -15px;
            width: 30px;
            height: 30px;
            background-color: var(--sidebar-bg);
            border: 2px solid var(--primary-bg);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content:
                center;
            cursor: pointer;
            z-index: 10;
            transition: all 0.3s ease;
        }

        .sidebar-toggle i {
            color: white;
            transition:
                transform 0.3s ease;
        }

        .sidebar-toggle:hover {
            background-color: var(--primary);
        }

        /* ESTADO COLAPSADO */
        .dashboard-container.sidebar-collapsed .sidebar {
            width: 80px;
        }

        .dashboard-container.sidebar-collapsed .logo span,
        .dashboard-container.sidebar-collapsed .nav-item span {
            opacity: 0;
            width: 0;
            overflow: hidden;
        }

        .dashboard-container.sidebar-collapsed .logo {
            justify-content: center;
        }

        .dashboard-container.sidebar-collapsed .nav-item {
            justify-content: center;
        }

        .dashboard-container.sidebar-collapsed .sidebar-toggle i {
            transform:
                rotate(180deg);
        }

        /* Tooltips al pasar el cursor */
        .dashboard-container.sidebar-collapsed .nav-item {
            position:
                relative;
        }

        .dashboard-container.sidebar-collapsed .nav-item:hover::after {
            content: attr(data-title);
            position:
                absolute;
            left: 100%;
            top: 50%;
            transform: translateY(-50%);
            background-color: #333;
            color: white;
            padding: 5px 10px;
            border-radius: 4px;
            font-size: 14px;
            white-space: nowrap;
            margin-left: 15px;
            z-index: 100;
        }

        /* ---
        ESTILOS PARA EL CARRITO DE COMPRAS --- */
        .cart-container {
            margin-top: 30px;
            padding-top: 20px;
        }

        .cart-item {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 15px;
        }

        .cart-item-img {
            width: 45px;
            height:
                45px;
            border-radius: 4px;
            object-fit: cover;
            flex-shrink: 0;
        }

        .cart-item-details {
            flex-grow: 1;
            font-size:
                14px;
            line-height: 1.3;
        }

        .cart-item-details strong {
            display: block;
            color: var(--main-text);
        }

        .cart-item-details span {
            color: var(--secondary-text);
        }

        .cart-total {
            margin-top: 20px;
            text-align: right;
            font-size: 18px;
            font-weight: bold;
        }

        .cart-total span {
            color: var(--secondary-text);
            font-weight: normal;
            font-size: 16px;
            margin-right: 10px;
        }

        /* AÑADE ESTAS NUEVAS CLASES PARA LOS CONTROLES DEL CARRITO */
        .cart-summary {
            margin-top: 15px;
            padding: 10px;
            background: #f8f9fa;
            border-radius: 8px;
            border: 1px solid #dee2e6;
        }

        .summary-line {
            display: flex;
            justify-content: space-between;
            font-size: 13px;
            margin-bottom: 5px;
            color: #495057;
        }

        .summary-line.total {
            font-weight: bold;
            font-size: 15px;
            color: #212529;
            border-top: 1px solid #dee2e6;
            margin-top: 10px;
            padding-top: 8px;
        }

        .detail-select-edit {
            width: 100%;
            padding: 8px;
            border-radius: 4px;
            border: 1px solid var(--primary);
            font-size: 13px;
        }

        .cart-item-actions {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .quantity-controls {
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .quantity-btn {
            background-color: #f0f0f0;
            border: none;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            cursor:
                pointer;
            font-weight: bold;
            color: var(--secondary-text);
        }

        .quantity-btn:hover {
            background-color: #e0e0e0;
        }

        .delete-cart-item-btn {
            background: none;
            border: none;
            color: #ff4d4d;
            cursor: pointer;
            font-size: 16px;
            padding: 0 5px;
        }

        .detail-item-static {
            display: flex;
            align-items: center;
            padding: 8px 10px;
            margin-bottom:
                5px;
            border-radius: 6px;
            cursor: pointer;
            transition: background 0.2s;
            font-size: 13px;
        }

        .detail-item-static:hover {
            background: #f0f4f8;
        }

        .detail-item-static i {
            width: 20px;
            color: var(--primary);
            margin-right: 10px;
            text-align: center;
        }

        .detail-label {
            font-size: 11px;
            color: #888;
            margin-bottom: 3px;
            margin-top: 10px;
            display: flex;
            align-items: center;
        }

        .detail-label i {
            margin-right: 5px;
            width: 15px;
            text-align: center;
        }

        .detail-select-permanent {
            width: 100%;
            padding: 6px 8px;
            font-size: 13px;
            border: 1px solid #ddd;
            border-radius: 4px;
            background: white;
            color: #333;
            outline: none;
        }

        .detail-select-permanent:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
        }

        .delete-cart-item-btn:hover {
            color: #cc0000;
        }

        /* FIN DE LAS NUEVAS CLASES */
        /* --- ESTILOS PARA DETALLES DEL CLIENTE --- */
        .customer-details-container {
            margin-top: 30px;
            padding-top: 20px;
        }

        .detail-item {
            display: flex;
            align-items:
                flex-start;
            gap: 12px;
            font-size: 14px;
            color: var(--main-text);
            margin-bottom: 12px;
        }

        .detail-item i {
            font-size: 15px;
            color: var(--secondary-text);
            margin-top: 2px;
            width: 18px;
            text-align: center;
        }

        .detail-item span {
            flex-grow: 1;
            line-height: 1.4;
        }

        /* --- Estilo para Títulos con Separador --- */
        .panel-section-title {
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px solid #e0e0e0;
        }

        /* --- Estilos para Órdenes --- */
        .create-order-btn {
            width: 100%;
            margin-top: 15px;
            padding: 12px;
            font-size: 16px;
        }

        .order-indicator {
            font-size: 12px;
            background-color: #e0e0e0;
            color: var(--secondary-text);
            padding: 2px 6px;
            border-radius: 10px;
            margin-left: 8px;
        }

        .order-indicator .fa-check {
            color: #28a745;
            /* Un color verde para el check */
        }

        /* ---
        Estilos para la Sección de Órdenes --- */
        .orders-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
        }

        .orders-table th,
        .orders-table td {
            padding: 14px 16px;
            text-align: left;
            border-bottom: 1px solid #f1f5f9;
        }

        .orders-table th {
            background-color: #fafbfc;
            font-weight: 700;
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: .04em;
            color: #94a3b8;
            border-bottom: 1px solid #eef0f3;
        }

        .orders-table tbody tr:last-child td {
            border-bottom: none;
        }

        .orders-table tr {
            cursor: pointer;
            transition: background-color 0.15s ease;
        }

        .orders-table tr:hover {
            background-color: #f8f7ff;
        }

        .order-detail-header {
            padding: 20px 30px;
            border-bottom: 1px solid #f0f0f0;
        }

        .order-detail-header .back-btn {
            margin-right: 20px;
        }

        /* --- Estilos para la Sección de Clientes --- */
        .client-info-panel .profile-pic {
            width:
                80px;
            height: 80px;
            margin-bottom: 15px;
        }

        .client-total-purchase {
            margin-top: 20px;
            font-size: 16px;
        }

        .clients-table {
            /* Reutilizamos el estilo de la tabla de órdenes */
            width: 100%;
            border-collapse: collapse;
            font-size: 15px;
        }

        .clients-table th,
        .clients-table td {
            padding: 15px;
            text-align: left;
            border-bottom: 1px solid #f0f0f0;
        }

        .clients-table th {
            background-color: #f8f9fa;
            font-weight: 500;
        }

        .clients-table tr {
            cursor:
                pointer;
            transition: background-color 0.2s ease;
        }

        .clients-table tr:hover {
            background-color: #fdfaf3;
        }

        .client-detail-view {
            display: flex;
            height: 100%;
        }

        .client-info-panel {
            width: 320px;
            flex-shrink: 0;
            padding:
                30px;
            border-right: 1px solid #f0f0f0;
        }

        .client-orders-panel {
            flex-grow: 1;
            padding: 30px;
            overflow-y: auto;
        }

        .conversation-header.is-clickable {
            cursor: pointer;
        }

        /* --- Estilos para Mejoras de Inventario --- */
        #product-search-bar {
            width: 100%;
            max-width: 400px;
            padding: 10px 15px;
            border: 1px solid #ddd;
            border-radius:
                6px;
            font-size: 15px;
        }

        .sold-count-cell {
            font-weight: bold;
            text-decoration: underline;
            cursor: pointer;
            position: relative;
        }

        .orders-popover {
            position: absolute;
            background-color: white;
            border: 1px solid #eee;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            border-radius: 6px;
            padding: 10px;
            z-index: 100;
            min-width: 150px;
            max-height: 200px;
            overflow-y: auto;
        }

        .orders-popover ul {
            list-style: none;
            padding: 0;
            margin: 0;
        }

        .orders-popover li {
            padding: 8px 10px;
            cursor: pointer;
        }

        .orders-popover li:hover {
            background-color: #f0f0f0;
        }

        /* --- INICIO: ESTILOS PARA EL HISTORIAL DE ÓRDENES EN CHAT --- */
        .history-list {
            width: 100%;
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-top: 15px;
        }

        .history-card {
            background-color: #f8f9fa;
            border: 1px solid #e9ecef;
            border-left: 4px solid var(--primary);
            border-radius: 6px;
            padding: 12px;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .history-card:hover {
            border-color:
                var(--primary);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
            transform: translateY(-2px);
        }

        .history-card-icon {
            font-size: 18px;
            color: var(--secondary-text);
            width: 20px;
            text-align: center;
        }

        .history-card-details {
            font-size: 13px;
            line-height: 1.4;
            color: var(--secondary-text);
        }

        .history-card-details strong {
            display:
                block;
            color: var(--main-text);
            font-size: 14px;
            margin-bottom: 2px;
        }

        /* --- FIN: ESTILOS --- */
        /* --- INICIO:
        ESTILOS PARA EL NUEVO ESTUDIO MÁGICO (VERSIÓN 2.0 - ESTILO GEMINI) --- */
        .gemini-style-chat {
            display: flex;
            height: 100%;
            width: 100%;
            box-sizing: border-box;
            padding: 0;
            font-family: "Google Sans", -apple-system,
                BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
        }

        /* --- Barra Lateral de Chats --- */
        #studio-sidebar {
            width: 260px;
            background-color: #f8f9fa;
            /* Un gris muy claro y limpio */
            padding: 15px;
            display: flex;
            flex-direction: column;
            border-right: 1px solid #dee2e6;
        }

        #new-chat-btn {
            width: 100%;
            margin-bottom: 15px;
            background-color: var(--primary);
            border: none;
            font-weight: 500;
        }

        #studio-chat-list {
            flex-grow: 1;
            overflow-y: auto;
        }

        .studio-chat-item {
            padding: 12px 15px;
            margin-bottom: 5px;
            border-radius:
                8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            color: #3c4043;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            transition: background-color 0.2s ease;
        }

        .studio-chat-item:hover {
            background-color:
                #e9ecef;
        }

        .studio-chat-item.active {
            background-color: #e8f0fe;
            /* Un azul suave para el item activo, como en
        Gemini */
            color: #1967d2;
        }

        /* --- Panel Principal del Chat --- */
        #studio-main-panel {
            flex-grow: 1;
            display:
                flex;
            position: relative;
            /* Necesario para la maquetación */
            background-color: #ffffff;
        }

        #studio-content-wrapper {
            width: 100%;
            max-width: 820px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            height: 100%;
        }

        #studio-messages {
            flex-grow: 1;
            /* Hace que ocupe todo el espacio vertical disponible */
            overflow-y: auto;
            /* AÑADE EL SCROLL SÓLO A ESTA ÁREA */
            padding: 24px 10px;
        }

        /* --- Burbujas de Mensajes
        (Estilo Asimétrico Corregido y Final) --- */
        #studio-messages {
            display: flex;
            flex-direction: column;
            /*
        Asegura que los mensajes se apilen verticalmente */
            flex-grow: 1;
            overflow-y: auto;
            padding: 24px 10px;
        }

        .studio-message {
            max-width: 85%;
            margin-bottom: 24px;
            line-height: 1.6;
            display: flex;
            /* Habilitamos flexbox
        para alinear contenido interno */
        }

        /* --- Estilo para el Mensaje de LYA (Modelo/IA) --- */
        .studio-message.model {
            align-items: flex-start;
            gap: 16px;
            align-self: flex-start;
            /* Se alinea a la izquierda
        del contenedor */
        }

        .studio-message-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 500;
            flex-shrink: 0;
            background-color:
                var(--primary);
            color: white;
        }

        .studio-message-content {
            padding-top: 4px;
            color: #3c4043;
            text-align: left;
            /*
        Asegura la alineación del texto */
        }

        /* --- Estilo para el Mensaje de la Empresa (Usuario) --- */
        .studio-message.user {
            background-color: #f0f2f5;
            color: #3c4043;
            padding: 10px 15px;
            border-radius: 18px;
            border-bottom-right-radius: 4px;
            align-self: flex-end;
            /* Se alinea a la derecha del contenedor */
            max-width:
                75%;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
            text-align: left;
            /* Asegura la alineación del texto dentro de
        la burbuja */
        }

        /* --- Estilos para el contenido de Markdown (aplican a ambos) --- */
        .studio-message p:last-child {
            margin-bottom: 0;
        }

        .studio-message ul,
        .studio-message ol {
            margin-bottom: 0;
            padding-left:
                20px;
        }

        .studio-message pre {
            background-color: #f1f3f4;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding:
                12px;
            font-family: "Roboto Mono", monospace;
            word-wrap: break-word;
        }

        /* --- Área de Input --- */
        #studio-input-area {
            margin: 0 0 20px 0;
            /* El margen ahora es solo inferior */
            flex-shrink: 0;
            /* Evita que se
        encoja */
            /* El resto de las propiedades se mantienen */
            display: flex;
            gap: 10px;
            align-items: flex-end;
            background-color: #f1f3f4;
            border-radius: 28px;
            padding: 8px 12px 8px 20px;
            border: 1px solid transparent;
            transition: border-color 0.2s ease;
        }

        #studio-input-area:focus-within {
            border-color: #ddd;
        }

        #studio-question-input {
            flex-grow: 1;
            border: none;
            background: transparent;
            padding: 10px 0;
            resize: none;
            font-size: 16px;
            font-family: inherit;
            line-height: 1.5;
            outline: none;
            max-height: 200px;
        }

        #studio-ask-btn {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            padding: 0;
            font-size: 18px;
            align-self: flex-end;
            /* Se alinea
        con la base del textarea */
        }

        /* --- FIN: ESTILOS --- */
        /* Cursor y estado de tipeo para Estudio Mágico */
        .studio-message.model .studio-message-content.typing::after {
            content: "▍";
            animation: blink 1s step-end infinite;
            margin-left: 2px;
            opacity: .8;
        }

        @keyframes blink {
            50% {
                opacity: 0;
            }
        }

        @keyframes msgSlideIn {
            from {
                opacity: 0;
                transform: translateY(12px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .chatlist-new-animate {
            animation: msgSlideIn 0.4s ease forwards;
        }

        /* Estilos de Configuración
        */
        .settings-container {
            padding: 40px;
            overflow-y: auto;
            height: 100%;
        }

        .switch {
            position: relative;
            display: inline-block;
            width: 60px;
            height: 34px;
        }

        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor:
                pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 34px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 26px;
            width: 26px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked+.slider {
            background-color:
                #25D366;
        }

        input:checked+.slider:before {
            transform: translateX(26px);
        }

        /* Estilos para el header de la
        conversación y botones de IA */
        .conversation-header {
            display: flex;
            align-items: center;
            padding-bottom: 15px;
            margin-bottom: 15px;
            border-bottom: 1px solid #eee;
            flex-shrink: 0;
        }

        .conversation-header-info {
            flex-grow: 1;
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .ai-toggle-btn {
            margin-left: auto;
            padding: 8px 12px;
            font-size: 13px;
            font-weight: 500;
            border-radius: 20px;
            cursor: pointer;
            border: 1px solid transparent;
        }

        .ai-toggle-btn.human-mode {
            background-color: #e8f0fe;
            color: #1967d2;
            border-color: #1967d2;
        }

        .ai-toggle-btn.ai-mode {
            background-color: #e6f7ea;
            color: #1e8e3e;
            border-color: #1e8e3e;
        }

        .conversation-input-area.disabled {
            opacity: 0.6;
            pointer-events: none;
        }

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

        .modal-content {
            background-color: white;
            border-radius: 8px;
            padding: 25px;
            width: 90%;
            max-width:
                550px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }

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

        .modal-header h3 {
            margin: 0;
        }

        .modal-close-btn {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #aaa;
        }

        .modal-body {
            max-height: 60vh;
            overflow-y: auto;
        }

        .saved-reply-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px;
            border-bottom: 1px solid #eee;
        }

        .saved-reply-actions .action-btn {
            background: none;
            border:
                none;
            cursor: pointer;
            font-size: 16px;
            color: #888;
            margin-left: 10px;
        }

        /* --- INICIO: Estilos Mejorados para
        Respuestas Guardadas --- */
        .saved-replies-panel .reply-list {
            padding: 5px;
            max-height: 300px;
            overflow-y:
                auto;
        }

        .saved-replies-panel {
            width: 400px;
            height: 400px;
            display: flex;
            flex-direction: column;
        }

        .saved-replies-panel .reply-list {
            padding: 5px;
            overflow-y: auto;
            flex-grow: 1;
            min-height: 0;
        }

        .reply-item-card {
            display: flex;
            cursor: pointer;
            border-radius: 8px;
            padding: 10px;
            margin: 2px 0;
            transition:
                background-color 0.2s ease;
        }

        .reply-item-card:hover {
            background-color: var(--primary-light);
        }

        .reply-item-card .title {
            font-weight: 600;
            color: #333;
            width: 150px;
            flex-shrink: 0;
            padding-right: 10px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .reply-item-card .text {
            font-size: 14px;
            color: #777;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        #replies-manager-modal .saved-reply-item {
            border-radius: 6px;
            margin-bottom: 5px;
        }

        #replies-manager-modal .saved-reply-item:hover {
            background-color: #f9f9f9;
        }

        #modal-reply-form {
            border: 1px solid #eee;
        }

        #modal-reply-form input,
        #modal-reply-form textarea {
            font-size: 15px !important;
        }

        #modal-status-message {
            text-align: center;
            padding:
                12px;
            margin: 15px 0;
            border-radius: 6px;
            background-color: #e6f7ea;
            color: #1e8e3e;
            font-weight: 500;
            display:
                none;
        }

        /* --- FIN: Estilos Mejorados --- */
        /* --- NUEVOS ESTILOS PARA EL FORMULARIO DEL CATÁLOGO --- */
        .filter-input {
            font-size: 13px !important;
            padding: 10px 14px;
            border-radius: 8px;
            border: 1px solid #e5e7eb;
            background: #fff;
            color: #374151;
        }

        .filter-input.multi-select {
            padding: 4px;
            min-height: 40px !important;
        }

        .multi-select option {
            padding: 4px 8px;
            border-radius: 4px;
        }

        .multi-select option:checked {
            background: #7751f8 !important;
            color: #fff !important;
        }

        .settings-card {
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            border: 1px solid #e5e7eb;
        }

        .settings-card h4 {
            margin-top: 0;
            border-bottom: 1px solid #e5e7eb;
            padding-bottom: 10px;
            margin-bottom: 20px;
        }

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

        .form-group label {
            display: block;
            font-weight: 500;
            margin-bottom: 5px;
            font-size: 14px;
            color: #374151;
        }

        .form-group input,
        .form-group textarea {
            width: 100%;
            padding: 8px 12px;
            border-radius: 6px;
            border: 1px solid #d1d5db;
            box-sizing: border-box;
        }

        /* --- INICIO: CÓDIGO PARA HACER LYA RESPONSIVE --- */
        @media (max-width: 1024px) {
            .sidebar {
                display: none;
            }

            .main-content {
                padding: 20px;
            }

            #conversation-view {
                flex-direction: column;
                height: 100%;
                overflow-y: auto;
            }

            .product-panel,
            .tracking-panel {
                width: 100%;
                max-width: none;
                border-left: none;
                border-top: 1px solid #e0e0e0;
                padding: 20px;
                box-sizing: border-box;
            }

            .conversation-main {
                padding: 20px;
            }
        }

        @media (max-width: 768px) {
            .main-content {
                padding: 10px;
            }

            .main-header h1 {
                font-size: 24px;
            }

            .main-header p {
                font-size: 14px;
            }

            #content-area {
                padding: 0;
            }

            .conversation-main,
            .product-panel,
            .tracking-panel {
                padding: 15px;
            }
        }

        /* --- FIN: CÓDIGO RESPONSIVE --- */
        /* --- INICIO: ESTILOS PARA MENÚ HAMBURGUESA --- */
        .mobile-menu-toggle {
            display: none;
            /* Oculto en escritorio */
            background: none;
            border: none;
            font-size: 24px;
            color: var(--text-main);
            cursor: pointer;
            margin-right: 15px;
        }

        /* En pantallas pequeñas... */
        @media (max-width: 1024px) {
            .mobile-menu-toggle {
                display: block;
                /* ...mostramos el botón de hamburguesa. */
            }

            .main-header {
                /* Alineamos el botón con el título */
                display: flex;
                align-items: center;
            }

            .sidebar {
                /*
        Posicionamos el menú fuera de la pantalla por defecto */
                position: fixed;
                left: 0;
                top: 0;
                height: 100%;
                z-index: 1000;
                transform: translateX(-100%);
                transition: transform 0.3s ease-in-out;
                display: flex;
                /* Lo
        volvemos a mostrar para que la transición funcione */
            }

            .sidebar.is-open {
                /* Cuando esté abierto, lo traemos a
        la vista */
                transform: translateX(0);
            }

            /* Quitamos el colapso en móvil, ahora se oculta/muestra */
            .dashboard-container.sidebar-collapsed .sidebar {
                width: 260px;
            }

            .sidebar-toggle {
                display: none;
                /* Ocultamos
        el botón de colapsar en la barra */
            }

            /* Forzamos a que el texto de los items sea visible en el menú móvil */
            .dashboard-container.sidebar-collapsed .nav-item span,
            .dashboard-container.sidebar-collapsed .logo span {
                opacity: 1;
                width: auto;
                overflow: visible;
            }

            /* Alineamos el texto y el icono a la izquierda, como en la
        versión de escritorio */
            .dashboard-container.sidebar-collapsed .nav-item,
            .dashboard-container.sidebar-collapsed .logo {
                justify-content: flex-start;
            }
        }

        /* --- FIN: ESTILOS MENÚ
        HAMBURGUESA --- */
        /* --- INICIO: RESET DEFINITIVO PARA BURBUJAS DE MENSAJE --- */
        /* 1. Nos aseguramos de que
        la burbuja se ajuste a su contenido */
        .message {
            height: auto !important;
            white-space: normal !important;
            /*
        Anulamos el pre-wrap */
        }

        /* 2. Reseteamos completamente los párrafos que están adentro */
        .message p {
            margin:
                0 !important;
            padding: 0 !important;
            line-height: 1.4 !important;
            /* Forzamos una altura de línea normal */
        }

        /*
        --- FIN: RESET DEFINITIVO --- */
        .chat-item.active {
            background-color: var(--primary-light) !important;
            border-right: 4px solid var(--primary);
        }

        /* --- INICIO: ESTILOS PARA NOTIFICACIÓN TOAST EN CHAT --- */
        .chat-toast {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translate(-50%, -150%);
            /* Inicia oculto arriba
        */
            background-color: var(--primary);
            color: var(--white);
            padding: 12px 24px;
            border-radius: 25px;
            font-weight:
                500;
            font-size: 15px;
            z-index: 2000;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            transition: transform 0.4s ease-in-out, visibility 0.4s;
            /* Añadimos visibility a la transición */
            visibility: hidden;
            /* <-- LÍNEA NUEVA:
        Oculto por defecto */
        }

        .chat-toast.show {
            transform: translate(-50%, 0);
            /* Se desliza a su posición visible */
            visibility: visible;
            /* <-- LÍNEA NUEVA: Visible cuando se muestra */
        }

        /* --- FIN: ESTILOS PARA NOTIFICACIÓN
        TOAST --- */
        /* --- INICIO: ESTILOS ESPECÍFICOS PARA PAGINACIÓN BOOTSTRAP --- */
        /* Contenedor principal de la
        paginación */
        .pagination {
            display: flex;
            padding-left: 0;
            list-style: none;
            border-radius: .25rem;
            /*
        Opcional: bordes redondeados */
        }

        /* Estilo de los enlaces/botones dentro de cada item */
        .page-link {
            position:
                relative;
            display: block;
            padding: .5rem .75rem;
            margin-left: -1px;
            /* Junta los bordes */
            line-height: 1.25;
            color: #6366F1;
            /* Color principal LYA para enlaces */
            background-color: #fff;
            border: 1px solid #dee2e6;
            text-decoration: none;
            /* Quita subrayado */
            transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
        }

        /* Estilo al pasar el cursor (hover)
        */
        .page-link:hover {
            z-index: 2;
            color: #4F46E5;
            /* Color LYA hover */
            background-color: #e9ecef;
            border-color:
                #dee2e6;
        }

        /* Quita margen izquierdo al primer elemento */
        .page-item:first-child .page-link {
            margin-left: 0;
            border-top-left-radius: .25rem;
            border-bottom-left-radius: .25rem;
        }

        /* Estilo para el último elemento */
        .page-item:last-child .page-link {
            border-top-right-radius: .25rem;
            border-bottom-right-radius: .25rem;
        }

        /*
        Estilo para el item activo (página actual) */
        .page-item.active .page-link {
            z-index: 3;
            color: #fff;
            background-color: #6366F1;
            /* Color principal LYA */
            border-color: #6366F1;
            /* Color principal LYA */
        }

        /*
        Estilo para items desactivados (primera/última página) */
        .page-item.disabled .page-link {
            color: #6c757d;
            pointer-events: none;
            cursor: auto;
            background-color: #fff;
            border-color: #dee2e6;
        }

        /* Centrar la paginación
        (si usas justify-content-center en el HTML) */
        .justify-content-center {
            justify-content: center !important;
        }

        /* --- FIN: ESTILOS ESPECÍFICOS --- */
        /* --- RESPONSIVE FIXES FOR DELL/SMALL SCREENS --- */
        @media (max-width: 1366px) {
            .sidebar {
                width: 220px;
                /* More compact sidebar */
            }

            .sidebar-header {
                padding: 0 15px;
            }

            .nav-item {
                padding: 12px 15px;
            }

            .main-content {
                padding: 20px;
                /* Recover 40px of width */
            }

            .view-switcher,
            .chat-filters {
                margin-left: 0;
                margin-right: 0;
            }

            .chat-list {
                padding: 10px;
            }
        }

        @media (max-width: 1024px) {
            .sidebar {
                width: 60px;
                /* Icon-only mode for tablets/small laptops */
                align-items: center;
            }

            .sidebar-header {
                padding: 0;
                margin-bottom: 20px;
                justify-content: center;
            }

            .logo span,
            .nav-item span {
                display: none;
                /* Hide text */
            }

            .nav-item {
                padding: 15px;
                justify-content: center;
                width: 100%;
                box-sizing: border-box;
            }

            .nav-item i {
                margin:
                    0;
                font-size: 22px;
            }

            /* Adjust Main Content to fill space */
            .main-content {
                padding: 15px;
            }
        }

        /* Prevent
        Flexbox Overflow Issues */
        .content-area,
        .kanban-board,
        .chat-details {
            min-width: 0;
            /* Critical for nested
        flex containers */
        }

        /* --- INICIO: ESTILOS PARA INDICADORES VISUALES (IA/INTENCIÓN) --- */
        .chat-header-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2px;
        }

        .chat-header-bottom {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 11px;
            color: #666;
        }

        .mode-indicator {
            display:
                inline-flex;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            font-size: 10px;
            margin-right: 4px;
        }

        .mode-indicator.ai {
            color: #1e8e3e;
            background-color: #e6f7ea;
            border:
                1px solid #ceead6;
        }

        .mode-indicator.human {
            color: #ea8600;
            background-color: #fce8e6;
            /* Usamos un tono cálido
        para humano */
            border: 1px solid #fad2cf;
        }

        .intent-badge {
            display: inline-block;
            padding: 1px 6px;
            border-radius: 4px;
            font-size: 10px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.3px;
        }

        /*
        Colores por Intención (Ejemplos) */
        .intent-general {
            background-color: #e8f0fe;
            color: #1967d2;
        }

        .intent-venta {
            background-color: #e6f4ea;
            color: #137333;
        }

        .intent-venta-web {
            background-color: #fef08a;
            /* Yellow-200 */
            color: #854d0e;
            /* Yellow-800 */
        }

        .intent-queja {
            background-color: #fce8e6;
            color: #c5221f;
        }

        .intent-envio {
            background-color: #fff8e1;
            color: #f29900;
        }

        .intent-default {
            background-color: #f1f3f4;
            color: #5f6368;
        }

        .chat-item .chat-header {
            /* Restablecemos el display flex del header original para usar nuestro nuevo layout */
            display: block;
        }

        /* --- FIN: ESTILOS PARA INDICADORES VISUALES --- */
        /* --- NUEVOS ESTILOS: REDISEÑO ÓRDENES
        (SHOPIFY STYLE) --- */
        .shopify-layout {
            display: grid;
            grid-template-columns: 2fr 1fr;
            gap: 20px;
            padding: 20px 30px 60px 30px;
            /* Aumentado padding inferior */
            background-color: #f6f6f7;
            min-height: calc(100vh - 160px);
        }

        .shopify-card {
            background: #ffffff;
            border-radius: 8px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
            padding: 20px;
            margin-bottom: 20px;
            border: 1px solid #e1e3e5;
        }

        .shopify-card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
        }

        .shopify-card-title {
            font-size: 16px;
            font-weight: 600;
            color: #202223;
            margin: 0;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        /* Iconos coloridos y armoniosos para los títulos de tarjeta */
        .icon-wrapper {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            border-radius: 8px;
            font-size: 14px;
        }

        .icon-wrapper.blue {
            background-color: #e3f0ff;
            color: #005bd3;
        }

        .icon-wrapper.green {
            background-color: #e1f5e8;
            color: #008060;
        }

        .icon-wrapper.purple {
            background-color:
                #f1e4ff;
            color: #5c20a8;
        }

        .icon-wrapper.yellow {
            background-color: #fffae8;
            color: #9a6500;
        }

        .icon-wrapper.gray {
            background-color: #f6f6f7;
            color: #5c5f62;
        }

        .shopify-detail-row {
            display: flex;
            justify-content: space-between;
            padding: 8px 0;
            color: #6d7175;
            font-size: 14px;
        }

        .shopify-detail-row.bold {
            color: #202223;
            font-weight: 600;
        }

        .shopify-detail-row.total {
            font-size: 16px;
            font-weight: 700;
            border-top:
                1px solid #e1e3e5;
            padding-top: 15px;
            margin-top: 10px;
        }

        .shopify-badge {
            display: inline-flex;
            align-items:
                center;
            padding: 2px 8px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 500;
            gap: 4px;
        }

        .shopify-badge::before {
            content: '';
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
        }

        .badge-success {
            background: #E3F1DF;
            color: #2E6B27;
        }

        .badge-success::before {
            background: #2E6B27;
        }

        .badge-warning {
            background: #FFEA8A;
            color: #8A6116;
        }

        .badge-warning::before {
            background: #8A6116;
        }

        .badge-neutral {
            background: #E4E5E7;
            color: #4D5358;
        }

        .badge-neutral::before {
            background: #4D5358;
        }

        .badge-info {
            background: #f5f3ff;
            color: #6366f1;
        }

        .badge-info::before {
            background: #6366f1;
        }

        .shopify-item-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
        }

        .shopify-item-table th,
        .shopify-item-table td {
            padding: 12px 0;
            text-align: left;
            border-bottom: 1px solid #e1e3e5;
        }

        .shopify-item-table th {
            color: #6d7175;
            font-weight: 500;
        }

        .shopify-sidebar-section {
            margin-bottom: 20px;
        }

        .shopify-sidebar-section h4 {
            font-size: 13px;
            text-transform: uppercase;
            color: #6d7175;
            font-weight: 600;
            margin-bottom: 10px;
            letter-spacing: 0.5px;
        }

        .shopify-sidebar-text {
            font-size: 14px;
            color: #202223;
            margin-bottom: 5px;
            line-height: 1.4;
        }

        .shopify-sidebar-link {
            color: #2c6ecb;
            text-decoration: none;
            cursor:
                pointer;
            font-size: 14px;
        }

        .shopify-sidebar-link:hover {
            text-decoration: underline;
        }

        .order-header-actions {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 15px 30px;
            background: white;
            border-bottom: 1px solid #e1e3e5;
            position: sticky;
            top: 0;
            z-index: 10;
        }

        .order-header-main {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .order-header-title {
            font-size: 20px;
            font-weight: 600;
            color: #202223;
            margin: 0;
        }

        .order-header-buttons {
            display: flex;
            gap: 8px;
        }

        .shopify-btn {
            background: white;
            border: 1px solid #e1e3e5;
            border-radius: 6px;
            padding: 8px 14px;
            font-size: 13px;
            font-weight: 500;
            color: #202223;
            cursor:
                pointer;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
            display: inline-flex;
            align-items: center;
            gap: 6px;
            text-decoration: none;
            transition: all 0.2s ease;
        }

        .shopify-btn:hover {
            background: #f8f9fa;
            border-color:
                #c9cccf;
            color: #202223;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
            transform: translateY(-1px);
        }

        .shopify-btn.primary {
            background: linear-gradient(135deg, #7A5AF5, #6a017f);
            color: white;
            border: none;
            box-shadow: 0 4px 6px rgba(122, 90, 245, 0.2);
        }

        .shopify-btn.primary:hover {
            background:
                linear-gradient(135deg, #6a017f, #510061);
            color: white;
            box-shadow: 0 6px 8px rgba(122, 90, 245, 0.3);
        }

        .shopify-btn i {
            font-size: 14px;
        }

        /* --- Estilos Toast Notification --- */
        .lya-toast {
            position: fixed;
            bottom: -100px;
            left: 50%;
            transform: translateX(-50%);
            background: #202223;
            color: white;
            padding: 12px 24px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 10px;
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
            transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            z-index: 10000;
        }

        .lya-toast.show {
            bottom: 30px;
        }

        .lya-toast.success i {
            color: #00a06b;
        }

        .lya-toast.error i {
            color: #d82c0d;
        }

        /* --- Estilos para los Selectores de Etapa --- */
        .shopify-select-wrapper {
            position:
                relative;
            display: inline-flex;
            align-items: center;
        }

        .shopify-select {
            appearance: none;
            -webkit-appearance:
                none;
            background: white;
            border: 1px solid #c9cccf;
            border-radius: 4px;
            padding: 6px 30px 6px 12px;
            font-size:
                14px;
            font-weight: 500;
            color: #202223;
            cursor: pointer;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
            transition:
                border-color 0.2s, box-shadow 0.2s;
        }

        .shopify-select:hover {
            background: #f6f6f7;
        }

        .shopify-select:focus {
            outline: none;
            border-color: #7A5AF5;
            /* Morado Lya */
            box-shadow: 0 0 0 2px rgba(122, 90, 245, 0.2);
        }

        .shopify-select-icon {
            position: absolute;
            right: 12px;
            pointer-events: none;
            color: #5c5f62;
            font-size: 12px;
        }

        /* Highlight para el método de pago */
        .payment-highlight {
            background-color: #f1f8f5;
            border: 1px solid #cce8d9;
            padding: 10px 15px;
            border-radius: 6px;
            color: #006e52;
            font-weight: 600;
            display: flex;
            align-items:
                center;
            gap: 8px;
            margin-bottom: 15px;
        }

        /* --- FIN REDISEÑO ÓRDENES --- */
        /* --- ESTILOS MODERNOS PARA SWEETALERT2 (Glassmorphism) --- */
        .glass-swal-popup {
            background: rgba(255, 255, 255, 0.95) !important;
            backdrop-filter: blur(16px) saturate(180%);
            border: 1px solid rgba(255, 255, 255, 0.3) !important;
            box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.1) !important;
            border-radius: 24px !important;
            overflow: hidden;
            color: #1e293b !important;
        }

        div:where(.swal2-container) h2:where(.swal2-title).glass-swal-title {
            color: #0f172a !important;
            font-weight: 900 !important;
            font-family: 'Inter', system-ui, sans-serif !important;
            letter-spacing: -0.025em;
        }

        .glass-swal-confirm {
            background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
            border-radius: 12px !important;
            font-weight: 700 !important;
            box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
            padding: 12px 24px !important;
            transition: all 0.3s ease !important;
        }

        .glass-swal-confirm:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4) !important;
        }

        .glass-toast-popup {
            background: rgba(255, 255, 255, 0.92) !important;
            backdrop-filter: blur(12px);
            border: 1px solid rgba(255, 255, 255, 0.5) !important;
            box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.08) !important;
            border-radius: 16px !important;
            padding: 10px 20px !important;
        }

        .glass-toast-title {
            font-weight: 800 !important;
            font-family: 'Inter', system-ui, sans-serif !important;
            color: #0f172a !important;
            font-size: 14px !important;
        }

        /* --- PREMUIM CSS TOOLTIPS PARA SIDEBAR CONTRAIDO --- */
        aside.w-20 .nav-item {
            position: relative;
        }

        aside.w-20 .nav-item:hover::after {
            content: attr(data-title);
            position: absolute;
            left: 100%;
            top: 50%;
            transform: translateY(-50%);
            margin-left: 14px;
            background-color: #1e293b;
            /* slate-800 */
            color: white;
            padding: 8px 14px;
            border-radius: 8px;
            font-size: 13px;
            font-family: 'Inter', sans-serif;
            font-weight: 600;
            white-space: nowrap;
            z-index: 99999;
            box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
            pointer-events: none;
            opacity: 1 !important;
            visibility: visible !important;
        }

        /* Tooltip Arrow */
        aside.w-20 .nav-item:hover::before {
            content: "";
            position: absolute;
            left: 100%;
            top: 50%;
            transform: translateY(-50%);
            margin-left: 8px;
            border-width: 6px;
            border-style: solid;
            border-color: transparent #1e293b transparent transparent;
            z-index: 99999;
            pointer-events: none;
        }

        /* --- ESTILOS SUBMENÚ --- */
        .sub-nav-container {
            display: none;
            flex-direction: column;
            margin-top: 2px;
            margin-left: 16px;
            margin-bottom: 4px;
            border-left: 2px solid rgba(192, 132, 252, 0.25);
            padding-left: 8px;
            animation: fadeIn 0.2s ease;
        }
        .sub-nav-container.open {
            display: flex;
        }
        .sub-nav-group {
            font-size: 10px;
            font-weight: 700;
            color: #94a3b8;
            text-transform: uppercase;
            margin-top: 8px;
            margin-bottom: 4px;
            letter-spacing: 0.05em;
        }
        .sub-nav-item {
            padding: 7px 10px;
            border-radius: 8px;
            font-size: 12px;
            font-weight: 600;
            color: #94a3b8;
            cursor: pointer;
            transition: all 0.15s;
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 2px;
        }
        .sub-nav-item:hover {
            background: rgba(255,255,255,0.07);
            color: #e2e8f0;
        }
        .sub-nav-item i {
            font-size: 11px;
            width: 14px;
            text-align: center;
            color: #64748b;
            flex-shrink: 0;
        }
        .sub-nav-item:hover i { color: #94a3b8; }
        .sub-nav-item.sub-nav-active {
            background: rgba(106, 1, 127, 0.30);
            color: #f3e8ff;
            font-weight: 700;
        }
        .sub-nav-item.sub-nav-active i { color: #c084fc; }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-5px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .guias-st-pill {
            padding:6px 16px; border-radius:20px; border:1.5px solid #e2e8f0; background:#fff;
            font-size:12px; font-weight:600; color:#64748b; cursor:pointer; transition:all .15s; white-space:nowrap;
        }
        .guias-st-pill:hover { border-color:#6a017f; color:#6a017f; }
        .guias-st-pill.active { background:#6a017f; color:#fff; border-color:#6a017f; }
        .tickets-st-pill {
            padding:6px 16px; border-radius:20px; border:1.5px solid #e2e8f0; background:#fff;
            font-size:12px; font-weight:600; color:#64748b; cursor:pointer; transition:all .15s; white-space:nowrap;
        }
        .tickets-st-pill:hover { border-color:#6a017f; color:#6a017f; }
        .tickets-st-pill.active { background:#6a017f; color:#fff; border-color:#6a017f; }

        /* ============================================================
           VENTARIA — RESPONSIVE MÓVIL (Métricas, Inbox, Órdenes, Ventas)
           Todo encapsulado en @media: la versión de escritorio (>1024px)
           no se ve afectada por ninguna de estas reglas.
           ============================================================ */

        /* Botones de navegación móvil del Inbox: ocultos en escritorio */
        .mobile-chat-back-btn,
        .mobile-sales-toggle-btn,
        .mobile-sales-back-btn {
            display: none;
            align-items: center;
            justify-content: center;
            width: 36px;
            height: 36px;
            border-radius: 10px;
            border: 1px solid #e2e8f0;
            background: #fff;
            color: #475569;
            font-size: 14px;
            cursor: pointer;
            flex-shrink: 0;
        }

        @media (max-width: 1024px) {

            /* --- Sidebar como panel deslizable (off-canvas), sin reservar espacio --- */
            #main-sidebar {
                position: fixed !important;
                top: 0 !important;
                left: 0 !important;
                height: 100vh !important;
                z-index: 210 !important;
                width: 280px !important;
                max-width: 82vw !important;
                transform: translateX(-100%) !important;
                transition: transform 0.25s ease-in-out !important;
                box-shadow: 10px 0 40px rgba(0,0,0,0.25);
            }
            #main-sidebar.mobile-sidebar-open {
                transform: translateX(0) !important;
            }
            /* Forzar textos/íconos visibles aunque conserve clases de "colapsado" */
            #main-sidebar .sidebar-text-container {
                opacity: 1 !important;
                width: auto !important;
                overflow: visible !important;
            }
            /* Anula la regla legacy ".nav-item span, .logo span { display:none }" que oculta las etiquetas */
            #main-sidebar span.sidebar-text-container,
            #main-sidebar i.sidebar-text-container {
                display: inline-block !important;
            }
            #main-sidebar .nav-item,
            #main-sidebar .logo,
            #main-sidebar .sidebar-item {
                justify-content: flex-start !important;
            }
            #main-sidebar #sidebar-collapser {
                display: none !important;
            }
            #sidebar-mobile-backdrop {
                display: block;
                position: fixed;
                inset: 0;
                background: rgba(15, 23, 42, 0.45);
                z-index: 205;
                opacity: 0;
                visibility: hidden;
                transition: opacity 0.2s ease, visibility 0.2s ease;
            }
            #sidebar-mobile-backdrop.show {
                opacity: 1;
                visibility: visible;
            }

            /* --- Inbox: una columna a la vez (lista → conversación → cliente/venta) --- */
            #chat-interface-container {
                position: relative;
                overflow: hidden;
            }
            #chat-list-panel,
            #conversation-panel,
            #unified-sales-panel {
                width: 100% !important;
                max-width: 100% !important;
                flex: 1 1 100% !important;
                min-width: 0 !important;
            }
            #chat-list-panel {
                border-right: none;
            }
            #conversation-panel,
            #unified-sales-panel {
                position: absolute;
                inset: 0;
                display: none !important;
            }
            #chat-interface-container.show-conversation #chat-list-panel {
                display: none !important;
            }
            #chat-interface-container.show-conversation #conversation-panel {
                display: flex !important;
                z-index: 5;
            }
            #chat-interface-container.show-sales #chat-list-panel,
            #chat-interface-container.show-sales #conversation-panel {
                display: none !important;
            }
            #chat-interface-container.show-sales #unified-sales-panel {
                display: flex !important;
                z-index: 6;
            }
            .mobile-chat-back-btn,
            .mobile-sales-toggle-btn,
            .mobile-sales-back-btn {
                display: inline-flex !important;
            }

            /* --- Órdenes: scroll horizontal en la tabla ancha + márgenes compactos --- */
            #orders-list-wrapper {
                padding: 16px !important;
            }
            #orders-list-container {
                overflow-x: auto !important;
                -webkit-overflow-scrolling: touch;
            }
            .orders-table {
                min-width: 820px;
            }
            #orders-view .view-switcher {
                margin: 16px 16px 0 16px !important;
                flex-wrap: wrap;
                row-gap: 8px;
            }
            #orders-filter-bar {
                padding: 12px 16px !important;
            }

            /* --- Ventas por Producto: pista visual de scroll horizontal --- */
            #sales-ranking-view .overflow-x-auto {
                -webkit-overflow-scrolling: touch;
            }
            #table-sales-ranking {
                min-width: 760px;
            }
        }

        @media (max-width: 640px) {
            /* --- Métricas: filtros de fecha no se desbordan --- */
            .dash-date-filter {
                width: 100%;
                flex-wrap: wrap;
                row-gap: 6px;
            }
            .dash-date-filter input[type="date"] {
                flex: 1 1 auto;
                min-width: 0;
            }

            /* --- Métricas: una tarjeta KPI por fila para que el valor no se trunque --- */
            .dash-kpi-grid {
                grid-template-columns: 1fr !important;
            }

            /* --- Métricas: encabezados de tarjetas con leyenda permiten salto de línea --- */
            .dash-card-header {
                flex-wrap: wrap;
                row-gap: 10px;
            }

            /* --- Chat: header de la conversación — con avatar+nombre a la izquierda y dos
                 botones con texto ("Revisado", "Atención IA/Humana") a la derecha, en un celular
                 angosto no cabe todo en una sola fila de 80px. Se dejan solo los íconos (el
                 texto sigue disponible como tooltip vía title=""), y los botones se angostan. */
            #conversation-panel .header-btn-label {
                display: none;
            }
            #conversation-panel #mark-reviewed-btn,
            #conversation-panel #ai-control-btn {
                padding: 8px !important;
            }

            /* --- Chat: paneles flotantes de emojis/atajos tienen ancho fijo (300-320px) que se
                 sale de la pantalla en un celular angosto (320-375px de ancho real) — se acotan
                 al viewport disponible en vez de un ancho fijo. --- */
            .emoji-panel,
            .saved-replies-panel {
                width: calc(100vw - 40px) !important;
                max-width: 320px !important;
                left: 20px !important;
                right: 20px !important;
            }
        }
