/* DITT Modules UI - estándar 2025 — actualizado paleta DITT */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');


:root {
    --ditt-bg: #F5F7FB;
    --ditt-card: #FFFFFF;
    --ditt-border: #E2E8F0;
    --ditt-text: #1A202C;
    --ditt-muted: #718096;
    --ditt-primary: #2E4A7A;
    --ditt-accent: #2E4A7A;
    --ditt-success: #16A34A;
    --ditt-warning: #D97706;
    --ditt-danger: #DC2626;
    --ditt-info: #2E4A7A;
    --ditt-secondary: #718096;
}

.search-input {
    width: 100%;
    padding: 1.3rem 1.5rem 1.3rem 4rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    font-size: 1rem;
    transition: var(--transition);
    background: white;
    box-shadow: var(--shadow);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    outline: none;
    transform: translateY(-2px);
}

.search-icon {
    position: absolute;
    left: 1.5rem;
    z-index: 10;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.modules-container {
    background: var(--ditt-bg);
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

.controls-section {
    padding: 1rem 1.25rem;
    background: var(--ditt-card);
    border-bottom: 1px solid var(--ditt-border)
}

.controls-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap
}

.search-section {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center
}

.search-section-solo {
    width: 100%;
    max-width: 520px
}

.search-section-solo .search-container {
    max-width: 520px
}

.search-container {
    position: relative;
    width: 100%
}

.search-input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.2rem;
    border: 1px solid var(--ditt-border);
    border-radius: 2rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}

.search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ditt-primary)
}

.btn-new-project {
    background: linear-gradient(135deg, var(--ditt-success), #16A34A);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.6rem 1rem;
    font-weight: 600
}

.table-section {
    background: var(--ditt-card);
    padding: 1rem 1.25rem
}

.table {
    font-size: .9rem
}

.table thead th {
    background: linear-gradient(135deg, #fafafa, #f1f5f9);
    border: none;
    padding: .9rem .8rem;
    color: var(--ditt-text);
    /* text-transform: uppercase; Eliminado para paridad */
    font-weight: 600;
    font-size: .72rem;
    letter-spacing: .02em;
}

.table td {
    padding: 1rem .8rem;
    border-bottom: 1px solid var(--ditt-border)
}


/* Hover/animación filas */

.table tbody tr {
    transition: background .15s ease, transform .15s ease
}

.table tbody tr:hover {
    background: #fafafa
}

.badge {
    border: 1px solid transparent;
    border-radius: .375rem;
    font-weight: 600;
}

.bg-success {
    background: #16A34A !important
}

.bg-info {
    background: #3B82F6 !important
}

/* Compact Table System */
.ditt-table th,
.ditt-table td {
    padding: 0.6rem 0.75rem !important;
    vertical-align: middle !important;
    font-size: 0.85rem !important;
}

.ditt-table thead th {
    background: #F8FAFC !important;
    color: #475569 !important;
    font-weight: 600 !important;
    /* Eliminado text-transform uppercase para coincidir con Actividades */
    font-size: 0.75rem !important;
    letter-spacing: 0.025em !important;
    border-bottom: 2px solid #E2E8F0 !important;
}

.btn-group-sm {
    display: inline-flex !important;
    gap: .4rem !important;
    justify-content: center !important;
    width: auto !important;
}

.btn-group-sm .btn {
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.btn-group-sm .btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.btn-outline-primary {
    border-color: #2E4A7A;
    color: #2E4A7A;
    border-width: 1px;
    border-radius: .5rem;
    background: #fff;
}

.btn {
    border-radius: 8px !important;
    font-weight: 500 !important;
    font-size: 0.9rem !important;
    padding: 0.55rem 1.25rem;
    /* Removido !important para permitir overrides */
    border: 1px solid transparent !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
}

.btn-register {
    background: linear-gradient(135deg, var(--ditt-success), #059669);
    border: none;
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
    min-width: 180px;
    justify-content: center;
}

.btn-export-excel {
    background: linear-gradient(135deg, #10B981, #059669);
    border: none;
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
    min-width: 180px;
    justify-content: center;
}

.btn-outline-primary:hover {
    background: #2E4A7A;
    color: #fff;
    border-color: #2E4A7A;
}

.btn-outline-warning {
    border-color: #f59e0b;
    /* Amarillo igual que Proyectos */
    color: #f59e0b;
    border-width: 1px;
    border-radius: .5rem;
    background: #fff;
}

.btn-outline-warning:hover {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b;
}


/* Variante danger para acciones destructivas (igual que Proyectos) */

.btn-outline-danger {
    border-color: #ef4444;
    color: #ef4444;
    border-width: 1px;
    border-radius: .5rem;
    background: #fff;
}

.btn-outline-danger:hover {
    background: #ef4444;
    color: #fff;
}


/* Variantes extra para uso transversal */

.btn-outline-success {
    border-color: var(--ditt-success);
    color: var(--ditt-success);
    border-width: 1px;
    border-radius: .5rem;
    background: #fff;
}

.btn-outline-success:hover {
    background: var(--ditt-success);
    color: #fff;
    border-color: var(--ditt-success);
}

.btn-outline-info {
    border-color: var(--ditt-info);
    color: var(--ditt-info);
    border-width: 1px;
    border-radius: .5rem;
    background: #fff;
}

.btn-outline-info:hover {
    background: var(--ditt-info);
    color: #fff;
    border-color: var(--ditt-info);
}


/* Modal */

.livewire-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1055
}

.modal-dialog {
    width: 100%;
    max-width: 800px
}

.modal-content {
    background: #fff;
    border-radius: .75rem;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(16, 24, 40, .14);
}

.modal-header {
    background: linear-gradient(135deg, #2E4A7A 0%, #3B5F9E 100%);
    color: #fff;
    padding: 1rem 1.25rem
}

.modal-title {
    margin: 0;
    font-weight: 600
}

.toast {
    position: fixed;
    right: 16px;
    top: 16px;
    z-index: 2000;
    background: #111827;
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, .15);
    display: flex;
    align-items: center;
    gap: 10px
}

.toast.success {
    background: #16A34A
}

.toast.error {
    background: #DC2626
}

.toast .icon {
    font-size: 18px
}

.btn-close-custom {
    border: none;
    background: rgba(255, 255, 255, .2);
    color: #fff;
    border-radius: 50%;
    width: 36px;
    height: 36px
}

.modal-body {
    padding: 1.25rem
}

.modal-footer {
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    border-top: 1px solid var(--ditt-border)
}

.form-input,
.form-select,
textarea.form-input {
    border: 1px solid var(--ditt-border);
    border-radius: .5rem;
    padding: .6rem .85rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}

.btn-save {
    background: var(--ditt-accent);
    color: #fff;
    border: none;
    border-radius: .5rem;
    padding: .6rem 1rem;
    font-weight: 600
}

.btn-cancel {
    background: #E5E7EB;
    border: none;
    border-radius: .5rem;
    padding: .6rem 1rem;
    color: var(--ditt-text)
}



.kpi-icon.success {
    background: #16A34A;
}

.kpi-icon.info {
    background: #3B82F6;
}

.kpi-icon.warn {
    background: #D97706;
}

.kpi-icon.gray {
    background: #4B5563;
}

.kpi-meta {
    line-height: 1.1;
}

.kpi-value {
    font-weight: 700;
    color: var(--ditt-text);
}

.kpi-label {
    font-size: .8rem;
    color: var(--ditt-muted);
}


/* Botón icono */

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--ditt-border);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--ditt-primary);
}

.btn-icon:hover {
    box-shadow: 0 2px 8px rgba(16, 24, 40, .1);
    transform: translateY(-1px);
}

.btn-icon.edit {
    color: #0ea5e9;
    border-color: #bae6fd;
    background: #f0f9ff
}

.btn-icon.toggle {
    color: #d97706;
    border-color: #fde68a;
    background: #fffbeb
}

.btn-icon.doi {
    color: #2E4A7A;
    border-color: #BFCFE8;
    background: #EBF0F7
}

.btn-icon.delete {
    color: #ef4444;
    border-color: #fecaca;
    background: #fff1f2
}

.btn-icon.view {
    color: #06b6d4;
    border-color: #a5f3fc;
    background: #ecfeff
}


/* Botones de acción compactos con hover */

.btn-action-view {
    transition: all 0.2s ease;
}

.btn-action-view:hover {
    background-color: #2E4A7A !important;
    border-color: #2E4A7A !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(46, 74, 122, 0.3);
}

.btn-action-edit {
    transition: all 0.2s ease;
}

.btn-action-edit:hover {
    background-color: #f59e0b !important;
    border-color: #f59e0b !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

.btn-action-delete {
    transition: all 0.2s ease;
}

.btn-action-delete:hover {
    background-color: #dc2626 !important;
    border-color: #dc2626 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}


/* Skeleton loaders */

.skeleton {
    animation: pulse .9s ease-in-out infinite;
    background: linear-gradient(90deg, #f3f4f6, #e5e7eb, #f3f4f6);
    background-size: 200% 100%;
}

@keyframes pulse {
    0% {
        background-position: 200% 0
    }

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

.skeleton-line {
    height: 14px;
    border-radius: 7px;
    margin: 6px 0
}

.skeleton-rect {
    border-radius: 12px
}


/* Campos con foco elegante Premium */
.form-input,
.form-select,
.ditt-input,
.ditt-select {
    background: #f8fafc;
    /* Slate 50 like Comunicación */
    border: 1px solid var(--ditt-border);
    border-radius: 10px;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    color: #1e293b;
    transition: all 0.2s ease;
}

.form-input:hover,
.form-select:hover {
    border-color: #94a3b8;
    background: #fff;
}

.form-input:focus,
.form-select:focus,
.ditt-input:focus,
.ditt-select:focus {
    background: white;
    outline: none;
    border-color: var(--ditt-primary);
    box-shadow: 0 0 0 4px rgba(46, 74, 122, 0.12);
    transform: translateY(-1px);
}


/* Paginación moderna */

.pagination-modern {
    display: flex;
    gap: 6px;
    align-items: center
}

.pagination-modern .page,
.pagination-modern .nav {
    border: 1px solid var(--ditt-border);
    padding: .45rem .75rem;
    border-radius: 8px;
    background: #fff;
    color: var(--ditt-primary);
    text-decoration: none
}

.pagination-modern .page.is-active {
    background: var(--ditt-primary);
    color: #fff;
    border-color: var(--ditt-primary)
}

.pagination-modern .nav[aria-disabled="true"],
.pagination-modern .page[aria-disabled="true"] {
    opacity: .5;
    pointer-events: none
}

.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

.event-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
}

.event-card:hover {
    transform: translateY(-4px);
}

/* ════════════════════════════════════════════════════════════
   PEI DASHBOARD MODULE - Professional Architecture
   ════════════════════════════════════════════════════════════ */

.pei-dashboard-container {
    font-family: 'DM Sans', sans-serif;
    padding: 0.75rem;
}

.pei-header h1 {
    font-family: 'DM Sans', sans-serif;
    font-size: 2.75rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.05em;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.pei-header h1 span {
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    font-weight: 400;
    color: #0369a1;
    font-size: 3.25rem;
    letter-spacing: -0.01em;
    vertical-align: middle;
    margin-right: 0.25rem;
}

.pei-badge-year {
    background: #f1f5f9;
    padding: 0.4rem 1rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid #e2e8f0;
}

/* KPIs Reusable Architecture (BEM) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    /* Forzamos contracción */
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1400px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .kpi-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* KPIs PEI - Estética Cyber-Enterprise */
.pei-kpi {
    background: #ffffff !important;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    /* Reducimos el borde lateral a una franja más técnica */
    border-left: 6px solid var(--kpi-accent, #cbd5e1) !important;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 2px 4px -1px rgba(0, 0, 0, 0.03),
        inset 0 0 20px rgba(255, 255, 255, 1);
    /* Brillo interior */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    height: 100%;
}

/* Textura de rejilla técnica sutil */
.pei-kpi::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px);
    background-size: 15px 15px;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.pei-kpi>* {
    position: relative;
    z-index: 1;
}

.pei-kpi:hover {
    transform: translateY(-4px);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        inset 0 0 15px var(--kpi-glow, rgba(255, 255, 255, 0));
}

/* Etiqueta Técnica ID */
.pei-kpi__id {
    position: absolute;
    top: 0.75rem;
    right: 4.5rem;
    font-family: 'JetBrains Mono', 'Monaco', monospace;
    font-size: 0.65rem;
    color: #94a3b8;
    background: #f8fafc;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #f1f5f9;
    font-weight: 600;
}

.kpi-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: #64748b !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.1rem;
}

.kpi-value {
    font-size: 2.1rem;
    font-weight: 950;
    color: #0f172a !important;
    letter-spacing: -0.04em;
    line-height: 0.9;
}

.pei-kpi__main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.pei-kpi__icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

/* --- Variantes de Color (Energía Controlada) --- */

/* --- Variantes de Color (Módulos Técnicos) --- */

.pei-kpi--cumplimiento {
    --kpi-accent: #3b82f6;
    --kpi-glow: rgba(59, 130, 246, 0.05);
    background: linear-gradient(135deg, #fff 70%, rgba(59, 130, 246, 0.03) 100%) !important;
}

.pei-kpi--cumplimiento .pei-kpi__icon {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.pei-kpi--cumplimiento .pei-kpi__progress-bar {
    background: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.pei-kpi--presupuesto {
    --kpi-accent: #f59e0b;
    --kpi-glow: rgba(245, 158, 11, 0.05);
    background: linear-gradient(135deg, #fff 70%, rgba(245, 158, 11, 0.03) 100%) !important;
}

.pei-kpi--presupuesto .pei-kpi__icon {
    background: #f59e0b;
    color: #fff;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.pei-kpi--presupuesto .pei-kpi__progress-bar {
    background: #f59e0b;
}

.pei-kpi--proyectos {
    --kpi-accent: #8b5cf6;
    --kpi-glow: rgba(139, 92, 246, 0.05);
    background: linear-gradient(135deg, #fff 70%, rgba(139, 92, 246, 0.03) 100%) !important;
}

.pei-kpi--proyectos .pei-kpi__icon {
    background: #8b5cf6;
    color: #fff;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.pei-kpi--proyectos .pei-kpi__progress-bar {
    background: #8b5cf6;
}

.pei-kpi--impacto {
    --kpi-accent: #ec4899;
    --kpi-glow: rgba(236, 72, 153, 0.05);
    background: linear-gradient(135deg, #fff 70%, rgba(236, 72, 153, 0.03) 100%) !important;
}

.pei-kpi--impacto .pei-kpi__icon {
    background: #ec4899;
    color: #fff;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

.pei-kpi--impacto .pei-kpi__progress-bar {
    background: #ec4899;
}

/* --- Alert States (Vibrancy Max / Cyber-Alerta) --- */

.pei-kpi--critical {
    --kpi-accent: #ef4444;
    --kpi-glow: rgba(239, 68, 68, 0.08);
    background: linear-gradient(135deg, #fff 60%, rgba(239, 68, 68, 0.05) 100%) !important;
    border: 1px solid #fee2e2;
    animation: pei-pulse-border-red 2s infinite;
}

.pei-kpi--critical .pei-kpi__icon {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    animation: pei-icon-shake 0.5s ease infinite alternate;
}

.pei-kpi--critical .kpi-value {
    color: #ef4444 !important;
}

.pei-kpi--warning {
    --kpi-accent: #f59e0b;
    --kpi-glow: rgba(245, 158, 11, 0.08);
    background: linear-gradient(135deg, #fff 60%, rgba(245, 158, 11, 0.05) 100%) !important;
    border: 1px solid #fef3c7;
}

.pei-kpi--warning .pei-kpi__icon {
    background: #f59e0b;
    color: #fff;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.pei-kpi__progress-track {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    border: 1px solid #e2e8f0;
}

/* Efecto de segmentos técnicos en la barra */
.pei-kpi__progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    background-image: linear-gradient(90deg,
            rgba(255, 255, 255, 0.15) 25%,
            transparent 25%,
            transparent 50%,
            rgba(255, 255, 255, 0.15) 50%,
            rgba(255, 255, 255, 0.15) 75%,
            transparent 75%,
            transparent);
    background-size: 8px 8px;
    /* Segmentos de 8px */
}

/* Animaciones de Alerta Refinadas */
@keyframes pei-pulse-border-red {
    0% {
        border-left-width: 8px;
    }

    50% {
        border-left-width: 14px;
    }

    100% {
        border-left-width: 8px;
    }
}

@keyframes pei-icon-shake {
    from {
        transform: scale(1.1) rotate(-5deg);
    }

    to {
        transform: scale(1.1) rotate(5deg);
    }
}

/* Estado Satisfactorio (Verde) /* Animación Pulsante para Críticos */
@keyframes pei-pulse-red {
    0% {
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 0 0 0 rgba(239, 68, 68, 0);
    }

    50% {
        box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.1), 0 0 0 6px rgba(239, 68, 68, 0.05);
    }

    100% {
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* --- DASHBOARD EXECUTIVO (CEO VIEW) --- */
.pei-executive-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 20px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    gap: 2rem;
}

.pei-executive-bar__info {
    flex-grow: 1;
}

.pei-executive-bar__meta {
    font-size: 0.7rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 4px;
}

.pei-executive-bar__title {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
}

.pei-executive-bar__controls {
    display: flex;
    align-items: flex-end;
    gap: 1.25rem;
}

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

.pei-filter-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 2px;
}

.pei-select-wrapper {
    position: relative;
    min-width: 180px;
}

.pei-select {
    width: 100%;
    appearance: none;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s;
}

.pei-select:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.pei-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.pei-select-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.pei-loading-spinner {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
    padding: 0.6rem 1rem;
    border-radius: 10px;
}

@media (max-width: 900px) {
    .pei-executive-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
    }
}

/* --- GRID & LAYOUT --- */
.pei-charts-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    /* Crucial para evitar que el canvas bloquee el shrink */
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.pei-chart-card {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

@media (min-width: 1400px) {
    .pei-chart-card {
        padding: 2rem;
    }
}

.pei-chart-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.pei-chart-card__meta {
    font-size: 0.7rem;
    color: #94a3b8;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
}

.pei-chart-card__title {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: #1e293b;
    margin: 0;
}

.pei-chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    max-width: 320px;
}

.pei-chart-legend__item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pei-chart-legend__color {
    width: 14px;
    height: 3px;
    border-radius: 4px;
}

.pei-chart-legend__label {
    font-size: 0.76rem;
    color: #64748B;
    font-weight: 600;
}

.pei-chart-canvas-wrapper {
    position: relative;
    flex-grow: 1;
    min-width: 0;
    /* Permite que el contenedor se contraiga en flex/grid */
}

.pei-chart-canvas-wrapper--evolucion {
    height: 320px;
}

.pei-chart-canvas-wrapper--balance {
    height: 200px;
    margin-bottom: 2rem;
}

.pei-chart-card__progress-list {
    margin-top: auto;
    border-top: 1px solid #f1f5f9;
    padding-top: 1.5rem;
}

.pei-chart-progress-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 10px;
}

.pei-chart-progress-item__id {
    font-size: 0.7rem;
    font-weight: 800;
    min-width: 38px;
    font-family: 'JetBrains Mono';
    opacity: 0.8;
}

.pei-chart-progress-item__track {
    flex: 1;
    height: 8px;
    background: #f8fafc;
    border-radius: 99px;
    overflow: hidden;
    position: relative;
    border: 1px solid #f1f5f9;
}

/* Removiendo redundancia o asegurando herencia correcta */
.pei-kpi__progress-track {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    border: 1px solid #e2e8f0;
    margin: 0.5rem 0;
}

.pei-chart-progress-item__bar {
    height: 100%;
    border-radius: 99px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.pei-chart-progress-item__val {
    font-size: 0.7rem;
    font-weight: 800;
    color: #1e293b;
    min-width: 32px;
    text-align: right;
    opacity: 0.9;
}

/* --- Indicators Grid (BEM Strict) --- */
.indicators-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.25rem;
}

@media (max-width: 1550px) {
    .indicators-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    .indicators-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .indicators-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.indicator-card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.indicator-card__code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f1f5f9;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    color: #64748b;
    width: fit-content;
}

.indicator-card__title {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.indicator-card__progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.indicator-card__meta-group {
    display: flex;
    flex-direction: column;
}

.indicator-card__meta {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.indicator-card__value {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.indicator-card__ring {
    position: relative;
    width: 64px;
    height: 64px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.indicator-card:hover .indicator-card__ring {
    transform: scale(1.15);
}

.indicator-card:hover .indicator-card__title {
    color: #0369a1;
}

.indicator-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.08);
    border-color: #e2e8f0;
}

.indicator-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--ind-color, #cbd5e1);
    opacity: 0.8;
    transition: height 0.3s ease, opacity 0.3s ease;
}

.indicator-card:hover::before {
    height: 6px;
    opacity: 1;
}

/* Alert States (Ultra-Vivid Palette) */
.indicator-card--critical {
    border-color: #ff3b3b;
    background: linear-gradient(135deg, #fff 60%, #fff0f0 100%);
    box-shadow: 0 4px 15px rgba(255, 59, 59, 0.08);
    animation: pei-pulse-red-vivid 2.5s infinite;
}

.indicator-card--critical::before {
    background: #ff1e1e !important;
}

.indicator-card--critical .indicator-card__title {
    color: #d32f2f;
}

.indicator-card--critical .indicator-card__value {
    color: #ff1e1e;
    font-weight: 900;
}

.indicator-card--critical .indicator-card__status-icon {
    color: #ff1e1e;
    filter: drop-shadow(0 0 4px rgba(255, 30, 30, 0.3));
}

.indicator-card--critical .indicator-card__status-label {
    color: #fff;
    background: #ff1e1e;
    box-shadow: 0 2px 8px rgba(255, 30, 30, 0.3);
}

.indicator-card--warning {
    border-color: #ff9100;
    background: linear-gradient(135deg, #fff 60%, #fff8e1 100%);
    box-shadow: 0 4px 15px rgba(255, 145, 0, 0.08);
}

.indicator-card--warning::before {
    background: #ff9100 !important;
}

.indicator-card--warning .indicator-card__title {
    color: #ef6c00;
}

.indicator-card--warning .indicator-card__status-icon {
    color: #ff9100;
}

.indicator-card--warning .indicator-card__status-label {
    color: #fff;
    background: #ff9100;
    box-shadow: 0 2px 8px rgba(255, 145, 0, 0.3);
}

.indicator-card--success {
    border-color: #00c853;
    background: linear-gradient(135deg, #fff 60%, #e8f5e9 100%);
    box-shadow: 0 4px 15px rgba(0, 200, 83, 0.08);
}

.indicator-card--success::before {
    background: #00c853 !important;
}

.indicator-card--success .indicator-card__status-icon {
    color: #00c853;
}

.indicator-card--success .indicator-card__status-label {
    color: #fff;
    background: #00c853;
    box-shadow: 0 2px 8px rgba(0, 200, 83, 0.3);
}

.indicator-card--excellent {
    border-color: #00b0ff;
    background: linear-gradient(135deg, #fff 60%, #e1f5fe 100%);
    box-shadow: 0 4px 15px rgba(0, 176, 255, 0.08);
}

.indicator-card--excellent::before {
    background: #00b0ff !important;
}

.indicator-card--excellent .indicator-card__status-icon {
    color: #00b0ff;
    filter: drop-shadow(0 0 5px rgba(0, 176, 255, 0.4));
}

.indicator-card--excellent .indicator-card__status-label {
    color: #fff;
    background: #00b0ff;
    box-shadow: 0 2px 8px rgba(0, 176, 255, 0.4);
}

/* --- Enhanced KPI Colors (Top Section) --- */
.pei-kpi--critical {
    border-color: #ff3b3b;
    background: linear-gradient(135deg, #ff1e1e 0%, #d32f2f 100%);
    animation: pei-pulse-red-vivid 2s infinite;
}

.pei-kpi--warning {
    border-color: #ff9100;
    background: linear-gradient(135deg, #ff9100 0%, #f57c00 100%);
}

.pei-kpi--success {
    border-color: #00c853;
    background: linear-gradient(135deg, #00c853 0%, #2e7d32 100%);
}

/* --- Status Elements within Card --- */
.indicator-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.indicator-card__status-icon {
    font-size: 1.15rem;
    transition: transform 0.3s ease;
}

.indicator-card:hover .indicator-card__status-icon {
    transform: scale(1.2) rotate(10deg);
}

.indicator-card__status-badge {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
}

.indicator-card__status-label {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

@keyframes pei-pulse-red-vivid {
    0% {
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 0 0 0 rgba(255, 30, 30, 0.4);
    }

    70% {
        box-shadow: 0 10px 15px -3px rgba(255, 30, 30, 0.1), 0 0 0 10px rgba(255, 30, 30, 0);
    }

    100% {
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 0 0 0 rgba(255, 30, 30, 0);
    }
}

@keyframes pei-pulse-red-soft {
    0% {
        box-shadow: 0 4px 15px rgba(255, 30, 30, 0.05), 0 0 0 0 rgba(255, 30, 30, 0.2);
    }

    70% {
        box-shadow: 0 4px 15px rgba(255, 30, 30, 0.05), 0 0 0 10px rgba(255, 30, 30, 0);
    }

    100% {
        box-shadow: 0 4px 15px rgba(255, 30, 30, 0.05), 0 0 0 0 rgba(255, 30, 30, 0);
    }
}

/* Responsiveness */
@media (max-width: 1024px) {
    .pei-charts-grid {
        grid-template-columns: 1fr;
    }

    .pei-chart-canvas-wrapper--evolucion {
        height: 350px;
    }
}

@media (max-width: 768px) {
    .pei-dashboard-container {
        padding: 0.75rem;
    }

    .pei-charts-grid {
        gap: 1.5rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }

    .indicators-grid {
        grid-template-columns: 1fr;
    }

    .pei-chart-card {
        padding: 1.25rem;
    }

    .pei-chart-card__header {
        flex-direction: column;
        gap: 1rem;
    }

    .pei-chart-legend {
        justify-content: flex-start;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .pei-chart-canvas-wrapper--evolucion {
        height: 280px;
    }

    .pei-chart-canvas-wrapper--balance {
        height: 180px;
    }

    .kpi-value {
        font-size: 1.75rem;
    }
}