/* DIMACEA | Extraído de index.html | bloque CSS 1 */

/* ESTILOS BASE */
        body {
            font-family: 'Inter', sans-serif;
            background-color: #f1f5f9;
            color: #1e293b;
            height: 100vh;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }

        body,
        aside,
        header,
        main,
        .card,
        input,
        select,
        .core-box,
        th,
        td,
        .upload-card,
        #headerDate,
        .sidebar-section,
        .chk-item,
        h1,
        h2,
        h3,
        span,
        div,
        i,
        p,
        label,
        .badge-day,
        .qty-box,
        .projection-box,
        .euphoria-banner,
        .btn-action,
        #cloudSyncBox {
            transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
        }

        .scroller::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        .scroller::-webkit-scrollbar-thumb {
            background: #cbd5e1;
            border-radius: 4px;
        }

        /* SCROLL PARA CAJAS DE FILTROS */
        .core-box::-webkit-scrollbar {
            width: 6px;
        }

        .core-box::-webkit-scrollbar-thumb {
            background-color: #cbd5e1;
            border-radius: 3px;
        }

        .badge-core {
            display: inline-block;
            padding: 3px 8px;
            border-radius: 4px;
            font-size: 10px;
            font-weight: 800;
            text-transform: uppercase;
            width: 100%;
            text-align: center;
            margin-bottom: 3px;
            white-space: nowrap;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        }

        .bg-deos {
            background: #ffedd5;
            color: #c2410c;
            border: 1px solid #fdba74;
        }

        .bg-dish {
            background: #dcfce7;
            color: #15803d;
            border: 1px solid #86efac;
        }

        .bg-pep {
            background: #e0e7ff;
            color: #4338ca;
            border: 1px solid #a5b4fc;
        }

        .bg-sedal {
            background: #fce7f3;
            color: #be185d;
            border: 1px solid #f9a8d4;
        }

        .bg-sol {
            background: #dbeafe;
            color: #1d4ed8;
            border: 1px solid #93c5fd;
        }

        .bg-other {
            background: #f1f5f9;
            color: #64748b;
            border: 1px solid #e2e8f0;
        }

        @keyframes pulseStrong {
            0% {
                transform: scale(1);
            }

            50% {
                transform: scale(1.1);
            }

            100% {
                transform: scale(1);
            }
        }

        .live-pulse {
            animation: pulseStrong 2s infinite ease-in-out;
            display: inline-block;
        }

        .live-breathe {
            animation: breathe 3s infinite ease-in-out;
        }

        @keyframes breathe {

            0%,
            100% {
                opacity: 1;
                transform: scale(1);
            }

            50% {
                opacity: 0.8;
                transform: scale(0.95);
            }
        }

        @keyframes popIn {
            0% {
                transform: translate(-50%, -50%) scale(0);
                opacity: 0;
            }

            80% {
                transform: translate(-50%, -50%) scale(1.1);
                opacity: 1;
            }

            100% {
                transform: translate(-50%, -50%) scale(1);
            }
        }

        .euphoria-banner {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0);
            background: linear-gradient(135deg, #ec4899, #8b5cf6);
            color: white;
            padding: 20px 40px;
            border-radius: 50px;
            font-weight: 900;
            font-size: 24px;
            text-transform: uppercase;
            box-shadow: 0 0 50px rgba(139, 92, 246, 0.8);
            z-index: 9999;
            pointer-events: none;
            opacity: 0;
            text-align: center;
            border: 4px solid rgba(255, 255, 255, 0.3);
            transition: opacity 0.3s ease;
        }

        .euphoria-active {
            animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
            opacity: 1;
        }

        /* ESTILOS DE CAJAS DE FILTRO (CORE BOX) */
        .core-box {
            background-color: white;
            border: 1px solid #cbd5e1;
            border-radius: 8px;
            padding: 0;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
            max-height: 150px;
        }

        .chk-item {
            display: flex;
            align-items: center;
            padding: 8px 10px;
            border-bottom: 1px solid #f1f5f9;
            font-size: 10px;
            font-weight: 700;
            color: #475569;
            cursor: pointer;
            transition: all 0.2s;
            user-select: none;
        }

        .chk-item:hover {
            background-color: #f0f9ff;
            color: #2563eb;
            padding-left: 14px;
        }

        .chk-item:last-child {
            border-bottom: none;
        }

        .chk-item input {
            margin-right: 8px;
            cursor: pointer;
            accent-color: #2563eb;
        }

        .chk-item span {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        /* MODO OSCURO */
        body.dark {
            background-color: #020617 !important;
            color: #e2e8f0 !important;
        }

        body.dark main,
        body.dark aside,
        body.dark .sidebar-section,
        body.dark .scroller {
            background-color: #020617 !important;
            border-color: #1e293b !important;
        }

        body.dark header {
            background-image: none !important;
            background-color: #0f172a !important;
            border-bottom-color: #1e293b !important;
        }

        body.dark .card,
        body.dark .upload-card,
        body.dark #headerDate,
        body.dark .bg-white,
        body.dark .filter-card,
        body.dark .btn-action,
        body.dark #dimiBubble,
        body.dark #cloudSyncBox,
        body.dark .modal-content {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #ffffff !important;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5) !important;
        }

        body.dark input,
        body.dark select {
            background-color: #0f172a !important;
            border-color: #334155 !important;
            color: #ffffff !important;
            color-scheme: dark;
        }

        body.dark input::placeholder {
            color: #64748b !important;
        }

        /* MODO OSCURO PARA CAJAS DE FILTRO */
        body.dark .core-box {
            background-color: #0f172a !important;
            border-color: #334155 !important;
            color: #f1f5f9 !important;
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
        }

        body.dark .chk-item {
            border-bottom-color: #1e293b !important;
            color: #cbd5e1 !important;
        }

        body.dark .chk-item:hover {
            background-color: #1e293b !important;
            color: #60a5fa !important;
        }

        body.dark .chk-item input {
            accent-color: #60a5fa;
        }

        body.dark .core-box::-webkit-scrollbar-thumb {
            background: #475569;
        }

        body.dark h1,
        body.dark h2,
        body.dark h3,
        body.dark h4,
        body.dark .text-slate-700,
        body.dark .text-slate-800 {
            color: #ffffff !important;
        }

        body.dark .text-slate-600,
        body.dark .text-slate-500,
        body.dark label {
            color: #e2e8f0 !important;
        }

        body.dark .text-slate-400 {
            color: #94a3b8 !important;
        }

        body.dark img[src="logo.png"] {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 12px;
            padding: 8px;
            box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
        }

        body.dark th {
            background-color: #1e293b !important;
            color: #cbd5e1 !important;
            border-bottom-color: #334155 !important;
        }

        body.dark td {
            border-bottom-color: #334155 !important;
            color: #e2e8f0 !important;
        }

        body.dark .row-main:hover {
            background-color: #334155 !important;
        }

        body.dark .detail-panel {
            background-color: #020617 !important;
        }

        body.dark .detail-row {
            background-color: #1e293b !important;
            border-color: #334155 !important;
        }

        .qty-box {
            background-color: #f1f5f9;
            color: #475569;
            font-weight: 800;
            padding: 4px 8px;
            border-radius: 6px;
            font-size: 10px;
            text-align: center;
            border: 1px solid transparent;
        }

        body.dark .qty-box {
            background-color: #0f172a !important;
            color: #e2e8f0 !important;
            border-color: #334155 !important;
        }

        .badge-day {
            display: inline-block;
            padding: 3px 10px;
            border-radius: 20px;
            font-size: 9px;
            font-weight: 800;
            text-transform: uppercase;
            background: #f8fafc;
            color: #64748b;
            border: 1px solid #cbd5e1;
            min-width: 65px;
            text-align: center;
            letter-spacing: 0.05em;
        }

        body.dark .badge-day {
            background-color: #1e293b !important;
            color: #60a5fa !important;
            border-color: #334155 !important;
            box-shadow: 0 0 5px rgba(96, 165, 250, 0.1);
        }

        .projection-box {
            background-color: #eff6ff;
            border: 1px solid #dbeafe;
            border-radius: 8px;
            padding: 8px;
            margin-top: 10px;
        }

        body.dark .projection-box {
            background-color: #0f172a !important;
            border-color: #334155 !important;
        }

        .theme-icon {
            transition: transform 0.5s;
        }

        body.dark .theme-icon {
            transform: rotate(180deg);
            color: #facc15;
        }

        body.dark .bg-blue-100 {
            background-color: #1e3a8a !important;
            color: #bfdbfe !important;
        }

        body.dark .scroller::-webkit-scrollbar-thumb {
            background: #475569;
        }

        .date-input-wrapper:hover input {
            border-color: #3b82f6;
        }

        .date-input-wrapper input {
            cursor: pointer;
            padding-left: 36px;
            font-size: 13px;
        }

        body.dark .date-input-wrapper i {
            color: #60a5fa !important;
        }

        .card {
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
            border: 1px solid #e2e8f0;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .card-header {
            padding: 12px 16px;
            border-bottom: 1px solid #f1f5f9;
            background-color: #fff;
            flex-shrink: 0;
        }

        .card-body {
            flex: 1;
            overflow-y: auto;
            padding: 0;
            position: relative;
        }

        .card-footer-fixed {
            padding: 10px 16px;
            border-top: 1px solid #e2e8f0;
            background-color: #f8fafc;
            flex-shrink: 0;
            font-size: 11px;
            font-weight: 700;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .spinner {
            width: 40px;
            height: 40px;
            border: 4px solid #e2e8f0;
            border-top-color: #3b82f6;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }

        .upload-card {
            transition: 0.3s;
            position: relative;
            overflow: hidden;
        }

        .upload-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
            border-color: #3b82f6;
        }

        .upload-success {
            background-color: #f0fdf4 !important;
            border-color: #22c55e !important;
            border-style: solid !important;
        }

        body.dark .upload-success {
            background-color: #064e3b !important;
            border-color: #10b981 !important;
        }

        .upload-success .upload-icon-box {
            background-color: #dcfce7 !important;
            color: #15803d !important;
        }

        body.dark .upload-success .upload-icon-box {
            background-color: #065f46 !important;
            color: #34d399 !important;
            border-color: #065f46 !important;
        }

        .upload-success .status-text {
            color: #15803d !important;
            font-weight: 800;
        }

        body.dark .upload-success .status-text {
            color: #34d399 !important;
        }

        .filter-card {
            background-color: #ffffff;
            border: 1px solid #cbd5e1;
            border-radius: 12px;
            padding: 16px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        }

        .row-main {
            cursor: pointer;
            transition: background 0.15s;
        }

        .row-main:hover {
            background-color: #f8fafc;
        }

        .row-active {
            background-color: #eff6ff !important;
            border-left: 4px solid #3b82f6;
        }

        body.dark .row-active {
            background-color: #1e3a8a !important;
            border-left-color: #60a5fa !important;
        }

        .detail-panel {
            display: none;
            background-color: #f8fafc;
            border-top: 1px solid #e2e8f0;
        }

        .detail-panel.open {
            display: table-row;
        }

        .rotate-icon {
            transition: transform 0.2s;
        }

        .row-active .rotate-icon {
            transform: rotate(90deg);
        }

        #app-container {
            display: none;
        }

        /* LOGIN MODERNO ANIMADO */
        #login-screen {
            position: fixed;
            inset: 0;
            z-index: 1000;
            background: linear-gradient(-45deg, #020617, #0f172a, #1e1b4b, #172554);
            background-size: 400% 400%;
            animation: gradientBG 15s ease infinite;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        @keyframes gradientBG {
            0% {
                background-position: 0% 50%;
            }

            50% {
                background-position: 100% 50%;
            }

            100% {
                background-position: 0% 50%;
            }
        }

        .floating-shape {
            position: absolute;
            border-radius: 50%;
            filter: blur(40px);
            opacity: 0.4;
            z-index: 1;
            animation: floatShape 10s infinite alternate;
        }

        .shape-1 {
            width: 300px;
            height: 300px;
            background: #4f46e5;
            top: 10%;
            left: 10%;
            animation-delay: 0s;
        }

        .shape-2 {
            width: 200px;
            height: 200px;
            background: #db2777;
            bottom: 10%;
            right: 10%;
            animation-delay: -2s;
        }

        @keyframes floatShape {
            from {
                transform: translate(0, 0);
            }

            to {
                transform: translate(30px, 30px);
            }
        }

        .login-card {
            position: relative;
            z-index: 10;
            background: rgba(255, 255, 255, 0.05);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            padding: 3rem;
            border-radius: 2rem;
            border: 1px solid rgba(255, 255, 255, 0.1);
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
            width: 100%;
            max-width: 420px;
            text-align: center;
        }

        .login-input {
            width: 100%;
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid rgba(255, 255, 255, 0.1);
            padding: 1rem 1.25rem;
            border-radius: 1rem;
            color: white;
            margin-bottom: 1rem;
            outline: none;
            transition: 0.3s;
        }

        .login-input:focus {
            border-color: #6366f1;
            background: rgba(15, 23, 42, 0.8);
            box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
        }

        .login-btn {
            width: 100%;
            background: linear-gradient(135deg, #4f46e5, #7c3aed);
            color: white;
            padding: 1rem;
            border-radius: 1rem;
            font-weight: 800;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            transition: 0.3s;
            box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }

        .login-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 15px 25px -5px rgba(79, 70, 229, 0.5);
        }

        .error-msg {
            color: #f87171;
            font-size: 0.8rem;
            margin-top: 1rem;
            min-height: 1.2rem;
            font-weight: bold;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
        }

        #cloudSyncBox {
            background-color: #eff6ff;
            border: 2px dashed #3b82f6;
            padding: 15px;
            border-radius: 12px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 10px;
            margin-bottom: 10px;
            position: relative;
            overflow: hidden;
        }

        body.dark #cloudSyncBox {
            background-color: #1e3a8a;
            border-color: #60a5fa;
        }

        .sync-btn {
            background: #2563eb;
            color: white;
            width: 100%;
            padding: 10px;
            border-radius: 8px;
            font-weight: 800;
            font-size: 11px;
            text-transform: uppercase;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: 0.2s;
            box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
        }

        .sync-btn:hover {
            background: #1d4ed8;
            transform: translateY(-1px);
        }

        .sync-active {
            animation: pulse 1.5s infinite;
            background: #10b981;
            pointer-events: none;
        }

        /* ESTILOS DE DIMI (ASISTENTE CON CHAT & CEREBRO) */
        #dimiBubble {
            position: fixed;
            bottom: 20px;
            right: 20px;
            z-index: 50;
            background: white;
            border: 1px solid #e2e8f0;
            border-radius: 16px;
            box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
            transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
            width: 360px;
            max-width: 90vw;
            height: 480px;
            max-height: 70vh;
            overflow: hidden;
            display: none;
            flex-direction: column;
        }

        /* ESTADO HERO/INTRO: GRANDE Y CENTRADO */
        #dimiBubble.hero-mode {
            width: 90%;
            max-width: 420px;
            height: auto;
            max-height: 80vh;
            bottom: 50%;
            right: 50%;
            transform: translate(50%, 50%);
            border-radius: 24px;
            box-shadow: 0 0 0 1000px rgba(15, 23, 42, 0.6);
            border: 2px solid #8b5cf6;
            z-index: 999;
        }

        #dimiBubble.minimized {
            width: 70px;
            height: 70px;
            border-radius: 50%;
            padding: 0;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            background: white;
            border: 2px solid #a855f7;
            box-shadow: 0 4px 20px rgba(168, 85, 247, 0.4);
            animation: bounceIn 0.5s;
            transform: translate(0, 0) !important;
            bottom: 20px;
            right: 20px;
        }

        @media (max-width: 520px) {
            #dimiBubble {
                right: 10px;
                bottom: 10px;
                width: 92vw;
                max-width: 92vw;
                height: 60vh;
                max-height: 70vh;
            }

            #dimiBubble.minimized {
                right: 10px;
                bottom: 10px;
            }
        }

        @keyframes bounceIn {
            0% {
                transform: scale(0);
            }

            60% {
                transform: scale(1.1);
            }

            100% {
                transform: scale(1);
            }
        }

        /* CORRECCIÓN DE LA IMAGEN MINIMIZADA: Ocultamos completamente header y footer */
        #dimiBubble.minimized .dimi-header,
        #dimiBubble.minimized .dimi-body,
        #dimiBubble.minimized .dimi-footer {
            display: none !important;
        }

        /* Icono al estar minimizado */
        .dimi-icon-min {
            display: none;
        }

        #dimiBubble.minimized .dimi-icon-min {
            display: flex !important;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 100%;
            overflow: hidden;
            border-radius: 50%;
            padding: 0;
            margin: 0;
        }

        #dimiBubble.minimized .dimi-icon-min img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .dimi-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 16px;
            background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
            border-bottom: 1px solid #e2e8f0;
            cursor: default;
        }

        body.dark .dimi-header {
            background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
            border-color: #334155;
        }

        #dimiBubble.hero-mode .dimi-header,
        #dimiBubble.hero-mode .dimi-footer {
            display: none;
        }

        /* Ocultar cabecera y footer en modo hero */

        .dimi-body {
            flex: 1;
            padding: 12px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 8px;
            background-color: #fff;
        }

        body.dark .dimi-body {
            background-color: #0f172a;
        }

        .dimi-footer {
            padding: 10px;
            border-top: 1px solid #e2e8f0;
            display: flex;
            gap: 6px;
            background: #f8fafc;
        }

        body.dark .dimi-footer {
            background: #1e293b;
            border-color: #334155;
        }

        .chat-msg {
            max-width: 90%;
            padding: 10px 12px;
            border-radius: 12px;
            font-size: 11px;
            line-height: 1.4;
            position: relative;
            animation: slideUp 0.3s ease;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        }

        @keyframes slideUp {
            from {
                opacity: 0;
                transform: translateY(10px);
            }

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

        .chat-bot {
            background: #eff6ff;
            color: #1e293b;
            align-self: flex-start;
            border-bottom-left-radius: 2px;
            border: 1px solid #dbeafe;
        }

        body.dark .chat-bot {
            background: #1e3a8a;
            color: #e2e8f0;
            border-color: #1e40af;
        }

        .chat-user {
            background: #6366f1;
            color: white;
            align-self: flex-end;
            border-bottom-right-radius: 2px;
            box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
        }

        .typing-indicator {
            display: flex;
            gap: 4px;
            padding: 4px 8px;
            background: #f1f5f9;
            border-radius: 12px;
            width: fit-content;
            margin-bottom: 8px;
        }

        body.dark .typing-indicator {
            background: #334155;
        }

        .dot {
            width: 6px;
            height: 6px;
            background: #94a3b8;
            border-radius: 50%;
            animation: bounce 1.4s infinite ease-in-out both;
        }

        .dot:nth-child(1) {
            animation-delay: -0.32s;
        }

        .dot:nth-child(2) {
            animation-delay: -0.16s;
        }

        @keyframes bounce {

            0%,
            80%,
            100% {
                transform: scale(0);
            }

            40% {
                transform: scale(1);
            }
        }

        .suggestion-chip {
            display: inline-block;
            font-size: 10px;
            background: #f1f5f9;
            color: #64748b;
            padding: 6px 10px;
            border-radius: 20px;
            margin: 4px 2px;
            cursor: pointer;
            border: 1px solid #e2e8f0;
            transition: 0.2s;
            font-weight: 600;
            white-space: nowrap;
        }

        .suggestion-chip:hover {
            background: #e0e7ff;
            color: #4338ca;
            border-color: #c7d2fe;
            transform: translateY(-1px);
        }

        body.dark .suggestion-chip {
            background: #1e293b;
            color: #cbd5e1;
            border-color: #334155;
        }

        body.dark .suggestion-chip:hover {
            background: #334155;
            color: #a5b4fc;
        }

        .dimi-input {
            flex: 1;
            border: 1px solid #cbd5e1;
            border-radius: 20px;
            padding: 8px 12px;
            font-size: 11px;
            outline: none;
        }

        .dimi-input:focus {
            border-color: #6366f1;
        }

        .dimi-send-btn {
            background: #6366f1;
            color: white;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: 0.2s;
            cursor: pointer;
        }

        .dimi-send-btn:hover {
            background: #4f46e5;
            transform: scale(1.05);
        }

        /* ESTILOS PARA EL MODAL */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(15, 23, 42, 0.6);
            backdrop-filter: blur(4px);
            z-index: 60;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
            opacity: 0;
            transition: opacity 0.3s;
        }

        .modal-overlay.active {
            display: flex;
            opacity: 1;
        }

        .modal-content {
            background: white;
            width: 100%;
            max-width: 500px;
            max-height: 80vh;
            border-radius: 16px;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
            display: flex;
            flex-direction: column;
            transform: scale(0.9);
            transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            overflow: hidden;
        }

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

        .modal-header {
            padding: 16px;
            border-bottom: 1px solid #e2e8f0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #f8fafc;
        }

        .modal-body {
            overflow-y: auto;
            padding: 0;
        }

        .modal-footer {
            padding: 12px 16px;
            background: #f8fafc;
            border-top: 1px solid #e2e8f0;
            text-align: right;
        }

        .btn-close-modal {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: #e2e8f0;
            color: #64748b;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: 0.2s;
        }

        .btn-close-modal:hover {
            background: #cbd5e1;
            color: #ef4444;
        }


        /* =========================
   DIMI CHAT - RESPONSIVE
   ========================= */

        /* Telefonos */
        @media (max-width: 600px) {
            #chatContainer {
                width: 88vw !important;
                max-width: 88vw !important;
                height: 30vh !important;
                max-height: 30vh !important;
                bottom: 10px;
                right: 4vw;
                border-radius: 14px;
            }

            #chatHeader {
                padding: 8px 10px;
                font-size: 13px;
            }

            #chatBody {
                font-size: 13px;
                padding: 8px;
            }

            #chatInput input {
                font-size: 13px;
                padding: 8px;
            }

            #chatInput button {
                padding: 0 12px;
                font-size: 13px;
            }

            /* Header compacto en telefono */
            header {
                padding-top: 8px !important;
                padding-bottom: 8px !important;
                padding-left: 12px !important;
                padding-right: 12px !important;
            }

            #headerTitle {
                font-size: 16px !important;
                line-height: 1.1 !important;
            }

            #headerVend {
                font-size: 13px !important;
            }

            #headerButtons {
                gap: 6px !important;
            }

            #headerButtons button {
                padding: 6px !important;
            }

            #headerDate {
                font-size: 8px !important;
                padding: 4px 8px !important;
                margin-bottom: 2px !important;
            }

            #headerEfec {
                font-size: 22px !important;
            }

            /* Reduce espacio vertical del bloque derecho */
            header>div:last-child {
                gap: 6px !important;
                margin-top: 8px !important;
            }

        }


        /* --- NUEVO: Animaciones del loader por etapa --- */
        .loader-anim {
            width: min(420px, 90vw);
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 54px;
        }

        .anim-row {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .anim-badge {
            font-size: 26px;
            line-height: 1;
        }

        .anim-track {
            position: relative;
            width: min(260px, 70vw);
            height: 14px;
            border-radius: 999px;
            background: rgba(15, 23, 42, .08);
            overflow: hidden
        }

        .anim-dot {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 12px;
            height: 12px;
            border-radius: 999px;
            background: rgba(59, 130, 246, .85);
            filter: drop-shadow(0 2px 6px rgba(59, 130, 246, .35));
            animation: moveDot 1.6s linear infinite
        }

        .anim-dot.d2 {
            animation-delay: .3s;
            opacity: .8
        }

        .anim-dot.d3 {
            animation-delay: .6s;
            opacity: .6
        }

        @keyframes moveDot {
            0% {
                left: -18px
            }

            100% {
                left: calc(100% + 18px)
            }
        }

        .bars {
            display: flex;
            gap: 6px;
            align-items: flex-end;
            height: 22px
        }

        .bar {
            width: 6px;
            border-radius: 999px;
            background: rgba(16, 185, 129, .9);
            animation: barPulse 900ms ease-in-out infinite
        }

        .bar.b2 {
            animation-delay: .15s
        }

        .bar.b3 {
            animation-delay: .3s
        }

        .bar.b4 {
            animation-delay: .45s
        }

        @keyframes barPulse {

            0%,
            100% {
                height: 6px;
                opacity: .55
            }

            50% {
                height: 22px;
                opacity: 1
            }
        }

        .target-wrap {
            position: relative;
            width: min(260px, 70vw);
            height: 22px
        }

        .arrow {
            position: absolute;
            left: -18px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 18px;
            animation: arrowFly 1.4s ease-in-out infinite
        }

        @keyframes arrowFly {
            0% {
                left: -18px;
                opacity: 0
            }

            10% {
                opacity: 1
            }

            80% {
                opacity: 1
            }

            100% {
                left: calc(100% - 16px);
                opacity: 0
            }
        }

        .calendar {
            display: flex;
            align-items: center;
            gap: 10px
        }

        .wipe {
            width: min(260px, 70vw);
            height: 14px;
            border-radius: 999px;
            background: rgba(239, 68, 68, .10);
            overflow: hidden;
            position: relative
        }

        .wipe:before {
            content: "";
            position: absolute;
            inset: 0;
            transform: translateX(-100%);
            background: linear-gradient(90deg, transparent, rgba(239, 68, 68, .45), transparent);
            animation: wipe 1.35s ease-in-out infinite
        }

        @keyframes wipe {
            0% {
                transform: translateX(-100%)
            }

            100% {
                transform: translateX(100%)
            }
        }

        /* --- NUEVO: Dropdown de clientes compacto y elegante --- */
        .client-dd {
            position: absolute;
            left: 0;
            right: 0;
            top: calc(100% + 8px);
            background: rgba(255, 255, 255, .96);
            border: 1px solid rgba(15, 23, 42, .10);
            border-radius: 14px;
            box-shadow: 0 18px 40px rgba(2, 6, 23, .18);
            overflow: hidden;
            max-height: 260px;
            /* más pequeño */
            z-index: 50;
        }

        .client-dd-item {
            width: 100%;
            display: flex;
            gap: 10px;
            align-items: center;
            padding: 10px 12px;
            text-align: left;
            background: transparent;
            border: 0;
            cursor: pointer;
            transition: background .15s ease;
        }

        .client-dd-item:hover {
            background: rgba(99, 102, 241, .08);
        }

        .client-dd-code {
            font-size: 11px;
            font-weight: 900;
            letter-spacing: .04em;
            color: rgba(30, 41, 59, .95);
            background: rgba(99, 102, 241, .10);
            padding: 4px 8px;
            border-radius: 999px;
            flex: 0 0 auto;
        }

        .client-dd-name {
            font-size: 12px;
            font-weight: 700;
            color: rgba(30, 41, 59, .90);
            line-height: 1.2;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .client-dd-empty {
            padding: 12px;
            font-size: 12px;
            font-weight: 700;
            color: rgba(100, 116, 139, .9);
        }

        /* scroll bonito */
        .client-dd {
            scrollbar-width: thin;
            scrollbar-color: rgba(99, 102, 241, .55) transparent;
        }

        .client-dd::-webkit-scrollbar {
            width: 8px;
        }

        .client-dd::-webkit-scrollbar-thumb {
            background: rgba(99, 102, 241, .55);
            border-radius: 999px;
        }

        .client-dd::-webkit-scrollbar-track {
            background: transparent;
        }

        @media (max-width: 640px) {
            .client-dd {
                max-height: 220px;
                border-radius: 16px;
            }

            .client-dd-item {
                padding: 10px 12px;
            }

            .client-dd-name {
                font-size: 12px;
            }
        }

        /* --- NUEVO: Chip cliente seleccionado + botón X --- */
        .client-clear {
            position: absolute;
            right: 10px;
            top: 50%;
            transform: translateY(-50%);
            width: 34px;
            height: 34px;
            border-radius: 12px;
            border: 1px solid rgba(15, 23, 42, .10);
            background: rgba(255, 255, 255, .92);
            color: rgba(51, 65, 85, .9);
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 10px 18px rgba(2, 6, 23, .08);
            transition: transform .12s ease, background .12s ease;
            z-index: 55;
        }

        .client-clear:hover {
            background: rgba(99, 102, 241, .10);
            transform: translateY(-50%) scale(1.03);
        }

        .client-chip {
            margin-top: 10px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 10px 12px;
            border-radius: 14px;
            background: rgba(99, 102, 241, .08);
            border: 1px solid rgba(99, 102, 241, .20);
        }

        .client-chip-text {
            font-size: 12px;
            font-weight: 800;
            color: rgba(30, 41, 59, .95);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .client-chip-x {
            width: 34px;
            height: 34px;
            border-radius: 12px;
            border: 0;
            background: rgba(239, 68, 68, .12);
            color: rgba(185, 28, 28, .95);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform .12s ease, background .12s ease;
            flex: 0 0 auto;
        }

        .client-chip-x:hover {
            background: rgba(239, 68, 68, .18);
            transform: scale(1.03);
        }

        /* --- NUEVO: Transición suave entre modo claro/oscuro --- */
        body.theme-transition,
        body.theme-transition * {
            transition:
                background-color 260ms ease,
                color 260ms ease,
                border-color 260ms ease,
                box-shadow 260ms ease,
                fill 260ms ease,
                stroke 260ms ease,
                opacity 260ms ease !important;
        }

        /* Evitar "lag" por transiciones en transform/layout */
        body.theme-transition * {
            transition-property: background-color, color, border-color, box-shadow, fill, stroke, opacity !important;
        }

        @media (prefers-reduced-motion: reduce) {

            body.theme-transition,
            body.theme-transition * {
                transition: none !important;
            }
        }

        /* --- NUEVO: Saludo (modal) prolijo - alineación estable de números --- */
        .welcome-kpi-card {
            display: flex;
            flex-direction: column;
            justify-content: center;
            min-height: 72px;
        }

        .welcome-kpi-card p:first-child {
            margin-bottom: 6px;
        }

        .welcome-kpi-val,
        .welcome-kpi-val-xl {
            white-space: nowrap;
            line-height: 1.05;
            font-variant-numeric: tabular-nums;
            letter-spacing: .01em;
        }

        .welcome-kpi-dual {
            align-items: stretch !important;
        }

        .welcome-kpi-dual>div {
            display: flex;
            flex-direction: column;
            justify-content: center;
            min-height: 78px;
        }

        .welcome-kpi-dual>div p:first-child {
            margin-bottom: 6px;
        }

        /* Ajuste móvil: evita saltos por tamaños/line-height */
        @media (max-width: 480px) {
            .welcome-kpi-card {
                min-height: 68px;
            }

            .welcome-kpi-dual>div {
                min-height: 74px;
            }

            .welcome-kpi-val {
                font-size: 16px !important;
            }

            .welcome-kpi-val-xl {
                font-size: 18px !important;
            }
        }


        /* ===== DIMI HERO KPI responsive fixes (phones) ===== */
        .welcome-kpi-val,
        .welcome-kpi-val-xl {
            overflow-wrap: anywhere;
            word-break: break-word;
            line-height: 1.15;
        }

        @media (max-width: 480px) {
            .welcome-kpi-grid {
                gap: 0.75rem;
            }

            .welcome-kpi-card {
                padding: 0.75rem !important;
            }

            .welcome-kpi-dual {
                padding-left: 1rem !important;
                padding-right: 1rem !important;
            }

            .welcome-kpi-val {
                font-size: 1.05rem !important;
            }

            .welcome-kpi-val-xl {
                font-size: 1.2rem !important;
            }
        }

        @media (max-width: 360px) {
            .welcome-kpi-val {
                font-size: 0.98rem !important;
            }

            .welcome-kpi-val-xl {
                font-size: 1.1rem !important;
            }
        }

        /* Sticky slim footer (always visible) */
        :root {
            --stickyFooterH: 32px;
        }

        #stickyFooter {
            position: fixed;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 80;
            background: rgba(255, 255, 255, 0.92);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border-top: 1px solid rgba(148, 163, 184, 0.35);
            padding: 2px 8px;
            font-size: 10px;
            line-height: 1.05;
        }

        #stickyFooter .sf-wrap {
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 1px;
            text-align: center;
        }

        #stickyFooter .sf-line1 {
            font-weight: 800;
            letter-spacing: .08em;
            color: #64748b;
            text-transform: uppercase;
        }

        #stickyFooter .sf-line2 {
            color: #94a3b8;
        }

        #stickyFooter .sf-name {
            font-weight: 900;
            color: #475569;
            text-transform: uppercase;
        }

        /* Reserve space so content isn't covered */
        #mainContent {
            padding-bottom: var(--stickyFooterH);
        }

        @media (max-width: 768px) {
            #mainContent {
                padding-bottom: calc(var(--stickyFooterH) + 6px);
            }

            #stickyFooter .sf-wrap {
                gap: 8px;
            }
        }



        /* === FIX SCROLL MÓVIL: permitir desplazamiento normal de toda la página === */
        @media (max-width: 768px) {

            html,
            body {
                height: auto !important;
                min-height: 100dvh;
                overflow-y: auto !important;
                overflow-x: hidden !important;
                -webkit-overflow-scrolling: touch;
            }

            body {
                display: block !important;
            }

            #app,
            #mainContent {
                height: auto !important;
                min-height: 0 !important;
                overflow: visible !important;
            }

            #mainContent>.flex-1.overflow-y-auto,
            #mainContent .scroller {
                overflow-y: visible !important;
                max-height: none !important;
                height: auto !important;
            }

            #mainContent header {
                position: static !important;
                top: auto !important;
            }

            /* Permitir que listas largas se vean completas en móvil */
            #noBuyCard,
            #buyCard,
            #weeklyCard {
                height: auto !important;
                min-height: 0 !important;
                overflow: visible !important;
            }

            #noBuyCard .card-body,
            #buyCard .card-body,
            #weeklyCard .card-body {
                overflow: visible !important;
                max-height: none !important;
                height: auto !important;
                -webkit-overflow-scrolling: touch;
            }

            #noBuyCard .card-header,
            #buyCard .card-header,
            #weeklyCard .card-header,
            #noBuyCard thead,
            #buyCard thead {
                position: static !important;
            }

            #noBuyCard .nobuy-mobile-fit,
            #buyCard .buyers-mobile-fit,
            #weeklyCard #weeklyHitsList {
                overflow: visible !important;
                max-height: none !important;
            }
        }

        /* === FIX: Dimi Bienvenida sin scroll en móvil === */
        @media (max-width: 520px) {

            /* Hero ocupa toda la pantalla (sin centrar con translate) */
            #dimiBubble.hero-mode {
                top: 6px !important;
                left: 6px !important;
                right: 6px !important;
                bottom: 6px !important;
                width: auto !important;
                height: auto !important;
                max-width: none !important;
                max-height: none !important;
                transform: none !important;
                border-radius: 16px !important;
                z-index: 9999 !important;
            }

            /* Quitar el input del chat durante la bienvenida (libera espacio) */
            #dimiBubble.hero-mode .dimi-footer {
                display: none !important;
            }

            /* El cuerpo NO debe scrollear; ajustamos espaciados para que todo entre */
            #dimiBubble.hero-mode .dimi-body {
                overflow: hidden !important;
                padding: 8px !important;
                gap: 6px !important;
                display: flex !important;
                align-items: stretch !important;
            }

            /* Compactar márgenes Tailwind usados en el template de bienvenida */
            #dimiBubble.hero-mode .dimi-body .mb-6 {
                margin-bottom: 12px !important;
            }

            #dimiBubble.hero-mode .dimi-body .mb-4 {
                margin-bottom: 10px !important;
            }

            #dimiBubble.hero-mode .dimi-body .mb-2 {
                margin-bottom: 8px !important;
            }

            /* Compactar tarjetas KPI */
            #dimiBubble.hero-mode .welcome-kpi-card {
                padding: 10px !important;
            }

            #dimiBubble.hero-mode .welcome-kpi-dual {
                padding: 10px !important;
                gap: 10px !important;
            }

            #dimiBubble.hero-mode .welcome-kpi-val {
                font-size: 18px !important;
                line-height: 1.15 !important;
            }

            #dimiBubble.hero-mode .welcome-kpi-val-xl {
                font-size: 20px !important;
                line-height: 1.15 !important;
            }

            /* Botón siempre visible y compacto */
            #dimiBubble.hero-mode .dimi-body button {
                padding-top: 10px !important;
                padding-bottom: 10px !important;
                font-size: 13px !important;
            }

            #dimiBubble.hero-mode .dimi-body>div {
                padding: 8px !important;
                justify-content: flex-start !important;
            }

            #dimiBubble.hero-mode img.w-28.h-28 {
                width: 72px !important;
                height: 72px !important;
            }

            #dimiBubble.hero-mode h2 {
                font-size: 1.15rem !important;
                line-height: 1.15 !important;
            }

            #dimiBubble.hero-mode .text-xs.font-bold.text-slate-500.mb-6 {
                margin-bottom: 10px !important;
                font-size: 11px !important;
            }

            #dimiBubble.hero-mode .w-full.bg-slate-100.rounded-full.h-3 {
                height: 10px !important;
                margin-bottom: 6px !important;
            }
        }


        /* === Client visual blocks (No Buy / Buy) === */
        .client-block {
            display: flex;
            flex-direction: column;
            gap: 2px;
            min-width: 0;
        }

        .client-line {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
        }

        .client-code {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 2px 8px;
            border-radius: 999px;
            font-size: 10px;
            font-weight: 900;
            letter-spacing: .08em;
            text-transform: uppercase;
            border: 1px solid rgba(148, 163, 184, .6);
            background: rgba(241, 245, 249, .8);
            color: #334155;
        }

        .client-name {
            font-size: 12px;
            font-weight: 900;
            color: #0f172a;
            line-height: 1.1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .client-sub {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            align-items: center;
            color: #64748b;
            font-size: 10px;
            font-weight: 700;
        }


        /* === Mobile fix: tablas Clientes con/Sin compra sin corte horizontal === */
        @media (max-width: 768px) {
            .client-line {
                flex-wrap: wrap;
                gap: 4px;
                align-items: flex-start;
            }

            .client-name {
                white-space: normal;
                overflow: visible;
                text-overflow: clip;
                word-break: break-word;
                flex: 1 1 140px;
            }

            .col-coveredbadge {
                margin-left: 0 !important;
                max-width: 100%;
                white-space: normal;
                word-break: break-word;
            }

            #tableBodyNoBuy td,
            #tableBodyBuy td {
                vertical-align: top;
            }

            #tableBodyNoBuy .badge-day,
            #tableBodyNoBuy .col-priority span,
            #tableBodyBuy .badge-core {
                white-space: normal;
            }

            #tableBodyNoBuy .client-block,
            #tableBodyBuy .client-block {
                width: 100%;
                min-width: 0;
            }

            /* Tablas ocupan el ancho de pantalla y reparten mejor columnas */
            #tableBodyNoBuy,
            #tableBodyBuy {
                width: 100%;
            }

            #tableBodyNoBuy tr>td:nth-child(1) {
                width: 28px;
                padding-left: 4px;
                padding-right: 4px;
            }


            /* Evita duplicar badges CORE en móvil dentro de Clientes con compra */
            @media (max-width: 767px) {
                #tableBodyBuy tr>td:nth-child(2) {
                    display: none !important;
                }

                #tableBodyBuy .client-sub .badge-core {
                    display: inline-flex;
                }
            }

            #tableBodyNoBuy tr>td:nth-child(2) {
                width: 84px;
                padding-left: 4px;
                padding-right: 4px;
            }

            #tableBodyNoBuy tr>td:nth-child(4) {
                width: 54px;
                padding-left: 4px;
                padding-right: 4px;
            }

            #tableBodyBuy tr>td:nth-child(3) {
                width: 82px;
                padding-left: 4px;
                padding-right: 8px;
            }

            /* Contenedores de las dos tablas sin scroll lateral en móvil */
            #tableBodyNoBuy.closest-table,
            #tableBodyBuy.closest-table {
                overflow-x: visible;
            }

            .buyers-mobile-fit,
            .nobuy-mobile-fit {
                overflow-x: visible !important;
                width: 100%;
            }

            .buyers-mobile-fit table,
            .nobuy-mobile-fit table {
                width: 100% !important;
                table-layout: fixed;
            }

            .buyers-mobile-fit th,
            .buyers-mobile-fit td,
            .nobuy-mobile-fit th,
            .nobuy-mobile-fit td {
                padding-top: 8px;
                padding-bottom: 8px;
            }

            .buyers-mobile-fit th:nth-child(1) {
                width: auto;
            }

            .buyers-mobile-fit th:nth-child(3) {
                width: 86px;
            }

            .nobuy-mobile-fit th:nth-child(1) {
                width: 30px;
            }

            .nobuy-mobile-fit th:nth-child(2) {
                width: 88px;
            }

            .nobuy-mobile-fit th:nth-child(3) {
                width: auto;
            }

            .nobuy-mobile-fit th:nth-child(4) {
                width: 58px;
            }
        }

        /* === Mobile cards para listas de clientes === */
        @media (max-width: 640px) {

            .buyers-mobile-fit,
            .nobuy-mobile-fit {
                overflow-x: visible !important;
            }

            .buyers-mobile-fit thead,
            .nobuy-mobile-fit thead {
                display: none;
            }

            .buyers-mobile-fit table,
            .nobuy-mobile-fit table,
            .buyers-mobile-fit tbody,
            .nobuy-mobile-fit tbody,
            .buyers-mobile-fit tr,
            .nobuy-mobile-fit tr,
            .buyers-mobile-fit td,
            .nobuy-mobile-fit td {
                display: block;
                width: 100% !important;
            }

            .buyers-mobile-fit tr,
            .nobuy-mobile-fit tr {
                border: 1px solid #e2e8f0;
                border-radius: 14px;
                margin: 8px 8px 10px;
                background: #fff;
                box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
            }

            .buyers-mobile-fit td,
            .nobuy-mobile-fit td {
                border: 0 !important;
                padding: 8px 10px !important;
            }

            .buyers-mobile-fit td+td,
            .nobuy-mobile-fit td+td {
                padding-top: 0 !important;
            }

            .buyers-mobile-fit td:last-child,
            .nobuy-mobile-fit td:last-child {
                text-align: left !important;
            }

            .mobile-hide {
                display: none !important;
            }

            .mobile-meta-wrap {
                display: flex;
                flex-wrap: wrap;
                gap: 6px;
                margin-top: 6px;
            }

            .mobile-meta-chip {
                display: inline-flex;
                align-items: center;
                gap: 4px;
                padding: 4px 8px;
                border-radius: 999px;
                font-size: 10px;
                font-weight: 800;
                line-height: 1.2;
                background: #f8fafc;
                border: 1px solid #e2e8f0;
                color: #475569;
                max-width: 100%;
                word-break: break-word;
            }

            .mobile-day-right {
                margin-left: auto;
                flex: 0 0 auto;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                padding: 4px 8px;
                border-radius: 999px;
                font-size: 10px;
                font-weight: 900;
                line-height: 1;
                color: #0f172a;
                background: #f8fafc;
                border: 1px solid #cbd5e1;
                white-space: nowrap;
            }

            .mobile-amount-chip {
                background: #ecfdf5;
                border-color: #a7f3d0;
                color: #065f46;
            }

            .mobile-week-card {
                border: 1px solid #e2e8f0;
                border-radius: 14px;
                padding: 10px;
                margin: 8px 10px;
                background: #fff;
            }

            .mobile-week-grid {
                display: grid;
                grid-template-columns: 1fr;
                gap: 6px;
                margin-top: 8px;
            }

            .mobile-week-item {
                border: 1px solid #e2e8f0;
                border-radius: 10px;
                padding: 8px;
                background: #f8fafc;
            }
        }


        /* === MOBILE: scroll interno en cajas clave === */
        @media (max-width: 640px) {
            .section-scroll-card {
                overflow: hidden !important;
                border-radius: 1rem;
            }

            .section-scroll-card.section-scroll-card-red {
                height: 420px !important;
                min-height: 420px !important;
                max-height: 420px !important;
            }

            .section-scroll-card.section-scroll-card-green {
                height: 380px !important;
                min-height: 380px !important;
                max-height: 380px !important;
            }

            .section-scroll-card.section-scroll-card-violet {
                height: 400px !important;
                min-height: 400px !important;
                max-height: 400px !important;
            }

            .section-scroll-card .card-body.section-scroll-body {
                flex: 1 1 auto !important;
                min-height: 0 !important;
                max-height: 100% !important;
                overflow-y: auto !important;
                overflow-x: hidden !important;
                overscroll-behavior: contain;
                -webkit-overflow-scrolling: touch;
            }

            .section-scroll-card .card-header,
            .section-scroll-card .card-footer-fixed {
                flex-shrink: 0 !important;
            }

            .section-scroll-card .buyers-mobile-fit,
            .section-scroll-card .nobuy-mobile-fit,
            .section-scroll-card #weeklyHitsList {
                width: 100% !important;
                overflow-x: hidden !important;
            }

            .section-scroll-card .buyers-mobile-fit table,
            .section-scroll-card .nobuy-mobile-fit table {
                width: 100% !important;
                table-layout: fixed;
            }

            .section-scroll-card #weeklyHitsList {
                padding-bottom: 0.75rem;
            }
        }


        /* === MOBILE: cajas compactas con scroll interno (máx. ~6 clientes visibles) === */
        @media (max-width: 768px) {

            #noBuyCard,
            #buyCard,
            #weeklyCard {
                overflow: hidden !important;
                min-height: 0 !important;
            }

            /* En móvil estas cajas deben mantenerse compactas */
            #noBuyCard {
                height: min(58vh, 430px) !important;
                max-height: min(58vh, 430px) !important;
            }

            #buyCard {
                height: min(46vh, 340px) !important;
                max-height: min(46vh, 340px) !important;
            }

            #weeklyCard {
                height: min(52vh, 380px) !important;
                max-height: min(52vh, 380px) !important;
            }

            #noBuyCard .card-body,
            #buyCard .card-body,
            #weeklyCard .card-body,
            #noBuyCard .card-body.section-scroll-body,
            #buyCard .card-body.section-scroll-body,
            #weeklyCard .card-body.section-scroll-body {
                flex: 1 1 auto !important;
                min-height: 0 !important;
                height: auto !important;
                max-height: 100% !important;
                overflow-y: auto !important;
                overflow-x: hidden !important;
                overscroll-behavior: contain;
                -webkit-overflow-scrolling: touch;
            }

            #noBuyCard .card-header,
            #buyCard .card-header,
            #weeklyCard .card-header,
            #noBuyCard .card-footer-fixed,
            #buyCard .card-footer-fixed,
            #weeklyCard .card-footer-fixed,
            #weeklyHitInfo,
            #noBuyInsightBox {
                flex-shrink: 0 !important;
            }

            #noBuyCard .nobuy-mobile-fit,
            #buyCard .buyers-mobile-fit,
            #weeklyCard #weeklyHitsList {
                width: 100% !important;
                overflow-x: hidden !important;
            }

            #noBuyCard .nobuy-mobile-fit table,
            #buyCard .buyers-mobile-fit table {
                width: 100% !important;
                table-layout: fixed !important;
            }

            /* Mantener encabezados visibles mientras se hace scroll interno */
            #noBuyCard thead,
            #buyCard thead {
                position: sticky !important;
                top: 0 !important;
                z-index: 10 !important;
            }
        }


        /* === CONTROL DE ENTREGAS + HERO DIMI MOBILE === */
        #deliveryControlCard .delivery-line {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 10px;
        }

        #deliveryControlCard .delivery-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-top: 6px;
        }

        #deliveryControlCard .delivery-chip {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 4px 8px;
            border-radius: 999px;
            border: 1px solid #e2e8f0;
            background: #fff;
            color: #475569;
            font-size: 10px;
            font-weight: 800;
            line-height: 1;
            max-width: 100%;
        }

        #deliveryControlCard .delivery-card-row {
            border-bottom: 1px solid #f1f5f9;
            padding: 12px 14px;
        }

        #deliveryControlCard .delivery-products {
            margin-top: 8px;
            font-size: 11px;
            line-height: 1.45;
            color: #64748b;
        }

        #deliveryControlCard .delivery-products strong {
            color: #334155;
        }

        #weeklyCard,
        #deliveryControlCard {
            min-height: 470px;
        }

        #weeklyCard .card-body,
        #deliveryControlCard .card-body {
            min-height: 0;
            overflow-y: auto;
            overflow-x: hidden;
        }

        @media (min-width: 768px) {

            #weeklyCard,
            #deliveryControlCard {
                min-height: 500px;
                max-height: 500px;
            }
        }

        @media (max-width: 768px) {

            #deliveryControlCard,
            #weeklyCard {
                overflow: hidden !important;
            }

            #deliveryControlCard {
                height: min(58vh, 460px) !important;
                max-height: min(58vh, 460px) !important;
            }

            #weeklyCard {
                height: min(58vh, 460px) !important;
                max-height: min(58vh, 460px) !important;
            }

            #deliveryControlCard .card-body,
            #weeklyCard .card-body,
            #deliveryControlCard .delivery-scroll-body,
            #weeklyCard .weekly-scroll-body {
                flex: 1 1 auto !important;
                min-height: 0 !important;
                max-height: 100% !important;
                overflow-y: auto !important;
                overflow-x: hidden !important;
                -webkit-overflow-scrolling: touch !important;
                overscroll-behavior: contain;
                touch-action: pan-y;
            }

            #deliveryControlCard #deliveryControlList,
            #weeklyCard #weeklyHitsList {
                min-height: 100%;
            }

            #deliveryControlCard .delivery-card-row {
                padding: 12px 12px;
            }

            #deliveryControlCard .delivery-line {
                flex-direction: column;
                align-items: stretch;
            }

            #deliveryControlCard .delivery-amount {
                text-align: left !important;
                white-space: normal;
            }

            #dimiBubble.hero-mode {
                inset: 10px !important;
                width: auto !important;
                max-width: none !important;
                max-height: calc(100dvh - 20px) !important;
            }

            #dimiBubble.hero-mode .dimi-body {
                padding: 14px 14px 84px !important;
            }

            #dimiBubble.hero-mode .dimi-body>div {
                gap: 12px !important;
            }

            #dimiBubble.hero-mode h2 {
                font-size: 1.15rem !important;
                line-height: 1.25 !important;
            }

            #dimiBubble.hero-mode img.w-28.h-28 {
                width: 4.5rem !important;
                height: 4.5rem !important;
            }
        }


        @media (max-width: 768px) {

            .backdrop-blur-md,
            .backdrop-blur,
            .backdrop-blur-sm {
                backdrop-filter: none !important;
                -webkit-backdrop-filter: none !important;
            }

            .shadow-xl,
            .shadow-lg {
                box-shadow: 0 6px 18px rgba(15, 23, 42, .12) !important;
            }
        }
