/* ==========================================
   PREDICTAQMS - ESTILOS PRINCIPALES
   Sistema de Gestión de Calidad Predictiva
   ========================================== */

:root {
    /* Colores principales */
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;

    /* Colores de fondo */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-dark: #1f2937;
    --bg-darker: #111827;

    /* Colores de texto */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;

    /* Colores específicos de la aplicación */
    --reactivo-color: #f59e0b;
    --predictivo-color: #7c3aed;

    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Bordes */
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-color: #e5e7eb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ==========================================
   NAVEGACIÓN - SIDEBAR LATERAL IZQUIERDO
   ========================================== */

/* Variables del sidebar */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
}

.navbar {
    background: linear-gradient(180deg, rgba(31, 41, 55, 0.98) 0%, rgba(17, 24, 39, 0.98) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: white;
    padding: 0;
    box-shadow: 4px 0 20px -2px rgba(0, 0, 0, 0.25);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    width: var(--sidebar-width);
    height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transition: width 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Compensar espacio del sidebar fixed */
body {
    padding-left: var(--sidebar-width);
    padding-top: 0;
    transition: padding-left 0.3s ease;
}

/* Estado del navbar al hacer scroll - ya no aplica igual */
.navbar.scrolled {
    box-shadow: 6px 0 32px -4px rgba(0, 0, 0, 0.35);
}

.nav-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Cabecera del sidebar */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
    z-index: 1001;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.15);
    min-height: 70px;
}

.logo-icon {
    font-size: 1.75rem;
    line-height: 1;
    flex-shrink: 0;
}

.logo-text {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.35rem;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
}

.logo-badge {
    background: var(--predictivo-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 0;
}

/* Botón hamburguesa - oculto en desktop */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius);
    cursor: pointer;
    padding: 8px;
    z-index: 1002;
    position: relative;
    transition: all 0.3s ease;
    gap: 5px;
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

.nav-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.nav-toggle.active {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Overlay para menú mobile - oculto por defecto en desktop */
.nav-overlay {
    display: none;
}

/* Wrapper del menú - Área de navegación principal */
.nav-menu-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.nav-menu-wrapper::-webkit-scrollbar {
    width: 4px;
}

.nav-menu-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.nav-menu-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    list-style: none;
    gap: 0.25rem;
    margin: 0;
    padding: 0 0.75rem;
    width: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    color: #d1d5db;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 0.875rem 1rem;
    border-radius: var(--border-radius);
    white-space: nowrap;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}

.nav-link .nav-icon {
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.nav-link .nav-text {
    font-size: 0.9rem;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
    border-left-color: rgba(255, 255, 255, 0.3);
    transform: translateX(2px);
}

.nav-link.active {
    color: white;
    background: rgba(37, 99, 235, 0.25);
    border-left-color: var(--primary-color);
}

/* Menú de usuario - Parte inferior del sidebar */
.nav-user {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 1001;
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.15);
    margin-top: auto;
}

.user-menu {
    position: relative;
    width: 100%;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius);
    padding: 0.6rem 0.75rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
}

.user-button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    line-height: 1.2;
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.user-role {
    font-size: 0.7rem;
    opacity: 0.8;
    padding: 0.1rem 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    line-height: 1.3;
}

.dropdown-arrow {
    font-size: 0.6rem;
    opacity: 0.7;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.user-button:hover .dropdown-arrow,
.user-dropdown.show~.user-button .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Dropdown del usuario - aparece hacia arriba en el sidebar */
.user-dropdown {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    overflow: hidden;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.dropdown-header strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.dropdown-header small {
    color: var(--text-secondary);
    font-size: 0.75rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
    padding-left: 1.25rem;
}

.dropdown-item .dropdown-icon {
    font-size: 1rem;
}

.dropdown-item span:not(.dropdown-icon) {
    flex: 1;
}

/* ==========================================
   CONTENIDO PRINCIPAL
   ========================================== */

.main-content {
    min-height: calc(100vh - 100px);
    padding: 2rem;
    transition: margin-left 0.3s ease;
}

/* Main content se ajusta al sidebar en desktop */
@media (min-width: 769px) {
    .main-content {
        min-height: 100vh;
    }
}

/* ==========================================
   HERO SECTION (Página de inicio)
   ========================================== */

.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 2rem;
    text-align: center;
}

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.5rem;
    opacity: 0.9;
    margin-bottom: 3rem;
}

.hero-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.feature-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.feature-highlight {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    opacity: 0.9;
}

.hero-cta {
    margin-top: 3rem;
}

.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

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

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

/* ==========================================
   INFO SECTION
   ========================================== */

.info-section {
    padding: 4rem 2rem;
    background: var(--bg-primary);
}

.info-container {
    max-width: 1200px;
    margin: 0 auto;
}

.info-container h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.comparison-card {
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
}

.comparison-card.reactivo {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid var(--reactivo-color);
}

.comparison-card.predictivo {
    background: linear-gradient(135deg, #ddd6fe 0%, #c4b5fd 100%);
    border-left: 4px solid var(--predictivo-color);
}

.comparison-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.comparison-card ul {
    list-style: none;
}

.comparison-card li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.comparison-card li::before {
    content: '✓';
    position: absolute;
    left: 0;
    font-weight: bold;
    color: var(--success-color);
}

/* ==========================================
   DASHBOARD
   ========================================== */

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ==========================================
   WIDGETS
   ========================================== */

.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.widget {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.widget:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.widget-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.widget-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.reactivo-badge {
    background: #fef3c7;
    color: #92400e;
}

.predictivo-badge {
    background: #ddd6fe;
    color: #5b21b6;
}

.widget-body {
    margin: 1.5rem 0;
}

.widget-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.widget-description {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.widget-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.widget-trend {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.widget-trend.highlight {
    color: var(--predictivo-color);
    font-weight: 600;
}

.widget-reactivo .widget-value {
    color: var(--reactivo-color);
}

.widget-predictivo .widget-value {
    color: var(--predictivo-color);
}

.widget-info .widget-value {
    color: var(--info-color);
}

.widget-success .widget-value {
    color: var(--success-color);
}

.widget-status {
    padding: 1rem;
    border-radius: var(--border-radius);
    text-align: center;
}

.status-indicator {
    font-size: 1.2rem;
    font-weight: 600;
}

.status-indicator.ok {
    color: var(--success-color);
}

.status-indicator.warning {
    color: var(--warning-color);
}

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

.section-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.section-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--info-color);
    color: white;
}

/* ==========================================
   TABLAS
   ========================================== */

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
}

.data-table thead {
    background: var(--bg-secondary);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

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

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.process-id {
    background: var(--bg-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 600;
}

.valor-destacado {
    font-weight: 700;
    color: var(--danger-color);
}

.estado-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.estado-badge.activa {
    background: #fee2e2;
    color: #991b1b;
}

.estado-badge.abierto {
    background: #fef3c7;
    color: #92400e;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* ==========================================
   API TESTER
   ========================================== */

.api-tester {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--border-radius);
}

.api-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.form-container {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.api-response {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    display: none;
}

.api-response.success {
    display: block;
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.api-response.alerta {
    display: block;
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

.api-response.error {
    display: block;
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

/* ==========================================
   FOOTER
   ========================================== */

.footer {
    background: var(--bg-darker);
    color: #9ca3af;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.footer-tech {
    margin-top: 0.5rem;
    color: #6b7280;
    font-size: 0.9rem;
}

/* ==========================================
   GESTIÓN DE DOCUMENTOS
   ========================================== */

.documentos-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

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

.documentos-header h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
}

.documentos-header .btn-primary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
}

.documentos-header .btn-primary:hover {
    background: #1d4ed8;
}

/* Filtros */
.filtros-container {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filtro-grupo {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 200px;
}

.filtro-grupo label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.filtro-select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}

.filtro-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

/* Tabla de Documentos */
.tabla-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    overflow-y: visible;
}

.tabla-documentos {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 1200px;
}

/* Anchos específicos para columnas */
.tabla-documentos th:nth-child(1),
.tabla-documentos td:nth-child(1) {
    width: 30%;
}

/* Documento */
.tabla-documentos th:nth-child(2),
.tabla-documentos td:nth-child(2) {
    width: 8%;
}

/* Tipo */
.tabla-documentos th:nth-child(3),
.tabla-documentos td:nth-child(3) {
    width: 8%;
}

/* Orden */
.tabla-documentos th:nth-child(4),
.tabla-documentos td:nth-child(4) {
    width: 8%;
}

/* Revisión */
.tabla-documentos th:nth-child(5),
.tabla-documentos td:nth-child(5) {
    width: 12%;
}

/* Última Revisión */
.tabla-documentos th:nth-child(6),
.tabla-documentos td:nth-child(6) {
    width: 8%;
}

/* Tipo Archivo */
.tabla-documentos th:nth-child(7),
.tabla-documentos td:nth-child(7) {
    width: 8%;
}

/* Tamaño */
.tabla-documentos th:nth-child(8),
.tabla-documentos td:nth-child(8) {
    width: 18%;
}

/* Acciones */

.tabla-documentos thead {
    background: var(--bg-secondary);
}

.tabla-documentos th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.tabla-documentos td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.tabla-documentos tbody tr {
    transition: background 0.2s ease;
}

.tabla-documentos tbody tr:hover {
    background: var(--bg-secondary);
}

.doc-titulo {
    font-weight: 600;
    color: var(--primary-color);
}

.badge-categoria {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-tipo {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #f3f4f6;
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    font-family: monospace;
}

.badge-estado {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-estado.badge-borrador {
    background: #fef3c7;
    color: #92400e;
}

.badge-estado.badge-aprobado {
    background: #d1fae5;
    color: #065f46;
}

.badge-estado.badge-obsoleto {
    background: #fee2e2;
    color: #991b1b;
}

.acciones {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    transform: scale(1.1);
}

.btn-ver:hover {
    background: #dbeafe;
}

.btn-descargar:hover {
    background: #d1fae5;
}

.btn-imprimir:hover {
    background: #e0e7ff;
}

.btn-editar:hover {
    background: #fef3c7;
}

.btn-eliminar:hover {
    background: #fee2e2;
}

.mensaje-vacio {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.modal-close {
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-help-text {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.modal-acciones {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.modal form {
    padding: 1.5rem;
}

.form-grupo {
    margin-bottom: 1.5rem;
}

.form-grupo label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-grupo input[type="text"],
.form-grupo input[type="file"],
.form-grupo select,
.form-grupo textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-grupo input:focus,
.form-grupo select:focus,
.form-grupo textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-grupo small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.form-acciones {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.upload-progress {
    padding: 1.5rem;
    text-align: center;
}

.progress-bar {
    background: var(--bg-secondary);
    height: 8px;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    height: 100%;
    width: 0%;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% {
        width: 0%;
    }

    50% {
        width: 70%;
    }

    100% {
        width: 100%;
    }
}

.progress-text {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ==========================================
   VER DOCUMENTO
   ========================================== */

.ver-documento-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.documento-header {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.documento-info h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.documento-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.meta-item {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.meta-item strong {
    color: var(--text-primary);
}

.documento-acciones {
    display: flex;
    gap: 1rem;
}

.documento-visor {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 2rem;
}

/* Visor de PDF */
.pdf-viewer-container {
    width: 100%;
    height: 800px;
}

.pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Visor de Excel */
.excel-viewer-container {
    padding: 1.5rem;
}

.excel-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.excel-content {
    overflow-x: auto;
}

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

.excel-content th,
.excel-content td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    min-width: 100px;
}

.excel-content th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.excel-content td.editable {
    background: #fef3c7;
    cursor: text;
}

.excel-content td.editable:hover {
    background: #fde68a;
}

.sheet-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.sheet-tab {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sheet-tab:hover {
    background: var(--bg-primary);
}

.sheet-tab.active {
    background: var(--bg-primary);
    border-bottom: 2px solid var(--primary-color);
}

.excel-fallback,
.loading-message {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* Visor de Imágenes */
.image-viewer-container {
    padding: 2rem;
    text-align: center;
    background: var(--bg-secondary);
}

.image-preview {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

/* Visor de Texto */
.text-viewer-container {
    padding: 1.5rem;
}

.text-content {
    width: 100%;
    min-height: 500px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: monospace;
    font-size: 0.95rem;
    resize: vertical;
}

/* Sin Previsualización */
.no-preview-container {
    padding: 4rem 2rem;
    text-align: center;
}

.no-preview-message {
    max-width: 500px;
    margin: 0 auto;
}

.no-preview-message .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.no-preview-message h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.no-preview-message p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* ========================================
   EDITOR DE DOCUMENTOS TIPO WORD
   ======================================== */

.word-editor-container {
    background: #f8f9fa;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 2rem;
}

/* Barra de herramientas tipo Word */
.word-toolbar {
    background: #ffffff;
    border-bottom: 1px solid #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Pestañas de Word */
.word-tabs {
    display: flex;
    background: #f3f4f6;
    border-bottom: 1px solid #d1d5db;
    padding: 0;
    margin: 0;
}

.word-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-right: 1px solid #d1d5db;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    transition: all 0.2s ease;
    position: relative;
}

.word-tab:hover {
    background: #e5e7eb;
    color: #111827;
}

.word-tab.active {
    background: #ffffff;
    color: #111827;
    border-bottom: 2px solid #2563eb;
    font-weight: 600;
}

/* Contenido de pestañas */
.word-tab-content {
    background: #ffffff;
    padding: 16px 20px;
    min-height: 60px;
}

.word-tab-panel {
    display: none;
}

.word-tab-panel.active {
    display: block;
}

/* Grupos de herramientas */
.word-group {
    display: inline-block;
    margin-right: 24px;
    vertical-align: top;
}

.word-group-title {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.word-buttons {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
}

.word-btn {
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #374151;
}

.word-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.word-btn.active {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.word-icon {
    font-weight: 600;
    font-size: 12px;
}

/* Controles de fuente */
.word-controls {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.word-select {
    height: 32px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0 8px;
    font-size: 12px;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
}

.word-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

/* Área del documento */
.word-document-area {
    background: #ffffff;
    margin: 0;
    padding: 0;
    min-height: 600px;
    position: relative;
}

.word-document {
    width: 21cm;
    min-height: 29.7cm;
    margin: 0 auto;
    padding: 2.5cm;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    font-family: 'Times New Roman', serif;
    font-size: 12pt;
    line-height: 1.5;
    color: #000000;
    outline: none;
    position: relative;
    overflow: visible;
}

/* Estilos de texto para el editor */
.word-document h1 {
    font-size: 18pt;
    font-weight: bold;
    margin: 12pt 0;
    color: #000000;
}

.word-document h2 {
    font-size: 16pt;
    font-weight: bold;
    margin: 10pt 0;
    color: #000000;
}

.word-document h3 {
    font-size: 14pt;
    font-weight: bold;
    margin: 8pt 0;
    color: #000000;
}

.word-document p {
    margin: 6pt 0;
    text-align: justify;
}

.word-document ul,
.word-document ol {
    margin: 6pt 0;
    padding-left: 20pt;
}

.word-document li {
    margin: 3pt 0;
}

/* Estilos de formato */
.word-document strong,
.word-document b {
    font-weight: bold;
}

.word-document em,
.word-document i {
    font-style: italic;
}

.word-document u {
    text-decoration: underline;
}

.word-document s,
.word-document strike {
    text-decoration: line-through;
}

.word-document sup {
    vertical-align: super;
    font-size: smaller;
}

.word-document sub {
    vertical-align: sub;
    font-size: smaller;
}

/* Alineación de párrafos */
.word-document .text-left {
    text-align: left;
}

.word-document .text-center {
    text-align: center;
}

.word-document .text-right {
    text-align: right;
}

.word-document .text-justify {
    text-align: justify;
}

/* Barra de estado */
.word-status-bar {
    background: #f3f4f6;
    border-top: 1px solid #d1d5db;
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #6b7280;
}

.word-status-left {
    display: flex;
    gap: 16px;
}

.word-status-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.word-btn-small {
    width: 24px;
    height: 24px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    cursor: pointer;
    border-radius: 2px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.word-btn-small:hover {
    background: #f3f4f6;
}

/* Botones de acción */
.word-actions {
    background: #f8f9fa;
    padding: 16px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #d1d5db;
}

/* Estilos para el contenido del Manual de Calidad */
.word-document .documento-header {
    margin-bottom: 30pt;
    border-bottom: 2pt solid #000000;
    padding-bottom: 15pt;
}

.word-document .logo-container {
    text-align: center;
    margin-bottom: 20pt;
}

.word-document .logo-container .logo {
    font-size: 24pt;
    font-weight: bold;
    color: #2563eb;
    margin-bottom: 10pt;
}

.word-document .documento-title {
    font-size: 20pt;
    font-weight: bold;
    text-align: center;
    color: #6b7280;
    margin: 20pt 0;
    text-transform: uppercase;
    letter-spacing: 2pt;
}

.word-document .documento-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15pt;
}

.word-document .meta-table {
    border: 1pt solid #000000;
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 15pt;
}

.word-document .meta-table td {
    border: 1pt solid #000000;
    padding: 8pt;
    font-size: 10pt;
}

.word-document .meta-table .label {
    background: #f3f4f6;
    font-weight: bold;
    width: 30%;
}

.word-document .page-info {
    text-align: right;
    font-size: 10pt;
    color: #6b7280;
    margin-top: 10pt;
}

.word-document .documento-content {
    margin: 30pt 0;
    min-height: 400pt;
}

.word-document .documento-footer {
    position: absolute;
    bottom: 2.5cm;
    left: 2.5cm;
    right: 2.5cm;
    text-align: center;
    margin-top: 50pt;
}

.word-document .documento-footer .logo {
    font-size: 18pt;
    font-weight: bold;
    color: #2563eb;
}

/* Contenido Editable (mantener compatibilidad) */
.documento-contenido-editable {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

.contenido-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.contenido-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.contenido-vista {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    min-height: 200px;
    white-space: pre-wrap;
    line-height: 1.8;
}

.contenido-editor {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

.contenido-acciones {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Toast de notificaciones */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    font-weight: 500;
    display: none;
    animation: slideIn 0.3s ease-out;
}

.toast-success {
    background: #10b981;
}

.toast-error {
    background: #ef4444;
}

.toast-warning {
    background: #f59e0b;
}

.toast-info {
    background: #3b82f6;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.error-message {
    text-align: center;
    padding: 2rem;
    color: var(--danger-color);
}

/* ==========================================
   ACCESO RÁPIDO DOCUMENTOS (DASHBOARD)
   ========================================== */

.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.quick-access-card {
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.quick-access-card:hover {
    transform: translateY(-3px);
}

.quick-access-card .feature-icon {
    font-size: 2rem;
}

.quick-access-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.quick-access-card p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.quick-access-manuales {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 4px solid #2563eb;
}

.quick-access-procedimientos {
    background: linear-gradient(135deg, #ddd6fe 0%, #c4b5fd 100%);
    border-left: 4px solid #7c3aed;
}

.quick-access-auditorias {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #f59e0b;
}

.quick-access-capacitacion {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-left: 4px solid #10b981;
}

/* ==========================================
   NUEVOS MÓDULOS - NO CONFORMIDADES, ACCIONES CORRECTIVAS, AUDITORÍAS
   ========================================== */

/* Estilos comunes para los módulos */
.nc-container,
.ac-container,
.aud-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nc-header,
.ac-header,
.aud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.nc-header-info h1,
.ac-header-info h1,
.aud-header-info h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.nc-subtitle,
.ac-subtitle,
.aud-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Estadísticas rápidas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease;
}

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

.stat-icon {
    font-size: 2.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stat-card-total {
    border-left: 4px solid var(--info-color);
}

.stat-card-abiertas,
.stat-card-pendientes,
.stat-card-planificadas {
    border-left: 4px solid var(--warning-color);
}

.stat-card-criticas,
.stat-card-urgentes {
    border-left: 4px solid var(--danger-color);
}

.stat-card-cerradas,
.stat-card-finalizadas {
    border-left: 4px solid var(--success-color);
}

.stat-card-en-curso {
    border-left: 4px solid var(--primary-color);
}

/* Badges y etiquetas */
.codigo-badge {
    background: var(--bg-secondary);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-family: monospace;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.codigo-badge.codigo-grande {
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
}

.badge-severidad {
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-severidad-baja {
    background: #d1fae5;
    color: #065f46;
}

.badge-severidad-media {
    background: #fef3c7;
    color: #92400e;
}

.badge-severidad-alta {
    background: #fed7aa;
    color: #9a3412;
}

.badge-severidad-crítica {
    background: #fee2e2;
    color: #991b1b;
}

.badge-prioridad {
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-prioridad-baja {
    background: #dbeafe;
    color: #1e40af;
}

.badge-prioridad-media {
    background: #fef3c7;
    color: #92400e;
}

.badge-prioridad-alta {
    background: #fed7aa;
    color: #9a3412;
}

.badge-prioridad-urgente {
    background: #fee2e2;
    color: #991b1b;
}

.badge-tipo-nc,
.badge-tipo {
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-tipo-correctiva {
    background: #fed7aa;
    color: #9a3412;
}

.badge-tipo-preventiva {
    background: #d1fae5;
    color: #065f46;
}

.badge-tipo-interna {
    background: #dbeafe;
    color: #1e40af;
}

.badge-tipo-externa {
    background: #fce7f3;
    color: #831843;
}

.badge-tipo-certificación {
    background: #fef3c7;
    color: #92400e;
}

.badge-tipo-seguimiento {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-estado {
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-estado-abierta,
.badge-estado-planificada {
    background: #dbeafe;
    color: #1e40af;
}

.badge-estado-en-análisis,
.badge-estado-en-ejecución,
.badge-estado-en-curso {
    background: #fef3c7;
    color: #92400e;
}

.badge-estado-en-tratamiento,
.badge-estado-implementada {
    background: #fed7aa;
    color: #9a3412;
}

.badge-estado-verificada {
    background: #d1fae5;
    color: #065f46;
}

.badge-estado-cerrada,
.badge-estado-finalizada {
    background: #d1fae5;
    color: #065f46;
}

.badge-estado-cancelada {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-calificacion {
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-calificacion-satisfactorio {
    background: #d1fae5;
    color: #065f46;
}

.badge-calificacion-aceptable {
    background: #fef3c7;
    color: #92400e;
}

.badge-calificacion-no-satisfactorio {
    background: #fee2e2;
    color: #991b1b;
}

.badge-grande {
    font-size: 1rem;
    padding: 0.5rem 1rem;
}

.badge-muy-grande {
    font-size: 1.5rem;
    padding: 0.75rem 1.5rem;
}

/* Indicadores de tiempo */
.dias-vencidos {
    color: var(--danger-color);
    font-weight: 600;
    font-size: 0.85rem;
}

.dias-hoy {
    color: var(--warning-color);
    font-weight: 600;
    font-size: 0.85rem;
}

.dias-proximos {
    color: var(--warning-color);
    font-size: 0.85rem;
}

.dias-tiempo {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Tablas específicas */
.tabla-nc,
.tabla-ac,
.tabla-aud {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
}

.tabla-nc thead,
.tabla-ac thead,
.tabla-aud thead {
    background: var(--bg-secondary);
}

.tabla-nc th,
.tabla-ac th,
.tabla-aud th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tabla-nc td,
.tabla-ac td,
.tabla-aud td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.tabla-nc tbody tr,
.tabla-ac tbody tr,
.tabla-aud tbody tr {
    transition: background 0.2s ease;
}

.tabla-nc tbody tr:hover,
.tabla-ac tbody tr:hover,
.tabla-aud tbody tr:hover {
    background: var(--bg-secondary);
}

.nc-titulo-cell,
.ac-titulo-cell,
.aud-titulo-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nc-desc-preview,
.ac-desc-preview,
.aud-alcance-preview {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.text-muted {
    color: var(--text-secondary);
}

.clickable-row {
    cursor: pointer;
}

/* Vista de detalle */
.ver-nc-container,
.ver-ac-container,
.ver-aud-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nc-detalle-header,
.ac-detalle-header,
.aud-detalle-header {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.nc-codigo-titulo,
.ac-codigo-titulo,
.aud-codigo-titulo {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nc-meta-info,
.ac-meta-info,
.aud-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.nc-detalle-acciones,
.ac-detalle-acciones,
.aud-detalle-acciones {
    display: flex;
    gap: 1rem;
}

.nc-detalle-grid,
.ac-detalle-grid,
.aud-detalle-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.nc-detalle-seccion,
.ac-detalle-seccion,
.aud-detalle-seccion {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.seccion-titulo {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-item label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.info-item p {
    color: var(--text-primary);
    font-size: 1rem;
}

.texto-contenido {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    line-height: 1.8;
    white-space: pre-wrap;
}

.mensaje-vacio-seccion {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Cards de acciones y NC asociadas */
.acciones-list,
.nc-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.accion-card,
.nc-card,
.nc-asociada-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.accion-card:hover,
.nc-card:hover,
.nc-asociada-card:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.accion-header,
.nc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.accion-body,
.nc-body {
    margin-bottom: 1rem;
}

.accion-body h4,
.nc-body h4 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.accion-desc,
.nc-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.accion-footer,
.nc-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.fecha-info {
    color: var(--text-secondary);
}

/* Estado manager */
.estado-manager,
.calificacion-manager {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.eficacia-status {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.eficacia-verificada,
.eficacia-pendiente {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.icon-check,
.icon-pending {
    font-size: 4rem;
}

.calificacion-actual {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.mensaje-vacio-inline {
    color: var(--text-secondary);
    text-align: center;
    padding: 1rem;
}

/* Modales más grandes */
.modal-large {
    max-width: 800px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.required {
    color: var(--danger-color);
}

/* ==========================================
   SECCIONES DE FORMULARIO (para agrupar campos relacionados)
   ========================================== */

.form-seccion {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.form-seccion h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.nc-selector-container {
    margin-top: 0.5rem;
}

.nc-selector-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem;
}


.nc-checkbox-item {
    margin-bottom: 0.5rem;
}

.nc-checkbox-item label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    background: var(--bg-primary);
}

.nc-checkbox-item label:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.nc-checkbox-item input[type="checkbox"] {
    margin-top: 0.25rem;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.nc-checkbox-item strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.nc-checkbox-item small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.loading-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    display: none;
}

.loading-message:only-child {
    display: block;
}

.mensaje-vacio-seccion {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    display: none;
}

.mensaje-vacio-seccion:only-child {
    display: block;
}

/* Contenedor de no conformidades seleccionadas */
.nc-seleccionadas-container {
    margin-top: 1rem;
}

.nc-seleccionadas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.nc-seleccionada-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    transition: all 0.2s ease;
}

.nc-seleccionada-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.nc-seleccionada-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.nc-seleccionada-header strong {
    color: var(--primary-color);
    font-size: 1rem;
}

.nc-seleccionada-body {
    font-size: 0.9rem;
}

.nc-seleccionada-body p {
    margin: 0.5rem 0;
    color: var(--text-primary);
}

.nc-seleccionada-body strong {
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Widget links */
.widget-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.widget-link:hover {
    color: var(--secondary-color);
}

.widget-acciones .widget-value {
    color: #f59e0b;
}

.widget-auditorias .widget-value {
    color: #8b5cf6;
}

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

/* Responsive - Pantalla grande (sidebar colapsado con iconos) */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 220px;
    }

    .nav-link {
        padding: 0.75rem 0.875rem;
        font-size: 0.85rem;
    }

    .nav-link .nav-text {
        font-size: 0.85rem;
    }
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: var(--sidebar-collapsed-width);
    }

    /* Sidebar colapsado solo con iconos */
    .navbar {
        width: var(--sidebar-collapsed-width);
    }

    body {
        padding-left: var(--sidebar-collapsed-width);
    }

    .nav-brand {
        padding: 1rem 0.75rem;
        justify-content: center;
    }

    .logo-text,
    .logo-badge {
        display: none;
    }

    .logo-icon {
        font-size: 1.5rem;
    }

    .nav-menu {
        padding: 0 0.5rem;
    }

    .nav-link {
        padding: 0.875rem;
        justify-content: center;
        border-left: none;
        border-bottom: 2px solid transparent;
    }

    .nav-link .nav-text {
        display: none;
    }

    .nav-link .nav-icon {
        font-size: 1.25rem;
    }

    .nav-link:hover {
        transform: none;
        border-left: none;
        border-bottom-color: rgba(255, 255, 255, 0.3);
    }

    .nav-link.active {
        border-left: none;
        border-bottom-color: var(--primary-color);
    }

    /* Tooltip para iconos cuando el texto está oculto */
    .nav-link[title] {
        position: relative;
    }

    .nav-link[title]:hover::after {
        content: attr(title);
        position: absolute;
        left: calc(100% + 0.75rem);
        top: 50%;
        transform: translateY(-50%);
        background: var(--bg-darker);
        color: white;
        padding: 0.5rem 0.75rem;
        border-radius: 4px;
        font-size: 0.8rem;
        white-space: nowrap;
        z-index: 1002;
        pointer-events: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .nav-link[title]:hover::before {
        content: '';
        position: absolute;
        left: calc(100% + 0.25rem);
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
        border-right: 6px solid var(--bg-darker);
        z-index: 1002;
        pointer-events: none;
    }

    /* Usuario colapsado */
    .nav-user {
        padding: 0.5rem;
    }

    .user-button {
        padding: 0.5rem;
        justify-content: center;
    }

    .user-info,
    .dropdown-arrow {
        display: none;
    }

    .user-avatar {
        width: 40px;
        height: 40px;
    }

    .user-dropdown {
        left: calc(100% + 0.5rem);
        bottom: 0;
        right: auto;
        min-width: 240px;
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.2);
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {

    /* Compensar - sin sidebar en mobile */
    body {
        padding-left: 0;
        padding-top: 56px;
    }

    /* Navbar vuelve a ser horizontal en mobile */
    .navbar {
        width: 100%;
        height: 56px;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.25);
        background: linear-gradient(90deg, rgba(31, 41, 55, 0.98) 0%, rgba(17, 24, 39, 0.98) 100%);
    }

    .nav-container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0 1rem;
        height: 100%;
    }

    .nav-brand {
        padding: 0;
        border-bottom: none;
        background: none;
        min-height: auto;
        flex-direction: row;
        justify-content: flex-start;
    }

    .logo-text {
        display: block;
        font-size: 1.25rem;
    }

    .logo-badge {
        display: block;
    }

    .logo-icon {
        font-size: 1.5rem;
    }

    /* Mostrar botón hamburguesa */
    .nav-toggle {
        display: flex;
    }

    /* Overlay oscuro cuando el menú está abierto */
    .nav-overlay {
        display: block;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 999;
    }

    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Menú drawer lateral izquierdo */
    .nav-menu-wrapper {
        position: fixed;
        top: 56px;
        left: -280px;
        right: auto;
        width: 280px;
        height: calc(100vh - 56px);
        background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.3);
        overflow-y: auto;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 1.5rem 0;
        flex: none;
        z-index: 1001;
    }

    .nav-menu-wrapper.active {
        left: 0;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        padding: 0 1rem;
        align-items: stretch;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-link {
        width: 100%;
        justify-content: flex-start;
        padding: 1rem 1.25rem;
        border-radius: var(--border-radius);
        gap: 1rem;
        border-left: 3px solid transparent;
        border-bottom: none;
        transition: all 0.2s ease;
    }

    .nav-link:hover {
        background: rgba(255, 255, 255, 0.08);
        border-left-color: var(--primary-color);
        transform: translateX(4px);
    }

    .nav-link.active {
        background: rgba(37, 99, 235, 0.2);
        border-left-color: var(--primary-color);
    }

    .nav-link .nav-text {
        display: inline;
        font-size: 0.95rem;
        font-weight: 500;
    }

    .nav-link .nav-icon {
        font-size: 1.2rem;
        width: auto;
    }

    /* Tooltips deshabilitados en mobile */
    .nav-link[title]:hover::after,
    .nav-link[title]:hover::before {
        display: none;
    }

    /* Usuario en mobile - en el header */
    .nav-user {
        flex-direction: row;
        padding: 0;
        border-top: none;
        background: none;
        margin-top: 0;
    }

    .user-button {
        padding: 0.35rem;
        gap: 0.5rem;
        height: 40px;
        width: auto;
        background: transparent;
        border: none;
    }

    .user-button:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .user-info {
        display: none;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .dropdown-arrow {
        display: none;
    }

    /* Dropdown de usuario en mobile */
    .user-dropdown {
        position: fixed;
        top: 56px;
        right: 0;
        left: auto;
        bottom: auto;
        width: 100%;
        max-width: 300px;
        border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    }
}

/* Responsive - Mobile pequeño */
@media (max-width: 480px) {
    body {
        padding-top: 52px;
    }

    .navbar {
        height: 52px;
    }

    .nav-container {
        padding: 0 0.75rem;
    }

    .nav-brand {
        font-size: 1.1rem;
        gap: 0.5rem;
    }

    .logo-icon {
        font-size: 1.3rem;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .logo-badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }

    .nav-toggle {
        width: 36px;
        height: 36px;
        padding: 6px;
    }

    .nav-toggle span {
        width: 18px;
    }

    .user-button {
        padding: 0.3rem;
        height: 36px;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    /* Overlay ajustado para pantalla pequeña */
    .nav-overlay {
        top: 52px;
    }

    /* Menú drawer full width en pantallas muy pequeñas */
    .nav-menu-wrapper {
        top: 52px;
        width: 85%;
        left: -85%;
        height: calc(100vh - 52px);
    }

    .nav-menu-wrapper.active {
        left: 0;
    }

    .user-dropdown {
        top: 52px;
        max-width: 100%;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

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


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

    .documentos-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filtros-container {
        flex-direction: column;
    }

    .filtro-grupo {
        width: 100%;
    }

    .tabla-documentos {
        font-size: 0.85rem;
    }

    .tabla-documentos th,
    .tabla-documentos td {
        padding: 0.5rem;
    }

    .documento-header {
        flex-direction: column;
    }

    .documento-acciones {
        width: 100%;
        flex-direction: column;
    }

    .documento-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .pdf-viewer-container {
        height: 500px;
    }

    .nc-header,
    .ac-header,
    .aud-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

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

    .acciones-list,
    .nc-list {
        grid-template-columns: 1fr;
    }

    .nc-detalle-header,
    .ac-detalle-header,
    .aud-detalle-header {
        flex-direction: column;
    }

    .nc-detalle-acciones,
    .ac-detalle-acciones,
    .aud-detalle-acciones {
        width: 100%;
        flex-direction: column;
    }
}

/* ==========================================
   CUADRO INFORMATIVO DE REFERENCIAS
   ========================================== */

.cuadro-informativo {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.cuadro-informativo h3 {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.referencias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.referencia-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.referencia-item .codigo {
    font-weight: 600;
    color: var(--primary-color);
    margin-right: 0.75rem;
    min-width: 3rem;
}

.referencia-item .descripcion {
    color: var(--text-primary);
    font-size: 0.875rem;
}

.nota-informativa {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: var(--border-radius);
    padding: 0.75rem;
    margin-top: 1rem;
    color: #92400e;
    font-size: 0.875rem;
    line-height: 1.4;
}

.nota-informativa strong {
    color: #78350f;
}

/* Responsive para referencias */
@media (max-width: 768px) {
    .referencias-grid {
        grid-template-columns: 1fr;
    }

    .cuadro-informativo {
        padding: 1rem;
    }
}

/* ==========================================
   ESTILOS GENÉRICOS PARA FORMULARIOS DE CREACIÓN/EDICIÓN
   Plantilla base reutilizable para todos los formularios "nueva" o "crear"
   ========================================== */

/* Contenedor principal del formulario */
.form-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header del formulario */
.form-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

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

.form-header-info h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.form-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
}

.form-header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Formulario principal */
.form-main {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

/* Filas del formulario */
.form-row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Grupos de formulario con diferentes tamaños */
.form-grupo {
    margin-bottom: 1.5rem;
}

.form-grupo-small {
    grid-column: span 3;
}

.form-grupo-medium {
    grid-column: span 6;
}

.form-grupo-large {
    grid-column: span 9;
}

.form-grupo-full {
    grid-column: span 12;
}

/* Grupo de checkboxes */
.checkbox-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: background 0.2s ease;
}

.checkbox-label:hover {
    background: var(--bg-secondary);
}

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

.checkbox-text {
    font-weight: 500;
    color: var(--text-primary);
    user-select: none;
}

/* Select con acciones (botones de agregar/editar/eliminar) */
.select-with-actions {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.select-with-actions select {
    flex: 1;
}

.select-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

/* Estilos para elementos de formulario dentro de form-grupo */
.form-grupo label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-grupo input[type="text"],
.form-grupo input[type="number"],
.form-grupo input[type="date"],
.form-grupo input[type="email"],
.form-grupo input[type="tel"],
.form-grupo select,
.form-grupo textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-grupo input:focus,
.form-grupo select:focus,
.form-grupo textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-grupo textarea {
    resize: vertical;
    min-height: 100px;
}

.form-grupo small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Campos requeridos */
.required {
    color: var(--danger-color);
    font-weight: 700;
}

/* Botones de acción del formulario */
.form-acciones {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive para formularios */
@media (max-width: 1024px) {
    .form-grupo-small {
        grid-column: span 6;
    }

    .form-grupo-medium {
        grid-column: span 12;
    }

    .form-grupo-large {
        grid-column: span 12;
    }
}

@media (max-width: 768px) {
    .form-container {
        padding: 1rem;
    }

    .form-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .form-header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .form-main {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-grupo-small,
    .form-grupo-medium,
    .form-grupo-large,
    .form-grupo-full {
        grid-column: span 1;
    }

    .checkbox-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    .form-acciones {
        flex-direction: column-reverse;
    }

    .form-acciones .btn {
        width: 100%;
    }
}

/* ==========================================
   GESTIÓN DE USUARIOS
   ========================================== */

/* Badges de roles */
.badge-rol {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
}

.badge-rol-admin {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.badge-rol-calidad {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.badge-rol-operacion {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

/* Estadísticas específicas de usuarios */
.stat-card-admin {
    border-left: 4px solid #667eea;
}

.stat-card-calidad {
    border-left: 4px solid #10b981;
}

.stat-card-operacion {
    border-left: 4px solid #6b7280;
}

/* Info boxes */
.info-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-box-light {
    background: #f0f9ff;
    border-left-color: var(--info-color);
}

.info-box h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-list {
    margin: 0;
    padding-left: 1.5rem;
}

.info-list li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.info-list li strong {
    color: var(--text-primary);
}

.info-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 0.5rem 0;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.info-row div {
    color: var(--text-secondary);
}

.info-row strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Section titles */
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.section-title:first-child {
    margin-top: 0;
}

/* Form help text */
.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Badge estados activo/inactivo */
.badge-estado-activo {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.badge-estado-inactivo {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

/* Responsive para gestión de usuarios */
@media (max-width: 768px) {
    .info-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .badge-rol {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }
}

/* ==========================================
   ESTILOS PARA NO CONFORMIDADES - NOVEDADES AGRUPADAS
   ========================================== */

.seccion-fuente {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.novedades-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.novedades-controls .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.novedades-container {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    background: var(--bg-secondary);
}

.grupo-novedades {
    margin-bottom: 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.grupo-novedades:last-child {
    margin-bottom: 0;
}

.grupo-novedades-header {
    display: flex;
    align-items: center;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.grupo-novedades-header input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-right: 0.5rem;
}

.grupo-novedades-header label {
    cursor: pointer;
    user-select: none;
    flex: 1;
}

.novedades-lista {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.novedad-item {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.novedad-item:hover {
    background: #f3f4f6;
    border-color: var(--primary-color);
}

.novedad-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.novedad-item label {
    flex: 1;
    margin-left: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.novedad-item label strong {
    color: var(--primary-color);
    font-size: 0.95rem;
}

.novedad-item label small {
    color: var(--text-secondary);
    display: block;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.mensaje-vacio {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Indeterminate checkbox state */
input[type="checkbox"]:indeterminate {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cline x1='2' y1='6' x2='10' y2='6' stroke='white' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

@media (max-width: 768px) {
    .novedades-controls {
        flex-direction: column;
    }

    .novedades-controls .btn {
        width: 100%;
    }

    .novedad-item {
        flex-direction: column;
    }

    .novedad-item label {
        margin-left: 0;
        margin-top: 0.5rem;
    }
}

/* ==========================================
   CLASES UTILITARIAS
   Reemplazan estilos inline en templates
   ========================================== */

/* Visibilidad - sin !important para compatibilidad con JS que usa style.display */
.hidden {
    display: none;
}

.invisible {
    visibility: hidden;
}

/* Texto */
.text-center {
    text-align: center;
}

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

.text-muted {
    color: var(--text-secondary);
}

.text-small {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

/* Márgenes */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }

/* Ancho fijo para columnas de tablas de impresión */
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-50 { width: 50%; }
.w-100 { width: 100%; }
.w-100px { width: 100px; }