/* ============================================================
   CUHK Sports Medicine - Patient Rehabilitation Tracking
   Main Stylesheet
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --cuhk-purple: #4e2a84;
    --cuhk-purple-dark: #3a1f63;
    --cuhk-purple-light: #7b5ea7;
    --cuhk-purple-pale: #f3f0f9;
    --cuhk-gold: #c8a951;
    --cuhk-gold-light: #f0e0a0;

    --blue-accent: #2563eb;
    --blue-light: #eff6ff;
    --green-accent: #16a34a;
    --green-light: #f0fdf4;
    --orange-accent: #ea580c;
    --orange-light: #fff7ed;
    --red-accent: #dc2626;
    --red-light: #fef2f2;

    --text-primary: #1e1b2e;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --bg-page: #f5f4f8;
    --bg-white: #ffffff;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(78,42,132,0.1);
    --shadow-lg: 0 8px 32px rgba(78,42,132,0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --transition: all 0.25s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
    color: var(--text-primary);
    background: var(--bg-page);
    line-height: 1.6;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* --- Language Switcher (Login Page) --- */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lang-btn {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.4);
    color: rgba(255,255,255,0.8);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    transition: var(--transition);
}

.lang-btn:hover,
.lang-btn.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-color: rgba(255,255,255,0.8);
}

.lang-divider { color: rgba(255,255,255,0.4); font-size: 0.75rem; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    background: linear-gradient(135deg, var(--cuhk-purple-dark) 0%, var(--cuhk-purple) 50%, var(--cuhk-purple-light) 100%);
    overflow: hidden;
}

.login-page .lang-switcher {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 100;
}

.login-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 10;
}

/* Left Brand Panel */
.login-brand-panel {
    flex: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 48px;
    color: #fff;
}

.brand-content {
    max-width: 420px;
    width: 100%;
}

.cuhk-logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 36px;
}

.cuhk-emblem {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.emblem-icon { font-size: 1.8rem; color: var(--cuhk-gold); }

.univ-name-zh {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #fff;
}

.univ-name-en {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.7);
    margin-top: 2px;
}

.dept-title { margin-bottom: 40px; }

.dept-title h1 {
    font-size: 1.9rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    margin-bottom: 8px;
}

.dept-title h2 {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--cuhk-gold);
    letter-spacing: 0.06em;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    color: rgba(255,255,255,0.9);
    font-size: 0.9rem;
}

.feature-item i {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.12);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cuhk-gold);
    flex-shrink: 0;
    font-size: 0.85rem;
}

.brand-footer-text {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 20px;
}

/* Right Form Panel */
.login-form-panel {
    flex: 1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    box-shadow: -20px 0 60px rgba(0,0,0,0.15);
}

.login-form-container {
    width: 100%;
    max-width: 400px;
}

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

.login-icon {
    width: 72px;
    height: 72px;
    background: var(--cuhk-purple-pale);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.login-icon i { font-size: 2rem; color: var(--cuhk-purple); }

.login-header h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

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

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group label i { color: var(--cuhk-purple); font-size: 0.85rem; }

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: #fff;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--cuhk-purple);
    box-shadow: 0 0 0 3px rgba(78,42,132,0.1);
}

.form-control[readonly] { background: #f9fafb; color: var(--text-secondary); }

.input-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--cuhk-purple), var(--cuhk-purple-light));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(78,42,132,0.4);
}

.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--cuhk-purple-pale);
    color: var(--cuhk-purple);
    border: 1.5px solid var(--cuhk-purple-light);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--cuhk-purple);
    color: #fff;
}

.btn-login { width: 100%; padding: 14px; font-size: 1rem; margin-top: 8px; }

/* Alerts */
.alert-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: var(--red-light);
    border: 1px solid #fca5a5;
    border-radius: var(--radius-sm);
    color: var(--red-accent);
    font-size: 0.88rem;
    margin-bottom: 16px;
}

.alert-success {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: var(--green-light);
    border: 1px solid #86efac;
    border-radius: var(--radius-sm);
    color: var(--green-accent);
    font-size: 0.88rem;
    margin-bottom: 16px;
}

/* Demo Info */
.login-demo-info {
    margin-top: 28px;
    padding: 16px;
    background: var(--cuhk-purple-pale);
    border-radius: var(--radius-md);
    border: 1px dashed var(--cuhk-purple-light);
}

.demo-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--cuhk-purple);
    margin-bottom: 10px;
}

.demo-accounts { display: flex; gap: 8px; flex-wrap: wrap; }

.demo-code {
    padding: 6px 14px;
    background: #fff;
    border: 1.5px solid var(--cuhk-purple-light);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cuhk-purple);
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Courier New', monospace;
}

.demo-code:hover { background: var(--cuhk-purple); color: #fff; }

.login-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Background Decoration */
.bg-decoration {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.deco-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}

.deco-1 { width: 500px; height: 500px; top: -200px; left: -100px; }
.deco-2 { width: 300px; height: 300px; bottom: -100px; left: 20%; }
.deco-3 { width: 200px; height: 200px; top: 30%; left: 40%; }

/* ============================================================
   TOP NAVIGATION (Questionnaire & Dashboard)
   ============================================================ */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, var(--cuhk-purple-dark), var(--cuhk-purple));
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

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

.nav-logo-icon {
    font-size: 1.4rem;
    color: var(--cuhk-gold);
}

.nav-title-block { display: flex; flex-direction: column; }

.nav-title-main {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.nav-title-sub {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.65);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-lang { flex-shrink: 0; }

.nav-patient-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.12);
    padding: 6px 14px;
    border-radius: 20px;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.85);
    border-radius: 20px;
    font-size: 0.82rem;
    transition: var(--transition);
}

.btn-logout:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* ============================================================
   QUESTIONNAIRE PAGE
   ============================================================ */
.q-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, var(--cuhk-purple), var(--cuhk-purple-light));
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    color: #fff;
    box-shadow: var(--shadow-md);
}

.welcome-content { display: flex; align-items: center; gap: 16px; }

.welcome-avatar {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.2);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.welcome-text h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; }
.welcome-text p { font-size: 0.82rem; color: rgba(255,255,255,0.75); }

.btn-history {
    background: rgba(255,255,255,0.15) !important;
    border-color: rgba(255,255,255,0.4) !important;
    color: #fff !important;
    font-size: 0.82rem !important;
    padding: 8px 16px !important;
    white-space: nowrap;
}

.btn-history:hover { background: rgba(255,255,255,0.25) !important; }

/* Q Card */
.q-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.q-card-header {
    background: linear-gradient(135deg, var(--cuhk-purple-pale), #fff);
    padding: 24px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1.5px solid var(--border-color);
}

.q-header-icon {
    width: 48px;
    height: 48px;
    background: var(--cuhk-purple);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.q-header-text h3 { font-size: 1.1rem; font-weight: 700; color: var(--cuhk-purple-dark); }
.q-header-text p { font-size: 0.82rem; color: var(--text-secondary); margin-top: 3px; }

/* Progress Steps */
.q-progress {
    padding: 20px 28px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
}

.progress-steps {
    display: flex;
    align-items: center;
    gap: 0;
}

.p-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.p-step-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    transition: var(--transition);
}

.p-step.active .p-step-circle {
    background: var(--cuhk-purple);
    color: #fff;
}

.p-step span {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

.p-step.active span { color: var(--cuhk-purple); font-weight: 600; }

.p-step-line {
    flex: 1;
    height: 2px;
    background: var(--border-color);
    margin-bottom: 18px;
    max-width: 40px;
}

/* Q Sections */
.q-section {
    padding: 28px;
    border-bottom: 1px solid var(--border-color);
}

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

.section-num {
    width: 28px;
    height: 28px;
    background: var(--cuhk-purple);
    color: #fff;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.section-title h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--cuhk-purple-dark);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.required { color: var(--red-accent); font-size: 0.85rem; }

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

.textarea-sm { min-height: 70px !important; }

/* Training Counter */
.training-counter {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.counter-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--cuhk-purple-pale);
    border: 2px solid var(--cuhk-purple-light);
    color: var(--cuhk-purple);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.counter-btn:hover { background: var(--cuhk-purple); color: #fff; border-color: var(--cuhk-purple); }

.counter-display {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 160px;
    background: var(--cuhk-purple-pale);
    padding: 8px 16px;
    border-radius: 12px;
    border: 2px solid var(--cuhk-purple-light);
}

.counter-input {
    width: 60px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--cuhk-purple);
    outline: none;
}

.counter-input::-webkit-inner-spin-button,
.counter-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.counter-unit { font-size: 0.85rem; color: var(--text-secondary); font-weight: 600; }

.quick-select-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.quick-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.quick-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-page);
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
}

.quick-btn:hover,
.quick-btn.active {
    background: var(--cuhk-purple);
    color: #fff;
    border-color: var(--cuhk-purple);
}

/* VAS Scale */
.vas-info-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: var(--blue-light);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: #1e40af;
    margin-bottom: 24px;
    line-height: 1.5;
}

.vas-scale-container {
    background: var(--bg-page);
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1.5px solid var(--border-color);
}

.vas-face-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.vas-face {
    font-size: 1.8rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    user-select: none;
    flex: 1;
    text-align: center;
}

.vas-slider-wrapper { margin-bottom: 8px; }

.vas-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background: linear-gradient(to right, #16a34a, #fbbf24, #dc2626);
}

.vas-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--cuhk-purple);
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.15s;
}

.vas-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }

.vas-track-labels {
    display: flex;
    justify-content: space-between;
    padding: 6px 4px 0;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.vas-score-display {
    text-align: center;
    padding: 16px;
    margin: 16px 0;
    background: #fff;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.vas-score-number {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    color: var(--cuhk-purple);
    transition: color 0.3s;
}

.vas-score-label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 6px;
    transition: color 0.3s;
}

.vas-buttons {
    display: flex;
    gap: 6px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.vas-btn {
    flex: 1;
    min-width: 0;
    padding: 8px 0;
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    background: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
}

.vas-btn:hover { background: var(--cuhk-purple-pale); border-color: var(--cuhk-purple); color: var(--cuhk-purple); }
.vas-btn.active { background: var(--cuhk-purple); color: #fff; border-color: var(--cuhk-purple); }

.vas-extremes {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

.vas-min { color: var(--green-accent); font-weight: 600; }
.vas-max { color: var(--red-accent); font-weight: 600; }

/* Feeling Options */
.feeling-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.feeling-opt {
    flex: 1;
    min-width: 80px;
    padding: 14px 8px;
    background: var(--bg-page);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.feeling-opt:hover { border-color: var(--cuhk-purple-light); background: var(--cuhk-purple-pale); }

.feeling-opt.active {
    border-color: var(--cuhk-purple);
    background: var(--cuhk-purple-pale);
    box-shadow: 0 0 0 3px rgba(78,42,132,0.12);
}

.feeling-emoji { font-size: 1.8rem; margin-bottom: 6px; }

.feeling-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.feeling-opt.active .feeling-label { color: var(--cuhk-purple); }

/* Submit Area */
.submit-area {
    padding: 28px;
    text-align: center;
}

.btn-submit {
    padding: 16px 48px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 20px;
}

.success-icon { background: var(--green-light); color: var(--green-accent); }

.modal-box h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }
.modal-box p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 24px; }

.modal-buttons { display: flex; gap: 12px; justify-content: center; }

/* ============================================================
   DASHBOARD PAGE
   ============================================================ */
.dash-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

.dash-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.dash-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #fff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-back:hover { border-color: var(--cuhk-purple); color: var(--cuhk-purple); }

.dash-header-left h2 { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); }
.dash-header-left p { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; }

.btn-new-record { white-space: nowrap; }

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stat-blue { background: var(--blue-light); color: var(--blue-accent); }
.stat-green { background: var(--green-light); color: var(--green-accent); }
.stat-orange { background: var(--orange-light); color: var(--orange-accent); }
.stat-purple { background: var(--cuhk-purple-pale); color: var(--cuhk-purple); }

.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

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

.chart-card-header h4 { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); }

.chart-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.vas-badge { background: var(--orange-light); color: var(--orange-accent); }
.train-badge { background: var(--green-light); color: var(--green-accent); }

/* Records Table */
.records-card {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.records-card-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
}

.records-card-header h4 { font-size: 0.95rem; font-weight: 700; }

.records-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    gap: 4px;
}

.records-count span:nth-child(2) { font-weight: 700; color: var(--cuhk-purple); }

.loading-state, .empty-state {
    padding: 60px 24px;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loading-state i, .empty-state i { font-size: 2.5rem; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

.records-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.records-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #f9fafb;
    border-bottom: 1.5px solid var(--border-color);
    white-space: nowrap;
}

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

.records-table tr:last-child td { border-bottom: none; }
.records-table tr:hover td { background: var(--cuhk-purple-pale); }

.vas-badge-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.9rem;
}

.vas-0-3 { background: #dcfce7; color: #16a34a; }
.vas-4-6 { background: #fef9c3; color: #ca8a04; }
.vas-7-10 { background: #fee2e2; color: #dc2626; }

.feeling-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .login-brand-panel { display: none; }
    .login-form-panel { flex: 1; padding: 40px 24px; }
    .login-form-panel { border-radius: 0; }
    .login-page .lang-switcher .lang-btn { color: var(--cuhk-purple); border-color: var(--cuhk-purple-light); }
    .login-page .lang-switcher .lang-btn.active { background: var(--cuhk-purple); color: #fff; }
    .login-page .lang-switcher .lang-divider { color: var(--text-muted); }

    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .charts-row { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .feeling-options { gap: 8px; }
    .feeling-opt { min-width: 60px; padding: 10px 4px; }
    .vas-buttons { gap: 4px; }
    .vas-btn { padding: 6px 0; font-size: 0.78rem; }
}

@media (max-width: 600px) {
    .top-nav { padding: 0 16px; }
    .nav-patient-info { display: none; }
    .nav-title-sub { display: none; }
    .q-section { padding: 20px 16px; }
    .submit-area { padding: 20px 16px; }
    .q-card-header { padding: 18px 16px; }
    .q-progress { padding: 16px; }
    .training-counter { gap: 10px; }
    .welcome-banner { flex-direction: column; align-items: flex-start; gap: 12px; }
    .stats-row { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 1.3rem; }
    .dash-header { flex-direction: column; align-items: stretch; }
    .dash-header-left { flex-wrap: wrap; }
    .btn-new-record { width: 100%; justify-content: center; }
    .modal-buttons { flex-direction: column; }
    .modal-buttons button { width: 100%; justify-content: center; }
    .p-step span { display: none; }
}
