/* ============================================================
   CUHK FACTS & FIGURES - MAIN STYLESHEET
   ============================================================
   
   IMPORTANT: This file depends on colors.css
   Make sure colors.css is imported BEFORE this file in HTML:
   <link rel="stylesheet" href="colors.css">
   <link rel="stylesheet" href="styles.css">
   
   All color variables and typography scales are defined in colors.css
   ============================================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Respect user's motion preferences for accessibility and performance */
@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;
    }
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    /* Base font size for rem calculations */
    overflow-x: hidden;
    /* Prevent horizontal scroll at root level */
    max-width: 100vw;
    /* Limit to viewport width */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: var(--line-height-normal);
    color: var(--cuhk-black);
    background-color: var(--cuhk-haze);
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-regular);
    overflow-x: hidden;
    max-width: 100vw;
    /* Limit to viewport width */
    position: relative;
    /* Establish positioning context */
    padding-top: 100px;
}

.print-cover {
    display: none;
}

/* Hide labs print content from web view */
.labs-print {
    display: none;
}

.programmes-exchange-print {
    display: none;
}

.scholarships-print {
    display: none;
}

.global-print {
    display: none;
}

.facilities-print {
    display: none;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: var(--font-weight-bold);
    color: var(--cuhk-classic-purple);
    line-height: var(--line-height-tight);
    margin-bottom: var(--spacing-md);
}

h1 {
    font-size: var(--font-size-main-title);
    font-weight: var(--font-weight-bold);
    color: var(--cuhk-classic-purple);
}

h2 {
    font-size: var(--font-size-h2);
    font-weight: var(--font-weight-bold);
    color: var(--cuhk-classic-purple);
}

h3 {
    font-size: var(--font-size-h3);
    font-weight: var(--font-weight-semibold);
    color: var(--cuhk-royal-purple);
}

h4,
h5,
h6 {
    font-size: var(--font-size-labels);
    font-weight: var(--font-weight-semibold);
    color: var(--cuhk-royal-purple);
}

.chinese {
    font-weight: var(--font-weight-light);
    color: var(--cuhk-royal-purple);
    font-size: 1em;
    line-height: var(--line-height-relaxed);
}

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

/* AI Editor Styles */
.ai-editor {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.ai-editor.open {
    right: 0;
}

.ai-editor-content {
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ai-editor h3 {
    color: var(--royal-purple);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.ai-editor p {
    color: var(--marble);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.ai-editor textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 2px solid var(--coral);
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    resize: vertical;
    margin-bottom: 1rem;
}

.ai-editor textarea:focus {
    outline: none;
    border-color: var(--royal-purple);
}

.ai-editor-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ai-editor button {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.ai-editor #ai-submit {
    background: var(--royal-purple);
    color: white;
    flex: 1;
}

.ai-editor #ai-submit:hover {
    background: var(--classic-purple);
}

.ai-editor #ai-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.ai-editor #ai-toggle {
    background: #f5f5f5;
    color: var(--marble);
    border: 1px solid #ddd;
}

.ai-editor #ai-toggle:hover {
    background: #e9e9e9;
}

.ai-status {
    padding: 0.75rem;
    border-radius: 5px;
    font-size: 0.9rem;
    margin-top: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
}

.ai-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ai-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.ai-status.loading {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.ai-editor-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: var(--royal-purple);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.ai-editor-toggle:hover {
    background: var(--classic-purple);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.ai-editor-toggle.hidden {
    display: none;
}

.user-guide-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: var(--cuhk-royal-purple);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    text-decoration: none;
}

.user-guide-toggle:hover {
    background: var(--cuhk-classic-purple);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    color: white;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--cuhk-stone);
    z-index: 1000;
    transition: all 0.3s ease;
    overflow: visible;
    /* Allow mobile menu to be visible */
}

/* Navbar scrolled state - more performant than JS scroll listener */
.navbar.scrolled {
    background: rgba(241, 236, 244, 0.98);
    box-shadow: 0 2px 20px rgba(118, 67, 147, 0.1);
}

.nav-container {
    max-width: 1400px;
    width: 100%;
    /* Ensure it doesn't exceed viewport */
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100px;
}

.nav-logo img {
    height: 70px;
    width: auto;
    transition: all 0.3s ease;
    display: block;
}

.year {
    background: var(--cuhk-royal-purple);
    color: var(--cuhk-white);
    padding: 0.2rem 0.6rem;
    border-radius: 5px;
    font-size: var(--font-size-subtext);
    margin-left: 0.8rem;
    font-weight: var(--font-weight-semibold);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1rem;
    margin: 0;
    align-items: flex-start;
    padding-top: 0.5rem;
}

.nav-link {
    text-decoration: none;
    color: var(--cuhk-grey);
    font-weight: var(--font-weight-regular);
    font-size: var(--font-size-nav);
    transition: color 0.3s ease;
    position: relative;
    line-height: var(--line-height-normal);
    padding-bottom: 1.2rem;
    display: inline-block;
    white-space: nowrap;
}

/* Chinese text overlay effect */
.nav-link::before {
    content: attr(data-chinese);
    position: absolute;
    top: 1.25rem;
    /* Moved up slightly from 1.5rem to create more gap from underline */
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.875rem;
    color: var(--cuhk-classic-purple);
    white-space: nowrap;
    opacity: 0.75;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.nav-link:hover::before {
    opacity: 1;
}

.nav-link:hover {
    color: var(--cuhk-classic-purple);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -8px;
    /* Moved down to create more gap from text */
    left: 0;
    width: 0;
    height: 2px;
    background: var(--cuhk-classic-purple);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Active nav link styling */
.nav-link.active {
    color: var(--cuhk-classic-purple);
    font-weight: var(--font-weight-semibold);
}

.nav-link.active::after {
    width: 100%;
    background: var(--cuhk-royal-gold);
}

/* Show Chinese text with medium opacity for active links */
.nav-link.active::before {
    opacity: 1;
}

/* Navigation Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.print-btn,
.view-mode-btn,
.chinese-variant-toggle {
    background: none;
    border: none;
    color: var(--classic-purple);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.chinese-variant-toggle {
    width: auto;
    min-width: 58px;
    gap: 0.25rem;
    padding: 0 0.65rem;
    border: 1px solid var(--cuhk-dewy-purple);
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: var(--font-weight-semibold);
    line-height: 1;
}

.chinese-variant-option {
    color: var(--cuhk-classic-purple);
    opacity: 0.58;
    font-weight: var(--font-weight-medium);
    transition: opacity 0.2s ease, color 0.2s ease;
}

.chinese-variant-option.active {
    color: var(--cuhk-classic-purple);
    opacity: 1;
    font-weight: var(--font-weight-bold);
}

.chinese-variant-separator {
    color: var(--cuhk-classic-purple);
    opacity: 0.75;
}

.print-btn:hover,
.view-mode-btn:hover,
.chinese-variant-toggle:hover {
    background: var(--classic-purple);
    color: white;
}

.chinese-variant-toggle:hover .chinese-variant-option,
.chinese-variant-toggle:hover .chinese-variant-separator {
    color: white;
    opacity: 1;
}

.chinese-variant-toggle:hover .chinese-variant-option.active {
    color: white;
}

.chinese-variant-toggle:hover .chinese-variant-option:not(.active) {
    opacity: 0.65;
}

.chinese-variant-toggle:focus-visible {
    outline: 3px solid var(--cuhk-royal-gold);
    outline-offset: 2px;
}

.view-mode-btn.active {
    background: var(--classic-purple);
    color: white;
}

.view-mode-btn.active:hover {
    background: var(--classic-purple-dark, #5a4a7a);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background: var(--classic-purple);
    margin: 3px 0;
    transition: 0.3s;
}

/* Hero Section */
.hero {
    display: flex;
    flex-direction: column;
    background-color: var(--cuhk-classic-purple);
}

.hero-content {
    text-align: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 1rem 3rem;
    width: 100%;
    box-sizing: border-box;
}

.hero-title {
    font-family: 'Inter', sans-serif;
    font-size: 88px;
    font-weight: 300;
    color: #FFF;
    font-style: normal;
    line-height: 88px;
    letter-spacing: -3.52px;
    margin-bottom: 1rem;
    display: block;
    text-align: center;
}

.hero-title-line {
    display: inline;
}

.hero-title .ampersand {
    font-family: 'Roboto', sans-serif;
    font-size: inherit;
    font-style: normal;
    font-weight: 100;
    line-height: inherit;
    color: #FFF;
    opacity: 1;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--cuhk-white);
    margin-bottom: 0;
    font-weight: var(--font-weight-thin);
    letter-spacing: 0.15em;
    line-height: var(--line-height-normal);
    text-align: center;
}

/* Hero Pattern Strip */
.hero-pattern {
    width: 100%;
    height: 120px;
    background-image: url('static/FF25_Digital_Cover_h.svg');
    background-repeat: repeat-x;
    background-size: auto 100%;
    background-position: left bottom;
    margin-top: auto;
    margin-bottom: -5px;
    position: relative;
    overflow: hidden;
}

.hero-description {
    display: none;
}



.stat-item {
    text-align: center;
    padding: 1.5rem;
    background: var(--cuhk-white);
    border-radius: 5px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--cuhk-dewy-purple);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(118, 67, 147, 0.2);
}

.stat-number {
    font-size: var(--font-size-key-figures);
    font-weight: var(--font-weight-extrabold);
    color: var(--cuhk-royal-gold);
    margin-bottom: 0.5rem;
    line-height: var(--line-height-tight);
}

.stat-label {
    font-size: var(--font-size-labels);
    color: var(--cuhk-royal-purple);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
}

/* Sections */
.section {
    padding: 4rem 0;
    position: relative;
    background: var(--cuhk-white);
    transition: opacity 0.3s ease, max-height 0.3s ease;
}

#research.research-section {
    background: #FCFCFC;
}

#research.research-section .chinese,
#research.research-section .section-last-updated-date,
#research.research-section .subsection-title,
#research.research-section .subsection-title [data-field],
#research.research-section .output-number {
    color: var(--cuhk-classic-purple);
}

/* Section visibility based on permissions (only in edit mode) */
section[data-permission-hidden="true"] {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
}

/* Smooth transition for section visibility in edit mode */
body:not(.view-mode) section {
    transition: opacity 0.3s ease, max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
}


.section-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.section-title {
    flex: 1;
    font-size: var(--font-size-h2);
    font-weight: var(--font-weight-bold);
    color: var(--cuhk-classic-purple);
    text-align: left;
    margin-bottom: 1rem;
    position: relative;
    letter-spacing: -0.01em;
    line-height: var(--line-height-tight);
}

.section-title .chinese {
    display: block;
    font-size: var(--font-size-h3);
    margin-top: 0.5rem;
    font-weight: var(--font-weight-light);
    color: var(--cuhk-royal-purple);
    line-height: var(--line-height-relaxed);
}

.section-title::after {
    display: none;
}

.section-last-updated {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.7rem;
    color: var(--cuhk-steel-gray);
    margin-left: auto;
    margin-right: 0.5rem;
    margin-top: 0.5rem;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.6);
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    border: 1px solid var(--cuhk-dewy-purple);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    line-height: 1.2;
    /* Normalize line height */
}

.section-last-updated:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--cuhk-classic-purple);
    box-shadow: 0 4px 12px rgba(118, 67, 147, 0.1);
    transform: translateY(-1px);
}

.section-last-updated i {
    font-size: 0.9rem;
    color: var(--cuhk-classic-purple);
    display: inline-flex;
    align-items: center;
    height: auto;
    line-height: 1;
}

.section-last-updated-label {
    font-weight: var(--font-weight-semibold);
    color: var(--cuhk-classic-purple);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.7rem;
    line-height: 1;
    padding-top: 1px;
    /* Micro-adjustment for visual centering */
}

.section-last-updated-text {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.section-last-updated-date {
    font-weight: var(--font-weight-semibold);
    color: var(--cuhk-royal-purple);
    line-height: 1;
}



.section-print-btn {
    background: none;
    border: none;
    color: var(--cuhk-classic-purple);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.section-print-btn:hover,
.section-print-btn:focus {
    background: var(--cuhk-milky-purple);
    color: var(--cuhk-royal-purple);
}

.section-print-btn:focus-visible {
    outline: 3px solid var(--cuhk-royal-gold);
    outline-offset: 2px;
}

.ai-section-print-btn {
    color: var(--cuhk-royal-gold);
    margin-left: -0.75rem;
}

.ai-section-print-btn:hover,
.ai-section-print-btn:focus {
    background: var(--cuhk-champagne-gold);
    color: var(--cuhk-dark-royal-gold);
}

.print-tooltip {
    position: fixed;
    z-index: 10060;
    max-width: min(320px, calc(100vw - 24px));
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    background: var(--cuhk-milky-purple);
    color: var(--cuhk-royal-purple);
    font-size: 0.82rem;
    line-height: 1.45;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.print-tooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 12px;
    height: 12px;
    background: var(--cuhk-milky-purple);
    transform: translateX(-50%) rotate(45deg);
}

.print-tooltip.print-tooltip--below::after {
    top: -6px;
    bottom: auto;
}

@media print {
    .print-tooltip {
        display: none !important;
    }
}

body.ai-print-modal-open {
    overflow: hidden;
}

.ai-print-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.55);
}

.ai-print-modal.open {
    display: flex;
}

.ai-print-dialog {
    width: min(1120px, 100%);
    max-height: 92vh;
    overflow: hidden;
    background: var(--cuhk-white);
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    border: 1px solid var(--cuhk-dewy-purple);
}

.ai-print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem 1.75rem;
    background: var(--cuhk-milky-purple);
    border-bottom: 1px solid var(--cuhk-dewy-purple);
}

.ai-print-header h3 {
    margin: 0 0 0.35rem 0;
    color: var(--cuhk-royal-purple);
    font-size: 1.35rem;
}

.ai-print-header p {
    margin: 0;
    color: var(--cuhk-grey);
}

.ai-print-close {
    border: none;
    background: transparent;
    color: var(--cuhk-royal-purple);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
}

.ai-print-close:hover,
.ai-print-close:focus {
    background: var(--cuhk-dewy-purple);
}

.ai-print-body {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    max-height: calc(92vh - 105px);
    overflow: auto;
}

.ai-print-controls {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ai-print-controls label {
    font-weight: 700;
    color: var(--cuhk-royal-purple);
    margin-top: 0.35rem;
}

.ai-print-controls select,
.ai-print-controls input,
.ai-print-controls textarea {
    width: 100%;
    border: 1px solid var(--cuhk-dewy-purple);
    border-radius: 8px;
    padding: 0.75rem;
    font: inherit;
    color: var(--cuhk-grey);
    background: var(--cuhk-white);
}

.ai-print-controls textarea {
    min-height: 150px;
    resize: vertical;
}

.ai-print-custom-presentation {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ai-print-custom-presentation[hidden] {
    display: none;
}

.ai-print-controls select:focus,
.ai-print-controls input:focus,
.ai-print-controls textarea:focus {
    outline: 3px solid var(--cuhk-champagne-gold);
    border-color: var(--cuhk-royal-purple);
}

.ai-print-primary,
.ai-print-actions button {
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    font-weight: 700;
    cursor: pointer;
}

.ai-print-primary {
    margin-top: 0.75rem;
    background: var(--cuhk-royal-purple);
    color: var(--cuhk-white);
}

.ai-print-primary:hover,
.ai-print-primary:focus {
    background: var(--cuhk-classic-purple);
}

.ai-print-primary:disabled,
.ai-print-actions button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ai-print-preview-panel {
    min-height: 420px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-print-status {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: var(--cuhk-champagne-gold);
    color: var(--cuhk-dark-royal-gold);
    font-weight: 600;
}

.ai-print-status.loading {
    background: var(--cuhk-milky-purple);
    color: var(--cuhk-royal-purple);
}

.ai-print-status.error {
    background: var(--cuhk-haze);
    color: var(--cuhk-dark-royal-purple);
}

.ai-print-preview {
    flex: 1;
    min-height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cuhk-haze);
    border: 1px dashed var(--cuhk-dark-classic-gold);
    border-radius: 12px;
    padding: 1rem;
}

.ai-print-preview img {
    max-width: 100%;
    max-height: 62vh;
    object-fit: contain;
    background: var(--cuhk-white);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.ai-print-preview.editing img {
    opacity: 0.55;
}

.ai-print-placeholder {
    color: var(--cuhk-royal-purple);
    font-weight: 700;
}

.ai-print-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.ai-print-actions button {
    background: var(--cuhk-champagne-gold);
    color: var(--cuhk-dark-royal-gold);
}

.ai-print-actions button:hover:not(:disabled),
.ai-print-actions button:focus:not(:disabled) {
    background: var(--cuhk-classic-gold);
}

.ai-print-disclaimer {
    margin: 0;
    padding: 0.55rem 0.85rem;
    border-left: 3px solid var(--cuhk-champagne-gold);
    background: var(--cuhk-haze);
    border-radius: 0 6px 6px 0;
    font-size: 0.75rem;
    color: var(--cuhk-grey);
    font-style: italic;
    line-height: 1.5;
}

.ai-print-disclaimer i {
    color: var(--cuhk-royal-gold);
    margin-right: 0.35rem;
    font-style: normal;
}

.ai-print-edit-panel {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1rem;
    border: 1px solid var(--cuhk-dewy-purple);
    border-radius: 10px;
    background: var(--cuhk-milky-purple);
}

.ai-print-edit-panel[hidden] {
    display: none;
}

.ai-print-edit-panel label {
    font-weight: 700;
    color: var(--cuhk-royal-purple);
}

.ai-print-edit-panel textarea {
    width: 100%;
    min-height: 95px;
    resize: vertical;
    border: 1px solid var(--cuhk-dewy-purple);
    border-radius: 8px;
    padding: 0.75rem;
    font: inherit;
    color: var(--cuhk-grey);
    background: var(--cuhk-white);
}

.ai-print-edit-panel textarea:focus {
    outline: 3px solid var(--cuhk-champagne-gold);
    border-color: var(--cuhk-royal-purple);
}

.ai-print-output {
    display: none;
}

@media (max-width: 768px) {
    .chinese-override-toggle {
        right: 1.5rem;
        bottom: 6rem;
        width: 50px;
        height: 50px;
    }

    .chinese-override-form,
    .chinese-override-row-text {
        grid-template-columns: 1fr;
    }

    .chinese-override-row {
        align-items: stretch;
        flex-direction: column;
    }

    .chinese-override-delete-btn {
        align-self: flex-start;
    }

    .ai-print-modal {
        padding: 0;
    }

    .ai-print-dialog {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .ai-print-body {
        grid-template-columns: 1fr;
        max-height: calc(100vh - 105px);
    }

    .ai-print-actions {
        flex-direction: column;
    }
}

/* Rankings Section */
#rankings.rankings-section {
    background: #FCFCFC;
}

.rankings-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

.rankings-print {
    display: none;
}

.rankings-featured {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    background: var(--cuhk-royal-gold);
    border: 1px solid var(--cuhk-royal-gold);
    border-radius: 5px;
    color: var(--cuhk-white);
    overflow: hidden;
    padding: 2.25rem;
}

.ranking-feature-card {
    position: relative;
    min-height: 205px;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    text-align: center;
}

.ranking-feature-card.has-divider::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: var(--cuhk-champagne-gold);
}

.ranking-feature-position {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0.125rem;
    font-size: 6rem;
    font-weight: 900;
    line-height: 0.95;
    color: var(--cuhk-white);
}

.ranking-feature-position .ranking-hash {
    font-size: 1.875rem;
    line-height: 1;
    color: var(--cuhk-champagne-gold);
    opacity: 0.72;
    margin-top: 0.1em;
}

.ranking-feature-rule {
    width: 60px;
    height: 3px;
    background: var(--cuhk-champagne-gold);
}

.ranking-feature-title {
    max-width: 24rem;
    font-size: 1.125rem;
    font-weight: var(--font-weight-bold);
    line-height: 1.35;
    color: var(--cuhk-white);
}

.rankings-list,
.ranking-group,
.ranking-group-rows {
    display: flex;
    flex-direction: column;
}

.rankings-list {
    gap: 2.25rem;
}

.ranking-group {
    gap: 1.25rem;
}

.ranking-group-rows {
    gap: 1.5rem;
}

.ranking-group-heading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    min-height: 48px;
    padding: 0.7rem 1.5rem;
    border: 2px solid #764393;
    border-radius: 999px;
    background: transparent;
    color: #764393;
    font-size: 14px;
    font-weight: var(--font-weight-extrabold);
    letter-spacing: 0.16em;
    line-height: 1;
    text-transform: uppercase;
}

.ranking-card {
    background: white;
    padding: 0;
    border-radius: 5px;
    text-align: left;
    border: 1px solid var(--cuhk-stone);
    transition: none;
    position: relative;
    min-height: 149px;
    display: flex;
    align-items: stretch;
    cursor: default;
    overflow: hidden;
}

body:not(.view-mode):not(.static-site-mode) .ranking-card {
    cursor: grab;
}

body:not(.view-mode):not(.static-site-mode) .ranking-card:active {
    cursor: grabbing;
}

.ranking-card.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.ranking-card.drag-over {
    border-color: var(--classic-purple);
    background-color: var(--cuhk-milky-purple);
    transform: scale(1.02);
    border-width: 2px;
}

.drag-handle {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #ccc;
    font-size: 1.2rem;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 4px;
    border-radius: 5px;
}

.achievement-card:hover .drag-handle {
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Prevent drag handle from interfering with other elements */
.ranking-card .delete-ranking-btn,
.achievement-card .delete-achievement-btn {
    z-index: 20;
}

.ranking-card .delete-ranking-btn {
    top: 0.5rem;
    right: 0.5rem;
}

.ranking-card::before {
    display: none;
}

.ranking-logo {
    font-size: var(--font-size-subtext);
    font-weight: var(--font-weight-semibold);
    color: var(--cuhk-classic-purple);
    padding: 0;
    background: none;
    border-radius: 5px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    line-height: var(--line-height-normal);
}

.rankings-featured .ranking-logo,
.rankings-featured .ranking-logo-link {
    color: var(--cuhk-champagne-gold);
}

.rankings-featured .ranking-logo-link {
    cursor: default;
    transition: none;
}

.rankings-featured .ranking-logo-link:hover,
.rankings-featured .ranking-logo-link:focus {
    color: var(--cuhk-champagne-gold);
    opacity: 1;
    text-decoration: underline;
}

.ranking-logo-link {
    color: var(--cuhk-classic-purple);
    text-decoration: none;
    transition: color 0.3s ease, opacity 0.3s ease;
    display: inline-block;
}

.ranking-logo-link:hover {
    color: var(--cuhk-classic-purple);
    opacity: 1;
    text-decoration: underline;
}

.ranking-row-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.5rem 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
}

.ranking-position {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0.125rem;
    font-size: 3.75rem;
    font-weight: 900;
    color: var(--cuhk-classic-purple);
    line-height: 0.95;
}

.ranking-position .ranking-hash {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--cuhk-classic-purple);
}

.ranking-title {
    font-size: 1.25rem;
    color: var(--cuhk-black);
    font-weight: var(--font-weight-extrabold);
    line-height: 1.35;
}

.ranking-title-year {
    white-space: nowrap;
}

.ranking-subtitle {
    font-size: var(--font-size-subtext);
    color: var(--cuhk-black);
    font-weight: var(--font-weight-semibold);
    line-height: 1.5;
}

.rankings-featured .ranking-subtitle {
    color: var(--cuhk-white);
    font-weight: var(--font-weight-semibold);
}

.ranking-scope-badge {
    width: 108px;
    flex: 0 0 108px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    color: var(--cuhk-classic-purple);
    font-size: 0.75rem;
    font-weight: var(--font-weight-regular);
    text-align: center;
}

.ranking-scope-badge i {
    font-size: 1.875rem;
    line-height: 1;
}

.ranking-scope-svg {
    display: block;
    width: 60px;
    height: 60px;
}

.ranking-rank-panel {
    width: 173px;
    flex: 0 0 173px;
    background: var(--cuhk-milky-purple);
    color: var(--cuhk-classic-purple);
    padding: 1.5rem 2.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.ranking-rank-label {
    font-size: var(--font-size-subtext);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.05em;
}

.rankings-grid > .add-ranking-card {
    min-height: 110px;
    height: auto;
    width: 100%;
}

.ranking-note {
    text-align: center;
    color: var(--cuhk-silver);
    font-style: italic;
    font-size: var(--font-size-subtext);
    line-height: var(--line-height-normal);
}

.rankings-source-note {
    margin-top: -0.5rem;
    align-self: stretch;
    width: 100%;
    text-align: left;
    color: #6c7074;
    font-size: 12px;
}

.rankings-source-note p {
    margin: 0;
    text-align: left;
    font-size: 12px;
}

.section-source-note {
    margin-top: 1rem;
    color: #6c7074;
    font-size: var(--font-size-subtext);
    font-style: italic;
    line-height: var(--line-height-normal);
    text-align: left;
}

.section-source-note p {
    margin: 0;
}

.source-note-line {
    white-space: nowrap;
}

.funding-source-note {
    margin-top: 0.5rem;
    font-size: 12px;
}

.funding-source-note p {
    font-size: 12px;
}

.research-output-source-note {
    margin-top: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 12px;
}

.research-output-source-note p {
    font-size: 12px;
}

.student-source-note {
    margin-top: 0.75rem;
}

.labs-source-note {
    margin-top: 1rem;
    font-size: 12px;
}

.labs-source-note p {
    font-size: 12px;
}

.admissions-source-note {
    margin-top: 1.25rem;
    font-size: 12px;
}

.admissions-source-note p {
    font-size: 12px;
}

.programmes-source-note {
    margin-top: -0.75rem;
    margin-bottom: 2rem;
    font-size: 12px;
}

.programmes-source-note p {
    font-size: 12px;
}

.career-source-note {
    margin-top: 0.75rem;
    margin-bottom: 0;
    font-size: 12px;
}

.career-source-note p {
    font-size: 12px;
}

.scholarships-source-note {
    margin-top: 1rem;
    font-size: 12px;
}

.scholarships-source-note p {
    font-size: 12px;
}

.global-source-note {
    margin-top: 1rem;
    font-size: 12px;
}

.global-source-note p {
    font-size: 12px;
}

.museums-source-note {
    margin-top: 0.75rem;
    color: #6c7074;
    font-size: 12px;
}

.museums-source-note p {
    color: #6c7074;
    font-size: 12px;
}

.library-card-notes {
    margin-top: 0.75rem;
}

.library-card-notes .student-as-of,
.library-source-note {
    color: #6c7074;
    font-size: 12px;
    margin-top: 0;
    opacity: 1;
}

.library-card-notes .student-as-of [data-field],
.library-card-notes .student-as-of .as-of-date-chinese,
.library-source-note p {
    color: #6c7074;
    font-size: 12px;
    opacity: 1;
}

.sports-source-note {
    margin-top: 0.75rem;
    color: #6c7074;
    font-size: 12px;
}

.sports-source-note p {
    color: #6c7074;
    font-size: 12px;
}

.staff-card-notes {
    margin-top: 0.75rem;
}

.staff-card-notes .student-as-of,
.staff-source-note {
    color: #6c7074;
    font-size: 12px;
    margin-top: 0;
    opacity: 1;
}

.staff-card-notes .student-as-of [data-field],
.staff-card-notes .student-as-of .as-of-date-chinese,
.staff-source-note p {
    color: #6c7074;
    font-size: 12px;
    opacity: 1;
}

.hostel-card-notes {
    margin-top: 0.75rem;
}

.hostel-card-notes .student-as-of,
.hostel-source-note {
    color: #6c7074;
    font-size: 12px;
    margin-top: 0;
    opacity: 1;
}

.hostel-card-notes .student-as-of [data-field],
.hostel-card-notes .student-as-of .as-of-date-chinese,
.hostel-source-note p {
    color: #6c7074;
    font-size: 12px;
    opacity: 1;
}

.campus-card-notes {
    margin-top: 0.75rem;
}

.campus-card-notes .student-as-of,
.campus-source-note {
    color: #6c7074;
    font-size: 12px;
    margin-top: 0;
    opacity: 1;
}

.campus-card-notes .student-as-of [data-field],
.campus-card-notes .student-as-of .as-of-date-chinese,
.campus-source-note p {
    color: #6c7074;
    font-size: 12px;
    opacity: 1;
}

.student-card-notes {
    margin-top: 0.75rem;
    min-width: 0;
}

.student-card-notes .student-as-of,
.student-card-notes .student-source-note {
    font-size: 12px;
    margin-top: 0;
    margin-bottom: 0.25rem;
}

.student-card-notes .student-as-of [data-field],
.student-card-notes .student-as-of .as-of-date-chinese,
.student-card-notes .source-note-line {
    font-size: 12px;
}

.student-as-of,
#students.students-section .student-as-of,
#students.students-section .student-as-of [data-field],
#students.students-section .student-as-of .as-of-date-chinese {
    color: #6c7074;
    opacity: 1;
}

/* Subject Rankings Accordion */
.subject-rankings-container {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.subject-ranking-accordion {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.subject-ranking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.subject-ranking-header:hover {
    background: var(--cuhk-milky-purple);
}

.subject-ranking-header-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.subject-ranking-title {
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-semibold);
    color: var(--cuhk-royal-purple);
    line-height: var(--line-height-normal);
}

.subject-ranking-title-chinese {
    font-size: var(--font-size-subtext);
    color: var(--cuhk-classic-purple);
    font-weight: var(--font-weight-regular);
}

.subject-ranking-toggle {
    color: var(--cuhk-royal-purple);
    font-size: 1rem;
    transition: transform 0.25s ease;
    flex-shrink: 0;
    margin-left: 1rem;
}

.subject-ranking-accordion.open .subject-ranking-toggle {
    transform: rotate(180deg);
}

.subject-ranking-body {
    display: none;
    padding: 1.5rem 1.75rem;
    border-top: 1px solid #e0e0e0;
    background: #fdfcfa;
}

.subject-ranking-accordion.open .subject-ranking-body {
    display: block;
}

.subject-ranking-items-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.9rem 1.5rem;
}

.subject-ranking-item {
    display: flex;
    align-items: center;
    gap: 0;
    min-height: 2.8rem;
    position: relative;
}

.subject-rank-number {
    font-size: 1.55rem;
    font-weight: var(--font-weight-extrabold);
    color: var(--cuhk-royal-gold);
    line-height: 1;
    white-space: nowrap;
    display: flex;
    align-items: baseline;
    gap: 0.05em;
    flex-shrink: 0;
    min-width: 3.5rem;
}

.subject-rank-hash {
    font-size: 0.6em;
    opacity: 0.75;
    vertical-align: baseline;
}

.subject-rank-divider {
    width: 1px;
    background: #ccc;
    align-self: stretch;
    margin: 0 0.75rem;
    flex-shrink: 0;
}

.subject-rank-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.subject-rank-name {
    font-size: var(--font-size-subtext);
    font-weight: var(--font-weight-semibold);
    color: var(--cuhk-black);
    line-height: var(--line-height-normal);
}

.subject-rank-name-zh {
    font-size: 0.72rem;
    color: var(--cuhk-grey);
    line-height: var(--line-height-normal);
}

/* Subject Rankings Edit Controls */
.delete-subject-group-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.delete-subject-group-btn:hover {
    background: #ff3742;
    transform: scale(1.1);
}

.add-subject-item-btn {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.4rem 1rem;
    background: transparent;
    color: var(--cuhk-royal-purple);
    border: 1px dashed var(--cuhk-royal-purple);
    border-radius: 4px;
    cursor: pointer;
    font-size: var(--font-size-subtext);
    transition: all 0.2s ease;
}

.add-subject-item-btn:hover {
    background: var(--cuhk-milky-purple);
}

.add-subject-group-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    border: 2px dashed #ccc;
    border-radius: 5px;
    cursor: pointer;
    color: #999;
    font-size: var(--font-size-body);
    transition: all 0.2s ease;
}

.add-subject-group-btn:hover {
    border-color: var(--cuhk-royal-purple);
    color: var(--cuhk-royal-purple);
    background: var(--cuhk-milky-purple);
}

/* Achievements Section */
.achievements-section {
    background: #fafafa;
}

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

.achievements-print {
    display: none;
}

.research-print {
    display: none;
}

.students-print {
    display: none;
}

.achievement-card {
    background: white;
    padding: 2rem 1.5rem;
    border-radius: 5px;
    text-align: center;
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    cursor: grab;
    position: relative;
}

.achievement-card:active {
    cursor: grabbing;
}

.achievement-card.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.achievement-card.drag-over {
    border-color: var(--royal-gold);
    background-color: #fffbf0;
    transform: scale(1.02);
    border-width: 2px;
}

.achievement-card .drag-handle {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #ccc;
    font-size: 1.2rem;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 4px;
    border-radius: 2px;
}

.achievement-card .drag-handle:active {
    cursor: grabbing;
}

.achievement-card:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--cuhk-royal-gold);
}

.achievement-number {
    font-size: var(--font-size-key-figures);
    font-weight: var(--font-weight-extrabold);
    color: var(--cuhk-royal-gold);
    margin-bottom: 1rem;
    line-height: var(--line-height-tight);
}

.achievement-title {
    font-size: var(--font-size-body);
    color: var(--cuhk-black);
    margin-bottom: 0.8rem;
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-normal);
}

.achievement-subtitle {
    font-size: var(--font-size-subtext);
    color: var(--cuhk-grey);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
}

/* Research Section */
.research-subsection {
    margin-bottom: 4rem;
}

.subsection-title {
    font-size: var(--font-size-h3);
    color: var(--cuhk-royal-purple);
    margin-top: 1rem;
    margin-bottom: 1rem;
    text-align: left;
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
}

.subsection-title .chinese {
    margin-left: 0.35em;
}

.research-output-title,
.research-output-title .chinese,
.research-output-title [data-field] {
    color: var(--cuhk-classic-purple);
}

.research-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 0;
}

.total-output-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
    gap: 1.5rem;
}

.total-output {
    text-align: center;
    min-height: 210px;
    padding: 2rem;
    background: var(--cuhk-white);
    border-radius: 5px;
    border: 1px solid var(--cuhk-classic-purple);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.big-number {
    font-size: var(--font-size-key-figures);
    font-weight: var(--font-weight-extrabold);
    color: var(--cuhk-royal-gold);
    margin-bottom: 1rem;
    line-height: var(--line-height-tight);
}

.big-label {
    font-size: var(--font-size-labels);
    color: var(--cuhk-black);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0.5rem;
    line-height: var(--line-height-normal);
}

.big-sublabel {
    font-size: var(--font-size-subtext);
    color: var(--cuhk-grey);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
}

/* Patents Granted Highlight */
.patents-highlight {
    min-height: 210px;
    padding: 2rem;
    background: var(--gradient-gold-diagonal);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1rem;
    box-shadow: 0 4px 12px rgba(246, 141, 46, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.patents-highlight:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(246, 141, 46, 0.3);
}

.patents-icon {
    font-size: 2.5rem;
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

.patents-number {
    font-size: 3.5rem;
    font-weight: var(--font-weight-bold);
    color: white;
    line-height: 1;
}

.patents-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: center;
    width: 100%;
}

.patents-label-en {
    font-size: 1.1rem;
    font-weight: var(--font-weight-semibold);
    color: white;
    line-height: 1.3;
}

.patents-label-zh {
    font-size: 0.95rem;
    font-weight: var(--font-weight-regular);
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.3;
}

.output-breakdown {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

.output-item {
    position: relative;
    background: var(--cuhk-white);
    min-height: 210px;
    padding: 1.75rem 1.25rem;
    border-radius: 5px;
    text-align: center;
    border: 1px solid rgba(118, 67, 147, 0.28);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.output-number {
    font-size: var(--font-size-h2);
    font-weight: var(--font-weight-bold);
    color: var(--cuhk-royal-purple);
    margin-bottom: 1rem;
    line-height: var(--line-height-tight);
}

.output-label {
    font-size: var(--font-size-labels);
    color: var(--cuhk-black);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0.5rem;
    line-height: var(--line-height-normal);
}

.output-sublabel {
    font-size: var(--font-size-subtext);
    color: var(--cuhk-grey);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
}

/* Funding Section */
.funding-overview {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.funding-total-section {
    display: flex;
    gap: 2rem;
    align-items: stretch;
}

.funding-total {
    flex: 1;
    text-align: center;
    padding: 1.75rem 2rem;
    background: var(--gradient-gold-diagonal);
    border-radius: 7px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.funding-total-label {
    font-size: 1rem;
    margin-bottom: 0.65rem;
    opacity: 0.95;
    font-weight: 500;
}

.funding-total-amount {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
}

.funding-total-amount .currency {
    font-size: 1.45rem;
    font-weight: 600;
}

.funding-total-amount .amount {
    font-size: 3.2rem;
    font-weight: var(--font-weight-bold);
    line-height: 1;
}

.funding-total-amount .amount[contenteditable="true"]:focus {
    background: rgba(255, 255, 255, 0.95);
    color: var(--cuhk-royal-gold);
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    outline: 3px solid var(--cuhk-white);
    outline-offset: 2px;
}

.funding-total-amount .unit {
    font-size: 1.3rem;
    font-weight: 500;
}

.funding-rgc-highlight {
    flex: 1;
    background: linear-gradient(180deg, #FFFFFF 0%, #FBF8FD 100%);
    border: 2px solid var(--cuhk-classic-purple);
    border-radius: 7px;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 1.25rem;
    text-align: left;
}

.rgc-label-group {
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(118, 67, 147, 0.18);
}

.rgc-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.rgc-metric {
    min-height: auto;
    padding: 0.95rem 1rem;
    background: rgba(118, 67, 147, 0.06);
    border: 1px solid rgba(118, 67, 147, 0.16);
    border-radius: 7px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.rgc-metric-amount {
    align-items: flex-start;
    text-align: left;
}

.rgc-metric-share {
    flex-direction: row;
    justify-content: space-between;
    gap: 1rem;
}

.rgc-amount {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.3rem;
    color: var(--cuhk-classic-purple);
    margin-bottom: 0.35rem;
}

.rgc-metric-amount .rgc-amount {
    justify-content: flex-start;
}

.rgc-amount .currency {
    font-size: 1.35rem;
    font-weight: 600;
}

.rgc-amount .amount {
    font-size: 2.8rem;
    font-weight: var(--font-weight-bold);
    line-height: 1;
}

.rgc-amount .unit {
    font-size: 1.1rem;
    font-weight: 500;
}

.rgc-percentage {
    font-size: 2.45rem;
    font-weight: 600;
    color: var(--cuhk-classic-purple);
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rgc-share-label {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: #666;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.15;
    text-align: right;
}

.rgc-metric-caption {
    color: #666;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.15;
    text-align: left;
}

.rgc-label {
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--cuhk-classic-purple);
    line-height: 1.35;
    margin-bottom: 0.35rem;
    white-space: nowrap;
}

.rgc-label-break {
    display: none;
}

.rgc-label-chinese {
    font-size: 0.82rem;
    color: #666;
    line-height: 1.35;
    white-space: nowrap;
}

.currency {
    font-size: 1.5rem;
    font-weight: 600;
}

.amount {
    font-size: 3.5rem;
    font-weight: var(--font-weight-bold);
    display: block;
    margin: 0.5rem 0;
}

.unit {
    font-size: 1.2rem;
    font-weight: 500;
}

.funding-subtitle {
    margin-top: 1rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.funding-content {
    background: white;
    border-radius: 7px;
    padding: 3rem;
    border: 1px solid var(--dewy-purple);
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(380px, 1.1fr);
    gap: 2.5rem;
    align-items: center;
}

.funding-chart {
    width: 100%;
    min-height: clamp(340px, 34vw, 500px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.funding-legend {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
    align-content: center;
}

.funding-legend-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.funding-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 5px;
    flex-shrink: 0;
}

.funding-legend-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.funding-legend-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--dark-purple);
}

.funding-legend-chinese {
    font-size: 0.8rem;
    color: #666;
    font-weight: 400;
}

.funding-legend-value {
    margin-left: auto;
    font-weight: 600;
    color: var(--dynamic-purple);
    font-size: 0.9rem;
    text-align: right;
}

/* Funding Footnotes (web) */
.funding-footnotes-web {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--dewy-purple);
}

.funding-fn-col {
    flex: 1;
    min-width: 0;
}

.funding-fn-line {
    font-size: 0.78rem;
    color: #6D6E71;
    line-height: 1.5;
    margin: 0 0 0.35rem 0;
}

.funding-fn-marker {
    font-size: 0.72rem;
    vertical-align: super;
    margin-right: 0.15rem;
    color: var(--cuhk-classic-purple);
    font-weight: 600;
}

@media (max-width: 768px) {
    .funding-footnotes-web {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Labs Grid */
.labs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

#labs.labs-section .section-title .chinese,
#labs.labs-section .subsection-title,
#labs.labs-section .subsection-title .chinese,
#labs.labs-section .innohk-category-title,
#labs.labs-section .innohk-category-title span {
    color: var(--cuhk-classic-purple);
}

.lab-card {
    background: white;
    padding: 1.5rem;
    border-radius: 6px;
    border: 1px solid var(--cuhk-classic-purple);
    transition: none;
    position: relative;
}

.lab-card:hover {
    transform: none;
    box-shadow: none;
}

.lab-card .delete-lab-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lab-card:hover .delete-lab-btn {
    opacity: 1;
}

.lab-card .delete-lab-btn:hover {
    background: #ff3742;
    transform: scale(1.1);
}

.add-lab-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: default;
    border: 2px dashed var(--cuhk-classic-purple);
    background: rgba(118, 67, 147, 0.02);
    min-height: 120px;
}

.add-lab-card:hover {
    border-color: var(--cuhk-classic-purple);
    background: rgba(118, 67, 147, 0.02);
}

.add-icon {
    font-size: 2rem;
    color: var(--cuhk-classic-purple);
    margin-bottom: 0.5rem;
}

.add-text {
    color: var(--cuhk-classic-purple);
    font-weight: 500;
}

.innohk-category-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: start;
}

.innohk-category-card {
    background: white;
    border: 1px solid var(--cuhk-royal-gold);
    border-radius: 6px;
    padding: 1.25rem 1.5rem;
}

.innohk-category-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    color: var(--cuhk-classic-purple);
    font-size: 1.1rem;
}

.innohk-category-title-chinese {
    color: var(--cuhk-light-royal-gold);
    font-size: 0.9rem;
    font-weight: 500;
}

.innohk-category-items {
    display: flex;
    flex-direction: column;
}

.innohk-category-card .lab-card {
    border: none;
    border-top: 1px solid var(--cuhk-classic-purple);
    border-radius: 0;
    padding: 1rem 0 1rem 1rem;
    box-shadow: none;
}

.innohk-category-card .lab-card:first-child {
    border-top: none;
}

.innohk-category-card .innohk-category-add-card {
    border: 2px dashed var(--cuhk-classic-purple);
    border-radius: 6px;
    margin-top: 0.75rem;
    padding: 1rem;
    min-height: 86px;
    background: rgba(118, 67, 147, 0.02);
}

.innohk-category-card .innohk-category-add-card:first-child {
    border-top: 2px dashed var(--cuhk-classic-purple);
}

.innohk-category-card .innohk-category-add-card:hover {
    border-color: var(--cuhk-classic-purple);
    background: rgba(118, 67, 147, 0.05);
}

.innohk-category-card .lab-card:hover {
    transform: none;
    box-shadow: none;
}

.innohk-category-card .lab-title {
    position: relative;
}

.innohk-category-card .lab-title::before {
    content: "•";
    position: absolute;
    left: -1rem;
    color: var(--cuhk-royal-gold);
}

/* Achievements Overview Section */
.achievements-overview {
    margin-top: 2rem;
}

.achievement-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.achievement-category {
    background: white;
    padding: 2rem;
    border-radius: 6px;
    border: 1px solid var(--dewy-purple);
    transition: all 0.3s ease;
    position: relative;
    cursor: move;
}

.achievement-category:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(94, 54, 118, 0.15);
}

.achievement-category .drag-handle {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #ccc;
    cursor: move;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.achievement-category:hover .drag-handle {
    opacity: 1;
}

.achievement-category .delete-achievement-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.achievement-category:hover .delete-achievement-btn {
    opacity: 1;
}

.achievement-category .delete-achievement-btn:hover {
    background: #ff3742;
    transform: scale(1.1);
}

.achievement-icon {
    text-align: center;
    margin-bottom: 1.5rem;
}

.icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.achievement-category h4 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    text-align: center;
    line-height: 1.3;
}

.achievement-category h4.chinese-subtitle {
    font-size: 1.1rem;
    font-weight: 500;
    color: #666;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

.achievement-details {
    text-align: left;
}

.achievement-period {
    font-size: 1rem;
    color: #666;
    font-weight: 500;
    text-decoration: underline;
    margin-bottom: 1rem;
    text-align: center;
}

.achievement-item {
    font-size: 0.95rem;
    color: #444;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    padding-left: 0.5rem;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.achievement-item:hover {
    border-left-color: var(--royal-purple);
    padding-left: 1rem;
}

.add-achievement-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px dashed var(--dewy-purple);
    background: rgba(94, 54, 118, 0.02);
    min-height: 280px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.add-achievement-card:hover {
    border-color: var(--royal-purple);
    background: rgba(94, 54, 118, 0.05);
}

.add-achievement-card .add-icon {
    font-size: 3rem;
    color: var(--dewy-purple);
    margin-bottom: 1rem;
}

.add-achievement-card .add-text {
    color: var(--classic-purple);
    font-weight: 500;
}

.achievement-category.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.achievement-category.drag-over {
    border-color: var(--classic-purple);
    background-color: #f8f6ff;
    transform: scale(1.02);
    border-width: 2px;
}

.lab-title[contenteditable="true"]:focus,
.lab-subtitle[contenteditable="true"]:focus {
    outline: 2px solid var(--cuhk-classic-purple);
    outline-offset: 2px;
    background: rgba(118, 67, 147, 0.05);
    border-radius: 5px;
    padding: 2px 4px;
}

.lab-number {
    width: 40px;
    height: 40px;
    background: var(--cuhk-classic-purple);
    color: var(--cuhk-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-bold);
    margin-bottom: 1rem;
    font-size: var(--font-size-labels);
}

.lab-title {
    font-size: var(--font-size-labels);
    color: var(--cuhk-classic-purple);
    margin-bottom: 0.5rem;
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-normal);
}

.lab-subtitle {
    font-size: var(--font-size-labels);
    color: var(--cuhk-grey);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
}

/* Students Section */
#students.students-section {
    background: #FCFCFC;
}

#students.students-section .section-title .chinese,
#students.students-section .subsection-title,
#students.students-section .subsection-title .chinese,
#students.students-section .subsection-title [data-field],
#students.students-section .student-category h3,
#students.students-section .student-count,
#students.students-section .total-count,
#students.students-section .total-label,
#students.students-section .jupas-label,
#students.students-section .career-legend-field {
    color: var(--cuhk-classic-purple);
}

#students.students-section .student-as-of,
#students.students-section .student-as-of [data-field],
#students.students-section .student-as-of .as-of-date-chinese {
    color: #6c7074;
    opacity: 1;
}

#students.students-section .jupas-item,
#students.students-section .career-content {
    border-color: var(--cuhk-classic-purple);
}

.student-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
    margin-bottom: 4rem;
}

.student-category {
    min-width: 0;
}

.student-category h3 {
    text-align: left;
    margin-bottom: 0.9rem;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--classic-purple);
}

.student-as-of {
    font-size: 14px;
    opacity: 0.6;
    font-style: italic;
    margin-bottom: 1.5rem;
    color: var(--classic-purple);
}

.student-population-note {
    margin-top: -2rem;
    margin-bottom: 2.5rem;
}

.student-population-note p {
    font-size: 0.78rem;
    color: #6D6E71;
    line-height: 1.5;
    margin: 0 0 0.2rem 0;
}

.student-numbers {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    background: white;
    padding: 1.25rem;
    border-radius: 5px;
    border: 1px solid var(--cuhk-classic-purple);
    align-items: stretch;
}

.student-group {
    text-align: center;
    padding: 1rem;
}

.student-group,
.student-total {
    min-height: 8rem;
    padding: 1rem 0.5rem;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.student-count {
    font-size: 2.2rem;
    font-weight: 300;
    color: var(--cuhk-classic-purple);
    margin-bottom: 0.65rem;
    line-height: 1;
}

.student-type {
    font-size: 0.9rem;
    color: #666;
    font-weight: 400;
}

.student-total {
    text-align: center;
    background: rgba(118, 67, 147, 0.06);
    border: 1px solid rgba(118, 67, 147, 0.18);
}

.total-count {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--classic-purple);
    line-height: 1;
}

.total-label {
    font-size: 0.9rem;
    color: var(--cuhk-classic-purple);
    font-weight: 500;
}

/* JUPAS Section */
.jupas-section {
    margin-bottom: 4rem;
}

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

.jupas-item {
    background: white;
    padding: 2rem;
    border-radius: 7px;
    text-align: center;
    border: 1px solid var(--dewy-purple);
    position: relative;
}

.jupas-number {
    font-size: 2.5rem;
    font-weight: var(--font-weight-bold);
    color: var(--royal-gold);
    margin-bottom: 1rem;
}

.jupas-label {
    font-size: 1rem;
    color: var(--classic-purple);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.jupas-sublabel {
    font-size: 0.85rem;
    color: var(--mauve);
}

.jupas-note {
    position: absolute;
    top: 10px;
    right: 15px;
    background: var(--cuhk-dynamic-gold);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 7px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Career Chart */
.career-content {
    background: white;
    border-radius: 7px;
    padding: 3rem;
    border: 1px solid var(--dewy-purple);
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(380px, 1.1fr);
    gap: 2.5rem;
    align-items: center;
}

.career-chart {
    width: 100%;
    min-height: clamp(340px, 34vw, 500px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.career-legend {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
    align-content: center;
}

.career-legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.career-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 5px;
    flex-shrink: 0;
}

.career-legend-text {
    flex: 1;
}

.career-legend-field {
    font-weight: 500;
    color: #2F3133;
    font-size: 0.9rem;
    line-height: 1.3;
}

.career-legend-chinese {
    font-size: 0.8rem;
    color: #666666;
    font-weight: 400;
    font-style: normal;
    line-height: 1.3;
}

.career-legend-percentage {
    font-weight: bold;
    color: var(--royal-gold);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .career-content {
        grid-template-columns: 1fr;
    }

    .career-chart {
        min-height: 400px;
    }

    .career-legend {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .career-legend-item {
        gap: 0.8rem;
        padding: 0.5rem;
        border-bottom: none;
        border-radius: 5px;
    }

    .career-legend-text {
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
    }

    .career-legend-field {
        font-weight: 500;
        font-size: 0.9rem;
        color: #2F3133;
        line-height: 1.3;
    }

    .career-legend-chinese {
        font-size: 0.8rem;
        color: #666666;
        font-weight: 400;
        font-style: normal;
    }

    .career-legend-percentage {
        margin-left: auto;
        text-align: right;
        font-weight: 600;
        color: var(--dynamic-purple);
        font-size: 0.9rem;
    }

    /* Fix Funding Legend Alignment */
    .funding-legend {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
        width: 100%;
        justify-items: stretch;
    }

    /* Fix Chinese Text Wrapping */
    .subsection-title .chinese {
        display: block;
        margin-top: 0.2rem;
        margin-left: 0;
    }

    .section-header {
        flex-wrap: wrap;
    }

    .section-last-updated {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
        margin-top: 0.5rem;
        font-size: 0.8rem;
    }

    .section-last-updated-text {
        align-items: flex-start;
    }
}

/* Global Section */
#global.global-section {
    background: #FCFCFC;
}

#global.global-section .student-as-of,
#global.global-section .student-as-of [data-field],
#global.global-section .student-as-of .as-of-date-chinese {
    color: #6C7074;
    opacity: 1;
}

.global-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 0;
}

.global-stat {
    background: white;
    padding: 2rem;
    border-radius: 7px;
    text-align: center;
    border: 1px solid var(--dewy-purple);
    transition: all 0.3s ease;
}

.global-stat:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(118, 67, 147, 0.15);
}

.global-number {
    font-size: 2rem;
    font-weight: var(--font-weight-bold);
    color: var(--classic-purple);
    margin-bottom: 1rem;
}

.global-label {
    font-size: 1rem;
    color: var(--mauve);
}

/* Exchange Section */
.exchange-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.exchange-item {
    background: white;
    padding: 1.5rem;
    border-radius: 6px;
    text-align: center;
    border: 1px solid var(--dewy-purple);
}

.exchange-number {
    font-size: 2rem;
    font-weight: var(--font-weight-bold);
    color: var(--royal-purple);
    margin-bottom: 0.5rem;
}

.exchange-label {
    font-size: 0.9rem;
    color: var(--mauve);
}

/* Global Map */
.global-map {
    margin-top: 3rem;
}

.map-title {
    font-size: 1.5rem;
    color: #764393;
    margin-bottom: 1.5rem;
    text-align: left;
    font-weight: 600;
}

.alumni-map-container {
    height: 500px;
    width: 100%;
    border-radius: 7px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--dewy-purple);
}

.map-legend {
    display: flex;
    justify-content: flex-start;
    gap: 2rem;
    margin-top: 1.6rem;
    padding: 0;
    background: transparent;
    border-radius: 0;
    backdrop-filter: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: #2F3133;
}

.map-legend .legend-item {
    font-size: 1.18rem;
    font-weight: 700;
}

.legend-marker {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.alumni-marker {
    background: var(--royal-purple);
}

/* Alumni Cities Web List */
.alumni-cities-web {
    margin-top: 1.5rem;
    display: grid;
    grid-template-rows: repeat(6, auto);
    grid-auto-flow: column;
    grid-auto-columns: minmax(120px, 1fr);
    gap: 0;
}

@media (max-width: 768px) {
    .alumni-cities-web {
        grid-template-rows: none;
        grid-auto-flow: row;
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.25rem 0;
    }
}

.city-item-web {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.35rem 0.85rem;
    background: transparent;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    text-align: left;
    appearance: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.city-item-web:hover,
.city-item-web:focus-visible,
.city-item-web.is-active {
    background: rgba(118, 67, 147, 0.08);
    outline: none;
}

.city-name-web {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--classic-purple);
    line-height: 1.3;
}

.city-chinese-web {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--mauve);
    line-height: 1.3;
}

.city-item-web.is-active .city-name-web {
    color: #764393;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.city-item-web.is-active .city-chinese-web {
    color: #6c7074;
}

/* Leaflet popup customization */
.leaflet-control-zoom a,
.leaflet-control-zoom a span {
    color: var(--cuhk-black) !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 8px 12px;
    font-family: 'Inter', sans-serif;
}

.popup-title {
    font-weight: 600;
    color: var(--royal-purple);
    font-size: 14px;
    margin-bottom: 4px;
}

.popup-description {
    font-size: 12px;
    color: var(--mauve);
    line-height: 1.4;
}

/* Facilities Section */
.facilities-section {
    background: #FCFCFC;
}

#facilities.facilities-section {
    --classic-purple: #764393;
    --cuhk-classic-purple: #764393;
    --royal-purple: #764393;
    --cuhk-royal-purple: #764393;
    --dynamic-purple: #764393;
    --cuhk-dynamic-purple: #764393;
}

.facilities-subsection {
    margin-bottom: 4rem;
}

/* Colleges Timeline */
.colleges-timeline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

.college-item {
    background: white;
    padding: 1.5rem;
    border-radius: 6px;
    border: 1px solid var(--dewy-purple);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.college-emblem {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 1rem;
    border-radius: 5px;
    background: white;
    padding: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.college-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(118, 67, 147, 0.15);
}

.college-item.special {
    background: var(--gradient-purple-diagonal);
    color: white;
}



.college-year {
    font-size: 1.5rem;
    font-weight: var(--font-weight-bold);
    color: var(--royal-gold);
    margin-bottom: 0.5rem;
}

.college-item.special .college-year {
    color: var(--champagne-gold);
}

.college-name {
    font-size: 1rem;
    color: var(--classic-purple);
    font-weight: 600;
}

.college-item.special .college-name {
    color: white;
}

.colleges-total {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 7px;
    border: 2px solid var(--classic-purple);
}

.total-number {
    font-size: 4rem;
    font-weight: var(--font-weight-bold);
    color: var(--classic-purple);
    display: block;
    margin-bottom: 0.5rem;
}

.total-label {
    font-size: 1.2rem;
    color: var(--royal-purple);
    font-weight: 600;
}

/* Faculties Grid */
.faculties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.faculty-item {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 5px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.faculty-icon {
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
}

.faculty-icon svg {
    width: 3.5rem;
    height: 3.5rem;
    display: block;
}

.faculty-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.faculty-name-chinese {
    font-size: 14px;
    color: #666;
    font-style: italic;
}

/* Museums & Galleries / Cultural Facilities */
.museums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 2rem;
}

.museum-item {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 5px;
    padding: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    position: relative;
}

.museum-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(118, 67, 147, 0.15);
}

.museum-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--classic-purple);
    margin-bottom: 4px;
    line-height: 1.3;
}

.museum-name-chinese {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 10px;
}

.museum-description {
    font-size: 0.875rem;
    color: #555;
    line-height: 1.5;
    margin-top: auto;
}

.museum-description-chinese {
    font-size: 0.8rem;
    color: #777;
    line-height: 1.5;
    margin-top: 0.25rem;
}

/* Hostels */
.hostels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.hostel-category {
    background: white;
    padding: 1.5rem 1rem;
    border-radius: 5px;
    text-align: center;
    border: 1px solid #e0e0e0;
    position: relative;
    overflow: hidden;
}

/* Orange accent line at the top */
.hostel-category::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #DFD0AA;
    border-radius: 5px 5px 0 0;
}

.hostel-count {
    font-size: 2.2rem;
    font-weight: var(--font-weight-bold);
    color: #F0AA23;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.hostel-category h4 {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    line-height: 1.3;
    margin: 0 0 0.5rem 0;
}

.hostel-places {
    font-size: 2.2rem;
    font-weight: var(--font-weight-bold);
    color: #ff9500;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.hostel-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    line-height: 1.3;
}

/* Campus Facts Cards */
.campus-facts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1rem;
}

.campus-fact-card {
    background: #f8f5fc;
    border: 1px solid #e0d4ec;
    border-radius: 8px;
    padding: 2rem 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.campus-fact-icon {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.campus-fact-icon svg {
    width: 100%;
    height: 100%;
}

.campus-fact-heading {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.campus-fact-number {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #7d2882;
    font-weight: var(--font-weight-bold);
    line-height: 1;
    flex-wrap: wrap;
    justify-content: center;
}

.campus-fact-prefix {
    font-size: 1.2rem;
    color: #555;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.campus-fact-value {
    font-size: 3.2rem;
    font-weight: var(--font-weight-bold);
    color: #7d2882;
}

.campus-fact-unit {
    font-size: 1.2rem;
    color: #555;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.campus-fact-desc {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

@media (max-width: 600px) {
    .campus-facts-grid {
        grid-template-columns: 1fr;
    }

    .campus-fact-value {
        font-size: 2.5rem;
    }
}

/* Total section styling to match original design */
.hostel-total {
    background: #DFD0AA;
    color: white;
    padding: 2rem;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.hostel-total h4 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    flex: 1;
}

.hostel-total .total-count {
    font-size: 3rem;
    font-weight: var(--font-weight-bold);
    margin: 0;
    text-align: right;
    min-width: fit-content;
}

/* Mobile responsive for hostels */
@media (max-width: 768px) {
    .hostels-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.8rem;
    }

    .hostel-category {
        padding: 1rem 0.8rem;
    }

    .hostel-places {
        font-size: 1.8rem;
    }

    .hostel-label {
        font-size: 0.8rem;
    }

    .hostel-total {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .hostel-total h4 {
        text-align: center;
    }

    .hostel-total .total-count {
        text-align: center;
        font-size: 2.5rem;
    }
}

/* Libraries Section */
.libraries-subsection {
    --library-card-radius: 6px;
}

.libraries-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.libraries-header .subsection-title {
    margin-bottom: 0.5rem;
}

.library-list {
    position: relative;
    margin-bottom: 2rem;
}

.library-names {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    background: transparent;
    padding: 0;
    position: relative;
}

.library-item {
    background: white;
    min-height: 228px;
    padding: 1.4rem 1rem 1.25rem;
    border-radius: var(--library-card-radius);
    box-shadow: 0 1px 5px rgba(71, 40, 88, 0.16);
    transition: all 0.3s ease;
    position: relative;
    z-index: 3;
    border: 1px solid rgba(213, 197, 222, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.library-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 22px rgba(71, 40, 88, 0.16);
}

.library-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100%;
}

.library-seal {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 112px;
    margin-bottom: 0.85rem;
}

.lib-logo-img {
    width: 116px;
    height: 116px;
    object-fit: contain;
    filter: none;
}

.lib-logo-placeholder {
    width: 116px;
    height: 116px;
    border-radius: 50%;
    border: 2px solid var(--cuhk-dewy-purple);
    background: var(--cuhk-milky-purple);
}

.library-item-text {
    flex: 0 1 auto;
    line-height: 1.25;
}

.library-name-en,
.library-item-text span:first-child {
    display: block;
    color: var(--cuhk-royal-purple);
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    margin: 0;
}

.library-name-zh,
.library-item-text span:last-child {
    display: block;
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: var(--font-weight-medium);
    margin-top: 0.4rem;
}

/* Library logo positioning */
.library-logo {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    margin-left: auto;
    color: var(--cuhk-royal-purple);
    white-space: nowrap;
}

.library-logo .library-number {
    color: var(--cuhk-dynamic-purple);
    font-size: 2.05rem;
    font-weight: var(--font-weight-bold);
    line-height: 1;
    margin: 0;
}

.library-logo .library-label {
    color: var(--cuhk-royal-purple);
    font-size: 0.78rem;
    font-weight: var(--font-weight-bold);
}

.libraries-subsection .add-library-item {
    border: 1.5px dashed var(--cuhk-royal-purple);
    border-radius: var(--library-card-radius);
    box-shadow: none;
    background: rgba(241, 236, 244, 0.45);
    color: var(--cuhk-royal-purple);
    cursor: pointer;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
    padding: 1.4rem 1rem 1.25rem;
}

.libraries-subsection .add-library-item:hover {
    background: rgba(241, 236, 244, 0.72);
    border-color: var(--cuhk-dynamic-purple);
    transform: translateY(-4px);
}

.libraries-subsection .add-library-item .add-icon {
    color: var(--cuhk-dynamic-purple);
    font-size: 2.6rem;
    font-weight: var(--font-weight-bold);
    line-height: 1;
    margin: 0;
}

.libraries-subsection .add-library-item .add-text {
    color: var(--cuhk-royal-purple);
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    margin: 0;
}

@media (max-width: 1024px) {
    .library-names {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .libraries-header {
        align-items: flex-start;
        gap: 1rem;
    }

    .library-logo {
        align-items: center;
        flex-wrap: wrap;
        justify-content: flex-end;
        row-gap: 0.2rem;
    }

    .library-logo .library-number {
        font-size: 1.7rem;
    }

    .library-logo .library-label {
        font-size: 0.72rem;
    }

    .library-names {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.85rem;
    }

    .library-item {
        min-height: 190px;
        padding: 1rem 0.8rem;
    }

    .library-seal {
        min-height: 92px;
        margin-bottom: 0.7rem;
    }

    .lib-logo-img,
    .lib-logo-placeholder {
        width: 92px;
        height: 92px;
    }

    .library-name-en,
    .library-item-text span:first-child {
        font-size: 0.92rem;
    }

    .library-name-zh,
    .library-item-text span:last-child {
        font-size: 0.86rem;
    }
}

@media (max-width: 480px) {
    .libraries-header {
        flex-direction: column;
        gap: 0.35rem;
    }

    .library-logo {
        margin-left: 0;
        justify-content: flex-start;
    }

    .library-names {
        grid-template-columns: 1fr;
    }

    .library-item {
        min-height: 205px;
    }
}

/* Staff Section */
.staff-overview {
    margin-bottom: 2rem;
    text-align: center;
}

.staff-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    background: var(--gradient-bloom-diagonal);
    border-radius: 7px;
    color: var(--cuhk-classic-purple);
    position: relative;
    overflow: hidden;
}

.staff-icon {
    font-size: 3rem;
    color: var(--royal-purple);
    margin-bottom: 1rem;
}

.staff-total-number {
    font-size: 4rem;
    font-weight: var(--font-weight-bold);
    color: var(--royal-purple);
    line-height: 1;
}

.staff-total-label {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dynamic-purple)
}

.staff-note {
    font-size: 0.9rem;
    opacity: 0.8;
    font-style: italic;
    color: var(--marble)
}

.staff-categories {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 1rem;
    margin-top: 3rem;
    align-items: start;
}

/* Teaching card spans 3 rows on the left */
.staff-category:first-child {
    grid-row: 1 / 4;
    grid-column: 1;
}

/* Other cards fill the remaining 2x3 grid */
.staff-category:nth-child(2) {
    grid-row: 1;
    grid-column: 2;
}

.staff-category:nth-child(3) {
    grid-row: 1;
    grid-column: 3;
}

.staff-category:nth-child(4) {
    grid-row: 2;
    grid-column: 2;
}

.staff-category:nth-child(5) {
    grid-row: 2;
    grid-column: 3;
}

.staff-category:nth-child(6) {
    grid-row: 3;
    grid-column: 2;
}

.staff-category:nth-child(7) {
    grid-row: 3;
    grid-column: 3;
}

@media (max-width: 1024px) {
    .staff-categories {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }

    .staff-category:first-child {
        grid-row: auto;
        grid-column: auto;
    }

    .staff-category:nth-child(n) {
        grid-row: auto;
        grid-column: auto;
    }
}

@media (max-width: 768px) {
    .staff-categories {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .staff-category:first-child {
        grid-row: auto;
        grid-column: auto;
    }

    .staff-category:nth-child(n) {
        grid-row: auto;
        grid-column: auto;
    }
}

.staff-category {
    background: white;
    border-radius: 5px;
    padding: 1.2rem;
    border: 2px solid var(--dewy-purple);
    transition: all 0.3s ease;
    position: relative;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Teaching card needs more padding for breakdown items */
.staff-category:first-child {
    padding: 1.5rem;
    justify-content: flex-start;
}

.staff-category::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--royal-gold);
    border-radius: 6px 6px 0 0;
}

.staff-category:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--royal-gold);
}

.staff-category-title {
    font-size: 1.1rem;
    font-weight: var(--font-weight-bold);
    color: var(--royal-purple);
    margin-bottom: 0.5rem;
    text-align: center;
    flex-shrink: 0;
}

.staff-category-total {
    font-size: 2rem;
    font-weight: var(--font-weight-bold);
    color: var(--royal-gold);
    text-align: center;
    margin-bottom: 0.5rem;
    line-height: 1;
    flex-shrink: 0;
}

/* Larger styling for the teaching card */
.staff-category:first-child .staff-category-title {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
}

.staff-category:first-child .staff-category-total {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.staff-breakdown,
.staff-additional {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
}

.staff-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background: var(--milky-purple);
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

.staff-item:hover {
    background: var(--champagne-gold);
}

.staff-count {
    font-size: 1.1rem;
    font-weight: var(--font-weight-bold);
    color: var(--royal-purple);
    min-width: 60px;
}

.staff-label {
    font-size: 0.95rem;
    color: var(--mauve);
    text-align: left;
    flex: 1;
    margin-left: 1rem;
}

/* Mobile responsive for staff section */
@media (max-width: 768px) {
    .staff-total-number {
        font-size: 3rem;
    }

    .staff-category-total {
        font-size: 2rem;
    }

    .staff-item {
        padding: 0.6rem;
    }

    .staff-count {
        font-size: 1rem;
        min-width: 50px;
    }

    .staff-label {
        font-size: 0.9rem;
        margin-left: 0.5rem;
    }
}

/* Library Stats */
.library-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.library-stat {
    background: white;
    padding: 1.5rem;
    border-radius: 5px;
    text-align: center;
    border: 1px solid var(--dewy-purple);
    transition: all 0.3s ease;
}

.library-stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(118, 67, 147, 0.1);
}

.library-number {
    font-size: 2rem;
    font-weight: var(--font-weight-bold);
    color: var(--classic-purple);
    margin-bottom: 0.5rem;
}

.library-label {
    font-size: 0.9rem;
    color: var(--mauve);
}

/* Sports Grid */
.sports-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.2rem;
}

.sport-item {
    background: white;
    padding: 1.2rem;
    border-radius: 5px;
    text-align: center;
    border: 1px solid var(--dewy-purple);
    transition: all 0.3s ease;
}

.sport-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(118, 67, 147, 0.1);
}

.sport-icon {
    font-size: 2.5rem;
    color: var(--royal-purple);
    margin-bottom: 1rem;
    display: block;
}

.sport-icon svg {
    height: 3.5rem;
    width: auto;
    display: inline-block;
    vertical-align: middle;
}

.sport-count {
    font-size: 1.8rem;
    font-weight: var(--font-weight-bold);
    color: var(--royal-gold);
    margin-bottom: 0.5rem;
}

.sport-label {
    font-size: 0.9rem;
    color: var(--mauve);
}

@media (max-width: 1024px) {
    .sports-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

#facilities.facilities-section .section-title,
#facilities.facilities-section .section-title .chinese,
#facilities.facilities-section .subsection-title,
#facilities.facilities-section .subsection-title .chinese,
#facilities.facilities-section .college-name,
#facilities.facilities-section .colleges-total,
#facilities.facilities-section .total-number,
#facilities.facilities-section .total-label,
#facilities.facilities-section .museum-name,
#facilities.facilities-section .campus-fact-number,
#facilities.facilities-section .campus-fact-value,
#facilities.facilities-section .staff-total,
#facilities.facilities-section .staff-icon,
#facilities.facilities-section .staff-total-number,
#facilities.facilities-section .staff-total-label,
#facilities.facilities-section .staff-category-title,
#facilities.facilities-section .staff-count,
#facilities.facilities-section .library-name-en,
#facilities.facilities-section .library-item-text span:first-child,
#facilities.facilities-section .library-logo,
#facilities.facilities-section .library-logo .library-number,
#facilities.facilities-section .library-logo .library-label,
#facilities.facilities-section .libraries-subsection .add-library-item,
#facilities.facilities-section .libraries-subsection .add-library-item .add-icon,
#facilities.facilities-section .libraries-subsection .add-library-item .add-text,
#facilities.facilities-section .library-number,
#facilities.facilities-section .sport-icon {
    color: #764393;
}

#facilities.facilities-section .colleges-total,
#facilities.facilities-section .libraries-subsection .add-library-item {
    border-color: #764393;
}

#facilities.facilities-section svg[stroke="#7d2882"],
#facilities.facilities-section svg [stroke="#7d2882"] {
    stroke: #764393;
}

#facilities.facilities-section svg[fill="#7d2882"],
#facilities.facilities-section svg [fill="#7d2882"] {
    fill: #764393;
}

#facilities.facilities-section svg[stroke="#8a67a8"],
#facilities.facilities-section svg [stroke="#8a67a8"],
#facilities.facilities-section svg[stroke="#9b7ab5"],
#facilities.facilities-section svg [stroke="#9b7ab5"],
#facilities.facilities-section svg[stroke="#b09ac5"],
#facilities.facilities-section svg [stroke="#b09ac5"],
#facilities.facilities-section svg[stroke="#c8b8d8"],
#facilities.facilities-section svg [stroke="#c8b8d8"],
#facilities.facilities-section svg[stroke="#d4c5e2"],
#facilities.facilities-section svg [stroke="#d4c5e2"],
#facilities.facilities-section svg[stroke="#f1ecf4"],
#facilities.facilities-section svg [stroke="#f1ecf4"] {
    stroke: #764393;
}

#facilities.facilities-section svg[fill="#8a67a8"],
#facilities.facilities-section svg [fill="#8a67a8"],
#facilities.facilities-section svg[fill="#9b7ab5"],
#facilities.facilities-section svg [fill="#9b7ab5"],
#facilities.facilities-section svg[fill="#b09ac5"],
#facilities.facilities-section svg [fill="#b09ac5"],
#facilities.facilities-section svg[fill="#c8b8d8"],
#facilities.facilities-section svg [fill="#c8b8d8"],
#facilities.facilities-section svg[fill="#d4c5e2"],
#facilities.facilities-section svg [fill="#d4c5e2"],
#facilities.facilities-section svg[fill="#f1ecf4"],
#facilities.facilities-section svg [fill="#f1ecf4"] {
    fill: #764393;
}

#facilities.facilities-section .college-item.special {
    background: #764393;
}

#facilities.facilities-section .colleges-timeline .college-item.special {
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    min-height: 150px;
    padding: 1.75rem 2rem;
    text-align: center;
}

#facilities.facilities-section .colleges-timeline .college-item.special .college-year {
    margin: 0;
    color: #FFFFFF;
    font-size: 2.75rem;
    line-height: 1;
    letter-spacing: -0.04em;
}

#facilities.facilities-section .college-item.special .college-name {
    color: #FFFFFF;
}

#facilities.facilities-section .colleges-timeline .college-item.special .college-name {
    font-size: 1.05rem;
    line-height: 1.45;
}

#facilities.facilities-section .campus-fact-card,
#facilities.facilities-section .lib-logo-placeholder {
    border-color: #764393;
}

#facilities.facilities-section .campus-facts-grid {
    gap: 1.25rem;
}

#facilities.facilities-section .campus-fact-card {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    grid-template-areas:
        "icon heading number";
    align-items: center;
    column-gap: 1.25rem;
    padding: 1.75rem 2rem;
    background: #FFFFFF;
    border: 1px solid rgba(118, 67, 147, 0.18);
    box-shadow: 0 1px 5px rgba(71, 40, 88, 0.08);
    text-align: left;
}

#facilities.facilities-section .campus-fact-icon {
    grid-area: icon;
    display: flex;
    width: 76px;
    height: 76px;
    margin: 0;
    align-items: center;
    justify-content: center;
    color: #764393;
}

#facilities.facilities-section .campus-fact-heading {
    grid-area: heading;
    align-items: flex-start;
    color: #2F3133;
    font-size: 1.05rem;
    gap: 0.15rem;
    max-width: 18rem;
}

#facilities.facilities-section .campus-fact-heading .chinese {
    color: #666666;
    font-size: 0.95rem;
}

#facilities.facilities-section .campus-fact-number {
    grid-area: number;
    justify-content: flex-end;
    align-items: baseline;
    gap: 0.65rem;
    text-align: right;
    flex-wrap: nowrap;
}

#facilities.facilities-section .campus-fact-prefix {
    align-items: flex-start;
    color: #6c7074;
    font-size: 0.9rem;
    padding-right: 0.75rem;
    border-right: 1px solid rgba(118, 67, 147, 0.2);
}

#facilities.facilities-section .campus-fact-value {
    color: #764393;
    font-size: clamp(3rem, 5vw, 4.1rem);
    letter-spacing: -0.04em;
}

#facilities.facilities-section .campus-fact-unit {
    align-items: flex-end;
    color: #2F3133;
    font-size: 1rem;
}

#facilities.facilities-section .campus-fact-unit .chinese,
#facilities.facilities-section .campus-fact-prefix .chinese {
    color: #666666;
    font-size: 0.88em;
}

#facilities.facilities-section .museums-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin-top: 1rem;
    overflow: hidden;
    background: #FFFFFF;
    border: 1px solid rgba(118, 67, 147, 0.18);
    border-radius: 7px;
    box-shadow: 0 1px 5px rgba(71, 40, 88, 0.08);
}

#facilities.facilities-section .museum-item {
    min-height: 0;
    padding: 1.35rem 1.5rem;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(118, 67, 147, 0.12);
    border-radius: 0;
    box-shadow: none;
}

#facilities.facilities-section .museum-item:nth-child(odd) {
    border-right: 1px solid rgba(118, 67, 147, 0.12);
}

#facilities.facilities-section .museum-item:hover {
    transform: none;
    box-shadow: none;
}

#facilities.facilities-section .museum-name {
    margin-bottom: 0.2rem;
    color: #764393;
    font-size: 1rem;
    line-height: 1.3;
}

#facilities.facilities-section .museum-name-chinese {
    margin-bottom: 0.7rem;
    color: #666666;
    font-size: 0.9rem;
    font-style: normal;
    line-height: 1.35;
}

#facilities.facilities-section .museum-description,
#facilities.facilities-section .museum-description-chinese {
    color: #6c7074;
    font-size: 0.85rem;
    line-height: 1.5;
}

#facilities.facilities-section .museum-description-chinese {
    margin-top: 0.25rem;
}

#facilities.facilities-section .libraries-header {
    align-items: center;
    padding: 0;
    margin-bottom: 1rem;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

#facilities.facilities-section .libraries-header .subsection-title {
    margin-bottom: 0;
}

#facilities.facilities-section .library-logo {
    align-items: baseline;
    gap: 0.55rem;
    min-width: 0;
    justify-content: flex-start;
    padding: 0;
    margin-left: auto;
    background: transparent;
    border-radius: 0;
    color: #764393;
    box-shadow: none;
    white-space: nowrap;
}

#facilities.facilities-section .library-logo .library-number {
    color: #764393;
    font-size: 2.05rem;
    line-height: 1;
    letter-spacing: -0.05em;
}

#facilities.facilities-section .library-logo .library-label {
    color: #764393;
    font-size: 0.78rem;
    font-weight: var(--font-weight-bold);
    line-height: 1;
    white-space: nowrap;
}

#facilities.facilities-section .library-list {
    margin-bottom: 1.25rem;
}

#facilities.facilities-section .library-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

#facilities.facilities-section .library-stat {
    display: grid;
    grid-template-rows: auto 1fr;
    align-items: start;
    min-height: 142px;
    padding: 1.25rem;
    background: #FFFFFF;
    border: 1px solid rgba(118, 67, 147, 0.18);
    border-radius: 7px;
    box-shadow: 0 1px 5px rgba(71, 40, 88, 0.08);
    text-align: left;
}

#facilities.facilities-section .library-stat:nth-child(4) {
    grid-column: 1 / -1;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: none;
    align-items: center;
    gap: 1.5rem;
    min-height: 0;
    padding: 1.1rem 1.4rem;
}

#facilities.facilities-section .library-stat:hover {
    transform: none;
    background: #FFFFFF;
    box-shadow: 0 1px 5px rgba(71, 40, 88, 0.08);
}

#facilities.facilities-section .library-stat .library-number {
    color: #764393;
    font-size: clamp(1.9rem, 3vw, 2.6rem);
    line-height: 1;
    letter-spacing: -0.04em;
    margin-bottom: 0.75rem;
}

#facilities.facilities-section .library-stat:nth-child(4) .library-number {
    margin-bottom: 0;
    font-size: clamp(2.3rem, 4vw, 3.2rem);
    white-space: nowrap;
}

#facilities.facilities-section .library-stat .library-label {
    color: #2F3133;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
}

#facilities.facilities-section .library-stat .library-label br {
    display: block;
    content: "";
    margin-bottom: 0.2rem;
}

#facilities.facilities-section .library-stat .library-label span:last-child {
    color: #666666;
    font-size: 0.86rem;
    font-weight: 500;
}

#facilities.facilities-section .library-stat:nth-child(4) .library-label span:last-child {
    white-space: nowrap;
}

@media (max-width: 900px) {
    #facilities.facilities-section .library-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #facilities.facilities-section .library-stat:nth-child(4) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) {
    #facilities.facilities-section .libraries-header {
        align-items: flex-start;
        flex-direction: column;
    }

    #facilities.facilities-section .library-logo {
        margin-left: 0;
    }

    #facilities.facilities-section .library-stats {
        grid-template-columns: 1fr;
    }

    #facilities.facilities-section .library-stat {
        min-height: 0;
    }

    #facilities.facilities-section .library-stat:nth-child(4) {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    #facilities.facilities-section .library-stat:nth-child(4) .library-number {
        white-space: normal;
    }

    #facilities.facilities-section .library-stat:nth-child(4) .library-label span:last-child {
        white-space: normal;
    }
}

#facilities.facilities-section .staff-total {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.5rem;
    padding: 1.75rem 2rem;
    background: #FFFFFF;
    border: 1px solid rgba(118, 67, 147, 0.18);
    color: #764393;
    text-align: left;
}

#facilities.facilities-section .staff-icon {
    display: none;
}

#facilities.facilities-section .staff-total-number {
    order: 2;
    font-size: clamp(3rem, 5vw, 4.4rem);
    margin: 0;
    letter-spacing: -0.04em;
    text-align: right;
}

#facilities.facilities-section .staff-total-label {
    order: 1;
    margin: 0;
    color: #2F3133;
    font-size: 1.15rem;
    line-height: 1.45;
}

#facilities.facilities-section .staff-category {
    border: 1px solid rgba(118, 67, 147, 0.18);
    box-shadow: 0 1px 5px rgba(71, 40, 88, 0.08);
}

#facilities.facilities-section .staff-category::before {
    display: none;
}

#facilities.facilities-section .staff-category-total {
    color: #764393;
}

#facilities.facilities-section .hostel-category {
    border: 1px solid rgba(118, 67, 147, 0.18);
    box-shadow: 0 1px 5px rgba(71, 40, 88, 0.08);
}

#facilities.facilities-section .hostel-category::before {
    display: none;
}

#facilities.facilities-section .hostel-count,
#facilities.facilities-section .hostel-places {
    color: #764393;
}

#facilities.facilities-section .hostel-total {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.5rem;
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    background: #FFFFFF;
    color: #2F3133;
    border: 1px solid rgba(118, 67, 147, 0.18);
    box-shadow: 0 1px 5px rgba(71, 40, 88, 0.08);
}

#facilities.facilities-section .hostel-total h4 {
    color: #2F3133;
    line-height: 1.35;
}

#facilities.facilities-section .hostel-total .total-count {
    color: #764393;
    font-size: clamp(2.5rem, 4vw, 3.4rem);
    letter-spacing: -0.04em;
}

@media (max-width: 768px) {
    #facilities.facilities-section .staff-total {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    #facilities.facilities-section .staff-total-number {
        text-align: center;
    }

    #facilities.facilities-section .hostel-total {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    #facilities.facilities-section .hostel-total h4 {
        font-size: 1.15rem;
        font-weight: normal;
        line-height: 1.45;
        margin: 0;
    }

    #facilities.facilities-section .hostel-total .total-count {
        font-size: clamp(3rem, 5vw, 4.4rem);
        text-align: center;
        margin: 0;
    }
}

@media (max-width: 700px) {
    #facilities.facilities-section .campus-fact-card {
        grid-template-columns: 1fr;
        grid-template-areas:
            "icon"
            "heading"
            "number";
        justify-items: center;
        text-align: center;
    }

    #facilities.facilities-section .campus-fact-icon {
        width: 72px;
        height: 72px;
    }

    #facilities.facilities-section .campus-fact-heading,
    #facilities.facilities-section .campus-fact-prefix,
    #facilities.facilities-section .campus-fact-unit {
        align-items: center;
        max-width: none;
    }

    #facilities.facilities-section .campus-fact-number {
        justify-content: center;
        text-align: center;
        flex-wrap: wrap;
    }

    #facilities.facilities-section .museums-grid {
        grid-template-columns: 1fr;
    }

    #facilities.facilities-section .museum-item:nth-child(odd) {
        border-right: 0;
    }
}

#facilities.facilities-section .college-item,
#facilities.facilities-section .faculty-item,
#facilities.facilities-section .museum-item,
#facilities.facilities-section .hostel-category,
#facilities.facilities-section .library-item,
#facilities.facilities-section .staff-category,
#facilities.facilities-section .staff-item,
#facilities.facilities-section .library-stat,
#facilities.facilities-section .sport-item,
#facilities.facilities-section .add-hostel-item,
#facilities.facilities-section .add-library-item,
#facilities.facilities-section .add-library-stat-item,
#facilities.facilities-section .add-sport-item {
    transition: none;
}

#facilities.facilities-section .college-item:hover,
#facilities.facilities-section .staff-category:hover,
#facilities.facilities-section .sport-item:hover,
#facilities.facilities-section .add-hostel-item:hover,
#facilities.facilities-section .add-library-stat-item:hover,
#facilities.facilities-section .add-sport-item:hover {
    transform: none;
    box-shadow: none;
}

#facilities.facilities-section .sport-item:hover {
    background: white;
    border-color: var(--dewy-purple);
}

#facilities.facilities-section .museum-item:hover {
    transform: none;
    box-shadow: none;
}

#facilities.facilities-section .library-item:hover {
    transform: none;
    box-shadow: 0 1px 5px rgba(71, 40, 88, 0.16);
}

#facilities.facilities-section .staff-category:hover {
    border-color: var(--dewy-purple);
}

#facilities.facilities-section .staff-item:hover {
    background: var(--milky-purple);
}

#facilities.facilities-section .libraries-subsection .add-library-item:hover {
    background: rgba(241, 236, 244, 0.45);
    border-color: #764393;
    transform: none;
}

#facilities.facilities-section .add-hostel-item:hover,
#facilities.facilities-section .add-library-stat-item:hover,
#facilities.facilities-section .add-sport-item:hover {
    background: rgba(118, 67, 147, 0.05);
    border-color: var(--dynamic-purple);
}

/* Footer */
.footer {
    background: #f5f5f5;
    color: #333;
    padding: 3rem 0 2rem;
    border-top: 1px solid #e0e0e0;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 2fr;
    gap: 3rem;
    align-items: start;
}

.footer-info h3 {
    color: var(--classic-purple);
    margin-bottom: 1.5rem;
    font-weight: 500;
    font-size: 1.1rem;
}

.footer-info p {
    margin-bottom: 0.5rem;
    margin-left: 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

.footer-info a {
    color: var(--classic-purple);
    text-decoration: none;
}

.footer-info a:hover {
    text-decoration: underline;
}

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

.footer-credits p {
    margin-bottom: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.footer-disclaimer {
    border-top: 1px solid #e0e0e0;
    margin-top: 1.5rem;
    padding-top: 1rem;
    color: #999;
    font-size: 0.75rem;
    line-height: 1.5;
}

.footer-disclaimer p {
    margin-bottom: 0.35rem;
}

.footer-disclaimer p:last-child {
    margin-bottom: 0;
}

/* Hidden on screen; shown only during section/all-section print modes via print.css */
.footer-disclaimer-print-only {
    display: none;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .nav-container {
        padding: 0 0.75rem;
        width: 100%;
        /* Ensure container stays within viewport */
        max-width: 100%;
        /* Prevent overflow */
        box-sizing: border-box;
        /* Include padding in width calculation */
        height: 70px;
    }

    .nav-logo {
        flex-shrink: 1;
        /* Allow logo to shrink if needed */
        overflow: hidden;
        /* Prevent logo overflow */
        max-width: calc(100% - 140px);
        /* Reserve space for actions + hamburger */
        order: 0;
    }

    .nav-logo img {
        height: 52px;
        max-width: 100%;
        object-fit: contain;
    }

    .nav-actions {
        order: 1;
        margin-right: 0;
        /* Remove margin */
        margin-left: auto;
        /* Push to the right */
        gap: 0.5rem;
        /* Reduce gap between buttons */
        flex-shrink: 0;
        /* Prevent shrinking */
    }

    .print-btn,
    .view-mode-btn,
    .chinese-variant-toggle {
        width: 36px;
        /* Slightly smaller on mobile */
        height: 36px;
        font-size: 1rem;
        /* Slightly smaller icon */
        padding: 0.4rem;
    }

    .chinese-variant-toggle {
        width: auto;
        min-width: 52px;
        padding: 0 0.5rem;
        font-size: 0.8rem;
    }

    .hamburger {
        display: flex;
        width: 36px;
        height: 36px;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        order: 2;
        flex-shrink: 0;
        /* Prevent shrinking */
        margin-left: 0.5rem;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        display: flex;
        /* Explicitly set display */
        flex-direction: column;
        background: white;
        width: 100%;
        text-align: center;
        transition: left 0.3s ease-in-out;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        padding: 2rem 1.5rem;
        box-sizing: border-box;
        z-index: 1001;
        /* Higher than navbar to show above it */
        max-height: calc(100vh - 70px);
        /* Prevent menu from going off screen */
        overflow-y: auto;
        /* Allow scrolling if menu is too tall */
    }

    .nav-menu.active {
        left: 0 !important;
        /* Force left position */
        display: flex !important;
        /* Ensure it's visible */
    }

    .nav-menu li {
        margin: 1rem 0;
    }

    /* Mobile nav link - show Chinese inline in single row */
    .nav-link {
        display: inline-flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 0.65rem;
        padding-bottom: 0;
        text-align: center;
        white-space: normal;
        flex-wrap: wrap;
    }

    /* Hide the default ::before in mobile */
    .nav-link::before {
        display: none;
    }

    /* Override desktop ::after underline and use it to show Chinese text */
    .nav-link::after {
        content: attr(data-chinese);
        position: static;
        transform: none;
        opacity: 0.85;
        margin-top: 0;
        font-size: 0.85rem;
        text-align: center;
        background: var(--cuhk-classic-purple);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        width: auto;
        height: auto;
        left: auto;
        bottom: auto;
    }

    .nav-link:hover::after,
    .nav-link.active::after {
        opacity: 1;
        width: auto;
        background: var(--cuhk-classic-purple);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
}

/* Scholarships */
#scholarships.scholarships-section {
    background: #FFFFFF;
}

/* Scholarships Vertical Bar Chart */
.scholarships-chart-container {
    width: 100%;
    max-width: 900px;
    margin: 3rem auto 0;
}

.scholarships-legend-top {
    display: flex;
    justify-content: flex-start;
    gap: 3rem;
    margin-bottom: 2rem;
}

.legend-item-left, .legend-item-right {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.legend-item-left .legend-purple-box {
    width: 24px;
    height: 24px;
    background-color: #6C3376; /* Purple */
    margin-top: 2px;
}

.legend-item-right {
    color: var(--cuhk-royal-gold); /* Gold */
}

.legend-item-right i {
    font-size: 1.7rem;
}

.legend-text {
    line-height: 1.2;
}

.legend-text .legend-zh {
    font-weight: bold;
    font-size: 0.95rem;
    color: #333;
}

.legend-item-right .legend-text .legend-zh {
    color: var(--cuhk-royal-gold);
}

.legend-text .legend-en {
    font-size: 0.8rem;
}

.scholarships-columns {
    display: flex;
    align-items: flex-end;
    padding-bottom: 0;
    margin-bottom: 1rem;
}

.scholarship-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
}

.col-bar-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    height: 240px;
    border-bottom: 2px solid #000;
}

.col-awards-wrapper {
    color: var(--cuhk-royal-gold);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

.col-awards-wrapper i {
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
    opacity: 0.7;
}

.col-awards-wrapper .awards-sup {
    font-size: 0.7em;
    vertical-align: super;
}

.col-bar {
    height: var(--bar-size, 0%);
    width: 50%;
    max-width: 60px;
    background-color: #6C3376;
}

.col-info {
    text-align: center;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 150px; /* Fixed height for text area below bar */
}

.col-amount {
    font-size: 3rem;
    font-weight: 800;
    color: var(--cuhk-black);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.col-amount .amount-count {
    color: var(--cuhk-black);
}

.col-info .category-zh {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--cuhk-black);
    line-height: 1.3;
    margin-bottom: 0.3rem;
}

.col-info .category-en {
    font-size: 0.85rem;
    color: #333;
    line-height: 1.25;
}

.scholarships-notes {
    margin-top: 3rem;
    font-size: 0.8rem;
    color: #666;
    line-height: 1.5;
}

.scholarships-note-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.scholarships-note-marker {
    flex: 0 0 auto;
    font-weight: 700;
    color: var(--cuhk-black);
}

@media screen and (max-width: 768px) {
    .scholarships-chart-container {
        margin-top: 2rem;
    }

    .scholarships-legend-top {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1.5rem;
    }

    .scholarships-columns {
        flex-direction: column;
        height: auto;
        align-items: stretch;
        border-bottom: none;
        gap: 0;
    }
    
    .scholarship-col {
        width: 100%;
        flex-direction: row;
        border-bottom: none;
        padding-bottom: 0;
        align-items: stretch;
    }
    
    .col-info {
        width: 40%;
        order: 1;
        height: auto;
        margin-top: 0;
        text-align: right;
        align-items: flex-end;
        padding-left: 0;
        padding-right: 1.5rem;
        border-right: 2px solid #000;
        padding-top: 1.25rem;
        padding-bottom: 1.25rem;
    }

    .col-info .col-amount {
        font-size: 2.2rem;
    }

    .col-info .category-zh {
        font-size: 0.95rem;
    }

    .col-info .category-en {
        font-size: 0.75rem;
    }
    
    .col-bar-area {
        width: 60%;
        order: 2;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        height: auto;
        border-bottom: none;
    }
    
    .col-bar {
        order: 1;
        width: var(--bar-size, 0%);
        height: 30px;
        max-width: none;
    }
    
    .col-awards-wrapper {
        order: 2;
        flex-direction: row;
        align-items: center;
        margin-bottom: 0;
        margin-left: 0.75rem;
        font-size: 1.1rem;
    }

    .col-awards-wrapper i {
        margin-bottom: 0;
        margin-right: 0.3rem;
        font-size: 1.1rem;
    }
}

@media screen and (max-width: 480px) {
    .col-info {
        padding-right: 1rem;
        width: 45%;
    }

    .col-bar-area {
        width: 55%;
    }

    .col-info .col-amount {
        font-size: 1.8rem;
    }

    .col-awards-wrapper {
        font-size: 1rem;
        margin-left: 0.5rem;
    }
    
    .col-awards-wrapper i {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .hero-content {
        padding: 2rem 1.5rem 1rem;
    }

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

    .hero-subtitle {
        font-size: 1.25rem;
        letter-spacing: 0.1em;
    }

    .hero-pattern {
        height: 90px;
        min-height: unset;
        max-height: unset;
        overflow: hidden;
    }

    .hero-pattern img {
        height: 100%;
        width: auto;
        min-width: 200%;
        object-fit: cover;
        object-position: left top;
    }

    .container {
        padding: 0 1.5rem;
    }

    .section {
        padding: 3rem 0;
    }

    /* All headings align left in mobile */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    .section-title,
    .subsection-title {
        text-align: left !important;
    }

    .hero-title,
    .hero-subtitle {
        text-align: center !important;
    }


    .section-title {
        font-size: 2.2rem;
    }

    .section-title .chinese {
        font-size: 1.4rem;
    }

    .rankings-grid {
        gap: 1rem;
    }

    .rankings-featured {
        grid-template-columns: 1fr;
        padding: 1.5rem;
    }

    .ranking-feature-card {
        min-height: auto;
        padding: 1.5rem 0;
    }

    .ranking-feature-card.has-divider::after {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        height: 1px;
    }

    .ranking-row {
        flex-direction: column;
    }

    .ranking-row-main {
        padding: 1.5rem;
    }

    .ranking-scope-badge,
    .ranking-rank-panel {
        width: 100%;
        flex-basis: auto;
    }

    .ranking-scope-badge {
        padding: 1rem 1.5rem;
        flex-direction: row;
    }

    .ranking-rank-panel {
        padding: 1.25rem 1.5rem;
    }

    .subject-ranking-items-grid {
        grid-template-columns: 1fr;
    }

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

    .research-stats {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .total-output-wrapper {
        grid-template-columns: 1fr;
    }

    .patents-highlight {
        padding: 1.25rem 1.5rem;
        gap: 0.75rem;
    }

    .patents-icon {
        font-size: 2rem;
    }

    .patents-number {
        font-size: 2.75rem;
    }

    .patents-label-en {
        font-size: 1rem;
    }

    .patents-label-zh {
        font-size: 0.85rem;
    }

    .output-breakdown {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .student-stats {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .student-numbers {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .colleges-timeline {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .footer-credits {
        text-align: left;
    }

    /* AI Editor toggle button - move up on mobile to avoid conflicts with mobile UI */
    .ai-editor-toggle {
        margin-bottom: 1.5rem;
        right: 1.5rem;
        /* Slightly closer to edge on mobile */
        width: 56px;
        /* Slightly smaller on mobile */
        height: 56px;
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 0.5rem;
        /* Slightly less padding on very small screens */
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        height: 60px;
    }

    .nav-logo {
        max-width: calc(100% - 120px);
        /* Reserve space for actions + hamburger on small screens */
    }

    .nav-logo img {
        height: 44px;
    }

    .nav-actions {
        gap: 0.25rem;
        /* Tighter gap on small screens */
    }

    .print-btn,
    .view-mode-btn,
    .chinese-variant-toggle {
        width: 32px;
        /* Even smaller on very small screens */
        height: 32px;
        font-size: 0.9rem;
        padding: 0.3rem;
    }

    .chinese-variant-toggle {
        width: auto;
        min-width: 46px;
        padding: 0 0.4rem;
        font-size: 0.75rem;
    }

    .hamburger {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        margin-left: 0.25rem;
    }

    .bar {
        width: 22px;
        /* Slightly smaller hamburger */
        height: 2.5px;
    }

    /* Ensure nav-menu works on small screens too */
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 60px;
        display: flex;
        /* Explicitly set display */
        flex-direction: column;
        background: white;
        width: 100%;
        text-align: center;
        transition: left 0.3s ease-in-out;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        padding: 1.5rem 1rem;
        /* Slightly less padding on small screens */
        box-sizing: border-box;
        z-index: 1001;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }

    .nav-menu.active {
        left: 0 !important;
        /* Force left position */
        display: flex !important;
        /* Ensure it's visible */
    }

    .nav-menu li {
        margin: 0.8rem 0;
        /* Slightly tighter spacing */
    }

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

    .ranking-position,
    .achievement-number {
        font-size: 3rem;
    }

    .big-number {
        font-size: 3.5rem;
    }

    .student-count,
    .total-count {
        font-size: 1.8rem;
    }

    /* AI Editor toggle button - even higher on very small screens */
    .ai-editor-toggle {
        margin-bottom: 1.5rem;
        right: 1rem;
        /* Tighter to edge */
        width: 52px;
        /* Smaller on very small screens */
        height: 52px;
        font-size: 1rem;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

.section {
    animation: fadeInUp 0.6s ease-out;
}

/* Smooth scrolling improvements */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Focus styles for accessibility */
.nav-link:focus,
.hamburger:focus {
    outline: 2px solid var(--royal-gold);
    outline-offset: 2px;
}

/* AI Editor Styles */
.ai-editor {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--warm-purple);
    z-index: 2000;
    transition: right 0.3s ease;
    box-shadow: -10px 0 30px rgba(118, 67, 147, 0.1);
}

.ai-editor.open {
    right: 0;
}

.ai-editor-content {
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ai-editor h3 {
    color: var(--classic-purple);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.ai-editor p {
    color: var(--royal-purple);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

#ai-prompt {
    flex: 1;
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--warm-purple);
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: none;
    background: white;
    color: var(--marble);
    margin-bottom: 1rem;
    transition: border-color 0.3s ease;
}

#ai-prompt:focus {
    outline: none;
    border-color: var(--classic-purple);
    box-shadow: 0 0 0 3px rgba(118, 67, 147, 0.1);
}

#ai-prompt::placeholder {
    color: #999;
}

.ai-editor-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ai-editor-actions button {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

#ai-submit {
    background: var(--classic-purple);
    color: white;
}

#ai-submit:hover:not(:disabled) {
    background: var(--dynamic-purple);
    transform: translateY(-1px);
}

#ai-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#ai-toggle {
    background: transparent;
    color: var(--royal-purple);
    border: 1px solid var(--warm-purple);
}

#ai-toggle:hover {
    background: var(--warm-purple);
    color: white;
}

.ai-status {
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    display: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
}

.ai-status.loading {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

.ai-status.success {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.ai-status.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.ai-editor-toggle {
    width: 60px;
    height: 60px;
    background: var(--classic-purple);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(118, 67, 147, 0.3);
}

.ai-editor-toggle:hover {
    background: var(--dynamic-purple);
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(118, 67, 147, 0.4);
}

.ai-editor-toggle.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Chinese override manager */
.chinese-override-toggle {
    position: fixed;
    right: 2rem;
    bottom: 6.75rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--cuhk-royal-purple);
    color: var(--cuhk-white);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.chinese-override-toggle:hover,
.chinese-override-toggle:focus {
    background: var(--cuhk-classic-purple);
    transform: scale(1.06);
}

.chinese-override-toggle:focus-visible {
    outline: 3px solid var(--cuhk-royal-gold);
    outline-offset: 2px;
}

.chinese-override-toggle i {
    font-size: 1.45rem;
}

body.view-mode .chinese-override-toggle,
body.static-site-mode .chinese-override-toggle {
    display: none !important;
}

.chinese-override-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.chinese-override-modal.open {
    display: flex;
}

.chinese-override-modal-content {
    background: var(--cuhk-white);
    border-radius: 8px;
    width: min(760px, 100%);
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.chinese-override-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--cuhk-royal-purple);
    color: var(--cuhk-white);
}

.chinese-override-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--cuhk-white);
}

.chinese-override-modal-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--cuhk-white);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.85;
}

.chinese-override-modal-close:hover {
    opacity: 1;
}

.chinese-override-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.chinese-override-help {
    margin: 0 0 1rem;
    color: var(--cuhk-grey-dark);
    line-height: 1.5;
}

.chinese-override-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
    background: var(--cuhk-milky-purple);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.chinese-override-form label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    color: var(--cuhk-royal-purple);
    font-weight: var(--font-weight-semibold);
}

.chinese-override-form textarea {
    width: 100%;
    resize: vertical;
    min-height: 64px;
    padding: 0.65rem;
    border: 1px solid var(--cuhk-dewy-purple);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
}

.chinese-override-form textarea:focus {
    outline: none;
    border-color: var(--cuhk-classic-purple);
    box-shadow: 0 0 0 2px rgba(118, 67, 147, 0.15);
}

.chinese-override-add-btn {
    grid-column: 1 / -1;
    justify-self: flex-start;
    border: none;
    border-radius: 6px;
    background: var(--cuhk-classic-purple);
    color: var(--cuhk-white);
    padding: 0.65rem 1rem;
    cursor: pointer;
    font-weight: var(--font-weight-semibold);
}

.chinese-override-add-btn:hover {
    background: var(--cuhk-royal-purple);
}

.chinese-override-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chinese-override-empty {
    padding: 1rem;
    border: 1px dashed var(--cuhk-dewy-purple);
    border-radius: 6px;
    color: var(--cuhk-grey);
    text-align: center;
}

.chinese-override-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem;
    border: 1px solid var(--cuhk-dewy-purple);
    border-radius: 8px;
    background: var(--cuhk-white);
}

.chinese-override-row-text {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.chinese-override-row-value span {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--cuhk-royal-gold);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chinese-override-row-value strong {
    color: var(--cuhk-royal-purple);
    font-weight: var(--font-weight-semibold);
    word-break: break-word;
}

.chinese-override-delete-btn {
    border: 1px solid var(--cuhk-royal-gold);
    background: var(--cuhk-champagne-gold);
    color: var(--cuhk-dark-royal-gold);
    border-radius: 6px;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
}

.chinese-override-delete-btn:hover {
    background: var(--cuhk-royal-gold);
    color: var(--cuhk-white);
}

/* User Info Toggle Button */
.user-info-toggle {
    /* Position handled by container */
    width: 60px;
    height: 60px;
    background: var(--cuhk-gold);
    color: var(--cuhk-grey-light);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(184, 134, 11, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* For panel positioning */
}

.user-info-toggle:hover {
    background: var(--cuhk-royal-gold);
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(184, 134, 11, 0.4);
}

.user-info-toggle i {
    font-size: 1.5rem;
}

/* User Info Panel */
.user-info-panel {
    position: absolute;
    bottom: 0;
    right: 100%;
    margin-right: 15px;
    /* Spacing from button */
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1600;
    min-width: 200px;
    animation: fadeInSlide 0.3s ease;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.user-info-content {
    padding: 1rem;
}

.user-info-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--cuhk-stone);
    margin-bottom: 0.75rem;
    font-weight: var(--font-weight-semibold);
    color: var(--cuhk-classic-purple);
}

.user-info-header i {
    font-size: 1.5rem;
    color: var(--cuhk-gold);
}

.user-permissions {
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--cuhk-royal-purple);
    border-bottom: 1px solid var(--cuhk-stone);
}

.user-permissions small {
    display: block;
    margin-top: 0.25rem;
}

.user-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.user-panel-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--cuhk-stone);
    color: var(--cuhk-classic-purple);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: var(--font-weight-medium);
    transition: all 0.3s ease;
}

.user-panel-link:hover {
    background: var(--cuhk-lavender);
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(118, 67, 147, 0.15);
}

.user-panel-link i {
    font-size: 1rem;
    color: var(--cuhk-gold);
}

.logout-btn {
    width: 100%;
    padding: 0.6rem 1rem;
    background: var(--cuhk-classic-purple);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: var(--font-weight-medium);
    transition: all 0.3s ease;
    display: flex;
    align-items: left;
    justify-content: left;
    gap: 0.5rem;
}

.logout-btn:hover {
    background: var(--cuhk-royal-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(118, 67, 147, 0.2);
}

.logout-btn i {
    font-size: 1rem;
}

/* Data Confirmation Toggle Button (Non-Admin) */
.data-confirm-toggle {
    width: 60px;
    height: 60px;
    background: var(--cuhk-dawn);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(239, 140, 109, 0.3);
    display: none;
    align-items: center;
    justify-content: center;
}

.data-confirm-toggle:hover {
    background: #e06840;
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(239, 140, 109, 0.4);
}

.data-confirm-toggle i {
    font-size: 1.5rem;
}

/* Admin Confirmations Review Toggle Button */
.confirmations-review-toggle {
    width: 60px;
    height: 60px;
    background: var(--cuhk-sky);
    color: var(--cuhk-grey-dark);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(135, 206, 235, 0.3);
    display: none;
    align-items: center;
    justify-content: center;
}

.confirmations-review-toggle:hover {
    background: #5fb8e0;
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(135, 206, 235, 0.4);
}

.confirmations-review-toggle i {
    font-size: 1.5rem;
}

/* Data Confirmation Modal */
.data-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: none;
    justify-content: center;
    align-items: center;
}

.data-confirm-modal-content {
    background: white;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    min-width: 400px;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    animation: fadeInScale 0.3s ease;
}

.data-confirm-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--cuhk-dawn);
    color: white;
    font-weight: var(--font-weight-bold);
    font-size: 1.1rem;
}

.data-confirm-modal-header i {
    font-size: 1.25rem;
}

.data-confirm-modal-close {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.data-confirm-modal-close:hover {
    opacity: 1;
}

.data-confirm-modal-body {
    padding: 1.5rem;
}

.data-confirm-modal-body p {
    margin: 0 0 1rem 0;
    color: var(--cuhk-grey-dark);
    line-height: 1.6;
}

.data-confirm-sections-list {
    background: var(--cuhk-stone);
    border-radius: 5px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.data-confirm-sections-list h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: var(--cuhk-classic-purple);
}

.data-confirm-sections-list ul {
    margin: 0;
    padding-left: 1.5rem;
    color: var(--cuhk-grey-dark);
    font-size: 0.9rem;
}

.data-confirm-sections-list li {
    margin-bottom: 0.25rem;
}

.data-confirm-last-confirmation {
    font-size: 0.85rem;
    color: var(--cuhk-grey);
    padding: 0.75rem;
    background: var(--cuhk-lavender);
    border-radius: 5px;
    border-left: 3px solid var(--cuhk-classic-purple);
}

.data-confirm-last-confirmation.no-confirmation {
    background: #fff3cd;
    border-left-color: #ffc107;
    color: #856404;
}

.data-confirm-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--cuhk-stone);
    display: flex;
    justify-content: flex-end;
}

.data-confirm-submit-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--cuhk-classic-purple);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.3s ease;
}

.data-confirm-submit-btn:hover {
    background: var(--cuhk-royal-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(118, 67, 147, 0.3);
}

.data-confirm-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Confirmations Review Modal (Admin) */
.confirmations-review-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: none;
    justify-content: center;
    align-items: center;
}

.confirmations-review-modal-content {
    background: white;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    min-width: 500px;
    max-width: 700px;
    max-height: 80vh;
    overflow: hidden;
    animation: fadeInScale 0.3s ease;
}

.confirmations-review-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--cuhk-sky);
    color: var(--cuhk-grey-dark);
    font-weight: var(--font-weight-bold);
    font-size: 1.1rem;
}

.confirmations-review-modal-header i {
    font-size: 1.25rem;
}

.confirmations-review-modal-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--cuhk-grey-dark);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.confirmations-review-modal-close:hover {
    opacity: 1;
}

.confirmations-review-modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.confirmations-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.confirmations-loading {
    text-align: center;
    color: var(--cuhk-grey);
    padding: 2rem;
}

.confirmation-item {
    background: var(--cuhk-stone);
    border-radius: 5px;
    padding: 1rem;
    border-left: 4px solid var(--cuhk-classic-purple);
}

.confirmation-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.confirmation-username {
    font-weight: var(--font-weight-semibold);
    color: var(--cuhk-classic-purple);
    font-size: 1rem;
}

.confirmation-timestamp {
    font-size: 0.85rem;
    color: var(--cuhk-grey);
}

.confirmation-sections {
    font-size: 0.9rem;
    color: var(--cuhk-grey-dark);
}

.confirmation-sections span {
    display: inline-block;
    background: var(--cuhk-lavender);
    padding: 0.25rem 0.5rem;
    border-radius: 5px;
    margin: 0.25rem 0.25rem 0.25rem 0;
    font-size: 0.8rem;
}

.no-confirmations {
    text-align: center;
    color: var(--cuhk-grey);
    padding: 2rem;
    background: var(--cuhk-stone);
    border-radius: 5px;
}

.no-confirmations i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* Email Template Editor Styles */
.email-template-section h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.email-template-toggle-btn {
    background: transparent;
    border: 1px solid var(--cuhk-stone);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--cuhk-grey-dark);
}

.email-template-toggle-btn:hover {
    background: var(--cuhk-stone);
}

.email-template-toggle-btn.expanded i {
    transform: rotate(180deg);
}

.email-template-toggle-btn i {
    transition: transform 0.3s ease;
}

.email-template-editor {
    margin-top: 1rem;
    animation: fadeIn 0.3s ease;
}

.email-template-info {
    background: var(--cuhk-lavender);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--cuhk-grey-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.email-template-info i {
    color: var(--cuhk-classic-purple);
    margin-top: 2px;
}

.email-template-info code {
    background: rgba(118, 75, 162, 0.15);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--cuhk-classic-purple);
}

.email-template-field {
    margin-bottom: 1rem;
}

.email-template-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: var(--font-weight-semibold);
    color: var(--cuhk-grey-dark);
    margin-bottom: 0.35rem;
}

.email-template-field input[type="text"],
.email-template-field textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--cuhk-stone);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.email-template-field input[type="text"]:focus,
.email-template-field textarea:focus {
    outline: none;
    border-color: var(--cuhk-classic-purple);
    box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.1);
}

.email-template-field textarea {
    resize: vertical;
    min-height: 80px;
}

.email-template-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.email-template-preview-btn,
.email-template-save-btn,
.email-template-reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.3s ease;
}

.email-template-preview-btn {
    flex: 1;
    background: var(--cuhk-sky);
    color: var(--cuhk-grey-dark);
}

.email-template-preview-btn:hover {
    background: #5fb8e0;
}

.email-template-save-btn {
    flex: 2;
    background: var(--cuhk-pine);
    color: white;
}

.email-template-save-btn:hover {
    background: #4a8a5c;
}

.email-template-reset-btn {
    background: var(--cuhk-stone);
    color: var(--cuhk-grey-dark);
    padding: 0.6rem;
}

.email-template-reset-btn:hover {
    background: #c5c3c0;
}

.email-template-preview-btn:disabled,
.email-template-save-btn:disabled,
.email-template-reset-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Email Template Preview Modal */
.email-template-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10003;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.email-template-preview-content {
    background: white;
    border-radius: 6px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.3s ease;
}

.email-template-preview-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--cuhk-classic-purple);
    color: white;
    border-radius: 12px 12px 0 0;
}

.email-template-preview-header i {
    font-size: 1.1rem;
}

.email-template-preview-header span {
    flex: 1;
    font-weight: var(--font-weight-semibold);
}

.email-template-preview-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.email-template-preview-close:hover {
    opacity: 1;
}

.email-template-preview-body {
    flex: 1;
    overflow: hidden;
    border-radius: 0 0 12px 12px;
}

.email-template-preview-body iframe {
    width: 100%;
    height: 500px;
    border: none;
    background: white;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Section Visibility Panel (Admin) */
.section-visibility-toggle {
    width: 60px;
    height: 60px;
    background: var(--cuhk-mint);
    color: var(--cuhk-grey-dark);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(188, 225, 148, 0.3);
    display: none;
    align-items: center;
    justify-content: center;
}

.section-visibility-toggle:hover {
    background: #a8d97f;
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(188, 225, 148, 0.4);
}

.section-visibility-toggle i {
    font-size: 1.5rem;
}

.section-visibility-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    z-index: 10002;
    min-width: 320px;
    max-width: 400px;
    animation: fadeInScale 0.3s ease;
    display: none;
    /* Hidden by default */
}

.section-visibility-content {
    padding: 1rem;
}

.section-visibility-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--cuhk-stone);
    margin-bottom: 1rem;
    font-weight: var(--font-weight-bold);
    color: var(--cuhk-classic-purple);
    font-size: 1rem;
}

.section-visibility-header i {
    font-size: 1.5rem;
    color: var(--cuhk-mint);
}

.section-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.section-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--cuhk-stone);
    border-radius: 5px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.section-item:hover {
    background: var(--cuhk-lavender);
    transform: translateX(3px);
    border-color: var(--cuhk-mint);
}

.section-item.section-hidden {
    opacity: 0.6;
    background: #f5f5f5;
}

.section-item.section-hidden:hover {
    opacity: 0.8;
}

.section-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.section-name {
    font-weight: var(--font-weight-semibold);
    color: var(--cuhk-classic-purple);
    font-size: 0.9rem;
}

.section-id {
    font-size: 0.75rem;
    color: var(--cuhk-grey);
    font-family: 'Courier New', monospace;
}

/* Custom Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e74c3c;
    transition: all 0.3s ease;
    border-radius: 24px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: all 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.toggle-slider {
    background-color: #27ae60;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

input:checked+.toggle-slider:before {
    transform: translateX(24px);
}

.toggle-slider:hover {
    opacity: 0.95;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.15), 0 0 0 2px rgba(118, 67, 147, 0.1);
}

.section-visibility-footer {
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--cuhk-stone);
    display: flex;
    gap: 0.5rem;
}

.apply-visibility-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    background: var(--cuhk-classic-purple);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: var(--font-weight-medium);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.apply-visibility-btn:hover {
    background: var(--cuhk-royal-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(118, 67, 147, 0.2);
}

.reset-visibility-btn {
    padding: 0.6rem 1rem;
    background: var(--cuhk-stone);
    color: var(--cuhk-grey-dark);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: var(--font-weight-medium);
    transition: all 0.3s ease;
}

.reset-visibility-btn:hover {
    background: var(--cuhk-lavender);
    transform: translateY(-2px);
}

/* Backdrop overlay for section visibility panel */
.section-visibility-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ============================================================
   RESTRICTED INFORMATION PANEL
   ============================================================ */

/* Floating toggle button */
.restricted-info-toggle {
    width: 60px;
    height: 60px;
    background: var(--cuhk-classic-gold);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(123, 45, 142, 0.3);
    display: none;
    align-items: center;
    justify-content: center;
}

.restricted-info-toggle:hover {
    background: var(--cuhk-dark-royal-purple);
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(123, 45, 142, 0.4);
}

.restricted-info-toggle i {
    font-size: 1.5rem;
}

.restricted-info-toggle svg .st0 {
    fill: #000000 !important;
}

/* Modal overlay */
.restricted-info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: none;
    justify-content: center;
    align-items: center;
}

.restricted-info-modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    width: 1280px;
    max-width: 95vw;
    max-height: 90vh;
    overflow: hidden;
    animation: fadeInScale 0.3s ease;
    display: flex;
    flex-direction: column;
}

.restricted-info-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--cuhk-classic-purple);
    color: white;
    font-weight: var(--font-weight-bold);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.restricted-info-modal-header i {
    font-size: 1.25rem;
}

.restricted-info-modal-close {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.restricted-info-modal-close:hover {
    opacity: 1;
}

.restricted-info-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Admin controls */
.restricted-info-admin-controls {
    margin-bottom: 1rem;
}

.restricted-info-add-btn {
    background: var(--cuhk-classic-purple);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s;
}

.restricted-info-add-btn:hover {
    background: var(--cuhk-dark-royal-purple);
}

/* Form */
.restricted-info-form {
    background: #f9f9fb;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.restricted-info-form-group {
    margin-bottom: 1rem;
}

.restricted-info-form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    color: #444;
}

.restricted-info-form-group input[type="text"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.95rem;
    font-family: inherit;
}

/* Rich HTML editor (contenteditable) */
.restricted-info-html-editor {
    width: 100%;
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 0 0 5px 5px;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.5;
    background: white;
}

.restricted-info-html-editor:focus {
    outline: none;
    border-color: var(--cuhk-classic-purple);
    box-shadow: 0 0 0 2px rgba(123, 45, 142, 0.15);
}

.restricted-info-html-editor:empty::before {
    content: attr(data-placeholder);
    color: #aaa;
}

/* ===== Rich HTML Editor Toolbar ===== */
.ri-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: #f5f5f7;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    user-select: none;
}

.ri-toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.ri-toolbar-sep {
    width: 1px;
    height: 22px;
    background: #d4d4d8;
    margin: 0 4px;
}

.ri-toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #444;
    font-size: 0.8rem;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.ri-toolbar-btn:hover {
    background: #e2e2e6;
    color: #222;
}

.ri-toolbar-btn.active {
    background: var(--cuhk-classic-purple);
    color: white;
}

.ri-toolbar-select {
    height: 28px;
    border: 1px solid #d4d4d8;
    border-radius: 4px;
    background: white;
    font-size: 0.78rem;
    padding: 0 6px;
    color: #444;
    cursor: pointer;
    outline: none;
}

.ri-toolbar-select:focus {
    border-color: var(--cuhk-classic-purple);
}

/* Color picker buttons */
.ri-toolbar-color-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
}

.ri-toolbar-color-btn:hover {
    background: #e2e2e6;
}

.ri-color-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    cursor: pointer;
}

/* Dropdown panels (table, chart) */
.ri-toolbar-dropdown-wrap {
    position: relative;
}

.ri-toolbar-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    background: white;
    border: 1px solid #d4d4d8;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 10px;
    min-width: 200px;
}

.ri-toolbar-dropdown.open {
    display: block;
}

/* Table grid picker */
.ri-table-grid-label,
.ri-table-actions-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ri-table-grid {
    display: grid;
    grid-template-columns: repeat(8, 24px);
    grid-template-rows: repeat(8, 24px);
    gap: 2px;
    margin-bottom: 4px;
}

.ri-table-grid-cell {
    width: 24px;
    height: 24px;
    border: 1px solid #d4d4d8;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
}

.ri-table-grid-cell.highlighted {
    background: rgba(123, 45, 142, 0.15);
    border-color: var(--cuhk-classic-purple);
}

.ri-table-grid-size {
    text-align: center;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 6px;
}

/* Table edit actions inside dropdown */
.ri-table-actions {
    border-top: 1px solid #eee;
    padding-top: 8px;
    margin-top: 8px;
}

.ri-table-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 5px 8px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #444;
    transition: background 0.12s;
    text-align: left;
}

.ri-table-action-btn:hover {
    background: #f0f0f2;
}

.ri-table-action-btn.ri-danger {
    color: #d9534f;
}

.ri-table-action-btn.ri-danger:hover {
    background: rgba(217, 83, 79, 0.08);
}

/* Chart dropdown */
.ri-chart-dropdown {
    min-width: 280px;
}

.ri-chart-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ri-chart-form-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ri-chart-form-row label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #555;
}

.ri-chart-form-row label small {
    font-weight: 400;
    color: #999;
}

.ri-chart-form-row input,
.ri-chart-form-row select {
    padding: 5px 8px;
    border: 1px solid #d4d4d8;
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
}

.ri-chart-form-row input:focus,
.ri-chart-form-row select:focus {
    border-color: var(--cuhk-classic-purple);
}

.ri-chart-insert-btn {
    padding: 6px 12px;
    background: var(--cuhk-classic-purple);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 4px;
    transition: background 0.15s;
}

.ri-chart-insert-btn:hover {
    background: var(--cuhk-dark-royal-purple);
}

/* Source code editor textarea */
.restricted-info-source-editor {
    width: 100%;
    min-height: 150px;
    max-height: 300px;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 0 0 5px 5px;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
    background: #1e1e2e;
    color: #cdd6f4;
    resize: vertical;
    outline: none;
    tab-size: 2;
}

.restricted-info-source-editor:focus {
    border-color: var(--cuhk-classic-purple);
    box-shadow: 0 0 0 2px rgba(123, 45, 142, 0.15);
}

/* Editor content table styling within editor */
.restricted-info-html-editor table {
    border-collapse: collapse;
    width: auto;
    min-width: 50%;
    margin: 0.5rem 0;
}

.restricted-info-html-editor table td,
.restricted-info-html-editor table th {
    border: 1px solid #bbb;
    padding: 6px 10px;
    font-size: 0.88rem;
    min-width: 40px;
    position: relative;
}

.restricted-info-html-editor table th {
    background: #f0f0f4;
    font-weight: 600;
}

.restricted-info-html-editor table td:focus,
.restricted-info-html-editor table th:focus {
    outline: 2px solid var(--cuhk-classic-purple);
    outline-offset: -2px;
}

/* Selected table cell highlight */
.restricted-info-html-editor td.ri-cell-selected,
.restricted-info-html-editor th.ri-cell-selected {
    background: rgba(123, 45, 142, 0.08);
}

/* Chart container within editor */
.ri-chart-container {
    display: inline-block;
    width: 100%;
    max-width: 500px;
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #e0e0e6;
    border-radius: 8px;
    background: white;
    position: relative;
}

.ri-chart-container canvas {
    width: 100% !important;
    height: auto !important;
}

/* Responsive toolbar */
@media (max-width: 768px) {
    .ri-editor-toolbar {
        gap: 1px;
        padding: 4px 5px;
    }

    .ri-toolbar-btn {
        width: 26px;
        height: 24px;
        font-size: 0.72rem;
    }

    .ri-toolbar-sep {
        margin: 0 2px;
        height: 18px;
    }

    .ri-toolbar-select {
        height: 24px;
        font-size: 0.72rem;
    }

    .ri-table-grid {
        grid-template-columns: repeat(6, 20px);
        grid-template-rows: repeat(6, 20px);
    }
}

/* ===== End Rich HTML Editor Toolbar ===== */

/* Role checkboxes */
.restricted-info-roles-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.restricted-info-roles-checkboxes label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 400;
    font-size: 0.9rem;
    background: #eee;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.restricted-info-roles-checkboxes label:hover {
    background: #ddd;
}

.restricted-info-form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.restricted-info-save-btn {
    background: var(--cuhk-classic-purple);
    color: white;
    border: none;
    padding: 0.45rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.restricted-info-save-btn:hover {
    background: var(--cuhk-dark-royal-purple);
}

.restricted-info-cancel-btn {
    background: #e0e0e0;
    color: #333;
    border: none;
    padding: 0.45rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.restricted-info-cancel-btn:hover {
    background: #d0d0d0;
}

/* Item list */
.restricted-info-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.restricted-info-loading {
    text-align: center;
    padding: 2rem;
    color: #888;
}

.restricted-info-empty {
    text-align: center;
    padding: 2rem;
    color: #999;
    font-style: italic;
}

.restricted-info-item {
    background: #f9f9fb;
    border: 1px solid #e0e0e6;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    transition: box-shadow 0.2s;
}

.restricted-info-item:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.restricted-info-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.restricted-info-item-header .ri-expand-icon {
    font-size: 0.75rem;
    color: #999;
    margin-right: 0.5rem;
    transition: transform 0.2s;
}

.restricted-info-item.expanded .restricted-info-item-header .ri-expand-icon {
    transform: rotate(90deg);
}

.restricted-info-item-detail {
    display: none;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid #e8e8ec;
}

.restricted-info-item.expanded .restricted-info-item-detail {
    display: block;
}

.restricted-info-item-title {
    font-weight: 700;
    font-size: 1rem;
    color: #333;
}

.restricted-info-item-actions {
    display: flex;
    gap: 0.35rem;
}

.restricted-info-item-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    transition: background 0.15s;
}

.restricted-info-item-actions .ri-edit-btn {
    color: var(--cuhk-classic-purple);
}

.restricted-info-item-actions .ri-edit-btn:hover {
    background: rgba(123, 45, 142, 0.1);
}

.restricted-info-item-actions .ri-delete-btn {
    color: #d9534f;
}

.restricted-info-item-actions .ri-delete-btn:hover {
    background: rgba(217, 83, 79, 0.1);
}

.restricted-info-item-body {
    font-size: 0.9rem;
    line-height: 1.55;
    color: #444;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.restricted-info-item-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
}

.restricted-info-item-body table td,
.restricted-info-item-body table th {
    border: 1px solid #ccc;
    padding: 4px 8px;
    font-size: 0.85rem;
}

.restricted-info-item-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.6rem;
    font-size: 0.75rem;
    color: #888;
}

.restricted-info-item-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.restricted-info-role-tag {
    background: var(--cuhk-classic-purple);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    font-weight: 600;
}

/* Pagination */
.restricted-info-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    margin-top: 1rem;
}

.restricted-info-page-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s;
}

.restricted-info-page-btn:hover:not(:disabled) {
    background: #e0e0e0;
}

.restricted-info-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.restricted-info-page-info {
    font-size: 0.85rem;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .restricted-info-modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .restricted-info-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* Mobile responsiveness for AI Editor */
@media (max-width: 768px) {
    .ai-editor {
        width: 100vw;
        right: -100vw;
    }

    .ai-editor-content {
        padding: 1.5rem;
    }

    .ai-editor-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .user-info-toggle {
        bottom: 6.5rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .user-info-panel {
        bottom: 6.5rem;
        right: 4.5rem;
        min-width: 180px;
    }

    .section-visibility-toggle {
        bottom: 17rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .data-confirm-toggle {
        bottom: 10rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .confirmations-review-toggle {
        bottom: 13.5rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .email-reminder-toggle {
        bottom: 17rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .section-visibility-toggle {
        bottom: 20.5rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .data-confirm-modal-content {
        min-width: 90vw;
        max-width: 95vw;
    }

    .confirmations-review-modal-content {
        min-width: 90vw;
        max-width: 95vw;
    }

    .email-reminder-modal-content {
        min-width: 90vw;
        max-width: 95vw;
    }

    .section-visibility-panel {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        min-width: 280px;
        max-width: 90vw;
    }
}

/* Editable field highlighting */
[data-field] {
    position: relative;
    transition: all 0.3s ease;
}

[data-field]:hover {
    background: rgba(118, 67, 147, 0.05);
    border-radius: 4px;
    cursor: help;
}

[data-field]:hover::after {
    content: "✏️ Click to edit";
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--classic-purple);
    color: white;
    padding: 2px 2px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0.9;
}

/* Tablet responsive styles */
@media (max-width: 1024px) {

    /* Make funding chart adaptive for tablet */
    .funding-overview {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .funding-total-section {
        flex-direction: column;
    }

    .funding-total {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1.5rem;
        text-align: left;
    }

    .funding-total-label {
        margin-bottom: 0;
    }

    .funding-total-amount {
        flex-shrink: 0;
    }

    .funding-content {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }

    .funding-chart {
        min-height: 300px;
    }

    /* Make career chart adaptive for tablet */
    .career-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .career-chart {
        min-height: 350px;
    }

    .career-legend {
        max-height: none;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .career-legend-item {
        padding: 0.4rem;
    }
}

/* Hide tooltips on mobile */
@media (max-width: 768px) {
    [data-field]:hover::after {
        display: none;
    }

    /* Make funding chart responsive for mobile */
    .funding-overview {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .funding-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem;
    }

    .rgc-metrics {
        grid-template-columns: 1fr;
    }

    .rgc-label {
        white-space: normal;
    }

    .rgc-label-break {
        display: block;
    }

    .rgc-metric {
        min-height: auto;
    }

    .funding-chart {
        min-height: 250px;
        padding: 0.5rem;
    }

    .funding-legend {
        padding: 0.5rem;
    }

    .funding-legend-item {
        padding: 0.4rem;
        font-size: 0.85rem;
    }

    .funding-legend-label {
        font-size: 0.8rem;
    }

    .funding-legend-chinese {
        font-size: 0.7rem;
    }

    .funding-legend-value {
        font-size: 0.8rem;
    }

    /* Make career chart responsive for mobile */
    .career-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .career-chart {
        min-height: 320px;
        max-height: 450px;
        padding: 0.75rem;
        overflow: visible;
        width: 100%;
    }

    .career-chart canvas {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
    }

    .career-legend {
        max-height: none;
        padding: 0.5rem;
        order: 2;
    }

    .career-legend-item {
        gap: 0.8rem;
        padding: 0.4rem;
        border-bottom: none;
        border-radius: 5px;
    }

    .career-legend-field {
        font-size: 0.8rem;
        color: #2F3133;
        font-weight: 500;
        line-height: 1.2;
    }

    .career-legend-chinese {
        font-size: 0.7rem;
        color: #666666;
        font-weight: 400;
        font-style: normal;
    }

    .career-legend-percentage {
        font-size: 0.8rem;
        margin-left: auto;
        text-align: right;
        white-space: nowrap;
        color: var(--dynamic-purple);
        font-weight: 600;
    }

    /* Make funding chart canvas responsive */
    .funding-chart {
        width: 100%;
        overflow: visible;
    }

    .funding-chart canvas {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .career-chart {
        min-height: 280px;
        max-height: 350px;
        padding: 0.5rem;
    }

    /* Career legend - single column for small mobile */
    .career-legend {
        display: flex;
        flex-direction: column;
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0.5rem;
    }

    .career-legend-item {
        padding: 0.4rem;
        border-bottom: none;
    }

    /* Enhanced funding section for mobile readability */
    .funding-overview {
        gap: 1.5rem;
    }

    .funding-total-section {
        flex-direction: column;
        gap: 1rem;
    }

    .funding-total {
        flex-direction: column;
        align-items: center;
        gap: 0;
        text-align: center;
        padding: 1.5rem 1rem;
    }

    .funding-total-label {
        margin-bottom: 0.75rem;
    }

    .funding-total-label {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }

    .funding-total-amount .currency {
        font-size: 1.3rem;
    }

    .funding-total-amount .amount {
        font-size: 2.8rem;
    }

    .funding-total-amount .unit {
        font-size: 1rem;
    }

    .funding-rgc-highlight {
        padding: 1.5rem 1rem;
    }

    .rgc-amount .currency {
        font-size: 1.1rem;
    }

    .rgc-amount .amount {
        font-size: 2.2rem;
    }

    .rgc-amount .unit {
        font-size: 0.9rem;
    }

    .rgc-percentage {
        font-size: 1.4rem;
        margin-bottom: 0.75rem;
    }

    .rgc-label {
        font-size: 0.85rem;
    }

    .rgc-label-chinese {
        font-size: 0.75rem;
    }

    .funding-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem 1rem;
    }

    .funding-chart {
        min-height: 220px;
        padding: 0.5rem;
    }

    .funding-legend {
        gap: 0.6rem;
    }

    .funding-legend-item {
        padding: 0.4rem;
        gap: 0.6rem;
    }

    .funding-legend-color {
        width: 14px;
        height: 14px;
    }

    .funding-legend-label {
        font-size: 0.85rem;
    }

    .funding-legend-chinese {
        font-size: 0.75rem;
    }

    .funding-legend-value {
        font-size: 0.85rem;
    }

    /* Enhanced output section for mobile readability */
    .output-breakdown {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .output-item {
        padding: 1.5rem 1rem;
    }

    .output-number {
        font-size: 2.5rem;
        margin-bottom: 0.75rem;
        line-height: 1.1;
    }

    .output-label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
        line-height: 1.3;
    }

    .output-sublabel {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .subsection-title {
        font-size: 1.1rem;
    }
}

/* Inline editing styles */
.inline-edit-input {
    width: 100% !important;
    border: 2px solid var(--dynamic-purple) !important;
    border-radius: 4px !important;
    padding: 2px 6px !important;
    outline: none !important;
    box-sizing: border-box !important;
    background-color: #fff !important;
    color: #333 !important;
    transition: border-color 0.2s ease !important;
}

.inline-edit-input:focus {
    border-color: var(--classic-purple) !important;
    box-shadow: 0 0 0 3px rgba(118, 67, 147, 0.1) !important;
}

[data-field].editing {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 1px;
}

/* Enhanced hover effect for editable elements */
[data-field]:not(.editing):hover {
    background-color: rgba(118, 67, 147, 0.05);
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* Double-click hint */
[data-field]:not(.editing)::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--dynamic-purple);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

[data-field]:not(.editing):hover::before {
    opacity: 0.7;
}

/* Delete Button Styles */
.delete-ranking-btn,
.delete-achievement-btn,
.delete-funding-btn,
.delete-career-btn,
.delete-lab-btn,
.delete-location-btn,
.delete-output-btn,
.delete-gba-btn,
.delete-hostel-btn,
.delete-library-btn,
.delete-library-stat-btn,
.delete-sport-btn,
.delete-subject-item-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Highlight toggle button */
.highlight-toggle-btn {
    position: absolute;
    top: -8px;
    right: 15px;
    width: 20px;
    height: 20px;
    background: #ddd;
    color: #666;
    border: none;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.highlight-toggle-btn.active {
    background: #ffa502;
    color: white;
}

.highlight-toggle-btn:hover {
    transform: scale(1.1);
}

.delete-ranking-btn:hover,
.delete-achievement-btn:hover,
.delete-funding-btn:hover,
.delete-career-btn:hover,
.delete-lab-btn:hover,
.delete-location-btn:hover,
.delete-output-btn:hover,
.delete-gba-btn:hover,
.delete-hostel-btn:hover,
.delete-library-btn:hover,
.delete-library-stat-btn:hover,
.delete-sport-btn:hover,
.delete-subject-item-btn:hover {
    background: #ff3742;
    transform: scale(1.1);
}

/* Show delete buttons on parent hover */
.achievement-card:hover .delete-achievement-btn,
.funding-legend-item:hover .delete-funding-btn,
.career-legend-item:hover .delete-career-btn,
.lab-card:hover .delete-lab-btn,
.popup-content:hover .delete-location-btn,
.output-item:hover .delete-output-btn,
.gba-item:hover .delete-gba-btn,
.hostel-category:hover .delete-hostel-btn,
.library-item:hover .delete-library-btn,
.library-stat:hover .delete-library-stat-btn,
.sport-item:hover .delete-sport-btn,
.subject-ranking-item:hover .delete-subject-item-btn,
.subject-ranking-accordion:hover .delete-subject-group-btn,
[data-field]:hover .delete-ranking-btn,
[data-field]:hover .delete-achievement-btn {
    opacity: 1;
}

/* Show highlight toggle button on parent hover */
.gba-item:hover .highlight-toggle-btn {
    opacity: 1;
}

/* Add Item Styles */
.add-ranking-card,
.add-achievement-card,
.add-funding-item,
.add-career-item,
.add-output-item,
.add-gba-item,
.add-hostel-item,
.add-library-item,
.add-library-stat-item,
.add-sport-item {
    border: 2px dashed var(--dynamic-purple);
    background: rgba(118, 67, 147, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 1rem;
    border-radius: 5px;
    margin: 0.5rem 0;
}

.add-ranking-card,
.add-achievement-card {
    height: 250px;
    min-height: 150px;
}

.add-ranking-card:hover,
.add-achievement-card:hover,
.add-funding-item:hover,
.add-career-item:hover,
.add-output-item:hover,
.add-gba-item:hover,
.add-hostel-item:hover,
.add-library-item:hover,
.add-library-stat-item:hover,
.add-sport-item:hover {
    background: rgba(118, 67, 147, 0.1);
    border-color: var(--classic-purple);
    transform: translateY(-2px);
}

.add-icon {
    font-size: 2rem;
    color: var(--dynamic-purple);
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.add-text {
    color: var(--classic-purple);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Map Control Styles */
.add-location-control button {
    background: var(--classic-purple);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    z-index: 0;
    transition: all 0.2s ease;
}

.add-location-control button:hover {
    background: var(--dynamic-purple);
    transform: translateY(-1px);
}

/* Popup Delete Button */
.delete-location-btn {
    position: static;
    background: #ff4757;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    margin-top: 8px;
    opacity: 1;
}

.delete-location-btn:hover {
    background: #ff3742;
}

/* GBA Timeline, Hostel Items, and Library Items Positioning */
.gba-item,
.hostel-category,
.library-item {
    position: relative;
}

.gba-item {
    background: white;
    border: 1px solid var(--cuhk-grey-light);
    border-radius: 5px;
    padding: 1.5rem;
    margin: 0.5rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.gba-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.gba-item.highlight {
    border-left: 4px solid var(--cuhk-dynamic-purple);
    background: linear-gradient(135deg, rgba(118, 67, 147, 0.05), rgba(125, 40, 130, 0.05));
}

/* Editable Content Styles */
.editable {
    transition: all 0.2s ease;
    border-radius: 3px;
    padding: 2px 4px;
    margin: 0 1px;
}

.editable:hover {
    background: rgba(118, 67, 147, 0.1);
    outline: 1px dashed var(--dynamic-purple);
}

.editable:focus {
    background: rgba(118, 67, 147, 0.15);
    outline: 2px solid var(--dynamic-purple);
}

/* Hostel specific editable styles */
.hostel-category .editable {
    display: inline-block;
    min-width: 50px;
}

.hostel-count.editable {
    font-size: 2rem;
    font-weight: bold;
    color: var(--classic-purple);
    text-align: center;
    min-width: 100px;
}

/* GBA Item Management Styles */
.gba-item {
    position: relative;
}

.add-gba-item {
    min-height: 80px;
    /* Override gba-item styles for add button */
    background: rgba(118, 67, 147, 0.05) !important;
    border: 2px dashed var(--dynamic-purple) !important;
    box-shadow: none !important;
}

.add-gba-item:hover {
    background: rgba(118, 67, 147, 0.1) !important;
    border-color: var(--classic-purple) !important;
    box-shadow: none !important;
}

/* Enhanced Greater Bay Area Section Styling */
#greater-bay-area.gba-section {
    background: #FFFFFF;
    position: relative;
}

#greater-bay-area.gba-section::before {
    display: none;
}

.gba-section .container {
    position: relative;
    z-index: 1;
}

/* Enhanced GBA Timeline */
.gba-timeline {
    position: relative;
    padding: 2rem 0 0.5rem;
}

.gba-source-note {
    margin-top: 0.25rem;
    font-size: 12px;
}

.gba-source-note p {
    font-size: 12px;
}

.gba-timeline-print {
    display: none;
}

/* Vertical line is now handled per-item using ::after for segments */

/* Enhanced GBA Items */
.gba-timeline .gba-item {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(255, 255, 255, 0.9) 100%);
    border: 1px solid rgba(118, 67, 147, 0.15);
    border-radius: 6px;
    padding: 2rem;
    margin: 2rem 0 2rem 5rem;
    box-shadow:
        0 8px 25px rgba(118, 67, 147, 0.08),
        0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative;
    backdrop-filter: blur(10px);
    transition: none;
}

.gba-timeline .gba-item:last-child,
.gba-timeline .gba-item:nth-last-child(2):has(~ .add-gba-item) {
    margin-bottom: 0;
}

.gba-timeline .gba-item::before {
    content: '';
    position: absolute;
    left: -3.5rem;
    top: 2.75rem;
    width: 12px;
    height: 12px;
    background: var(--dynamic-purple);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(118, 67, 147, 0.2);
    z-index: 2;
}

.gba-timeline .gba-item::after {
    content: '';
    position: absolute;
    left: calc(-3.5rem + 7.5px);
    top: 2.75rem;
    height: calc(100% + 2rem);
    width: 3px;
    background: var(--gradient-purple-vertical, var(--dynamic-purple));
    z-index: 1;
}

/* Hide line after last actual GBA data item */
.gba-timeline .gba-item:last-child::after,
.gba-timeline .gba-item:nth-last-child(2):has(~ .add-gba-item)::after {
    display: none;
}

/* Hide line and dot entirely for the "Add New GBA Item" button */
.gba-timeline .gba-item.add-gba-item::after,
.gba-timeline .gba-item.add-gba-item::before {
    display: none;
}

.gba-timeline .gba-item:hover {
    transform: none;
    box-shadow:
        0 8px 25px rgba(118, 67, 147, 0.08),
        0 2px 10px rgba(0, 0, 0, 0.05);
    border-color: rgba(118, 67, 147, 0.15);
}

.gba-timeline .gba-item:hover::before {
    background: var(--dynamic-purple);
    transform: none;
    box-shadow: 0 0 0 3px rgba(118, 67, 147, 0.2);
}

.gba-timeline .gba-item.highlight {
    border: 3px solid var(--cuhk-dynamic-purple, var(--dynamic-purple));
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(255, 255, 255, 0.9) 100%);
}

/* GBA Item Content Typography */
.gba-timeline .gba-item h3 {
    color: var(--classic-purple);
    font-weight: 600;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.gba-timeline .gba-item .year {
    display: inline-block;
    background: var(--gradient-purple-diagonal);
    color: var(--cuhk-white);
    padding: 0.3rem 0.8rem;
    border-radius: 7px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(118, 67, 147, 0.3);
}

.gba-timeline .gba-item p {
    color: var(--marble);
    line-height: 1.6;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.gba-timeline .gba-item .chinese {
    color: var(--royal-purple);
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.9;
}

/* Responsive Design for GBA Timeline */
@media (max-width: 768px) {
    .gba-timeline .gba-item {
        margin-left: 3rem;
        padding: 1.5rem;
    }

    .gba-timeline .gba-item::before {
        left: -2.5rem;
        top: 2.25rem;
    }

    .gba-timeline .gba-item::after {
        left: calc(-2.5rem + 7.5px);
        top: 2.25rem;
    }
}

@media (max-width: 480px) {
    /* GBA timeline line is kept visible - inherits ≤768px positioning */
}

/* View Mode - Disable all hover effects and edit functionality */
body.view-mode *:hover {
    transform: none !important;
}

body.view-mode .stat-item:hover {
    transform: none !important;
    background: inherit !important;
    box-shadow: none !important;
}

body.view-mode .achievement-card:hover,
body.view-mode .lab-card:hover {
    transform: none !important;
    box-shadow: inherit !important;
    border-color: inherit !important;
}

body.view-mode .achievement-card:hover .drag-handle {
    opacity: 0 !important;
}

body.view-mode .funding-legend-item:hover,
body.view-mode .global-stat:hover,
body.view-mode .faculty-item:hover,
body.view-mode .library-stat:hover,
body.view-mode .sport-item:hover {
    transform: none !important;
    background: inherit !important;
    box-shadow: none !important;
}

body.view-mode .lab-card:hover .delete-lab-btn {
    opacity: 0 !important;
}

body.view-mode .programme-item:hover .delete-btn {
    opacity: 0 !important;
    display: none !important;
}

body.view-mode .add-lab-card:hover {
    transform: none !important;
    background: inherit !important;
    border-color: inherit !important;
}

/* Disable contenteditable in view mode */
body.view-mode [contenteditable="true"] {
    pointer-events: none;
}

/* Disable drag handles in view mode */
body.view-mode .drag-handle {
    display: none !important;
}

/* Permission-based field restrictions (only in edit mode) */
body:not(.view-mode) [data-permission-disabled="true"] {
    cursor: not-allowed !important;
    opacity: 0.6 !important;
    background-color: #f5f5f5 !important;
    user-select: none;
}

body:not(.view-mode) [data-permission-disabled="true"]:hover {
    outline: 2px solid #ff9800;
    outline-offset: 2px;
}

/* In view mode, permission restrictions don't apply */
body.view-mode [data-permission-disabled="true"] {
    cursor: default !important;
    opacity: 1 !important;
    background-color: inherit !important;
}

/* Hide all delete buttons in view mode */
body.view-mode .delete-ranking-btn,
body.view-mode .delete-achievement-btn,
body.view-mode .delete-funding-btn,
body.view-mode .delete-career-btn,
body.view-mode .delete-lab-btn,
body.view-mode .delete-location-btn,
body.view-mode .delete-output-btn,
body.view-mode .delete-gba-btn,
body.view-mode .delete-hostel-btn,
body.view-mode .delete-library-btn,
body.view-mode .delete-library-stat-btn,
body.view-mode .delete-sport-btn,
body.view-mode .delete-achievement-btn,
body.view-mode .delete-btn,
body.view-mode .highlight-toggle-btn,
body.view-mode .add-location-control,
body.view-mode .add-achievement-card,
body.view-mode .delete-subject-group-btn,
body.view-mode .delete-subject-item-btn,
body.view-mode .add-subject-item-btn,
body.view-mode .add-subject-group-btn {
    display: none !important;
}

/* Disable edit hints and data-field interactions in view mode */
body.view-mode [data-field] {
    cursor: default !important;
    user-select: none !important;
}

/* Hide AI Editor floating toggle button in view mode */
body.view-mode .ai-editor-toggle {
    display: none !important;
}

/* Hide User Info toggle button in view mode */
body.view-mode .user-info-toggle {
    display: none !important;
}

/* Hide Section Visibility toggle button in view mode */
body.view-mode .section-visibility-toggle {
    display: none !important;
}

/* Hide Data Confirmation toggle button in view mode */
body.view-mode .data-confirm-toggle {
    display: none !important;
}

/* Hide Confirmations Review toggle button in view mode */
body.view-mode .confirmations-review-toggle {
    display: none !important;
}

/* Hide Email Reminder toggle button in view mode */
body.view-mode .email-reminder-toggle {
    display: none !important;
}

/* Hide Restricted Info toggle button in view mode */
body.view-mode .restricted-info-toggle {
    display: none !important;
}

/* Hide AI Editor panel in view mode */
body.view-mode .ai-editor {
    display: none !important;
}

/* Disable all editing-related pseudo-classes in view mode */
body.view-mode [data-field]:hover::after {
    display: none !important;
    content: none !important;
}

/* Prevent any edit-related tooltips or hints */
body.view-mode [data-field]:hover {
    position: relative;
}

body.view-mode [data-field]:hover::before,
body.view-mode [data-field]:not(.editing):hover::before {
    display: none !important;
    opacity: 0 !important;
}

/* Disable all data-field styling in view mode */
body.view-mode [data-field]:hover {
    background-color: transparent !important;
    border-radius: 0 !important;
}

/* Hide all "Add New" buttons and cards in view mode */
body.view-mode .add-ranking-card,
body.view-mode .add-achievement-card,
body.view-mode .add-lab-card,
body.view-mode .add-output-item,
body.view-mode .add-gba-item,
body.view-mode .add-hostel-item,
body.view-mode .add-library-item,
body.view-mode .add-library-stat-item,
body.view-mode .add-sport-item,
body.view-mode .add-career-item,
body.view-mode .add-funding-item,
body.view-mode .add-subject-item-btn,
body.view-mode .add-subject-group-btn {
    display: none !important;
}

/* Login Dialog Styles */
.login-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.login-dialog {
    background: white;
    padding: 2rem;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
}

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

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

.login-dialog-content h3 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.5rem;
}

.login-dialog-content p {
    margin: 0 0 1.5rem 0;
    color: #666;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.form-actions button {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-actions button[type="submit"] {
    background: #007bff;
    color: white;
}

.form-actions button[type="submit"]:hover {
    background: #0056b3;
}

.form-actions button[type="button"] {
    background: #6c757d;
    color: white;
}

.form-actions button[type="button"]:hover {
    background: #5a6268;
}

.login-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
    display: none;
}

.login-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.login-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.login-status.loading {
    background: #cce7ff;
    color: #004085;
    border: 1px solid #b3d7ff;
}

/* Enhanced Auth Button Styles */
.auth-login-btn {
    background: var(--gradient-purple-diagonal);
    color: rgb(255, 255, 255);
    border: none;
    border-radius: 5px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(118, 67, 147, 0.3);
    position: relative;
    overflow: hidden;
}

.auth-login-btn:hover {
    background: linear-gradient(135deg, var(--cuhk-royal-purple) 0%, var(--cuhk-dark-royal-purple) 100%);
    box-shadow: 0 6px 20px rgba(118, 67, 147, 0.4);
    transform: translateY(-2px);
}

.auth-login-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(118, 67, 147, 0.3);
}

.auth-login-btn:disabled {
    background: linear-gradient(135deg, var(--cuhk-silver) 0%, var(--cuhk-grey) 100%);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.auth-login-btn:disabled:hover {
    background: linear-gradient(135deg, var(--cuhk-silver) 0%, var(--cuhk-grey) 100%);
    box-shadow: none;
    transform: none;
}

.auth-cancel-btn {
    background: linear-gradient(135deg, var(--cuhk-silver) 0%, var(--cuhk-grey) 100%);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.2);
}

.auth-cancel-btn:hover {
    background: linear-gradient(135deg, var(--cuhk-grey) 0%, var(--cuhk-black) 100%);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
    transform: translateY(-1px);
}

.auth-cancel-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(108, 117, 125, 0.2);
}

/* Enhanced loading animation for login button */
.auth-login-btn.loading {
    background: var(--gradient-purple-gold-diagonal);
    position: relative;
}

.auth-login-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Mobile responsive for login dialog */
@media (max-width: 768px) {
    .login-dialog {
        padding: 1.5rem;
        margin: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button,
    .auth-login-btn,
    .auth-cancel-btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .auth-login-btn,
    .auth-cancel-btn {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }
}

/* Enhanced Copy Feedback Popup with Audit History */
.copy-feedback-popup {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 350px;
}

.copy-feedback-popup.enhanced {
    max-width: 400px;
}

.copy-success-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
}

.copy-icon {
    font-size: 1.1em;
}

.copy-message strong {
    color: #333;
    font-weight: 600;
}

.copy-field {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    color: #666;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    margin-top: 4px;
    word-break: break-all;
}

.audit-history-section {
    margin-top: 8px;
}

.audit-history-header {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.audit-no-history {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 8px;
}

.audit-history-list {
    max-height: 200px;
    overflow-y: auto;
}

.audit-history-item {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.audit-history-item.latest {
    background: #f9f9f9;
    margin: -4px -6px 4px -6px;
    padding: 10px 6px;
    border-radius: 3px;
    border-left: 3px solid #7B5BA1;
}

.audit-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.audit-date {
    font-size: 0.75rem;
    color: #666;
}

.audit-user {
    font-size: 0.75rem;
    color: #333;
    font-weight: 500;
}

.audit-action {
    font-size: 0.8rem;
    color: #555;
    margin-bottom: 4px;
}

.audit-change {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

.audit-change .old-value {
    color: #d73a49;
    background: #ffeef0;
    padding: 2px 4px;
    border-radius: 2px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.audit-change .new-value {
    color: #28a745;
    background: #e6f9ea;
    padding: 2px 4px;
    border-radius: 2px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.audit-change .arrow {
    color: #999;
}

/* Responsive design for copy feedback popup */
@media (max-width: 768px) {
    .copy-feedback-popup {
        max-width: 300px;
        font-size: 0.8rem;
    }

    .copy-feedback-popup.enhanced {
        max-width: 320px;
    }

    .audit-history-list {
        max-height: 150px;
    }
}

/* ========================================
   RESPONSIVE TYPOGRAPHY
   Scales font sizes for tablets and mobile
   ======================================== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    :root {
        --font-size-main-title: 2.5rem;
        /* 40px */
        --font-size-h2: 2rem;
        /* 32px */
        --font-size-h3: 1.375rem;
        /* 22px */
        --font-size-key-figures: 2rem;
        /* 32px */
        --font-size-labels: 1rem;
        /* 16px */
    }

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

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

/* Mobile (up to 768px) */
@media (max-width: 768px) {
    :root {
        --font-size-main-title: 2rem;
        /* 32px */
        --font-size-h2: 1.8rem;
        /* 28px */
        --font-size-h3: 1.25rem;
        /* 20px */
        --font-size-key-figures: 1.75rem;
        /* 28px */
        --font-size-labels: 0.9375rem;
        /* 15px */
        --font-size-body: 0.9375rem;
        /* 15px */
        --font-size-subtext: 0.8125rem;
        /* 13px */
    }

    .hero-content {
        padding: 4rem 2rem 3rem;
        text-align: center;
    }

    .hero-title {
        color: #FFF;
        font-family: 'Inter', sans-serif;
        font-size: 45.408px;
        font-style: normal;
        font-weight: 300;
        line-height: 45.408px;
        letter-spacing: -1.816px;
        text-align: center;
        margin-bottom: 1.5rem;
    }

    .hero-title .ampersand {
        color: #FFF;
        font-family: 'Roboto', sans-serif;
        font-size: 45.408px;
        font-style: normal;
        font-weight: 100;
        line-height: 45.408px;
    }

    .hero-title-line {
        display: block;
    }

    .hero-subtitle {
        font-size: 1.25rem;
        text-align: center;
    }


}

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
    :root {
        --font-size-main-title: 1.75rem;
        /* 28px */
        --font-size-h2: 1.375rem;
        /* 22px */
        --font-size-h3: 1.125rem;
        /* 18px */
        --font-size-key-figures: 1.5rem;
        /* 24px */
        --font-size-labels: 0.875rem;
        /* 14px */
        --font-size-body: 0.875rem;
        /* 14px */
        --font-size-subtext: 0.75rem;
        /* 12px */
    }

    .hero-content {
        padding: 5rem 2rem 3.5rem;
        text-align: center;
    }

    .hero-title {
        color: #FFF;
        font-family: 'Inter', sans-serif;
        font-size: 45.408px;
        font-style: normal;
        font-weight: 300;
        line-height: 45.408px;
        letter-spacing: -1.816px;
        text-align: center;
        margin-bottom: 2rem;
    }

    .hero-title-line {
        display: block;
    }

    .hero-subtitle {
        font-size: 1.25rem;
        text-align: center;
        letter-spacing: 0.1em;
    }

    .hero-title .ampersand {
        color: #FFF;
        font-family: 'Roboto', sans-serif;
        font-size: 45.408px;
        font-style: normal;
        font-weight: 100;
        line-height: 45.408px;
    }

    .hero-pattern {
        height: 75px;
        margin-bottom: -2px;
    }

}



/* Tablet/iPad Specific Fix for Hero Pattern Gap */
@media (min-width: 481px) and (max-width: 1024px) {
    .hero-pattern {
        margin-bottom: -6px;
    }
}

/* Mobile Alignment Fix for Last Updated Component */
@media (max-width: 768px) {
    .section-header {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "title print"
            "update update";
        gap: 0.5rem;
    }

    .section-title {
        grid-area: title;
        margin-bottom: 0;
    }

    .section-print-btn {
        grid-area: print;
    }

    .section-last-updated {
        grid-area: update;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        justify-content: flex-start;
        /* Left align text */
        margin-bottom: 1.5rem;
    }

    .rankings-grid .ranking-card:first-child {
        margin-bottom: 0;
    }
}

/* ============================================================
   STATIC SITE MODE STYLES
   ============================================================
   When the site is in static mode, interactive elements are hidden
   and editable fields lose their interactive styling.
   ============================================================ */

/* Hide all interactive UI elements in static mode */
body.static-site-mode #ai-editor-toggle,
body.static-site-mode #ai-editor,
body.static-site-mode #user-info-toggle,
body.static-site-mode #user-info-panel,
body.static-site-mode #data-confirm-toggle,
body.static-site-mode #data-confirm-modal,
body.static-site-mode #confirmations-review-toggle,
body.static-site-mode #confirmations-review-modal,
body.static-site-mode #email-reminder-toggle,
body.static-site-mode #email-reminder-modal,
body.static-site-mode #section-visibility-toggle,
body.static-site-mode #section-visibility-panel,
body.static-site-mode #restricted-info-toggle,
body.static-site-mode #restricted-info-modal,
body.static-site-mode .view-mode-btn,
body.static-site-mode .publish-panel,
body.static-site-mode .realtime-active-users,
body.static-site-mode .login-dialog-overlay {
    display: none !important;
}

/* Remove editable styling in static mode */
body.static-site-mode .editable,
body.static-site-mode .static-content {
    cursor: default !important;
    border-bottom: none !important;
}

/* Only remove background from inline editable text, not styled elements like .year */
body.static-site-mode .editable:not(.year):not(.ranking-position):not(.achievement-number),
body.static-site-mode .static-content:not(.year):not(.ranking-position):not(.achievement-number) {
    background: transparent !important;
}

body.static-site-mode .editable:hover,
body.static-site-mode .static-content:hover {
    border-color: transparent !important;
}

body.static-site-mode .editable:not(.year):not(.ranking-position):not(.achievement-number):hover,
body.static-site-mode .static-content:not(.year):not(.ranking-position):not(.achievement-number):hover {
    background: transparent !important;
}

/* Remove any edit indicators */
body.static-site-mode [data-field]::after {
    display: none !important;
}

/* Hide add/remove buttons in static mode */
body.static-site-mode .add-btn,
body.static-site-mode .remove-btn,
body.static-site-mode .add-programme-section,
body.static-site-mode .add-achievement-card,
body.static-site-mode .add-ranking-card,
body.static-site-mode .delete-ranking,
body.static-site-mode .delete-achievement,
body.static-site-mode [data-action="add-achievement-category"],
body.static-site-mode [data-action*="add"],
body.static-site-mode [onclick*="add"],
body.static-site-mode .delete-subject-group-btn,
body.static-site-mode .delete-subject-item-btn,
body.static-site-mode .add-subject-item-btn,
body.static-site-mode .add-subject-group-btn {
    display: none !important;
}

/* Hide drag handles in static mode */
body.static-site-mode .drag-handle,
body.static-site-mode [draggable="true"] {
    cursor: default !important;
}

/* Keep print buttons visible and functional */
body.static-site-mode .print-btn,
body.static-site-mode .section-print-btn {
    display: flex !important;
}

@media (max-width: 768px) {
    .section-header {
        grid-template-columns: 1fr auto auto;
        grid-template-areas:
            "title print ai-print"
            "update update update";
    }

    .ai-section-print-btn {
        grid-area: ai-print;
        margin-left: 0;
    }
}

/* Floating Controls Container */
.floating-controls {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1490;
    display: flex;
    flex-direction: column-reverse;
    /* Stack from bottom up */
    gap: 0.75rem;
    pointer-events: none;
    /* Layout container shouldn't block clicks */
    align-items: flex-end;
}

.floating-controls>* {
    pointer-events: auto;
    /* Buttons are clickable */
    /* Ensure no residual fixed positioning affects layout */
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    margin: 0 !important;
    /* Reset margins */
    flex: 0 0 auto;
}

.floating-controls>.chinese-override-toggle {
    width: 60px;
    height: 60px;
}

.floating-controls>.chinese-override-toggle i {
    font-size: 1.5rem;
}

body.printing-section .floating-controls,
body.printing-all-sections .floating-controls,
body.printing-section .active-users-toggle,
body.printing-all-sections .active-users-toggle,
body.printing-section .active-users-panel,
body.printing-all-sections .active-users-panel {
    display: none !important;
}

/* Floating controls tooltips */
.floating-controls>*[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background-color: var(--primary-color, #7030a0);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: inherit;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    transform-origin: right center;
    z-index: 1000;
}

.floating-controls>*[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

/* Specific handling for user-info-wrapper interactions */
.user-info-toggle {
    /* Ensure flex behavior for centering icon and relative context */
    position: relative !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .floating-controls {
        bottom: 1rem;
        right: 1rem;
        gap: 0.6rem;
    }

    .floating-controls>.ai-editor-toggle,
    .floating-controls>.user-guide-toggle,
    .floating-controls>.user-info-toggle,
    .floating-controls>.chinese-override-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .floating-controls>.user-info-toggle i,
    .floating-controls>.chinese-override-toggle i {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .floating-controls {
        bottom: 0.75rem;
        right: 0.75rem;
        gap: 0.5rem;
    }

    .floating-controls>.ai-editor-toggle,
    .floating-controls>.user-guide-toggle,
    .floating-controls>.user-info-toggle,
    .floating-controls>.chinese-override-toggle {
        width: 46px;
        height: 46px;
        font-size: 1.1rem;
    }
}

/* Library card rules are defined with the facilities section styles above. */
