@charset "UTF-8";

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button, input {
    overflow: visible;
}

button, select {
    text-transform: none;
}

button::-moz-focus-inner,
input::-moz-focus-inner {
    border: 0;
    padding: 0;
}

::-webkit-input-placeholder { color: #aaa; }
::-moz-placeholder { color: #aaa; opacity: 1; }
::placeholder { color: #aaa; }

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    padding-left: calc(20px + var(--safe-left));
    padding-right: calc(20px + var(--safe-right));
    padding-bottom: calc(40px + var(--safe-bottom));
}

.container-wide {
    max-width: 1100px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 28px;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.subtitle {
    color: #666;
    font-size: 16px;
}

/* Upload Section */
.upload-section {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-top: 24px;
}

.upload-area {
    border: 2px dashed #d0d5dd;
    border-radius: 8px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #4a6cf7;
    background: #f8f9ff;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.upload-text {
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 13px;
    color: #999;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 16px;
    background: #f8f9ff;
    border-radius: 8px;
    font-size: 14px;
}

.file-info #fileName {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-info #fileSize {
    color: #666;
}

.btn-clear {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

.btn-clear:hover {
    color: #e74c3c;
}

/* Question Source */
.question-source {
    margin-top: 20px;
    padding: 16px 20px;
    background: #fafbfc;
    border: 1px solid #eef0f5;
    border-radius: 8px;
}

.question-source h3 {
    font-size: 15px;
    color: #1a1a2e;
    margin-bottom: 12px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.15s;
}

.radio-option:hover {
    background: #f0f2f5;
}

.radio-option input[type="radio"] {
    accent-color: #4a6cf7;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.radio-label {
    font-size: 14px;
    color: #333;
}

.manual-question {
    margin-top: 12px;
}

.manual-question textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    line-height: 1.5;
    transition: border-color 0.2s;
}

.manual-question textarea:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

.manual-question textarea::placeholder {
    color: #aaa;
}

.btn-submit {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    background: #4a6cf7;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover:not(:disabled) {
    background: #3a5ce5;
}

.btn-submit:disabled {
    background: #c0c8e0;
    cursor: not-allowed;
}

/* Progress Section */
.progress-section {
    background: #fff;
    border-radius: 12px;
    padding: 48px 32px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e8ecf1;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a6cf7, #6c8cff);
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    color: #555;
    font-size: 15px;
    margin-bottom: 24px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e8ecf1;
    border-top-color: #4a6cf7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

/* Result Section */
.result-section {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.result-section h2 {
    text-align: center;
    font-size: 22px;
    color: #1a1a2e;
    margin-bottom: 28px;
}

.last-eval-time {
    text-align: center;
    color: #999;
    font-size: 13px;
    margin-top: -20px;
    margin-bottom: 20px;
}

.warnings {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 24px;
    font-size: 14px;
    color: #7a6200;
}

.warnings p {
    margin: 4px 0;
}

/* Question Info */
.question-info {
    background: #f0f4ff;
    border: 1px solid #c8d6f7;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.question-info h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.question-info p {
    font-size: 15px;
    color: #1a1a2e;
    font-weight: 500;
    margin-bottom: 10px;
}

.candidate-info {
    margin-bottom: 10px;
}

.candidate-info p {
    font-size: 13px;
    color: #4a6cf7;
    font-weight: 400;
    background: #e8edff;
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    margin-bottom: 6px;
}

.time-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.time-tag {
    display: inline-block;
    padding: 3px 10px;
    background: #e0e7ff;
    border-radius: 12px;
    font-size: 12px;
    color: #4a6cf7;
}

/* Total Score */
.total-score {
    text-align: center;
    margin-bottom: 32px;
}

.score-circle {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
}

.score-number {
    font-size: 56px;
    font-weight: 700;
    color: #4a6cf7;
}

.score-max {
    font-size: 20px;
    color: #999;
}

.score-label {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

.score-grade {
    font-size: 18px;
    font-weight: 600;
    color: #4a6cf7;
    margin-top: 4px;
}

.score-weight {
    font-size: 12px;
    color: #999;
    font-weight: 400;
}

/* Score Cards */
.scores-grid {
    display: grid;
    grid-gap: 16px;
    gap: 16px;
    margin-bottom: 28px;
}

.score-card {
    padding: 16px;
    border: 1px solid #eef0f5;
    border-radius: 8px;
}

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

.score-value-group {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.score-prev-inline {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
}

.score-name {
    font-weight: 600;
    font-size: 15px;
}

.score-value {
    font-weight: 700;
    color: #4a6cf7;
    font-size: 15px;
}

.score-bar-bg {
    height: 6px;
    background: #e8ecf1;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.score-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a6cf7, #6c8cff);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.score-comment {
    font-size: 13px;
    color: #666;
}

/* 总分历史对比 */
.prev-total-scores {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
}

.prev-total-tag {
    font-size: 12px;
    color: #888;
    background: #f5f6fa;
    padding: 3px 10px;
    border-radius: 10px;
}

/* Overall Comment */
.overall-comment {
    background: #f8f9ff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.overall-comment h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #1a1a2e;
}

.overall-comment p {
    font-size: 14px;
    color: #555;
}

/* Mindmap Section */
.mindmap-section {
    background: #f8f9ff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.mindmap-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #1a1a2e;
}

.mindmap {
    display: flex;
    align-items: flex-start;
    gap: 0;
    overflow-x: auto;
}

.mindmap-root {
    flex-shrink: 0;
    background: #4f6ef7;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 18px;
    border-radius: 8px;
    margin-right: 24px;
    align-self: center;
    white-space: nowrap;
}

.mindmap-branches {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    padding-left: 20px;
    border-left: 2px solid #c5cee0;
}

.mindmap-branch {
    position: relative;
    padding-left: 16px;
}

.mindmap-branch::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 12px;
    width: 20px;
    height: 0;
    border-top: 2px solid #c5cee0;
}

.mindmap-branch-label {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e6b;
    padding: 6px 14px;
    background: #e8eeff;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: 4px;
}

.mindmap-points {
    list-style: none;
    padding-left: 18px;
    margin: 4px 0 0;
}

.mindmap-points li {
    font-size: 13px;
    color: #555;
    line-height: 1.7;
    position: relative;
    padding-left: 12px;
}

.mindmap-points li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 5px;
    height: 5px;
    background: #8ea4d2;
    border-radius: 50%;
}

/* Feedback Columns */
.feedback-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 16px;
    gap: 16px;
    margin-bottom: 24px;
}

.strengths, .improvements {
    padding: 16px;
    border-radius: 8px;
}

.strengths {
    background: #f0faf0;
    border: 1px solid #c8e6c9;
}

.improvements {
    background: #fff8e1;
    border: 1px solid #ffe082;
}

.strengths h3 {
    color: #2e7d32;
    font-size: 15px;
    margin-bottom: 8px;
}

.improvements h3 {
    color: #f57f17;
    font-size: 15px;
    margin-bottom: 8px;
}

.strengths ul, .improvements ul {
    list-style: none;
    padding: 0;
}

.strengths li, .improvements li {
    font-size: 13px;
    padding: 4px 0;
    color: #555;
}

.strengths li::before {
    content: "\2022 ";
    color: #4caf50;
    font-weight: bold;
}

.improvements li::before {
    content: "\2022 ";
    color: #ff9800;
    font-weight: bold;
}

/* Detail Blocks */
.detail-block {
    margin-bottom: 12px;
    border: 1px solid #eef0f5;
    border-radius: 8px;
    overflow: hidden;
}

.detail-block summary {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    background: #fafbfc;
    -webkit-user-select: none;
    user-select: none;
}

.detail-block summary:hover {
    background: #f0f2f5;
}

.detail-content {
    padding: 16px;
    font-size: 13px;
    color: #555;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

/* Error Section */
.error-section {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

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

.error-box h3 {
    color: #e74c3c;
    font-size: 20px;
    margin-bottom: 12px;
}

.error-box p {
    color: #555;
    margin-bottom: 8px;
}

#errorDetails {
    text-align: left;
    background: #fef2f2;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 13px;
    color: #b71c1c;
}

#errorDetails:empty {
    display: none;
}

/* Navigation Bar */
.top-nav {
    background: #1a1a2e;
    padding: 12px 0;
    padding-top: calc(12px + var(--safe-top));
    position: relative;
    z-index: 1000;
}

.nav-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    padding-left: calc(20px + var(--safe-left));
    padding-right: calc(20px + var(--safe-right));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-wide {
    max-width: 1100px;
}

.nav-brand {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
}

.nav-brand:hover {
    color: #e0e7ff;
}

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

.nav-link {
    color: #ccc;
    text-decoration: none;
    font-size: 14px;
}

.nav-link:hover {
    color: #fff;
}

.nav-user {
    color: #6c8cff;
    font-size: 14px;
}

/* Hamburger Toggle (hidden on desktop) */
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle-bars {
    position: relative;
    width: 18px;
    height: 2px;
    background: #fff;
    transition: background 0.2s;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: #fff;
    transition: transform 0.2s;
}

.nav-toggle-bars::before { transform: translateY(-6px); }
.nav-toggle-bars::after  { transform: translateY(6px); }

.top-nav.nav-open .nav-toggle-bars {
    background: transparent;
}

.top-nav.nav-open .nav-toggle-bars::before {
    transform: translateY(0) rotate(45deg);
}

.top-nav.nav-open .nav-toggle-bars::after {
    transform: translateY(0) rotate(-45deg);
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 20px;
}

.flash-msg {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 14px;
}

/* Login Form */
.login-section {
    background: #fff;
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    max-width: 400px;
    margin: 60px auto;
}

.login-section h2 {
    text-align: center;
    margin-bottom: 24px;
    color: #1a1a2e;
    font-size: 22px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

.login-toggle {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: #666;
}

.login-toggle a {
    color: #4a6cf7;
    text-decoration: none;
}

.login-toggle a:hover {
    text-decoration: underline;
}

/* Role Tabs (Registration) */
.role-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #d0d5dd;
}

.role-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: #fafbfc;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: #666;
    transition: background 0.2s, color 0.2s;
    font-family: inherit;
}

.role-tab:first-child {
    border-right: 1px solid #d0d5dd;
}

.role-tab.active {
    background: #4a6cf7;
    color: #fff;
}

.role-tab:hover:not(.active) {
    background: #f0f2f5;
}

/* Pending Page */
.pending-section {
    background: #fff;
    border-radius: 12px;
    padding: 60px 32px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    max-width: 500px;
    margin: 60px auto;
    text-align: center;
}

.pending-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.pending-section h2 {
    font-size: 22px;
    color: #1a1a2e;
    margin-bottom: 12px;
}

.pending-section p {
    color: #555;
    font-size: 15px;
    margin-bottom: 8px;
}

.pending-hint {
    color: #999 !important;
    font-size: 13px !important;
}

/* Admin Code Page */
.code-result {
    background: #f0faf0;
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.code-result p {
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
}

.generated-code {
    font-size: 28px;
    font-weight: 700;
    color: #2e7d32;
    letter-spacing: 2px;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
    border: 2px dashed #c8e6c9;
    margin: 12px 0;
    -webkit-user-select: all;
    user-select: all;
}

.code-hint {
    font-size: 12px !important;
    color: #999 !important;
}

/* ========== Teacher Dashboard ========== */
.dashboard {
    max-width: 100%;
}

.dashboard h2 {
    font-size: 22px;
    color: #1a1a2e;
    margin-bottom: 24px;
}

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

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #4a6cf7;
}

.stat-card-warning {
    border-left-color: #ff9800;
}

.stat-card-info {
    border-left-color: #2196f3;
}

.stat-card-success {
    border-left-color: #4caf50;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a2e;
}

.stat-label {
    font-size: 13px;
    color: #999;
    margin-top: 4px;
}

/* Panel */
.panel {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
}

.panel h3 {
    font-size: 16px;
    color: #1a1a2e;
    margin-bottom: 16px;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eef0f5;
    font-size: 14px;
}

.data-table th {
    color: #666;
    font-weight: 500;
    background: #fafbfc;
}

.data-table tbody tr:hover {
    background: #f8f9ff;
}

.td-question {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-view {
    display: inline-block;
    padding: 4px 14px;
    background: #4a6cf7;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
}

.btn-view:hover {
    background: #3a5ce5;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #eef0f5;
}

.tab-link {
    padding: 10px 20px;
    text-decoration: none;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.tab-link:hover {
    color: #4a6cf7;
}

.tab-link.active {
    color: #4a6cf7;
    border-bottom-color: #4a6cf7;
}

/* Approve / Reject Buttons */
.btn-approve {
    display: inline-block;
    padding: 5px 16px;
    background: #4caf50;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    margin-right: 6px;
    font-family: inherit;
}

.btn-approve:hover {
    background: #43a047;
}

.btn-reject {
    display: inline-block;
    padding: 5px 16px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}

.btn-reject:hover {
    background: #c0392b;
}

/* Badge */
.badge-yes {
    display: inline-block;
    padding: 2px 10px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 10px;
    font-size: 12px;
}

.badge-no {
    display: inline-block;
    padding: 2px 10px;
    background: #fafafa;
    color: #999;
    border-radius: 10px;
    font-size: 12px;
}

/* Student Detail Header */
.student-header {
    margin-bottom: 24px;
}

.student-header h2 {
    margin-bottom: 8px;
}

.student-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 14px;
    color: #666;
}

.btn-reset-pwd {
    display: inline-block;
    margin-top: 12px;
    padding: 6px 18px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.btn-reset-pwd:hover {
    background: #c0392b;
}

/* Dimension Stats (Student Detail) */
.dim-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.dim-stat-name {
    width: 80px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    flex-shrink: 0;
}

.dim-stat-weight {
    width: 60px;
    font-size: 12px;
    color: #888;
    flex-shrink: 0;
}

.dim-stat-bar-bg {
    flex: 1;
    height: 8px;
    background: #e8ecf1;
    border-radius: 4px;
    overflow: hidden;
}

.dim-stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a6cf7, #6c8cff);
    border-radius: 4px;
}

.dim-stat-value {
    width: 60px;
    text-align: right;
    font-size: 14px;
    font-weight: 600;
    color: #4a6cf7;
}

/* Back Button */
.btn-back {
    display: inline-block;
    padding: 10px 24px;
    background: #eef0f5;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 12px;
}

.btn-back:hover {
    background: #dfe2e8;
}

/* Filter Bar */
.filter-bar {
    background: #fff;
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-bar label {
    font-size: 14px;
    color: #666;
}

.filter-bar select {
    padding: 8px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

.filter-bar select:focus {
    outline: none;
    border-color: #4a6cf7;
}

.filter-bar form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Evaluation Detail Header */
.eval-detail-header {
    margin-bottom: 24px;
}

.eval-detail-header h2 {
    margin-bottom: 12px;
}

.eval-detail-tags {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.eval-tag {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
}

.eval-tag-student {
    background: #eef2ff;
    color: #4a6cf7;
    border: 1px solid #c8d6f7;
}

.eval-tag-classroom {
    background: #f0faf0;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.eval-tag-time {
    background: #f5f6fa;
    color: #666;
    border: 1px solid #e0e0e0;
    font-weight: 400;
}

/* Teacher Feedback Panel */
.teacher-feedback-panel {
    margin-top: 24px;
}

.feedback-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    line-height: 1.6;
    min-height: 100px;
}

.feedback-textarea:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

.feedback-time {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

/* Quick Fill Chips (Teacher Feedback) */
.quick-fill-section {
    margin-bottom: 16px;
}

.quick-fill-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

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

.quick-chip {
    display: inline-block;
    padding: 5px 14px;
    background: #f0f2f5;
    border: 1px solid #d0d5dd;
    border-radius: 16px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.quick-chip:hover {
    background: #e0e7ff;
    border-color: #4a6cf7;
    color: #4a6cf7;
}

.quick-chip-primary {
    background: #e8edff;
    border-color: #4a6cf7;
    color: #4a6cf7;
}

.quick-chip-primary:hover {
    background: #4a6cf7;
    color: #fff;
}

.quick-chip-green {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #2e7d32;
}

.quick-chip-green:hover {
    background: #4caf50;
    border-color: #4caf50;
    color: #fff;
}

.quick-chip-orange {
    background: #fff8e1;
    border-color: #ffe082;
    color: #f57f17;
}

.quick-chip-orange:hover {
    background: #ff9800;
    border-color: #ff9800;
    color: #fff;
}

/* ========== Module Panel (Teacher Toggle+Edit) ========== */
.module-panel-hint {
    font-size: 13px;
    color: #999;
    margin-bottom: 20px;
}

.module-panel {
    border: 1px solid #eef0f5;
    border-radius: 8px;
    margin-bottom: 14px;
    overflow: hidden;
}

.module-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef0f5;
}

.module-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.module-panel-body {
    padding: 12px 16px;
}

.module-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    line-height: 1.6;
    color: #333;
}

.module-textarea:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

.module-divider {
    border: none;
    border-top: 1px solid #eef0f5;
    margin: 20px 0;
}

.module-comment-section h4 {
    font-size: 14px;
    color: #333;
    margin-bottom: 10px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    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: #ccc;
    border-radius: 24px;
    transition: background-color 0.25s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #4caf50;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Teacher Module Block (Student Side) */
.teacher-module-block {
    border: 1px solid #eef0f5;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    background: #fafbfc;
}

.teacher-module-block h3 {
    font-size: 15px;
    color: #1a1a2e;
    margin-bottom: 10px;
}

.teacher-module-content {
    font-size: 14px;
    color: #555;
    line-height: 1.8;
    white-space: pre-wrap;
}

.teacher-module-strengths {
    background: #f0faf0;
    border-color: #c8e6c9;
}

.teacher-module-strengths h3 {
    color: #2e7d32;
}

.teacher-module-improvements {
    background: #fff8e1;
    border-color: #ffe082;
}

.teacher-module-improvements h3 {
    color: #f57f17;
}

/* Feedback Actions Row */
.feedback-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
}

.btn-clear-feedback {
    padding: 12px 20px;
    background: #f0f2f5;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    font-family: inherit;
}

.btn-clear-feedback:hover {
    background: #e0e2e5;
    color: #333;
}

/* Teacher Comment Block (Student Side) */
.teacher-comment-block {
    background: #f0f8ff;
    border: 1px solid #b3d7ff;
    border-radius: 8px;
    padding: 20px;
    margin-top: 24px;
}

.teacher-comment-block h3 {
    font-size: 16px;
    color: #1a1a2e;
    margin-bottom: 10px;
}

.teacher-comment-text {
    font-size: 14px;
    color: #333;
    line-height: 1.8;
    white-space: pre-wrap;
}

.teacher-comment-meta {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
    text-align: right;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.page-link {
    color: #4a6cf7;
    text-decoration: none;
    font-size: 14px;
}

.page-link:hover {
    text-decoration: underline;
}

.page-info {
    font-size: 13px;
    color: #666;
}

.empty-state {
    text-align: center;
    padding: 40px 0;
    color: #999;
}

.empty-state p {
    margin-bottom: 16px;
    font-size: 15px;
}

/* Comparison Section */
.comparison-section {
    background: #f0f8ff;
    border: 1px solid #b3d7ff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.comparison-section h3 {
    font-size: 16px;
    color: #1a1a2e;
    margin-bottom: 12px;
}

.comp-dim {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #e0ecf5;
    font-size: 14px;
}

.comp-dim:last-child {
    border-bottom: none;
}

.comp-total {
    font-weight: 600;
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 2px solid #b3d7ff;
}

.comp-name {
    flex: 1;
    font-weight: 500;
}

.comp-scores {
    flex: 1;
    text-align: center;
}

.comp-diff {
    width: 60px;
    text-align: right;
    font-weight: 600;
}

.comparison-encouragement {
    margin-top: 16px;
    font-size: 14px;
    color: #333;
    line-height: 1.8;
    white-space: pre-wrap;
    background: #fff;
    padding: 16px;
    border-radius: 6px;
}

/* History Cards */
.history-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border-radius: 10px;
    padding: 16px 20px;
    text-decoration: none;
    color: inherit;
    border: 1px solid #f0f0f0;
    transition: box-shadow 0.2s, border-color 0.2s;
    cursor: pointer;
    position: relative;
}

.history-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border-color: #d0d5dd;
}

.history-card-score {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 2px solid;
}

.history-card-score.score-high {
    background: #eef2ff;
    border-color: #4a6cf7;
    color: #4a6cf7;
}

.history-card-score.score-mid {
    background: #fffbeb;
    border-color: #f5a623;
    color: #e69500;
}

.history-card-score.score-low {
    background: #fef2f2;
    border-color: #e74c3c;
    color: #e74c3c;
}

.history-card-num {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
}

.history-card-unit {
    font-size: 12px;
    font-weight: 400;
}

.history-card-body {
    flex: 1;
    min-width: 0;
}

.history-card-question {
    font-size: 15px;
    font-weight: 500;
    color: #1a1a2e;
    line-height: 1.4;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.history-card-time {
    color: #999;
}

.history-card-grade {
    font-weight: 500;
}

.history-card-grade.grade-high {
    color: #4a6cf7;
}

.history-card-grade.grade-mid {
    color: #f5a623;
}

.history-card-grade.grade-low {
    color: #e74c3c;
}

.history-card-feedback {
    color: #4a6cf7;
    font-weight: 500;
}

.history-card-student {
    color: #333;
    font-weight: 500;
}

.history-card-nofeedback {
    color: #bbb;
}

.history-card-delete {
    flex-shrink: 0;
    padding: 4px 12px;
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.history-card-delete:hover {
    color: #e74c3c;
    border-color: #e74c3c;
    background: #fef2f2;
}

/* Batch Action Bar */
.batch-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 0 14px;
    border-bottom: 1px solid #eef0f5;
    margin-bottom: 12px;
}

.batch-check-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

.batch-check-all input {
    width: 16px;
    height: 16px;
    accent-color: #4a6cf7;
    cursor: pointer;
}

.batch-count {
    font-size: 13px;
    color: #4a6cf7;
    font-weight: 500;
}

.batch-delete-btn {
    margin-left: auto;
    padding: 6px 18px;
    background: #fff;
    color: #e74c3c;
    border: 1px solid #e74c3c;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.batch-delete-btn:hover:not(:disabled) {
    background: #e74c3c;
    color: #fff;
}

.batch-delete-btn:disabled {
    color: #ccc;
    border-color: #ddd;
    cursor: not-allowed;
}

/* Card Checkbox */
.history-card-check {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.history-card-check input {
    width: 16px;
    height: 16px;
    accent-color: #4a6cf7;
    cursor: pointer;
}

/* Student 7-Day History Section */
.recent-history-section {
    background: #fff;
    border-radius: 12px;
    padding: 24px 32px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-top: 24px;
}

.recent-history-section h3 {
    font-size: 16px;
    color: #1a1a2e;
    margin-bottom: 16px;
}

/* Teacher Detail Block (always open) */
.detail-block-open {
    border: 1px solid #eef0f5;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.detail-block-open h3 {
    padding: 12px 16px;
    font-weight: 500;
    font-size: 14px;
    background: #fafbfc;
    margin: 0;
    border-bottom: 1px solid #eef0f5;
}

/* Inline Form */
.inline-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inline-form input[type="text"],
.inline-form select {
    padding: 8px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

.inline-form input[type="text"]:focus,
.inline-form select:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

/* ========== Mobile: 768px ========== */
@media (max-width: 768px) {
    .nav-container {
        position: relative;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .nav-links {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        background: #1a1a2e;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 12px;
        padding: 10px;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        pointer-events: none;
        transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    }

    .top-nav.nav-open .nav-links {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    .nav-link {
        display: flex;
        align-items: center;
        padding: 10px 12px;
        border-radius: 8px;
        min-height: 40px;
    }

    .nav-link:hover,
    .nav-link:active {
        background: rgba(255, 255, 255, 0.08);
    }

    .nav-user {
        padding: 10px 12px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.06);
    }

    /* iOS Safari: prevent zoom on focus for inputs < 16px */
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Tables: let parent panel handle overflow */
    .panel {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 560px;
    }

    /* Touch targets: minimum 40px height */
    .btn-view,
    .btn-approve,
    .btn-reject,
    .history-card-delete,
    .batch-delete-btn,
    .btn-reset-pwd,
    .btn-back {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .page-link {
        display: inline-flex;
        align-items: center;
        min-height: 40px;
        padding: 8px 6px;
    }

    .btn-clear {
        min-width: 36px;
        min-height: 36px;
    }

    .tab-link {
        padding: 10px 14px;
        min-height: 40px;
    }
}

/* ========== Mobile: 600px ========== */
@media (max-width: 600px) {
    .container {
        padding: 20px 12px;
        padding-left: calc(12px + var(--safe-left));
        padding-right: calc(12px + var(--safe-right));
        padding-bottom: calc(20px + var(--safe-bottom));
    }

    header h1 {
        font-size: 22px;
    }

    .upload-section, .progress-section, .result-section, .error-section {
        padding: 20px 16px;
    }

    .upload-area {
        padding: 32px 16px;
    }

    .feedback-columns {
        grid-template-columns: 1fr;
    }

    .score-number {
        font-size: 42px;
    }

    .nav-container {
        padding: 0 12px;
        padding-left: calc(12px + var(--safe-left));
        padding-right: calc(12px + var(--safe-right));
    }

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

    .data-table th:nth-child(3),
    .data-table td:nth-child(3) {
        display: none;
    }

    .student-meta {
        flex-direction: column;
        gap: 4px;
    }

    .role-tabs {
        flex-direction: column;
    }

    .role-tab:first-child {
        border-right: none;
        border-bottom: 1px solid #d0d5dd;
    }

    .mindmap {
        flex-direction: column;
    }

    .mindmap-root {
        margin-right: 0;
        margin-bottom: 12px;
        align-self: flex-start;
    }

    .mindmap-branches {
        padding-left: 16px;
    }

    .mindmap-branch::before {
        left: -16px;
        width: 16px;
    }

    .history-card {
        padding: 12px 14px;
        gap: 12px;
    }

    .history-card-score {
        width: 52px;
        height: 52px;
    }

    .history-card-num {
        font-size: 18px;
    }

    .history-card-question {
        font-size: 14px;
    }

    .history-card-meta {
        gap: 8px;
        font-size: 12px;
    }

    /* Filter bar: stack vertically */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar form {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar select {
        width: 100%;
    }

    /* Inline forms: stack vertically */
    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .inline-form input[type="text"],
    .inline-form select {
        width: 100%;
    }

    /* Remove nested scrolling on mobile */
    .detail-content {
        max-height: none;
        overflow: visible;
    }

    /* Reduce section padding */
    .recent-history-section {
        padding: 20px 16px;
    }

    .panel {
        padding: 18px 16px;
    }

    .login-section {
        margin: 30px auto;
        padding: 28px 20px;
    }

    .pending-section {
        margin: 30px auto;
        padding: 40px 20px;
    }

    /* Eval detail tags: smaller font */
    .eval-tag {
        font-size: 13px;
        padding: 5px 12px;
    }

    /* Batch upload table: allow scroll */
    .panel[style*="overflow-x"] {
        padding: 16px 12px;
    }

    /* Comparison section */
    .comp-dim {
        font-size: 13px;
    }

    .comp-diff {
        width: 50px;
    }

    /* Module panel body padding */
    .module-panel-body {
        padding: 10px 12px;
    }
}
