/* =====================================================
   DESARROLLO DE NEGOCIOS - ESTILOS CSS
   Versión 1.0
   ===================================================== */

/* =================================================================
   VARIABLES Y RESET
   ================================================================= */

:root {
    --primary: #2c3e50;
    --primary-light: #34495e;
    --secondary: #3498db;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #17a2b8;
    --light: #ecf0f1;
    --dark: #1a252f;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

.crm-app {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    min-height: 100vh;
    color: var(--gray-800);
}

.crm-app * {
    box-sizing: border-box;
}

/* =================================================================
   HEADER
   ================================================================= */

.crm-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 20px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.crm-header .header-left {
    flex: 1;
    min-width: 200px;
}

.crm-header .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.crm-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.crm-header .subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 4px;
}

/* Navegación en el header */
.header-nav {
    display: flex;
    gap: 8px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.nav-tab.active {
    background: white;
    color: var(--primary);
    font-weight: 600;
}

.nav-badge {
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

/* =================================================================
   MÉTRICAS SUPERIORES
   ================================================================= */

.metrics-bar {
    display: flex;
    gap: 16px;
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
}

.metric-card {
    background: var(--gray-50);
    padding: 12px 20px;
    border-radius: var(--radius);
    border-left: 3px solid var(--secondary);
    min-width: 150px;
}

.metric-card .metric-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.metric-card .metric-label {
    font-size: 0.75rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card .metric-amount {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-top: 2px;
}

/* Métricas de Ganados */
.metric-card.metric-won {
    border-left-color: var(--success);
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.metric-card.metric-won .metric-value {
    color: var(--success);
}

/* Métricas de Perdidos */
.metric-card.metric-lost {
    border-left-color: var(--danger);
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.metric-card.metric-lost .metric-value {
    color: var(--danger);
}

/* Métrica de Win Rate */
.metric-card.metric-rate {
    border-left-color: var(--info);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.metric-card.metric-rate .metric-value {
    color: var(--info);
}

.metric-card.metric-rate .metric-value.rate-good {
    color: var(--success);
}

.metric-card.metric-rate .metric-value.rate-medium {
    color: var(--warning);
}

.metric-card.metric-rate .metric-value.rate-low {
    color: var(--danger);
}

/* =================================================================
   INDICADORES SECUNDARIOS
   ================================================================= */

.secondary-metrics {
    display: flex;
    gap: 24px;
    padding: 10px 24px;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.85rem;
    color: var(--gray-600);
    flex-wrap: wrap;
}

.secondary-metric {
    display: flex;
    align-items: center;
    gap: 6px;
}

.secondary-metric i {
    color: var(--gray-500);
}

.secondary-metric strong {
    color: var(--gray-800);
    font-weight: 600;
}

.secondary-metric .metric-amount-small {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-left: 4px;
}

/* Vencidas con alerta */
.secondary-metric#cardVencidas.has-overdue {
    color: var(--danger);
    background: #fee2e2;
    padding: 4px 10px;
    border-radius: var(--radius);
}

.secondary-metric#cardVencidas.has-overdue i,
.secondary-metric#cardVencidas.has-overdue strong {
    color: var(--danger);
}

/* =================================================================
   FILTROS Y TOOLBAR
   ================================================================= */

.toolbar {
    display: flex;
    flex-direction: column;
    padding: 12px 24px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    gap: 12px;
}

.filters-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filters-row-secondary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 0.7rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.filter-group label i {
    margin-right: 4px;
}

.btn-limpiar-filtros {
    padding: 8px 14px;
    background: var(--gray-200);
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--gray-700);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    align-self: flex-end;
}

.btn-limpiar-filtros:hover {
    background: var(--gray-300);
}

.filters-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    width: 280px;
}

.search-box input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
    min-width: 150px;
    max-width: 200px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--secondary);
}

.filter-actions-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.view-toggle {
    display: flex;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    overflow: hidden;
}

.view-toggle button {
    padding: 8px 14px;
    border: none;
    background: white;
    cursor: pointer;
    color: var(--gray-600);
    transition: var(--transition);
}

.view-toggle button:hover {
    background: var(--gray-100);
}

.view-toggle button.active {
    background: var(--primary);
    color: white;
}

/* =================================================================
   SCROLL HORIZONTAL SUPERIOR (SINCRONIZADO)
   ================================================================= */

.scroll-top-container {
    overflow-x: auto;
    overflow-y: hidden;
    height: 8px;
    margin: 0 20px 8px 20px;
}

.scroll-top-container::-webkit-scrollbar {
    height: 8px;
}

.scroll-top-container::-webkit-scrollbar-track {
    background: var(--gray-200);
    border-radius: 4px;
}

.scroll-top-container::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

.scroll-top-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

.scroll-top-content {
    height: 1px;
}

/* =================================================================
   PIPELINE KANBAN
   ================================================================= */

.pipeline-container {
    padding: 20px;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Scrollbar elegante para el pipeline */
.pipeline-container::-webkit-scrollbar {
    height: 8px;
}

.pipeline-container::-webkit-scrollbar-track {
    background: var(--gray-200);
    border-radius: 4px;
}

.pipeline-container::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

.pipeline-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

#pipelineKanban {
    display: flex;
    gap: 16px;
    min-height: calc(100vh - 280px);
    padding-bottom: 20px;
    /* Forzar ancho mínimo para scroll horizontal: 7 columnas x 300px + gaps */
    min-width: max-content;
}

.pipeline-column {
    min-width: 280px;
    width: 280px;
    flex-shrink: 0;
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
}

/* Columnas terminales (Ganado/Perdido) - más compactas */
.pipeline-column.folded {
    min-width: 60px;
    width: 60px;
}

.column-header {
    padding: 16px;
    background: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-top: 4px solid var(--gray-500);
}

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

.stage-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray-800);
}

.stage-count {
    background: var(--gray-200);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
}

.column-amount {
    font-size: 0.85rem;
    color: var(--gray-600);
    font-weight: 500;
}

.column-cards {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
}

.column-cards.drag-over {
    background: rgba(52, 152, 219, 0.1);
    border: 2px dashed var(--secondary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.empty-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: var(--gray-500);
    text-align: center;
}

.empty-stage i {
    font-size: 2rem;
    margin-bottom: 8px;
}

/* =================================================================
   OPORTUNIDAD CARD
   ================================================================= */

.oportunidad-card {
    background: white;
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
    position: relative;
}

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

.oportunidad-card.dragging {
    opacity: 0.4;
    transform: scale(0.98);
}
/* Ghost visual durante drag custom */
.drag-ghost {
    border-radius: var(--radius);
    cursor: grabbing !important;
}

.oportunidad-card.processing {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.oportunidad-card.processing::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
}

.oportunidad-card.activity-overdue {
    border-left-color: var(--danger);
}

.oportunidad-card.activity-today {
    border-left-color: var(--warning);
}

.oportunidad-card.activity-planned {
    border-left-color: var(--secondary);
}

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

.card-priority {
    color: #f1c40f;
    font-size: 0.75rem;
}

.card-priority .fa-star-o {
    color: var(--gray-400);
}

.card-activity {
    font-size: 0.85rem;
}

.card-activity .fa-exclamation-circle {
    color: var(--danger);
}

.card-activity .fa-clock-o {
    color: var(--warning);
}

.card-activity .fa-calendar-check-o {
    color: var(--secondary);
}

.card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray-800);
    margin-bottom: 6px;
    line-height: 1.3;
}

.card-client {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-client i {
    color: var(--gray-500);
}

.card-client .client-logo {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.card-client .client-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-client .client-logo-fallback {
    width: 24px;
    text-align: center;
}

.card-type {
    margin-bottom: 10px;
}

.type-badge {
    background: var(--gray-200);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--gray-700);
    text-transform: uppercase;
}

/* Etiquetas (Tags) */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 500;
    white-space: nowrap;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-badge.tag-more {
    background: var(--gray-200) !important;
    color: var(--gray-600) !important;
    font-size: 0.65rem;
}

/* Etiquetas en panel de detalle */
.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-badge-detail {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 0.75rem;
    font-weight: 500;
}

.detail-tags-row span {
    flex: 1;
}

.card-financials {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 8px;
}

.card-amount {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary);
}

.card-probability {
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.card-deadline {
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-deadline.deadline-passed {
    color: var(--danger);
    font-weight: 600;
}

.card-deadline.deadline-today {
    color: var(--warning);
    font-weight: 600;
}

.card-deadline.deadline-soon {
    color: var(--info);
}

.card-owner {
    display: flex;
    align-items: center;
}

.owner-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.vendedor-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Tip para siguiente etapa */
.card-tip {
    margin-top: 10px;
    padding: 8px 10px;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-radius: var(--radius);
    font-size: 0.75rem;
    color: #92400e;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #fcd34d;
}

.card-tip:hover {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    transform: translateY(-1px);
}

.card-tip i {
    color: #f59e0b;
}

.card-tip .tip-more {
    background: #fcd34d;
    padding: 1px 5px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 2px;
}

/* Indicador de deterioro/estancamiento */
.card-rotting {
    margin-top: 10px;
    padding: 8px 10px;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-radius: var(--radius);
    font-size: 0.75rem;
    color: #991b1b;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #fca5a5;
    animation: pulse-warning 2s infinite;
}

.card-rotting i {
    color: #dc2626;
}

.oportunidad-card.is-rotting {
    border-left: 4px solid #dc2626;
}

.oportunidad-card.is-rotting::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #dc2626 0%, #f87171 100%);
    border-radius: var(--radius) var(--radius) 0 0;
}

@keyframes pulse-warning {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Prevenir drag nativo de imágenes en navegadores Webkit */
.oportunidad-card img,
.oportunidad-card a {
    -webkit-user-drag: none;
}

/* Hacer que el clic traspase las imágenes hacia la tarjeta */
.oportunidad-card img {
    pointer-events: none;
}

/* Proyecto vinculado en el card */
.card-project {
    margin-top: 10px;
    padding: 6px 10px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-radius: var(--radius);
    font-size: 0.7rem;
    color: #065f46;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #6ee7b7;
}

.card-project i {
    color: #10b981;
}

/* Botón de acción en el card */
.card-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid #60a5fa;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 500;
    color: #1e40af;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-action-btn:hover {
    background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
    color: #1e3a8a;
    text-decoration: none;
}

.card-action-btn i {
    color: #2563eb;
}

/* =================================================================
   LISTA DE OPORTUNIDADES
   ================================================================= */

#listaOportunidades {
    display: none;
    padding: 20px 24px;
}

.tabla-oportunidades {
    width: 100%;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border-collapse: collapse;
}

.tabla-oportunidades th {
    background: var(--gray-100);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--gray-600);
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    white-space: nowrap;
}

.tabla-oportunidades th:hover {
    background: var(--gray-200);
}

.tabla-oportunidades th.no-sort {
    cursor: default;
}

.tabla-oportunidades th.no-sort:hover {
    background: var(--gray-100);
}

.tabla-oportunidades th .sort-icon {
    margin-left: 4px;
    opacity: 0.3;
    font-size: 0.65rem;
}

.tabla-oportunidades th.sorted .sort-icon {
    opacity: 1;
    color: var(--secondary);
}

.tabla-oportunidades th.sorted {
    color: var(--secondary);
}

.tabla-oportunidades td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    font-size: 0.8rem;
}

.tabla-oportunidades tr:hover {
    background: var(--gray-50);
}

/* Toolbar de lista */
.lista-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 0;
}

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

.agrupar-por label {
    font-size: 0.85rem;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 6px;
}

.agrupar-por select {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
}

.lista-total {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--gray-600);
}

.lista-total .total-monto {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
}

/* Contenedor de tabla con scroll horizontal */
.tabla-container {
    overflow-x: auto;
    background: white;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow);
}

.tabla-container .tabla-oportunidades {
    border-radius: 0;
    box-shadow: none;
    min-width: 1100px;
}

/* Columnas de tabla */
.tabla-oportunidades .th-nombre { min-width: 180px; }
.tabla-oportunidades .th-cliente { min-width: 130px; }
.tabla-oportunidades .th-etapa { min-width: 100px; }
.tabla-oportunidades .th-tipo { min-width: 100px; }
.tabla-oportunidades .th-region { min-width: 100px; }
.tabla-oportunidades .th-monto { min-width: 90px; text-align: right; }
.tabla-oportunidades .th-prob { min-width: 50px; text-align: center; }
.tabla-oportunidades .th-ponderado { min-width: 90px; text-align: right; }
.tabla-oportunidades .th-cierre { min-width: 80px; }
.tabla-oportunidades .th-origen { min-width: 100px; }
.tabla-oportunidades .th-vendedor { min-width: 60px; text-align: center; }
.tabla-oportunidades .th-acciones { min-width: 40px; }

.tabla-oportunidades .col-monto,
.tabla-oportunidades .col-ponderado { 
    text-align: right; 
    font-weight: 500;
    font-size: 0.75rem;
}

.tabla-oportunidades .col-prob { 
    text-align: center; 
}

.tabla-oportunidades .col-vendedor { 
    text-align: center; 
}

.tabla-oportunidades .col-nombre .nombre-texto {
    font-size: 0.8rem;
    font-weight: 500;
}

.tabla-oportunidades .col-tipo,
.tabla-oportunidades .col-region,
.tabla-oportunidades .col-origen,
.tabla-oportunidades .col-cierre {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.tabla-oportunidades .vendedor-avatar {
    width: 26px;
    height: 26px;
    font-size: 0.65rem;
}

/* Filas clickeables */
.oportunidad-row {
    cursor: pointer;
    transition: background 0.15s;
}

.oportunidad-row:hover {
    background: #f0f9ff !important;
}

.oportunidad-row.en-grupo {
    background: var(--gray-50);
}

.oportunidad-row.en-grupo:hover {
    background: #e0f2fe !important;
}

/* Indicadores en fila de lista */
.oportunidad-row.is-rotting {
    background: #fef2f2 !important;
}

.oportunidad-row.is-rotting:hover {
    background: #fee2e2 !important;
}

.row-indicadores {
    margin-left: 8px;
    display: inline-flex;
    gap: 4px;
}

.row-indicadores .rotting-icon {
    color: #dc2626;
    font-size: 0.75rem;
}

.row-indicadores .activity-icon {
    font-size: 0.75rem;
}

.row-indicadores .activity-icon.overdue {
    color: #dc2626;
}

.row-indicadores .activity-icon.today {
    color: #f59e0b;
}

/* Badge de etapa pequeño */
.etapa-badge-sm {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

/* Header de grupo */
.grupo-header {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
    cursor: default;
}

.grupo-header:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
}


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

.grupo-info i {
    color: var(--secondary);
}

.grupo-label {
    font-weight: 600;
    color: var(--gray-800);
}

.grupo-count {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.grupo-total {
    text-align: right;
}

.grupo-monto {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.95rem;
}

.grupo-ponderado {
    text-align: left;
    padding-left: 20px !important;
}

.grupo-ponderado-valor {
    font-size: 0.8rem;
    color: var(--gray-600);
}

.etapa-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

/* =================================================================
   MODALES
   ================================================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 20px 40px 20px;
    overflow-y: auto;
    z-index: 10000;
}

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

/* Asegurar que el header no tape los modales */
.crm-header {
    z-index: 100;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

.modal-content.modal-lg {
    max-width: 900px;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header-info {
    flex: 1;
}

.modal-subtitle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--gray-500);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.btn-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal-body {
    padding: 24px;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

/* Sección de campos faltantes en modal */
.modal-tip-section {
    margin: 0;
    padding: 16px 24px;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-top: 1px solid #fcd34d;
}

.modal-tip-section .tip-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-tip-section .tip-header i {
    color: #f59e0b;
}

.modal-tip-section .tip-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.modal-tip-section .tip-field-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 1px solid #fcd34d;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #92400e;
}

.modal-tip-section .tip-field-tag i {
    font-size: 0.6rem;
    color: #f59e0b;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

/* =================================================================
   TABS EN MODAL
   ================================================================= */

.detail-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--gray-600);
    position: relative;
    transition: var(--transition);
}

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

.tab-btn.active {
    color: var(--primary);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* =================================================================
   DETALLES EN MODAL
   ================================================================= */

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

.detail-section {
    background: var(--gray-50);
    padding: 16px;
    border-radius: var(--radius);
}

.detail-section.full-width {
    grid-column: 1 / -1;
}

.detail-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-section h4 i {
    color: var(--secondary);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row label {
    color: var(--gray-600);
    font-size: 0.85rem;
}

.detail-row span {
    font-weight: 500;
    color: var(--gray-800);
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.value-card {
    background: white;
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
}

.value-label {
    font-size: 0.75rem;
    color: var(--gray-600);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.value-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.stakeholders-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stakeholder-card {
    background: white;
    padding: 12px;
    border-radius: var(--radius);
    text-align: center;
}

.stakeholder-role {
    font-size: 0.7rem;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stakeholder-name {
    font-weight: 600;
    color: var(--gray-800);
}

.decision-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 600;
    margin-bottom: 12px;
    background: var(--gray-200);
    color: var(--gray-700);
}

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

.decision-badge.no-go {
    background: var(--danger);
    color: white;
}

.cotizacion-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.cotizacion-card {
    background: white;
    padding: 12px;
    border-radius: var(--radius);
    text-align: center;
}

.cotizacion-label {
    font-size: 0.7rem;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.cotizacion-value {
    font-weight: 600;
    color: var(--primary);
}

.no-project {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}

.no-project i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
}

.project-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: var(--radius);
}

.project-name {
    font-weight: 600;
    color: var(--primary);
}

/* =================================================================
   FORMULARIO
   ================================================================= */

.form-section {
    margin-bottom: 24px;
}

.form-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title i {
    color: var(--secondary);
}

/* =================================================================
   SECCIONES COLAPSABLES
   ================================================================= */

.form-section.collapsible {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.form-section.collapsible .form-section-title {
    margin-bottom: 0;
    padding: 14px 16px;
    border-bottom: none;
    background: var(--gray-100);
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.form-section.collapsible .form-section-title:hover {
    background: var(--gray-200);
}

.form-section.collapsible.expanded .form-section-title {
    border-bottom: 1px solid var(--gray-200);
}

.collapsible-header {
    justify-content: space-between;
}

.collapse-icon {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.form-section.collapsible.expanded .collapse-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 16px;
}

.form-section.collapsible.expanded .collapsible-content {
    max-height: 1000px;
    padding: 16px;
}

.section-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin: 0 0 16px 0;
    padding: 10px;
    background: var(--gray-100);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-hint i {
    color: var(--info);
}

/* =================================================================
   STAKEHOLDERS
   ================================================================= */

.stakeholder-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-200);
}

.stakeholder-row:last-child {
    border-bottom: none;
}

.stakeholder-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--secondary), #2980b9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.stakeholder-icon i {
    color: white;
}

.stakeholder-field {
    flex: 1;
}

.stakeholder-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
    display: block;
}

.stakeholder-selector {
    display: flex;
    gap: 8px;
}

.stakeholder-selector select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.stakeholder-selector select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--secondary);
    background: white;
    color: var(--secondary);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--secondary);
    color: white;
}

.stakeholder-info {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--gray-500);
}

.stakeholder-info:empty {
    display: none;
}

.stakeholder-info .contact-email,
.stakeholder-info .contact-phone {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 12px;
}

.stakeholder-info i {
    font-size: 0.75rem;
}

/* =================================================================
   MODAL HINT
   ================================================================= */

.modal-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin: 16px 0 0 0;
    padding: 10px 12px;
    background: #e8f4fc;
    border-radius: var(--radius);
    border-left: 3px solid var(--info);
}

.modal-hint i {
    color: var(--info);
    margin-right: 6px;
}

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

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

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group label .required {
    color: var(--danger);
    font-weight: 700;
}



.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.prioridad-selector {
    display: flex;
    gap: 8px;
}

.prioridad-option {
    padding: 10px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-600);
}

.prioridad-option:hover {
    border-color: var(--secondary);
}

.prioridad-option.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Selector de Etiquetas */
.tags-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    min-height: 50px;
}

.tags-empty {
    color: var(--gray-500);
    font-size: 0.85rem;
    font-style: italic;
}

.tag-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
}

.tag-option:hover {
    border-color: var(--secondary);
    background: var(--gray-50);
}

.tag-option.selected {
    border-color: var(--secondary);
    background: #e8f4fc;
}

.tag-option .tag-checkbox {
    color: var(--gray-400);
    font-size: 1rem;
}

.tag-option.selected .tag-checkbox {
    color: var(--secondary);
}

.tag-option .tag-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-option .tag-name {
    color: var(--gray-700);
}

.tag-option.selected .tag-name {
    font-weight: 500;
}

/* Autocomplete cliente */
.cliente-autocomplete {
    position: relative;
}

#clienteResultados {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.cliente-resultado {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

.cliente-resultado:hover {
    background: var(--gray-50);
}

.cliente-resultado.crear-nuevo {
    color: var(--secondary);
    font-weight: 500;
}

.cliente-nombre {
    font-weight: 500;
}

.cliente-rut {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.no-results {
    padding: 12px;
    color: var(--gray-500);
    font-style: italic;
    text-align: center;
    border-bottom: 1px solid var(--gray-100);
}

/* =================================================================
   BOTONES
   ================================================================= */

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

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

.btn-success:hover {
    background: #219a52;
}

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

.btn-danger:hover {
    background: #c0392b;
}

.btn-outline {
    background: white;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    border-radius: 50%;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* =================================================================
   FAB (FLOATING ACTION BUTTON)
   ================================================================= */

.fab-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: var(--transition);
}

.fab-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.4);
}

/* =================================================================
   LOADING
   ================================================================= */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* =================================================================
   TOAST
   ================================================================= */

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 14px 24px;
    background: var(--gray-800);
    color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* =================================================================
   RESPONSIVE
   ================================================================= */

@media (max-width: 1200px) {
    .pipeline-column {
        min-width: 260px;
        max-width: 260px;
    }
}

@media (max-width: 768px) {
    .metrics-bar {
        flex-direction: column;
    }
    
    .metric-card {
        width: 100%;
    }
    
    .secondary-metrics {
        flex-direction: column;
        gap: 8px;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters-row {
        flex-direction: column;
    }
    
    .filters-row-secondary {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filters-group {
        flex-direction: column;
    }
    
    .search-box {
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
        max-width: none;
    }
    
    .btn-limpiar-filtros {
        width: 100%;
        justify-content: center;
    }
    
    #pipelineKanban {
        flex-direction: column;
    }
    
    .pipeline-column {
        min-width: 100%;
        max-width: 100%;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .values-grid {
        grid-template-columns: 1fr;
    }
    
    .stakeholders-grid {
        grid-template-columns: 1fr;
    }
    
    .cotizacion-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .modal-content {
        margin: 10px;
    }
}

/* =================================================================
   SECCIÓN DE DOCUMENTOS
   ================================================================= */

.documentos-container {
    padding: 0;
}

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

.documentos-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.documentos-title i {
    color: var(--secondary);
}

.documentos-lista {
    min-height: 100px;
}

.loading-docs {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}

.no-docs {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
    background: var(--gray-100);
    border-radius: var(--radius);
}

.no-docs i {
    font-size: 2.5rem;
    color: var(--gray-300);
    margin-bottom: 12px;
}

.no-docs p {
    margin: 0;
}

.no-docs .hint {
    font-size: 0.8rem;
    margin-top: 8px;
}

/* Grupos de documentos */
.docs-grupo {
    margin-bottom: 20px;
}

.docs-grupo-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    padding: 8px 12px;
    background: var(--gray-100);
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.docs-grupo-header i {
    color: var(--secondary);
}

.docs-count {
    background: var(--secondary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.docs-grupo-lista {
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* Item de documento */
.doc-item {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    border-bottom: 1px solid var(--gray-200);
    transition: background 0.2s;
}

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

.doc-item:hover {
    background: var(--gray-50);
}

.doc-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.doc-icon i {
    font-size: 1.2rem;
    color: var(--secondary);
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-name {
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 4px;
    word-break: break-word;
}

.doc-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.doc-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.doc-meta i {
    font-size: 0.65rem;
}

.doc-notas {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-top: 6px;
    font-style: italic;
}

.doc-actions {
    display: flex;
    gap: 6px;
    margin-left: 12px;
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-600);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon-sm:hover {
    background: var(--secondary);
    border-color: var(--secondary);
    color: white;
}

.btn-icon-sm.btn-danger-icon:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* =================================================================
   MODAL SUBIR DOCUMENTO
   ================================================================= */

.file-upload-area {
    position: relative;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    background: var(--gray-50);
    transition: all 0.2s;
    overflow: hidden;
}

.file-upload-area:hover {
    border-color: var(--secondary);
    background: #f0f9ff;
}

.file-upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    text-align: center;
    color: var(--gray-500);
}

.file-upload-placeholder i {
    font-size: 2.5rem;
    color: var(--secondary);
    margin-bottom: 12px;
}

.file-upload-placeholder p {
    margin: 0;
}

.file-upload-placeholder .hint {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 6px;
}

.file-upload-selected {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #e0f2fe;
    gap: 12px;
}

.file-upload-selected i {
    font-size: 1.5rem;
    color: var(--secondary);
}

.file-upload-selected span {
    flex: 1;
    font-weight: 500;
    color: var(--gray-800);
    word-break: break-word;
}

.btn-remove-file {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

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

.field-hint {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* =================================================================
   SECCIÓN DE ACTIVIDADES
   ================================================================= */

.actividades-container {
    padding: 0;
}

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

.actividades-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.actividades-title i {
    color: var(--secondary);
}

.actividades-lista {
    min-height: 100px;
}

.no-actividades {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
    background: var(--gray-100);
    border-radius: var(--radius);
}

.no-actividades i {
    font-size: 2.5rem;
    color: var(--gray-300);
    margin-bottom: 12px;
}

.no-actividades p {
    margin: 0;
}

.no-actividades .hint {
    font-size: 0.8rem;
    margin-top: 8px;
}

/* Secciones de actividades */
.actividades-seccion {
    margin-bottom: 20px;
}

.actividades-seccion-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    padding: 10px 12px;
    background: var(--gray-100);
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.actividades-seccion-header i {
    color: var(--secondary);
}

.actividades-seccion-header.collapsible {
    cursor: pointer;
    transition: background 0.2s;
}

.actividades-seccion-header.collapsible:hover {
    background: var(--gray-200);
}

.actividades-seccion.completadas .actividades-seccion-header {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.actividades-seccion.completadas .actividades-seccion-header i:first-child {
    color: var(--success);
}

.actividades-count {
    background: var(--secondary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.actividades-seccion.completadas .actividades-count {
    background: var(--success);
}

.toggle-icon {
    transition: transform 0.3s;
    margin-left: 8px;
}

.toggle-icon.rotated {
    transform: rotate(180deg);
}

.actividades-seccion-lista {
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* Item de actividad */
.actividad-item {
    display: flex;
    align-items: flex-start;
    padding: 14px;
    border-bottom: 1px solid var(--gray-200);
    background: white;
    transition: background 0.2s;
}

.actividad-item:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

.actividad-item:hover {
    background: var(--gray-50);
}

.actividad-item.overdue {
    background: #fef2f2;
}

.actividad-item.overdue:hover {
    background: #fee2e2;
}

.actividad-item.today {
    background: #fffbeb;
}

.actividad-item.today:hover {
    background: #fef3c7;
}

.actividad-item.done {
    background: #f0fdf4;
    opacity: 0.85;
}

/* Estado visual */
.actividad-estado {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    flex-shrink: 0;
}

.actividad-estado i {
    color: white;
    font-size: 1rem;
}

/* Contenido */
.actividad-contenido {
    flex: 1;
    min-width: 0;
}

.actividad-tipo {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.actividad-tipo i {
    font-size: 0.8rem;
}

.actividad-titulo {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 6px;
}

.actividad-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 6px;
}

.actividad-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.actividad-meta i {
    font-size: 0.65rem;
}

.actividad-fecha {
    font-weight: 600;
}

.actividad-nota {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-top: 8px;
    padding: 8px 10px;
    background: var(--gray-100);
    border-radius: var(--radius);
    border-left: 3px solid var(--gray-300);
}

.actividad-feedback {
    font-size: 0.8rem;
    color: var(--success);
    margin-top: 8px;
    padding: 8px 10px;
    background: #f0fdf4;
    border-radius: var(--radius);
    border-left: 3px solid var(--success);
}

.actividad-feedback i {
    margin-right: 6px;
}

/* Acciones */
.actividad-acciones {
    display: flex;
    gap: 6px;
    margin-left: 12px;
    flex-shrink: 0;
}

.actividad-acciones .btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* Checkbox label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .actividad-item {
        flex-direction: column;
    }
    
    .actividad-estado {
        margin-bottom: 10px;
    }
    
    .actividad-acciones {
        margin-left: 0;
        margin-top: 12px;
        width: 100%;
        justify-content: flex-end;
    }
}

/* =================================================================
   DASHBOARD COMERCIAL - ESTILOS
   ================================================================= */

/* Filtros del Dashboard */
.dashboard-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.dashboard-filters .filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-filters .filter-group label {
    font-size: 0.85rem;
    color: var(--gray-600);
    white-space: nowrap;
}

.dashboard-filters .filter-select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    min-width: 150px;
}

.dashboard-filters .filter-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.dashboard-filters .export-buttons {
    display: flex;
    gap: 8px;
}

.btn-success {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    border-color: #059669;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-grid-secondary {
    grid-template-columns: repeat(5, 1fr);
}

.kpi-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.kpi-card.kpi-primary::before { background: var(--primary); }
.kpi-card.kpi-success::before { background: var(--success); }
.kpi-card.kpi-info::before { background: var(--secondary); }
.kpi-card.kpi-warning::before { background: #f59e0b; }

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.kpi-primary .kpi-icon { background: #dbeafe; color: var(--primary); }
.kpi-success .kpi-icon { background: #dcfce7; color: var(--success); }
.kpi-info .kpi-icon { background: #e0e7ff; color: var(--secondary); }
.kpi-warning .kpi-icon { background: #fef3c7; color: #f59e0b; }

.kpi-content {
    flex: 1;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
}

.kpi-label {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-top: 4px;
}

.kpi-subtitle {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.kpi-detail {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.kpi-trend {
    font-size: 0.85rem;
    margin-top: 8px;
}

.kpi-trend.positive { color: var(--success); }
.kpi-trend.negative { color: var(--danger); }

/* KPI Cards Pequeñas */
.kpi-card-small {
    background: white;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    text-align: center;
    position: relative;
}

.kpi-card-small.kpi-won { border-bottom: 3px solid var(--success); }
.kpi-card-small.kpi-lost { border-bottom: 3px solid var(--danger); }
.kpi-card-small.kpi-alert { border-bottom: 3px solid #f59e0b; }
.kpi-card-small.kpi-rotting { border-bottom: 3px solid #dc2626; }

.kpi-small-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
}

.kpi-card-small.kpi-won .kpi-small-value { color: var(--success); }
.kpi-card-small.kpi-lost .kpi-small-value { color: var(--danger); }
.kpi-card-small.kpi-alert .kpi-small-value { color: #f59e0b; }
.kpi-card-small.kpi-rotting .kpi-small-value { color: #dc2626; }

.kpi-small-label {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-top: 4px;
}

.kpi-small-amount {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.chart-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chart-card.chart-wide {
    grid-column: span 2;
}

.chart-card.chart-funnel {
    min-width: 350px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.chart-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-header h3 i {
    color: var(--secondary);
}

.chart-legend {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--gray-600);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.chart-body {
    padding: 20px;
    height: 300px;
}

/* Funnel */
.funnel-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.funnel-stage {
    display: grid;
    grid-template-columns: 120px 1fr 100px;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.funnel-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-700);
    text-align: right;
}

.funnel-bar-container {
    height: 28px;
    background: var(--gray-100);
    border-radius: var(--radius);
    overflow: hidden;
}

.funnel-bar {
    height: 100%;
    border-radius: var(--radius);
    transition: width 0.5s ease;
    min-width: 4px;
}

.funnel-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.funnel-count {
    font-weight: 700;
    color: var(--gray-800);
    font-size: 1rem;
}

.funnel-monto {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Tables Row */
.tables-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.table-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.table-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-header h3 i {
    color: var(--secondary);
}

.table-subtitle {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.table-body {
    padding: 0;
    max-height: 350px;
    overflow-y: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

.dashboard-table th {
    background: var(--gray-50);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    position: sticky;
    top: 0;
}

.dashboard-table td {
    padding: 12px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--gray-100);
}

.dashboard-table tr {
    cursor: pointer;
    transition: background 0.15s;
}

.dashboard-table tr:hover {
    background: var(--gray-50);
}

.dashboard-table .text-right { text-align: right; }
.dashboard-table .text-center { text-align: center; }
.dashboard-table .text-success { color: var(--success); }
.dashboard-table .font-bold { font-weight: 600; }

.dashboard-table .empty-table {
    text-align: center;
    color: var(--gray-500);
    padding: 40px;
}

.vendedor-avatar-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 600;
    margin-right: 8px;
}

/* Forecast Section */
.forecast-section {
    margin-bottom: 24px;
}

.forecast-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.forecast-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.forecast-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.forecast-header h3 i {
    color: var(--secondary);
}

.forecast-body {
    padding: 20px;
}

.forecast-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.forecast-column {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 16px;
}

.forecast-month {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 12px;
    text-transform: capitalize;
    font-size: 0.95rem;
}

.forecast-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
}

.forecast-label {
    font-size: 0.8rem;
    color: var(--gray-600);
}

.forecast-value {
    font-weight: 600;
    font-size: 0.9rem;
}

.forecast-value.committed { color: var(--success); }
.forecast-value.probable { color: #f59e0b; }
.forecast-value.pipeline { color: var(--gray-500); }

.forecast-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    margin-top: 8px;
    font-weight: 600;
    color: var(--primary);
    font-size: 0.95rem;
}

/* Forecast Trimestral */
.forecast-quarterly {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.forecast-quarters {
    grid-template-columns: repeat(4, 1fr);
}

.quarter-column {
    background: white;
    border: 1px solid var(--gray-200);
    position: relative;
}

.quarter-column:first-child {
    border-left: 3px solid var(--primary);
}

.forecast-quarter {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
    font-size: 1.1rem;
}

.quarter-dates {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--gray-200);
}

/* Activities Summary */
.activities-summary {
    margin-bottom: 24px;
}

.activities-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.activities-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.activities-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.activities-header h3 i {
    color: var(--secondary);
}

.activities-body {
    display: flex;
    gap: 0;
    padding: 0;
}

.activity-stat {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    border-right: 1px solid var(--gray-200);
}

.activity-stat:last-child {
    border-right: none;
}

.activity-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.activity-stat.overdue .activity-stat-icon {
    background: #fee2e2;
    color: #dc2626;
}

.activity-stat.today .activity-stat-icon {
    background: #fef3c7;
    color: #f59e0b;
}

.activity-stat.planned .activity-stat-icon {
    background: #dbeafe;
    color: #3b82f6;
}

.activity-stat-content {
    flex: 1;
}

.activity-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
}

.activity-stat.overdue .activity-stat-value { color: #dc2626; }
.activity-stat.today .activity-stat-value { color: #f59e0b; }

.activity-stat-label {
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* Responsive Dashboard */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .kpi-grid-secondary {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .chart-card.chart-wide {
        grid-column: span 1;
    }
    
    .tables-row {
        grid-template-columns: 1fr;
    }
    
    .forecast-columns {
        grid-template-columns: 1fr;
    }
    
    .forecast-quarters {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .crm-header {
        flex-direction: column;
        text-align: center;
    }
    
    .crm-header .header-left {
        width: 100%;
    }
    
    .header-nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .kpi-grid-secondary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .forecast-quarters {
        grid-template-columns: 1fr;
    }
    
    .activities-body {
        flex-direction: column;
    }
    
    .activity-stat {
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }
    
    .activity-stat:last-child {
        border-bottom: none;
    }
    
    .funnel-stage {
        grid-template-columns: 80px 1fr 60px;
    }
    
    .funnel-label {
        font-size: 0.75rem;
    }
}

/* =================================================================
   PÁGINA DE ACTIVIDADES - ESTILOS
   ================================================================= */

/* Contadores de Actividades */
.actividades-counters {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 20px 24px;
    background: var(--gray-50);
}

.counter-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

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

.counter-card.overdue {
    border-left-color: #dc2626;
}

.counter-card.overdue.has-items {
    background: #fef2f2;
    animation: pulse-danger 2s infinite;
}

.counter-card.today {
    border-left-color: #f59e0b;
}

.counter-card.planned {
    border-left-color: #3b82f6;
}

.counter-card.done {
    border-left-color: #22c55e;
}

@keyframes pulse-danger {
    0%, 100% { box-shadow: var(--shadow); }
    50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2); }
}

.counter-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.counter-card.overdue .counter-icon {
    background: #fee2e2;
    color: #dc2626;
}

.counter-card.today .counter-icon {
    background: #fef3c7;
    color: #f59e0b;
}

.counter-card.planned .counter-icon {
    background: #dbeafe;
    color: #3b82f6;
}

.counter-card.done .counter-icon {
    background: #dcfce7;
    color: #22c55e;
}

.counter-content {
    flex: 1;
}

.counter-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1;
}

.counter-card.overdue .counter-value { color: #dc2626; }
.counter-card.today .counter-value { color: #f59e0b; }

.counter-label {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-top: 4px;
}

/* Filtros de Actividades */
.actividades-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
}

.actividades-filters .filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.actividades-filters .filter-group label {
    font-size: 0.85rem;
    color: var(--gray-600);
    white-space: nowrap;
}

.actividades-filters .filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    min-width: 140px;
}

/* Main Content */
.actividades-main {
    padding: 24px;
    background: var(--gray-50);
    min-height: calc(100vh - 300px);
}

.actividades-list-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.list-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-header h3 i {
    color: var(--secondary);
}

.list-count {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.actividades-list {
    max-height: calc(100vh - 400px);
    overflow-y: auto;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h4 {
    margin: 0 0 8px;
    color: var(--gray-600);
}

.empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

/* Loading Placeholder */
.loading-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.loading-placeholder i {
    font-size: 2rem;
    margin-bottom: 12px;
}

/* Grupos de Actividades */
.actividades-grupo {
    border-bottom: 1px solid var(--gray-200);
}

.actividades-grupo:last-child {
    border-bottom: none;
}

.grupo-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.actividades-grupo.overdue .grupo-header {
    background: #fef2f2;
    color: #991b1b;
}

.actividades-grupo.today .grupo-header {
    background: #fffbeb;
    color: #92400e;
}

.actividades-grupo.planned .grupo-header {
    background: #eff6ff;
    color: #1e40af;
}

.actividades-grupo.done .grupo-header {
    background: #f0fdf4;
    color: #166534;
}

.grupo-count {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: auto;
}

.grupo-items {
    padding: 0;
}

/* Card de Actividad en Página */
.actividad-card-page {
    display: flex;
    align-items: flex-start;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s;
}

.actividad-card-page:hover {
    background: var(--gray-50);
}

.actividad-card-page:last-child {
    border-bottom: none;
}

.act-estado {
    width: 4px;
    height: 100%;
    min-height: 80px;
    border-radius: 2px;
    margin-right: 16px;
    flex-shrink: 0;
}

.act-content {
    flex: 1;
    min-width: 0;
}

.act-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.act-tipo {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--gray-500);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.act-fecha {
    font-size: 0.8rem;
    font-weight: 600;
}

.act-titulo {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.act-oportunidad {
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.act-oportunidad:hover {
    text-decoration: underline;
}

.act-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.act-meta i {
    margin-right: 4px;
    color: var(--gray-400);
}

.act-creador {
    color: var(--gray-500);
    font-style: italic;
}

.act-nota {
    font-size: 0.85rem;
    color: var(--gray-600);
    background: var(--gray-50);
    padding: 8px 12px;
    border-radius: var(--radius);
    border-left: 3px solid var(--gray-300);
}

.act-acciones {
    display: flex;
    gap: 8px;
    margin-left: 16px;
    flex-shrink: 0;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.btn-icon.btn-danger-icon:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* Modal Actividades Page */
.actividad-resumen {
    background: var(--gray-50);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.resumen-tipo {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.resumen-titulo {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.resumen-oportunidad {
    font-size: 0.9rem;
    color: var(--primary);
}

.seguimiento-form {
    background: #eff6ff;
    padding: 16px;
    border-radius: var(--radius);
    margin-top: 16px;
    border: 1px solid #bfdbfe;
}

.reagendar-shortcuts {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.shortcut-label {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 10px;
    display: block;
}

.shortcut-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-outline {
    background: white;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
    padding: 8px 14px;
    font-size: 0.85rem;
}

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

/* Responsive Actividades */
@media (max-width: 1024px) {
    .actividades-counters {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .actividades-counters {
        grid-template-columns: 1fr;
        padding: 16px;
    }
    
    .actividades-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .actividades-filters .filter-group {
        width: 100%;
    }
    
    .actividades-filters .filter-group select {
        flex: 1;
    }
    
    .actividad-card-page {
        flex-direction: column;
    }
    
    .act-estado {
        width: 100%;
        height: 4px;
        min-height: auto;
        margin-right: 0;
        margin-bottom: 12px;
    }
    
    .act-acciones {
        margin-left: 0;
        margin-top: 12px;
        width: 100%;
        justify-content: flex-end;
    }
}

/* =================================================================
   SISTEMA DE NOTIFICACIONES
   ================================================================= */

/* Contenedor de notificaciones */
.notif-container {
    position: relative;
}

/* Botón de campana */
.notif-bell {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-bell:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.notif-bell.has-notifications {
    animation: bell-ring 0.5s ease-in-out;
}

@keyframes bell-ring {
    0%, 100% { transform: rotate(0); }
    20%, 60% { transform: rotate(15deg); }
    40%, 80% { transform: rotate(-15deg); }
}

/* Badge de notificaciones */
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Panel de notificaciones */
.notif-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 380px;
    max-height: 500px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.notif-panel.active {
    display: block;
    animation: slideDown 0.2s ease-out;
}

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

/* Flecha del panel */
.notif-panel::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 18px;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05);
}

/* Header del panel */
.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

.notif-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.notif-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Contenido del panel */
.notif-content {
    max-height: 360px;
    overflow-y: auto;
}

.notif-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.notif-loading i {
    margin-right: 8px;
}

/* Grupos de notificaciones */
.notif-group {
    border-bottom: 1px solid var(--gray-100);
}

.notif-group:last-child {
    border-bottom: none;
}

.notif-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--gray-50);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
}

.notif-group-header.overdue {
    background: #fef2f2;
    color: #991b1b;
}

.notif-group-header.today {
    background: #fffbeb;
    color: #92400e;
}

.notif-group-header.rotting {
    background: #fef2f2;
    color: #991b1b;
}

.notif-group-header .notif-count {
    margin-left: auto;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
}

/* Items de notificación */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.15s;
}

.notif-item:hover {
    background: var(--gray-50);
}

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

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.notif-icon.overdue {
    background: #fee2e2;
    color: #dc2626;
}

.notif-icon.today {
    background: #fef3c7;
    color: #f59e0b;
}

.notif-icon.rotting {
    background: #fee2e2;
    color: #dc2626;
}

.notif-icon.planned {
    background: #dbeafe;
    color: #3b82f6;
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-subtitle {
    font-size: 0.8rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-time {
    font-size: 0.75rem;
    color: var(--gray-400);
    flex-shrink: 0;
}

/* Estado vacío */
.notif-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.notif-empty i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.notif-empty p {
    margin: 0;
    font-size: 0.9rem;
}

/* Footer del panel */
.notif-footer {
    padding: 12px 20px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    text-align: center;
}

.notif-link {
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
}

.notif-link:hover {
    text-decoration: underline;
}

/* Resumen rápido en el panel */
.notif-summary {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.notif-summary-item {
    flex: 1;
    text-align: center;
    padding: 12px;
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.notif-summary-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.notif-summary-item.overdue {
    border-left: 3px solid #dc2626;
}

.notif-summary-item.today {
    border-left: 3px solid #f59e0b;
}

.notif-summary-item.rotting {
    border-left: 3px solid #dc2626;
}

.notif-summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
}

.notif-summary-item.overdue .notif-summary-value { color: #dc2626; }
.notif-summary-item.today .notif-summary-value { color: #f59e0b; }
.notif-summary-item.rotting .notif-summary-value { color: #dc2626; }

.notif-summary-label {
    font-size: 0.7rem;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-top: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .notif-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    
    .notif-panel::before {
        display: none;
    }
}

/* =================================================================
   TIMELINE / HISTORIAL
   ================================================================= */

.historial-container {
    padding: 0;
}

.historial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.historial-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.historial-title i {
    color: var(--primary);
}

.timeline-container {
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
}

.timeline-loading,
.timeline-error,
.timeline-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.timeline-loading i,
.timeline-empty i,
.timeline-error i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
    opacity: 0.5;
}

.timeline-error {
    color: var(--danger);
}

.timeline-empty p {
    margin: 0;
    font-size: 0.95rem;
}

/* Timeline estructura */
.timeline {
    position: relative;
    padding-left: 0;
}

.timeline-group {
    margin-bottom: 24px;
}

.timeline-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: capitalize;
    padding: 8px 12px;
    background: var(--gray-100);
    border-radius: var(--radius);
    margin-bottom: 12px;
    display: inline-block;
}

.timeline-items {
    position: relative;
    padding-left: 24px;
    border-left: 2px solid var(--gray-200);
    margin-left: 12px;
}

/* Timeline item */
.timeline-item {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 8px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-icon {
    position: absolute;
    left: -32px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--gray-500);
}

/* Colores por tipo */
.timeline-item.tipo-email .timeline-icon {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

.timeline-item.tipo-nota .timeline-icon {
    border-color: #f59e0b;
    color: #f59e0b;
    background: #fffbeb;
}

.timeline-item.tipo-etapa .timeline-icon {
    border-color: #8b5cf6;
    color: #8b5cf6;
    background: #f5f3ff;
}

.timeline-item.tipo-actividad .timeline-icon {
    border-color: #10b981;
    color: #10b981;
    background: #ecfdf5;
}

.timeline-item.tipo-documento .timeline-icon {
    border-color: #6366f1;
    color: #6366f1;
    background: #eef2ff;
}

.timeline-item.tipo-sistema .timeline-icon {
    border-color: var(--gray-400);
    color: var(--gray-500);
    background: var(--gray-100);
}

.timeline-content {
    flex: 1;
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 12px 16px;
    border: 1px solid var(--gray-200);
}

.timeline-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.timeline-tipo {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-500);
    letter-spacing: 0.5px;
}

.timeline-hora {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.timeline-subject {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.timeline-body {
    color: var(--gray-600);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-break: break-word;
}

.timeline-tracking {
    font-size: 0.8rem;
    color: var(--gray-500);
    padding: 6px 10px;
    background: white;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    display: inline-block;
}

.timeline-tracking i {
    margin-right: 4px;
    color: var(--primary);
}

.timeline-attachments {
    font-size: 0.8rem;
    color: #6366f1;
    margin-bottom: 8px;
}

.timeline-attachments i {
    margin-right: 4px;
}

.timeline-author {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.timeline-author i {
    margin-right: 4px;
}

/* Hover effect */
.timeline-content:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Responsive timeline */
@media (max-width: 768px) {
    .historial-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .timeline-items {
        padding-left: 20px;
        margin-left: 8px;
    }
    
    .timeline-icon {
        left: -28px;
        width: 16px;
        height: 16px;
        font-size: 0.5rem;
    }
    
    .timeline-content {
        padding: 10px 12px;
    }
    
    .timeline-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* =================================================================
   PÁGINA DE CONFIGURACIÓN COMERCIAL
   ================================================================= */

/* Tabs de configuración */
.config-tabs {
    display: flex;
    gap: 4px;
    padding: 0 20px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    overflow-x: auto;
}

.config-tab {
    padding: 16px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--gray-600);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-tab:hover {
    color: var(--primary);
    background: var(--gray-50);
}

.config-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.config-tab i {
    font-size: 1rem;
}

/* Contenido de configuración */
.config-content {
    padding: 24px 20px;
    min-height: calc(100vh - 180px);
    background: var(--gray-100);
}

.config-panel {
    display: none;
}

.config-panel.active {
    display: block;
}

/* Header del panel */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    background: white;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.panel-title h2 {
    font-size: 1.25rem;
    color: var(--gray-800);
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title h2 i {
    color: var(--primary);
}

.panel-title p {
    margin: 0;
    color: var(--gray-500);
    font-size: 0.9rem;
}

/* Lista de configuración */
.config-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.config-list.vendedores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* Cards de configuración */
.config-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.config-card:hover {
    box-shadow: var(--shadow-lg);
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.presupuesto-icon {
    background: linear-gradient(135deg, #10b981, #059669);
}

.card-body {
    flex: 1;
    min-width: 0;
}

.card-body h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0 0 6px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.card-details span {
    font-size: 0.85rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-details span i {
    color: var(--gray-400);
}

.card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Vendedor card */
.vendedor-card {
    flex-direction: row;
}

.vendedor-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    flex-shrink: 0;
}

.equipo-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem !important;
}

.equipo-badge.has-team {
    background: #ecfdf5;
    color: #059669;
}

.equipo-badge.no-team {
    background: #fef2f2;
    color: #dc2626;
}

/* Filtros */
.vendedores-filters,
.metas-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

/* Tabla de metas */
.metas-table {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.metas-table table {
    width: 100%;
    border-collapse: collapse;
}

.metas-table th,
.metas-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.metas-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metas-table td {
    font-size: 0.95rem;
    color: var(--gray-700);
}

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

.metas-table tr:hover td {
    background: var(--gray-50);
}

/* Presupuesto card */
.presupuesto-card {
    flex-direction: column;
    align-items: flex-start;
}

.presupuesto-card .card-body {
    width: 100%;
}

.presupuesto-desglose {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.q-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
    min-width: 80px;
}

.q-item span {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.q-item strong {
    font-size: 0.95rem;
    color: var(--gray-800);
    margin-top: 2px;
}

.q-item.total {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.q-item.total span,
.q-item.total strong {
    color: white;
}

.presupuesto-notas {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--gray-600);
    font-style: italic;
}

.presupuesto-card .card-actions {
    position: absolute;
    top: 20px;
    right: 20px;
}

.presupuesto-card {
    position: relative;
}

/* Modal presupuesto grid */
.presupuesto-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.presupuesto-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius);
    color: white;
    margin-bottom: 20px;
}

.presupuesto-total label {
    font-weight: 600;
}

.presupuesto-total span {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Radio group */
.radio-group {
    display: flex;
    gap: 20px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--gray-700);
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Form row */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Input readonly */
.input-readonly {
    background: var(--gray-100) !important;
    cursor: not-allowed;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.empty-state i {
    font-size: 3rem;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 20px;
}

/* Loading placeholder */
.loading-placeholder {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}

/* Modal sizes */
.modal-sm {
    max-width: 480px;
}

.modal-md {
    max-width: 600px;
}

/* Form hint */
.form-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Button danger outline */
.btn-outline.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-outline.btn-danger:hover {
    background: var(--danger);
    color: white;
}

/* Responsive configuración */
@media (max-width: 768px) {
    .config-tabs {
        padding: 0 12px;
    }
    
    .config-tab {
        padding: 12px 16px;
        font-size: 0.85rem;
    }
    
    .config-tab span {
        display: none;
    }
    
    .config-content {
        padding: 16px 12px;
    }
    
    .panel-header {
        flex-direction: column;
        gap: 16px;
    }
    
    .config-list.vendedores-grid {
        grid-template-columns: 1fr;
    }
    
    .presupuesto-grid,
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .presupuesto-desglose {
        justify-content: space-between;
    }
    
    .q-item {
        min-width: 60px;
        padding: 8px 12px;
    }
    
    .metas-table {
        overflow-x: auto;
    }
}

/* =================================================================
   WIDGET DE META DEL PERÍODO
   ================================================================= */

.meta-periodo-widget {
    background: linear-gradient(135deg, #1a365d 0%, #2d3748 100%);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 0 16px 20px 16px;
    color: white;
    box-shadow: var(--shadow-lg);
}

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

.meta-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.meta-title i {
    color: #f6ad55;
    font-size: 20px;
}

.meta-periodo-selector {
    display: flex;
    gap: 10px;
}

.meta-periodo-selector select {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
}

.meta-periodo-selector select option {
    background: #2d3748;
    color: white;
}

/* Barra de progreso */
.meta-progress-section {
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.meta-progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.meta-progress-label {
    font-size: 14px;
    opacity: 0.9;
}

.meta-progress-percent {
    font-size: 24px;
    font-weight: 700;
    color: #68d391;
}

.meta-progress-bar {
    height: 24px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.meta-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #48bb78, #38a169);
    border-radius: 12px;
    transition: width 0.5s ease;
}

.meta-progress-fill.danger {
    background: linear-gradient(90deg, #fc8181, #f56565);
}

.meta-progress-fill.warning {
    background: linear-gradient(90deg, #f6ad55, #ed8936);
}

.meta-progress-fill.success {
    background: linear-gradient(90deg, #48bb78, #38a169);
}

.meta-progress-pipeline {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(99, 179, 237, 0.5);
    border-radius: 12px;
    transition: all 0.5s ease;
}

.meta-progress-legend {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    font-size: 12px;
}

.meta-progress-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-ganado i {
    color: #48bb78;
}

.legend-pipeline i {
    color: #63b3ed;
}

/* Métricas */
.meta-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.meta-metric {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.1);
    padding: 16px;
    border-radius: var(--radius);
}

.meta-metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.meta-metric-icon.target {
    background: rgba(246, 173, 85, 0.2);
    color: #f6ad55;
}

.meta-metric-icon.won {
    background: rgba(72, 187, 120, 0.2);
    color: #48bb78;
}

.meta-metric-icon.pipeline {
    background: rgba(99, 179, 237, 0.2);
    color: #63b3ed;
}

.meta-metric-icon.gap {
    background: rgba(252, 129, 129, 0.2);
    color: #fc8181;
}

.meta-metric-data {
    flex: 1;
}

.meta-metric-value {
    font-size: 20px;
    font-weight: 700;
}

.meta-metric-label {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
}

/* Proyección */
.meta-projection {
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius);
    padding: 16px;
}

.meta-projection-header {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-projection-header i {
    color: #d69e2e;
}

.meta-projection-content {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

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

.projection-label {
    font-size: 13px;
    opacity: 0.8;
}

.projection-value {
    font-weight: 600;
}

.projection-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.projection-badge.success {
    background: rgba(72, 187, 120, 0.3);
    color: #9ae6b4;
}

.projection-badge.warning {
    background: rgba(246, 173, 85, 0.3);
    color: #fbd38d;
}

.projection-badge.danger {
    background: rgba(252, 129, 129, 0.3);
    color: #feb2b2;
}

/* Estado vacío */
.meta-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.meta-empty i {
    font-size: 40px;
    opacity: 0.5;
    margin-bottom: 16px;
}

.meta-empty p {
    margin-bottom: 16px;
    opacity: 0.8;
}

.meta-empty .btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
}

.meta-empty .btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Responsive */
@media (max-width: 1024px) {
    .meta-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .meta-periodo-widget {
        margin: 0 10px 16px 10px;
        padding: 16px;
    }
    
    .meta-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .meta-metrics {
        grid-template-columns: 1fr;
    }
    
    .meta-projection-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .meta-metric-value {
        font-size: 16px;
    }
}

/* =================================================================
   LEADERBOARD DE VENDEDORES
   ================================================================= */

.leaderboard-section {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d4a6f 50%, #1a365d 100%);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 0 16px 20px 16px;
    color: white;
    box-shadow: var(--shadow-lg);
}

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

.leaderboard-title {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.leaderboard-title i {
    color: #fbbf24;
    font-size: 24px;
}

.leaderboard-periodo {
    background: rgba(255,255,255,0.15);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* Podium */
.leaderboard-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px 0;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 140px;
}

.podium-gold {
    order: 2;
}

.podium-silver {
    order: 1;
}

.podium-bronze {
    order: 3;
}

.podium-crown {
    position: absolute;
    top: -30px;
    font-size: 24px;
    color: #fbbf24;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.podium-position {
    position: absolute;
    top: -10px;
    right: -5px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    z-index: 2;
}

.podium-gold .podium-position {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a1a;
}

.podium-silver .podium-position {
    background: linear-gradient(135deg, #e5e7eb, #9ca3af);
    color: #1a1a1a;
}

.podium-bronze .podium-position {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: white;
}

.podium-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    margin-bottom: 8px;
    border: 3px solid rgba(255,255,255,0.3);
}

.podium-gold .podium-avatar {
    width: 80px;
    height: 80px;
    font-size: 26px;
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.2);
}

.podium-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    text-align: center;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.podium-stats {
    text-align: center;
    width: 100%;
}

.podium-amount {
    font-size: 18px;
    font-weight: 700;
    color: #68d391;
}

.podium-gold .podium-amount {
    font-size: 22px;
}

.podium-progress {
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    margin: 8px 0;
    overflow: hidden;
}

.podium-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, #fc8181, #f56565);
}

.podium-progress-bar.warning {
    background: linear-gradient(90deg, #f6ad55, #ed8936);
}

.podium-progress-bar.success {
    background: linear-gradient(90deg, #68d391, #48bb78);
}

.podium-pct {
    font-size: 12px;
    opacity: 0.9;
}

.podium-pedestal {
    width: 100%;
    border-radius: 8px 8px 0 0;
    margin-top: 12px;
}

.podium-pedestal.gold {
    height: 80px;
    background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
}

.podium-pedestal.silver {
    height: 60px;
    background: linear-gradient(180deg, #e5e7eb 0%, #9ca3af 100%);
}

.podium-pedestal.bronze {
    height: 45px;
    background: linear-gradient(180deg, #d97706 0%, #92400e 100%);
}

/* Tabla del Leaderboard */
.leaderboard-table-container {
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 16px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table thead {
    background: rgba(0,0,0,0.2);
}

.leaderboard-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
    font-weight: 500;
}

.leaderboard-table th.col-rank,
.leaderboard-table th.col-ops {
    text-align: center;
    width: 60px;
}

.leaderboard-table th.col-meta,
.leaderboard-table th.col-ganado,
.leaderboard-table th.col-pipeline {
    text-align: right;
    width: 100px;
}

.leaderboard-table th.col-progreso {
    width: 150px;
}

.leaderboard-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: background 0.2s ease;
}

.leaderboard-table tbody tr:hover {
    background: rgba(255,255,255,0.05);
}

.leaderboard-table tbody tr.row-gold {
    background: rgba(251, 191, 36, 0.1);
}

.leaderboard-table tbody tr.row-silver {
    background: rgba(156, 163, 175, 0.1);
}

.leaderboard-table tbody tr.row-bronze {
    background: rgba(217, 119, 6, 0.1);
}

.leaderboard-table td {
    padding: 14px 16px;
    font-size: 14px;
}

.leaderboard-table td.col-rank {
    text-align: center;
    font-weight: 700;
}

.leaderboard-table td.col-meta,
.leaderboard-table td.col-ganado,
.leaderboard-table td.col-pipeline {
    text-align: right;
}

.leaderboard-table td.col-ops {
    text-align: center;
    opacity: 0.8;
}

.leaderboard-table .medal {
    margin-right: 8px;
}

.leaderboard-table .medal.gold i {
    color: #fbbf24;
}

.leaderboard-table .medal.silver i {
    color: #9ca3af;
}

.leaderboard-table .medal.bronze i {
    color: #d97706;
}

.vendedor-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vendedor-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

.vendedor-nombre {
    font-weight: 500;
}

.no-meta {
    opacity: 0.5;
    font-style: italic;
    font-size: 12px;
}

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

.mini-progress {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    overflow: hidden;
}

.mini-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.mini-progress-bar.danger {
    background: linear-gradient(90deg, #fc8181, #f56565);
}

.mini-progress-bar.warning {
    background: linear-gradient(90deg, #f6ad55, #ed8936);
}

.mini-progress-bar.success {
    background: linear-gradient(90deg, #68d391, #48bb78);
}

.progress-pct {
    min-width: 45px;
    text-align: right;
    font-weight: 600;
    font-size: 13px;
}

.progress-pct.danger {
    color: #fc8181;
}

.progress-pct.warning {
    color: #f6ad55;
}

.progress-pct.success {
    color: #68d391;
}

/* Estado vacío */
.leaderboard-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    text-align: center;
}

.leaderboard-empty i {
    font-size: 48px;
    opacity: 0.4;
    margin-bottom: 16px;
}

.leaderboard-empty p {
    opacity: 0.7;
    margin-bottom: 16px;
}

.btn-outline-light {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-outline-light:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.6);
}

/* Responsive */
@media (max-width: 1024px) {
    .leaderboard-podium {
        gap: 10px;
    }
    
    .podium-item {
        min-width: 100px;
    }
    
    .podium-gold .podium-avatar {
        width: 60px;
        height: 60px;
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .leaderboard-section {
        margin: 0 10px 16px 10px;
        padding: 16px;
    }
    
    .leaderboard-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .leaderboard-podium {
        flex-wrap: wrap;
    }
    
    .podium-item {
        min-width: 80px;
    }
    
    .podium-pedestal.gold {
        height: 50px;
    }
    
    .podium-pedestal.silver {
        height: 40px;
    }
    
    .podium-pedestal.bronze {
        height: 30px;
    }
    
    .leaderboard-table-container {
        overflow-x: auto;
    }
    
    .leaderboard-table {
        min-width: 600px;
    }
}

/* =================================================================
   SISTEMA DE EMAILS
   ================================================================= */

/* Tab de Emails */
.emails-container {
    padding: 0;
}

.emails-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    border-radius: var(--radius) var(--radius) 0 0;
}

.emails-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.emails-title i {
    color: var(--secondary);
}

.emails-actions {
    display: flex;
    gap: 8px;
}

/* Panel de plantillas en configuración */
.plantillas-info-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.info-card {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.info-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #e3f2fd;
    color: #1976d2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.info-icon.whatsapp {
    background: #e8f5e9;
    color: #25d366;
}

.info-icon.variables {
    background: #fff3e0;
    color: #f57c00;
}

.info-content h4 {
    margin: 0 0 6px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
}

.info-content p {
    margin: 0;
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.5;
}

.plantillas-uso {
    background: #f8f9fa;
    border-radius: var(--radius);
    padding: 20px;
    border-left: 4px solid var(--secondary);
}

.plantillas-uso h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.plantillas-uso ol {
    margin: 0;
    padding-left: 20px;
}

.plantillas-uso li {
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.5;
}

.plantillas-uso li:last-child {
    margin-bottom: 0;
}

/* Filtros de plantillas en configuración */
.plantillas-filtros-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    gap: 20px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 16px;
}

.filtros-grupo {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.filtro-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filtro-item label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
}

.filtro-item select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    background: white;
    min-width: 140px;
}

.filtros-busqueda {
    position: relative;
}

.filtros-busqueda input {
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    width: 250px;
}

.filtros-busqueda i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

/* Tabla de plantillas */
.plantillas-table {
    width: 100%;
    border-collapse: collapse;
}

.plantillas-table th,
.plantillas-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.plantillas-table th {
    background: var(--gray-50);
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
}

.plantillas-table tr:hover {
    background: var(--gray-50);
}

/* Badges de canal */
.canal-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.canal-badge.canal-email {
    background: #e3f2fd;
    color: #1976d2;
}

.canal-badge.canal-whatsapp {
    background: #e8f5e9;
    color: #25d366;
}

/* Badges de momento */
.momento-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Badges de estado */
.estado-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.estado-badge.activa {
    background: #d4edda;
    color: #155724;
}

.estado-badge.inactiva {
    background: #f8d7da;
    color: #721c24;
}

/* Botón danger light */
.btn-danger-light {
    background: transparent;
    color: var(--gray-500);
}

.btn-danger-light:hover {
    background: #ffebee;
    color: #c62828;
}

/* Panel de variables */
.variables-panel {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px;
    margin-top: 16px;
}

.variables-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.variables-header small {
    font-weight: 400;
    color: var(--gray-400);
}

.variables-lista {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.variable-tag {
    display: inline-block;
    padding: 4px 10px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    color: var(--secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.variable-tag:hover {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

/* Toggle switch en configuración */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 6px;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    display: inline-block;
}

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

.toggle-slider-switch {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-300);
    border-radius: 26px;
    transition: 0.2s;
}

.toggle-slider-switch:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle-switch input:checked + .toggle-slider-switch {
    background: var(--success);
}

.toggle-switch input:checked + .toggle-slider-switch:before {
    transform: translateX(22px);
}

/* Modal grande */
.modal-lg {
    max-width: 700px;
}

/* Lista de emails */
.emails-lista {
    max-height: 500px;
    overflow-y: auto;
}

.emails-list {
    padding: 0;
}

.email-item {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    transition: background 0.2s ease;
}

.email-item:hover {
    background: var(--gray-50);
}

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

.email-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.email-enviado .email-icon {
    background: rgba(39, 174, 96, 0.15);
    color: var(--success);
}

.email-recibido .email-icon {
    background: rgba(52, 152, 219, 0.15);
    color: var(--secondary);
}

.email-content {
    flex: 1;
    min-width: 0;
}

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

.email-tipo {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.email-enviado .email-tipo {
    color: var(--success);
}

.email-recibido .email-tipo {
    color: var(--secondary);
}

.email-fecha {
    font-size: 12px;
    color: var(--gray-500);
}

.email-asunto {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-de {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.email-preview {
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.email-adjuntos {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.email-adjuntos i {
    color: var(--gray-400);
}

.email-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.email-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
}

/* Estado vacío */
.emails-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--gray-500);
}

.emails-empty i {
    font-size: 48px;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.emails-empty p {
    margin: 0;
}

.emails-empty .hint {
    font-size: 13px;
    margin-top: 8px;
}

.emails-error {
    padding: 40px 20px;
    text-align: center;
    color: var(--danger);
}

.loading-emails {
    padding: 40px 20px;
    text-align: center;
    color: var(--gray-500);
}

/* Modal de Email */
.modal-email {
    max-width: 650px;
}

.modal-email .form-control {
    width: 100%;
}

.modal-email textarea {
    resize: vertical;
    min-height: 150px;
    font-family: inherit;
    line-height: 1.5;
}

/* Área de adjuntos */
.email-adjuntos-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.email-adjuntos-area .hint {
    font-size: 12px;
    color: var(--gray-500);
}

.email-adjuntos-lista {
    margin-top: 8px;
}

.adjuntos-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.adjunto-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.adjunto-chip i {
    color: var(--secondary);
}

.adjunto-nombre {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adjunto-size {
    color: var(--gray-500);
    font-size: 11px;
}

.adjunto-remove {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.adjunto-remove:hover {
    background: var(--danger);
    color: white;
}

/* Vista previa de firma */
.email-firma-preview {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 13px;
    max-height: 200px;
    overflow-y: auto;
}

.email-firma-preview table {
    font-size: 13px;
}

/* Modal ver email completo */
.email-detail-meta {
    background: var(--gray-50);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.email-detail-meta p {
    margin: 4px 0;
    font-size: 14px;
}

.email-detail-body {
    padding: 16px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
}

.email-detail-body img {
    max-width: 100%;
    height: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .emails-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .email-actions {
        flex-wrap: wrap;
    }
    
    .modal-email {
        max-width: 100%;
        margin: 10px;
    }
}

/* =================================================================
   SISTEMA DE SCORING
   ================================================================= */

/* Variables de colores para temperaturas */
.score-hot { --score-color: #e74c3c; }
.score-warm { --score-color: #27ae60; }
.score-mild { --score-color: #f39c12; }
.score-cold { --score-color: #3498db; }
.score-frozen { --score-color: #95a5a6; }

/* Badge de score en tarjetas del pipeline */
.card-score {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: var(--score-color);
    color: white;
    margin-left: auto;
    margin-right: 4px;
}

.card-score .score-emoji {
    font-size: 10px;
}

.card-score .score-value {
    min-width: 16px;
    text-align: center;
}

/* Colores de fondo para badges */
.card-score.score-hot { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.card-score.score-warm { background: linear-gradient(135deg, #27ae60, #1e8449); }
.card-score.score-mild { background: linear-gradient(135deg, #f39c12, #d68910); }
.card-score.score-cold { background: linear-gradient(135deg, #3498db, #2980b9); }
.card-score.score-frozen { background: linear-gradient(135deg, #95a5a6, #7f8c8d); }

/* Widget de score en header del modal */
.header-score-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--score-color);
    border-radius: var(--radius);
    color: white;
    margin-right: 16px;
}

.header-score-widget.score-hot { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.header-score-widget.score-warm { background: linear-gradient(135deg, #27ae60, #1e8449); }
.header-score-widget.score-mild { background: linear-gradient(135deg, #f39c12, #d68910); }
.header-score-widget.score-cold { background: linear-gradient(135deg, #3498db, #2980b9); }
.header-score-widget.score-frozen { background: linear-gradient(135deg, #95a5a6, #7f8c8d); }

.score-circle {
    display: flex;
    align-items: baseline;
}

.score-number {
    font-size: 24px;
    font-weight: 700;
}

.score-max {
    font-size: 12px;
    opacity: 0.8;
}

.score-label {
    font-size: 13px;
    font-weight: 500;
}

/* =================================================================
   TAB SCORE - Contenido detallado
   ================================================================= */

.score-detail-container {
    padding: 16px;
}

/* Header con score total */
.score-total-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px;
    background: var(--score-color);
    border-radius: var(--radius-lg);
    color: white;
    margin-bottom: 24px;
}

.score-total-header.score-hot { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.score-total-header.score-warm { background: linear-gradient(135deg, #27ae60, #1e8449); }
.score-total-header.score-mild { background: linear-gradient(135deg, #f39c12, #d68910); }
.score-total-header.score-cold { background: linear-gradient(135deg, #3498db, #2980b9); }
.score-total-header.score-frozen { background: linear-gradient(135deg, #95a5a6, #7f8c8d); }

.score-total-circle {
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.score-total-number {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.score-total-max {
    font-size: 12px;
    opacity: 0.8;
}

.score-total-info {
    flex: 1;
}

.score-total-temp {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.score-total-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.score-bar-label {
    width: 35px;
    font-size: 12px;
    font-weight: 600;
    opacity: 0.9;
}

.score-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.score-bar-value {
    width: 45px;
    font-size: 12px;
    text-align: right;
    opacity: 0.9;
}

/* Desglose en columnas */
.score-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.score-column {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
}

.score-column h4 {
    margin: 0 0 16px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.score-column h4 i {
    color: var(--secondary);
}

.score-factors {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-factor-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: var(--gray-50);
    border-radius: var(--radius);
    font-size: 13px;
}

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

.factor-info i.ok {
    color: var(--success);
}

.factor-info i.warn {
    color: var(--warning);
}

.factor-name {
    font-weight: 500;
    color: var(--gray-700);
}

.factor-value {
    color: var(--gray-600);
    font-size: 12px;
}

.factor-points {
    font-weight: 600;
    color: var(--primary);
    min-width: 45px;
    text-align: right;
}

.score-subtotal {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
    text-align: right;
    font-size: 13px;
    color: var(--gray-600);
}

.score-subtotal strong {
    color: var(--primary);
}

/* Sugerencias */
.score-suggestions {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.score-suggestions h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestions-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.suggestions-list li {
    padding: 8px 0;
    font-size: 13px;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestions-list li + li {
    border-top: 1px dashed rgba(133, 100, 4, 0.3);
}

.suggestions-list li i {
    width: 16px;
    text-align: center;
}

.suggestion-action i { color: var(--success); }
.suggestion-warning i { color: var(--danger); }
.suggestion-info i { color: var(--info); }

/* Leyenda */
.score-legend {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 12px 16px;
}

.score-legend h5 {
    margin: 0 0 10px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.legend-item {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--score-color);
    color: white;
}

.legend-item.score-hot { background: #e74c3c; }
.legend-item.score-warm { background: #27ae60; }
.legend-item.score-mild { background: #f39c12; }
.legend-item.score-cold { background: #3498db; }
.legend-item.score-frozen { background: #95a5a6; }

/* =================================================================
   WIDGET DISTRIBUCIÓN DE SCORES EN DASHBOARD
   ================================================================= */

.score-distribution-widget {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.score-distribution-widget h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.distribution-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.distribution-row {
    display: grid;
    grid-template-columns: 100px 1fr 80px 100px;
    align-items: center;
    gap: 12px;
}

.dist-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.dist-label .emoji {
    font-size: 14px;
}

.dist-bar-container {
    height: 24px;
    background: var(--gray-100);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.dist-bar {
    height: 100%;
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding-left: 8px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    min-width: fit-content;
    transition: width 0.5s ease;
}

.dist-bar.score-hot { background: linear-gradient(90deg, #e74c3c, #c0392b); }
.dist-bar.score-warm { background: linear-gradient(90deg, #27ae60, #1e8449); }
.dist-bar.score-mild { background: linear-gradient(90deg, #f39c12, #d68910); }
.dist-bar.score-cold { background: linear-gradient(90deg, #3498db, #2980b9); }
.dist-bar.score-frozen { background: linear-gradient(90deg, #95a5a6, #7f8c8d); }

.dist-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    text-align: center;
}

.dist-amount {
    font-size: 12px;
    color: var(--gray-600);
    text-align: right;
}

/* Responsive para score */
@media (max-width: 768px) {
    .score-breakdown {
        grid-template-columns: 1fr;
    }
    
    .score-total-header {
        flex-direction: column;
        text-align: center;
    }
    
    .score-total-bars {
        width: 100%;
    }
    
    .header-score-widget {
        display: none;
    }
    
    .distribution-row {
        grid-template-columns: 80px 1fr 60px;
    }
    
    .dist-amount {
        display: none;
    }
}

/* =================================================================
   REDISEÑO TABS CON ICONOS
   ================================================================= */

.detail-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 0 0 12px 0;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.detail-tabs::-webkit-scrollbar {
    height: 4px;
}

.detail-tabs::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 2px;
}

.detail-tabs::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

.detail-tabs .tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.detail-tabs .tab-btn i {
    font-size: 14px;
}

.detail-tabs .tab-btn:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.detail-tabs .tab-btn.active {
    background: var(--secondary);
    color: white;
}

/* En pantallas pequeñas, ocultar texto y solo mostrar iconos */
@media (max-width: 900px) {
    .detail-tabs .tab-btn {
        padding: 8px 10px;
    }
    
    .detail-tabs .tab-btn span {
        display: none;
    }
    
    .detail-tabs .tab-btn i {
        font-size: 16px;
    }
}

/* =================================================================
   WIDGET DE SCORE CLICKEABLE
   ================================================================= */

.header-score-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--score-color);
    border-radius: var(--radius);
    color: white;
    margin-right: 12px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.header-score-widget:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.header-score-widget .score-toggle-icon {
    font-size: 10px;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.header-score-widget.expanded .score-toggle-icon {
    transform: rotate(180deg);
}

.header-score-widget .score-circle {
    display: flex;
    align-items: baseline;
}

.header-score-widget .score-number {
    font-size: 22px;
    font-weight: 700;
}

.header-score-widget .score-max {
    font-size: 11px;
    opacity: 0.8;
}

.header-score-widget .score-label {
    font-size: 12px;
    font-weight: 500;
}

/* =================================================================
   PANEL DE SCORE EXPANDIBLE
   ================================================================= */

.score-panel-expandible {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.score-panel-content {
    padding: 16px 20px;
}

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

.score-panel-col {
    background: white;
    border-radius: var(--radius);
    padding: 12px;
    border: 1px solid var(--gray-200);
}

.score-panel-col-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--gray-100);
}

.score-panel-col-header i {
    color: var(--secondary);
}

.score-panel-subtotal {
    margin-left: auto;
    font-size: 12px;
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--gray-600);
}

.score-panel-factors {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.score-panel-factor {
    display: grid;
    grid-template-columns: 18px 1fr auto 50px;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 6px 8px;
    background: var(--gray-50);
    border-radius: 4px;
}

.score-panel-factor i.ok {
    color: var(--success);
}

.score-panel-factor i.warn {
    color: var(--warning);
}

.score-panel-factor .factor-name {
    font-weight: 500;
    color: var(--gray-700);
}

.score-panel-factor .factor-value {
    color: var(--gray-500);
    font-size: 11px;
    text-align: right;
}

.score-panel-factor .factor-pts {
    font-weight: 600;
    color: var(--primary);
    text-align: right;
}

.score-panel-suggestions {
    margin-top: 12px;
    padding: 10px 12px;
    background: #fff3cd;
    border-radius: var(--radius);
    font-size: 12px;
    color: #856404;
}

.score-panel-suggestions i {
    color: #d39e00;
}

/* Responsive panel */
@media (max-width: 768px) {
    .score-panel-columns {
        grid-template-columns: 1fr;
    }
    
    .score-panel-factor {
        grid-template-columns: 18px 1fr 40px;
    }
    
    .score-panel-factor .factor-value {
        display: none;
    }
}

/* =================================================================
   MODAL PLANTILLAS DE MENSAJE
   ================================================================= */

.modal-plantillas {
    max-width: 900px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-plantillas .modal-header {
    flex-shrink: 0;
}

.modal-plantillas .modal-body {
    padding: 0;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.plantillas-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
    flex: 1;
    min-height: 400px;
    max-height: 60vh;
    overflow: hidden;
}

.plantillas-filtros {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
    grid-column: 1 / -1;
}

.plantillas-filtros .filtro-grupo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.plantillas-filtros label {
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-600);
    white-space: nowrap;
}

.plantillas-filtros select {
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    background: white;
    min-width: 120px;
}

.plantillas-lista {
    border-right: 1px solid var(--gray-200);
    overflow-y: auto;
    background: white;
    min-height: 0;
}

.plantillas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--gray-500);
    text-align: center;
}

.plantillas-empty i {
    font-size: 32px;
    margin-bottom: 12px;
}

.plantilla-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: var(--transition);
}

.plantilla-item:hover {
    background: var(--gray-50);
}

.plantilla-item.selected {
    background: #e3f2fd;
    border-left: 3px solid var(--secondary);
}

.plantilla-icono {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.plantilla-icono.icon-email {
    background: #e3f2fd;
    color: #1976d2;
}

.plantilla-icono.icon-whatsapp {
    background: #e8f5e9;
    color: #25d366;
}

.plantilla-info {
    flex: 1;
    min-width: 0;
}

.plantilla-nombre {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plantilla-meta {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 2px;
}

.plantilla-preview {
    padding: 20px;
    overflow-y: auto;
    background: var(--gray-50);
    min-height: 0;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--gray-400);
    text-align: center;
}

.preview-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.preview-canal {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.preview-canal.email {
    background: #e3f2fd;
    color: #1976d2;
}

.preview-canal.whatsapp {
    background: #e8f5e9;
    color: #25d366;
}

.preview-nombre {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
}

.preview-asunto {
    margin-bottom: 16px;
}

.preview-asunto label,
.preview-cuerpo label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.preview-asunto input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
}

.preview-cuerpo textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 200px;
}

.preview-acciones {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.preview-acciones .btn {
    flex: 1;
}

.preview-acciones .btn-success {
    background: #25d366;
    border-color: #25d366;
}

.preview-acciones .btn-success:hover {
    background: #128c7e;
    border-color: #128c7e;
}

.preview-notas {
    margin-top: 16px;
    padding: 10px 12px;
    background: #fff8e1;
    border-radius: var(--radius);
    font-size: 12px;
    color: #f57c00;
}

.preview-notas i {
    margin-right: 6px;
}

.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--gray-500);
    grid-column: 1 / -1;
}

.loading-placeholder i {
    font-size: 32px;
    margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .plantillas-container {
        grid-template-columns: 1fr;
        height: auto;
        max-height: 70vh;
    }
    
    .plantillas-lista {
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
        max-height: 200px;
    }
    
    .plantilla-preview {
        min-height: 300px;
    }
    
    .preview-acciones {
        flex-direction: column;
    }
}

/* Agrupador Lista */
.grupo-header-td {
    padding: 10px 16px !important;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-bottom: 2px solid var(--gray-300);
}

.grupo-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.grupo-totales {
    display: flex;
    gap: 24px;
    align-items: center;
    white-space: nowrap;
}