 :root {
     --bg-body: #f7f9fc;
     --primary: #243876;
     --accent: #3b82f6;
     --success: #10b981;
     --warning: #f59e0b;
     --cancel: #a70000;
     --border: #e2e8f0;
     --text-main: #1e293b;
     --text-muted: #64748b;
     --white: #ffffff;
 }

 * {
     box-sizing: border-box;
     margin: 0;
     padding: 0;
 }

 body {
     font-family: 'Inter', sans-serif;
     background-color: var(--bg-body);
     color: var(--text-main);
     min-height: 100vh;
     display: flex;
     flex-direction: column;

 }

 /* --- NAVBAR --- */
 .navbar {
     height: 60px;
     background: var(--white);
     display: flex;
     align-items: center;
     justify-content: space-between;
     padding: 0 20px;
     border-bottom: 1px solid var(--border);
     z-index: 1001;
     flex-shrink: 0;
 }

 .nav-left {
     display: flex;
     align-items: center;
     gap: 15px;
 }

 .nav-right {
     display: flex;
     align-items: center;
     gap: 18px;
 }

 .menu-btn {
     cursor: pointer;
     color: var(--primary);
     padding: 8px;
     border-radius: 8px;
     display: flex;
     align-items: center;
 }

 .menu-btn:hover {
     background: #f0f2f5;
 }

 .brand-logo {
     width: 100px;
     height: 32px;
     border-radius: 8px;
     display: flex;
     align-items: center;
     justify-content: center;
     color: white;
     font-weight: 800;
     font-size: 1.2rem;
 }

 .nav-action-icon {
     cursor: pointer;
     color: var(--text-muted);
     position: relative;
     display: flex;
     align-items: center;
     transition: color 0.2s;
 }

 .nav-action-icon:hover {
     color: var(--primary);
 }

 .badge-dot {
     position: absolute;
     top: -2px;
     right: -2px;
     width: 8px;
     height: 8px;
     background: #ef4444;
     border-radius: 50%;
     border: 2px solid var(--white);
 }

 /* --- MAIN WRAPPER --- */
 .main-wrapper {
     display: flex;
     flex: 1;
     overflow: visible;
 }

 /* --- SIDEBAR --- */
 .sidebar {
     width: 190px;
     background-color: var(--primary);
     border-right: 1px solid var(--border);
     transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
     display: flex;
     flex-direction: column;
     flex-shrink: 0;
     overflow: hidden;
     box-shadow: .06rem 0 1.3rem 0 var(#5b6fad)
 }

 .sidebar-overlay {
     position: fixed;
     top: 60px;
     /* Inicia debajo de la navbar */
     left: 0;
     width: 100%;
     height: 100%;
     background-color: rgba(0, 0, 0, 0.5);
     /* Color negro con 50% de opacidad */
     z-index: 9998;
     /* Un nivel debajo de la sidebar (9999) */
     display: none;
     /* Oculto por defecto */
     transition: opacity 0.3s ease;
 }

 .sidebar.mobile-open+.sidebar-overlay,
 /* Si usas estructura contigua */
 .sidebar-overlay.active {
     display: block;
     animation: fadeIn 0.3s ease;
 }

 .sidebar.collapsed {
     width: 70px;
 }

 .sidebar-nav {
     padding-top: 15px;
     width: 250px;
 }

 .sidebar-item {
     display: flex;
     align-items: center;
     height: 50px;
     padding: 0 23px;
     color: var(--text-muted);
     cursor: pointer;
     text-decoration: none;
     transition: 0.10s;
     white-space: nowrap;
 }

 .sidebar-item:hover {
     color: var(--primary);
     background-color: #f8fafc;
 }

 .sidebar-item.active {
     color: var(--primary);
     font-weight: 600;
     background-color: #f1f5f9;
     border-right: 3px solid var(--primary);
 }

 .sidebar-item .material-icons {
     margin-right: 20px;
     min-width: 24px;
 }

 .sidebar.collapsed .sidebar-item span:not(.material-icons) {
     opacity: 0;
     pointer-events: none;
 }

 /* --- CONTENIDO --- */
 .content-body {
     flex: 1;
     padding: 20px;
     overflow-y: auto;
     width: 100%;
 }

 .action-bar {
     display: flex;
     justify-content: space-between;
     align-items: center;
     margin-bottom: 25px;
 }

 .action-group {
     display: flex;
     gap: 12px;
     align-items: center;
 }

 .btn-update {
     background: var(--white);
     color: var(--primary);
     border: 1px solid var(--primary);
     padding: 10px 18px;
     border-radius: 8px;
     cursor: pointer;
     font-weight: 600;
     display: flex;
     gap: 8px;
     align-items: center;
     font-size: 0.85rem;
 }

 .select-custom {
     padding: 10px;
     border: 1px solid var(--border);
     border-radius: 8px;
     background: var(--white);
     font-family: inherit;
     font-size: 0.85rem;
 }

 .btn-excel {
     background: var(--primary);
     color: white;
     border: none;
     padding: 10px 18px;
     border-radius: 8px;
     cursor: pointer;
     font-weight: 600;
     display: flex;
     gap: 8px;
     align-items: center;
     font-size: 0.85rem;
 }

 /* KPIs */
 .kpi-row {
     display: grid;
     grid-template-columns: repeat(4, 1fr);
     gap: 20px;
     margin-bottom: 25px;
 }

 .kpi-card {
     background: var(--white);
     padding: 20px;
     border-radius: 12px;
     border: 1px solid var(--border);
 }

 .kpi-card span {
     font-size: 0.7rem;
     color: var(--text-muted);
     font-weight: 700;
     text-transform: uppercase;
 }

 .kpi-card h2 {
     font-size: 1.8rem;
     margin-top: 5px;
     font-weight: 700;
 }

 /* GRÁFICAS */
 .charts-row {
     display: grid;
     grid-template-columns: 2fr 1fr;
     gap: 20px;
     margin-bottom: 25px;
 }

 .chart-card {
     background: var(--white);
     padding: 20px;
     border-radius: 12px;
     border: 1px solid var(--border);
     height: 320px;
 }

 .chart-card h4 {
     font-size: 0.9rem;
     margin-bottom: 15px;
     color: var(--text-main);
 }

 /* TABLA */
 .table-section {
     background: var(--white);
     border-radius: 12px;
     border: 1px solid var(--border);
     overflow: hidden;
     margin-bottom: 20px;
 }

 .table-header {
     padding: 15px 20px;
     border-bottom: 1px solid var(--border);
     display: flex;
     justify-content: space-between;
     align-items: center;
 }

 .policy-table {
     width: 100%;
     border-collapse: collapse;
     min-width: 900px;
 }

 .policy-table th {
     background: #f8fafc;
     padding: 14px 18px;
     text-align: left;
     font-size: 0.65rem;
     color: var(--text-muted);
     text-transform: uppercase;
     border-bottom: 1px solid var(--border);
 }

 .policy-table td {
     padding: 14px 18px;
     border-bottom: 1px solid #f1f5f9;
     font-size: 0.85rem;
 }

 .status-badge {
     padding: 4px 10px;
     border-radius: 6px;
     font-size: 0.75rem;
     font-weight: 600;
 }

 .bg-emitida {
     background: #dcfce7;
     color: #166534;
 }

 .bg-proceso {
     background: #fef3c7;
     color: #92400e;
 }

 .search-input {
     padding: 8px 12px;
     border: 1px solid var(--border);
     border-radius: 6px;
     width: 250px;
     font-size: 0.85rem;
 }

 /* --- STEPPER --- */
 .stepper-row {
     display: flex;
     align-items: center;
     min-width: 320px;
 }

 .step-block {
     display: flex;
     flex-direction: column;
     align-items: center;
     flex: 1;
 }

 .step-icon {
     width: 24px;
     height: 24px;
     border-radius: 50%;
     display: flex;
     align-items: center;
     justify-content: center;
     border: 2px solid var(--step-gray);
     background: white;
     color: var(--step-gray);
     z-index: 2;
 }

 .step-icon .material-icons {
     font-size: 14px;
 }

 .step-text {
     font-size: 0.6rem;
     font-weight: 600;
     margin-top: 4px;
     color: var(--text-muted);
 }

 .step-divider {
     width: 30px;
     height: 2px;
     background: var(--border);
     margin-top: -18px;
     z-index: 1;
 }

 .completed .step-icon {
     background: var(--success);
     border-color: var(--success);
     color: white;
 }

 .divider-completed {
     background: var(--success);
 }

 .active .step-icon {
     border-color: var(--accent);
     color: var(--accent);
     animation: pulse 1.5s infinite;
 }

 @media (max-width: 1024px) {
     .kpi-row {
         grid-template-columns: repeat(2, 1fr);
         /* 2 columnas en lugar de 4 */
     }

     .charts-row {
         grid-template-columns: 1fr;
         /* Gráficas una debajo de otra */
     }

     .sidebar {
         position: fixed;
         top: 60px;
         /* Debajo de la navbar */
         left: -250px;
         /* Totalmente fuera de pantalla */
         height: calc(100vh - 60px);
         width: 250px;
         z-index: 9999;
         transition: all 0.3s ease;
         visibility: hidden;
         /* Escondida por defecto */
     }

     .sidebar.mobile-open {
         left: 0;
         visibility: visible;
     }

     .main-wrapper {
         display: block;
         /* Mejor flujo en móvil */
     }

     .sidebar.active {
         left: 0;
     }

     .sidebar.collapsed {
         left: -70px;
     }
 }

 /* Móviles Pequeños */
 @media (max-width: 768px) {
     .navbar {
         padding: 0 10px;
     }

     .page-title {
         display: none;
         /* Ocultamos el título largo en móviles */
     }

     .action-bar {
         flex-direction: column;
         /* Apilamos los filtros y botones */
         align-items: stretch;
         gap: 15px;
     }

     .action-group {
         flex-wrap: wrap;
         justify-content: space-between;
     }

     .kpi-row {
         grid-template-columns: 1fr;
         /* 1 columna */
     }

     .search-input {
         width: 100%;
         /* Buscador ocupa todo el ancho */
     }

     .table-header {
         flex-direction: column;
         align-items: flex-start;
         gap: 10px;
     }
 }

 /* Ajuste específico para el Stepper dentro de la tabla */
 .stepper-row {
     min-width: 280px;
     /* Evita que se colapse demasiado */
 }

 @keyframes pulse {

     0%,
     100% {
         transform: scale(1);
     }

     50% {
         transform: scale(1.1);
     }
 }

 @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
