/* ==========================================================================
   SciMetrics - World-Class Academic SaaS Design System & Responsive Framework
   Loaded after style.css to enforce modern layout, responsiveness, and themes.
   ========================================================================== */
/* Dizayn tokenlari: assets/css/tokens.css */

/* ─── Global Base & Reset ─── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    max-width: 100%;
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
}

body {
    max-width: 100%;
    overflow-x: clip;
    line-height: 1.55;
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: var(--font-body, 'Inter', -apple-system, BlinkMacSystemFont, sans-serif);
    margin: 0;
    padding: 0;
}

button, input, select, textarea {
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}

a {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.skip-link {
    position: fixed;
    left: 16px;
    top: -100px;
    z-index: 3000;
    padding: 12px 18px;
    background: var(--bg-surface);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-modal);
    text-decoration: none;
    font-weight: 700;
}
.skip-link:focus {
    top: 16px;
}

/* ─── Topbar (Unified Header) ─── */
.topbar,
html.dark-theme .topbar,
body.dark-theme .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    transition: height 0.25s ease, background-color 0.25s ease;
    overflow: visible;
}

.topbar-left-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex-shrink: 1;
}

.topbar-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-subtle);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.topbar-sidebar-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.topbar-brand {
    display: flex;
    align-items: center;
    min-width: 0;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    min-width: 0;
}

.logo-icon-img {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    flex-shrink: 0;
}

.brand-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* IPU emblem is single-colour navy: render it white on dark surfaces */
html.dark-theme .logo-icon-img .brand-img,
body.dark-theme .logo-icon-img .brand-img {
    filter: brightness(0) invert(1);
}

.logo-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.logo-title {
    font-size: clamp(14px, 1.8vw, 17px);
    font-weight: 800;
    letter-spacing: -0.4px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.logo-subtitle {
    font-size: 11px;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-width: 0;
}

.theme-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.theme-toggle-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: rotate(15deg);
}

.topbar-guest-badge {
    background: rgba(var(--teal-52-rgb), 0.08);
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 10px;
    border: 1px solid rgba(var(--teal-52-rgb), 0.18);
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-topbar-login {
    background: linear-gradient(135deg, var(--teal-52) 0%, var(--teal-48) 100%);
    color: #ffffff !important;
    font-weight: 600;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(var(--teal-52-rgb), 0.25);
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-topbar-login:hover {
    background: linear-gradient(135deg, var(--teal-48) 0%, var(--teal-42) 100%);
    box-shadow: 0 4px 14px rgba(var(--teal-52-rgb), 0.35);
    transform: translateY(-1px);
}

/* User Profile Trigger & Dropdown */
.user-dropdown-container {
    position: relative;
    flex-shrink: 0;
}

.user-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 4px 4px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.user-dropdown-trigger:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.user-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 320px;
    max-width: calc(100vw - 20px);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-dropdown);
    z-index: 1050;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.user-dropdown-container.open .user-dropdown-menu {
    display: flex;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Sidebar Navigation ─── */
/* ─── Sidebar Navigation (World-Class SaaS UI) ─── */
.sidebar,
html.dark-theme .sidebar,
body.dark-theme .sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    width: var(--sidebar-width);
    height: calc(100dvh - var(--header-height));
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.02);
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.28s cubic-bezier(0.33, 1, 0.68, 1);
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.25);
    border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.45);
}

.sidebar-nav {
    padding: 14px 12px 32px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-title {
    color: var(--text-muted, #94a3b8);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-top: 14px;
    margin-bottom: 8px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-color, #e2e8f0);
    opacity: 0.7;
}

.nav-item {
    min-height: 40px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 550;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-item > i {
    width: 18px;
    font-size: 14px;
    text-align: center;
    flex-shrink: 0;
}
.nav-item:hover {
    background: rgba(var(--teal-52-rgb), 0.08);
    color: var(--primary);
    transform: translateX(2px);
}
.nav-item.active,
html.dark-theme .nav-item.active,
body.dark-theme .nav-item.active {
    color: #ffffff !important;
    background: var(--primary-gradient) !important;
    box-shadow: var(--primary-glow) !important;
    font-weight: 700;
}
.nav-item.active i,
.nav-item.active > i {
    color: #ffffff !important;
}

/* Sidebar Dropdown & Submenu Styles (Accordion) */
.nav-dropdown-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 4px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.nav-dropdown-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #475569);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    font-family: inherit;
    gap: 10px;
}

.nav-dropdown-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.nav-group-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13.5px;
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    /* IPU sayti uslubida bir xil: navy (yorug' rejim), teal (to'q rejim) */
    background: rgba(var(--navy-24-rgb), 0.07);
    color: var(--primary);
}

html.dark-theme .nav-group-icon,
body.dark-theme .nav-group-icon {
    background: rgba(var(--teal-61-rgb), 0.16);
    color: var(--teal-71);
}

.nav-dropdown-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.nav-arrow {
    font-size: 10px;
    color: var(--text-muted, #94a3b8);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
    flex-shrink: 0;
}

.nav-dropdown-header:hover {
    background: rgba(var(--teal-56-rgb), 0.05);
    color: var(--text-main, #0f172a);
    border-color: rgba(var(--teal-56-rgb), 0.08);
}

.nav-dropdown-header:hover .nav-group-icon {
    transform: scale(1.08);
}

.nav-dropdown-group.open > .nav-dropdown-header {
    background: linear-gradient(135deg, rgba(var(--teal-56-rgb), 0.08) 0%, rgba(var(--teal-56-rgb), 0.03) 100%);
    color: var(--primary, var(--teal-52));
    border-color: rgba(var(--teal-56-rgb), 0.16);
    box-shadow: 0 2px 8px rgba(var(--teal-56-rgb), 0.06);
}

.nav-dropdown-group.open > .nav-dropdown-header .nav-arrow {
    transform: rotate(180deg);
    color: var(--primary, var(--teal-52));
}

.nav-dropdown-group.open > .nav-dropdown-header .nav-group-icon,
html.dark-theme .nav-dropdown-group.open > .nav-dropdown-header .nav-group-icon,
body.dark-theme .nav-dropdown-group.open > .nav-dropdown-header .nav-group-icon {
    background: var(--primary);
    color: #ffffff;
    box-shadow: var(--primary-glow);
    transform: scale(1.04);
}

.nav-submenu {
    display: none;
    flex-direction: column;
    gap: 3px;
    padding: 5px 0 6px 12px;
    margin: 3px 0 6px 18px;
    border-left: 2px solid rgba(var(--teal-56-rgb), 0.2);
    background: transparent;
}

.nav-dropdown-group.open > .nav-submenu {
    display: flex !important;
    flex-direction: column !important;
}

.nav-sub-item {
    min-height: 36px;
    padding: 7px 11px;
    border-radius: 9px;
    font-size: 12.8px;
    font-weight: 550;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary, #475569);
    text-decoration: none;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.nav-sub-item > i {
    width: 18px;
    font-size: 13.5px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.18s ease, color 0.18s ease;
}

.nav-sub-item:hover {
    background: rgba(var(--teal-56-rgb), 0.07);
    color: var(--primary, var(--teal-52));
    transform: translateX(3px);
}

.nav-sub-item:hover > i {
    transform: scale(1.15);
    color: var(--primary, var(--teal-48));
}

.nav-sub-item.active {
    background: linear-gradient(135deg, rgba(var(--teal-48-rgb), 0.12) 0%, rgba(var(--teal-56-rgb), 0.06) 100%) !important;
    color: var(--primary, var(--teal-42)) !important;
    font-weight: 700;
    border: 1px solid rgba(var(--teal-56-rgb), 0.2);
    box-shadow: 0 2px 8px rgba(var(--teal-56-rgb), 0.08);
}

.nav-sub-item.active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 4px;
    background: var(--teal-48);
    box-shadow: 0 0 8px rgba(var(--teal-48-rgb), 0.6);
}

.nav-sub-item.active > i {
    color: var(--primary, var(--teal-48)) !important;
    transform: scale(1.1);
}

/* Micro-badges in sidebar */
.badge-scopus {
    background: rgba(234, 88, 12, 0.1);
    color: #ea580c;
    border: 1px solid rgba(234, 88, 12, 0.22);
    font-size: 10px;
    font-weight: 750;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.2px;
}
.badge-nav-gold {
    background: rgba(217, 119, 6, 0.1);
    color: #b45309;
    border: 1px solid rgba(217, 119, 6, 0.25);
    font-size: 10px;
    font-weight: 750;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.2px;
}
.badge-nav-cyan {
    background: rgba(14, 165, 233, 0.1);
    color: #0284c7;
    border: 1px solid rgba(14, 165, 233, 0.22);
    font-size: 10px;
    font-weight: 750;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.2px;
}

/* Sidebar Footer Brand Card */
.sidebar-footer-widget {
    margin-top: 18px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg-subtle, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-widget-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(var(--teal-52-rgb), 0.1);
    color: var(--primary, var(--teal-52));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.sidebar-widget-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar-widget-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    line-height: 1.2;
}
.sidebar-widget-sub {
    font-size: 10px;
    color: var(--text-muted, #64748b);
    margin-top: 1px;
}

/* Dark theme overrides for accordion */
html.dark-theme .nav-dropdown-header,
body.dark-theme .nav-dropdown-header {
    color: #cbd5e1;
}

html.dark-theme .nav-dropdown-header:hover,
body.dark-theme .nav-dropdown-header:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.08);
}

html.dark-theme .nav-dropdown-group.open > .nav-dropdown-header,
body.dark-theme .nav-dropdown-group.open > .nav-dropdown-header {
    background: linear-gradient(135deg, rgba(var(--teal-56-rgb), 0.2) 0%, rgba(var(--teal-56-rgb), 0.08) 100%);
    color: var(--teal-88);
    border-color: rgba(var(--teal-56-rgb), 0.28);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

html.dark-theme .nav-dropdown-group.open > .nav-dropdown-header .nav-arrow,
body.dark-theme .nav-dropdown-group.open > .nav-dropdown-header .nav-arrow {
    color: var(--teal-88);
}

html.dark-theme .nav-submenu,
body.dark-theme .nav-submenu {
    border-left-color: rgba(var(--teal-66-rgb), 0.25);
}

html.dark-theme .nav-sub-item,
body.dark-theme .nav-sub-item {
    color: #94a3b8;
}

html.dark-theme .nav-sub-item:hover,
body.dark-theme .nav-sub-item:hover {
    background: rgba(var(--teal-56-rgb), 0.16);
    color: #f1f5f9;
}

html.dark-theme .nav-sub-item.active,
body.dark-theme .nav-sub-item.active {
    background: linear-gradient(135deg, rgba(var(--teal-56-rgb), 0.3) 0%, rgba(var(--teal-56-rgb), 0.18) 100%) !important;
    color: #ffffff !important;
    border-color: rgba(var(--teal-66-rgb), 0.35);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

html.dark-theme .nav-sub-item.active::before,
body.dark-theme .nav-sub-item.active::before {
    background: var(--teal-66);
    box-shadow: 0 0 10px rgba(var(--teal-66-rgb), 0.8);
}

html.dark-theme .nav-sub-item.active > i,
body.dark-theme .nav-sub-item.active > i {
    color: var(--teal-81) !important;
}

html.dark-theme .sidebar-footer-widget,
body.dark-theme .sidebar-footer-widget {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

html.dark-theme .sidebar-widget-title,
body.dark-theme .sidebar-widget-title {
    color: #f1f5f9;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ─── Main Wrapper & Content Container ─── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    min-height: calc(100dvh - var(--header-height));
    width: calc(100% - var(--sidebar-width));
    transition: margin 0.28s ease, width 0.28s ease;
}

.content-container {
    width: 100%;
    max-width: 1720px;
    margin: 0 auto;
    padding: 28px 32px 48px;
    box-sizing: border-box;
}

/* ─── Page Header & Action Bar ─── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.page-title-group {
    flex: 1 1 auto;
    min-width: 0;
}

.page-title {
    font-size: clamp(20px, 2.2vw, 28px);
    font-weight: 800;
    letter-spacing: -0.6px;
    line-height: 1.25;
    color: var(--text-main);
    margin: 0 0 6px 0;
    word-break: break-word;
}

.page-subtitle {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
    max-width: 820px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ─── Button Hierarchy ─── */
.btn {
    min-height: 40px;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    box-shadow: 0 3px 12px rgba(var(--teal-52-rgb), 0.25);
}
.btn-primary:hover {
    box-shadow: 0 6px 18px rgba(var(--teal-52-rgb), 0.38);
    transform: translateY(-1px);
    color: #ffffff;
}
.btn-secondary {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-main);
}
.btn-secondary:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong, #cbd5e1);
    color: var(--text-main);
}
.btn-sm {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
}

/* ─── Cards & Surfaces ─── */
.card, .stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.22s ease, border-color 0.22s ease;
    position: relative;
    overflow: hidden;
}
.card:hover, .stat-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: rgba(var(--teal-52-rgb), 0.3);
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.card-title {
    font-size: 16px;
    font-weight: 750;
    letter-spacing: -0.3px;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}
.card-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 3px 0 0 0;
}
.card-body {
    padding: 22px;
}

/* ─── Metric Cards Grid & Metric Composite ─── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
    align-items: stretch;
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    position: relative;
    overflow: hidden;
    transition: all 0.22s ease;
}
.metric-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.metric-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.metric-label {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
}

/* Composite items grid: equal 3-column distribution preventing label truncation */
.metric-composite {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: 12px 10px;
    margin: 14px 0;
    border: 1px solid var(--border-subtle);
}

.comp-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-align: center;
    padding: 0 4px;
}

.comp-label {
    font-size: 9.5px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
    margin-bottom: 4px;
}

.comp-val {
    font-size: clamp(15px, 2vw, 18px);
    font-weight: 800;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.comp-divider {
    display: none; /* Replaced by grid gap for perfect proportionality */
}

.metric-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 10px;
    margin-top: 2px;
}

/* ─── Charts & Split Grids ─── */
.charts-row {
    display: grid;
    grid-template-columns: 1.35fr 0.85fr;
    gap: 20px;
    margin-bottom: 24px;
    align-items: stretch;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 320px;
}

.dashboard-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* ─── Responsive Tables ─── */
.table-responsive {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    border-radius: var(--radius-md);
    scrollbar-width: thin;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modern-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}
.modern-table th {
    padding: 13px 16px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.modern-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
    line-height: 1.5;
    vertical-align: middle;
}
.modern-table tr:last-child td {
    border-bottom: none;
}
.modern-table tr:hover td {
    background: var(--primary-light);
}

/* ─── Filter Form & Toolbar ─── */
.filter-bar-card {
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 22px;
}

.filter-form,
.researchers-filter-form,
.pub-filter-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.search-input-group,
.filter-select-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.form-control,
.form-select {
    width: 100%;
    min-height: 42px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    font-size: 13.5px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--teal-52-rgb), 0.15);
    outline: none;
}

/* Filter Tabs Swiper */
.filter-tabs,
.works-tab-nav,
.platform-tabs-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.filter-tabs::-webkit-scrollbar,
.works-tab-nav::-webkit-scrollbar {
    display: none;
}
.filter-tab,
.works-main-tab {
    flex-shrink: 0;
    white-space: nowrap;
}

/* ─── Researcher Cards Grid ─── */
.researchers-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.r-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: all 0.22s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.r-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: rgba(var(--teal-52-rgb), 0.3);
}

.r-metrics-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 14px 0;
}

/* ─── Modals (To'liq ko'rinadigan, kesilmaydigan modal tizimi) ─── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: flex-start; /* CRITICAL: Prevents top clipping on tall modals */
    justify-content: center;
    padding: clamp(12px, 3vh, 32px) clamp(10px, 2vw, 24px);
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.modal-dialog {
    width: 100%;
    max-width: 680px;
    margin: clamp(16px, 3.5vh, 32px) auto !important; /* Explicit top/bottom margin prevents negative margin top clipping */
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
    max-height: calc(100dvh - clamp(32px, 7vh, 64px));
    outline: none;
}

/* Modal Content Container */
.modal-content,
.modal-box {
    background: var(--bg-surface-elevated, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-xl, 16px);
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-height: calc(100dvh - clamp(32px, 7vh, 64px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    animation: modalSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content.card {
    padding: 0 !important;
    margin: 0 !important;
    border: 1px solid var(--border-color, #e2e8f0);
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35) !important;
}

/* Modal sizing modifiers */
.modal-dialog.modal-sm, .modal-content.modal-sm { max-width: 440px; }
.modal-dialog.modal-md, .modal-content.modal-md { max-width: 680px; }
.modal-dialog.modal-lg, .modal-content.modal-lg { max-width: 860px; }
.modal-dialog.modal-xl, .modal-content.modal-xl { max-width: 1040px; }

/* CRITICAL: Form inside modal MUST be flex with min-height:0 so modal-body can scroll */
.modal-content > form,
.modal-dialog > form,
.modal-box > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    margin: 0;
    width: 100%;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-subtle, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
    flex-shrink: 0;
    background: var(--bg-surface-elevated, #ffffff);
    position: relative;
    top: auto;
    z-index: 10;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted, #64748b);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.modal-close:hover {
    color: var(--text-primary, #0f172a);
    background: var(--bg-subtle, #f1f5f9);
}

.modal-body {
    padding: 20px 22px;
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0; /* CRITICAL: Enables clean scrolling of body without cutting footer */
    box-sizing: border-box;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.6);
}

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-subtle, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex: 0 0 auto;
    flex-shrink: 0;
    background: var(--bg-surface-elevated, #ffffff);
    position: relative;
    bottom: auto;
    z-index: 10;
}

body.dark-theme .modal-backdrop,
html.dark-theme .modal-backdrop {
    background: rgba(3, 7, 18, 0.82);
}
body.dark-theme .modal-content,
body.dark-theme .modal-box,
body.dark-theme .modal-header,
body.dark-theme .modal-footer,
html.dark-theme .modal-content,
html.dark-theme .modal-box,
html.dark-theme .modal-header,
html.dark-theme .modal-footer {
    background: #1e293b;
    border-color: #334155;
}
body.dark-theme .modal-title,
html.dark-theme .modal-title {
    color: #f1f5f9;
}
body.dark-theme .modal-close:hover,
html.dark-theme .modal-close:hover {
    color: #ffffff;
    background: #334155;
}

/* ==========================================================================
   BREAKPOINTS & RESPONSIVE RULES
   ========================================================================== */

/* ─── Laptops & Intermediate Desktops (<= 1280px) ─── */
@media (max-width: 1280px) {
    .charts-row {
        grid-template-columns: 1.15fr 0.85fr;
        gap: 16px;
    }
    .rewards-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ─── Tablets & iPads Landscape/Portrait (<= 1024px) ─── */
@media (max-width: 1024px) {
    :root {
        --header-height: 60px;
    }

    .topbar {
        padding: 0 16px;
        height: var(--header-height);
    }

    .topbar-sidebar-toggle {
        display: inline-flex;
    }

    .sidebar {
        top: 0;
        bottom: 0;
        height: 100dvh;
        width: 280px;
        max-width: 85vw;
        transform: translateX(-100%);
        z-index: 1060;
        box-shadow: var(--shadow-modal);
    }
    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
        width: 100%;
        margin-top: var(--header-height);
    }

    .content-container {
        padding: 22px 20px 40px;
    }

    .charts-row {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .dashboard-split-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .passport-summary-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ─── Phablets & Large Phones (<= 768px) ─── */
@media (max-width: 768px) {
    :root {
        --header-height: 58px;
    }

    .topbar {
        padding: 0 14px;
        height: var(--header-height);
    }

    .content-container {
        padding: 16px 14px 36px;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 14px;
        margin-bottom: 20px;
    }

    .page-title-group {
        flex: 0 0 auto;
        width: 100%;
    }

    .page-actions {
        width: 100%;
    }
    .page-actions .btn {
        flex: 1 1 calc(50% - 6px);
        justify-content: center;
        min-width: 130px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .passport-summary-grid {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }

    .filter-form,
    .researchers-filter-form,
    .pub-filter-form,
    .dept-filter-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .filter-form > div,
    .researchers-filter-form > div,
    .pub-filter-form > div,
    .search-input-wrap,
    .search-input-group,
    .filter-select-wrap {
        width: 100% !important;
        min-width: 0 !important;
        flex: 1 1 100% !important;
    }

    .filter-form button,
    .researchers-filter-form button,
    .pub-filter-form button {
        width: 100%;
        justify-content: center;
    }

    .page-toolbar-row {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }
    .page-toolbar-row .filter-tabs {
        width: 100%;
    }
    .page-toolbar-row .page-actions {
        width: 100%;
    }

    .profile-hero-toolbar {
        flex-direction: column !important;
        gap: 12px !important;
    }
    .toolbar-left,
    .toolbar-right {
        width: 100% !important;
        display: flex;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .toolbar-btn,
    .profile-hero-toolbar .btn {
        flex: 1 1 calc(50% - 6px);
        justify-content: center;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
    }
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ─── Compact Phones (<= 640px) ─── */
@media (max-width: 640px) {
    .topbar-guest-badge .badge-text {
        display: none !important;
    }
    .topbar-guest-badge {
        padding: 6px 9px !important;
    }

    .logo-subtitle {
        display: none !important;
    }

    .user-meta-wrap {
        display: none !important;
    }

    .user-dropdown-caret {
        display: none !important;
    }

    .user-dropdown-trigger {
        padding: 3px !important;
        gap: 0 !important;
    }

    .rewards-metrics {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .r-metrics-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .chart-container {
        height: 270px;
    }
}

/* ─── Small Mobile (<= 480px) ─── */
@media (max-width: 480px) {
    :root {
        --header-height: 56px;
    }

    .topbar {
        padding: 0 10px;
        height: var(--header-height);
    }

    .topbar-left-wrapper {
        gap: 8px;
    }

    .topbar-sidebar-toggle {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .logo-icon-img {
        width: 32px;
        height: 32px;
    }

    .logo-title {
        font-size: 14px;
    }

    .theme-toggle-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .btn-topbar-login {
        padding: 6px 10px;
        font-size: 12px;
    }

    .content-container {
        padding: 14px 10px 32px;
    }

    .page-title {
        font-size: 21px;
    }

    .page-subtitle {
        font-size: 12.5px;
    }

    .card-header,
    .card-body {
        padding: 16px;
    }

    .metric-card {
        padding: 16px;
        min-height: auto;
    }

    .metric-composite {
        padding: 10px 6px;
    }

    .comp-val {
        font-size: 15px;
    }

    .comp-label {
        font-size: 9px;
    }

    .page-actions .btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .modal-backdrop {
        padding: 8px 6px;
    }

    .modal-dialog {
        max-width: 100% !important;
        margin: auto 0 !important;
        max-height: calc(100dvh - 16px) !important;
    }

    .modal-content,
    .modal-box {
        max-width: 100% !important;
        max-height: calc(100dvh - 16px) !important;
        border-radius: var(--radius-lg);
    }

    .modal-header,
    .modal-footer {
        padding: 12px 16px;
    }

    .modal-body {
        padding: 14px 14px;
    }

    /* Prevent mobile input auto-zoom on iOS */
    input, select, textarea, .form-control, .form-select {
        font-size: 16px;
    }
}

/* ─── Ultra-Compact Devices (<= 360px) ─── */
@media (max-width: 360px) {
    .topbar {
        padding: 0 6px;
    }

    .topbar-guest-badge {
        display: none !important;
    }

    .btn-topbar-login span {
        display: none !important;
    }
    .btn-topbar-login {
        padding: 7px 10px !important;
    }

    .logo-title {
        font-size: 13px;
    }
}

/* ─── Accessibility: Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   SciMetrics - High-Contrast Dark Theme Enhancement (WCAG AA/AAA Compliant)
   Enforces crisp readability on dark surfaces (#090d16 / #111827 / #1a2337)
   ========================================================================== */

/* ─── Global Badges ─── */
.badge-academic-base {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
body.dark-theme .badge-academic-base,
html.dark-theme .badge-academic-base {
    background: rgba(16, 185, 129, 0.16) !important;
    color: #6ee7b7 !important;
    border-color: rgba(110, 231, 183, 0.3) !important;
}

/* ─── Topbar & Nav in Dark Theme ─── */
body.dark-theme .topbar-guest-badge,
html.dark-theme .topbar-guest-badge {
    background: rgba(var(--teal-61-rgb), 0.15) !important;
    color: var(--teal-81) !important;
    border-color: rgba(var(--teal-61-rgb), 0.35) !important;
}

body.dark-theme .nav-section-title,
html.dark-theme .nav-section-title {
    color: #94a3b8 !important;
}

body.dark-theme .nav-item,
html.dark-theme .nav-item {
    color: #cbd5e1 !important;
}

body.dark-theme .nav-item:hover,
html.dark-theme .nav-item:hover {
    color: var(--teal-81) !important;
    background: rgba(var(--teal-61-rgb), 0.14) !important;
}

/* ─── Headings, Subtitles, Labels & Breadcrumbs ─── */
body.dark-theme .page-title,
html.dark-theme .page-title {
    color: #f8fafc !important;
}

body.dark-theme .page-subtitle,
html.dark-theme .page-subtitle {
    color: #cbd5e1 !important;
}

body.dark-theme .page-subtitle strong,
html.dark-theme .page-subtitle strong {
    color: #f8fafc !important;
}

body.dark-theme .breadcrumb,
html.dark-theme .breadcrumb {
    color: #94a3b8 !important;
}

body.dark-theme .breadcrumb a,
html.dark-theme .breadcrumb a {
    color: #cbd5e1 !important;
}

body.dark-theme .breadcrumb a:hover,
html.dark-theme .breadcrumb a:hover {
    color: var(--teal-81) !important;
}

/* ─── Filter Toolbars & Form Controls ─── */
body.dark-theme .filter-label,
html.dark-theme .filter-label {
    color: #cbd5e1 !important;
}

body.dark-theme .filter-label i,
html.dark-theme .filter-label i {
    color: var(--teal-81) !important;
}

body.dark-theme .form-control,
html.dark-theme .form-control,
body.dark-theme .search-field,
html.dark-theme .search-field,
body.dark-theme select.form-control,
html.dark-theme select.form-control {
    background-color: #111827 !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
    color: #f8fafc !important;
}

body.dark-theme .form-control:focus,
html.dark-theme .form-control:focus,
body.dark-theme select.form-control:focus,
html.dark-theme select.form-control:focus {
    border-color: var(--teal-61) !important;
    box-shadow: 0 0 0 3px rgba(var(--teal-61-rgb), 0.25) !important;
}

body.dark-theme .form-control::placeholder,
html.dark-theme .form-control::placeholder {
    color: #94a3b8 !important;
    opacity: 1;
}

body.dark-theme select.form-control option,
html.dark-theme select.form-control option,
body.dark-theme select option,
html.dark-theme select option {
    background-color: #111827 !important;
    color: #f8fafc !important;
}

body.dark-theme .search-icon,
html.dark-theme .search-icon {
    color: #94a3b8 !important;
}

body.dark-theme .search-clear,
html.dark-theme .search-clear {
    color: #94a3b8 !important;
}
body.dark-theme .search-clear:hover,
html.dark-theme .search-clear:hover {
    color: #f8fafc !important;
}

/* ─── Researcher Cards & Badges ─── */
body.dark-theme .researcher-box,
html.dark-theme .researcher-box {
    background: #111827 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .r-degree-pill,
html.dark-theme .r-degree-pill {
    color: var(--teal-81) !important;
    background: rgba(var(--teal-61-rgb), 0.18) !important;
    border: 1px solid rgba(var(--teal-81-rgb), 0.25) !important;
}

body.dark-theme .r-name a,
html.dark-theme .r-name a {
    color: #f8fafc !important;
}

body.dark-theme .r-name a:hover,
html.dark-theme .r-name a:hover {
    color: var(--teal-71) !important;
}

body.dark-theme .r-dept,
html.dark-theme .r-dept {
    color: #cbd5e1 !important;
}

body.dark-theme .r-dept i,
html.dark-theme .r-dept i {
    color: #94a3b8 !important;
}

/* Scopus Block */
body.dark-theme .scopus-block,
html.dark-theme .scopus-block {
    background: rgba(234, 88, 12, 0.14) !important;
    border-color: rgba(251, 146, 60, 0.35) !important;
}

body.dark-theme .scopus-block .r-metric-badge,
html.dark-theme .scopus-block .r-metric-badge {
    color: #fb923c !important;
}

body.dark-theme .scopus-block .r-sub,
html.dark-theme .scopus-block .r-sub {
    color: #fed7aa !important;
}

body.dark-theme .scopus-block .r-val,
html.dark-theme .scopus-block .r-val {
    color: #ffffff !important;
}

body.dark-theme .scopus-block .text-scopus,
html.dark-theme .scopus-block .text-scopus {
    color: #fdba74 !important;
}

/* Google Scholar Block */
body.dark-theme .scholar-block,
html.dark-theme .scholar-block {
    background: rgba(var(--teal-61-rgb), 0.14) !important;
    border-color: rgba(var(--teal-71-rgb), 0.35) !important;
}

body.dark-theme .scholar-block .r-metric-badge,
html.dark-theme .scholar-block .r-metric-badge {
    color: var(--teal-71) !important;
}

body.dark-theme .scholar-block .r-sub,
html.dark-theme .scholar-block .r-sub {
    color: var(--teal-88) !important;
}

body.dark-theme .scholar-block .r-val,
html.dark-theme .scholar-block .r-val {
    color: #ffffff !important;
}

body.dark-theme .scholar-block .text-scholar,
html.dark-theme .scholar-block .text-scholar {
    color: var(--teal-81) !important;
}

/* ID Tag Pills (Scopus, Scholar, ORCID) */
body.dark-theme .id-tag,
html.dark-theme .id-tag {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #cbd5e1 !important;
}

body.dark-theme .id-tag.tag-scopus,
html.dark-theme .id-tag.tag-scopus {
    color: #fed7aa !important;
    background: rgba(234, 88, 12, 0.18) !important;
    border-color: rgba(251, 146, 60, 0.35) !important;
}

body.dark-theme .id-tag.tag-scholar,
html.dark-theme .id-tag.tag-scholar {
    color: var(--teal-88) !important;
    background: rgba(var(--teal-52-rgb), 0.18) !important;
    border-color: rgba(var(--teal-71-rgb), 0.35) !important;
}

body.dark-theme .id-tag.tag-orcid,
html.dark-theme .id-tag.tag-orcid {
    color: #a7f3d0 !important;
    background: rgba(16, 185, 129, 0.18) !important;
    border-color: rgba(52, 211, 153, 0.35) !important;
}

/* Card Footer & Action Buttons */
body.dark-theme .sync-time,
html.dark-theme .sync-time {
    color: #94a3b8 !important;
}

body.dark-theme .sync-time-col .sync-date,
html.dark-theme .sync-time-col .sync-date {
    color: #cbd5e1 !important;
}

body.dark-theme .sync-time-col .sync-hour,
html.dark-theme .sync-time-col .sync-hour {
    color: #94a3b8 !important;
}

body.dark-theme .btn-action-icon,
html.dark-theme .btn-action-icon {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: #cbd5e1 !important;
}

body.dark-theme .btn-action-icon:hover,
html.dark-theme .btn-action-icon:hover {
    background: #27354f !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
    color: #ffffff !important;
}

/* Secondary Buttons */
body.dark-theme .btn-secondary,
html.dark-theme .btn-secondary {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
    color: #f1f5f9 !important;
}

body.dark-theme .btn-secondary:hover,
html.dark-theme .btn-secondary:hover {
    background: #2d3b55 !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
}

/* ─── Notice & KPI Banners ─── */
body.dark-theme .notice-banner,
html.dark-theme .notice-banner {
    background: #111827 !important;
    border-color: rgba(var(--teal-61-rgb), 0.25) !important;
}

body.dark-theme .notice-banner-title,
html.dark-theme .notice-banner-title {
    color: #f8fafc !important;
}

body.dark-theme .notice-banner-desc,
html.dark-theme .notice-banner-desc {
    color: #cbd5e1 !important;
}

/* ─── Metric Cards in Dashboard ─── */
body.dark-theme .metric-label,
html.dark-theme .metric-label {
    color: #cbd5e1 !important;
}

body.dark-theme .comp-label,
html.dark-theme .comp-label {
    color: #94a3b8 !important;
}

body.dark-theme .comp-val,
html.dark-theme .comp-val {
    color: #f8fafc !important;
}

body.dark-theme .metric-subtext,
html.dark-theme .metric-subtext {
    color: #94a3b8 !important;
}

body.dark-theme .card-desc,
html.dark-theme .card-desc {
    color: #94a3b8 !important;
}

/* ─── Tables in Dark Theme ─── */
body.dark-theme .modern-table th,
html.dark-theme .modern-table th,
body.dark-theme .table th,
html.dark-theme .table th {
    background: #162035 !important;
    color: #cbd5e1 !important;
    border-bottom-color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .modern-table td,
html.dark-theme .modern-table td,
body.dark-theme .table td,
html.dark-theme .table td {
    color: #e2e8f0 !important;
    border-bottom-color: rgba(255, 255, 255, 0.07) !important;
}

body.dark-theme .modern-table tr:hover td,
html.dark-theme .modern-table tr:hover td,
body.dark-theme .table tr:hover td,
html.dark-theme .table tr:hover td {
    background: rgba(30, 41, 59, 0.7) !important;
}

body.dark-theme .user-sub,
html.dark-theme .user-sub {
    color: #94a3b8 !important;
}

/* ─── Modals in Dark Theme ─── */
body.dark-theme .modal-content,
html.dark-theme .modal-content {
    background: #111827 !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #f8fafc !important;
}

body.dark-theme .modal-header,
html.dark-theme .modal-header,
body.dark-theme .modal-footer,
html.dark-theme .modal-footer {
    background: #111827 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .modal-title,
html.dark-theme .modal-title {
    color: #f8fafc !important;
}

body.dark-theme .modal-close,
html.dark-theme .modal-close {
    color: #94a3b8 !important;
}
body.dark-theme .modal-close:hover,
html.dark-theme .modal-close:hover {
    color: #ffffff !important;
}

body.dark-theme .form-label,
html.dark-theme .form-label,
body.dark-mode .form-label,
html.dark-mode .form-label {
    color: #e2e8f0 !important;
}

/* ==========================================================================
   ADVANCED DARK MODE PERFECTION SYSTEM (2026 SaaS Grade)
   ========================================================================== */
body.dark-theme, html.dark-theme,
body.dark-mode, html.dark-mode,
:root[data-theme="dark"] {
    color-scheme: dark;
}

/* 1. Global Backgrounds, Cards and Containers */
body.dark-theme, html.dark-theme,
body.dark-mode, html.dark-mode {
    background-color: var(--bg-app);
    color: var(--text-main);
}

body.dark-theme .card,
html.dark-theme .card,
body.dark-mode .card,
html.dark-mode .card {
    background: #111827;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.dark-theme .card-header,
html.dark-theme .card-header,
body.dark-mode .card-header,
html.dark-mode .card-header {
    background: rgba(26, 35, 55, 0.5);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .card-footer,
html.dark-theme .card-footer,
body.dark-mode .card-footer,
html.dark-mode .card-footer {
    background: rgba(17, 24, 39, 0.7);
    border-top-color: rgba(255, 255, 255, 0.07);
}

/* 2. Topbar, Sidebar & Fixed Elements */
body.dark-theme .topbar,
html.dark-theme .topbar,
body.dark-mode .topbar,
html.dark-mode .topbar {
    background: rgba(17, 24, 39, 0.94) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .sidebar,
html.dark-theme .sidebar,
body.dark-mode .sidebar,
html.dark-mode .sidebar {
    background: rgba(9, 13, 22, 0.96) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.07) !important;
}

body.dark-theme .nav-item,
html.dark-theme .nav-item,
body.dark-mode .nav-item,
html.dark-mode .nav-item {
    color: #cbd5e1;
}

body.dark-theme .nav-item:hover,
html.dark-theme .nav-item:hover,
body.dark-mode .nav-item:hover,
html.dark-mode .nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
}

body.dark-theme .nav-item.active,
html.dark-theme .nav-item.active,
body.dark-mode .nav-item.active,
html.dark-mode .nav-item.active {
    background: linear-gradient(135deg, rgba(var(--teal-52-rgb), 0.25) 0%, rgba(var(--teal-56-rgb), 0.2) 100%);
    color: var(--teal-71);
    border-left: 3px solid var(--teal-61);
}

/* 3. Inputs, Selects, Forms & Search Controls */
body.dark-theme .form-control,
html.dark-theme .form-control,
body.dark-mode .form-control,
html.dark-mode .form-control,
body.dark-theme input[type="text"],
html.dark-theme input[type="text"],
body.dark-theme input[type="search"],
html.dark-theme input[type="search"],
body.dark-theme input[type="password"],
html.dark-theme input[type="password"],
body.dark-theme input[type="email"],
html.dark-theme input[type="email"],
body.dark-theme input[type="number"],
html.dark-theme input[type="number"],
body.dark-theme input[type="date"],
html.dark-theme input[type="date"],
body.dark-theme textarea,
html.dark-theme textarea,
body.dark-theme select,
html.dark-theme select {
    background-color: #0d1424 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #f8fafc !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

body.dark-theme .form-control:focus,
html.dark-theme .form-control:focus,
body.dark-mode .form-control:focus,
html.dark-mode .form-control:focus,
body.dark-theme select:focus,
html.dark-theme select:focus {
    border-color: var(--teal-61) !important;
    box-shadow: 0 0 0 3px rgba(var(--teal-61-rgb), 0.28) !important;
    background-color: #111a30 !important;
}

body.dark-theme select option,
html.dark-theme select option,
body.dark-mode select option,
html.dark-mode select option {
    background-color: #111827 !important;
    color: #f8fafc !important;
}

body.dark-theme .input-group-text,
html.dark-theme .input-group-text {
    background-color: #162035 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #cbd5e1 !important;
}

/* 4. Dropdowns, Popovers and Floating Menus */
body.dark-theme .dropdown-menu,
html.dark-theme .dropdown-menu,
body.dark-mode .dropdown-menu,
html.dark-mode .dropdown-menu,
body.dark-theme .user-dropdown-menu,
html.dark-theme .user-dropdown-menu,
body.dark-theme .pub-export-dropdown,
html.dark-theme .pub-export-dropdown {
    background-color: #111827 !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    box-shadow: 0 16px 40px -6px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .dropdown-item,
html.dark-theme .dropdown-item,
body.dark-theme .user-dropdown-item,
html.dark-theme .user-dropdown-item {
    color: #cbd5e1 !important;
}

body.dark-theme .dropdown-item:hover,
html.dark-theme .dropdown-item:hover,
body.dark-theme .user-dropdown-item:hover,
html.dark-theme .user-dropdown-item:hover {
    background: rgba(var(--teal-61-rgb), 0.14) !important;
    color: #ffffff !important;
}

body.dark-theme .dropdown-divider,
html.dark-theme .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* 5. Tables & Grids */
body.dark-theme .modern-table,
html.dark-theme .modern-table,
body.dark-theme .table,
html.dark-theme .table {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .modern-table th,
html.dark-theme .modern-table th,
body.dark-theme .table th,
html.dark-theme .table th {
    background: #162035 !important;
    color: #cbd5e1 !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .modern-table td,
html.dark-theme .modern-table td,
body.dark-theme .table td,
html.dark-theme .table td {
    background: transparent !important;
    color: #e2e8f0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

body.dark-theme .modern-table tr:hover td,
html.dark-theme .modern-table tr:hover td,
body.dark-theme .table tr:hover td,
html.dark-theme .table tr:hover td {
    background: rgba(var(--teal-61-rgb), 0.08) !important;
}

body.dark-theme .table-striped tbody tr:nth-of-type(odd) td {
    background: rgba(255, 255, 255, 0.015) !important;
}

/* 6. Badges & Status Indicators */
body.dark-theme .badge-scopus,
html.dark-theme .badge-scopus {
    background: rgba(234, 88, 12, 0.18) !important;
    color: #fb923c !important;
    border: 1px solid rgba(251, 146, 60, 0.35) !important;
}

body.dark-theme .badge-scholar,
html.dark-theme .badge-scholar {
    background: rgba(var(--teal-52-rgb), 0.18) !important;
    color: var(--teal-71) !important;
    border: 1px solid rgba(var(--teal-71-rgb), 0.35) !important;
}

body.dark-theme .badge-q1,
html.dark-theme .badge-q1 {
    background: rgba(5, 150, 105, 0.22) !important;
    color: #34d399 !important;
    border: 1px solid rgba(52, 211, 153, 0.35) !important;
}

body.dark-theme .badge-q2,
html.dark-theme .badge-q2 {
    background: rgba(2, 132, 199, 0.22) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
}

body.dark-theme .badge-q3,
html.dark-theme .badge-q3 {
    background: rgba(217, 119, 6, 0.22) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(251, 191, 36, 0.35) !important;
}

body.dark-theme .badge-q4,
html.dark-theme .badge-q4 {
    background: rgba(225, 29, 72, 0.22) !important;
    color: #fb7185 !important;
    border: 1px solid rgba(251, 113, 133, 0.35) !important;
}

body.dark-theme .badge-oak,
html.dark-theme .badge-oak {
    background: rgba(124, 58, 237, 0.22) !important;
    color: #c084fc !important;
    border: 1px solid rgba(167, 139, 250, 0.35) !important;
}

/* 7. Pagination */
body.dark-theme .pagination .page-link,
html.dark-theme .pagination .page-link {
    background: #111827 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #cbd5e1 !important;
}

body.dark-theme .pagination .page-link:hover,
html.dark-theme .pagination .page-link:hover {
    background: #1e293b !important;
    color: #ffffff !important;
    border-color: var(--teal-61) !important;
}

body.dark-theme .pagination .page-item.active .page-link,
html.dark-theme .pagination .page-item.active .page-link {
    background: var(--teal-52) !important;
    color: #ffffff !important;
    border-color: var(--teal-52) !important;
    box-shadow: 0 4px 12px rgba(var(--teal-52-rgb), 0.4) !important;
}

/* 8. Code & Pre Blocks */
body.dark-theme code,
html.dark-theme code {
    background: #0d1424 !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme pre,
html.dark-theme pre {
    background: #0d1424 !important;
    color: #f1f5f9 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* 9. Notices, Alerts & Toasts */
body.dark-theme .alert,
html.dark-theme .alert {
    background: #111827 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #f8fafc !important;
}

body.dark-theme .alert-success,
html.dark-theme .alert-success {
    background: rgba(6, 78, 59, 0.35) !important;
    border-color: rgba(52, 211, 153, 0.35) !important;
    color: #a7f3d0 !important;
}

body.dark-theme .alert-info,
html.dark-theme .alert-info {
    background: rgba(var(--teal-38-rgb), 0.35) !important;
    border-color: rgba(var(--teal-71-rgb), 0.35) !important;
    color: var(--teal-88) !important;
}

body.dark-theme .alert-warning,
html.dark-theme .alert-warning {
    background: rgba(120, 53, 15, 0.35) !important;
    border-color: rgba(251, 191, 36, 0.35) !important;
    color: #fde68a !important;
}

body.dark-theme .alert-danger,
html.dark-theme .alert-danger {
    background: rgba(127, 29, 29, 0.35) !important;
    border-color: rgba(248, 113, 113, 0.35) !important;
    color: #fecdd3 !important;
}

/* 10. Publication Center Export Dropdown & Choice Cards */
.pub-export-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--bg-surface);
    min-width: 280px;
    border-radius: 14px;
    box-shadow: var(--shadow-dropdown);
    border: 1px solid var(--border-color);
    z-index: 1000;
    overflow: hidden;
    text-align: left;
}

.pub-export-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-main);
    text-decoration: none;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.18s ease;
}

.pub-export-item:last-child {
    border-bottom: none;
}

.pub-export-item:hover {
    background: var(--bg-subtle);
}

.pub-export-item.item-featured {
    background: rgba(16, 185, 129, 0.08);
}

.pub-export-item.item-featured:hover {
    background: rgba(16, 185, 129, 0.16);
}

.pub-export-title {
    font-weight: 700;
    color: var(--text-main);
}

.pub-export-item.item-featured .pub-export-title {
    color: #059669;
}

body.dark-theme .pub-export-item.item-featured .pub-export-title,
html.dark-theme .pub-export-item.item-featured .pub-export-title,
body.dark-mode .pub-export-item.item-featured .pub-export-title,
html.dark-mode .pub-export-item.item-featured .pub-export-title {
    color: #34d399;
}

.pub-export-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.export-choice-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.export-choice-card:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.export-choice-scopus {
    border-color: var(--scopus-border, #fed7aa);
    background: var(--scopus-bg, #fff7ed);
    color: var(--scopus-orange, #c2410c);
}

.export-choice-scholar {
    border-color: var(--scholar-border, var(--teal-88));
    background: var(--scholar-bg, #f0f6f6);
    color: var(--scholar-blue, var(--teal-48));
}

.export-choice-oak {
    border-color: var(--emerald-border, #a7f3d0);
    background: var(--emerald-bg, #ecfdf5);
    color: var(--emerald, #047857);
}

body.dark-theme .export-choice-scopus,
html.dark-theme .export-choice-scopus,
body.dark-mode .export-choice-scopus,
html.dark-mode .export-choice-scopus {
    background: rgba(234, 88, 12, 0.16) !important;
    border-color: rgba(251, 146, 60, 0.35) !important;
    color: #fb923c !important;
}

body.dark-theme .export-choice-scholar,
html.dark-theme .export-choice-scholar,
body.dark-mode .export-choice-scholar,
html.dark-mode .export-choice-scholar {
    background: rgba(var(--teal-52-rgb), 0.16) !important;
    border-color: rgba(var(--teal-71-rgb), 0.35) !important;
    color: var(--teal-71) !important;
}

body.dark-theme .export-choice-oak,
html.dark-theme .export-choice-oak,
body.dark-mode .export-choice-oak,
html.dark-mode .export-choice-oak {
    background: rgba(16, 185, 129, 0.16) !important;
    border-color: rgba(52, 211, 153, 0.35) !important;
    color: #34d399 !important;
}


/* ==========================================================================
   MOBILE BOTTOM NAVIGATION & GLOBAL COMMAND PALETTE (CTRL+K)
   ========================================================================== */

/* ─── Topbar Search Trigger Button ─── */
.topbar-search-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.topbar-search-trigger:hover {
    background: var(--bg-surface);
    border-color: var(--primary);
    color: var(--text-main);
    box-shadow: var(--shadow-xs);
}
.search-trigger-kbd {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.search-trigger-kbd kbd {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 10px;
    font-family: inherit;
    font-weight: 700;
    color: var(--text-muted);
}
@media (max-width: 640px) {
    .search-trigger-text, .search-trigger-kbd {
        display: none;
    }
    .topbar-search-trigger {
        padding: 8px 10px;
    }
}

/* ─── Command Palette Modal (Ctrl+K) ─── */
.command-palette-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    animation: fadeInPalette 0.15s ease-out;
}
@keyframes fadeInPalette {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}
.command-palette-modal {
    width: 95%;
    max-width: 620px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.command-palette-search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}
.search-palette-icon {
    font-size: 18px;
    color: var(--primary);
}
#commandPaletteInput {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
}
.command-palette-kbd {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}
.command-palette-results {
    max-height: 380px;
    overflow-y: auto;
    padding: 10px;
}
.palette-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    padding: 8px 12px 4px 12px;
}
.palette-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-main);
    transition: background 0.15s ease;
}
.palette-item:hover, .palette-item.active {
    background: var(--primary-light);
}
.palette-icon {
    font-size: 16px;
    color: var(--primary);
    width: 20px;
    text-align: center;
}
.palette-item-text {
    flex: 1;
    min-width: 0;
}
.palette-item-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.palette-item-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}
.palette-spinner {
    font-size: 15px;
    color: var(--primary);
    display: flex;
    align-items: center;
    padding: 0 4px;
}
.palette-researcher-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal-61), var(--teal-48));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12.5px;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(var(--teal-52-rgb), 0.2);
}
.palette-researcher-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.palette-researcher-metrics {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.badge-degree {
    display: inline-block;
    padding: 1px 6px;
    background: rgba(var(--teal-52-rgb), 0.12);
    color: var(--primary);
    border-radius: 4px;
    font-weight: 600;
    font-size: 10.5px;
}
.badge-metric {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.badge-metric.scopus-badge {
    background: rgba(249, 115, 22, 0.12);
    color: #ea580c;
    border: 1px solid rgba(249, 115, 22, 0.2);
}
.badge-metric.citation-badge {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.palette-empty-state {
    padding: 30px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.command-palette-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 18px;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border-color);
    font-size: 11.5px;
    color: var(--text-muted);
}
.command-palette-footer kbd {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 10px;
    color: var(--text-main);
}


#commandPaletteInput {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
}
.command-palette-kbd {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}
.command-palette-results {
    max-height: 380px;
    overflow-y: auto;
    padding: 10px;
}
.palette-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    padding: 8px 12px 4px 12px;
}
.palette-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-main);
    transition: background 0.15s ease;
}
.palette-item:hover, .palette-item.active {
    background: var(--primary-light);
}
.palette-icon {
    font-size: 16px;
    color: var(--primary);
    width: 20px;
    text-align: center;
}
.palette-item-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
}
.palette-item-sub {
    font-size: 11.5px;
    color: var(--text-muted);
}
.command-palette-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 18px;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border-color);
    font-size: 11.5px;
    color: var(--text-muted);
}
.command-palette-footer kbd {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 10px;
    color: var(--text-main);
}



.filter-pill.active i {
    color: #ffffff !important;
}

.table-inline-filter-row input:focus,
.table-inline-filter-row select:focus {
    border-color: var(--primary, var(--teal-42)) !important;
    box-shadow: 0 0 0 3px rgba(var(--teal-56-rgb), 0.15) !important;
}

.sortable-th {
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sortable-th:hover {
    background-color: var(--bg-hover, rgba(var(--teal-56-rgb), 0.08)) !important;
    color: var(--primary, var(--teal-42)) !important;
}

.sortable-th:hover .sort-icon {
    opacity: 0.8 !important;
    color: var(--primary, var(--teal-42)) !important;
}

.journal-data-row {
    transition: background-color 0.15s ease;
}

.journal-data-row:hover {
    background-color: var(--bg-hover, rgba(var(--teal-56-rgb), 0.04)) !important;
}

/* ==========================================================================
   ADVANCED MOBILE RESPONSIVENESS & TOUCH EXPERIENCE (SciMetrics Mobile 2.0)
   ========================================================================== */

/* 1. Mobile Global Inputs, Tap Targets, Spacing & Prevention of iOS Auto-Zoom */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    input[type="url"],
    input[type="tel"],
    select,
    textarea,
    .form-control,
    .form-select {
        font-size: 16px !important; /* Prevents auto-zoom on mobile Safari */
        min-height: 42px;
    }

    button, .btn, .nav-sub-item, .mobile-nav-item, .conf-filter-pill, .filter-pill {
        min-height: 38px;
        touch-action: manipulation;
    }

    /* Content padding with safe area for mobile bottom nav */
    .content-container, .content-wrapper {
        padding: 14px 12px 88px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Cards */
    .card {
        padding: 16px 14px !important;
        border-radius: 14px !important;
        margin-bottom: 16px !important;
    }

    /* Stats Grids */
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        margin-bottom: 16px !important;
    }
    .stat-card {
        padding: 12px 14px !important;
        border-radius: 12px !important;
    }
    .stat-card div:nth-child(2) {
        font-size: 20px !important;
        margin-top: 4px !important;
    }

    /* Page Header and Actions */
    .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        margin-bottom: 16px !important;
    }
    .page-title {
        font-size: 19px !important;
        line-height: 1.3 !important;
    }
    .page-subtitle {
        font-size: 12.5px !important;
        line-height: 1.4 !important;
    }
    .page-actions {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 8px !important;
    }
    .page-actions .btn, .page-actions a {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
    }

    /* Responsive Tables with Smooth Momentum Scrolling */
    .table-responsive {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border-radius: 12px !important;
        position: relative !important;
        margin-bottom: 14px !important;
    }
    .table-responsive table {
        min-width: 580px;
    }
    .table-responsive table th,
    .table-responsive table td {
        padding: 10px 8px !important;
        font-size: 12px !important;
    }

    /* Modals - Bottom Sheet on Mobile Phones */
    .modal-backdrop-custom {
        padding: 0 !important;
        align-items: flex-end !important;
        justify-content: center !important;
    }
    .modal-dialog-custom {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        max-height: 90dvh !important;
        padding: 20px 16px 32px !important;
        margin: 0 !important;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Filter Strip - Touch-friendly Horizontal Scroll */
    .conf-filter-pills-wrap,
    .d-flex.flex-wrap.gap-2:has(.conf-filter-pill) {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 6px !important;
        scrollbar-width: none !important;
    }
    .conf-filter-pills-wrap::-webkit-scrollbar,
    .d-flex.flex-wrap.gap-2:has(.conf-filter-pill)::-webkit-scrollbar {
        display: none !important;
    }
    .conf-filter-pill {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        padding: 6px 12px !important;
        font-size: 12px !important;
    }

    /* Checker Layout Grid */
    .checker-layout-grid,
    div[style*="grid-template-columns: 1.1fr 1fr"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    .checker-input-row,
    div[style*="grid-template-columns: 1fr 1fr"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* A4 Documents On-Screen Mobile Preview (Non-print) */
    .a4-page {
        width: 100% !important;
        max-width: 100% !important;
        min-height: auto !important;
        padding: 16px 12px !important;
        box-shadow: none !important;
        border-radius: 8px !important;
        overflow-x: hidden !important;
    }
    .certificate-sheet {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        padding: 10px !important;
        box-shadow: none !important;
    }
    .cert-border-inner {
        padding: 14px 8px !important;
    }
    .cert-main-title {
        font-size: 22px !important;
        letter-spacing: 2px !important;
    }
    .cert-author-name {
        font-size: 18px !important;
    }
    .cert-footer-row {
        flex-direction: column !important;
        align-items: center !important;
        gap: 14px !important;
    }
}

/* Extra Small Phones (<= 420px) */
@media (max-width: 420px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    .topbar-brand .logo-title {
        font-size: 13px !important;
    }
    .topbar-brand .brand-img {
        width: 26px !important;
        height: 26px !important;
    }
}

