* { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            color: #1d1d1f;
            background: #f5f5f7;
        }
        .app-layout {
            display: flex;
            min-height: 100vh;
        }
        .sidebar {
            position: fixed;
            left: 0; top: 0; width: 220px; height: 100vh;
            background: #ffffff;
            border-right: 1px solid #e5e5e7;
            display: flex; flex-direction: column;
            padding: 24px 10px; overflow-y: auto;
            z-index: 100; box-sizing: border-box;
        }
        .nav-item {
            display: flex; align-items: center; gap: 10px;
            padding: 11px 14px; border-radius: 10px;
            color: #636366; text-decoration: none;
            transition: all 0.15s; margin-bottom: 2px;
        }
        .nav-item:hover { background: #f0f0f0; color: #1d1d1f; }
        .nav-item.active { color: #0071e3; background: #e8f0fe; font-weight: 600; }
        body.theme-xuefeng .nav-item.active { color: #7c3aed; background: #f3e8ff; }
        body.theme-liangliang .nav-item.active { color: #ca8a04; background: #fef9c3; }
        body.theme-taotao .nav-item.active { color: #db2777; background: #fdf2f8; }
        body.theme-ji .nav-item.active { color: #16a34a; background: #f0fdf4; }
        .nav-icon { font-size: 20px; line-height: 1; flex-shrink: 0; width: 24px; text-align: center; }
        .nav-label { font-size: 14px; font-weight: 500; line-height: 1.3; color: #636366; }
        .nav-item.active .nav-label { color: inherit; }
        .nav-badge {
            font-size: 10px; padding: 1px 6px; border-radius: 4px;
            background: #e5e5e7; color: #86868b;
            margin-left: auto;
        }
        .main-content {
            margin-left: 220px; flex: 1;
            padding: 30px 20px 40px;
        }
        .main-content .container {
            max-width: 800px; margin: 0 auto;
        }
        h1 { text-align: center; font-size: 28px; color: #1d1d1f; margin-bottom: 8px; }

        .subtitle { text-align: center; color: #86868b; margin-bottom: 30px; }
        .search-box { display: flex; gap: 10px; margin-bottom: 30px; width: 100%; }
        .search-box input {
            flex: 1; padding: 14px 18px; border: 1px solid #c7c7cc; border-radius: 12px;
            font-size: 16px; outline: none; transition: border-color 0.2s;
        }
        .search-box input:focus { border-color: #0071e3; }
        .search-box textarea {
            flex: 1; padding: 14px 18px; border: 1px solid #c7c7cc; border-radius: 12px;
            font-size: 16px; outline: none; transition: border-color 0.2s;
            resize: none; overflow: hidden; font-family: inherit; line-height: 1.5;
            min-height: 52px;
        }
        .search-box textarea:focus { border-color: #0071e3; }
        .search-box button {
            padding: 14px 28px; background: #0071e3; color: white; border: none;
            border-radius: 12px; font-size: 16px; cursor: pointer; transition: background 0.2s;
        }
        .search-box button:hover { background: #0071e3; }
        .search-box button:disabled { background: #a0c4ff; cursor: not-allowed; }

        .type-selector {
            display: flex; align-items: center; gap: 8px;
            margin-bottom: 16px; justify-content: center;
        }
        .type-label { font-size: 14px; color: #86868b; }
        .type-btn {
            padding: 6px 16px; border: 1px solid #c7c7cc; border-radius: 8px;
            background: white; font-size: 14px; cursor: pointer;
            transition: all 0.2s; color: #1d1d1f;
        }
        .type-btn:hover { border-color: #0071e3; color: #0071e3; }
        .type-btn.active {
            background: #0071e3; color: white; border-color: #0071e3;
        }

        .chunk-card {
            background: white; border: 1px solid #e0e0e0; border-radius: 12px;
            margin-bottom: 16px; overflow: hidden;
        }
        .chunk-header {
            display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
            padding: 10px 16px; background: #f8f9fa;
            border-bottom: 1px solid #e0e0e0; font-size: 13px;
        }
        .chunk-label {
            font-weight: 600; color: #0071e3;
            background: #e8f0fe; padding: 2px 8px; border-radius: 4px;
        }
        .chunk-type { color: #515154; }
        .chunk-cat { color: #2e7d32; background: #e8f5e9; padding: 2px 8px; border-radius: 4px; }
        .chunk-diff { padding: 2px 8px; border-radius: 4px; }
        .tag-type { background: #e3f2fd; color: #1565c0; }
        .tag-type-simple { background: #f3e5f5; color: #6a1b9a; }
        .tag-type-special { background: #fce4ec; color: #c62828; }
        .chunk-steps { padding: 2px; }
        .chunk-steps .step { margin-bottom: 12px; }
        .chunk-steps .step:last-child { margin-bottom: 0; }
        .progress-pct { text-align: center; font-size: 24px; font-weight: 700; color: #0071e3; margin-top: 6px; }
        .progress-token { text-align: center; font-size: 12px; color: #86868b; margin-top: 4px; }
        .progress-timer { text-align: center; font-size: 14px; color: #0071e3; margin-top: 6px; font-weight: 600; }


        .progress-area { margin-bottom: 30px; display: none; }
        .progress-area.show { display: block; }
        .progress-bar-track {
            width: 100%; height: 6px;
            background: #e5e5e7; border-radius: 3px; overflow: hidden;
            margin-bottom: 10px;
        }
        .progress-bar-fill {
            height: 100%; width: 0%;
            background: linear-gradient(90deg, #0071e3, #00a2ff);
            border-radius: 3px; transition: width 0.3s ease;
        }
        .teacher-selector {
            display: grid; grid-template-columns: repeat(4, 1fr);
            gap: 12px; max-width: 560px; margin: 0 auto 20px;
        }
        .teacher-btn {
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            padding: 20px 8px; border-radius: 16px; cursor: pointer;
            border: 2px solid #e0e0e0; background: white;
            transition: all 0.2s ease; text-align: center;
            min-height: 150px; user-select: none;
        }
        .teacher-btn:hover {
            transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08);
        }
        .teacher-btn .t-icon { font-size: 36px; margin-bottom: 4px; }
        .teacher-btn .t-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
        .teacher-btn .t-desc { font-size: 11px; color: #86868b; line-height: 1.4; }
        .teacher-btn[data-teacher="xuefeng"] { background: #faf5ff; border-color: #e9d5ff; }
        .teacher-btn[data-teacher="xuefeng"]:hover { border-color: #9333ea; }
        .teacher-btn[data-teacher="xuefeng"].active { background: #f3e8ff; border-color: #9333ea; }
        .teacher-btn[data-teacher="liangliang"] { background: #fefce8; border-color: #fef08a; }
        .teacher-btn[data-teacher="liangliang"]:hover { border-color: #eab308; }
        .teacher-btn[data-teacher="liangliang"].active { background: #fef9c3; border-color: #eab308; color: #854d0e; }
        .teacher-btn[data-teacher="taotao"] { background: #fdf2f8; border-color: #fbcfe8; }
        .teacher-btn[data-teacher="taotao"]:hover { border-color: #ec4899; }
        .teacher-btn[data-teacher="taotao"].active { background: #fce7f3; border-color: #ec4899; color: #9d174d; }
        .teacher-btn[data-teacher="ji"] { background: #f0fdf4; border-color: #bbf7d0; }
        .teacher-btn[data-teacher="ji"]:hover { border-color: #22c55e; }
        .teacher-btn[data-teacher="ji"].active { background: #dcfce7; border-color: #22c55e; color: #166534; }
        /* 雪峰主题：全局变紫 */
        body.theme-xuefeng .teacher-btn[data-teacher="xuefeng"].active { background: #7c3aed; border-color: #7c3aed; }
        body.theme-xuefeng .teacher-btn[data-teacher="xuefeng"].active .t-name,
        body.theme-xuefeng .teacher-btn[data-teacher="xuefeng"].active .t-desc { color: white; }
        body.theme-xuefeng .search-box button { background: #7c3aed; }
        body.theme-xuefeng .search-box button:hover { background: #6d28d9; }
        body.theme-xuefeng .search-box button:disabled { background: #c4b5fd; }
        body.theme-xuefeng .progress-bar-fill { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
        body.theme-xuefeng .progress-pct { color: #7c3aed; }
        body.theme-xuefeng .progress-timer { color: #7c3aed; }
        body.theme-xuefeng .xuebile { background: #faf5ff; border-color: #e9d5ff; }
        body.theme-xuefeng .xuebile-title { color: #7c3aed; }
        /* 鸡主题：全局变绿 */
        body.theme-ji .search-box button { background: #16a34a; }
        body.theme-ji .search-box button:hover { background: #15803d; }
        body.theme-ji .search-box button:disabled { background: #86efac; }
        body.theme-ji .progress-bar-fill { background: linear-gradient(90deg, #16a34a, #4ade80); }
        body.theme-ji .progress-pct { color: #16a34a; }
        body.theme-ji .progress-timer { color: #16a34a; }
        body.theme-ji .xuebile { background: #f0fdf4; border-color: #bbf7d0; }
        body.theme-ji .xuebile-title { color: #16a34a; }
        /* 梁梁主题：全局变黄 */
        body.theme-liangliang .search-box button { background: #ca8a04; }
        body.theme-liangliang .search-box button:hover { background: #a16207; }
        body.theme-liangliang .search-box button:disabled { background: #fde68a; }
        body.theme-liangliang .progress-bar-fill { background: linear-gradient(90deg, #ca8a04, #fbbf24); }
        body.theme-liangliang .progress-pct { color: #ca8a04; }
        body.theme-liangliang .progress-timer { color: #ca8a04; }
        body.theme-liangliang .xuebile { background: #fefce8; border-color: #fef08a; }
        body.theme-liangliang .xuebile-title { color: #ca8a04; }
        /* 韬韬主题：全局变粉 */
        body.theme-taotao .search-box button { background: #db2777; }
        body.theme-taotao .search-box button:hover { background: #be185d; }
        body.theme-taotao .search-box button:disabled { background: #f9a8d4; }
        body.theme-taotao .progress-bar-fill { background: linear-gradient(90deg, #db2777, #f472b6); }
        body.theme-taotao .progress-pct { color: #db2777; }
        body.theme-taotao .progress-timer { color: #db2777; }
        body.theme-taotao .xuebile { background: #fdf2f8; border-color: #fbcfe8; }
        body.theme-taotao .xuebile-title { color: #db2777; }
        .progress-text { text-align: center; font-size: 14px; color: #86868b; }

        .result {
            background: white; border-radius: 16px; padding: 30px;
            box-shadow: 0 2px 12px rgba(0,0,0,0.08); display: none;
        }
        .result.show { display: block; }

        .meta-bar {
            display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
            padding-bottom: 16px; border-bottom: 1px solid #e5e5e7;
        }
        .tag {
            padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 500;
        }
        .tag-category { background: #e8f5e9; color: #2e7d32; }
        .tag-easy { background: #e3f2fd; color: #1565c0; }
        .tag-medium { background: #fff3e0; color: #e65100; }
        .tag-hard { background: #fce4ec; color: #c62828; }
        .tag-extreme { background: #f3e5f5; color: #6a1b9a; }
        .tag-unknown { background: #eceff1; color: #546e7a; }
        .tag-token { background: #f5f5f7; color: #515154; }

        .result h2 { font-size: 18px; color: #1d1d1f; margin-bottom: 20px; }

        .xuebile { background: #fff5f5; border: 2px solid #ffcdd2; border-radius: 16px; padding: 40px 28px; text-align: center; margin-bottom: 20px; }
        .xuebile-icon { font-size: 64px; margin-bottom: 12px; }
        .xuebile-title { font-size: 28px; color: #c62828; font-weight: 700; margin-bottom: 12px; }
        .xuebile-reason { font-size: 15px; color: #555; line-height: 1.6; }

        .step {
            background: white;
            border: 1px solid #e0e0e0;
            border-radius: 10px;
            padding: 16px;
            margin-bottom: 16px;
        }
        .step-header {
            display: flex; align-items: center; gap: 8px;
            margin-bottom: 10px;
            padding-left: 12px;
            border-left: 3px solid #0071e3;
        }
        .step-number { font-weight: 600; font-size: 15px; color: #1d1d1f; }
        .step-diff-tag { font-size: 12px; color: #86868b; margin-left: auto; background: #f5f5f7; padding: 2px 8px; border-radius: 4px; }
        .step-level1-tag { font-size: 11px; color: #1a73e8; margin-left: 8px; background: #e8f0fe; padding: 2px 8px; border-radius: 4px; font-weight: 500; }

        .step-content { margin-left: 0; padding: 8px 0 8px 12px; font-size: 15px; color: #1d1d1f; line-height: 1.7; border-left: 1px solid #e5e5e7; white-space: pre-wrap; word-break: break-word; }
        .step-kp { margin-left: 0; padding: 2px 0 6px 12px; font-size: 13px; color: #2e7d32; border-left: 1px solid #e5e5e7; }
        .dim-bars { margin: 4px 0 10px 14px; max-width: 460px; }
        .dim-bars-compact { max-width: 320px; }
        .dim-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
        .dim-bar-label { width: 88px; flex-shrink: 0; font-size: 11px; color: #636366; text-align: right; }
        .dim-bar-track { flex: 1; height: 8px; background: #ececf0; border-radius: 4px; overflow: hidden; }
        .dim-bar-fill { display: block; height: 100%; border-radius: 4px; background: #c7c7cc; transition: width 0.2s; }
        .dim-bar-fill.lv1 { background: #34c759; }
        .dim-bar-fill.lv2 { background: #ff9500; }
        .dim-bar-fill.lv3 { background: #ff3b30; }
        .dim-bar-value { width: 16px; flex-shrink: 0; font-size: 11px; color: #636366; text-align: center; }
        .dim-bar-value.lv1 { color: #28a745; font-weight: 600; }
        .dim-bar-value.lv2 { color: #e08600; font-weight: 600; }
        .dim-bar-value.lv3 { color: #d93025; font-weight: 700; }
        .detail-toggle {
            cursor: pointer; color: #0071e3; font-size: 13px;
            user-select: none; padding: 4px 0 2px 12px;
        }
        .detail-toggle:hover { text-decoration: underline; }
        .detail-content {
            display: none; margin-left: 0; padding: 8px 0 8px 12px;
            font-size: 14px; color: #1d1d1f; line-height: 1.7;
            border-left: 1px solid #e5e5e7; background: #fafafa;
            border-radius: 0 6px 6px 0; white-space: pre-wrap; word-break: break-word;
        }
        .detail-content.show { display: block; }
        
        /* ---- Step Error Styles ---- */
        .step.has-error {
            background: #fff5f5;
            border-color: #ffcdd2;
        }
        .step-error-btn {
            display: inline-flex; align-items: center; gap: 6px;
            margin: 8px 0 0 12px; padding: 6px 14px;
            border: 1px solid #c7c7cc; border-radius: 8px;
            font-size: 12px; color: #515154; cursor: pointer;
            background: white; transition: all 0.15s;
        }
        .step-error-btn:hover { border-color: #c62828; color: #c62828; background: #fff5f5; }
        .step-error-btn.has-error { background: #fff5f5; border-color: #e57373; color: #c62828; }
        
        .step-errors {
            margin: 8px 0 0 12px;
        }
        .step-error-item {
            display: flex; align-items: center; gap: 8px;
            padding: 6px 10px; margin-bottom: 4px;
            background: #fff0f0; border-radius: 6px;
            font-size: 13px;
        }
        .step-error-item:last-child { margin-bottom: 0; }
        .error-type-badge {
            display: inline-block; padding: 2px 10px;
            background: #c62828; color: white; border-radius: 4px;
            font-size: 12px; font-weight: 500;
        }
        .error-detail {
            flex: 1; color: #1d1d1f;
        }
        .error-time {
            font-size: 11px; color: #86868b; white-space: nowrap;
        }
        .error-delete-btn {
            cursor: pointer; color: #c7c7cc; font-size: 14px;
            border: none; background: none; padding: 2px 4px;
            transition: color 0.15s;
        }
        .error-delete-btn:hover { color: #c62828; }
        
        /* ---- Error Dialog ---- */
        .error-dialog-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.4); display: flex; align-items: center;
            justify-content: center; z-index: 1000;
        }
        .error-dialog {
            background: white; border-radius: 16px; padding: 28px 32px;
            max-width: 400px; width: 90%; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
        }
        .error-dialog h3 { font-size: 18px; margin-bottom: 20px; color: #1d1d1f; }
        .error-dialog-field { margin-bottom: 16px; }
        .error-dialog-field label {
            display: block; font-size: 13px; color: #86868b; margin-bottom: 6px; font-weight: 500;
        }
        .error-dialog-field select,
        .error-dialog-field textarea {
            width: 100%; padding: 10px 12px; border: 1px solid #c7c7cc;
            border-radius: 8px; font-size: 14px; outline: none;
            font-family: inherit;
        }
        .error-dialog-field select:focus,
        .error-dialog-field textarea:focus { border-color: #0071e3; }
        .error-dialog-field textarea { resize: vertical; min-height: 60px; }
        .error-dialog-actions {
            display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;
        }
        .error-dialog-actions button {
            padding: 10px 24px; border-radius: 10px; font-size: 14px;
            cursor: pointer; border: none; transition: all 0.15s;
        }
        .ed-btn-cancel { background: #f5f5f7; color: #515154; }
        .ed-btn-cancel:hover { background: #e8e8ed; }
        .ed-btn-confirm { background: #c62828; color: white; }
        .ed-btn-confirm:hover { background: #b71c1c; }

        /* ---- AI 仿题 Dialog ---- */
        .ai-gen-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.42); display: flex; align-items: center;
            justify-content: center; z-index: 1200; padding: 16px; box-sizing: border-box;
        }
        .ai-gen-dialog {
            background: white; border-radius: 16px; width: min(760px, 94vw);
            max-height: 84vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.22);
            padding: 24px 26px 26px; box-sizing: border-box;
        }
        .ai-gen-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
        .ai-gen-title { font-size: 18px; font-weight: 700; color: #1d1d1f; }
        .ai-gen-close {
            border: none; background: #f5f5f7; color: #515154; width: 32px; height: 32px;
            border-radius: 50%; font-size: 16px; cursor: pointer; transition: background 0.15s;
        }
        .ai-gen-close:hover { background: #e8e8ed; }
        .ai-gen-status { font-size: 13px; color: #86868b; margin-bottom: 14px; line-height: 1.6; }
        .ai-gen-loading {
            display: flex; flex-direction: column; align-items: center; gap: 14px;
            padding: 44px 16px; color: #86868b; font-size: 14px; text-align: center;
        }
        .ai-gen-spinner {
            width: 30px; height: 30px; border: 3px solid #e5e5e7; border-top-color: #ca8a04;
            border-radius: 50%; animation: aiGenSpin 0.8s linear infinite;
        }
        @keyframes aiGenSpin { to { transform: rotate(360deg); } }
        .ai-gen-card {
            border: 1px solid #e5e5e7; border-radius: 12px; padding: 16px; margin-bottom: 12px;
            background: #fafafa; transition: border-color 0.15s;
        }
        .ai-gen-card.ai-gen-accepted { background: #f4fbf6; border-color: #b7e4c7; }
        .ai-gen-card.ai-gen-rejected { opacity: 0.82; }
        .ai-gen-q { font-size: 14px; line-height: 1.7; color: #1d1d1f; margin-bottom: 10px; word-break: break-word; }
        .ai-gen-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
        .ai-gen-tag {
            display: inline-block; padding: 3px 10px; border-radius: 999px;
            font-size: 12px; background: #f5f5f7; color: #515154;
        }
        .ai-gen-tag.ai-gen-tag-ok { background: #d9f3e2; color: #1e7d3c; }
        .ai-gen-tag.ai-gen-tag-bad { background: #ffe9e9; color: #b3261e; }
        .ai-gen-note { font-size: 12px; color: #86868b; margin-bottom: 10px; line-height: 1.6; }
        .ai-gen-actions { display: flex; flex-wrap: wrap; gap: 8px; }
        .ai-gen-action {
            display: inline-flex; align-items: center; gap: 5px; padding: 8px 16px;
            border: none; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer;
            transition: all 0.15s;
        }
        .ai-gen-action-primary { background: #ca8a04; color: white; }
        .ai-gen-action-primary:hover { background: #a16207; }
        .ai-gen-action-plain { background: #f5f5f7; color: #515154; }
        .ai-gen-action-plain:hover { background: #e8e8ed; }

        /* ---- AI 仿题进度条 ---- */
        .ai-gen-progress { padding: 4px 0 18px; }
        .ai-gen-progress-stages {
            display: flex; align-items: center; justify-content: space-between;
            margin-bottom: 14px; padding: 0 6px;
        }
        .ai-gen-progress-stage {
            display: flex; align-items: center; gap: 7px; font-size: 12px;
            color: #86868b; transition: color 0.3s;
        }
        .ai-gen-progress-dot {
            width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
            background: #e0e0e0; transition: all 0.3s ease;
        }
        .ai-gen-progress-stage.active { color: #ca8a04; font-weight: 600; }
        .ai-gen-progress-stage.active .ai-gen-progress-dot {
            background: #ca8a04; box-shadow: 0 0 0 3px rgba(202,138,4,0.18);
        }
        .ai-gen-progress-stage.completed { color: #1e7d3c; }
        .ai-gen-progress-stage.completed .ai-gen-progress-dot { background: #34c759; }
        .ai-gen-progress-bar {
            height: 6px; background: #e5e5e7; border-radius: 3px; overflow: hidden;
        }
        .ai-gen-progress-fill {
            height: 100%; background: linear-gradient(90deg, #ca8a04, #f59e0b);
            border-radius: 3px; transition: width 0.35s ease;
        }
        .ai-gen-progress-pct {
            text-align: center; font-size: 18px; font-weight: 700;
            color: #ca8a04; margin-top: 8px;
        }
        .ai-gen-progress-text {
            text-align: center; font-size: 13px; color: #86868b; margin-top: 4px;
        }
        
        

        .final-answer { margin: 0 16px 16px; padding: 16px; background: #f0f7ff; border-radius: 12px; font-weight: 600; font-size: 16px; color: #0071e3; }

        /* ---- Save Toggle ---- */
        .save-toggle {
            display: flex; align-items: center;
            margin: 0 0 16px; justify-content: flex-end;
        }
        .toggle-label {
            display: flex; align-items: center; gap: 8px;
            cursor: pointer; user-select: none;
        }
        .toggle-label input[type="checkbox"] {
            width: 36px; height: 20px; appearance: none; -webkit-appearance: none;
            background: #d2d2d7; border-radius: 10px; position: relative;
            cursor: pointer; transition: background 0.2s; flex-shrink: 0;
        }
        .toggle-label input[type="checkbox"]::after {
            content: ''; position: absolute; top: 2px; left: 2px;
            width: 16px; height: 16px; background: #fff; border-radius: 50%;
            transition: transform 0.2s;
        }
        .toggle-label input[type="checkbox"]:checked {
            background: #0071e3;
        }
        .toggle-label input[type="checkbox"]:checked::after {
            transform: translateX(16px);
        }
        .toggle-text { font-size: 13px; color: #86868b; }

        /* ---- History Page ---- */
        .history-search { margin-bottom: 20px; }
        .history-search input {
            width: 100%; padding: 12px 16px; border: 1px solid #c7c7cc;
            border-radius: 12px; font-size: 15px; outline: none;
        }
        .history-search input:disabled {
            background: #f5f5f7; color: #c7c7cc;
        }
        .history-card {
            background: white; border: 1px solid #c7c7cc; border-radius: 12px;
            padding: 16px 20px; margin-bottom: 10px; cursor: pointer;
            transition: all 0.15s;
        }
        .history-card:hover {
            border-color: #0071e3; box-shadow: 0 2px 8px rgba(0,113,227,0.1);
        }
        .hc-preview {
            font-size: 15px; color: #1d1d1f; line-height: 1.5;
            margin-bottom: 10px; display: -webkit-box;
            -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
        }
        .hc-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
        .hc-date { font-size: 13px; color: #86868b; margin-left: auto; white-space: nowrap; }

        /* ---- Empty State ---- */
        .empty-state {
            text-align: center; padding: 80px 20px;
        }
        .empty-icon { font-size: 64px; margin-bottom: 16px; }
        .empty-state p { font-size: 16px; color: #86868b; margin-bottom: 8px; }
        .empty-desc { font-size: 14px; color: #a1a1a6; }
        .empty-link {
            display: inline-block; margin-top: 20px;
            padding: 10px 24px; background: #0071e3; color: #fff;
            border-radius: 10px; text-decoration: none; font-size: 15px;
        }

        /* ---- Placeholder Card (teach page) ---- */
        .placeholder-card {
            background: white; border-radius: 16px; padding: 60px 40px;
            text-align: center; box-shadow: 0 2px 12px rgba(0,0,0,0.08);
        }
        .placeholder-icon { font-size: 64px; margin-bottom: 16px; }
        .placeholder-card h2 { font-size: 24px; color: #1d1d1f; margin-bottom: 12px; }
        .placeholder-card p { font-size: 15px; color: #86868b; line-height: 1.6; margin-bottom: 24px; }
        .placeholder-features { display: inline-block; text-align: left; }
        .pf-item { font-size: 14px; color: #515154; padding: 6px 0; }

        /* ---- Back Button ---- */
        .back-btn {
            display: inline-flex; align-items: center; gap: 6px;
            padding: 8px 16px; background: #f5f5f7; border: 1px solid #c7c7cc;
            border-radius: 10px; font-size: 14px; color: #515154; cursor: pointer;
            margin-bottom: 16px; transition: all 0.15s;
        }
        .back-btn:hover { background: #e8e8ed; }

        /* ---- Loading Skeleton ---- */
        .skeleton-card {
            background: white; border: 1px solid #c7c7cc; border-radius: 12px;
            padding: 16px 20px; margin-bottom: 10px;
        }
        .skeleton-line {
            height: 14px; background: #f0f0f0; border-radius: 4px;
            margin-bottom: 10px; animation: pulse 1.5s ease-in-out infinite;
        }
        .skeleton-line.short { width: 40%; }
        @keyframes pulse {
            0%, 100% { opacity: 0.5; }
            50% { opacity: 1; }
        }

        /* ---- Progress count text (history) ----
        .save-after-area {
            text-align: center; margin-top: 20px; padding: 16px 0;
        }
        .save-after-btn {
            display: inline-flex; align-items: center; gap: 8px;
            padding: 12px 32px; background: #0071e3; color: #fff;
            border: none; border-radius: 12px; font-size: 15px; font-weight: 500;
            cursor: pointer; transition: all 0.2s;
            box-shadow: 0 2px 8px rgba(0,113,227,0.2);
        }
        .save-after-btn:hover { background: #0077ed; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,113,227,0.3); }
        .save-after-btn:active { transform: translateY(0); }
        .save-after-btn:disabled { background: #a0c4ff; cursor: default; transform: none; box-shadow: none; }
        .save-after-btn.saved { background: #e8f5e9; color: #2e7d32; cursor: default; transform: none; box-shadow: none; font-weight: 500; }

        .detail-question {
            background: white; border: 1px solid #c7c7cc; border-radius: 12px;
            padding: 20px 24px; margin-bottom: 16px;
        }
        .detail-question h3 {
            font-size: 13px; color: #86868b; margin-bottom: 10px; font-weight: 500;
        }
        .question-text {
            font-size: 16px; color: #1d1d1f; line-height: 1.8;
            white-space: pre-line;
        }
/* ---- Filter Bar (history page) ---- */
.filter-bar {
    display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
    align-items: center;
}
.filter-search {
    flex: 1; min-width: 200px;
    display: flex; align-items: center;
    background: white; border: 1px solid #c7c7cc; border-radius: 12px;
    padding: 0 14px; transition: border-color 0.2s;
}
.filter-search:focus-within { border-color: #0071e3; }
.filter-search input {
    flex: 1; border: none; outline: none; font-size: 15px;
    padding: 11px 8px; background: transparent;
}
.filter-search .search-icon { font-size: 18px; color: #86868b; }
.filter-select {
    padding: 8px 30px 8px 12px; border: 1px solid #c7c7cc;
    border-radius: 10px; font-size: 14px; color: #1d1d1f;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2386868b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none; -webkit-appearance: none;
    cursor: pointer; transition: border-color 0.2s; min-width: 100px;
}
.filter-select:hover { border-color: #0071e3; }
.filter-select:focus { outline: none; border-color: #0071e3; }
.filter-reset {
    padding: 8px 14px; background: #f5f5f7; border: 1px solid #c7c7cc;
    border-radius: 10px; font-size: 13px; color: #515154; cursor: pointer;
    transition: all 0.15s;
}
.filter-reset:hover { background: #e8e8ed; }


/* ---- Mode Toggle ---- */
.mode-toggle {
    display: inline-flex; gap: 3px;
    background: #f5f5f7; border-radius: 10px; padding: 3px;
}
.mode-btn {
    padding: 7px 14px; border: none; border-radius: 8px;
    font-size: 13px; font-weight: 500; cursor: pointer;
    background: transparent; color: #86868b; transition: all 0.2s;
    white-space: nowrap;
}
.mode-btn.active { background: white; color: #1d1d1f; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* ---- Filter Row 2 ---- */
.filter-row-2 {
    display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
    align-items: center;
}
.filter-error-select { min-width: 120px; }

/* ---- Delete Button ---- */
.delete-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; background: transparent; border: none;
    border-radius: 50%; font-size: 15px; color: #c7c7cc; cursor: pointer;
    transition: all 0.15s; flex-shrink: 0;
}
.delete-btn:hover { background: #ffebee; color: #c62828; }

.delete-btn-large {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 18px; background: transparent; border: 1px solid #c7c7cc;
    border-radius: 10px; font-size: 13px; color: #86868b; cursor: pointer;
    transition: all 0.15s; margin-left: 12px;
}
.delete-btn-large:hover { background: #fff5f5; border-color: #ffcdd2; color: #c62828; }
.delete-btn-large .del-icon { font-size: 14px; line-height: 1; }

/* ---- Confirm Dialog ---- */
.confirm-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); display: flex; align-items: center;
    justify-content: center; z-index: 999;
}
.confirm-dialog {
    background: white; border-radius: 16px; padding: 28px 32px;
    max-width: 360px; width: 90%; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    text-align: center;
}
.confirm-dialog p { font-size: 16px; color: #1d1d1f; margin-bottom: 20px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 12px; justify-content: center; }
.confirm-actions button {
    padding: 10px 28px; border-radius: 10px; font-size: 15px;
    cursor: pointer; border: none; transition: all 0.15s;
}
.confirm-cancel { background: #f5f5f7; color: #515154; }
.confirm-cancel:hover { background: #e8e8ed; }
.confirm-delete { background: #c62828; color: white; }
.confirm-delete:hover { background: #b71c1c; }

/* ---- Question Type Tag ---- */
.tag-type-choice { background: #f3e5f5; color: #6a1b9a; }
.tag-type-multi { background: #ede7f6; color: #4527a0; }
.tag-type-blank { background: #e3f2fd; color: #1565c0; }
.tag-type-long { background: #e8f5e9; color: #2e7d32; }
.tag-type-special { background: #fff3e0; color: #e65100; }
.tag-id { background: #f1f3f5; color: #495057; font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: 12px; padding: 3px 8px; border: 1px solid #e2e4e8; }

/* ---- Beautified Save Button ---- */
.save-after-area { text-align: center; margin-top: 20px; padding: 16px 0; }
.save-after-btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 36px; background: linear-gradient(135deg, #0071e3, #0077ed);
    color: #fff; border: none; border-radius: 14px;
    font-size: 15px; font-weight: 600; cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 16px rgba(0,113,227,0.25);
    letter-spacing: 0.3px;
}
.save-after-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0,113,227,0.35);
    background: linear-gradient(135deg, #0077ed, #0080ff);
}
.save-after-btn:active { transform: translateY(0); }
.save-after-btn:disabled { background: #a0c4ff; cursor: default; transform: none; box-shadow: none; }
.save-after-btn.saved {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: #2e7d32; cursor: default; transform: none;
    box-shadow: 0 2px 8px rgba(46,125,50,0.15);
}
.save-after-btn .btn-icon { font-size: 20px; line-height: 1; }

/* ---- Save Toggle (beautified) ---- */
.save-toggle { display: flex; align-items: center; margin: 0 0 16px; justify-content: flex-end; }
.toggle-label {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; user-select: none;
    padding: 8px 16px; border-radius: 10px;
    background: #f5f5f7; transition: background 0.2s;
}
.toggle-label:hover { background: #e8e8ed; }
.toggle-label .toggle-switch {
    width: 40px; height: 22px; appearance: none; -webkit-appearance: none;
    background: #d2d2d7; border-radius: 11px; position: relative;
    cursor: pointer; transition: background 0.2s; flex-shrink: 0;
}
.toggle-label .toggle-switch::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; background: #fff; border-radius: 50%;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-label .toggle-switch:checked { background: #0071e3; }
.toggle-label .toggle-switch:checked::after { transform: translateX(18px); }
.toggle-text { font-size: 13px; color: #515154; font-weight: 500; }
.toggle-label .toggle-icon { font-size: 16px; line-height: 1; }

/* ---- HC Meta with question type ---- */
.hc-meta .tag-type {
    padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 500;
}

/* ======== Go Exam Button ======== */
.go-exam-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; background: #0071e3; color: white;
    border: none; border-radius: 10px; font-size: 13px; font-weight: 500;
    cursor: pointer; text-decoration: none; transition: all 0.15s;
    position: relative; white-space: nowrap;
}
.go-exam-btn:hover { background: #0077ed; }
.go-exam-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 5px;
    background: #c62828; color: white; font-size: 11px; font-weight: 700;
    border-radius: 10px; line-height: 1;
}

/* ======== Pagination Bar ======== */
.pagination-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 4px; margin-top: 12px;
    border-top: 1px solid #e5e5e7;
}
.page-size-selector {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: #86868b;
}
.page-size-selector select {
    padding: 4px 24px 4px 8px; border: 1px solid #c7c7cc;
    border-radius: 8px; font-size: 13px; color: #1d1d1f;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2386868b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 6px center;
    appearance: none; -webkit-appearance: none; cursor: pointer;
}
.page-nav { display: flex; align-items: center; gap: 8px; }
.page-btn {
    padding: 6px 14px; border: 1px solid #c7c7cc; border-radius: 8px;
    font-size: 13px; background: white; color: #515154; cursor: pointer;
    transition: all 0.15s;
}
.page-btn:hover { border-color: #0071e3; color: #0071e3; }
.page-btn:disabled { opacity: 0.4; cursor: default; border-color: #e5e5e7; color: #c7c7cc; }
.page-info { font-size: 13px; color: #86868b; }

/* ======== Time Display ======== */
.hc-time-wrapper {
    position: relative; display: inline-flex; align-items: center; gap: 4px;
    cursor: pointer; user-select: none;
}
.hc-time-main { font-size: 12px; color: #86868b; white-space: nowrap; }
.hc-time-arrow { font-size: 10px; color: #c7c7cc; transition: transform 0.2s; }
.hc-time-arrow.open { transform: rotate(180deg); }
.hc-time-popup {
    display: none; position: absolute; top: 100%; left: 0; z-index: 50;
    margin-top: 4px; padding: 8px 12px; background: white;
    border: 1px solid #e5e5e7; border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1); min-width: 180px;
}
.hc-time-popup.show { display: block; }
.hc-time-popup-item {
    font-size: 12px; color: #86868b; padding: 3px 0;
    white-space: nowrap;
}
.hc-time-popup-item .ttp-label { color: #515154; font-weight: 500; }

/* ======== Shopping Cart ======== */
.cart-float {
    position: fixed; bottom: 28px; right: 28px; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 50%;
    background: #0071e3; color: white; font-size: 28px;
    cursor: pointer; box-shadow: 0 4px 16px rgba(0,113,227,0.35);
    transition: all 0.2s ease; border: none;
}
.cart-float:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(0,113,227,0.45); }
.cart-badge {
    position: fixed; top: -2px; right: -2px;
    background: #c62828; color: white; font-size: 11px; font-weight: 700;
    min-width: 20px; height: 20px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 5px; box-shadow: 0 2px 6px rgba(198,40,40,0.3);
}
.cart-popup {
    position: fixed; bottom: 66px; right: 0;
    width: 320px; max-height: 400px; overflow-y: auto;
    background: white; border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    display: none; z-index: 201; padding: 0;
}
.cart-float:hover .cart-popup { display: block; }
.cart-popup-header {
    padding: 14px 16px 10px; font-size: 14px; font-weight: 600;
    color: #1d1d1f; border-bottom: 1px solid #f0f0f0;
    display: flex; justify-content: space-between; align-items: center;
}
.cart-popup-clear {
    font-size: 12px; font-weight: 400; color: #c62828;
    cursor: pointer; border: none; background: none; padding: 4px 8px;
    border-radius: 6px; transition: background 0.15s;
}
.cart-popup-clear:hover { background: #fff5f5; }
.cart-popup-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; border-bottom: 1px solid #f5f5f5;
    font-size: 13px; color: #515154; line-height: 1.4;
}
.cart-popup-item:last-child { border-bottom: none; }
.cart-popup-item .cp-num {
    width: 22px; height: 22px; border-radius: 6px;
    background: #f0f0f0; display: flex; align-items: center;
    justify-content: center; font-size: 12px; font-weight: 600;
    color: #515154; flex-shrink: 0;
}
.cart-popup-item .cp-text {
    flex: 1; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap;
}
.cart-popup-item .cp-del {
    cursor: pointer; color: #c7c7cc; font-size: 14px;
    border: none; background: none; padding: 2px; transition: color 0.15s;
}
.cart-popup-item .cp-del:hover { color: #c62828; }
.cart-popup-export {
    display: block; width: calc(100% - 32px); margin: 12px 16px;
    padding: 10px; background: #0071e3; color: white; text-align: center;
    border: none; border-radius: 10px; font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: background 0.2s;
}
.cart-popup-export:hover { background: #0077ed; }

/* ======== Batch Mode ======== */
.filter-batch { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.batch-btn {
    padding: 8px 14px; border: 1px solid #c7c7cc; border-radius: 10px;
    font-size: 13px; cursor: pointer; background: white; color: #515154;
    transition: all 0.15s; white-space: nowrap;
}
.batch-btn:hover { border-color: #0071e3; color: #0071e3; }
.batch-btn.active { background: #0071e3; color: white; border-color: #0071e3; }
.batch-btn.select-all {
    border: 1px solid #c7c7cc; display: none;
}
.batch-btn.select-all.show { display: inline-flex; }
.history-card .hc-checkbox {
    display: none; width: 18px; height: 18px; flex-shrink: 0;
    margin-right: 4px; cursor: pointer; accent-color: #0071e3;
}
.history-card.batch-mode .hc-checkbox { display: inline; }
.history-card.batch-mode .delete-btn { display: none; }
.batch-action-bar {
    display: none; align-items: center; gap: 12px;
    padding: 12px 16px; background: #f0f7ff; border-radius: 12px;
    margin-bottom: 16px;
}
.batch-action-bar.show { display: flex; }
.batch-action-bar .bar-count { font-size: 14px; color: #0071e3; font-weight: 500; }
.batch-action-bar .bar-btn {
    padding: 8px 18px; border: none; border-radius: 8px;
    font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.bar-add-exam { background: #0071e3; color: white; }
.bar-add-exam:hover { background: #0077ed; }
.bar-select-all { background: #e8f0fe; color: #1565c0; }
.bar-select-all:hover { background: #d0e2fb; }

/* ======== Exam Page ======== */
body.exam-page { background: #f5f5f7; overflow: hidden; width: 100%; height: 100%; }
html:has(body.exam-page) { overflow: hidden; height: 100%; }
body.exam-page .app-layout { overflow: hidden; position: relative; }
.exam-layout {
    margin-left: 220px; display: flex;
    height: 100vh; overflow: hidden;
}
.exam-sidebar {
    flex: 0 0 400px;
    background: white; border-right: 1px solid #e5e5e7;
    height: 100vh; overflow-y: auto; overflow-x: hidden;
    overscroll-behavior: contain;
    display: flex; flex-direction: column;
}
.exam-sidebar-inner { padding: 20px 16px; }

.exam-title-input {
    width: 100%; padding: 10px 14px; border: 1px solid #c7c7cc;
    border-radius: 10px; font-size: 18px; font-weight: 600;
    outline: none; transition: border-color 0.2s; margin-bottom: 8px;
}
.exam-title-input:focus { border-color: #0071e3; }
.exam-subtitle-input {
    width: 100%; padding: 8px 14px; border: 1px solid #c7c7cc;
    border-radius: 8px; font-size: 13px; outline: none;
    transition: border-color 0.2s; margin-bottom: 16px; color: #86868b;
}
.exam-subtitle-input:focus { border-color: #0071e3; }

.exam-mode-toggle {
    display: flex; gap: 4px; margin-bottom: 20px;
    background: #f5f5f7; border-radius: 10px; padding: 4px;
}
.exam-mode-btn {
    flex: 1; padding: 8px 16px; border: none; border-radius: 8px;
    font-size: 14px; font-weight: 500; cursor: pointer;
    background: transparent; color: #86868b; transition: all 0.2s;
}
.exam-mode-btn.active { background: white; color: #1d1d1f; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

.exam-qlist { flex: 1; overflow-y: auto; margin-bottom: 16px; }
.exam-qitem {
    padding: 12px 14px; border: 1px solid #c7c7cc; border-radius: 10px;
    margin-bottom: 8px; cursor: pointer; transition: all 0.15s;
}
.exam-qitem:hover { border-color: #0071e3; background: #f8f9ff; }
.exam-qitem.active { border-color: #0071e3; background: #f0f7ff; }
.exam-qitem-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
    cursor: pointer; user-select: none;
}
.exam-qitem-arrow { font-size: 10px; color: #c7c7cc; transition: transform 0.2s; flex-shrink: 0; }
.exam-qitem-arrow.open { transform: rotate(90deg); }
.exam-qitem-num {
    width: 24px; height: 24px; border-radius: 6px; background: #f0f0f0;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.exam-qitem-preview {
    flex: 1; font-size: 13px; color: #515154;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; white-space: pre-line;
}
.exam-qitem-remove {
    cursor: pointer; color: #c7c7cc; border: none; background: none;
    font-size: 14px; padding: 2px; transition: color 0.15s;
}
.exam-qitem-remove:hover { color: #c62828; }
.exam-qitem-settings {
    padding: 12px; background: #fafafa; border-radius: 8px;
    margin-top: 4px; font-size: 13px;
}
.exam-qitem-settings .setting-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.exam-qitem-settings .setting-row:last-child { margin-bottom: 0; }
.setting-label { color: #86868b; font-size: 12px; }
.setting-slider { width: 80px; accent-color: #0071e3; cursor: pointer; }
.setting-slider-value { font-size: 12px; color: #515154; min-width: 30px; text-align: right; }
.setting-checkbox { accent-color: #0071e3; cursor: pointer; }

/* ---- Exam bottom bar ---- */
.exam-bottom {
    padding: 16px; border-top: 1px solid #e5e5e7;
    display: flex; gap: 8px; flex-wrap: wrap;
}
.exam-bottom .eb-btn {
    flex: 1; padding: 10px; border-radius: 10px; border: none;
    font-size: 13px; font-weight: 600; cursor: pointer; text-align: center;
    transition: all 0.15s; min-width: 80px;
}
.eb-clear { background: #f5f5f7; color: #515154; }
.eb-clear:hover { background: #e8e8ed; }
.eb-ai { background: #f3e8ff; color: #7c3aed; }
.eb-ai:hover { background: #e9d5ff; }

/* ---- Export button (big, prominent) ---- */
.eb-export {
    flex: 1.5; background: linear-gradient(135deg, #0071e3, #0077ed);
    color: white; box-shadow: 0 3px 12px rgba(0,113,227,0.3);
    font-size: 14px; letter-spacing: 0.5px;
}
.eb-export:hover { transform: translateY(-1px); box-shadow: 0 5px 18px rgba(0,113,227,0.4); }
.eb-export:active { transform: translateY(0); }
.eb-export:disabled { background: #a0c4ff; cursor: default; transform: none; box-shadow: none; }

/* ---- Preview ---- */
.exam-main {
    flex: 1;
    min-width: 0;
    height: 100vh; overflow-x: hidden;
    display: flex; flex-direction: column;
    background: #e8e8ec;
}
.exam-preview {
    flex: 1; overflow-y: auto;
    min-height: 0; box-sizing: border-box;
    overscroll-behavior: contain;
    padding: 50px 75px 50px;
    background: white;
    border: 1px solid #c7c7cc;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    font-size: 15px; line-height: 1.8; color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
}
.exam-preview .preview-header { text-align: center; margin-bottom: 28px; }
.exam-preview .preview-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.exam-preview .preview-subtitle { font-size: 14px; color: #86868b; margin-bottom: 16px; }
.exam-preview .preview-divider { border: none; border-top: 1px solid #e5e5e7; margin: 0 0 20px; }

/* Multi-page in preview */
.preview-page {
    margin-bottom: 32px; padding-bottom: 16px;
    page-break-inside: avoid; break-inside: avoid;
}

/* Student blank area */
.student-blank {
    border: none; margin: 0 0 20px;
    min-height: 120px;
}

/* Answer page */
.answer-page-title {
    text-align: center; font-size: 18px; font-weight: 700;
    margin: 20px 0 16px; padding-top: 20px;
    border-top: 2px solid #1d1d1f;
}
.answer-item { margin-bottom: 16px; }
.answer-item .answer-label { font-weight: 600; margin-bottom: 4px; }
.answer-item .answer-content { padding-left: 12px; color: #2e7d32; }

/* Teacher mode: process */
        .teacher-process { padding: 8px 0 8px 12px; font-size: 14px; color: #1d1d1f; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }

        /* ---- Question Search Picker ---- */
        .question-search-wrap { position: relative; display: block; }
        .question-search-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50; background: #fff; border: 1px solid #d2d2d7; border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,0.10); max-height: 220px; overflow: auto; text-align: left; }
        .question-search-item { display: block; width: 100%; padding: 8px 10px; cursor: pointer; border-bottom: 1px solid #f0f0f0; box-sizing: border-box; }
        .question-search-item:hover { background: #f0f7ff; }
        .question-search-item-id { color: #0071e3; font-weight: 600; font-size: 12px; }
        .question-search-item-preview { display: block; font-size: 12px; color: #1d1d1f; line-height: 1.5; margin-top: 2px; word-break: break-word; }
        .question-search-item-meta { display: block; font-size: 11px; color: #86868b; margin-top: 2px; }
        .question-search-empty { padding: 10px; font-size: 12px; color: #86868b; }
.teacher-kp { font-size: 13px; color: #2e7d32; }
.teacher-difficulty { font-size: 12px; color: #86868b; }

/* Export overlay */
.export-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.45); display: flex; align-items: center;
    justify-content: center; z-index: 999;
}
.export-dialog {
    background: white; border-radius: 20px; padding: 40px 48px;
    text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    max-width: 400px; width: 90%;
}
.export-dialog .ed-icon { font-size: 48px; margin-bottom: 16px; }
.export-dialog .ed-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.export-dialog .ed-text { font-size: 14px; color: #86868b; margin-bottom: 20px; }
.export-spinner {
    width: 36px; height: 36px; border: 3px solid #e5e5e7;
    border-top-color: #0071e3; border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Print styles */
@media print {
    body.exam-page .sidebar,
    body.exam-page .exam-sidebar { display: none !important; }
    body.exam-page .exam-layout { margin-left: 0; display: block; }
    body.exam-page .exam-main { padding: 0; }
    .exam-preview { box-shadow: none; border-radius: 0; padding: 20px 30px; }
    .no-print { display: none !important; }
    .student-blank { border-bottom: 1px solid #ccc; }
    .preview-page { page-break-inside: avoid; }
    .answer-page-title { page-break-before: always; }
}

/* ---- Cart on history page (override for dark sidebar theme) ---- */
body .cart-float.exam-cart {
    background: linear-gradient(135deg, #0071e3, #0077ed);
}
body.theme-xuefeng .cart-float.exam-cart { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
body.theme-ji .cart-float.exam-cart { background: linear-gradient(135deg, #16a34a, #4ade80); }
body.theme-liangliang .cart-float.exam-cart { background: linear-gradient(135deg, #ca8a04, #fbbf24); }
body.theme-taotao .cart-float.exam-cart { background: linear-gradient(135deg, #db2777, #f472b6); }

/* ---- Exam Add Button on Card ---- */
.exam-add-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; background: transparent; border: none;
    border-radius: 50%; font-size: 15px; color: #c7c7cc; cursor: pointer;
    transition: all 0.15s; flex-shrink: 0; margin-left: 2px;
}
.exam-add-btn:hover { background: #e3f2fd; color: #0071e3; }

/* ---- Toast Notification ---- */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    padding: 12px 24px; border-radius: 12px; font-size: 14px; z-index: 9999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15); pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0.01; transform: translateX(-50%) translateY(-10px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.toast-info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }

/* ---- Floating Cart Bar ---- */
.cart-float {
    cursor: pointer;
}
.cart-float .cart-popup {
    display: none;
}
.cart-float.active .cart-popup,
.cart-float:hover .cart-popup {
    display: block;
}
/* Remove the old hover-only rule */


/* ---- Page Break (for PDF export) ---- */
.exam-preview .preview-page { page-break-inside: avoid; break-inside: avoid; margin-bottom: 20px; }
.exam-preview .page-break-indicator {
    page-break-before: always; break-before: page;
    border-top: 2px dashed #d2d2d7; margin: 10px 0 24px;
    text-align: center; position: relative; height: 0;
}

/* ---- A4 Page Style ---- */
.a4-page {
    width: 794px; height: 1123px; box-sizing: border-box; overflow: hidden;
    padding: 50px 75px 50px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    border: 1px solid #c7c7cc;
    margin-bottom: 28px;
    font-size: 15px; line-height: 1.8; color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    position: relative;
}
.a4-page:last-child { margin-bottom: 0; }

/* Override old exam-preview when paginated */
.exam-preview.paginated {
    background: transparent; padding: 0; margin: 0;
    width: 100%; min-height: 0; box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}
/* ---- Zoom Controls ---- */
.zoom-bar {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 16px; justify-content: center;
    background: rgba(0,0,0,0.06); border-radius: 10px;
    padding: 6px 16px; flex-shrink: 0; width: 794px;
    position: sticky; top: 8px; z-index: 10;
}
.zoom-btn {
    width: 32px; height: 32px; border: none; border-radius: 8px;
    background: white; color: #515154; font-size: 16px;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.zoom-btn:hover { background: #f0f0f0; color: #1d1d1f; }
.zoom-label {
    font-size: 13px; color: #515154; font-weight: 500;
    min-width: 40px; text-align: center; user-select: none;
}

/* ---- Answer Box (student mode) ---- */
.answer-box-container {
    margin: 8px 0 16px;
}
.answer-box {
    width: 12.5cm; border: 2px solid #1d1d1f;
    position: relative;
}





/* ---- Student blank (no box) ---- */
.student-blank {
    margin: 0; border: none;
}

/* ---- Teacher mode: page padding for header/footer ---- */
.exam-preview.mode-teacher .preview-page {
    padding: 20px 20px 40px;
    box-sizing: border-box;
}

/* ---- Frequent page breaks mode ---- */
.exam-preview.frequent-breaks .preview-page {
    page-break-inside: auto !important;
    break-inside: auto !important;
}

/* ---- Remove old page-break-indicator visual ---- */
.page-break-indicator { page-break-before: always; }
/* No visual on screen - only page break for PDF */






/* ---- Answer Box Label (inside the box) ---- */

/* ---- Drag and Drop ---- */
.exam-qitem.dragging { opacity: 0.5; }



/* ========== Question List Sidebar ========== */

/* Simplified layout (sidebar removed - now floating) */
.history-layout {
    display: flex; gap: 24px; align-items: flex-start;
    max-width: 1524px; margin: 0 auto;
}
.main-content .container.history-header {
    max-width: 1524px;
}
.history-header {
    max-width: 1524px; margin: 0 auto 20px;
    display: flex; align-items: center; justify-content: center;
    gap: 16px;
}
.history-header-text {
    min-width: 0;
    text-align: center;
}
.history-header-text h1 {
    margin-bottom: 4px;
    text-align: center;
}
.history-header-text .subtitle {
    margin-bottom: 0; text-align: center;
}
#historyCount {
    display: none;
}
.history-main-area {
    flex: 1 1 auto; min-width: 0; max-width: 1200px;
}
body.standalone-ref .sidebar,
body.standalone-ref .mobile-nav-toggle,
body.standalone-ref .history-header,
body.standalone-ref .history-topbar,
body.standalone-ref .filter-bar,
body.standalone-ref .filter-row-2,
body.standalone-ref .batch-action-bar,
body.standalone-ref #listView,
body.standalone-ref .pagination-bar,
body.standalone-ref .ql-panel {
    display: none !important;
}
body.standalone-ref .history-layout {
    display: block;
    max-width: 1200px;
}
body.standalone-ref .history-main-area {
    max-width: 1200px;
    margin: 0 auto;
}

/* ========== Header Trigger (题单 button in top-right) ========== */
.ql-header-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px; border: 1px solid #e5e5e7; border-radius: 10px;
    background: #ffffff; color: #1d1d1f; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); position: relative;
}
.ql-header-btn:hover {
    border-color: #0071e3; color: #0071e3; background: #f5f9ff;
}
.ql-header-icon {
    font-size: 17px; line-height: 1;
}
.ql-header-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #ff3b30; display: none;
}

/* ========== Floating Ball (hidden; trigger moved to header) ========== */
.ql-float-ball {
    position: fixed;
    right: 24px;
    bottom: 100px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #0071e3;
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0,113,227,0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
}
.ql-float-ball:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,113,227,0.45);
}
.ql-float-ball:active {
    transform: scale(0.96);
}
.ql-ball-icon {
    font-size: 20px;
    line-height: 1;
}
.ql-ball-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff3b30;
    display: none;
}
body.theme-xuefeng .ql-float-ball { background: #7c3aed; }
body.theme-liangliang .ql-float-ball { background: #ca8a04; }
body.theme-taotao .ql-float-ball { background: #db2777; }
body.theme-ji .ql-float-ball { background: #16a34a; }

/* ========== Floating Panel ========== */
.ql-panel {
    position: fixed;
    right: 24px;
    bottom: 160px;
    width: 260px;
    max-height: 420px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}
.ql-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Panel header */
.ql-panel-header {
    padding: 16px 16px 12px;
    font-size: 15px; font-weight: 700; color: #1d1d1f;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid #f0f0f0;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}
.ql-panel-header .hlh-icon {
    font-size: 18px; margin-right: 6px;
}
.ql-panel-actions {
    display: flex; gap: 4px;
}
.ql-icon-btn {
    width: 28px; height: 28px; border: none; border-radius: 7px;
    background: transparent; cursor: pointer;
    color: #86868b; display: flex;
    align-items: center; justify-content: center;
    transition: all 0.12s;
}
.ql-icon-btn:hover {
    background: #f0f0f0; color: #515154;
}

/* Panel body (scrollable list area) */
.ql-panel-body {
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
    padding: 4px 0;
}
.ql-panel-body::-webkit-scrollbar { width: 4px; }
.ql-panel-body::-webkit-scrollbar-thumb { background: #e5e5e7; border-radius: 2px; }

/* Panel footer */
.ql-panel-footer {
    flex-shrink: 0;
    border-top: 1px solid #f0f0f0;
}
.ql-add-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; cursor: pointer;
    font-size: 13px; font-weight: 500;
    border: none; background: none; width: 100%; text-align: left;
    color: #0071e3; transition: all 0.12s;
}
.ql-add-btn:hover { background: #f5f5f7; }

/* ========== List Item Styles (shared with renderLists) ========== */
.history-list-section-title {
    font-size: 11px; font-weight: 600; color: #aeaeb2;
    padding: 10px 16px 4px; text-transform: uppercase;
    letter-spacing: 0.05em;
}
.history-list-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; cursor: pointer;
    color: #515154; font-size: 14px; line-height: 1.4;
    transition: all 0.12s; position: relative;
    border: none; background: none; width: 100%; text-align: left;
    border-radius: 0;
}
.history-list-item:hover {
    background: #f5f5f7; color: #1d1d1f;
}
.history-list-item.active {
    background: #e8f0fe; color: #0071e3; font-weight: 600;
    border-left: 3px solid #0071e3;
    padding-left: 13px;
}
body.theme-xuefeng .history-list-item.active { color: #7c3aed; background: #f3e8ff; border-left: 3px solid #7c3aed; padding-left: 13px; }
body.theme-liangliang .history-list-item.active { color: #ca8a04; background: #fef9c3; border-left: 3px solid #ca8a04; padding-left: 13px; }
body.theme-taotao .history-list-item.active { color: #db2777; background: #fdf2f8; border-left: 3px solid #db2777; padding-left: 13px; }
body.theme-ji .history-list-item.active { color: #16a34a; background: #f0fdf4; border-left: 3px solid #16a34a; padding-left: 13px; }

.history-list-item .list-icon {
    font-size: 17px; width: 22px; text-align: center; flex-shrink: 0;
    line-height: 1;
}
.history-list-item .list-name {
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 14px;
}
.history-list-item .list-count {
    font-size: 12px; color: #86868b; background: #f0f0f0;
    padding: 1px 8px; border-radius: 9px; flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    min-width: 22px; text-align: center;
}
.history-list-item.active .list-count {
    background: rgba(0,113,227,0.1); color: #0071e3;
}
.history-list-item .list-actions {
    display: none; margin-left: auto;
}
.history-list-item:hover .list-actions { display: flex; gap: 2px; }
.list-action-btn {
    background: none; border: none; cursor: pointer;
    padding: 3px 5px; font-size: 13px; color: #86868b; border-radius: 4px;
    line-height: 1; transition: all 0.1s;
}
.list-action-btn:hover { background: #e5e5e7; color: #515154; }
.list-action-btn.delete:hover { color: #e74c3c; }
.list-action-btn.rename:hover { color: #0071e3; }

/* Divider between system and user lists */
.history-list-divider {
    height: 1px; background: #f0f0f0; margin: 4px 12px;
}

/* Inline input for new list (used by showNewListDialog) */
.history-list-add-input {
    flex: 1; padding: 7px 10px; border: 1px solid #c7c7cc;
    border-radius: 8px; font-size: 13px; outline: none;
}
.history-list-add-input:focus { border-color: #0071e3; }
.history-list-add-confirm {
    padding: 6px 12px; background: #0071e3; color: white;
    border: none; border-radius: 7px; font-size: 12px; font-weight: 500;
    cursor: pointer;
}
.history-list-add-confirm:hover { background: #005bbf; }

/* ========== Question list: permanent left column ========== */
.ql-panel {
    position: sticky;
    top: 30px;
    right: auto;
    bottom: auto;
    left: auto;
    width: 280px;
    max-height: calc(100vh - 60px);
    border-radius: 12px;
    border: 1px solid #e5e5e7;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    opacity: 1;
    transform: none;
    pointer-events: auto;
    flex-shrink: 0;
    align-self: flex-start;
    order: -1;
    transform-origin: center;
}
.ql-panel .ql-panel-body {
    max-height: calc(100vh - 180px);
}
.history-main-area {
    order: 1;
}

/* ========== Save to Lists Dialog ========== */
.save-dialog-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.save-dialog {
    background: #fff; border-radius: 16px; padding: 24px;
    width: 380px; max-height: 80vh; overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}
.save-dialog h3 {
    font-size: 17px; font-weight: 600; color: #1d1d1f;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.save-dialog-lists {
    max-height: 280px; overflow-y: auto; margin-bottom: 12px;
}
.save-dialog-list-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    cursor: pointer; transition: background 0.1s;
}
.save-dialog-list-item:hover { background: #f5f5f7; }
.save-dialog-list-item input[type="checkbox"] {
    width: 18px; height: 18px; cursor: pointer; accent-color: #0071e3;
}
.save-dialog-list-item .sdl-name { flex: 1; font-size: 14px; color: #1d1d1f; }
.save-dialog-list-item .sdl-checked {
    font-size: 12px; color: #86868b;
}
.save-dialog-create {
    display: flex; gap: 8px; padding: 8px 0; margin-bottom: 12px;
    border-top: 1px solid #f0f0f0; padding-top: 12px;
}
.save-dialog-create input {
    flex: 1; padding: 8px 12px; border: 1px solid #c7c7cc;
    border-radius: 8px; font-size: 13px; outline: none;
}
.save-dialog-create input:focus { border-color: #0071e3; }
.save-dialog-create button {
    padding: 8px 14px; background: #f0f0f0; border: none;
    border-radius: 8px; font-size: 13px; cursor: pointer; color: #515154;
    font-weight: 500;
}
.save-dialog-create button:hover { background: #e5e5e7; }

.save-dialog .source-type-row {
    display: flex; gap: 6px; flex-wrap: wrap;
    padding: 12px 0; margin-bottom: 8px;
    border-top: 1px solid #f0f0f0;
}
.save-dialog .source-type-row label {
    font-size: 13px; color: #515154; font-weight: 500;
    width: 100%; margin-bottom: 4px;
}
.source-type-option {
    padding: 5px 12px; border: 1px solid #e5e5e7; border-radius: 14px;
    font-size: 12px; cursor: pointer; color: #636366;
    background: #fafafa; transition: all 0.12s;
}
.source-type-option:hover { border-color: #0071e3; color: #0071e3; }
.source-type-option.active { background: #0071e3; color: #fff; border-color: #0071e3; }

.source-meta-fields {
    display: flex; gap: 10px; flex-wrap: wrap;
    padding: 4px 0 10px; border-top: 1px solid #f0f0f0;
}
.source-meta-field {
    flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 4px;
}
.source-meta-field label {
    font-size: 12px; color: #86868b; font-weight: 500;
}
.source-meta-field input {
    padding: 8px 10px; border: 1px solid #c7c7cc; border-radius: 8px;
    font-size: 13px; outline: none; box-sizing: border-box; width: 100%;
}
.source-meta-field input:focus { border-color: #0071e3; }
.source-meta-hint { font-size: 12px; color: #a1a1a6; padding: 6px 0; }
.remember-source-row {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0 12px; font-size: 13px; color: #515154;
    border-top: 1px solid #f0f0f0; cursor: pointer;
}
.remember-source-row input { width: 16px; height: 16px; accent-color: #0071e3; cursor: pointer; }
.tag-source-meta {
    background: #f5f7fa; color: #5f6b7a; border-color: #e3e8ef;
}
.tag-ref-link {
    cursor: pointer;
    text-decoration: none;
}
.tag-ref-link:hover {
    background: #e8eef5;
    color: #0b6bcb;
}

.save-dialog-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    padding-top: 12px; border-top: 1px solid #f0f0f0;
}
.save-dialog-actions button {
    padding: 8px 20px; border-radius: 8px; font-size: 14px;
    cursor: pointer; border: none; font-weight: 500;
}
.sd-btn-cancel { background: #f0f0f0; color: #515154; }
.sd-btn-cancel:hover { background: #e5e5e7; }
.sd-btn-confirm { background: #0071e3; color: #fff; }
.sd-btn-confirm:hover { background: #005bbf; }

/* ========== Source Type Tag ========== */
.tag-source {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    line-height: 1.2;
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: #f0f0f0;
    color: #515154;
    font-weight: 600;
    white-space: nowrap;
}
.tag-source-ai { background: #e7f3fd; color: #0b6bcb; border-color: #bfe0fa; }
.tag-source-gaokao { background: #fdeef0; color: #c2253a; border-color: #f6cfd6; }
.tag-source-monikao { background: #eef2ff; color: #3f51b5; border-color: #d9e1fb; }
.tag-source-muti { background: #fff4e2; color: #b45309; border-color: #f9dfae; }

/* ---- Import dialog (multimodal batch / single) ---- */
.mm-import-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.45); display: flex; align-items: center;
    justify-content: center; z-index: 1000; padding: 16px; box-sizing: border-box;
}
.mm-import-dialog {
    background: #fff; border-radius: 14px; padding: 22px 24px;
    width: 100%; max-width: 520px; max-height: 86vh; overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}
.mm-import-dialog h3 {
    font-size: 17px; font-weight: 600; color: #1d1d1f;
    margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid #f0f0f0;
}
.mm-import-modes { display: flex; gap: 8px; margin-bottom: 14px; }
.mm-import-mode {
    flex: 1; padding: 9px 10px; border: 1px solid #d2d2d7; border-radius: 10px;
    background: #fafafa; font-size: 13px; color: #636366; cursor: pointer;
    transition: all 0.15s;
}
.mm-import-mode.active { background: #0071e3; color: #fff; border-color: #0071e3; }
.mm-import-rows { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.mm-import-row {
    border: 1px solid #e5e5e7; border-radius: 10px; padding: 12px; background: #fafafa;
}
.mm-import-row-head { font-size: 13px; font-weight: 600; color: #1d1d1f; margin-bottom: 8px; }
.mm-import-row .mm-source-select { width: 100%; margin-bottom: 8px; }
.auto-row { align-items: center; }
.auto-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: #0071e3; }
.mm-import-actions {
    display: flex; justify-content: flex-end; gap: 10px;
    padding-top: 14px; border-top: 1px solid #f0f0f0; margin-top: 12px;
}
.mm-import-actions button {
    padding: 9px 20px; border: none; border-radius: 8px; font-size: 14px;
    font-weight: 500; cursor: pointer;
}
.mm-import-cancel { background: #f0f0f0; color: #515154; }
.mm-import-confirm { background: #2e7d32; color: #fff; }
.mm-import-confirm:hover { background: #256d28; }

/* Radar chart empty state */
.radar-empty {
    padding: 40px 20px;
    color: #86868b;
    font-size: 13px;
    text-align: center;
    background: #fafafa;
    border: 1px dashed #d2d2d7;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
}

/* iPad-style sidebar toggle */
.history-layout { position: relative; }

/* Smooth sidebar slide */
.history-list-sidebar {
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease,
                border 0.2s ease;
}

/* Toggle button in header - iPad style */
.sidebar-toggle-btn {
    background: none; border: none; cursor: pointer;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px; transition: all 0.15s;
    color: #aeaeb2;
    opacity: 0.5;
}
.sidebar-toggle-btn:hover {
    opacity: 1; background: #e5e5e7; color: #636366;
}

/* Subtle right border on sidebar */
.history-list-sidebar::after {
    content: '';
    position: absolute; right: 0; top: 12px; bottom: 12px;
    width: 1px; background: #e5e5e7;
    pointer-events: none;
}

/* Collapsed sidebar state */
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden;
    opacity: 0;
    border-color: transparent;
    padding: 0;
    margin: 0;
}
    opacity: 0;
}
    margin-left: 0;
}

/* Expand tab - appears at left edge when sidebar is hidden */
.sidebar-expand-tab {
    display: none;
    position: absolute;
    left: -20px; top: 50%;
    transform: translateY(-50%);
    width: 18px; height: 40px;
    background: #fff;
    border: 1px solid #e5e5e7;
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 10;
    color: #aeaeb2;
    box-shadow: 1px 0 4px rgba(0,0,0,0.04);
    transition: all 0.15s;
}
.sidebar-expand-tab:hover {
    color: #636366;
    background: #f8f8fa;
    box-shadow: 2px 1px 8px rgba(0,0,0,0.08);
}

/* ========== Apple Calendar style global nav ========== */
.sidebar {
    transition: transform 0.2s ease;
}
.main-content,
.exam-layout {
    transition: none;
}
.nav-init .sidebar,
.nav-init .main-content,
.nav-init .exam-layout,
.nav-init .nav-item,
.nav-init .nav-expand-toggle,
.nav-init .mobile-nav-toggle {
    transition: none !important;
}
.mobile-nav-toggle {
    display: none;
    position: fixed;
    left: 14px;
    top: 14px;
    width: 40px;
    height: 40px;
    z-index: 1200;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e5e7;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: #1d1d1f;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.nav-expand-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 0 18px 10px;
    align-self: flex-start;
    border: 1px solid #e5e5e7;
    border-radius: 10px;
    background: #fff;
    color: #1d1d1f;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
}
.nav-expand-toggle:hover {
    border-color: #0071e3;
    color: #0071e3;
}

body.nav-expanded .sidebar {
    width: 220px;
    padding: 24px 10px;
}
body.nav-expanded .main-content,
body.nav-expanded .exam-layout {
    margin-left: 220px;
}
body.nav-expanded .nav-item {
    justify-content: flex-start;
    gap: 10px;
    padding: 11px 14px;
}
body.nav-expanded .nav-label,
body.nav-expanded .nav-badge {
    display: inline;
}
body.nav-expanded .nav-icon {
    font-size: 20px;
    width: 24px;
}
body.nav-expanded .nav-expand-toggle {
    margin: 0 0 18px 10px;
    align-self: flex-start;
}

body.nav-collapsed .sidebar {
    width: 68px;
    padding: 20px 8px;
}
body.nav-collapsed .main-content,
body.nav-collapsed .exam-layout {
    margin-left: 68px;
}
body.nav-collapsed .nav-item {
    justify-content: center;
    padding: 12px;
    gap: 0;
}
body.nav-collapsed .nav-label,
body.nav-collapsed .nav-badge {
    display: none;
}
body.nav-collapsed .nav-icon {
    font-size: 22px;
    width: auto;
}
body.nav-collapsed .nav-expand-toggle {
    margin: 0 auto 18px;
    align-self: center;
}

@media (max-width: 1800px) {
    .sidebar {
        width: 68px;
        padding: 20px 8px;
    }
    .main-content,
    .exam-layout {
        margin-left: 68px;
    }
    .nav-item {
        justify-content: center;
        padding: 12px;
        gap: 0;
    }
    .nav-label,
    .nav-badge {
        display: none;
    }
    .nav-icon {
        font-size: 22px;
        width: auto;
    }
}

@media (max-width: 760px) {
    .sidebar {
        transform: translateX(-100%);
        width: 240px;
        padding: 24px 10px;
        box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    }
    body.mobile-nav-open .sidebar {
        transform: translateX(0);
        z-index: 1100;
    }
    .main-content,
    .exam-layout {
        margin-left: 0;
    }
    .mobile-nav-toggle {
        display: flex;
    }
    .nav-expand-toggle {
        display: none;
    }
    body.mobile-nav-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 1050;
    }
    .nav-item {
        justify-content: flex-start;
        gap: 10px;
        padding: 11px 14px;
    }
    .nav-label,
    .nav-badge {
        display: inline;
    }
    .nav-icon {
        font-size: 20px;
        width: 24px;
    }
    body.nav-expanded .sidebar,
    body.nav-collapsed .sidebar {
        transform: translateX(-100%);
        width: 240px;
        padding: 24px 10px;
    }
    body.mobile-nav-open .sidebar {
        transform: translateX(0);
        z-index: 1100;
    }
    body.nav-expanded .main-content,
    body.nav-expanded .exam-layout,
    body.nav-collapsed .main-content,
    body.nav-collapsed .exam-layout {
        margin-left: 0;
    }
    body.nav-expanded .nav-item,
    body.nav-collapsed .nav-item {
        justify-content: flex-start;
        gap: 10px;
        padding: 11px 14px;
    }
    body.nav-expanded .nav-label,
    body.nav-expanded .nav-badge,
    body.nav-collapsed .nav-label,
    body.nav-collapsed .nav-badge {
        display: inline;
    }
    body.nav-expanded .nav-icon,
    body.nav-collapsed .nav-icon {
        font-size: 20px;
        width: 24px;
    }
}

/* ========== History filter panel (under question lists) ========== */
.history-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.filter-summary {
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #eef6ff;
    border: 1px solid #cfe6ff;
    border-radius: 10px;
    color: #1d1d1f;
    font-size: 13px;
    line-height: 1.5;
}
.filter-summary a {
    color: #0071e3;
    font-weight: 600;
    text-decoration: none;
}
body.standalone-ref .history-toolbar,
body.standalone-ref .filter-summary {
    display: none !important;
}
.ql-panel {
    max-height: calc(100vh - 40px);
}
.ql-panel .ql-panel-body {
    max-height: 260px;
    min-height: 120px;
    flex-shrink: 0;
}
.ql-filter-section {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    border-top: 1px solid #f0f0f0;
    padding: 12px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ql-filter-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.ql-filter-title {
    font-size: 14px;
    font-weight: 700;
    color: #1d1d1f;
}
.ql-filter-search {
    width: 100%;
    flex-shrink: 0;
}
.ql-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.ql-filter-label {
    font-size: 12px;
    font-weight: 600;
    color: #86868b;
}
.ql-filter-select {
    width: 100%;
    min-width: 0;
}
.multi-check-list {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    padding: 4px;
    background: #fff;
}
.multi-check-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    font-size: 13px;
    color: #1d1d1f;
    cursor: pointer;
    border-radius: 6px;
}
.multi-check-item:hover {
    background: #f5f5f7;
}
.multi-check-item input[type="checkbox"] {
    accent-color: #0071e3;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
}
.multi-check-empty {
    font-size: 12px;
    color: #c7c7cc;
    padding: 8px;
    text-align: center;
}

/* ========== 个人题库新版界面 ========== */
body.history-page {
    --hist-accent: #2563eb;
    --hist-accent-dark: #1d4ed8;
    --hist-accent-soft: #eaf1fe;
    --hist-accent-border: #d8e5fb;
    --hist-accent-tint: #eef4ff;
    --hist-ink: #16181d;
    --hist-muted: #8a919d;
    --hist-line: #e5e8ee;
    --hist-btn-line: #dde2e9;
    background: #f4f6f8;
}
body.theme-xuefeng.history-page {
    --hist-accent: #7c3aed;
    --hist-accent-dark: #6d28d9;
    --hist-accent-soft: #f3e8ff;
    --hist-accent-border: #e9d5ff;
    --hist-accent-tint: #faf5ff;
}
body.theme-liangliang.history-page {
    --hist-accent: #ca8a04;
    --hist-accent-dark: #a16207;
    --hist-accent-soft: #fef9c3;
    --hist-accent-border: #fef08a;
    --hist-accent-tint: #fefce8;
}
body.theme-taotao.history-page {
    --hist-accent: #db2777;
    --hist-accent-dark: #be185d;
    --hist-accent-soft: #fdf2f8;
    --hist-accent-border: #fbcfe8;
    --hist-accent-tint: #fdf2f8;
}
body.theme-ji.history-page {
    --hist-accent: #16a34a;
    --hist-accent-dark: #15803d;
    --hist-accent-soft: #f0fdf4;
    --hist-accent-border: #bbf7d0;
    --hist-accent-tint: #f0fdf4;
}

body.history-page .main-content {
    padding: 26px 24px 48px;
}

/* 头部 */
body.history-page .history-header {
    display: block;
    max-width: 1560px;
    margin: 0 auto 20px;
    padding: 4px 4px 18px;
    border-bottom: 1px solid var(--hist-line);
}
body.history-page .history-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
body.history-page .history-header-text {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-align: left;
}
body.history-page .history-head-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--hist-accent-soft);
    border: 1px solid var(--hist-accent-border);
    color: var(--hist-accent);
    font-size: 20px;
}
body.history-page .history-header-text h1 {
    margin: 0;
    font-size: 25px;
    line-height: 1.15;
    text-align: left;
    color: var(--hist-ink);
}
body.history-page .history-header-text .subtitle {
    margin: 5px 0 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--hist-muted);
    text-align: left;
}
body.history-page #historyCount {
    display: block;
}

/* 工具栏 */
body.history-page .history-toolbar {
    margin: 0;
}
body.history-page .go-exam-btn {
    padding: 9px 16px;
    border-radius: 9px;
    background: var(--hist-accent);
    font-size: 13px;
    font-weight: 600;
    gap: 7px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12), 0 4px 12px rgba(16, 24, 40, 0.08);
}
body.history-page .go-exam-btn:hover {
    background: var(--hist-accent-dark);
}
body.history-page .go-exam-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #fff;
    color: var(--hist-accent);
    font-size: 11px;
}
body.history-page .batch-btn {
    padding: 9px 15px;
    border-radius: 9px;
    border: 1px solid var(--hist-btn-line);
    background: #fff;
    color: #3f4754;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
body.history-page .batch-btn:hover {
    border-color: var(--hist-accent);
    color: var(--hist-accent);
    background: var(--hist-accent-tint);
}
body.history-page .batch-btn.active {
    background: var(--hist-accent);
    border-color: var(--hist-accent);
    color: #fff;
}

/* 筛选摘要 / 批量操作 */
body.history-page .filter-summary {
    margin-bottom: 14px;
    padding: 9px 14px;
    border-radius: 9px;
    background: var(--hist-accent-tint);
    border: 1px solid var(--hist-accent-border);
    color: #31415e;
    font-size: 12.5px;
}
body.history-page .filter-summary a {
    color: var(--hist-accent);
}
body.history-page .batch-action-bar {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--hist-accent-border);
    background: var(--hist-accent-tint);
}
body.history-page .batch-action-bar .bar-count {
    color: var(--hist-accent);
}
body.history-page .bar-add-exam {
    background: var(--hist-accent);
}
body.history-page .bar-add-exam:hover {
    background: var(--hist-accent-dark);
}
body.history-page .bar-select-all {
    background: var(--hist-accent-soft);
    color: var(--hist-accent);
}
body.history-page .bar-select-all:hover {
    background: var(--hist-accent-border);
}

/* 题目卡片 */
body.history-page #historyCards {
    padding-top: 2px;
}
body.history-page .history-card {
    background: #fff;
    border: 1px solid var(--hist-line);
    border-radius: 10px;
    padding: 15px 17px 13px;
    margin-bottom: 11px;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
body.history-page .history-card:hover {
    border-color: #bfd0e8;
    box-shadow: 0 5px 18px rgba(30, 41, 59, 0.07);
    transform: translateY(-1px);
}
body.history-page .hc-preview {
    margin-bottom: 11px;
    font-size: 14.5px;
    line-height: 1.7;
    color: #2b313b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
body.history-page .hc-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 11px;
    border-top: 1px dashed var(--hist-line);
}
body.history-page .hc-meta .tag,
body.history-page .hc-meta .tag-source {
    font-size: 11.5px;
    line-height: 1.2;
    padding: 4px 9px;
    border-radius: 7px;
}
body.history-page .tag-id {
    padding: 3px 8px;
    border: 1px solid #e1e5eb;
    background: #f3f5f8;
    color: #5d6675;
    font-size: 11px;
}
body.history-page .hc-date {
    margin-left: 6px;
    font-size: 12px;
    color: var(--hist-muted);
    white-space: nowrap;
}
body.history-page .hc-meta .exam-add-btn:first-of-type {
    margin-left: auto;
}
body.history-page .exam-add-btn,
body.history-page .delete-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e1e5eb;
    border-radius: 8px;
    background: #f7f8fa;
    color: #66707f;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.13s ease;
}
body.history-page .exam-add-btn:hover {
    border-color: var(--hist-accent-border);
    background: var(--hist-accent-soft);
    color: var(--hist-accent);
    transform: translateY(-1px);
}
body.history-page .delete-btn:hover {
    border-color: #f1c4ca;
    background: #fef1f2;
    color: #d6455d;
    transform: translateY(-1px);
}
body.history-page .history-card.batch-mode {
    position: relative;
    padding-left: 46px;
}
body.history-page .history-card.batch-mode .hc-checkbox {
    position: absolute;
    left: 16px;
    top: 17px;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--hist-accent);
}
body.history-page .hc-time-popup {
    border-radius: 9px;
    border-color: #e3e7ee;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.1);
}

/* 空状态 / 骨架 / 分页 */
body.history-page .empty-state {
    padding: 64px 24px;
    background: #fff;
    border: 1px dashed #d4dae2;
    border-radius: 12px;
}
body.history-page .empty-icon {
    font-size: 42px;
}
body.history-page .empty-state p {
    font-size: 15px;
    color: #6b7280;
}
body.history-page .empty-desc {
    font-size: 13px;
    color: #9aa1ab;
}
body.history-page .empty-link {
    background: var(--hist-accent);
    border-radius: 9px;
    padding: 10px 22px;
    font-size: 14px;
}
body.history-page .skeleton-card {
    border-radius: 10px;
    border-color: var(--hist-line);
}
body.history-page .pagination-bar {
    border-top: 1px solid var(--hist-line);
    padding: 16px 4px 4px;
}
body.history-page .page-btn {
    border-radius: 8px;
    border-color: var(--hist-btn-line);
    color: #4b5563;
    background: #fff;
}
body.history-page .page-btn:hover {
    border-color: var(--hist-accent);
    color: var(--hist-accent);
    background: var(--hist-accent-tint);
}
body.history-page .page-size-selector select {
    border-radius: 8px;
    border-color: var(--hist-btn-line);
}

/* 左侧题单与筛选面板 */
body.history-page .history-layout {
    display: grid;
    grid-template-columns: 316px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    max-width: 1560px;
    margin: 0 auto;
}
body.history-page .history-main-area {
    order: 1;
    max-width: none;
}
body.history-page .ql-panel {
    order: 0;
    position: sticky;
    top: 24px;
    width: auto;
    height: calc(100vh - 48px);
    max-height: calc(100vh - 48px);
    border-radius: 12px;
    border: 1px solid var(--hist-line);
    box-shadow: 0 2px 10px rgba(16, 24, 40, 0.05);
    overflow: hidden;
}
body.history-page.standalone-ref .history-layout {
    display: block;
    max-width: 1200px;
}
body.history-page.standalone-ref .history-main-area {
    max-width: 1200px;
    margin: 0 auto;
}
body.history-page .ql-panel-header {
    padding: 15px 16px 13px;
    font-size: 14px;
    font-weight: 650;
    color: #1b1f27;
    border-bottom: 1px solid #eef0f3;
}
body.history-page .ql-panel-header .hlh-icon {
    color: var(--hist-accent);
}
body.history-page .ql-icon-btn {
    border-radius: 7px;
    color: #7a8494;
}
body.history-page .ql-icon-btn:hover {
    background: #f0f3f7;
    color: #333a46;
}
body.history-page .ql-panel-body {
    padding: 6px 8px;
    max-height: 240px;
}
body.history-page .history-list-section-title {
    padding: 9px 10px 5px;
    color: #9aa1ab;
    font-size: 11px;
}
body.history-page .history-list-item {
    padding-top: 8px;
    padding-bottom: 8px;
    border-radius: 8px;
    margin: 2px 0;
    font-size: 13.5px;
}
body.history-page .history-list-item:hover {
    background: #f4f6f9;
}
body.history-page .history-list-item .list-icon {
    font-size: 15px;
    width: 20px;
}
body.history-page .history-list-item .list-count {
    font-size: 11px;
    border-radius: 8px;
    background: #f0f2f5;
    color: #7a8494;
}
body.history-page .history-list-divider {
    margin: 4px 10px;
}
body.history-page .ql-add-btn {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--hist-accent);
}
body.history-page .ql-add-btn:hover {
    background: #f4f7fb;
}
body.history-page .ql-filter-section {
    padding: 14px 16px 18px;
    gap: 13px;
}
body.history-page .ql-filter-title {
    font-size: 13px;
    color: #333a46;
}
body.history-page .filter-reset {
    padding: 5px 10px;
    border-radius: 7px;
    border-color: var(--hist-btn-line);
    background: #f7f8fa;
    color: #66707f;
    font-size: 12px;
}
body.history-page .filter-reset:hover {
    background: #edf0f4;
    color: #333a46;
}
body.history-page .ql-filter-label {
    font-size: 11.5px;
    color: #7a8494;
    font-weight: 600;
}
body.history-page .ql-filter-search {
    background: #f7f8fa;
    border-color: #e1e5eb;
    border-radius: 8px;
    padding: 0 11px;
}
body.history-page .ql-filter-search:focus-within {
    border-color: var(--hist-accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
body.history-page .ql-filter-search input {
    font-size: 13px;
}
body.history-page .ql-filter-search .search-icon {
    font-size: 14px;
    color: #98a0ac;
}
body.history-page .filter-select {
    min-width: 0;
    padding: 8px 28px 8px 10px;
    border-color: var(--hist-btn-line);
    border-radius: 8px;
    background-color: #fff;
    font-size: 13px;
    color: #2f3540;
}
body.history-page .filter-select:hover {
    border-color: var(--hist-accent);
}
body.history-page .filter-select:focus {
    border-color: var(--hist-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
/* 顶部搜索 + 题单条 */
body.history-page .history-topbar {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    max-width: 1560px;
    margin: 0 auto 18px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid var(--hist-line);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(16, 24, 40, 0.05);
}
body.history-page .topbar-search {
    background: #f7f8fa;
    border-color: #e1e5eb;
    border-radius: 9px;
    padding: 0 12px;
    height: 42px;
}
body.history-page .topbar-search:focus-within {
    border-color: var(--hist-accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
body.history-page .topbar-search input {
    font-size: 14px;
    min-width: 0;
}
body.history-page .filter-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #98a0ac;
    cursor: pointer;
    transition: all 0.12s;
}
body.history-page .filter-search-clear:hover {
    background: #eef1f5;
    color: #333a46;
}
body.history-page .history-topbar-lists {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
body.history-page .history-topbar-lists-head {
    display: flex;
    align-items: center;
    gap: 6px;
}
body.history-page .history-topbar-lists-title {
    font-size: 12px;
    font-weight: 650;
    color: #7a8494;
    margin-left: 2px;
}
body.history-page .history-topbar-lists-head .ql-icon-btn {
    width: 24px;
    height: 24px;
}
body.history-page .history-topbar-list-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
body.history-page .history-topbar .ql-panel-body {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    max-height: none;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px;
    scrollbar-width: thin;
}
body.history-page .history-topbar .ql-panel-body::-webkit-scrollbar {
    height: 5px;
}
body.history-page .history-topbar .history-list-section-title,
body.history-page .history-topbar .history-list-divider {
    display: none !important;
}
body.history-page .history-topbar .history-list-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    width: auto;
    padding: 7px 12px !important;
    margin: 0;
    border: 1px solid #e7eaef;
    border-radius: 999px;
    background: #fbfcfe;
    font-size: 13px;
    line-height: 1.2;
}
body.history-page .history-topbar .history-list-item:hover {
    background: #f0f3f7;
    border-color: #d4dae3;
}
body.history-page .history-topbar .history-list-item.active {
    background: var(--hist-accent-tint);
    border-color: rgba(37, 99, 235, 0.35);
    color: var(--hist-accent);
    font-weight: 600;
}
body.history-page .history-topbar .history-list-item .list-icon {
    font-size: 14px;
    width: 17px;
}
body.history-page .history-topbar .history-list-item .list-name {
    max-width: 150px;
}
body.history-page .history-topbar .history-list-item .list-count {
    min-width: 20px;
    padding: 1px 7px;
    font-size: 11px;
}
body.history-page .history-topbar .history-list-item .list-actions {
    display: none !important;
}
body.history-page .history-topbar .ql-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto;
    width: auto;
    padding: 8px 13px;
    border: 1px dashed #c9d3e2;
    border-radius: 999px;
    background: #f7f9fc;
    color: var(--hist-accent);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.12s;
}
body.history-page .history-topbar .ql-add-btn:hover {
    background: var(--hist-accent-tint);
    border-color: var(--hist-accent);
}
body.history-page .history-topbar .ql-add-btn svg {
    flex-shrink: 0;
}
body.history-page .multi-check-list {
    border-radius: 8px;
    border-color: #e1e5eb;
}
body.history-page .multi-check-item {
    font-size: 12.5px;
    color: #3a414d;
}
body.history-page .multi-check-item input[type="checkbox"] {
    accent-color: var(--hist-accent);
}

/* 详情页 */
body.history-page .back-btn {
    border-radius: 9px;
    border-color: var(--hist-btn-line);
    background: #fff;
    color: #4b5563;
    font-size: 13px;
}
body.history-page .back-btn:hover {
    background: #f4f6f9;
    border-color: #c3cedb;
    color: #1f2530;
}
body.history-page .detail-question {
    border-radius: 10px;
    border-color: var(--hist-line);
    box-shadow: 0 2px 10px rgba(16, 24, 40, 0.04);
}
body.history-page .detail-question h3 {
    font-size: 12px;
    color: #7a8494;
}
body.history-page .meta-bar {
    gap: 8px;
    padding-bottom: 14px;
}
body.history-page .chunk-card {
    border-radius: 10px;
    border-color: var(--hist-line);
    box-shadow: 0 1px 6px rgba(16, 24, 40, 0.04);
}
body.history-page .chunk-header {
    background: #fafbfc;
}
body.history-page .chunk-label {
    background: var(--hist-accent-soft);
    color: var(--hist-accent);
    border-radius: 6px;
}
body.history-page .step {
    border-radius: 9px;
    border-color: var(--hist-line);
}
body.history-page .step-header {
    border-left-color: var(--hist-accent);
}
body.history-page .final-answer {
    border-radius: 9px;
    background: var(--hist-accent-tint);
    color: var(--hist-accent);
}
body.history-page .step-error-btn {
    border-radius: 7px;
    border-color: var(--hist-btn-line);
    background: #f7f8fa;
    color: #66707f;
    font-size: 12px;
}

/* 弹窗与提示 */
body.history-page .confirm-dialog,
body.history-page .save-dialog,
body.history-page .error-dialog,
body.history-page .ai-gen-dialog {
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(16, 24, 40, 0.22);
}
body.history-page .confirm-actions button,
body.history-page .save-dialog-actions button,
body.history-page .ed-btn-cancel,
body.history-page .ed-btn-confirm,
body.history-page .ai-gen-action {
    border-radius: 8px;
}
body.history-page .toast {
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.14);
}

@media (max-width: 1200px) {
    body.history-page .history-topbar {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    body.history-page .history-topbar-search {
        width: 100%;
    }
    body.history-page .topbar-search {
        max-width: 420px;
    }
    body.history-page .history-layout {
        grid-template-columns: 1fr;
    }
    body.history-page .ql-panel {
        position: static;
        height: auto;
        max-height: none;
        width: auto;
    }
    body.history-page .ql-filter-section {
        flex: none;
        height: auto;
        max-height: none;
    }
    body.history-page .ql-panel-body {
        max-height: 220px;
    }
}

@media (max-width: 640px) {
    body.history-page .history-topbar {
        padding: 10px 12px;
        border-radius: 10px;
    }
    body.history-page .topbar-search {
        max-width: none;
    }
    body.history-page .main-content {
        padding: 18px 14px 40px;
    }
    body.history-page .history-header {
        padding: 2px 2px 14px;
    }
    body.history-page .history-header-inner {
        justify-content: center;
    }
    body.history-page .history-header-text {
        justify-content: center;
    }
    body.history-page .history-toolbar {
        justify-content: center;
        width: 100%;
    }
    body.history-page .history-card {
        padding: 13px 14px 12px;
    }
    body.history-page .hc-meta .exam-add-btn:first-of-type {
        margin-left: 0;
    }
    body.history-page .pagination-bar {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}
