/**
 * sensitivity.css
 * Estilos para el Motor de Sensibilidad, Ranking Tornado y Simulador What-If
 * Minera Centinela × Alert2Gain
 */

/* ==========================================================================
   1. BACKDROP & MODAL BASE
   ========================================================================== */
.cp-sens-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.cp-sens-backdrop.open {
    display: flex;
    opacity: 1;
}

.cp-sens-modal {
    position: relative;
    z-index: 100000;
    width: 1400px;
    max-width: 96vw;
    max-height: 92vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.97);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid #cbd5e1;
}

.cp-sens-backdrop.open .cp-sens-modal {
    transform: scale(1);
}

/* ==========================================================================
   2. CABECERA & NAVEGACIÓN DE TABS
   ========================================================================== */
.cp-sens-header {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.cp-sens-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: 4px;
    margin-bottom: 2px;
}

.cp-sens-title {
    font-size: 1.12rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}

.cp-sens-subtitle {
    font-size: 0.76rem;
    color: #64748b;
    margin: 2px 0 0 0;
    max-width: 780px;
}

.cp-sens-close-btn {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}

.cp-sens-close-btn:hover {
    color: #0f172a;
    background: #e2e8f0;
}

/* Tabs */
.cp-sens-nav-tabs {
    display: none !important;
}

/* Barra Superior de Navegación del Simulador */
.cp-sim-top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.cp-sim-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    color: #1e293b;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 7px 15px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.18s ease;
}

.cp-sim-back-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0284c7;
    transform: translateX(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.cp-sim-back-btn .back-arrow {
    font-size: 0.95rem;
    transition: transform 0.18s ease;
}

.cp-sim-back-btn:hover .back-arrow {
    transform: translateX(-3px);
}

.cp-sim-top-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cp-sim-top-info .sim-badge-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: -0.01em;
}

/* ==========================================================================
   3. CONTENIDO & TOOLBAR
   ========================================================================== */
.cp-sens-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    background: #ffffff;
}

.cp-sens-pane {
    display: none;
}

.cp-sens-pane.active {
    display: block;
}

.cp-sens-toolbar {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 14px;
}

.cp-sens-toolbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
}

.cp-sens-filter-row {
    padding-top: 10px;
    border-top: 1px dashed #cbd5e1;
}

.cp-sens-criterio-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cp-sens-filter-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.cp-sens-filter-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cp-sens-filter-label {
    font-size: 0.74rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cp-sens-pill-switcher,
.cp-sens-scope-switcher {
    display: flex;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 8px;
    gap: 4px;
}

.cp-sens-pill,
.cp-sens-scope-btn {
    padding: 5px 12px;
    border: none;
    background: transparent;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cp-sens-pill.active,
.cp-sens-scope-btn.active {
    background: #ffffff;
    color: #0284c7;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.cp-sens-select {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.78rem;
    color: #334155;
    cursor: pointer;
    outline: none;
    font-weight: 500;
}

.cp-sens-select:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.cp-sens-filter-toggle {
    margin-left: 4px;
}

.cp-sens-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #475569;
    background: #f1f5f9;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
}

.cp-sens-toggle-label:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.cp-sens-toggle-label.active,
.cp-sens-toggle-label:has(input:checked) {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #7dd3fc;
    font-weight: 700;
}

.cp-sens-checkbox {
    cursor: pointer;
    accent-color: #0284c7;
    width: 14px;
    height: 14px;
}

.cp-sens-counter-badge {
    font-size: 0.74rem;
    color: #475569;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.cp-sens-counter-badge strong {
    color: #0284c7;
}

.cp-sens-item-depth {
    font-size: 0.67rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #64748b;
    padding: 1px 6px;
    border-radius: 4px;
}

.cp-sens-item-leaf {
    font-size: 0.67rem;
    font-weight: 700;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    padding: 1px 6px;
    border-radius: 4px;
}

.cp-sens-empty {
    text-align: center;
    padding: 48px 20px;
    color: #64748b;
    font-size: 0.9rem;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    margin: 20px 0;
}

/* ==========================================================================
/* ==========================================================================
   3.1 SELECTOR DE MODO TEMPORAL EN TOOLBAR
   ========================================================================== */
.cp-sens-horizon-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 10px;
    border-bottom: 1px dashed #cbd5e1;
}

.cp-sens-horizon-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cp-sens-horizon-switcher {
    display: inline-flex;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 8px;
    gap: 4px;
}

.cp-sens-h-btn {
    padding: 5px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    color: #475569;
}

.cp-sens-h-btn .h-name {
    font-size: 0.8rem;
    font-weight: 700;
}

.cp-sens-h-btn .h-desc {
    font-size: 0.67rem;
    font-weight: 500;
    color: #64748b;
}

.cp-sens-h-btn:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.6);
}

.cp-sens-h-btn.active {
    background: #ffffff;
    color: #0284c7;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.cp-sens-h-btn.active .h-name {
    color: #0284c7;
}

.cp-sens-h-btn.active .h-desc {
    color: #0284c7;
    font-weight: 600;
}

.cp-sens-criterio-row {
    padding-bottom: 4px;
}

/* ==========================================================================
   4. TARJETA DE RESUMEN COMPACTO (ACTUAL VS META UNIFICADO)
   ========================================================================== */
.cp-sens-summary-compact {
    margin-bottom: 12px;
}

.cp-sens-summary-bar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cp-sens-sum-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cp-sens-sum-values {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.cp-sens-sum-actual strong {
    color: #0284c7;
    font-weight: 800;
}

.cp-sens-sum-target strong {
    color: #334155;
    font-weight: 700;
}

.lbl-dim {
    font-size: 0.75rem;
    color: #64748b;
    margin-right: 3px;
    font-weight: 500;
}

.cp-sens-sum-divider {
    color: #cbd5e1;
    font-weight: 300;
    font-size: 1rem;
}

.cp-sens-sum-sub {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-left: auto;
    font-style: italic;
}

/* Botones de solo icono en toolbar (Filtros y Ayuda) */
.cp-icon-only-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    transition: all 0.15s ease;
}

.cp-icon-only-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
    transform: translateY(-1px);
}

.cp-icon-only-btn.active {
    background: #e0f2fe;
    border-color: #0284c7;
    color: #0284c7;
}

.cp-sens-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Botones 'Ir al árbol' */
.btn-item-goto-tree {
    padding: 6px 12px;
    font-size: 0.76rem;
    font-weight: 600;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #15803d;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-item-goto-tree:hover {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
}

.btn-quick-step.btn-go-to-tree {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
    font-weight: 700;
}

.btn-quick-step.btn-go-to-tree:hover {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
}

.cp-sens-item-action {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   4.1 CABECERA DE LA SECCIÓN DE RANKING & INDICADOR DE FILTROS
   ========================================================================== */
.cp-sens-ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 12px;
}

.cp-sens-ranking-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ranking-header-icon {
    font-size: 1.1rem;
}

.ranking-header-text {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
}

.ranking-horizon-pill {
    font-size: 0.7rem;
    font-weight: 700;
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
}

.ranking-criterion-pill {
    font-size: 0.7rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 2px 8px;
    border-radius: 12px;
}

.cp-sens-counter-badge {
    font-size: 0.76rem;
    color: #334155;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.cp-sens-counter-badge strong {
    color: #0284c7;
    font-weight: 700;
}

/* ==========================================================================
   5. LISTA DE RANKING DE PALANCAS (SIN BARRAS CONFUSAS)
   ========================================================================== */
.cp-sens-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cp-sens-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.18s ease;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.cp-sens-item:hover {
    border-color: #0284c7;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.1);
    transform: translateY(-1px);
}

.cp-sens-item.top-1 {
    border-left: 4px solid #f59e0b;
}

.cp-sens-item.top-2 {
    border-left: 4px solid #94a3b8;
}

.cp-sens-item.top-3 {
    border-left: 4px solid #d97706;
}

.cp-sens-item-rank {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cp-sens-item.top-1 .cp-sens-item-rank {
    background: #fef3c7;
    color: #b45309;
}

.cp-sens-item.top-2 .cp-sens-item-rank {
    background: #e2e8f0;
    color: #334155;
}

.cp-sens-item.top-3 .cp-sens-item-rank {
    background: #fed7aa;
    color: #c2410c;
}

.cp-sens-item.at-limit {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    opacity: 0.72;
}

.cp-sens-item.at-limit:hover {
    border-color: #94a3b8;
    transform: none;
    box-shadow: none;
}

.cp-sens-item.at-limit .cp-sens-item-rank {
    background: #e2e8f0;
    color: #94a3b8;
    font-size: 0.82rem;
}

.cp-sens-item-limit-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
    padding: 1px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.cp-sens-item-info {
    flex: 1;
    min-width: 0;
}

.cp-sens-item-name {
    font-size: 0.94rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.cp-sens-item-meta {
    font-size: 0.72rem;
    color: #64748b;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 5px;
}

.cp-sens-item-cat {
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 0.67rem;
    font-weight: 600;
}

.cat-Operacional { background: #e0f2fe; color: #0369a1; }
.cat-Mantenimiento { background: #ffedd5; color: #c2410c; }
.cat-Geología { background: #dcfce7; color: #15803d; }

/* Pastillas de Actual y Meta por cada KPI */
.cp-sens-item-values {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.cp-sens-val-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.74rem;
    padding: 2px 8px;
    border-radius: 6px;
    line-height: 1.35;
}

.cp-sens-val-pill .val-label {
    color: #64748b;
    font-weight: 500;
}

.cp-sens-val-pill.actual {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #1e293b;
}

.cp-sens-val-pill.actual strong {
    color: #0f172a;
    font-weight: 700;
}

.cp-sens-val-pill.target {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

.cp-sens-val-pill.target strong {
    color: #1e40af;
    font-weight: 700;
}

.cp-sens-val-pill.pill-gap {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-weight: 600;
}

.cp-sens-val-pill.pill-ok {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    font-weight: 600;
}

.cp-sens-item-metric {
    min-width: 200px;
    text-align: right;
    flex-shrink: 0;
}

.cp-sens-item-gain {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.cp-sens-item-gain.text-emerald {
    color: #059669;
}

.cp-sens-item-subtext {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 2px;
}

.cp-sens-sub-epsilon {
    font-size: 0.65rem;
    color: #94a3b8;
    font-weight: 500;
}

.cp-sens-item-action {
    flex-shrink: 0;
}

.btn-item-simulate {
    padding: 6px 12px;
    font-size: 0.76rem;
    font-weight: 600;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-item-simulate:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.btn-item-simulate.in-scenario,
.btn-item-simulate.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.btn-item-simulate.in-scenario:hover,
.btn-item-simulate.active:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.btn-item-simulate.disabled-conflict {
    background: #f8fafc !important;
    border: 1px dashed #cbd5e1 !important;
    color: #94a3b8 !important;
    cursor: not-allowed !important;
    opacity: 0.8;
    position: relative;
    pointer-events: auto !important;
}

.btn-item-simulate.disabled-conflict:hover {
    background: #fef2f2 !important;
    border: 1px solid #f87171 !important;
    color: #dc2626 !important;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.18) !important;
    opacity: 1;
}

.cp-sens-item.has-path-conflict {
    opacity: 0.78;
    background: #fafafa;
}

.cp-sens-item.has-path-conflict:hover {
    border-color: #fca5a5;
    background: #fff8f8;
}

/* Tooltip flotante para explicar conflicto de path en simulación */
.cp-sens-conflict-tooltip {
    position: fixed;
    z-index: 100010;
    background: #0f172a;
    color: #ffffff;
    font-size: 0.74rem;
    font-weight: 500;
    line-height: 1.45;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(248, 113, 113, 0.45);
    box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.55), 0 0 12px rgba(239, 68, 68, 0.2);
    max-width: 330px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.cp-sens-conflict-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.cp-sens-conflict-tooltip .tip-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: #f87171;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.5px;
}

.cp-sens-conflict-tooltip .tip-body {
    color: #e2e8f0;
}

.cp-sens-conflict-tooltip .tip-highlight {
    color: #38bdf8;
    font-weight: 600;
}

/* Toast de notificación dentro del modal */
.cp-sens-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e293b;
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(248, 113, 113, 0.5);
    z-index: 100020;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* ==========================================================================
   6. SIMULADOR WHAT-IF
   ========================================================================== */
.cp-sim-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.cp-sim-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cp-sim-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cp-sim-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
}

.cp-sim-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.88rem;
    color: #0f172a;
    font-weight: 600;
    outline: none;
    background: #ffffff;
}

.cp-sim-kpi-info {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kpi-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: #64748b;
}

.kpi-info-row strong {
    color: #0f172a;
}

.kpi-info-row code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    color: #0f172a;
}

.badge-impact {
    background: #e0f2fe;
    color: #0284c7;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

/* Slider Box */
.cp-sim-slider-box {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-val-badge {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0284c7;
    background: #e0f2fe;
    padding: 2px 8px;
    border-radius: 6px;
}

.cp-whatif-range-slider {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: 10px !important;
    margin: 12px 0 !important;
    accent-color: #0284c7 !important;
    cursor: pointer !important;
    background: #e2e8f0;
    border-radius: 6px;
    outline: none;
}

.slider-quick-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-quick-step {
    padding: 5px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    color: #334155;
    transition: all 0.15s;
}

.btn-quick-step:hover {
    background: #e2e8f0;
}

.btn-quick-step.reset {
    color: #64748b;
    margin-left: auto;
}

/* Tarjeta de Resultados Simulación */
.cp-sim-results {
    display: flex;
    flex-direction: column;
}

.cp-sim-gauge-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.05);
}

.sim-res-title {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.sim-prod-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.sim-prod-number {
    font-size: 2.75rem;
    font-weight: 900;
    color: #0f172a;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.sim-prod-unit {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0284c7;
}

.sim-delta-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 800;
    margin-bottom: 18px;
    font-variant-numeric: tabular-nums;
}

.sim-delta-badge.positive {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    box-shadow: 0 2px 6px rgba(4, 120, 87, 0.08);
}

.sim-delta-badge.negative {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    box-shadow: 0 2px 6px rgba(185, 28, 28, 0.08);
}

.sim-progress-wrap {
    width: 100%;
    margin-bottom: 18px;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.76rem;
    color: #475569;
    margin-bottom: 6px;
}

.progress-labels strong {
    color: #0f172a;
    font-weight: 800;
}

.progress-track {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    position: relative;
    overflow: visible;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0284c7 0%, #10b981 100%);
    border-radius: 6px;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.progress-target-marker {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 3px;
    background: #dc2626;
    border-radius: 2px;
    box-shadow: 0 0 4px rgba(220, 38, 38, 0.4);
}

.progress-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 5px;
    font-variant-numeric: tabular-nums;
}

.sim-impact-breakdown {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
}

.sim-impact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.sim-impact-item span {
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sim-impact-item strong {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   7. PIE DE MODAL
   ========================================================================== */
.cp-sens-footer {
    padding: 14px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.cp-sens-footer-info {
    font-size: 0.75rem;
    color: #64748b;
    max-width: 800px;
    line-height: 1.4;
}

.cp-btn-secondary {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s;
}

.cp-btn-secondary:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* ==========================================================================
   8. NOTACIONES MATEMÁTICAS, BANNER DE AYUDA & PESTAÑA GUÍA
   ========================================================================== */
.cp-sens-footer-math {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: #1e293b;
    margin-bottom: 4px;
}

.cp-sens-footer-math .math-lbl {
    font-weight: 700;
    color: #0f172a;
}

.cp-sens-footer-math .math-sep {
    color: #cbd5e1;
    font-weight: 300;
}

.cp-sens-math-chip {
    display: inline-block;
    padding: 2px 8px;
    background: #e0f2fe;
    color: #0369a1;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 4px;
    border: 1px solid #bae6fd;
}

.cp-sens-footer-note {
    font-size: 0.73rem;
    color: #64748b;
    line-height: 1.35;
}

/* Botón de Ayuda en Toolbar */
.cp-sens-help-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cp-sens-help-toggle-btn:hover {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}

/* Banner de Ayuda Rápida Desplegable */
.cp-sens-help-banner {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #cbd5e1;
    border-left: 4px solid #0284c7;
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 18px;
    box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.05);
    animation: fadeInHelp 0.2s ease-out;
}

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

.help-banner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.help-banner-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #0f172a;
}

.help-banner-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.help-banner-close:hover {
    color: #0f172a;
    background: #e2e8f0;
}

.help-banner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.help-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.help-card-tag {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 6px;
}

.help-card-tag.orange {
    background: #ffedd5;
    color: #c2410c;
}

.help-card-tag.blue {
    background: #e0f2fe;
    color: #0369a1;
}

.help-card-tag.emerald {
    background: #d1fae5;
    color: #047857;
}

.help-card-body p {
    margin: 0;
    font-size: 0.77rem;
    line-height: 1.45;
    color: #334155;
}

.help-card-body code {
    background: #f1f5f9;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.74rem;
    color: #0f172a;
}

/* Pestaña de Guía (Tab 3) */
.cp-guide-container {
    max-width: 900px;
    margin: 0 auto;
}

.cp-guide-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    padding: 24px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.cp-guide-badge {
    display: inline-block;
    background: rgba(14, 165, 233, 0.25);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.cp-guide-hero h3 {
    margin: 0 0 6px 0;
    font-size: 1.25rem;
    color: #f8fafc;
}

.cp-guide-hero p {
    margin: 0;
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.45;
}

.cp-guide-sections {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.cp-guide-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.cp-guide-card.highlight-card {
    border-left: 4px solid #0284c7;
    background: #fbfcfe;
}

.guide-card-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.guide-card-content {
    flex: 1;
}

.guide-card-content h4 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #0f172a;
}

.guide-formula-box {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 8px 14px;
    border-radius: 6px;
    display: inline-block;
    margin: 6px 0 12px 0;
}

.guide-formula-box .math-expr {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.92rem;
    font-weight: 700;
    color: #0284c7;
}

.guide-list {
    margin: 8px 0 0 0;
    padding-left: 20px;
    font-size: 0.82rem;
    color: #334155;
    line-height: 1.5;
}

.guide-table-wrap {
    margin-top: 14px;
    overflow-x: auto;
}

.guide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.guide-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid #e2e8f0;
}

.guide-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.guide-table tr.row-highlight {
    background: #fffbeb;
}

.guide-table tr.row-highlight td {
    border-bottom: 1px solid #fef3c7;
}

.badge-time {
    display: inline-block;
    background: #ffedd5;
    color: #c2410c;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* ==========================================================================
   BOTÓN EDITOR DE METAS EN TOOLBAR
   ========================================================================== */
.cp-sens-target-editor-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cp-sens-target-editor-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    transform: translateY(-1px);
}

/* ==========================================================================
   BARRA FLOTANTE DE ESCENARIO MULTIVARIABLE
   ========================================================================== */
.cp-scenario-floating-bar {
    position: sticky;
    bottom: 10px;
    left: 0;
    right: 0;
    margin-top: 14px;
    background: #0f172a;
    color: #ffffff;
    border-radius: 10px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.4), 0 8px 10px -6px rgba(15, 23, 42, 0.3);
    z-index: 30;
    animation: sensSlideUp 0.22s ease-out;
}

@keyframes sensSlideUp {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.scenario-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.scenario-bar-icon {
    font-size: 1.25rem;
}

.scenario-bar-text {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.scenario-bar-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f8fafc;
}

.scenario-bar-count {
    font-size: 0.76rem;
    color: #94a3b8;
}

.scenario-bar-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.scenario-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #334155;
    color: #f1f5f9;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.scenario-tag-remove {
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.7rem;
}

.scenario-tag-remove:hover {
    color: #f87171;
}

.scenario-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.scenario-bar-gain {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.scenario-bar-gain .lbl-dim {
    font-size: 0.65rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.scenario-bar-gain strong {
    font-size: 0.92rem;
    font-weight: 800;
}

.btn-scenario-open {
    background: #2563eb !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 700 !important;
    padding: 6px 14px !important;
    border-radius: 6px !important;
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.15s ease;
}

.btn-scenario-open:hover {
    background: #1d4ed8 !important;
    transform: translateY(-1px);
}

.scenario-btn-clear {
    background: transparent;
    border: 1px solid #475569;
    color: #94a3b8;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.scenario-btn-clear:hover {
    color: #f87171;
    border-color: #ef4444;
}

/* ==========================================================================
   SIMULADOR WHAT-IF MULTIVARIABLE
   ========================================================================== */
.cp-sim-layout-multi {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 24px;
    align-items: start;
}

.cp-sim-top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cp-sim-add-dropdown-wrap {
    min-width: 250px;
}

.cp-sim-add-select {
    width: 100%;
    padding: 7px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    background-color: #ffffff;
    color: #0f172a;
    outline: none;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.cp-sim-add-select:hover {
    border-color: #94a3b8;
}

.cp-sim-add-select:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn-quick-step.reset {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-quick-step.reset:hover {
    background: #fee2e2;
    border-color: #f87171;
    color: #991b1b;
    transform: translateY(-1px);
}

.cp-sim-controls-multi {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cp-sim-multi-header {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-bottom: 4px;
}

.multi-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
}

.multi-header-title .badge-count {
    background: #e0f2fe;
    color: #0284c7;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #bae6fd;
}

.multi-header-sub {
    font-size: 0.76rem;
    color: #64748b;
}

.cp-sim-interventions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 560px;
    overflow-y: auto;
    padding-right: 6px;
}

.cp-sim-interventions-list::-webkit-scrollbar {
    width: 6px;
}
.cp-sim-interventions-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}
.cp-sim-interventions-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
.cp-sim-interventions-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* CARD DE INTERVENCION */
.sim-intervention-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 2px 6px -1px rgba(15, 23, 42, 0.05);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.sim-intervention-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 8px 16px -4px rgba(2, 132, 199, 0.1);
    transform: translateY(-1px);
}

.sim-intervention-card.active-change {
    border-color: #3b82f6;
    background: #fbfdff;
}

.sim-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.sim-card-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sim-card-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
}

.sim-card-cat-badge {
    font-size: 0.68rem;
    font-weight: 600;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1px 7px;
}

.sim-card-btn-remove {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.78rem;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.sim-card-btn-remove:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
    transform: scale(1.05);
}

/* Fila de Valores: Actual, Meta, Delta, Límite */
.sim-card-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.info-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.74rem;
    color: #334155;
}

.info-pill .lbl {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 500;
}

.info-pill strong {
    font-weight: 700;
}

.info-pill.text-emerald {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

.info-pill.text-red {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.info-pill.text-muted {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
}

.info-limit-note {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fffbeb;
    border: 1px solid #fef3c7;
    color: #b45309;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 6px;
    padding: 3px 8px;
}

/* Fila de Control: Slider + Input Numérico */
.sim-card-control-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.sim-slider-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.sim-current-marker {
    position: absolute;
    left: calc(13px + (100% - 26px) * var(--actual-position, 0));
    top: 50%;
    width: 2px;
    height: 22px;
    transform: translate(-50%, -50%);
    background: #dc2626;
    border-radius: 1px;
    pointer-events: none;
    z-index: 1;
}

.sim-range-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 7px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.sim-range-input:hover {
    background: #cbd5e1;
}

.sim-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0284c7;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
    border: 2px solid #ffffff;
    transition: all 0.12s ease;
}

.sim-range-input::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #0369a1;
}

.sim-range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0284c7;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
    border: 2px solid #ffffff;
}

.sim-number-input-wrap {
    display: inline-flex;
    align-items: center;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 4px 8px;
    transition: all 0.15s ease;
}

.sim-number-input-wrap:focus-within {
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.sim-number-input {
    border: none;
    background: transparent;
    font-size: 0.88rem;
    font-weight: 800;
    color: #0f172a;
    width: 66px;
    text-align: right;
    outline: none;
    font-variant-numeric: tabular-nums;
}

.sim-unit-suffix {
    font-size: 0.74rem;
    font-weight: 600;
    color: #64748b;
    margin-left: 4px;
    user-select: none;
}

/* Fila de Botones Rápidos */
.sim-card-quick-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    border-top: 1px dashed #e2e8f0;
    padding-top: 10px;
}

.btn-card-quick {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.12s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-card-quick:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.btn-card-quick[data-action="target"] {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.btn-card-quick[data-action="target"]:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
}

.btn-card-quick[data-action="base"] {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
}

.btn-card-quick[data-action="base"]:hover {
    background: #f1f5f9;
    color: #334155;
}

.cp-sim-empty-state {
    padding: 36px 24px;
    text-align: center;
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: 12px;
}

.cp-sim-empty-state .empty-icon {
    font-size: 2.2rem;
    display: block;
    margin-bottom: 10px;
}

.cp-sim-empty-state h4 {
    font-size: 0.96rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px 0;
}

.cp-sim-empty-state p {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0 0 14px 0;
    line-height: 1.45;
}

/* ==========================================================================
   WATERFALL BREAKDOWN
   ========================================================================== */
.sim-waterfall-card {
    margin-top: 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
    width: 100%;
}

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

.waterfall-header strong {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
}

.waterfall-sub {
    font-size: 0.72rem;
    color: #64748b;
}

.waterfall-table-wrap {
    overflow-x: auto;
    max-height: 240px;
    overflow-y: auto;
}

.sim-waterfall-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.sim-waterfall-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
}

.sim-waterfall-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    font-variant-numeric: tabular-nums;
}

.sim-waterfall-table tr:hover td {
    background: #f8fafc;
}

.waterfall-synergy-row td {
    background: #f5f3ff !important;
}

.synergy-label {
    color: #6d28d9;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.waterfall-total-row td {
    background: #f8fafc !important;
    border-top: 2px solid #cbd5e1 !important;
    border-bottom: none !important;
    font-size: 0.82rem;
}

/* ==========================================================================
   MODAL EDITOR DE METAS
   ========================================================================== */
.cp-target-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
}

.cp-target-modal {
    background: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 860px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: sensSlideUp 0.18s ease-out;
}

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

.cp-target-title {
    font-size: 1.02rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}

.cp-target-subtitle {
    font-size: 0.74rem;
    color: #64748b;
    margin: 2px 0 0 0;
}

.cp-target-toolbar {
    padding: 8px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
}

.cp-target-search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 3px 8px;
    width: 300px;
}

.cp-target-search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.78rem;
    width: 100%;
}

.cp-target-horizon-badge {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 700;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.cp-target-table-wrap {
    overflow-y: auto;
    padding: 0 18px;
    flex: 1;
    max-height: 50vh;
}

.cp-target-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.cp-target-table th {
    position: sticky;
    top: 0;
    background: #ffffff;
    padding: 8px 8px;
    color: #64748b;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    border-bottom: 2px solid #e2e8f0;
    z-index: 2;
}

.cp-target-table td {
    padding: 7px 8px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.cp-target-kpi-name {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.8rem;
}

.cp-target-kpi-meta {
    font-size: 0.68rem;
    color: #64748b;
}

.target-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.74rem;
    font-weight: 600;
}

.target-toggle-checkbox {
    accent-color: #2563eb;
    cursor: pointer;
}

.target-input-box {
    width: 80px;
    padding: 3px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 700;
    color: #0f172a;
}

.target-input-box:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
}

.cp-target-footer {
    padding: 10px 18px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cp-target-btn {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.cp-target-btn.btn-primary {
    background: #2563eb;
    color: #ffffff;
    border: 1px solid #1d4ed8;
}

.cp-target-btn.btn-primary:hover {
    background: #1d4ed8;
}

.cp-target-btn.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.cp-target-btn.btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.cp-target-btn.btn-outline {
    background: transparent;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.cp-target-btn.btn-outline:hover {
    background: #f8fafc;
    color: #0f172a;
}



.target-type-input { max-width: 170px; padding: 6px; border: 1px solid #64748b; border-radius: 5px; background: #1e293b; color: #f8fafc; }
.target-input-group .target-min-input, .target-input-group .target-max-input { width: 88px; min-width: 50px; }

/* Producción integrada en la cabecera del ranking. */
.cp-sens-header { gap: 16px; flex-wrap: wrap; }
.cp-sens-header .cp-sens-title-group { flex: 1 1 600px; min-width: 0; }
.cp-sens-header .cp-sens-subtitle { max-width: none; }
.cp-sens-header-production { margin: 0 0 0 auto; }
.cp-sens-header-production .cp-sens-summary-bar {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    justify-content: flex-end;
    gap: 6px 12px;
}
.cp-sens-header-production .cp-sens-sum-sub {
    flex-basis: 100%;
    text-align: right;
    margin-left: 0;
}
@media (max-width: 720px) {
    .cp-sens-header-production { margin-left: 0; }
    .cp-sens-header-production .cp-sens-summary-bar { justify-content: flex-start; }
    .cp-sens-header-production .cp-sens-sum-sub { text-align: left; }
}

.sim-plan-marker {
    position: absolute;
    left: calc(13px + (100% - 26px) * var(--target-position, 0));
    top: 50%;
    width: 2px;
    height: 22px;
    transform: translate(-50%, -50%);
    background: #16a34a;
    border-radius: 1px;
    pointer-events: none;
    z-index: 2;
}

/* A wider transparent hit area makes the slider reference lines easy to inspect. */
.sim-current-marker, .sim-plan-marker {
    width: 12px;
    background: transparent;
    pointer-events: auto;
    cursor: pointer;
}
.sim-current-marker::after, .sim-plan-marker::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    width: 2px;
    height: 100%;
    border-radius: 1px;
    background: #dc2626;
}
.sim-plan-marker::after { background: #16a34a; }

/* Spacious simulation controls and quiet, readable reference help. */
.sim-card-control-row { gap: 20px; margin-top: 14px; margin-bottom: 8px; }
.sim-slider-wrap { min-height: 48px; }
.sim-range-input { height: 12px; border-radius: 999px; position: relative; z-index: 3; }
.sim-range-input::-webkit-slider-thumb {
    width: 26px; height: 26px; border: 3px solid white;
    box-shadow: 0 1px 5px rgba(15, 23, 42, .2);
}
.sim-range-input::-moz-range-thumb {
    width: 26px; height: 26px; border: 3px solid white;
    box-shadow: 0 1px 5px rgba(15, 23, 42, .2);
}
.sim-range-input:focus-visible { outline: 2px solid #0284c7; outline-offset: 6px; }
.sim-current-marker, .sim-plan-marker { height: 38px; }
.sim-current-marker::before, .sim-plan-marker::before {
    content: attr(data-tooltip);
    position: absolute; bottom: calc(100% + 10px); left: 50%;
    transform: translate(-50%, 4px);
    width: max-content; max-width: min(340px, 70vw);
    padding: 12px 16px; border: 1px solid #dbe3ed; border-radius: 10px;
    background: #fff; color: #334155;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    font-size: 12px; font-weight: 500; line-height: 1.6;
    white-space: pre-line; pointer-events: none;
    opacity: 0; visibility: hidden; transition: opacity .15s, transform .15s;
}
.sim-current-marker:hover, .sim-plan-marker:hover,
.sim-current-marker:focus-visible, .sim-plan-marker:focus-visible { z-index: 10; }
.sim-current-marker:hover::before, .sim-plan-marker:hover::before,
.sim-current-marker:focus-visible::before, .sim-plan-marker:focus-visible::before {
    opacity: 1; visibility: visible; transform: translate(-50%, 0);
}
.sim-number-input-wrap { min-height: 46px; padding: 6px 12px; border-radius: 10px; gap: 6px; box-sizing: border-box; }
.sim-number-input { width: 82px; font-size: 1.05rem; font-weight: 700; }
.sim-unit-suffix { font-size: .8rem; font-weight: 500; }
.sim-variable-help { position: relative; }
.sim-variable-help-trigger {
    list-style: none; display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; box-sizing: border-box; border: 1px solid #cbd5e1;
    border-radius: 6px; color: #475569; background: white; cursor: pointer;
}
.sim-variable-help-trigger::-webkit-details-marker { display: none; }
.sim-variable-help-trigger:hover, .sim-variable-help-trigger:focus-visible { background: #f1f5f9; border-color: #94a3b8; }
.sim-variable-help-panel {
    position: absolute; right: 0; top: calc(100% + 10px); z-index: 20;
    width: min(350px, 70vw); padding: 16px 18px; border: 1px solid #dbe3ed;
    border-radius: 12px; background: #fff; color: #334155;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .12); font-size: 12px; line-height: 1.6;
}
.sim-variable-help-panel strong { color: #0f172a; font-size: 13px; }
.sim-variable-help-panel p { margin: 10px 0 0; }
@media (max-width: 540px) {
    .sim-card-control-row { gap: 12px; }
    .sim-number-input { width: 62px; }
    .sim-number-input-wrap { padding: 6px 8px; }
}

/* Native popovers render above the scrolling panel, without changing its size. */
.sim-variable-help-panel[popover] {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(390px, calc(100vw - 40px));
    height: fit-content;
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    box-sizing: border-box;
}
.sim-variable-help-panel[popover]::backdrop { background: transparent; }

.sim-range-input, .sim-range-input:hover {
    background: linear-gradient(to right,
        #e2e8f0 0%, #e2e8f0 var(--available-position, 100%),
        #fca5a5 var(--available-position, 100%), #fca5a5 100%);
}

.cp-sens-criterio-row { justify-content: flex-start; gap: 12px 24px; }
.cp-sens-criterio-row .cp-sens-toolbar-actions { margin-left: auto; }

/* Shared utilization budget: always visible above the scenario controls. */
.sim-hour-budget { margin: 0 0 20px; padding: 16px; background: #f8fafc; border: 1px solid #dce5ef; border-radius: 10px; }
.sim-hour-heading { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; color: #18324e; }
.sim-hour-heading > span { color: #52657d; }
.sim-hour-bar { display: flex; height: 12px; overflow: hidden; border-radius: 6px; background: #e2e8f0; margin: 13px 0; }
.sim-hour-bar > span { min-width: 0; transition: width .12s ease; }
.sim-hour-legend { display: grid; gap: 6px; }
.sim-hour-row, .sim-hour-row > span { display: flex; align-items: center; gap: 8px; }
.sim-hour-row { justify-content: space-between; font-size: 12px; color: #475569; }
.sim-hour-row i { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.sim-hour-row b { font-variant-numeric: tabular-nums; color: #243b53; white-space: nowrap; }
.sim-hour-row small { width: 65px; text-align: right; color: #52657d; font-variant-numeric: tabular-nums; }
.sim-hour-rule { margin: 12px 0 0; font-size: 12px; line-height: 1.5; color: #52657d; }
.sim-hour-warning { color: #b45309; font-size: 12px; margin: 8px 0 0; }
@media (prefers-reduced-motion: reduce) { .sim-hour-bar > span { transition: none; } }

.sim-hour-columns { display:flex; justify-content:flex-end; gap:16px; font-size:10px; color:#64748b; margin-bottom:7px; }

.sim-hour-distribution + .sim-hour-distribution { border-top: 1px solid #dce5ef; margin-top: 14px; padding-top: 14px; }

/* Quiet labels for the actual/plan lines and unavailable portion of the slider. */
.sim-slider-wrap { margin-bottom: 24px; }
.sim-marker-label {
    position: absolute; top: calc(100% + 2px); left: 50%;
    transform: translateX(-50%); color: #64748b;
    font-size: 10px; font-weight: 500; line-height: 14px; white-space: nowrap;
}
.sim-plan-marker .sim-marker-label { color: #15803d; }
.sim-marker-label-lower { top: calc(100% + 16px); }
.sim-excess-label {
    position: absolute; left: var(--available-position, 100%); right: 0;
    top: 50%; transform: translateY(-50%); z-index: 4;
    text-align: center; color: #7f1d1d; font-size: 9px; font-weight: 600;
    line-height: 12px; white-space: nowrap; overflow: hidden; pointer-events: none;
}
