:root {
    --primary: #1877F2;
    --primary-dark: #0d5fc9;
    --primary-light: #3b9bf7;
    --primary-ultra-light: #e3f2fd;
    --secondary: #64748b;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --error: #ef4444;
    --error-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffafe;

    /* Paleta funcional — tokens semánticos reutilizables (rutas de la app) */
    --primary-soft: #eff6ff;
    --primary-line: #bfdbfe;
    --success-dark: #047857;
    --success-soft: #ecfdf5;
    --success-line: #a7f3d0;
    --warning-dark: #b45309;
    --warning-soft: #fffbeb;
    --warning-line: #fde68a;
    --info-dark: #0e7490;
    --info-soft: #ecfeff;
    --info-line: #a5f3fc;
    --accent: #7C3AED;
    --accent-dark: #6d28d9;
    --accent-light: #ede9fe;
    --accent-soft: #f5f3ff;
    --accent-line: #ddd6fe;
    --danger: #EF4444;
    --danger-dark: #b91c1c;
    --danger-light: #fee2e2;
    --danger-soft: #fef2f2;
    --danger-line: #fecaca;
    --surface: #F8FAFC;
    --text: #172033;
    
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #1877F2;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #64748B;
    --text-inverse: #ffffff;
    
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 6px 10px -3px rgb(0 0 0 / 0.1), 0 2px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-primary: 0 4px 14px 0 rgba(24, 119, 242, 0.39);
    
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

    /* Escala de letter-spacing — nombrada por valor ya en uso, no inventa tracking nuevo */
    --tracking-tight: -0.01em;
    --tracking-snug: -0.005em;
    --tracking-normal: 0;
    --tracking-wide: 0.3px;
    --tracking-wider: 0.5px;
    --tracking-widest: 2px;

    --sidebar-width: 280px;
    --header-height: 70px;
    
    --transition-fast: 0.15s ease;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    pointer-events: all;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.login-page {
    pointer-events: all;
}

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

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

.main-content.sidebar-collapsed {
    margin-left: 80px;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .user-details {
    display: none !important;
}

.sidebar.collapsed .sidebar-close {
    display: none;
}

aside.sidebar.collapsed .sidebar-footer .user-details {
    display: none !important;
}

aside.sidebar.collapsed .sidebar-footer .user-name {
    display: none !important;
}

aside.sidebar.collapsed .sidebar-footer .user-info {
    justify-content: center !important;
}

aside.sidebar.collapsed .sidebar-footer .user-info .user-avatar {
    margin: 0 auto !important;
}

.sidebar.collapsed .logo {
    justify-content: center;
    width: 100%;
}

.sidebar.collapsed .sidebar-header-actions {
    margin-left: 0;
    justify-content: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.sidebar.collapsed .sidebar-toggle-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    width: 100%;
}

.sidebar.collapsed .sidebar-toggle-btn svg {
    display: block;
    width: 20px;
    height: 20px;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 14px;
    overflow: visible;
}

.sidebar.collapsed .sidebar-nav {
    padding: 20px 10px;
    overflow-x: visible;
    overflow-y: visible;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.05) 100%);
    position: relative;
    z-index: 1;
}

.sidebar.collapsed .sidebar-footer {
    padding: 16px 10px;
    justify-content: center;
}

.sidebar.collapsed .user-info {
    justify-content: center;
}

.sidebar.collapsed .logout-btn {
    padding: 10px;
}

.sidebar .nav-item {
    position: relative;
}

.sidebar .nav-item .nav-tooltip {
    display: none;
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 1000;
    margin-left: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sidebar .nav-item .nav-tooltip::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #1e293b;
}

.sidebar.collapsed .nav-item:hover .nav-tooltip {
    display: block;
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.sidebar-toggle-btn {
    display: none;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    width: auto;
    min-width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-toggle-btn svg {
    width: 20px;
    height: 20px;
    display: block;
}

@media (min-width: 1024px) {
    .sidebar-toggle-btn {
        display: flex;
    }
}

.content-wrapper {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #1877F2 0%, #0d5fc9 50%, #0a4a9e 100%);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    box-shadow: 4px 0 20px rgba(24, 119, 242, 0.3);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 90;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    gap: 10px;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.sidebar.collapsed .logo {
    justify-content: center;
    width: 100%;
    margin-bottom: 5px;
}

.sidebar.collapsed .sidebar-header-actions {
    margin-left: 0;
    justify-content: center;
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.sidebar.collapsed .sidebar-close {
    display: none;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: white;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-inverse);
    letter-spacing: var(--tracking-widest);
}

.logo-image {
    display: block;
    height: 40px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.sidebar.collapsed .logo-image {
    height: 32px;
    max-width: 44px;
}

.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-inverse);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-toggle svg {
    width: 24px;
    height: 24px;
}

.sidebar-close {
    display: none;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-close svg {
    width: 24px;
    height: 24px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.05) 100%);
    position: relative;
    z-index: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-weight: 500;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left: 3px solid white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-left: 3px solid white;
}

.nav-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.1);
}

.sidebar .sidebar-footer .user-info {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-direction: row !important;
    flex: 0 1 auto !important;
}

.sidebar .sidebar-footer .user-details {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 2px !important;
    flex: 0 1 auto !important;
}

.sidebar .sidebar-footer .user-name {
    color: var(--text-inverse) !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    margin: 0 !important;
}

.sidebar .sidebar-footer .user-avatar {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #1877F2 0%, #06b6d4 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-weight: 600 !important;
    font-size: 1.1rem !important;
}

aside.sidebar.collapsed .sidebar-footer .user-details {
    display: none !important;
}

aside.sidebar.collapsed .sidebar-footer .user-name {
    display: none !important;
}

aside.sidebar.collapsed .sidebar-footer .user-info {
    justify-content: center !important;
}

aside.sidebar.collapsed .sidebar-footer .user-info .user-avatar {
    margin: 0 auto !important;
}

.sidebar .sidebar-footer .badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 3px 10px !important;
    border-radius: 12px !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    text-transform: capitalize !important;
    white-space: nowrap !important;
}

.sidebar .sidebar-footer .badge-superadmin {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%) !important;
    color: white !important;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.4) !important;
}

.sidebar .sidebar-footer .badge-administrador {
    background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%) !important;
    color: white !important;
    box-shadow: 0 2px 4px rgba(14, 165, 233, 0.4) !important;
}

.sidebar .sidebar-footer .badge-archivos {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%) !important;
    color: white !important;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.4) !important;
}

.sidebar .sidebar-footer .badge-usuario {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%) !important;
    color: white !important;
    box-shadow: 0 2px 4px rgba(100, 116, 139, 0.4) !important;
}

.logout-btn {
    padding: 10px;
    color: rgba(255, 255, 255, 0.7);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.logout-btn svg {
    width: 20px;
    height: 20px;
}

.header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-primary);
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
}

.header-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-full);
}

.header-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.header-user-role {
    font-size: 0.75rem !important;
    padding: 2px 8px !important;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Acciones superiores unificadas — Notificaciones, Mi Perfil y Cerrar
   Sesión comparten exactamente la misma escala (40x40), radio, tipografía
   de icono y área táctil; solo cambia el color en hover/focus según su
   semántica (azul institucional para navegación, rojo solo para salir). */
.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: var(--transition-fast);
    border: none;
    cursor: pointer;
}

.header-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.header-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.28);
}

.header-btn svg {
    width: 20px;
    height: 20px;
}

/* Botón "Mi Perfil": misma caja que sus hermanos .header-btn, pero su
   contenido es el avatar (foto o silueta) en vez de un ícono genérico.
   Círculo azul institucional con silueta blanca — coherencia visual con el
   avatar que muestra el propio /mi-perfil (fuente única: usuario_helper). */
.header-btn-avatar {
    font-size: 0.85rem;
    font-weight: 700;
    overflow: hidden;
    background: var(--primary-dark);
    color: #ffffff;
    border-radius: 50%;
}

/* .header-btn:hover común haría el círculo gris con ícono azul (regla
   anterior, misma especificidad): se fuerza a mantener la identidad azul,
   con un aclarado sutil que indica interactividad sin cambiar el bloque. */
.header-btn-avatar:hover {
    background: var(--primary);
    color: #ffffff;
}

.header-btn-logout:hover,
.header-btn-logout:focus-visible {
    background: #fee2e2;
    color: var(--error);
}

.header-btn-logout:focus-visible {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.28);
}

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

.page-header-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header-content p {
    color: var(--text-secondary);
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn:hover::after {
    width: 200px;
    height: 200px;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, #1877F2 0%, #0d5fc9 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(24, 119, 242, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

.btn-block {
    width: 100%;
    justify-content: center;
}

.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
    position: relative;
    border-left: 4px solid;
    text-align: center;
}

.alert > *:not(.alert-close) {
    flex: 1;
}

.alert svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.alert ul {
    margin: 8px 0 0 20px;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-left-color: var(--success);
    box-shadow: var(--shadow);
}

.alert-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-left-color: var(--error);
    box-shadow: var(--shadow);
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border-left-color: var(--warning);
    box-shadow: var(--shadow);
}

.alert-info {
    background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%);
    color: #0e7490;
    border-left-color: var(--info);
    box-shadow: var(--shadow);
}

.alert-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0 4px;
    margin-left: auto;
    opacity: 0.6;
    transition: opacity 0.2s;
    line-height: 1;
    color: inherit;
}

.alert-close:hover {
    opacity: 1;
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--info));
    transform: scaleX(0);
    transform-origin: left;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 30px;
    height: 30px;
}

.stat-primary .stat-icon {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1877F2;
}

.stat-success .stat-icon {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: var(--success);
}

.stat-info .stat-icon {
    background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%);
    color: var(--info);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

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

.stat-warning .stat-icon {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.stat-warning .stat-value {
    color: #92400e;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

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

.chart-simple {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chart-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-label {
    min-width: 60px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.chart-bar-container {
    flex: 1;
    height: 24px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.chart-bar {
    height: 100%;
    background: linear-gradient(90deg, #1877F2 0%, #3b9bf7 100%);
    border-radius: var(--border-radius-sm);
    transition: width 0.5s ease;
}

.chart-bar-secondary {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.chart-value {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.activity-item:hover {
    background: var(--bg-primary);
}

.activity-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1877F2;
    flex-shrink: 0;
}

.activity-icon svg {
    width: 20px;
    height: 20px;
}

.activity-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.activity-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.activity-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.personal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.personal-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
}

.personal-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.personal-stat-icon svg {
    width: 20px;
    height: 20px;
}

.personal-stat-info {
    display: flex;
    flex-direction: column;
}

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

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

.dashboard-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

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

.card-body {
    padding: 24px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1877F2 0%, #06b6d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.profile-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-item {
    display: flex;
    gap: 8px;
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 60px;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

.badge {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-superadmin {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: white;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-administrador {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0369a1;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-archivos {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #0d5fc9;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-usuario {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #475569;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-purple {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    color: #7c3aed;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-teal {
    background: linear-gradient(135deg, #ccfbf1 0%, #99f6e4 100%);
    color: #0d9488;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-orange {
    background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
    color: #c2410c;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-pink {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    color: #be185d;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-cyan {
    background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%);
    color: #0e7490;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.badge-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.badge-pendiente {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.badge-activo {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.badge-rechazado {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.badge-personal {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #475569;
}

.notification-count {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 1px 8px;
    border-radius: var(--border-radius-full);
    background: rgba(255, 255, 255, 0.65);
    font-size: 0.7rem;
    color: var(--primary-dark);
    font-weight: 700;
}

.notification-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    background: transparent;
    text-align: center;
    flex-shrink: 0;
}

.view-all-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 6px 8px;
    border-radius: var(--border-radius-sm);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.83rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.view-all-link:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

.view-all-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.28);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
}

.action-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.action-btn svg {
    width: 24px;
    height: 24px;
}

.search-container {
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--bg-card);
}

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

.filters-form {
    margin-top: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.filters-form:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    align-items: end;
}

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

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-group .form-input,
.filter-group .form-select {
    padding: 10px 12px;
    font-size: 0.9rem;
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.results-info {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-radius: var(--border-radius-sm);
    color: #0369a1;
    font-weight: 500;
    display: inline-block;
}

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

.header-section h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-section h1 i,
.header-section h1 svg {
    color: var(--primary);
}

.header-section p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.table-container {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow);
}

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

.data-table thead {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, #e8eef4 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    border-bottom: 2px solid var(--primary);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition);
    position: relative;
}

.data-table tbody tr:hover {
    background: linear-gradient(90deg, var(--primary-ultra-light) 0%, transparent 100%);
}

.data-table tbody tr:hover td:first-child {
    border-left: 3px solid var(--primary);
}

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

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

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

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

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-edit {
    background: #e3f2fd;
    color: #1877F2;
}

.btn-edit:hover {
    background: #1877F2;
    color: white;
}

.btn-delete {
    background: #fee2e2;
    color: var(--error);
}

.btn-delete:hover {
    background: var(--error);
    color: white;
}

/* Eliminación de cadena completa: distinta del borrado de borradores
   (.btn-delete) — visible en cualquier estado_documental para superadmin,
   por eso lleva un tono más intenso para no confundirse visualmente con
   una acción reversible. */
.btn-delete-cadena {
    background: var(--error);
    color: white;
}

.btn-delete-cadena:hover {
    background: #991b1b;
    color: white;
}

.btn-download {
    background: #d1fae5;
    color: var(--success);
}

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

.btn-signature {
    background: #ccfbf1;
    color: #0d9488;
    cursor: pointer;
}

.btn-signature:hover {
    background: #0d9488;
    color: white;
}

.btn-cancel-signature {
    background: #fef3c7;
    color: #b45309;
    cursor: pointer;
}

.btn-cancel-signature:hover {
    background: #b45309;
    color: white;
}

.btn-verify {
    background: #ede9fe;
    color: #6d28d9;
    cursor: pointer;
}

.btn-verify:hover {
    background: #6d28d9;
    color: white;
}

.btn-attach-pdf {
    background: #fff7ed;
    color: #c2410c;
    cursor: pointer;
}

.btn-attach-pdf:hover {
    background: #c2410c;
    color: white;
}

.btn-correccion {
    background: #fef3c7;
    color: #92400e;
    cursor: pointer;
}

.btn-correccion:hover {
    background: #92400e;
    color: white;
}

.btn-correccion-metadatos {
    background: #e0e7ff;
    color: #4338ca;
    cursor: pointer;
}

.btn-correccion-metadatos:hover {
    background: #4338ca;
    color: white;
}

.btn-historial {
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
}

.btn-sign {
    background: #dcfce7;
    color: #15803d;
    cursor: pointer;
}

.btn-sign:hover {
    background: #15803d;
    color: white;
}

.btn-sign-pending {
    background: #fef3c7;
    color: #92400e;
    cursor: pointer;
}

.btn-sign-pending:hover {
    background: #92400e;
    color: white;
}

.btn-sign-cancel {
    background: #fee2e2;
    color: #b91c1c;
    cursor: pointer;
}

.btn-sign-cancel:hover {
    background: #b91c1c;
    color: white;
}

.btn-signed {
    background: #dbeafe;
    color: #1d4ed8;
    cursor: pointer;
}

.btn-signed:hover {
    background: #1d4ed8;
    color: white;
}

.btn-historial:hover {
    background: #475569;
    color: white;
}

.inline-action-form {
    display: inline-flex;
    margin: 0;
}

.form-container {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 32px;
    box-shadow: var(--shadow);
}

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

.form-section:last-of-type {
    margin-bottom: 0;
}

.form-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section-title svg {
    color: var(--primary);
    flex-shrink: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.login-form .form-grid {
    gap: 8px;
    margin-bottom: 8px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.login-form .form-group {
    margin-bottom: 8px;
}

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

.form-input,
.form-select,
.form-textarea {
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-family);
    width: 100%;
    pointer-events: auto;
    opacity: 1;
}

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

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 44px;
}

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

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

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

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

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.file-info svg {
    width: 20px;
    height: 20px;
    color: var(--success);
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1877F2 0%, #0d5fc9 100%);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.login-page * {
    z-index: 10;
}

.login-container {
    position: relative;
    z-index: 100;
    width: 100%;
    max-width: 650px;
    padding: 20px;
}

.login-container .alert {
    justify-content: center;
    text-align: center;
    flex-direction: column;
}

.login-container .alert svg {
    margin: 0 auto 8px;
    flex-shrink: 0;
}

.login-container .alert span,
.login-container .alert strong {
    display: block;
    text-align: center;
}

.login-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 25px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.5);
    max-height: 100vh;
    overflow-y: auto;
}

@media (max-width: 480px) {
    .login-card {
        padding: 20px;
        max-height: 95vh;
    }
}

.login-header {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #1877F2 0%, #0d5fc9 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 4px 14px rgba(24, 119, 242, 0.4);
}

.login-logo svg {
    width: 36px;
    height: 36px;
    color: white;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 0;
}

.login-form .form-group {
    position: relative;
    z-index: 10;
}

.login-form .form-input {
    position: relative;
    z-index: 10;
    pointer-events: all !important;
    cursor: text !important;
}

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper .form-input {
    padding-right: 50px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-muted);
    transition: var(--transition);
}

.toggle-password:hover {
    color: var(--text-primary);
}

.toggle-password svg {
    width: 20px;
    height: 20px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 100;
}

.login-footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.login-footer .link {
    color: #1877F2;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    z-index: 100;
}

.login-footer .link:hover {
    text-decoration: underline;
}

.login-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 0;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    z-index: 0;
}

.bg-shape-1 {
    width: 400px;
    height: 400px;
    background: #0d5fc9;
    top: -100px;
    right: -100px;
    animation: float 20s ease-in-out infinite;
}

.bg-shape-2 {
    width: 300px;
    height: 300px;
    background: #3b9bf7;
    bottom: -50px;
    left: -50px;
    animation: float 15s ease-in-out infinite reverse;
}

.bg-shape-3 {
    width: 200px;
    height: 200px;
    background: var(--success);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 10s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(30px, 30px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.5;
    }
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 85%;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 85%;
        max-width: 300px;
        background: linear-gradient(180deg, #1877F2 0%, #0d5fc9 50%, #0a4a9e 100%) !important;
        box-shadow: 4px 0 20px rgba(24, 119, 242, 0.5) !important;
        z-index: 100;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar.active ~ .sidebar-overlay {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .content-wrapper {
        padding: 16px;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .sidebar-close {
        display: block;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .page-header .btn {
        width: 100%;
        justify-content: center;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-form .btn {
        width: 100%;
        justify-content: center;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 800px;
    }
    
    .header-date {
        display: none;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    :root {
        --header-height: 60px;
    }
    
    .login-card {
        padding: 24px;
        border-radius: 16px;
        max-height: 95vh;
    }
    
    .login-logo {
        width: 60px;
        height: 60px;
        border-radius: 16px;
    }
    
    .login-logo svg {
        width: 32px;
        height: 32px;
    }
    
    .login-header h1 {
        font-size: 1.25rem;
    }
    
    .header-title {
        font-size: 1.25rem;
    }
    
    .header-section h1 {
        font-size: 1.5rem;
    }
    
    .stat-card {
        padding: 16px;
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
    }
    
    .data-table th,
    .data-table td {
        padding: 12px 8px;
        font-size: 0.85rem;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.875rem;
    }
    
    .form-input {
        padding: 12px 14px;
    }
    
    .filters-form {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .table-actions {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-wrap: wrap;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.fade-in-row {
    animation: slideUp 0.3s ease forwards;
    opacity: 0;
}

.fade-in-card {
    animation: scaleIn 0.4s ease forwards;
    opacity: 0;
}

.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.stat-card {
    animation: slideUp 0.4s ease forwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.dashboard-card {
    animation: scaleIn 0.4s ease forwards;
}

.data-table tbody tr {
    animation: fadeIn 0.3s ease forwards;
}

.data-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.data-table tbody tr:nth-child(2) { animation-delay: 0.1s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.2s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.25s; }

.loading-skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-primary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin-left: -9px;
    margin-top: -9px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.transition-all {
    transition: var(--transition);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.hover-scale:hover {
    transform: scale(1.02);
}

.cursor-pointer {
    cursor: pointer;
}

.select-none {
    user-select: none;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scrollbar-thin::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.3);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: var(--tracking-wide);
}

.badge-success {
    background: var(--success-light);
    color: #065f46;
}

.badge-warning {
    background: var(--warning-light);
    color: #92400e;
}

.badge-error {
    background: var(--error-light);
    color: #991b1b;
}

.badge-info {
    background: var(--info-light);
    color: #0e7490;
}

.badge-primary {
    background: var(--primary-ultra-light);
    color: var(--primary-dark);
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

.badge-default {
    background: #f1f5f9;
    color: #64748b;
}

.no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.no-data svg {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-data p {
    font-size: 1rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

.card-hover {
    transition: var(--transition);
}

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

.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.input-icon-wrapper .form-input {
    padding-left: 42px;
}

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

.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--info) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.badge-disponible {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-disponible::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
}

.badge-no-disponible {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #64748b;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.75rem;
}

.pdf-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-preview {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0369a1;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.btn-preview:hover {
    background: linear-gradient(135deg, #bae6fd 0%, #7dd3fc 100%);
    transform: scale(1.1);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    max-width: 90%;
    max-height: 90%;
    width: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scaleIn 0.3s ease;
}

.modal-large {
    width: 900px;
    max-width: 100%;
    height: 85vh;
}

.modal-pdf {
    width: 100%;
    height: 100%;
    padding: 30px;
    align-items: center;
    justify-content: center;
}

.modal-pdf .modal-content {
    width: 100%;
    max-width: 1000px;
    height: auto;
    min-height: 500px;
    max-height: 90vh;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0;
}

.modal-sm {
    width: 450px;
}

.modal-sm .modal-content {
    max-width: 100%;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--error-light);
    color: var(--error);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-card);
}

.modal-body-iframe {
    padding: 0;
    margin: 0;
    background: #e8eaed;
    flex: 1;
    min-height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body-iframe iframe {
    width: 100%;
    height: 100%;
    min-height: 450px;
    border: none;
    background: white;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-card);
}

.modal-footer .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 768px) {
    .modal-large {
        width: 95%;
        height: 80vh;
    }
    
    .modal-pdf {
        width: 100%;
        height: 100vh;
        max-width: 100%;
        padding: 0;
    }
    
    .modal-pdf .modal-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .modal-sm {
        width: 90%;
    }
    
    .modal-body iframe {
        min-height: 300px;
    }
    
    .modal-body-iframe {
        min-height: 400px;
    }
    
    .modal-body-iframe iframe {
        min-height: 400px;
    }
    
    .pdf-actions {
        flex-direction: row;
    }
}

@media (max-width: 480px) {
    .modal-large {
        width: 100%;
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
    }
    
    .modal-sm {
        width: 100%;
        padding: 0;
    }
    
    .modal-sm .modal-content {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 90vh;
        margin: 20px;
        border-radius: var(--border-radius);
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

.notification-wrapper {
    position: relative;
}

.notification-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: none;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.notification-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.notification-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.28);
}

.notification-btn svg {
    width: 20px;
    height: 20px;
}

/* Badge de conteo real — sin animación, solo un anillo blanco para que
   se lea con claridad sobre el icono en cualquier estado del botón */
.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--error);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-card);
    box-shadow: 0 1px 2px rgba(16, 19, 26, 0.12);
}

/* ---------- Panel de notificaciones: componente premium y compacto,
   misma superficie/sombra del sistema (--bg-card, --shadow-lg,
   --border-radius) — sin crear un sistema paralelo de tarjetas. ---------- */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 372px;
    max-width: calc(100vw - 32px);
    max-height: 440px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 100;
    display: none;
    overflow: hidden;
    margin-top: 10px;
    flex-direction: column;
}

.notification-dropdown.active {
    display: flex;
    animation: slideDown 0.2s ease;
}

/* Relación visual clara entre la campana y el popover abierto — mismo
   tinte azul que la cabecera del panel, activado por aria-expanded (ya
   alternado por el script existente, sin lógica nueva) */
.notification-btn[aria-expanded="true"] {
    background: var(--primary-ultra-light);
    color: var(--primary-dark);
}

/* Cabecera diferenciada: tinte azul institucional muy suave, icono de
   campana + título + contador real de pendientes */
.notification-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--primary-ultra-light);
    flex-shrink: 0;
}

.notification-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(24, 119, 242, 0.14);
    color: var(--primary-dark);
    flex-shrink: 0;
}

.notification-header-icon svg {
    width: 15px;
    height: 15px;
}

.notification-header-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.notification-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Múltiples notificaciones sin crecimiento indefinido del popover — el
   límite ya lo aplica el propio controlador (slice de 5); esto solo
   evita que la propia altura de los ítems empuje el panel más allá de
   una altura cómoda, con scroll interno únicamente si hace falta. */
.notification-body {
    max-height: 340px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.notification-item:hover {
    background: var(--bg-secondary);
}

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

/* Notificaciones de corrección de PDF: mismo bloque .notification-item,
   pero es un enlace completo (nunca acción inline) — se anula el
   subrayado/color de enlace por defecto y se diferencia el avatar del
   de "solicitud de usuario" con un color distinto. */
.notification-item-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

/* Disparador de "marcar como leída": el <form> no participa del layout
   (display: contents), el <button> dentro reproduce exactamente el mismo
   flex que .notification-item tenía antes con el <a>/<div> directo. */
.notification-item-lectura-form {
    display: contents;
}

.notification-item-trigger {
    all: unset;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
}

/* Ya leída: se conserva en el listado mientras siga vigente (no se
   elimina), solo se atenúa visualmente frente a las no leídas. */
.notification-item-leida {
    opacity: 0.6;
}

.notification-avatar-correccion {
    background: var(--info, #0d5fc9);
}

/* Iniciales del solicitante — mismo patrón de avatar sólido institucional
   usado en /mi-perfil, sin degradados */
/* Fotografía de perfil dentro de cualquier contenedor de avatar existente
   (.pf-avatar, .user-avatar, .notification-avatar, .header-btn) — hereda
   el tamaño y la forma (círculo o cuadrado redondeado) del contenedor que
   la envuelve en cada vista, sin necesidad de una regla por vista. */
.avatar-foto {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

/* Marca SVG del avatar (usuario_helper::avatar_svg_html) — se escala al
   contenedor como la foto (.pf-avatar, .user-avatar, .notification-avatar,
   .header-btn-avatar) y hereda su forma; color heredado del contenedor
   (fondo azul institucional + trazo blanco). */
.avatar-svg {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: inherit;
}

.notification-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-dark);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

/* El nombre completo puede ocupar hasta 2 líneas antes de truncar — ya
   no se corta agresivamente a una sola línea; DNI queda claramente como
   información secundaria debajo. */
.notification-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
}

.notification-content strong {
    font-size: 0.87rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.notification-content span {
    font-size: 0.76rem;
    color: var(--text-secondary);
}

/* Separación visual explícita entre el estado (Pendiente) y las
   acciones — el badge queda agrupado con la información, no pegado a
   los botones de aceptar/rechazar */
.notification-content .badge-pending {
    align-self: flex-start;
    margin-top: 3px;
}

.notification-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-top: 1px;
    padding-left: 10px;
    border-left: 1px solid var(--border-color);
}

.notification-actions a {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    text-decoration: none;
}

.notification-actions a svg {
    width: 15px;
    height: 15px;
}

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

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

.btn-approve:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

.btn-approve:active,
.btn-reject:active {
    transform: scale(0.92);
}

.btn-reject {
    background: var(--error-light);
    color: var(--error);
}

.btn-reject:hover {
    background: var(--error);
    color: white;
}

.btn-reject:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

/* Estado vacío: mismo lenguaje del panel (icono en contenedor tonal,
   jerarquía título/subtítulo), sin inventar datos — solo copy genérico */
.notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 36px 20px;
    text-align: center;
}

.notification-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-muted);
    margin-bottom: 14px;
}

.notification-empty-icon svg {
    width: 22px;
    height: 22px;
}

.notification-empty p {
    margin: 0 0 4px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.notification-empty-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.badge-pending {
    background: var(--warning-light);
    color: #92400e;
    padding: 2px 8px;
    border-radius: var(--border-radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-block;
    margin-top: 4px;
}

.login-footer .link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.login-footer .link:hover {
    text-decoration: underline;
}

.login-footer.main-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-footer.main-footer p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

@media (max-width: 480px) {
    /* Ancla al viewport (no al wrapper del botón) con márgenes fijos a
       ambos lados — garantiza que el panel nunca se desborde
       horizontalmente sin importar la posición exacta del botón que lo
       abre. Corrige un "right: -60px" previo que en realidad empujaba el
       panel 60px MÁS ALLÁ del borde derecho del contenedor (fuera de la
       pantalla) en vez de desplazarlo hacia adentro. */
    .notification-dropdown {
        position: fixed;
        top: var(--header-height);
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
        max-height: 75vh;
        border-radius: var(--border-radius);
        margin-top: 0;
    }
}

@media (max-width: 768px) {
    .page-header-content h2 {
        font-size: 1.25rem;
    }
    
    .page-header-content p {
        font-size: 0.85rem;
    }
    
    .search-container {
        padding: 12px;
    }
    
    .filters-grid {
        gap: 12px;
    }
    
    .filter-group {
        flex: 1 1 calc(50% - 6px);
    }
    
    .filter-actions {
        flex: 1 1 100%;
        justify-content: center;
        margin-top: 8px;
    }
    
    .results-info {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    
    .data-table th,
    .data-table td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .data-table th:nth-child(1),
    .data-table td:nth-child(1) {
        width: 40px;
    }
    
    .data-table th:nth-child(4),
    .data-table td:nth-child(4),
    .data-table th:nth-child(5),
    .data-table td:nth-child(5) {
        display: none;
    }
    
    .action-buttons {
        flex-wrap: nowrap;
        gap: 4px;
    }
    
    .btn-icon {
        padding: 6px;
    }
    
    .pdf-actions {
        flex-wrap: nowrap;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 12px;
    }
    
    .stats-grid {
        gap: 12px;
    }
    
    .dashboard-grid {
        gap: 12px;
    }
    
    .card-header {
        padding: 12px 16px;
    }
    
    .card-header h3 {
        font-size: 1rem;
    }
    
    .chart-simple .chart-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .chart-bar-container {
        width: 100%;
        height: 8px;
    }
    
    .activity-item {
        padding: 10px 12px;
    }
    
    .activity-icon {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    
    .activity-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .personal-stats {
        grid-template-columns: 1fr;
    }
    
    .user-profile {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-avatar {
        width: 64px;
        height: 64px;
        font-size: 1.5rem;
    }
    
    .profile-details {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .filters-grid {
        display: flex;
        flex-wrap: wrap;
    }
    
    .filter-group label {
        font-size: 0.75rem;
    }
    
    .page-header {
        gap: 12px;
    }
    
    .page-header .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .btn-sm {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 400px) {
    .login-card {
        padding: 16px;
        margin: 8px;
    }
    
    .login-header h1 {
        font-size: 1.1rem;
    }
    
    .login-header p {
        font-size: 0.85rem;
    }
    
    .form-grid {
        gap: 12px;
    }
    
    .form-group label {
        font-size: 0.85rem;
    }
    
    .form-input {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}

/* ============================================
   DASHBOARD COMPONENTS - 2026 Design
   ============================================ */

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

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

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

.kpi-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.kpi-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.kpi-trend {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-trend.up {
    background: var(--success-light);
    color: var(--success);
}

.kpi-trend.down {
    background: var(--error-light);
    color: var(--error);
}

.kpi-trend svg {
    width: 16px;
    height: 16px;
}

/* Year Cards */
.years-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.year-card {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-decoration: none;
    transition: var(--transition);
    border: 2px solid transparent;
}

.year-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.year-card.current {
    background: linear-gradient(135deg, var(--primary-ultra-light) 0%, #dbeafe 100%);
    border-color: var(--primary);
}

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

.year-badge {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.current-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    background: white;
    padding: 2px 8px;
    border-radius: var(--border-radius-full);
}

.year-card-body {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.year-total {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

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

.year-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

.year-trend.up {
    color: var(--success);
}

.year-trend.down {
    color: var(--error);
}

.year-trend svg {
    width: 14px;
    height: 14px;
}

/* Quick Actions */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.quick-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-decoration: none;
    transition: var(--transition);
}

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

.quick-action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-action-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.quick-action-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.timeline-item:hover {
    background: var(--bg-hover);
}

.timeline-marker {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.timeline-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.timeline-content strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.timeline-content span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.timeline-content small {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.timeline-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.timeline-icon svg {
    width: 16px;
    height: 16px;
}

/* Dashboard Sections */
.dashboard-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 24px;
    margin-bottom: 24px;
}

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

.dashboard-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-section-title h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.dashboard-section-title svg {
    width: 22px;
    height: 22px;
    color: var(--primary);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

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

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

@media (max-width: 768px) {
    .dashboard-grid,
    .dashboard-grid-3 {
        grid-template-columns: 1fr;
    }
    
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .years-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .years-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Header Responsive */
    .header {
        padding: 0 16px;
    }
    
    .header-user-info {
        display: none !important;
    }
    
    .header-title h1 {
        font-size: 1rem;
    }
    
    /* Page Header Responsive */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .page-header .btn {
        width: 100%;
        justify-content: center;
    }
    
    .page-header-content h2 {
        font-size: 1.25rem;
    }
    
    /* Dashboard Section Responsive */
    .dashboard-section {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .dashboard-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .dashboard-section-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .dashboard-section-title h3 {
        font-size: 1rem;
    }
    
    /* KPI Card Responsive */
    .kpi-card {
        padding: 16px;
        flex-direction: column;
        text-align: center;
    }
    
    .kpi-card::before {
        width: 100%;
        height: 4px;
        top: 0;
        left: 0;
    }
    
    .kpi-icon {
        width: 48px;
        height: 48px;
    }
    
    .kpi-value {
        font-size: 1.5rem;
    }
    
    .kpi-trend {
        position: absolute;
        top: 12px;
        right: 12px;
    }
    
    /* Timeline Responsive */
    .timeline-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 16px;
    }
    
    .timeline-marker {
        display: none;
    }
    
    .timeline-icon {
        position: absolute;
        top: 12px;
        right: 12px;
    }
    
    .timeline-content {
        width: 100%;
    }
    
    /* Quick Actions Responsive */
    .quick-action-card {
        padding: 16px;
    }
    
    .quick-action-icon {
        width: 40px;
        height: 40px;
    }
    
    /* Year Card Responsive */
    .year-card {
        padding: 12px;
    }
    
    .year-total {
        font-size: 1.5rem;
    }
    
    /* Table Responsive */
    .table-container {
        overflow-x: auto;
    }
    
    .data-table {
        font-size: 0.8rem;
        min-width: 600px;
    }
    
    /* Sidebar Nav Mobile */
    .sidebar-nav {
        padding: 12px 0;
    }
    
    .nav-item {
        padding: 12px 16px;
        margin: 4px 8px;
        border-radius: 8px;
    }
    
    .nav-icon {
        width: 20px;
        height: 20px;
    }
    
    .nav-text {
        font-size: 0.9rem;
    }
    
/* Sidebar Responsive - Mobile */
.sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar.active .sidebar-footer {
    display: flex !important;
}

.sidebar.active .user-details {
    display: flex !important;
}

.sidebar.active .user-name {
    display: block !important;
}

.sidebar.active .badge {
    display: inline-flex !important;
}
    
    .menu-toggle {
        display: flex;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    /* User Info Sidebar Mobile */
    .sidebar-footer {
        padding: 12px;
    }
    
    .user-info {
        width: 100%;
        justify-content: center;
    }
    
    .logout-btn {
        width: 40px;
        height: 40px;
        padding: 8px;
    }
}

/* Highlight Card */
.card-highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.card-highlight .kpi-title,
.card-highlight .kpi-subtitle {
    color: rgba(255, 255, 255, 0.8);
}

.card-highlight::before {
    background: white;
}

/* Tablet Responsive */
@media (min-width: 481px) and (max-width: 1024px) {
    .header-user-info {
        padding: 4px 10px;
    }
    
    .header-user-name {
        font-size: 0.8rem;
    }
    
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Notification Dropdown Responsive — se mantiene "position: absolute"
       (heredado, relativo a .notification-wrapper, ya probado y correcto
       en escritorio) en vez de "position: fixed": el header tiene
       backdrop-filter, que por especificación crea un nuevo contenedor de
       posicionamiento para descendientes "fixed" y hacía que el panel se
       calculara fuera del viewport en este rango de ancho. Solo se ajusta
       tamaño, no la estrategia de posicionamiento base. */
    .notification-dropdown {
        width: min(90vw, 372px);
        max-height: 80vh;
    }

    .notification-item {
        padding: 12px;
    }
    
    .notification-content {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Mobile Small */
@media (max-width: 360px) {
    .page-header-content h2 {
        font-size: 1.1rem;
    }
    
    .kpi-value {
        font-size: 1.25rem;
    }
    
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .years-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Badge Responsive */
@media (max-width: 768px) {
    .badge {
        padding: 2px 8px;
        font-size: 0.7rem;
    }
    
    .badge-superadmin,
    .badge-administrador,
    .badge-archivos,
    .badge-usuario {
        padding: 2px 8px;
        font-size: 0.65rem;
    }
    
    /* Dashboard Card Highlight Responsive */
    .card-highlight {
        padding: 16px;
    }
    
    .card-highlight .kpi-card {
        flex-direction: row;
        text-align: left;
    }
    
    .card-highlight .kpi-card::before {
        width: 4px;
        height: 100%;
        top: 0;
        left: 0;
    }
    
    /* Kpi Card Warning */
    .kpi-warning {
        border-left-color: var(--error);
    }
    
    /* Sidebar Footer Mobile */
    .sidebar .sidebar-footer {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
    }
    
    .sidebar .sidebar-footer .user-info {
        flex-direction: row !important;
        gap: 12px !important;
    }
    
    .sidebar .sidebar-footer .user-details {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 2px !important;
    }
    
    .sidebar .sidebar-footer .user-avatar {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.9rem !important;
    }
    
    .sidebar .sidebar-footer .user-name {
        font-size: 0.85rem !important;
    }
    
    .sidebar .sidebar-footer .badge {
        font-size: 0.65rem !important;
        padding: 2px 6px !important;
    }
}

/* Header Actions Responsive */
@media (max-width: 480px) {
    .header-actions {
        gap: 8px;
    }
    
    .header-btn {
        width: 36px;
        height: 36px;
    }
    
    .notification-btn {
        width: 36px;
        height: 36px;
    }
    
    .notification-badge {
        top: -4px;
        right: -4px;
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
    }
}

/* ==========================================================================
   Modal de confirmación/aviso institucional — componente único y
   reutilizable para reemplazar confirm()/alert() nativos en toda la app.
   Prefijo rd-confirm- deliberadamente nuevo: el proyecto ya tiene tres
   sistemas de modal independientes e inconsistentes (.modal/.active en
   catálogos, .pdf-viewer propio, .modal-overlay/.show en login) — usar
   cualquiera de esos nombres arriesgaría disparar el sistema equivocado.
   ========================================================================== */
.rd-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s ease;
}
.rd-confirm-overlay.rd-confirm-show {
    opacity: 1;
    visibility: visible;
}

.rd-confirm-modal {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.35), 0 4px 16px rgba(15, 23, 42, 0.12);
    padding: 28px 26px 24px;
    text-align: center;
    transform: scale(0.94) translateY(8px);
    opacity: 0;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}
/* Refinamiento premium del modal "Publicar resolución" (tipo publish).
   Solo presentación de ESTE modal; no altera otras confirmaciones/modales.
   Identidad: megáfono en círculo 56px con azul institucional suave; jerarquía
   tipográfica (título 22/700, pregunta 16); tarjeta informativa con tinte
   primario + acento azul 3px (--primary) e icono; divisor antes de las
   acciones; botones de 48px (Cancelar neutro + Publicar var(--primary) con
   hover var(--primary-dark)). Colores tomados de la paleta funcional. */
.rd-confirm-modal.rd-confirm-modal-publish {
    max-width: 520px;
    width: 100%;
    padding: 32px;
    border-radius: 18px;
    box-shadow: 0 18px 50px -12px rgba(15, 23, 42, 0.22), 0 6px 16px rgba(15, 23, 42, 0.08);
    text-align: center;
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    background: var(--primary-soft, #eff6ff);
    color: var(--primary, #1877F2);
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-icon svg {
    width: 28px;
    height: 28px;
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-title {
    margin: 0 0 12px;
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text, #172033);
    letter-spacing: var(--tracking-tight);
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-message {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary, #1e293b);
    line-height: 1.5;
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-message-sub {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 18px 0 0;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.55;
    color: #475569;
    text-align: left;
    background: color-mix(in srgb, var(--primary, #1877F2) 6%, #ffffff);
    border: 1px solid var(--primary-line, #bfdbfe);
    border-left: 3px solid var(--primary, #1877F2);
    border-radius: 10px;
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-message-sub::before {
    content: "";
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    margin-top: 2px;
    background-color: var(--primary, #1877F2);
    -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='12'%20cy='12'%20r='10'/%3E%3Cpath%20d='M12%2016v-4'/%3E%3Cpath%20d='M12%208h.01'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='12'%20cy='12'%20r='10'/%3E%3Cpath%20d='M12%2016v-4'/%3E%3Cpath%20d='M12%208h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-actions {
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eef2f7;
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-btn {
    height: 48px;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    gap: 8px;
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-btn-cancel {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #475569;
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-btn-cancel::before {
    content: "";
    width: 16px;
    height: 16px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M18%206L6%2018M6%206l12%2012'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M18%206L6%2018M6%206l12%2012'/%3E%3C/svg%3E") center / contain no-repeat;
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-btn-cancel:hover {
    background: var(--surface, #F8FAFC);
    border-color: #94a3b8;
    color: #334155;
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-btn-primary {
    background: var(--primary, #1877F2);
    border-color: var(--primary, #1877F2);
    color: #ffffff;
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-btn-primary::before {
    content: "";
    width: 18px;
    height: 18px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m3%2011%2018-5v12L3%2014v-3z'/%3E%3Cpath%20d='M11.6%2016.8a3%203%200%201%201-5.8-1.6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m3%2011%2018-5v12L3%2014v-3z'/%3E%3Cpath%20d='M11.6%2016.8a3%203%200%201%201-5.8-1.6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-btn-primary:hover {
    background: var(--primary-dark, #0d5fc9);
    border-color: var(--primary-dark, #0d5fc9);
}
.rd-confirm-modal.rd-confirm-modal-publish .rd-confirm-btn:focus-visible {
    outline: 2px solid var(--primary, #1877F2);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(24, 119, 242, 0.16);
}
@media (max-width: 480px) {
    .rd-confirm-modal.rd-confirm-modal-publish {
        padding: 24px 20px 20px;
    }
}
.rd-confirm-overlay.rd-confirm-show .rd-confirm-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
    .rd-confirm-overlay,
    .rd-confirm-modal {
        transition: opacity 0.01ms !important;
    }
    .rd-confirm-modal {
        transform: none !important;
    }
}

.rd-confirm-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-ultra-light, #e3f2fd);
    color: var(--primary-dark, #0d5fc9);
    flex-shrink: 0;
}
.rd-confirm-icon svg {
    width: 26px;
    height: 26px;
}
.rd-confirm-icon.rd-confirm-icon-danger { background: var(--danger-light); color: var(--danger-dark); }
.rd-confirm-icon.rd-confirm-icon-warning { background: var(--warning-light); color: var(--warning-dark); }
.rd-confirm-icon.rd-confirm-icon-success { background: var(--success-light); color: var(--success-dark); }
.rd-confirm-icon.rd-confirm-icon-error { background: var(--danger-light); color: var(--danger-dark); }
.rd-confirm-icon.rd-confirm-icon-info { background: var(--primary-ultra-light, #e3f2fd); color: var(--primary-dark, #0d5fc9); }
.rd-confirm-icon.rd-confirm-icon-publish { background: var(--primary-soft, #eff6ff); color: var(--primary, #1877F2); }

.rd-confirm-title {
    margin: 0 0 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    letter-spacing: var(--tracking-snug);
}
.rd-confirm-message {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-secondary, #64748b);
    white-space: pre-line;
}
.rd-confirm-message-sub {
    margin: 12px 0 0;
    padding: 10px 12px;
    font-size: 0.84rem;
    line-height: 1.6;
    color: #475569;
    background: var(--surface, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-left: 3px solid var(--primary-line, #bfdbfe);
    border-radius: 8px;
    text-align: left;
}

.rd-confirm-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}
.rd-confirm-actions.rd-confirm-actions-single {
    justify-content: center;
}
.rd-confirm-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 16px;
    border-radius: 10px;
    border: 1.5px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.rd-confirm-actions-single .rd-confirm-btn {
    flex: 0 1 200px;
}
.rd-confirm-btn:active {
    transform: translateY(1px);
}
.rd-confirm-btn-cancel {
    background: #ffffff;
    border-color: var(--border-color, #e2e8f0);
    color: var(--text-secondary, #64748b);
}
.rd-confirm-btn-cancel:hover {
    background: var(--bg-secondary, #f1f5f9);
    border-color: #cbd5e1;
}
.rd-confirm-btn-primary {
    background: var(--primary-dark, #0d5fc9);
    color: #ffffff;
}
.rd-confirm-btn-primary:hover {
    background: #0a4ea3;
}
.rd-confirm-btn-danger {
    background: #dc2626;
    color: #ffffff;
}
.rd-confirm-btn-danger:hover {
    background: #b91c1c;
}
.rd-confirm-btn:focus-visible {
    outline: 2px solid var(--primary, #1877F2);
    outline-offset: 2px;
}
.rd-confirm-btn-danger:focus-visible,
.rd-confirm-btn-cancel:focus-visible {
    outline-color: var(--primary, #1877F2);
}

.rd-confirm-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.rd-confirm-close:hover {
    background: var(--bg-secondary, #f1f5f9);
    color: var(--text-secondary, #64748b);
}
.rd-confirm-close:focus-visible {
    outline: 2px solid var(--primary, #1877F2);
    outline-offset: 1px;
}
.rd-confirm-close svg {
    width: 16px;
    height: 16px;
}
.rd-confirm-modal {
    position: relative;
}

@media (max-width: 480px) {
    .rd-confirm-modal {
        padding: 24px 20px 20px;
        max-width: 340px;
    }
    .rd-confirm-actions {
        flex-direction: column-reverse;
    }
    .rd-confirm-actions-single .rd-confirm-btn {
        flex: 1;
    }
}

/* ==========================================================================
   Toast institucional — sistema único y reutilizable para avisos
   informativos flotantes (éxito/error/advertencia/información), en
   reemplazo de las franjas .alert-success/.alert-error que empujaban el
   contenido. Prefijo rd-toast- nuevo por la misma razón que rd-confirm-:
   evitar cualquier colisión con el toast local ya existente en
   backup/index.php (.notification/.notification-success, no compartido). ==
   ========================================================================== */
.rd-toast-container {
    position: fixed;
    top: calc(var(--header-height, 70px) + 16px);
    right: 20px;
    z-index: 1900;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 360px;
    max-width: calc(100vw - 32px);
    pointer-events: none;
}

.rd-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #ffffff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-left: 3px solid var(--primary-dark, #0d5fc9);
    border-radius: 12px;
    box-shadow: 0 10px 28px -8px rgba(15, 23, 42, 0.22), 0 2px 6px rgba(15, 23, 42, 0.08);
    padding: 14px 14px 14px 15px;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.rd-toast.rd-toast-show {
    opacity: 1;
    transform: translateX(0);
}
.rd-toast.rd-toast-leaving {
    opacity: 0;
    transform: translateX(24px);
}
@media (prefers-reduced-motion: reduce) {
    .rd-toast {
        transition: opacity 0.01ms !important;
        transform: none !important;
    }
}

.rd-toast-success { border-left-color: #10b981; }
.rd-toast-error   { border-left-color: #ef4444; }
.rd-toast-warning { border-left-color: #f59e0b; }
.rd-toast-info    { border-left-color: var(--primary-dark, #0d5fc9); }

.rd-toast-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.rd-toast-icon svg { width: 16px; height: 16px; }
.rd-toast-success .rd-toast-icon { background: #d1fae5; color: #047857; }
.rd-toast-error   .rd-toast-icon { background: #fee2e2; color: #b91c1c; }
.rd-toast-warning .rd-toast-icon { background: #fef3c7; color: #b45309; }
.rd-toast-info    .rd-toast-icon { background: var(--primary-ultra-light, #e3f2fd); color: var(--primary-dark, #0d5fc9); }

.rd-toast-body {
    flex: 1;
    min-width: 0;
    padding-top: 4px;
}
.rd-toast-message {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.45;
    color: var(--text-primary, #1e293b);
    word-break: break-word;
}

.rd-toast-close {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.rd-toast-close:hover {
    background: var(--bg-secondary, #f1f5f9);
    color: var(--text-secondary, #64748b);
}
.rd-toast-close:focus-visible {
    outline: 2px solid var(--primary, #1877F2);
    outline-offset: 1px;
}
.rd-toast-close svg { width: 14px; height: 14px; }

@media (max-width: 640px) {
    .rd-toast-container {
        left: 16px;
        right: 16px;
        width: auto;
        max-width: none;
    }
}
