/* ==========================================================================
   PLANTILLA GENERAL - DASHBOARD & AUTH SYSTEM
   Soporte Multi-Tema: Dark (por defecto), Light y Auto (cambio a las 6:00 PM)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');
@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css');

/* TEMA DARK (Por defecto) */
:root,
[data-bs-theme="dark"] {
    --body-bg: #0b0f19;
    --surface-bg: #111827;
    --surface-card: #151d2f;
    --surface-card-hover: #1c263c;
    --surface-glass: rgba(21, 29, 47, 0.75);
    --sidebar-bg: #0d121f;
    --topbar-bg: rgba(11, 15, 25, 0.85);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-light: rgba(255, 255, 255, 0.14);
    
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-primary-glow: rgba(59, 130, 246, 0.35);
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-purple: #8b5cf6;
    
    --input-bg: rgba(21, 29, 47, 0.85);
    --input-focus-bg: #151d2f;
    
    --sidebar-width: 260px;
    --header-height: 70px;
    --footer-height: 55px;
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-color);
    --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.18);
    --auth-glow: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(11, 15, 25, 0) 70%);
}

/* TEMA LIGHT */
[data-bs-theme="light"] {
    --body-bg: #f4f6fa;
    --surface-bg: #ffffff;
    --surface-card: #ffffff;
    --surface-card-hover: #f8fafc;
    --surface-glass: rgba(255, 255, 255, 0.85);
    --sidebar-bg: #ffffff;
    --topbar-bg: rgba(255, 255, 255, 0.9);
    
    --border-color: rgba(0, 0, 0, 0.08);
    --border-color-light: rgba(0, 0, 0, 0.12);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent-primary: #2563eb;
    --accent-primary-hover: #1d4ed8;
    --accent-primary-glow: rgba(37, 99, 235, 0.2);
    --accent-cyan: #0284c7;
    --accent-emerald: #059669;
    --accent-amber: #d97706;
    --accent-rose: #e11d48;
    --accent-purple: #7c3aed;
    
    --input-bg: #f8fafc;
    --input-focus-bg: #ffffff;
    
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 0 0 1px var(--border-color);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.1);
    --auth-glow: radial-gradient(circle, rgba(37, 99, 235, 0.1) 0%, rgba(244, 246, 250, 0) 70%);
}

/* Reset y base global */
* {
    box-sizing: border-box;
}

body {
    background-color: var(--body-bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* ==========================================================================
   LAYOUT DEL DASHBOARD
   ========================================================================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* SIDEBAR */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s ease, border-color 0.25s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    gap: 0.75rem;
}

.sidebar-brand-badge {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #fff;
    font-weight: 800;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.sidebar-brand-text {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0;
    min-width: 0;
    line-height: 1.25;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.sidebar-header .sidebar-brand-badge { flex-shrink:0; overflow:hidden; }
.sidebar-header .sidebar-brand-badge.has-logo { background:var(--surface-bg); box-shadow:none; padding:2px; }
.sidebar-header .sidebar-brand-badge img { width:100%; height:100%; object-fit:contain; }

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 0.85rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(125, 125, 125, 0.2) transparent;
}

.sidebar-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.5rem 0.85rem 0.4rem;
    margin-top: 0.5rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s ease;
    gap: 0.75rem;
}

.nav-link-custom i {
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.nav-link-custom:hover {
    color: var(--text-primary);
    background-color: rgba(125, 125, 125, 0.08);
}

.nav-link-custom:hover i {
    color: var(--accent-primary);
}

.nav-link-custom.active {
    background-color: rgba(59, 130, 246, 0.12);
    color: var(--accent-primary);
    border: 1px solid rgba(59, 130, 246, 0.25);
    font-weight: 600;
}

.nav-link-custom.active i {
    color: var(--accent-primary);
}

.sidebar-group-toggle {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}

.sidebar-group-toggle .sidebar-group-chevron {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.sidebar-group-toggle[aria-expanded="true"] .sidebar-group-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    margin: 0.4rem 0 0.5rem;
    padding: 0;
    width: 100%;
}

.sidebar-submenu .nav-link-custom {
    width: 100%;
    font-size: 0.8rem;
    padding: 0.6rem 0.9rem 0.6rem 2.8rem;
}

.sidebar-group-toggle:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.nav-badge {
    margin-left: auto;
    font-size: 0.65rem;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.nav-badge-green {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.nav-badge-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background-color: rgba(125, 125, 125, 0.04);
}

.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    padding: 0.35rem;
    border-radius: var(--radius-md);
    transition: background-color 0.2s;
}

.user-profile-widget:hover {
    background-color: rgba(125, 125, 125, 0.08);
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border: 1px solid var(--border-color-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #f8fafc;
}

.user-avatar { overflow:hidden; flex-shrink:0; }
.user-avatar img { width:100%; height:100%; object-fit:cover; }

[data-bs-theme="light"] .user-avatar {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #1e293b;
}

.user-info {
    line-height: 1.25;
}

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

.user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* MAIN CONTENT AREA */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    background-color: var(--body-bg);
}

/* TOPBAR */
.app-topbar {
    height: var(--header-height);
    background-color: var(--topbar-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.breadcrumb-custom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    padding: 0;
    list-style: none;
}

.breadcrumb-custom a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-custom a:hover {
    color: var(--text-primary);
}

.breadcrumb-custom .active {
    color: var(--text-primary);
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.search-box-custom {
    position: relative;
    width: 260px;
}

.search-box-custom input {
    background: rgba(125, 125, 125, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 0.45rem 2.2rem 0.45rem 2.2rem;
    font-size: 0.85rem;
    width: 100%;
    transition: all 0.2s ease;
}

.search-box-custom input:focus {
    background: var(--surface-bg);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    outline: none;
}

.search-box-custom .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-box-custom .shortcut-badge {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    border: 1px solid var(--border-color);
    background: rgba(125, 125, 125, 0.1);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.topbar-icon-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: rgba(125, 125, 125, 0.05);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.topbar-icon-btn:hover {
    color: var(--text-primary);
    background: rgba(125, 125, 125, 0.12);
    border-color: var(--border-color-light);
}

.topbar-badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    background-color: var(--accent-rose);
    border: 2px solid var(--body-bg);
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Menú de la cuenta: usar los colores del tema activo, igual que el sidebar. */
.sidebar-footer .user-account-menu {
    --bs-dropdown-bg: var(--surface-card);
    --bs-dropdown-color: var(--text-primary);
    --bs-dropdown-border-color: var(--border-color);
    --bs-dropdown-header-color: var(--text-secondary);
    --bs-dropdown-divider-bg: var(--border-color);
    --bs-dropdown-link-color: var(--text-secondary);
    --bs-dropdown-link-hover-color: var(--accent-primary);
    --bs-dropdown-link-hover-bg: rgba(59, 130, 246, 0.08);
    min-width: 220px;
    max-width: calc(100vw - 32px);
    padding: 0.4rem;
    background-color: var(--surface-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.sidebar-footer .user-account-menu .dropdown-header {
    color: var(--text-secondary);
    white-space: normal;
    overflow-wrap: anywhere;
    font-family: var(--font-mono);
    font-size: 0.76rem;
}

.sidebar-footer .user-account-menu .dropdown-divider {
    border-color: var(--border-color);
}

.sidebar-footer .user-account-menu .dropdown-item {
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
}

.sidebar-footer .user-account-menu .dropdown-item:hover,
.sidebar-footer .user-account-menu .dropdown-item:focus {
    color: var(--accent-primary);
    background-color: rgba(59, 130, 246, 0.08);
}

.sidebar-footer .user-account-menu .account-logout,
.sidebar-footer .user-account-menu .account-logout:hover,
.sidebar-footer .user-account-menu .account-logout:focus {
    color: var(--accent-rose);
}

.sidebar-footer .user-account-menu .account-logout:hover,
.sidebar-footer .user-account-menu .account-logout:focus {
    background-color: rgba(244, 63, 94, 0.08);
}

/* SELECTOR DE TEMA (LIGHT, DARK, AUTO) */
.theme-dropdown .dropdown-menu {
    min-width: 150px;
    border-radius: var(--radius-md);
    padding: 0.35rem;
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

.theme-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    cursor: pointer;
}

.theme-dropdown .dropdown-item:hover {
    background-color: rgba(59, 130, 246, 0.12);
    color: var(--accent-primary);
}

.theme-dropdown .dropdown-item.active {
    background-color: var(--accent-primary);
    color: #ffffff;
    font-weight: 600;
}

.theme-dropdown .dropdown-item.active i {
    color: #ffffff;
}

/* Botón flotante universal de tema para vistas públicas/sin topbar */
.floating-theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1060;
}

/* CONTENT CONTAINER */
.app-content {
    flex: 1;
    padding: 2rem;
}

/* FOOTER */
.app-footer {
    height: var(--footer-height);
    border-top: 1px solid var(--border-color);
    background-color: rgba(125, 125, 125, 0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ==========================================================================
   CARDS, WIDGETS Y ELEMENTOS MODERNOS
   ========================================================================== */
.card-modern {
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1.35rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.25s ease;
    height: 100%;
}

.card-modern:hover {
    border-color: var(--border-color-light);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.stat-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.stat-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-emerald);
}

.stat-badge-danger {
    background: rgba(244, 63, 94, 0.12);
    color: var(--accent-rose);
}

.stat-badge-info {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan);
}

.stat-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0;
}

.stat-value {
    font-size: 2.15rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin: 0.2rem 0;
    line-height: 1.1;
}

.stat-footnote {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ==========================================================================
   BOTONES MODERNOS
   ========================================================================== */
.btn-modern-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px var(--accent-primary-glow);
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-modern-primary:hover {
    filter: brightness(1.08);
    color: #fff;
    box-shadow: 0 6px 20px var(--accent-primary-glow);
    transform: translateY(-1px);
}

.btn-modern-outline {
    background: rgba(125, 125, 125, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-modern-outline:hover {
    background: rgba(125, 125, 125, 0.12);
    color: var(--text-primary);
    border-color: var(--border-color-light);
    transform: translateY(-1px);
}

/* ==========================================================================
   AUTENTICACIÓN (LOGIN)
   ========================================================================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: var(--body-bg);
    position: relative;
    overflow: hidden;
    transition: background-color 0.25s ease;
}

.auth-bg-glow {
    position: absolute;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: var(--auth-glow);
    pointer-events: none;
    z-index: 0;
}

.auth-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.75rem 2.5rem;
    position: relative;
    z-index: 10;
}

.auth-nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.auth-nav-link:hover {
    color: var(--text-primary);
}

.auth-nav-link .highlight {
    color: var(--accent-primary);
    font-weight: 600;
}

.auth-card-container {
    width: 100%;
    max-width: 440px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    position: relative;
    z-index: 10;
}

.auth-card {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem 2.25rem;
    box-shadow: var(--shadow-card);
}

.auth-title {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin-bottom: 0.45rem;
}

.auth-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.auth-form-group {
    margin-bottom: 1.35rem;
}

.auth-form-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.45rem;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 1.05rem;
    pointer-events: none;
    transition: color 0.2s;
}

.auth-input {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color-light);
    color: var(--text-primary);
    font-size: 0.92rem;
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    transition: all 0.2s ease;
}

.auth-input:focus {
    background-color: var(--input-focus-bg);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
    outline: none;
}

.auth-input:focus + .auth-input-icon,
.auth-input-wrapper:focus-within .auth-input-icon {
    color: var(--accent-primary);
}

.auth-input.is-invalid {
    border-color: var(--accent-rose);
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2);
}

.auth-invalid-msg {
    display: block;
    color: var(--accent-rose);
    font-size: 0.78rem;
    margin-top: 0.4rem;
}

.auth-remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    font-size: 0.84rem;
}

.auth-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    margin: 0;
}

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

.auth-forgot-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-forgot-link:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

.auth-btn-submit {
    width: 100%;
    padding: 0.8rem 1.25rem;
    font-size: 0.95rem;
}

.auth-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    position: relative;
    z-index: 10;
}

/* ==========================================================================
   RESPONSIVE DESIGN (MÓVILES, TABLETS, DESKTOP)
   ========================================================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .app-main {
        margin-left: 0;
    }

    .app-content {
        padding: 1.25rem;
    }

    .search-box-custom {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .auth-header {
        padding: 1.25rem 1rem;
    }

    .auth-card-container {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .auth-card {
        padding: 1.75rem 1.25rem;
    }

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

    .app-footer {
        flex-direction: column;
        height: auto;
        padding: 1rem;
        gap: 0.4rem;
        text-align: center;
    }
}

/* ==========================================================================
   HOMOLOGACIÓN SWEETALERT2 Y BOOTSTRAP TABLE
   ========================================================================== */
/* SweetAlert2 integración con temas */
.swal2-popup {
    background: var(--surface-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-card) !important;
    font-family: var(--font-sans) !important;
}

.swal2-title {
    color: var(--text-primary) !important;
}

.swal2-html-container {
    color: var(--text-secondary) !important;
}

.swal2-confirm {
    background: var(--accent-primary) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 4px 14px var(--accent-primary-glow) !important;
}

.swal2-cancel {
    background: rgba(125, 125, 125, 0.2) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
}

/* Bootstrap Table */
.bootstrap-table .fixed-table-container {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    background-color: var(--surface-card) !important;
}

.bootstrap-table .table {
    color: var(--text-primary) !important;
    margin-bottom: 0 !important;
}

.bootstrap-table .table thead th {
    background-color: rgba(125, 125, 125, 0.05) !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    font-size: 0.8rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

.bootstrap-table .page-item .page-link {
    background-color: var(--surface-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

.bootstrap-table .page-item.active .page-link {
    background-color: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
    color: #ffffff !important;
}

/* ==========================================================================
   PÁGINAS DE ERROR (404, 500, 403, 419, etc.)
   ========================================================================== */
.error-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
}

.error-card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 3.5rem 3rem 2.5rem;
    max-width: 520px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6), 0 0 35px var(--accent-primary-glow);
    position: relative;
    z-index: 10;
}

.error-badge-label {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
}

.error-code-gradient {
    font-size: 7.5rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.04em;
    margin: 0 0 1rem;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 10px 20px rgba(96, 165, 250, 0.25));
}

.error-title {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.error-description {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.error-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    margin-bottom: 2.25rem;
    flex-wrap: wrap;
}

.error-tech-footer {
    border-top: 1px dashed var(--border-color);
    padding-top: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.error-tech-footer span strong {
    color: var(--text-secondary);
    font-weight: 600;
}

@media (max-width: 575.98px) {
    .error-card {
        padding: 2.25rem 1.5rem 1.75rem;
    }
    .error-code-gradient {
        font-size: 5.5rem;
    }
    .error-title {
        font-size: 1.4rem;
    }
    .error-tech-footer {
        gap: 0.85rem;
        flex-direction: column;
    }
}


/* Cierre de modales: posición común para todas las pantallas. */
.modal .modal-header {
    position: relative;
    padding-right: 64px;
}

.modal .modal-header .btn-close {
    position: absolute;
    top: 18px;
    right: 18px;
    margin: 0;
    padding: 10px;
}

@media (max-width: 767.98px) {
    .modal .modal-header {
        padding-right: 60px;
    }

    .modal .modal-header .btn-close {
        top: 14px;
        right: 14px;
    }
}


/* Área común para cargar imágenes. */
.image-dropzone { display:flex; align-items:center; position:relative; gap:24px; padding:24px; border:1px dashed var(--border-color-light); border-radius:18px; background:linear-gradient(125deg, rgba(59,130,246,.06), transparent 75%), var(--input-bg); transition:border-color .2s, background .2s, box-shadow .2s; }
.image-dropzone:hover, .image-dropzone.is-dragging, .image-dropzone:focus-within { border-color:var(--accent-primary); background:linear-gradient(125deg, rgba(59,130,246,.1), transparent 85%), var(--input-bg); }
.image-dropzone.is-dragging { box-shadow:inset 0 0 0 1px var(--accent-primary); }
.image-dropzone:focus-within { outline:2px solid var(--accent-primary); outline-offset:3px; }
.image-dropzone .institution-logo-small { width:140px; height:140px; border-radius:18px; background:var(--surface-card); box-shadow:0 6px 20px rgba(0,0,0,.04); }
.image-dropzone .institution-logo-small > i { font-size:2.2rem; color:var(--accent-primary); opacity:.65; }
.image-dropzone-eyebrow { display:block; margin-bottom:8px; font-size:.58rem; font-weight:700; letter-spacing:.13em; color:var(--accent-primary); }
.image-dropzone-title { display:block; font-size:.98rem; font-weight:700; letter-spacing:-.02em; color:var(--text-primary); }
.image-dropzone-description { display:block; margin-top:5px; font-size:.74rem; color:var(--text-secondary); }
.image-file-select { display:inline-flex; align-items:center; gap:8px; margin-top:14px; padding:9px 13px; border:1px solid var(--border-color-light); border-radius:9px; background:var(--surface-card); color:var(--text-primary); font-size:.74rem; font-weight:600; cursor:pointer; transition:border-color .2s, color .2s; }
.image-file-select i { color:var(--accent-primary); font-size:1rem; }
.image-file-select:hover { border-color:var(--accent-primary); color:var(--accent-primary); }
.image-file-name { margin:10px 0; font-size:.73rem; color:var(--text-secondary); overflow-wrap:anywhere; }
.image-dropzone .btn-modern-outline { padding:6px 10px; font-size:.72rem; }
.image-dropzone .collab-field-help { font-size:.65rem; line-height:1.6; }
@media (max-width:600px) { .image-dropzone { align-items:center; text-align:center; padding:22px 18px; gap:18px; } .image-dropzone > div:last-child { width:100%; } .image-dropzone .institution-logo-small { width:120px; height:120px; align-self:center; } }

.image-dropzone > div:last-child { flex:1; min-width:0; }
.image-dropzone .profile-avatar-preview { width:140px; height:140px; }
@media (max-width:600px) { .image-dropzone { flex-direction:column; } }
