:root {
    /* Azules (principales) */
    --primary-light: #1057A4;
    --primary-dark: #0C417B;
    --secondary-light: #4079B6;

    /* Errores / advertencias */
    --error-light: #F04A0C;
    --error-dark: #B43809;

    /* Éxito / confirmaciones */
    --success-light: #1fa43e;
    --success-dark: #1e7e34;

    /* Escala de grises / base UI */
    --background-light: #f8fafc;
    /* Ligeramente gris para que las tarjetas resalten */
    --border-light: #e2e8f0;
    --text-dark: #1e293b;
    --text-muted: #64748b;

    /* Tarjetas */
    --card-bg: #ffffff;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --card-radius: 12px;
}

#tomapedidos-dashboard {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-dark);
    background-color: var(--background-light);
    padding: 24px;
    box-sizing: border-box;
    width: 100%;
    display: block;
}

/* 
 * RESET CRÍTICO: 
 * Tu framework tiene un "div#content *" que hace margin-left: auto y margin-right: auto.
 * Esto destruye los anchos de Flexbox y CSS Grid.
 * Usamos una alta especificidad (dos IDs) para sobreescribir esa regla global y forzar que 
 * los márgenes vuelvan a 0 (nuestro layout se basa en "gap", no en márgenes).
 */
div#content #tomapedidos-dashboard * {
    margin-left: 0;
    margin-right: 0;
}

#tomapedidos-dashboard * {
    box-sizing: border-box;
}

/* Fix para custom elements en Light DOM */
#tomapedidos-dashboard dashboard-app,
#tomapedidos-dashboard kpi-card {
    display: block;
    width: 100%;
    min-width: 0;
}

#tomapedidos-dashboard bar-chart-card,
#tomapedidos-dashboard evidence-usage-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-width: 0;
}

/* Layout Principal */
#tomapedidos-dashboard .dashboard-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    width: 100%;
    min-width: 0;
}

#tomapedidos-dashboard .sidebar-column {
    flex: 0 0 280px;
    /* Ancho fijo para la primera columna */
    max-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

#tomapedidos-dashboard .main-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

/* Filas en la columna principal */
#tomapedidos-dashboard .dashboard-row {
    display: grid;
    gap: 20px;
    width: 100%;
    min-width: 0;
}

#tomapedidos-dashboard .kpi-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-width: 0;
    width: 100%;
}

#tomapedidos-dashboard .chart-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
    width: 100%;
}

/* Tarjeta Base */
#tomapedidos-dashboard .card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 16px;
    /* Reducido de 20px */
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* ========================================================= */
/* SISTEMA RESPONSIVO COMPLETO: PORTÁTILES, TABLETS Y MÓVILES */
/* ========================================================= */

/* --- 1. Portátiles grandes y medianos (1201px - 1440px) --- */
@media (max-width: 1440px) {
    #tomapedidos-dashboard .sidebar-column {
        flex: 0 0 240px;
        max-width: 240px;
    }

    #tomapedidos-dashboard .card {
        padding: 14px;
    }

    #tomapedidos-dashboard .dashboard-layout,
    #tomapedidos-dashboard .dashboard-row,
    #tomapedidos-dashboard .chart-row {
        gap: 14px;
    }

    #tomapedidos-dashboard .kpi-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
    }

    #tomapedidos-dashboard .kpi-card {
        padding: 12px 10px;
        min-height: 195px;
    }

    #tomapedidos-dashboard .kpi-header {
        gap: 5px;
    }

    #tomapedidos-dashboard .kpi-left {
        gap: 8px;
    }

    #tomapedidos-dashboard .kpi-icon-wrapper {
        width: 36px;
        height: 36px;
        border-radius: 9px;
    }

    #tomapedidos-dashboard .kpi-icon-wrapper i {
        width: 18px;
        height: 18px;
    }

    #tomapedidos-dashboard .kpi-title {
        font-size: 0.64rem;
        letter-spacing: 0.2px;
    }

    #tomapedidos-dashboard .kpi-value {
        font-size: 1.08rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #tomapedidos-dashboard .kpi-badge {
        padding: 2px 5px;
        font-size: 0.65rem;
        gap: 2px;
    }

    #tomapedidos-dashboard .kpi-arrow-icon {
        width: 10px;
        height: 10px;
    }

    #tomapedidos-dashboard .kpi-period {
        font-size: 0.62rem;
    }

    #tomapedidos-dashboard .kpi-bars {
        margin-top: 8px;
        gap: 4px;
    }

    #tomapedidos-dashboard .kpi-bar-row {
        gap: 5px;
    }

    #tomapedidos-dashboard .kpi-bar-label {
        width: 25px;
        font-size: 0.65rem;
    }

    #tomapedidos-dashboard .kpi-bar-value {
        width: 44px;
        font-size: 0.65rem;
    }

    #tomapedidos-dashboard .kpi-callout {
        padding: 6px 8px;
        font-size: 0.68rem;
        margin: 8px 0 6px 0;
        gap: 6px;
        border-radius: 8px;
    }

    #tomapedidos-dashboard .kpi-callout-icon {
        width: 14px;
        height: 14px;
    }

    #tomapedidos-dashboard .kpi-callout-icon i {
        width: 14px;
        height: 14px;
    }

    #tomapedidos-dashboard .kpi-footer {
        font-size: 0.65rem;
        padding-top: 4px;
    }

    #tomapedidos-dashboard .kpi-footer-icon {
        width: 12px;
        height: 12px;
    }
}

/* --- 2. Portátiles estándar y compactos (1025px - 1200px) --- */
@media (max-width: 1200px) {
    #tomapedidos-dashboard .sidebar-column {
        flex: 0 0 220px;
        max-width: 220px;
    }

    /* En portátiles compactos, 2 columnas de KPIs para que respiren holgadamente */
    #tomapedidos-dashboard .kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    #tomapedidos-dashboard .kpi-card {
        padding: 14px;
        min-height: 200px;
    }

    #tomapedidos-dashboard .kpi-value {
        font-size: 1.25rem;
    }

    #tomapedidos-dashboard .kpi-icon-wrapper {
        width: 40px;
        height: 40px;
    }
}

/* --- 3. Tablets en horizontal y laptops pequeñas (993px - 1100px) --- */
@media (max-width: 1100px) {

    /* Las gráficas pasan a 1 columna para aprovechar todo el ancho disponible */
    #tomapedidos-dashboard .chart-row {
        grid-template-columns: 1fr;
    }
}

/* --- 4. Tablets estándar y pantallas medianas (769px - 992px) --- */
@media (max-width: 992px) {
    #tomapedidos-dashboard {
        padding: 16px;
    }

    #tomapedidos-dashboard .dashboard-layout {
        flex-direction: column;
        gap: 20px;
    }

    /* El sidebar se coloca arriba de manera horizontal y compacta (Banner a la izq, Menú a la der) */
    #tomapedidos-dashboard .sidebar-column {
        flex: none;
        max-width: 100%;
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    #tomapedidos-dashboard .promo-banner {
        height: 100%;
        min-height: 220px;
        aspect-ratio: auto;
        padding: 0 16px 28px 16px;
        aspect-ratio: auto;
        padding: 0 16px 28px 16px;
    }

    #tomapedidos-dashboard .quick-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2px;
        padding: 6px;
    }

    #tomapedidos-dashboard .menu-item {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    #tomapedidos-dashboard .main-column {
        width: 100%;
    }

    #tomapedidos-dashboard .kpi-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    #tomapedidos-dashboard .chart-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* --- 5. Tablets en vertical y móviles grandes (481px - 768px) --- */
@media (max-width: 768px) {
    #tomapedidos-dashboard {
        padding: 12px;
    }

    #tomapedidos-dashboard .sidebar-column {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    /* El menú de accesos rápidos se distribuye en una cuadrícula táctil de 2 columnas */
    #tomapedidos-dashboard .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 8px;
    }

    #tomapedidos-dashboard .menu-item {
        padding: 10px 12px;
        font-size: 0.82rem;
        gap: 8px;
        border-radius: 8px;
        border-left: none;
        border: 1px solid var(--border-light);
    }

    #tomapedidos-dashboard .menu-item.active {
        border-color: var(--primary-light);
    }

    #tomapedidos-dashboard .kpi-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    #tomapedidos-dashboard .kpi-card {
        padding: 12px 14px;
        min-height: 74px;
        gap: 8px;
    }

    #tomapedidos-dashboard .kpi-icon-wrapper {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    #tomapedidos-dashboard .kpi-icon-wrapper i {
        width: 20px;
        height: 20px;
    }

    #tomapedidos-dashboard .kpi-value {
        font-size: 1.15rem;
    }

    #tomapedidos-dashboard .chart-row {
        grid-template-columns: 1fr;
    }

    #tomapedidos-dashboard .chart-card-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    #tomapedidos-dashboard .chart-title {
        font-size: 0.95rem;
    }

    #tomapedidos-dashboard .chart-select {
        font-size: 0.8rem;
        padding: 4px 24px 4px 8px;
    }

    #tomapedidos-dashboard .chart-container {
        height: 240px;
    }

    #tomapedidos-dashboard #vendedoresHoyChart {
        height: 280px;
    }
}

/* --- 6. Teléfonos móviles compactos (<= 480px) --- */
@media (max-width: 480px) {
    #tomapedidos-dashboard {
        padding: 8px 4px;
    }

    #tomapedidos-dashboard .dashboard-row {
        gap: 12px;
    }

    /* KPIs en 1 sola columna para máxima legibilidad en teléfonos */
    #tomapedidos-dashboard .kpi-row {
        grid-template-columns: 1fr;
    }

    #tomapedidos-dashboard .kpi-card {
        padding: 14px;
    }

    #tomapedidos-dashboard .quick-actions {
        grid-template-columns: 1fr;
    }

    #tomapedidos-dashboard .evidence-stats-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #tomapedidos-dashboard .evidence-meta {
        flex-direction: column;
        gap: 8px;
    }

    #tomapedidos-dashboard .evidence-modal-content {
        padding: 16px;
        width: 95%;
    }
}

/* Sidebar: Banner & Slider con Vista Previa 800x800 */
#tomapedidos-dashboard .promo-banner-wrapper {
    position: relative;
    width: 100%;
}

#tomapedidos-dashboard .promo-banner {
    /* Solo se ve mientras carga la imagen (o si falla) */
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    border-radius: 12px;
    padding: 0 20px 24px 20px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    box-sizing: border-box;
    aspect-ratio: 1 / 1;
    cursor: zoom-in;
    transition: box-shadow 0.3s ease;
}

/* Imagen del banner (viene del CRM): cubre todo el recuadro, tanto en la tarjeta como en la vista previa */
#tomapedidos-dashboard .promo-banner-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#tomapedidos-dashboard .promo-banner:hover {
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.22);
}

/* Marcador de posición mientras llegan los banners del CRM: mismo tamaño que el banner, sin interacción */
#tomapedidos-dashboard .promo-banner.promo-banner-placeholder {
    cursor: default;
    box-shadow: none;
    opacity: 0.35;
}

/* El botón de acción está fuera del trigger de zoom para ser cliqueado libremente */
#tomapedidos-dashboard .promo-btn {
    background: white;
    color: var(--primary-dark);
    border: none;
    padding: 10px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, transform 0.2s;
    position: relative;
    z-index: 10;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

#tomapedidos-dashboard .promo-btn:hover {
    background: #f1f5f9;
    transform: scale(1.04);
}

/* Banner sin destino configurado en el CRM: el botón se ve igual pero no invita al clic */
#tomapedidos-dashboard a.promo-btn:not([href]) {
    cursor: default;
}

#tomapedidos-dashboard .slider-dots {
    position: absolute;
    bottom: 8px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 25; /* Alta prioridad para interactividad ininterrumpida */
    pointer-events: auto;
}

#tomapedidos-dashboard .slider-dots .dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.45);
    transition: background 0.3s, width 0.3s;
}

#tomapedidos-dashboard .slider-dots .dot.active {
    background: rgba(255, 255, 255, 1);
    width: 24px;
    border-radius: 4px;
}

/* Botones de navegación situados en el perímetro exterior */
#tomapedidos-dashboard .slider-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ffffff !important;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.25s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 25; /* Máxima prioridad para no ser bloqueados */
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
}

#tomapedidos-dashboard .slider-nav-btn:hover {
    background: rgba(255, 255, 255, 0.55);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

#tomapedidos-dashboard .slider-nav-btn.prev {
    left: 8px;
}

#tomapedidos-dashboard .slider-nav-btn.next {
    right: 8px;
}

#tomapedidos-dashboard .promo-banner:hover .slider-nav-btn {
    opacity: 1;
}

#tomapedidos-dashboard .slider-nav-btn i,
#tomapedidos-dashboard .slider-nav-btn svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
    fill: none !important;
    width: 18px !important;
    height: 18px !important;
    font-size: 16px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: none !important;
}

/* ========================================================= */
/* VISTA PREVIA CUADRADA DEL BANNER (ZOOM PROPORCIONAL)      */
/* ========================================================= */
#tomapedidos-dashboard .banner-zoom-preview {
    position: absolute;
    top: 0;
    left: calc(100% + 16px);
    width: 528px;
    height: 528px;
    max-width: calc(100vw - 340px);
    max-height: calc(100vh - 60px);
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    box-shadow: 0 24px 50px -10px rgba(0, 0, 0, 0.48), 0 0 0 1.5px rgba(255, 255, 255, 0.25);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95) translateX(-8px);
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 0 38px 38px 38px;
    box-sizing: border-box;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    overflow: hidden;
}

#tomapedidos-dashboard .banner-zoom-preview.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateX(0);
}

#tomapedidos-dashboard .banner-zoom-preview .promo-btn {
    padding: 14px 28px;
    font-size: 1.1rem;
    border-radius: 25px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    margin-bottom: 0;
}

/* Sidebar: Quick Actions */
#tomapedidos-dashboard .quick-actions {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    box-shadow: var(--card-shadow);
}

#tomapedidos-dashboard .menu-item {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.2s;
}

#tomapedidos-dashboard .menu-item:hover {
    background: var(--background-light);
}

#tomapedidos-dashboard .menu-item.active {
    color: var(--primary-light);
    border: 1px solid var(--primary-light);
    border-radius: 8px;
    margin: 4px 12px;
    padding: 10px 16px;
}

#tomapedidos-dashboard .menu-item i {
    color: var(--primary-light);
    width: 20px;
}

/* Componente: KPI Card (Diseño Mejorado con Barras, Callout y Progreso) */
#tomapedidos-dashboard .kpi-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 14px 14px;
    border-radius: var(--card-radius);
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    min-height: 205px;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

#tomapedidos-dashboard .kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -2px rgba(0, 0, 0, 0.08);
}

/* 1. Cabecera */
#tomapedidos-dashboard .kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

#tomapedidos-dashboard .kpi-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

#tomapedidos-dashboard .kpi-icon-wrapper {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

#tomapedidos-dashboard .kpi-icon-wrapper i {
    width: 20px;
    height: 20px;
}

#tomapedidos-dashboard .kpi-icon-wrapper.blue {
    background-color: var(--primary-light);
}

#tomapedidos-dashboard .kpi-icon-wrapper.green {
    background-color: var(--success-light);
}

#tomapedidos-dashboard .kpi-icon-wrapper.orange {
    background-color: #f59e0b;
}

#tomapedidos-dashboard .kpi-icon-wrapper.red {
    background-color: var(--error-light);
}

#tomapedidos-dashboard .kpi-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

#tomapedidos-dashboard .kpi-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 2px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#tomapedidos-dashboard .kpi-value {
    font-size: 1.20rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#tomapedidos-dashboard .kpi-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    flex-shrink: 0;
}

#tomapedidos-dashboard .kpi-period {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

#tomapedidos-dashboard .kpi-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.72rem;
    white-space: nowrap;
}

#tomapedidos-dashboard .kpi-badge.positive {
    background-color: #dcfce7;
    color: var(--success-dark);
}

#tomapedidos-dashboard .kpi-badge.negative {
    background-color: #fee2e2;
    color: var(--error-dark);
}

#tomapedidos-dashboard .kpi-arrow-icon {
    width: 12px;
    height: 12px;
}

/* 2. Barras comparativas */
#tomapedidos-dashboard .kpi-bars {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 14px;
    width: 100%;
}

#tomapedidos-dashboard .kpi-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

#tomapedidos-dashboard .kpi-bar-label {
    width: 30px;
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
}

#tomapedidos-dashboard .kpi-bar-track {
    flex: 1;
    height: 8px;
    background-color: #f1f5f9;
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

#tomapedidos-dashboard .kpi-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#tomapedidos-dashboard .kpi-bar-value {
    width: 56px;
    flex-shrink: 0;
    text-align: right;
    font-size: 0.72rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
}

#tomapedidos-dashboard .kpi-bar-fill.blue-solid { background-color: #1057A4; }
#tomapedidos-dashboard .kpi-bar-fill.blue-pastel { background-color: #93c5fd; }
#tomapedidos-dashboard .kpi-bar-fill.green-solid { background-color: #16a34a; }
#tomapedidos-dashboard .kpi-bar-fill.green-pastel { background-color: #86efac; }
#tomapedidos-dashboard .kpi-bar-fill.orange-solid { background-color: #f59e0b; }
#tomapedidos-dashboard .kpi-bar-fill.orange-pastel { background-color: #fed7aa; }
#tomapedidos-dashboard .kpi-bar-fill.red-solid { background-color: #22c55e; }
#tomapedidos-dashboard .kpi-bar-fill.red-solid.has-debt { background-color: #ef4444; }
#tomapedidos-dashboard .kpi-bar-fill.red-pastel { background-color: #fca5a5; }

/* 3. Callout / Mensaje Contextual */
#tomapedidos-dashboard .kpi-callout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.73rem;
    font-weight: 500;
    line-height: 1.35;
    margin: 10px 0 8px 0;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#tomapedidos-dashboard .kpi-callout.callout-blue {
    background-color: #f0f7ff;
    border: 1px solid #dbeafe;
    color: #1e40af;
}
#tomapedidos-dashboard .kpi-callout.callout-blue .kpi-callout-icon {
    color: #2563eb;
}

#tomapedidos-dashboard .kpi-callout.callout-green {
    background-color: #f0fdf4;
    border: 1px solid #dcfce7;
    color: #166534;
}
#tomapedidos-dashboard .kpi-callout.callout-green .kpi-callout-icon {
    color: #16a34a;
}

#tomapedidos-dashboard .kpi-callout.callout-amber {
    background-color: #fffbeb;
    border: 1px solid #fef3c7;
    color: #92400e;
}
#tomapedidos-dashboard .kpi-callout.callout-amber .kpi-callout-icon {
    color: #d97706;
}

#tomapedidos-dashboard .kpi-callout.callout-red {
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    color: #991b1b;
}
#tomapedidos-dashboard .kpi-callout.callout-red .kpi-callout-icon {
    color: #dc2626;
}

#tomapedidos-dashboard .kpi-callout-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}
#tomapedidos-dashboard .kpi-callout-icon i {
    width: 16px;
    height: 16px;
}

#tomapedidos-dashboard .kpi-callout-text {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

/* 4. Pie de la tarjeta */
#tomapedidos-dashboard .kpi-footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-top: 6px;
    margin-top: auto;
    font-size: 0.70rem;
    color: #64748b;
    font-weight: 500;
    width: 100%;
    min-width: 0;
    border-top: 1px solid #f8fafc;
}

#tomapedidos-dashboard .kpi-footer-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#tomapedidos-dashboard .kpi-footer-icon {
    width: 13px;
    height: 13px;
    color: #64748b;
}

#tomapedidos-dashboard .chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
    flex-wrap: wrap;
}

#tomapedidos-dashboard .chart-header-left {
    min-width: 0;
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

#tomapedidos-dashboard .chart-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

/* Fila de subtítulo comparativo que se ubica debajo de la cabecera (título + botones + select) */
#tomapedidos-dashboard .chart-subtitle-row {
    width: 100%;
    margin-top: -2px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

#tomapedidos-dashboard .chart-subtitle-row .chart-subtitle,
#tomapedidos-dashboard .chart-subtitle {
    font-size: 0.73rem;
    color: #64748b;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

/* Chips individuales de modo (Más vendidos / Menos vendidos) en la misma fila con el select */
#tomapedidos-dashboard .chart-mode-switch {
    display: inline-flex;
    align-items: center;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 2px !important;
}

#tomapedidos-dashboard .mode-switch-btn {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted, #64748b);
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
}

#tomapedidos-dashboard .mode-switch-btn:hover {
    background: #f8fafc;
    color: var(--text-dark, #0f172a);
    border-color: #94a3b8;
}

#tomapedidos-dashboard .mode-switch-btn.active {
    background: var(--primary-light, #1057A4);
    border-color: var(--primary-light, #1057A4);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(16, 87, 164, 0.25);
}

@media (max-width: 1440px) {
    #tomapedidos-dashboard .chart-title {
        font-size: 0.92rem;
    }

    #tomapedidos-dashboard .mode-switch-btn {
        font-size: 0.70rem;
        padding: 4px 7px;
        height: 28px;
    }

    #tomapedidos-dashboard .chart-select {
        font-size: 0.75rem;
        height: 28px;
        padding: 3px 22px 3px 8px;
    }

    #tomapedidos-dashboard .chart-icon-wrapper {
        padding: 6px;
    }

    #tomapedidos-dashboard .chart-icon-wrapper i {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 1280px) {
    #tomapedidos-dashboard .chart-card-header {
        gap: 8px;
        margin-bottom: 6px;
    }

    #tomapedidos-dashboard .chart-title {
        font-size: 0.88rem;
    }

    #tomapedidos-dashboard .chart-header-left {
        gap: 8px;
    }

    #tomapedidos-dashboard .mode-switch-btn {
        font-size: 0.68rem;
        padding: 3px 6px;
        height: 26px;
    }

    #tomapedidos-dashboard .chart-select {
        font-size: 0.72rem;
        height: 26px;
        padding: 2px 20px 2px 6px;
        background-position: right 6px top 50%;
    }

    #tomapedidos-dashboard .chart-subtitle-row {
        margin-bottom: 8px;
    }

    #tomapedidos-dashboard .chart-subtitle-row .chart-subtitle {
        font-size: 0.71rem;
    }
}

#tomapedidos-dashboard .chart-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#tomapedidos-dashboard .chart-search-icon {
    position: absolute;
    left: 8px;
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

#tomapedidos-dashboard .chart-search-input {
    padding: 5px 24px 5px 28px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--text-dark);
    background-color: white;
    width: 145px;
    transition: width 0.2s ease, border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

#tomapedidos-dashboard .chart-search-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(16, 87, 164, 0.15);
    width: 175px;
}

#tomapedidos-dashboard .chart-search-clear {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

#tomapedidos-dashboard .chart-search-clear:hover {
    color: var(--text-dark);
    background-color: #f1f5f9;
}

#tomapedidos-dashboard .chart-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark, #0f172a);
    white-space: nowrap;
}

#tomapedidos-dashboard .chart-select {
    padding: 3px 24px 3px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-dark, #0f172a);
    background-color: white;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 8px top 50%;
    background-size: 8px auto;
    height: 28px;
    line-height: 1;
}

#tomapedidos-dashboard .chart-container {
    width: 100%;
    height: 325px;
    display: block;
}

#tomapedidos-dashboard #card-vendedores-hoy {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#tomapedidos-dashboard #card-vendedores-hoy .card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#tomapedidos-dashboard #vendedoresHoyChart {
    width: 100%;
    flex: 1;
    min-height: 350px;
    height: 100%;
}

/* Cabeceras de Gráficos y Tarjetas con Icono */
#tomapedidos-dashboard .chart-header-left,
#tomapedidos-dashboard .evidence-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

#tomapedidos-dashboard .chart-icon-wrapper,
#tomapedidos-dashboard .evidence-icon-wrapper {
    background-color: var(--primary-dark);
    color: white;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#tomapedidos-dashboard .chart-icon-wrapper i,
#tomapedidos-dashboard .evidence-icon-wrapper i {
    width: 20px;
    height: 20px;
}

#tomapedidos-dashboard .evidence-stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

#tomapedidos-dashboard .evidence-stat-box {
    background-color: var(--background-light);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 16px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#tomapedidos-dashboard .evidence-stat-box.primary {
    background-color: #f0f7ff;
    border-color: #cce3ff;
}

#tomapedidos-dashboard .evidence-stat-box.primary .stat-value {
    color: var(--primary-light);
}

#tomapedidos-dashboard .stat-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#tomapedidos-dashboard .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#tomapedidos-dashboard .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
}

#tomapedidos-dashboard .stat-unit {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}

#tomapedidos-dashboard .stat-icon-bg {
    position: absolute;
    right: -10px;
    bottom: -10px;
    opacity: 0.05;
    z-index: 1;
}

#tomapedidos-dashboard .stat-icon-bg i {
    width: 72px;
    height: 72px;
}

#tomapedidos-dashboard .evidence-stat-box.primary .stat-icon-bg {
    opacity: 0.1;
    color: var(--primary-light);
}

#tomapedidos-dashboard .evidence-info-row {
    display: flex;
    gap: 12px;
}

#tomapedidos-dashboard .info-pill {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background-color: var(--background-light);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-dark);
}

#tomapedidos-dashboard .info-pill .pill-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

#tomapedidos-dashboard .info-pill.highlight {
    background-color: #fdf5e6;
    color: #b45309;
}

#tomapedidos-dashboard .info-pill.highlight .pill-icon {
    color: #d97706;
}

/* Sección de Progreso y Aviso de Rango en Evidencias */
#tomapedidos-dashboard .evidence-progress-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 2px;
    margin-bottom: 6px;
}

#tomapedidos-dashboard .progress-callout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 1px 2px rgba(16, 87, 164, 0.04);
}

#tomapedidos-dashboard .progress-callout-content {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

#tomapedidos-dashboard .progress-callout-icon {
    width: 18px;
    height: 18px;
    color: var(--primary-light);
    flex-shrink: 0;
}

#tomapedidos-dashboard .progress-callout-text {
    font-size: 0.85rem;
    color: var(--primary-dark);
    font-weight: 500;
    line-height: 1.35;
}

#tomapedidos-dashboard .progress-callout-text strong {
    color: var(--primary-light);
    font-weight: 700;
}

#tomapedidos-dashboard .progress-percentage-pill {
    background: #ffffff;
    color: var(--primary-light);
    border: 1px solid #bfdbfe;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 12px;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#tomapedidos-dashboard .progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

#tomapedidos-dashboard .progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-light), var(--primary-light));
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#tomapedidos-dashboard .evidence-footer {
    margin-top: auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Botón con ancho al 50%, borde visible con contraste permanente, borde animado en movimiento continuo y reflejo de luz al hover */
#tomapedidos-dashboard .btn-ranges {
    width: 50%;
    min-width: 170px;
    max-width: 280px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px; /* Grosor del canal de borde animado */
    background-color: #dbeafe; /* Pista base que mantiene visible el contorno siempre */
    border: 1.5px solid var(--primary-light); /* Borde nítido para contraste total con el fondo */
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(16, 87, 164, 0.12);
    transition: transform 0.2s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

#tomapedidos-dashboard .btn-ranges:hover {
    transform: translateY(-1px);
    border-color: var(--primary-dark);
    box-shadow: 0 6px 20px rgba(12, 65, 123, 0.32);
}

#tomapedidos-dashboard .btn-ranges:active {
    transform: translateY(0);
}

/* Borde animado que gira continuamente alrededor del perímetro del botón */
#tomapedidos-dashboard .btn-ranges::before {
    content: '';
    position: absolute;
    top: -150%;
    left: -150%;
    width: 400%;
    height: 400%;
    background: conic-gradient(
        from 0deg,
        rgba(16, 87, 164, 0.12) 0deg,
        rgba(16, 87, 164, 0.12) 65deg,
        var(--secondary-light) 90deg,
        #38bdf8 110deg,
        #60a5fa 130deg,
        rgba(16, 87, 164, 0.12) 150deg,
        rgba(16, 87, 164, 0.12) 360deg
    );
    animation: spinBorderBeam 3.5s linear infinite;
    z-index: 1;
}

/* Superficie interior del botón */
#tomapedidos-dashboard .btn-ranges .btn-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 7px;
    background-color: #ffffff;
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.85rem;
    position: relative;
    z-index: 2;
    overflow: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Reflejo de luz que se expande de adentro hacia afuera al hover */
#tomapedidos-dashboard .btn-ranges .btn-content::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(147, 197, 253, 0.4) 40%, transparent 70%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 3;
    opacity: 0;
}

/* Hover: fondo --primary-dark, texto blanco y animación de reflejo de luz hacia afuera */
#tomapedidos-dashboard .btn-ranges:hover .btn-content {
    background-color: var(--primary-dark);
    color: #ffffff;
}

#tomapedidos-dashboard .btn-ranges:hover .btn-content::after {
    animation: lightReflectOutward 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes spinBorderBeam {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes lightReflectOutward {
    0% {
        width: 0;
        height: 0;
        opacity: 0.95;
    }
    40% {
        opacity: 0.7;
    }
    100% {
        width: 380px;
        height: 380px;
        opacity: 0;
    }
}

#tomapedidos-dashboard .btn-secondary-action {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    background-color: transparent;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

#tomapedidos-dashboard .btn-secondary-action:hover {
    background-color: var(--background-light);
    border-color: var(--primary-light);
    color: var(--primary-light);
}

/* Quick Actions Sidebar Menu */
#tomapedidos-dashboard .quick-actions {
    background-color: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--card-radius);
    padding: 12px 0;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
}

#tomapedidos-dashboard .quick-actions .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    outline: none;
}

#tomapedidos-dashboard .quick-actions .menu-item i {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

/* Hover State */
#tomapedidos-dashboard .quick-actions .menu-item:hover,
#tomapedidos-dashboard .quick-actions .menu-item:focus {
    background-color: #f8fafc;
    color: var(--primary-light);
    border-left-color: var(--primary-light);
}

#tomapedidos-dashboard .quick-actions .menu-item:hover i,
#tomapedidos-dashboard .quick-actions .menu-item:focus i {
    color: var(--primary-light);
}

/* Active State */
#tomapedidos-dashboard .quick-actions .menu-item.active {
    background-color: #eff6ff;
    color: var(--primary-light);
    border-left-color: var(--primary-light);
    font-weight: 600;
}

#tomapedidos-dashboard .quick-actions .menu-item.active i {
    color: var(--primary-light);
}

/* Pressed State */
#tomapedidos-dashboard .quick-actions .menu-item:active {
    background-color: #e2e8f0;
}

/* ========================================================= */
/* ESTILOS DE COMPONENTES: MODAL Y TABLA DE RANGOS          */
/* ========================================================= */

/* Card de evidencias */
#tomapedidos-dashboard .card-evidence {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 14px;
    position: relative;
}

#tomapedidos-dashboard .card-evidence .chart-card-header {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

#tomapedidos-dashboard .evidence-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

#tomapedidos-dashboard .card-evidence .stat-value.cost-value {
    font-size: 1.5rem;
}

#tomapedidos-dashboard .kpi-arrow-icon {
    width: 12px;
    height: 12px;
}

#tomapedidos-dashboard .promo-btn i {
    width: 16px;
    height: 16px;
}

#tomapedidos-dashboard .dashboard-loading {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

/* Estados de carga (esqueletos): la página se dibuja de inmediato y cada tarjeta se llena cuando llega su dato */
@keyframes tp-shimmer {
    0% {
        background-position: 200% 0;
    }

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

#tomapedidos-dashboard .kpi-card.is-loading .kpi-value,
#tomapedidos-dashboard .kpi-card.is-loading .kpi-badge,
#tomapedidos-dashboard .kpi-card.is-loading .kpi-bar-value,
#tomapedidos-dashboard .kpi-card.is-loading .kpi-callout-text,
#tomapedidos-dashboard .kpi-card.is-loading .kpi-footer-left span,
#tomapedidos-dashboard .skeleton-block {
    color: transparent;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: tp-shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
    user-select: none;
}

#tomapedidos-dashboard .kpi-card.is-loading .kpi-value {
    min-width: 96px;
}

#tomapedidos-dashboard .skeleton-block {
    flex: 1;
    min-height: 120px;
    margin-top: 12px;
    border-radius: 10px;
}

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

    #tomapedidos-dashboard .kpi-card.is-loading .kpi-value,
    #tomapedidos-dashboard .kpi-card.is-loading .kpi-badge,
    #tomapedidos-dashboard .kpi-card.is-loading .kpi-bar-value,
    #tomapedidos-dashboard .kpi-card.is-loading .kpi-callout-text,
    #tomapedidos-dashboard .kpi-card.is-loading .kpi-footer-left span,
    #tomapedidos-dashboard .skeleton-block {
        animation: none;
    }
}

/* Contenedor central que agrupa header, info-box y video promocional */
#tomapedidos-dashboard .chart-card-body,
#tomapedidos-dashboard .chart-card-boy {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    width: 100%;
    flex: 1;
}

/* Estado sin permiso: título + mensaje de cuota gratuita + video
   (photoEvidenceVideoUrl, project.js) en vez de estadísticas. */
#tomapedidos-dashboard .evidence-promo-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
    padding: 2px 0 0 0;
}

#tomapedidos-dashboard .evidence-promo-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
}

#tomapedidos-dashboard .evidence-promo-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Caja informativa (Estado B y avisos de rango) */
#tomapedidos-dashboard .info-box {
    background: #eff6ff;
    color: #1e40af;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    gap: 8px;
    align-items: center;
    border: 1px solid #bfdbfe;
    line-height: 1.35;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

#tomapedidos-dashboard .info-box svg,
#tomapedidos-dashboard .info-box i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #2563eb;
}

/* Variante de .info-box para el mensaje de cuota/rango superado:
   mismo layout, tono ámbar en vez de azul para transmitir que requiere acción. */
#tomapedidos-dashboard .info-box.warning {
    background-color: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

#tomapedidos-dashboard .info-box.warning svg,
#tomapedidos-dashboard .info-box.warning i {
    color: #d97706;
}

#tomapedidos-dashboard .evidence-promo-video {
    width: 100%;
    max-width: 400px;
    height: 220px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    background-color: #0f172a;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

#tomapedidos-dashboard .evidence-promo-video iframe {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

#tomapedidos-dashboard .evidence-footer {
    margin-top: auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Estado de error al cargar la evidencia fotográfica */
#tomapedidos-dashboard .evidence-error-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 8px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

#tomapedidos-dashboard .evidence-error-state i {
    width: 20px;
    height: 20px;
    color: #dc2626;
    flex-shrink: 0;
}

/* Modal de Evidencias */
#tomapedidos-dashboard .evidence-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

#tomapedidos-dashboard .evidence-modal-content {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px 28px;
    max-width: 540px;
    width: 92%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-height: 85vh;
    overflow-y: auto;
    font-family: 'Montserrat', sans-serif;
}

#tomapedidos-dashboard .evidence-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 12px;
}

#tomapedidos-dashboard .evidence-modal-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

#tomapedidos-dashboard .evidence-modal-close {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

#tomapedidos-dashboard .evidence-modal-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

#tomapedidos-dashboard .evidence-modal-desc {
    margin: 0 0 16px;
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

#tomapedidos-dashboard .evidence-modal-notice {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: 6px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 20px;
}

#tomapedidos-dashboard .evidence-modal-notice svg {
    flex-shrink: 0;
    color: #2563eb;
}

#tomapedidos-dashboard .evidence-modal-notice .notice-text {
    font-size: 13px;
    color: #1e40af;
    font-weight: 500;
}

#tomapedidos-dashboard .evidence-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

#tomapedidos-dashboard .btn-modal-close {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 22px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
}

#tomapedidos-dashboard .btn-modal-close:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

/* Tabla de Rangos */
#tomapedidos-dashboard .range-table-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

#tomapedidos-dashboard .range-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

#tomapedidos-dashboard .range-table thead tr {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#tomapedidos-dashboard .range-table th {
    padding: 12px 16px;
}

#tomapedidos-dashboard .range-table th.text-center,
#tomapedidos-dashboard .range-table td.text-center {
    text-align: center;
}

#tomapedidos-dashboard .range-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
}

#tomapedidos-dashboard .range-table tbody tr:last-child {
    border-bottom: none;
}

.range-table tbody tr.row-actual,
#tomapedidos-dashboard .range-table tbody tr.row-actual {
    background: #eff6ff;
}

.range-table tbody tr.row-actual td,
#tomapedidos-dashboard .range-table tbody tr.row-actual td {
    background: #eff6ff;
    border-top: 2px solid #2563eb !important;
    border-bottom: 2px solid #2563eb !important;
}

.range-table tbody tr.row-actual td:first-child,
#tomapedidos-dashboard .range-table tbody tr.row-actual td:first-child {
    border-left: 2px solid #2563eb !important;
}

.range-table tbody tr.row-actual td:last-child,
#tomapedidos-dashboard .range-table tbody tr.row-actual td:last-child {
    border-right: 2px solid #2563eb !important;
}

#tomapedidos-dashboard .range-table td {
    padding: 14px 16px;
    color: #475569;
}

#tomapedidos-dashboard .range-table td.col-tier {
    font-weight: 600;
    color: #334155;
}

#tomapedidos-dashboard .range-table tbody tr.row-actual td.col-tier {
    font-weight: 700;
    color: #1e40af;
}

#tomapedidos-dashboard .range-table tbody tr.row-actual td.col-limit {
    font-weight: 600;
    color: #1e40af;
}

#tomapedidos-dashboard .range-table td.col-cost {
    font-weight: 600;
    color: #1e293b;
}

#tomapedidos-dashboard .range-table tbody tr.row-actual td.col-cost {
    font-weight: 700;
    color: #1e40af;
}

#tomapedidos-dashboard .tier-cell-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

#tomapedidos-dashboard .tier-icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 13px;
}

#tomapedidos-dashboard .tier-icon-box.level-1 {
    background: #dcfce7;
    color: #16a34a;
}

#tomapedidos-dashboard .tier-icon-box.level-2 {
    background: #dbeafe;
    color: #2563eb;
}

#tomapedidos-dashboard .tier-icon-box.level-3,
#tomapedidos-dashboard .tier-icon-box.level-4 {
    background: #f8fafc;
    color: #64748b;
}

#tomapedidos-dashboard .status-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    display: inline-block;
}

#tomapedidos-dashboard .status-tag.superado {
    background: #f1f5f9;
    color: #64748b;
}

#tomapedidos-dashboard .status-tag.actual {
    background: #2563eb;
    color: #ffffff;
    padding: 4px 10px;
    letter-spacing: 0.5px;
}

#tomapedidos-dashboard .status-tag.siguiente {
    background: #fef3c7;
    color: #b45309;
}

#tomapedidos-dashboard .status-tag.disponible {
    background: #f8fafc;
    color: #94a3b8;
}

/* =========================================================================
   SISTEMA DE ALERTAS / MODAL MODERNO (TIPO SHOWCASE)
   Inspirado en el referente visual con ícono flotante, destellos y `:root`
   ========================================================================= */

@keyframes alertModalPop {
    0% {
        opacity: 0;
        transform: scale(0.94) translateY(12px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes sparkleFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg) scale(1);
    }
    50% {
        transform: translateY(-4px) rotate(12deg) scale(1.15);
    }
}

.system-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.system-alert-modal {
    position: relative;
    max-width: 580px;
    width: 100%;
    background: #ffffff;
    border-radius: var(--card-radius, 16px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: alertModalPop 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Montserrat', sans-serif;
    color: var(--text-dark, #0f172a);
}

.system-alert-modal * {
    box-sizing: border-box;
}

/* Barra de pestañas en caso de múltiples alertas activas */
.system-alert-nav,
.system-alert-mock-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    padding: 8px 16px;
    gap: 8px;
}

.system-alert-nav .nav-label,
.system-alert-mock-nav .nav-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #64748b);
}

.system-alert-mock-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.system-alert-mock-tab {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.system-alert-mock-tab:hover {
    background: #f1f5f9;
    color: var(--text-dark, #0f172a);
    border-color: #cbd5e1;
}

.system-alert-mock-tab.active {
    background: var(--primary-light, #1057A4);
    color: #ffffff;
    border-color: var(--primary-light, #1057A4);
    box-shadow: 0 2px 4px rgba(16, 87, 164, 0.25);
}

/* Botón cerrar X */
.system-alert-close-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.system-alert-close-btn:hover {
    background: #f1f5f9;
    color: var(--text-dark, #0f172a);
}

.system-alert-close-btn svg {
    width: 18px;
    height: 18px;
}

/* Cabecera del modal: ícono flotante, destellos y títulos */
.system-alert-header {
    position: relative;
    padding: 28px 32px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.system-alert-icon-container {
    position: relative;
    margin-bottom: 16px;
}

.system-alert-icon-wrapper {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
}

.system-alert-icon-wrapper svg {
    width: 36px;
    height: 36px;
    stroke-width: 2;
}

/* Variantes cromáticas según tipo de alerta */
.system-alert-modal[data-variant="warning"] .system-alert-icon-wrapper {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
    box-shadow: 0 10px 25px -5px rgba(217, 119, 6, 0.28);
}

.system-alert-modal[data-variant="danger"] .system-alert-icon-wrapper {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: var(--error-light, #dc2626);
    box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.28);
}

.system-alert-modal[data-variant="primary"] .system-alert-icon-wrapper {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: var(--primary-light, #1057A4);
    box-shadow: 0 10px 25px -5px rgba(16, 87, 164, 0.28);
}

/* Distintivo / Mini Badge en esquina */
.system-alert-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
}

.system-alert-badge svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
}

.system-alert-modal[data-variant="warning"] .system-alert-badge svg {
    color: #d97706;
}

.system-alert-modal[data-variant="danger"] .system-alert-badge svg {
    color: var(--error-light, #dc2626);
}

.system-alert-modal[data-variant="primary"] .system-alert-badge svg {
    color: var(--primary-light, #1057A4);
}

/* Animación continua de la manecilla minutero del reloj */
@keyframes lucideClockSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.system-alert-icon-container svg.animated-alert-clock .clock-hand-minute,
.system-alert-icon-container svg.animated-alert-clock .clock-hands {
    transform-box: view-box;
    transform-origin: 12px 12px;
    animation: lucideClockSpin 4s linear infinite;
}

/* Destellos decorativos (Sparkles) */
.system-alert-sparkle {
    position: absolute;
    color: #60a5fa;
    opacity: 0.85;
    animation: sparkleFloat 3s ease-in-out infinite;
    pointer-events: none;
}

.system-alert-sparkle.sparkle-1 {
    top: -6px;
    left: -14px;
    width: 20px;
    height: 20px;
}

.system-alert-sparkle.sparkle-2 {
    top: 8px;
    right: -16px;
    width: 24px;
    height: 24px;
    animation-delay: 1.5s;
}

/* Títulos */
.system-alert-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-dark, #0f172a);
    margin: 0 0 6px 0;
    letter-spacing: -0.2px;
}

.system-alert-subtitle {
    font-size: 0.92rem;
    color: var(--text-muted, #64748b);
    margin: 0 0 16px 0;
    font-weight: 500;
    line-height: 1.4;
}

/* Píldora de aviso destacado (.info-box) */
.system-alert-info-box {
    border-radius: 10px;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 0.88rem;
    line-height: 1.4;
    text-align: left;
    max-width: 100%;
}

.system-alert-info-box svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 2;
}

.system-alert-modal[data-variant="warning"] .system-alert-info-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.system-alert-modal[data-variant="danger"] .system-alert-info-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.system-alert-modal[data-variant="primary"] .system-alert-info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: var(--primary-dark, #0C417B);
}

/* Cuerpo con HTML enriquecido */
.system-alert-body {
    padding: 0 32px 20px;
    color: #334155;
    font-size: 0.92rem;
    line-height: 1.6;
    text-align: center;
}

.system-alert-body p {
    margin: 0 0 10px;
}

.system-alert-body .alert-subtext {
    font-size: 0.82rem;
    color: var(--text-muted, #64748b);
    font-style: italic;
    margin-top: 8px;
}

/* Resumen de aumento de tarifas */
.system-alert-body .price-update-summary {
    background: #f8fafc;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 10px;
    padding: 14px 18px;
    margin: 16px 0 6px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.system-alert-body .price-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
}

.system-alert-body .price-label {
    color: var(--text-muted, #64748b);
    font-weight: 500;
}

.system-alert-body .price-value {
    color: var(--text-dark, #1e293b);
    font-weight: 600;
}

.system-alert-body .price-item.total {
    border-top: 1px dashed #cbd5e1;
    padding-top: 8px;
    margin-top: 4px;
    font-size: 0.95rem;
    font-weight: 700;
}

.system-alert-body .price-value.highlight {
    color: var(--primary-light, #1057A4);
}

/* Footer con acciones */
.system-alert-footer {
    padding: 16px 32px 24px;
    background: #fafafa;
    border-top: 1px solid var(--border-light, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.system-alert-footer button,
.system-alert-footer a {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-sizing: border-box;
}

.system-alert-footer button svg,
.system-alert-footer a svg {
    width: 16px;
    height: 16px;
}

.btn-alert-dismiss {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.btn-alert-dismiss:hover {
    background: #f1f5f9;
    color: var(--text-dark, #0f172a);
    border-color: #94a3b8;
}

.btn-alert-primary {
    background: var(--primary-light, #1057A4);
    border: 1px solid var(--primary-light, #1057A4);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(16, 87, 164, 0.2);
}

.btn-alert-primary:hover {
    background: var(--primary-dark, #0C417B);
    border-color: var(--primary-dark, #0C417B);
    box-shadow: 0 6px 14px rgba(16, 87, 164, 0.3);
}

.btn-alert-whatsapp {
    background: #25d366;
    border: 1px solid #25d366;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.25);
}

.btn-alert-whatsapp:hover {
    background: #1eb857;
    border-color: #1eb857;
    box-shadow: 0 6px 14px rgba(37, 211, 102, 0.35);
}

.alert-whatsapp-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block;
    flex-shrink: 0;
}

/* Botón flotante / disparador de Preview en la cabecera del Dashboard */
.alerts-preview-badge-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: var(--primary-light, #1057A4);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.alerts-preview-badge-btn:hover {
    background: #f8fafc;
    border-color: var(--primary-light, #1057A4);
    box-shadow: 0 4px 8px rgba(16, 87, 164, 0.12);
}

.alerts-preview-badge-btn svg {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   WIDGET DE TUTORIALES Y VIDEOS DE YOUTUBE (@Tomapedidosapp)
   ========================================================================== */
#tomapedidos-dashboard .youtube-widget-card,
.youtube-widget-card {
    position: relative !important;
    margin-top: 16px;
    background: #ffffff;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: var(--card-radius, 12px);
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    font-family: inherit;
    box-sizing: border-box;
    width: 100%;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.youtube-widget-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.youtube-widget-card * {
    box-sizing: border-box;
}

/* Cabecera del Widget */
.yt-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 6px;
}

.yt-widget-title-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
}

.yt-icon-svg {
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(255, 0, 0, 0.3));
}

.yt-widget-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-dark, #0f172a);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 0;
}

.yt-shuffle-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.yt-shuffle-btn:hover {
    background: #e2e8f0;
    color: var(--text-dark, #0f172a);
    border-color: #cbd5e1;
}

.yt-shuffle-btn svg {
    width: 12px;
    height: 12px;
}

/* Buscador de Tutoriales (UI Premium integrada y alineada al ancho del reproductor) */
#tomapedidos-dashboard .yt-search-box {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 32px !important;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 8px 0 10px !important;
    box-sizing: border-box !important;
    margin: 0 0 8px 0 !important;
    position: relative;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

#tomapedidos-dashboard .yt-search-box:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}

#tomapedidos-dashboard .yt-search-box:focus-within {
    border-color: var(--primary-light, #1057A4);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(16, 87, 164, 0.12);
}

#tomapedidos-dashboard .yt-search-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    flex-shrink: 0;
    margin-right: 8px;
    pointer-events: none;
    transition: color 0.2s ease;
}

#tomapedidos-dashboard .yt-search-box:focus-within .yt-search-icon-wrap {
    color: var(--primary-light, #1057A4);
}

#tomapedidos-dashboard .yt-search-icon {
    width: 15px;
    height: 15px;
    display: block;
}

#tomapedidos-dashboard .yt-search-box input,
#tomapedidos-dashboard .yt-search-input {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 100% !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0.8rem !important;
    font-family: inherit !important;
    font-weight: 500 !important;
    color: var(--text-dark, #0f172a) !important;
    line-height: normal !important;
}

#tomapedidos-dashboard .yt-search-box input::placeholder,
#tomapedidos-dashboard .yt-search-input::placeholder {
    color: #94a3b8;
    font-size: 0.76rem;
    font-weight: 400;
}

#tomapedidos-dashboard .yt-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e2e8f0;
    border: none;
    cursor: pointer;
    color: #64748b;
    padding: 0;
    flex-shrink: 0;
    margin-left: 6px;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

#tomapedidos-dashboard .yt-search-clear:hover {
    background: #cbd5e1;
    color: var(--text-dark, #0f172a);
    transform: scale(1.08);
}

#tomapedidos-dashboard .yt-search-clear svg {
    width: 11px;
    height: 11px;
}

/* Pestañas de Playlists */
.yt-playlist-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.yt-playlist-tabs::-webkit-scrollbar {
    display: none;
}

.yt-tab {
    padding: 3px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.yt-tab:hover {
    background: #f1f5f9;
    color: var(--text-dark, #0f172a);
}

.yt-tab.active {
    background: var(--primary-light, #1057A4);
    color: #ffffff;
    border-color: var(--primary-light, #1057A4);
    box-shadow: 0 1px 3px rgba(16, 87, 164, 0.25);
}

/* Contenedor del Reproductor / Thumbnail */
.yt-player-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #0f172a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.yt-thumbnail-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
    overflow: hidden;
}

.yt-thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.yt-thumbnail-wrapper:hover img {
    transform: scale(1.05);
}

.yt-video-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(15, 23, 42, 0.78);
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
    z-index: 2;
}

.yt-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease;
}

.yt-thumbnail-wrapper:hover .yt-play-overlay {
    background: rgba(0, 0, 0, 0.35);
}

.yt-play-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #FF0000;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(255, 0, 0, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.yt-thumbnail-wrapper:hover .yt-play-btn {
    transform: scale(1.12);
    box-shadow: 0 6px 18px rgba(255, 0, 0, 0.65);
}

.yt-player-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.yt-close-player-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    transition: background 0.2s;
    padding: 0;
}

.yt-close-player-btn:hover {
    background: #ef4444;
}

.yt-close-player-btn svg {
    width: 14px;
    height: 14px;
}

/* Información y Controles */
.yt-video-info {
    margin-top: 8px;
}

.yt-video-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dark, #0f172a);
    margin: 0 0 6px 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.1em;
}

.yt-video-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.yt-nav-arrows {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.yt-nav-btn {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: var(--text-dark, #0f172a);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.yt-nav-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.yt-nav-btn svg {
    width: 14px;
    height: 14px;
}

.yt-counter {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    min-width: 34px;
    text-align: center;
}

.yt-external-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--primary-light, #1057A4);
    text-decoration: none;
    transition: color 0.15s;
}

.yt-external-link:hover {
    color: var(--primary-dark, #0C417B);
    text-decoration: underline;
}

.yt-external-link svg {
    width: 12px;
    height: 12px;
}

/* Estado vacío */
.yt-empty-state {
    text-align: center;
    padding: 14px 6px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
}

.yt-empty-state svg {
    width: 24px;
    height: 24px;
    color: #94a3b8;
    margin-bottom: 4px;
}

.yt-empty-state p {
    font-size: 0.72rem;
    color: #64748b;
    margin: 4px 0 8px;
    line-height: 1.3;
}

.yt-search-channel-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--primary-light, #1057A4);
    padding: 4px 8px;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.yt-search-channel-btn:hover {
    background: #f1f5f9;
    border-color: var(--primary-light, #1057A4);
}

.yt-search-channel-btn svg {
    width: 11px;
    height: 11px;
    color: inherit;
    margin: 0;
}

/* ========================================================= */
/* VISTA PREVIA FLOTANTE DEL VIDEO (ZOOM DE PORTADA)         */
/* ========================================================= */
#tomapedidos-dashboard .yt-video-zoom-preview {
    position: absolute !important;
    top: 50% !important;
    left: calc(100% + 16px) !important;
    width: 576px !important;
    max-width: calc(100vw - 340px) !important;
    max-height: calc(100vh - 60px) !important;
    aspect-ratio: 16 / 9 !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    box-shadow: 0 24px 50px -10px rgba(0, 0, 0, 0.5), 0 0 0 1.5px rgba(255, 255, 255, 0.25) !important;
    z-index: 99999 !important;
    pointer-events: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-50%) scale(0.95) translateX(-8px) !important;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s !important;
    background: #0f172a !important;
    display: flex !important;
    flex-direction: column !important;
}

#tomapedidos-dashboard .yt-video-zoom-preview.active,
#tomapedidos-dashboard .yt-player-container:not(.is-playing):hover + .yt-video-zoom-preview {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(-50%) scale(1) translateX(0) !important;
}

#tomapedidos-dashboard .yt-zoom-thumb-wrap {
    position: relative;
    width: 100%;
    height: 100%;
}

#tomapedidos-dashboard .yt-zoom-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


#tomapedidos-dashboard .yt-zoom-title-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 18px 14px 18px;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.72) 65%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 2;
}

#tomapedidos-dashboard .yt-zoom-video-title {
    color: #ffffff;
    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1.35;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

#tomapedidos-dashboard .yt-zoom-hint {
    color: #93c5fd;
    font-size: 0.76rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

@media (max-width: 992px) {
    #tomapedidos-dashboard .banner-zoom-preview,
    #tomapedidos-dashboard .yt-video-zoom-preview {
        display: none !important;
    }
}

/* ========================================================= */
/* TARJETAS BLOQUEADAS POR PERMISOS                           */
/* Se pintan con datos de ejemplo difuminados y un aviso      */
/* encima; el título de las gráficas sigue visible.           */
/* ========================================================= */
#tomapedidos-dashboard .kpi-row.is-locked,
#tomapedidos-dashboard .card.is-locked {
    position: relative;
}

#tomapedidos-dashboard .card.is-locked {
    overflow: hidden;
}

#tomapedidos-dashboard .kpi-row.is-locked kpi-card,
#tomapedidos-dashboard .card.is-locked .chart-container,
#tomapedidos-dashboard .card.is-locked .chart-subtitle-row {
    filter: blur(6px);
    pointer-events: none;
    user-select: none;
}

#tomapedidos-dashboard .card.is-locked .chart-card-header {
    position: relative;
    z-index: 2;
}

#tomapedidos-dashboard .card.is-locked .chart-select,
#tomapedidos-dashboard .card.is-locked .mode-switch-btn {
    opacity: 0.5;
    cursor: not-allowed;
}

#tomapedidos-dashboard .locked-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(248, 250, 252, 0.35);
    border-radius: var(--card-radius);
}

#tomapedidos-dashboard .locked-message {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 10px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    box-shadow: var(--card-shadow);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

#tomapedidos-dashboard .locked-message i,
#tomapedidos-dashboard .locked-message svg {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    color: var(--primary-light);
}
