*{box-sizing:border-box}body{margin:0;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:#f6f7fb;color:#172033}body.auth-loading .topbar,body.auth-loading .layout,body.auth-required .topbar,body.auth-required .layout{display:none}body.app-ready .auth-gate{display:none}body.auth-loading .auth-form,body.auth-loading .auth-help{display:none}.auth-gate{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;background:#f6f7fb}.auth-card{width:min(460px,100%);background:#fff;border:1px solid #e5e7eb;border-radius:18px;padding:26px;box-shadow:0 18px 50px rgba(15,23,42,.08)}body.auth-loading .auth-card{text-align:center}.auth-eyebrow{font-size:12px;font-weight:900;color:#2563eb;margin-bottom:10px}.auth-card h1{font-size:26px;line-height:1.25;margin:0 0 10px}.auth-card p{color:#64748b;line-height:1.55;margin:0 0 18px}.auth-form{display:grid;grid-template-columns:1fr auto;gap:8px}.auth-message{margin-top:12px;font-size:13px;color:#475569;font-weight:800}.auth-message[data-kind="error"]{color:#dc2626}.auth-message[data-kind="success"]{color:#047857}.topbar{display:flex;gap:16px;align-items:center;justify-content:space-between;padding:18px 24px;background:white;border-bottom:1px solid #e5e7eb;position:sticky;top:0;z-index:10}.topbar h1{margin:0;font-size:22px}.topbar p{margin:4px 0 0;color:#6b7280;font-size:13px}.top-actions{display:flex;gap:8px;flex-wrap:wrap}.layout{display:grid;grid-template-columns:340px 1fr;height:calc(100vh - 82px)}.sidebar{padding:14px;background:#fff;border-right:1px solid #e5e7eb;overflow:auto}.detail{overflow:auto;padding:24px}.primary,button,.fileBtn{border:1px solid #d1d5db;background:#fff;border-radius:10px;padding:9px 12px;font-weight:700;cursor:pointer}.primary,button.primary{background:#2563eb;color:white;border-color:#2563eb}button:disabled,input:disabled{cursor:not-allowed;opacity:.65}.secondary{background:#f9fafb}.full{width:100%;margin-bottom:12px}input,select,textarea{width:100%;border:1px solid #d1d5db;border-radius:10px;padding:9px 10px;font:inherit;background:white}.filters{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:10px 0}.count{font-size:13px;color:#6b7280;margin:10px 2px}.question-list{display:flex;flex-direction:column;gap:7px}.qitem{padding:10px;border:1px solid #e5e7eb;border-radius:12px;background:#fff;cursor:pointer}.qitem.active{border-color:#2563eb;background:#eff6ff}.qitem-title{font-weight:800;font-size:14px}.qitem-meta{font-size:12px;color:#6b7280;margin-top:4px}.tags{display:flex;gap:5px;flex-wrap:wrap;margin-top:6px}.tag{font-size:11px;background:#eef2ff;color:#3730a3;border-radius:999px;padding:3px 7px}.card{background:white;border:1px solid #e5e7eb;border-radius:18px;padding:18px;box-shadow:0 8px 24px rgba(15,23,42,.05);max-width:1180px;margin:0 auto 18px}.card h2{margin:8px 0 6px;font-size:26px}.meta{color:#6b7280;font-size:14px}.actions{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}.image-panel{display:flex;flex-direction:column;gap:18px;margin-top:14px}.problem-img{max-width:100%;width:min(900px,100%);height:auto;border:1px solid #d1d5db;border-radius:10px;background:white;display:block;margin:0 auto}.image-caption{text-align:center;font-size:12px;color:#6b7280;margin-top:-10px}.section-title{font-weight:900;margin:20px 0 8px}.analysis-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.analysis-box{min-height:260px}.preview{white-space:pre-wrap;line-height:1.65;background:#fbfdff;border:1px solid #dbeafe;border-radius:12px;padding:12px;min-height:260px}.record-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.empty{text-align:center;color:#6b7280;padding:80px}.modal-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.5);display:flex;align-items:center;justify-content:center;z-index:99}.modal{background:white;border-radius:18px;padding:20px;width:min(900px,95vw);max-height:90vh;overflow:auto}.form-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}.form-grid .wide{grid-column:1/-1}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:14px}@media(max-width:900px){.auth-form{grid-template-columns:1fr}.layout{grid-template-columns:1fr;height:auto}.sidebar{height:40vh}.analysis-grid,.record-grid{grid-template-columns:1fr}.topbar{position:static;display:block}.top-actions{margin-top:10px}.form-grid{grid-template-columns:1fr}}
.preview{white-space:normal;overflow:auto;font-size:15px;color:#172033}.preview h1,.preview h2,.preview h3,.preview h4,.preview h5,.preview h6{margin:18px 0 8px;line-height:1.35;color:#111827}.preview h1{font-size:24px}.preview h2{font-size:21px}.preview h3{font-size:18px}.preview h4,.preview h5,.preview h6{font-size:16px}.preview p{margin:8px 0}.preview ul,.preview ol{margin:8px 0 12px 22px;padding:0}.preview li{margin:4px 0}.preview hr{border:0;border-top:1px solid #dbeafe;margin:18px 0}.preview code{background:#eef2ff;border:1px solid #dbeafe;border-radius:5px;padding:1px 5px;font-family:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",monospace;font-size:.92em}.preview pre{background:#0f172a;color:#e5e7eb;border-radius:10px;padding:12px;overflow:auto}.preview pre code{background:transparent;border:0;color:inherit;padding:0}.preview mjx-container{overflow-x:auto;overflow-y:hidden;max-width:100%;padding:4px 0}.preview-empty{color:#6b7280;text-align:center;padding:80px 0}
.evidence-anchor{border-radius:5px;background:#fff7ed;box-shadow:inset 0 -2px 0 #fed7aa;outline:1px solid transparent;cursor:pointer;transition:background .15s ease,outline-color .15s ease}.evidence-anchor:focus{outline:2px solid #fb923c;outline-offset:2px}.evidence-pill{display:inline-flex;align-items:center;margin-left:5px;padding:1px 6px;border:1px solid #fdba74;border-radius:999px;background:#ffedd5;color:#9a3412;font-size:11px;font-weight:900;line-height:1.5;vertical-align:1px}.source-evidence-highlight{border-radius:5px;background:transparent;box-shadow:none;outline:1px solid transparent;transition:background .15s ease,box-shadow .15s ease,outline-color .15s ease}.source-evidence-highlight.evidence-active{background:#fef3c7!important;box-shadow:inset 0 -2px 0 #f59e0b;outline:2px solid #f59e0b!important;outline-offset:1px}.evidence-anchor.evidence-active{background:#fde68a!important;outline:2px solid #f59e0b!important;outline-offset:1px}.evidence-unmatched{margin-top:8px;padding:8px 10px;border:1px dashed #fca5a5;border-radius:8px;background:#fff7f7;color:#b91c1c;font-size:12px;font-weight:800}
.graph-widget{border:1px solid #dbeafe;background:#fff;border-radius:14px;margin:14px 0;overflow:hidden}.graph-formula{padding:14px 16px;border-bottom:1px solid #e5e7eb;background:#f8fafc}.graph-stage{height:260px;background:white}.graph-canvas{display:block;width:100%;height:100%}.graph-controls{padding:10px 14px;border-top:1px solid #e5e7eb;background:#fbfdff}.graph-controls label{display:grid;grid-template-columns:auto auto 1fr;align-items:center;gap:10px;color:#334155;font-size:13px}.graph-controls input{padding:0}
.math-copy-block{position:relative;margin:10px 0;padding:8px 42px 8px 8px;border-radius:10px;background:#fff}.math-copy-block:hover{background:#f8fafc}.math-copy-btn{position:absolute;right:8px;top:8px;border-radius:7px;padding:4px 7px;font-size:11px;font-weight:700;background:#f1f5f9;color:#334155;border-color:#cbd5e1}.math-copy-btn:hover{background:#e2e8f0}.math-render{overflow-x:auto}
.sync-panel{border:1px solid #e5e7eb;background:#f8fafc;border-radius:12px;padding:10px;margin:0 0 12px}.sync-status{font-size:12px;color:#475569;font-weight:800;margin-bottom:8px}.auth-row{display:grid;grid-template-columns:1fr auto;gap:6px}.auth-row button[hidden],.auth-row input[hidden]{display:none}.auth-row input{font-size:13px}.auth-row button{font-size:12px;padding:8px 9px}.offline-actions{display:none;grid-template-columns:1fr;gap:6px;margin-top:8px}.offline-actions button{padding:7px 8px;border-radius:8px;font-size:12px;background:#fff}.offline-actions button:last-child{background:#f1f5f9}.analysis-source{font-size:12px;color:#64748b;font-weight:800;margin:-4px 0 8px}
.auth-form{grid-template-columns:1fr}.auth-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}.auth-actions button[hidden]{display:none}.auth-actions #resetPasswordBtn{grid-column:1/-1}.auth-actions #updatePasswordBtn{grid-column:1/-1}.save-state{align-self:center;color:#64748b;font-size:12px;font-weight:800}.save-state[data-kind="success"]{color:#047857}.save-state[data-kind="error"]{color:#dc2626}
.auth-help{font-size:13px;color:#334155;background:#f8fafc;border:1px solid #e5e7eb;border-radius:10px;padding:9px 10px}
.modal-help{margin:0 0 10px;color:#64748b;font-size:13px;line-height:1.5}.export-code{min-height:52vh;font-family:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",monospace;font-size:12px;line-height:1.45;white-space:pre;overflow:auto}
.button-link{display:inline-flex;align-items:center;justify-content:center;border:1px solid #d1d5db;background:#fff;border-radius:10px;padding:9px 12px;font-weight:700;color:#172033;text-decoration:none}.record-title-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:20px 0 8px}.record-title-row .section-title{margin:0}.analysis-empty{min-height:160px;display:flex;align-items:center;justify-content:center;background:#fbfdff;border:1px solid #dbeafe;border-radius:12px}
body:not([data-mode="admin"]) .topbar{padding:14px 22px}body:not([data-mode="admin"]) .topbar h1{font-size:21px}body:not([data-mode="admin"]) .layout{grid-template-columns:320px minmax(0,1fr);height:calc(100vh - 70px)}body:not([data-mode="admin"]) .sidebar{padding:12px;background:#fbfcff}body:not([data-mode="admin"]) .detail{padding:0;background:#f6f7fb}.folder-tree{display:flex;flex-direction:column;gap:6px}.folder-item{display:grid;grid-template-columns:18px minmax(0,1fr) auto;align-items:center;gap:8px;width:100%;min-height:38px;border:1px solid #e1e7f0;background:#fff;color:#172033;border-radius:10px;padding:7px 9px;text-align:left}.folder-item.depth-1{width:calc(100% - 20px);margin-left:20px}.folder-item.depth-2{width:calc(100% - 40px);margin-left:40px}.folder-item.active{border-color:#7c9cff;background:#eef3ff}.folder-caret{color:#8b5cf6;font-size:11px}.folder-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:800}.folder-count,.file-status{border:1px solid #dbe4f0;background:#f3f6fb;border-radius:999px;color:#64748b;font-size:12px;font-weight:900;min-width:28px;padding:3px 8px;text-align:center}.library-panel{min-height:100%;padding:26px}.library-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:18px}.eyebrow{font-size:12px;font-weight:900;color:#2563eb;margin-bottom:6px}.library-heading h2{font-size:26px;line-height:1.25;margin:0}.library-heading p{margin:6px 0 0;color:#64748b}.file-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:10px}.file-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:12px;min-height:76px;border:1px solid #e1e7f0;background:#fff;border-radius:10px;padding:12px;text-align:left}.file-row:hover{border-color:#7c9cff;background:#f8fbff}.file-icon{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:8px;background:#eef2ff;color:#3730a3;font-size:12px;font-weight:900}.file-main{display:flex;flex-direction:column;gap:4px;min-width:0}.file-main strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px}.file-main span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#64748b;font-size:12px}body:not([data-mode="admin"]).question-open .layout{display:block;height:calc(100vh - 70px)}body:not([data-mode="admin"]).question-open .sidebar{display:none}body:not([data-mode="admin"]).question-open .detail{height:calc(100vh - 70px);overflow:auto;background:#fff}.question-page{min-height:100%;background:#fff}.question-toolbar{position:sticky;top:0;z-index:8;display:flex;align-items:center;gap:12px;padding:10px 18px;background:rgba(255,255,255,.96);border-bottom:1px solid #e5e7eb}.question-path{color:#64748b;font-size:13px;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.question-hero{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding:18px 24px;border-bottom:1px solid #edf0f5}.question-hero h2{margin:0;font-size:24px}.question-hero p{margin:6px 0 0;color:#64748b}.question-grid{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(360px,.85fr);gap:0;align-items:start}.problem-surface,.study-surface{padding:22px 24px}.study-surface{border-left:1px solid #edf0f5;background:#fbfdff;min-height:calc(100vh - 174px)}.study-surface .preview{background:#fff}.record-grid-single{grid-template-columns:1fr}@media(max-width:980px){body:not([data-mode="admin"]) .layout{grid-template-columns:1fr;height:auto}body:not([data-mode="admin"]) .sidebar{height:auto;border-right:0;border-bottom:1px solid #e5e7eb}.folder-item.depth-1,.folder-item.depth-2{width:100%;margin-left:0}.question-grid{grid-template-columns:1fr}.study-surface{border-left:0;border-top:1px solid #edf0f5;min-height:0}.question-hero{display:block}.file-list{grid-template-columns:1fr}}
body.question-open .layout{display:block;height:calc(100vh - 70px)}body.question-open .sidebar{display:none}body.question-open .detail{height:calc(100vh - 70px);overflow:auto;background:#fff;padding:0}.file-main strong,.file-main span{white-space:normal;overflow:visible;text-overflow:clip;line-height:1.35}.file-tags{display:flex!important;flex-wrap:wrap;gap:4px}.file-tags span{width:auto;border:1px solid #e0e7ff;border-radius:999px;padding:2px 6px;background:#f8f7ff;color:#4f46e5;font-weight:800}.tag-filter-bar{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 14px}.tag-filter{border-radius:999px;background:#fff}.tag-filter.active{background:#635bff;color:#fff;border-color:#635bff}.tag-filter span{display:inline-flex;align-items:center;justify-content:center;min-width:22px;margin-left:5px;border-radius:999px;background:rgba(255,255,255,.25);font-size:12px}.tag-filter-note{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 14px;padding:14px;border:1px solid #ddd6fe;background:#fbfaff;border-radius:12px;color:#334155}.tag-filter-note button{white-space:nowrap}.tag-click,.editable-tag{cursor:pointer}.tag-editor-chips{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}.tag-empty{color:#64748b;font-size:13px}.tag-input-row{display:grid;grid-template-columns:1fr auto;gap:8px}.admin-question-grid{grid-template-columns:minmax(0,1fr) minmax(420px,.8fr)}
.folder-name{white-space:normal;overflow:visible;text-overflow:clip;line-height:1.3}.folder-item.depth-3{width:calc(100% - 60px);margin-left:60px}.folder-item.depth-4{width:calc(100% - 80px);margin-left:80px}.folder-item.depth-5{width:calc(100% - 100px);margin-left:100px}.library-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}button.danger{border-color:#fecaca;background:#fff5f5;color:#b91c1c}.folder-chip{border:1px solid #c7d2fe;background:#eef2ff;color:#3730a3;border-radius:999px;padding:5px 9px;font-size:12px;font-weight:900}.folder-editor .full{margin-top:8px;margin-bottom:0}.folder-editor select{min-width:0}@media(max-width:980px){.library-actions{justify-content:flex-start}.folder-item.depth-3,.folder-item.depth-4,.folder-item.depth-5{width:100%;margin-left:0}}
.question-jump{width:min(260px,42vw);min-width:160px;padding:8px 10px;border-radius:10px;font-weight:800}
.support-panel{margin:0 0 18px;padding:14px;border:1px solid #dbeafe;background:#fbfdff;border-radius:12px}.support-panel .section-title{margin:0 0 6px}.support-panel p{margin:0 0 10px;color:#64748b;font-size:13px;line-height:1.5}.support-form{display:grid;grid-template-columns:minmax(130px,180px) minmax(0,1fr) auto;gap:8px;align-items:start}.support-form textarea{min-height:42px}.support-state{margin-top:8px;color:#64748b;font-size:12px;font-weight:800}.support-state[data-kind="success"]{color:#047857}.support-state[data-kind="error"]{color:#dc2626}.support-list{display:grid;gap:10px}.support-empty{padding:18px;border:1px dashed #cbd5e1;border-radius:10px;color:#64748b;text-align:center;background:#fff}.support-request{border:1px solid #e5e7eb;background:#fff;border-radius:10px;padding:12px}.support-request-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.support-status{border:1px solid #dbe4f0;background:#f3f6fb;border-radius:999px;padding:3px 8px;font-size:12px;font-weight:900;color:#475569}.support-meta{margin-top:4px;color:#64748b;font-size:12px}.support-request p{white-space:pre-wrap;margin:10px 0;color:#172033}.support-actions{display:flex;gap:6px;flex-wrap:wrap}.support-actions button{font-size:12px;padding:6px 8px}
.admin-support-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:10px 0 12px}.admin-support-tools button{padding:7px 10px;border-radius:9px;font-size:12px}.admin-support-tools span{color:#64748b;font-size:12px;font-weight:800}
.admin-requests-shell{min-height:calc(100vh - 70px);background:#f6f7fb;padding:24px}.admin-requests-shell .library-panel{max-width:980px;margin:0 auto;background:#fff;border:1px solid #e1e7f0;border-radius:14px}.admin-requests-panel{border:0;background:transparent;margin:0}
@media(max-width:760px){.support-form{grid-template-columns:1fr}.support-form button{width:100%}}
.home-dashboard{margin:0 0 22px;padding:18px;border:1px solid #dbeafe;background:linear-gradient(180deg,#fff,#f8fbff);border-radius:14px}.dashboard-head{display:flex;align-items:flex-end;justify-content:space-between;gap:18px;margin-bottom:14px}.dashboard-head h2{margin:0;font-size:24px}.dashboard-head p{max-width:620px;margin:0;color:#64748b;font-size:13px;line-height:1.5}.dashboard-cards{display:grid;grid-template-columns:repeat(5,minmax(120px,1fr));gap:8px}.dashboard-card{display:flex;min-height:92px;flex-direction:column;align-items:flex-start;justify-content:space-between;text-align:left;background:#fff;border-color:#dbe4f0}.dashboard-card span{font-size:24px;font-weight:950;color:#2563eb}.dashboard-card small{color:#64748b;font-weight:800}.recent-strip{margin-top:12px;display:grid;grid-template-columns:120px repeat(3,minmax(0,1fr));gap:8px;align-items:stretch}.recent-strip-title{display:flex;align-items:center;color:#334155;font-weight:950}.recent-strip button{min-width:0;text-align:left;background:#fff;border-color:#e1e7f0}.recent-strip button strong,.recent-strip button span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.recent-strip button span{margin-top:3px;color:#64748b;font-size:12px}.recent-empty{grid-column:2/-1;padding:12px;border:1px dashed #cbd5e1;border-radius:10px;background:#fff;color:#64748b}.admin-lock-panel{max-width:620px;margin:80px auto;padding:28px;border:1px solid #dbeafe;background:#fff;border-radius:18px;box-shadow:0 18px 50px rgba(15,23,42,.08)}.admin-lock-panel h2{margin:0 0 10px;font-size:26px}.admin-lock-panel p{color:#64748b;line-height:1.6}.admin-locked .layout{display:block}.admin-locked .sidebar{display:none}.admin-locked .top-actions button{display:none}
@media(max-width:980px){.dashboard-head{display:block}.dashboard-head p{margin-top:8px}.dashboard-cards{grid-template-columns:repeat(2,minmax(0,1fr))}.recent-strip{grid-template-columns:1fr}.recent-empty{grid-column:auto}}
@media(max-width:980px){.offline-actions{display:grid}}
.source-editor{display:grid;gap:10px;margin:0 0 18px;padding:14px;border:1px solid #dbeafe;background:#fff;border-radius:12px}.source-editor .section-title{margin:0}.source-editor label{display:grid;gap:6px;color:#334155;font-size:13px;font-weight:800}.source-editor textarea{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;line-height:1.55}.source-editor-help{margin:0;color:#64748b;font-size:12px;line-height:1.5}
.image-panel{gap:14px}.problem-image-card{margin:0;border:1px solid #dbe4f0;border-radius:12px;background:#fff;overflow:hidden}.image-toolbar{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 10px;border-bottom:1px solid #edf2f7;background:#f8fafc}.image-counter{font-size:12px;font-weight:900;color:#475569}.image-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end}.image-actions button,.image-fallback-actions button{padding:6px 8px;border-radius:8px;font-size:12px}.image-zoom{min-width:44px;text-align:center;font-size:12px;font-weight:900;color:#334155}.image-scroll{overflow:auto;background:#f8fafc;text-align:center;max-height:none;padding:12px}.problem-image-card .problem-img{display:block;height:auto;margin:0 auto;border:0;border-radius:8px;background:white;box-shadow:0 0 0 1px #e2e8f0}.problem-image-card[data-fit="width"] .problem-img{width:100%;max-width:100%}.problem-image-card[data-fit="free"] .problem-img{width:calc(100% * var(--image-zoom,1));max-width:none}.image-fallback{padding:28px 16px;text-align:center;border:1px dashed #cbd5e1;border-radius:10px;background:#fff;color:#334155}.image-fallback strong{display:block;margin-bottom:6px}.image-fallback p{margin:0 auto 12px;max-width:680px;color:#64748b;font-size:12px;word-break:break-all}.image-fallback-actions{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}.image-empty{border:1px dashed #cbd5e1;border-radius:12px;background:#fff}.problem-image-card:fullscreen{background:#0f172a;border:0;border-radius:0;padding:10px}.problem-image-card:fullscreen .image-toolbar{background:#111827;border-color:#334155;color:#e5e7eb}.problem-image-card:fullscreen .image-counter,.problem-image-card:fullscreen .image-zoom{color:#e5e7eb}.problem-image-card:fullscreen .image-scroll{height:calc(100vh - 58px);background:#0f172a;display:flex;align-items:flex-start}.problem-image-card:fullscreen .problem-img{background:#fff}@media(max-width:760px){.image-toolbar{align-items:flex-start;flex-direction:column}.image-actions{justify-content:flex-start}.image-actions button{padding:7px 8px}.image-scroll{padding:8px}.problem-image-card[data-fit="free"] .problem-img{width:calc(140% * var(--image-zoom,1))}}

.file-list{
  align-items:stretch;
}

.file-row{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  justify-content:flex-start;
  gap:10px;
  min-height:150px;
  padding:14px;
  overflow:hidden;
}

.file-icon{
  display:none !important;
}

.file-card-head{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  min-height:30px;
}

.file-card-head .file-badges{
  width:100%;
  justify-content:flex-start;
}

.file-main{
  flex:1 1 auto;
  gap:5px;
}

.file-main strong{
  display:block;
  color:#0f172a;
  font-size:16px;
  line-height:1.35;
  white-space:normal;
  overflow:visible;
  text-overflow:clip;
  word-break:keep-all;
  overflow-wrap:break-word;
}

.file-main .file-meta{
  display:block;
  color:#64748b;
  font-size:12px;
  line-height:1.45;
  white-space:normal;
  overflow:visible;
  text-overflow:clip;
  word-break:keep-all;
}

.file-tags{
  margin-top:auto;
  padding-top:2px;
}

.file-tags.empty-tags{
  display:none !important;
}

.file-status.has-analysis-status{
  background:#ecfdf5;
  border-color:#bbf7d0;
  color:#047857;
}

.file-status.ai-status.missing-status{
  background:#f8fafc;
  border-color:#dbe4f0;
  color:#64748b;
}

.dashboard-cards{
  grid-template-columns:repeat(4,minmax(120px,1fr));
}

.study-surface{
  display:flex;
  flex-direction:column;
  gap:12px;
  height:calc(100vh - 96px);
  max-height:calc(100vh - 96px);
  overflow:hidden;
}

.question-panel-tabs{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px;
}

.question-panel-tabs button{
  min-width:0;
  border-radius:9px;
  background:#fff;
  color:#334155;
  padding:9px 8px;
}

.question-panel-tabs button.active{
  background:#2563eb;
  border-color:#2563eb;
  color:#fff;
}

.question-panel{
  min-height:0;
  flex:1 1 0;
  display:flex;
  flex-direction:column;
}

.question-analysis-panel .section-title{
  margin-top:0;
}

.question-analysis-scroll{
  flex:1 1 0;
  min-height:0;
  overflow:auto;
}

.question-record-panel .record-title-row{
  margin-top:0;
}

.question-record-scroll{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
  padding-right:4px;
}

.question-record-scroll textarea{
  min-height:108px;
}

.question-support-panel{
  overflow:auto;
}

.question-support-panel .support-panel{
  margin-bottom:0;
}

@media(max-width:980px){
  .study-surface{
    height:auto;
    max-height:none;
    overflow:visible;
  }

  .question-analysis-scroll,
  .question-record-scroll,
  .question-support-panel{
    max-height:none;
    overflow:visible;
  }
}

body.auth-loading .top-support-popover,
body.auth-required .top-support-popover{
  display:none !important;
}

.top-support-popover{
  position:fixed;
  top:62px;
  right:22px;
  z-index:40;
  width:min(720px, calc(100vw - 32px));
  padding:14px;
  border:1px solid #dbeafe;
  border-radius:16px;
  background:#fff;
  box-shadow:0 18px 60px rgba(15,23,42,.16);
}

.top-support-popover[hidden]{
  display:none;
}

.top-support-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}

.top-support-head strong{
  font-size:15px;
}

.top-support-head button{
  padding:6px 9px;
  border-radius:8px;
  font-size:12px;
}

.top-support-popover .support-panel{
  margin:0;
  padding:0;
  border:0;
  background:transparent;
}

.top-support-popover .support-form{
  grid-template-columns:minmax(130px,170px) minmax(0,1fr) auto;
}

.top-support-popover .support-form textarea{
  min-height:70px;
}

.example-box{
  margin:14px 0;
  padding:16px 18px;
  border:1px solid #cbd5e1;
  border-radius:8px;
  background:#fff;
  color:#172033;
}

.example-box-title{
  margin:0 0 10px;
  font-weight:950;
  text-align:center;
}

.example-box p{
  margin:7px 0;
}

body.question-open .detail{
  overflow:auto;
  padding-bottom:72px;
}

body.question-open .question-page{
  height:auto;
  min-height:0;
  display:flex;
  flex-direction:column;
}

body.question-open .question-toolbar,
body.question-open .question-hero{
  flex:0 0 auto;
}

body.question-open .question-grid{
  flex:1 1 auto;
  min-height:0;
  align-items:stretch;
  overflow:visible;
}

body.question-open .problem-surface,
body.question-open .study-surface{
  min-height:0;
  height:auto;
  max-height:none;
  overflow:hidden;
}

body.question-open .problem-surface{
  display:flex;
  flex-direction:column;
  overflow:visible;
}

body.question-open .problem-source-combo,
body.question-open .problem-source-main,
body.question-open .image-panel,
body.question-open .problem-image-card{
  min-height:0;
  flex:1 1 auto;
}

body.question-open .problem-source-combo{
  height:100%;
}

body.question-open .problem-source-main,
body.question-open .problem-image-card{
  display:flex;
  flex-direction:column;
}

body.question-open .problem-image-card .image-scroll{
  flex:1 1 auto;
  height:clamp(380px, 64vh, 680px);
  max-height:clamp(380px, 64vh, 680px);
  min-height:0;
  overflow:auto;
  scrollbar-gutter:stable;
}

body.question-open .problem-source-aside{
  max-height:100%;
}

@media(max-width:980px){
  body.question-open .detail,
  body.question-open .question-grid,
  body.question-open .problem-surface,
  body.question-open .study-surface{
    overflow:visible;
  }

  body.question-open .question-page,
  body.question-open .problem-source-combo{
    height:auto;
  }

  body.question-open .problem-image-card .image-scroll{
    height:auto;
    max-height:none;
    min-height:0;
  }
}

@media(max-width:760px){
  .top-support-popover{
    top:10px;
    right:10px;
    left:10px;
    width:auto;
  }

  .top-support-popover .support-form{
    grid-template-columns:1fr;
  }
}

.home-folder-hint{
  margin-top:14px;
  padding:16px;
  border:1px dashed #cbd5e1;
  border-radius:12px;
  background:#fff;
  color:#64748b;
  font-size:13px;
  line-height:1.55;
}

.admin-auth-form{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:10px;
  margin-top:18px;
}
.admin-auth-form label{
  display:flex;
  flex-direction:column;
  gap:6px;
  color:#334155;
  font-size:13px;
  font-weight:900;
}
.admin-auth-form button{
  min-height:42px;
}
.admin-auth-current{
  padding:10px 12px;
  border:1px solid #fed7aa;
  background:#fff7ed;
  border-radius:10px;
  color:#9a3412!important;
  font-weight:800;
}

@media(max-width:760px){
  .admin-auth-form{
    grid-template-columns:1fr;
  }
}

.dashboard-cards{
  grid-template-columns:repeat(auto-fit,minmax(140px,1fr));
}

.recent-dashboard{
  padding:14px 16px;
  margin-bottom:16px;
}

.recent-dashboard .dashboard-head{
  margin-bottom:10px;
}

.recent-dashboard .recent-strip{
  margin-top:0;
}

.mobile-question-tabs{
  display:none;
}

.mobile-evidence-sheet{
  position:fixed;
  right:24px;
  bottom:24px;
  z-index:36;
  display:flex;
  flex-direction:column;
  width:min(420px, calc(100vw - 48px));
  max-height:min(44vh, 360px);
  overflow:hidden;
  border:1px solid #fed7aa;
  border-radius:12px;
  background:#fff;
  box-shadow:0 18px 42px rgba(15,23,42,.18);
  opacity:0;
  pointer-events:none;
  transform:translateY(12px);
  visibility:hidden;
  transition:opacity .16s ease, transform .16s ease, visibility .16s ease;
}

.mobile-evidence-sheet.is-open{
  opacity:1;
  pointer-events:auto;
  transform:translateY(0);
  visibility:visible;
}

.mobile-evidence-sheet.is-dragging,
.mobile-source-overlay.is-dragging{
  transition:none;
  user-select:none;
}

.mobile-evidence-sheet__resize{
  display:none;
}

.mobile-evidence-sheet__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-bottom:1px solid #ffedd5;
  background:#fff7ed;
  cursor:move;
  touch-action:none;
}

.mobile-evidence-sheet__head strong{
  min-width:0;
  color:#9a3412;
  font-size:14px;
  line-height:1.3;
}

.mobile-evidence-sheet__actions{
  display:grid;
  grid-template-columns:repeat(2,48px);
  flex:0 0 auto;
  gap:6px;
}

.mobile-evidence-sheet__actions button{
  min-width:0;
  width:48px;
  padding:7px 0;
  border-radius:8px;
  cursor:pointer;
  font-size:12px;
  white-space:nowrap;
}

.mobile-evidence-sheet__actions [data-mobile-evidence-source]{
  border-color:#fb923c;
  background:#f97316;
  color:#fff;
}

.mobile-evidence-sheet__body{
  overflow:auto;
  padding:10px 12px 12px;
  -webkit-overflow-scrolling:touch;
}

.mobile-evidence-sheet__quote,
.mobile-evidence-sheet__empty{
  width:100%;
  margin:0;
  color:#172033;
  font-size:14px;
  line-height:1.55;
  text-align:left;
}

.mobile-evidence-sheet__quote{
  display:block;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  font-weight:500;
  cursor:pointer;
}

.mobile-evidence-sheet__quote:hover,
.mobile-evidence-sheet__quote:focus-visible{
  color:#9a3412;
  text-decoration:underline;
  text-underline-offset:3px;
}

.mobile-evidence-sheet__quote + .mobile-evidence-sheet__quote{
  margin-top:8px;
  padding-top:8px;
  border-top:1px solid #f1f5f9;
}

.mobile-evidence-sheet__empty{
  color:#b91c1c;
  font-weight:800;
}

.mobile-source-overlay{
  position:fixed;
  top:90px;
  right:24px;
  z-index:38;
  display:flex;
  flex-direction:column;
  width:min(560px, calc(100vw - 48px));
  max-height:min(62vh, 620px);
  overflow:hidden;
  border:1px solid #c7d2fe;
  border-radius:12px;
  background:#fff;
  box-shadow:0 18px 46px rgba(15,23,42,.2);
  opacity:0;
  pointer-events:none;
  transform:translateY(10px);
  visibility:hidden;
  transition:opacity .16s ease, transform .16s ease, visibility .16s ease;
}

.mobile-source-overlay.is-open{
  opacity:1;
  pointer-events:auto;
  transform:translateY(0);
  visibility:visible;
}

.mobile-source-overlay__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex:0 0 auto;
  padding:9px 12px;
  border-bottom:1px solid #e0e7ff;
  background:#eef2ff;
  cursor:move;
  touch-action:none;
}

.mobile-source-overlay__head strong{
  min-width:0;
  color:#3730a3;
  font-size:14px;
  line-height:1.3;
}

.mobile-source-overlay__head button{
  flex:0 0 auto;
  min-width:48px;
  padding:7px 9px;
  border-radius:8px;
  background:#fff;
  cursor:pointer;
  font-size:12px;
  white-space:nowrap;
}

.mobile-source-overlay__resize{
  display:none;
}

.mobile-source-overlay__body{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
  padding:12px 14px 18px;
  background:#fff;
}

.mobile-source-overlay__content{
  padding:0;
  color:#172033;
  font-size:14px;
  line-height:1.65;
}

.mobile-source-overlay__content p,
.mobile-source-overlay__content li{
  line-height:1.65;
}

@media(max-width:760px){
  body.question-open .topbar{
    display:none;
  }

  body.question-open .layout,
  body.question-open .detail,
  body:not([data-mode="admin"]).question-open .layout,
  body:not([data-mode="admin"]).question-open .detail{
    height:100dvh;
  }

  body.question-open .detail{
    overflow:auto;
    padding-bottom:calc(88px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain;
  }

  body.question-open .question-page{
    height:auto;
    min-height:100dvh;
  }

  body.question-open .question-toolbar{
    top:0;
    flex-wrap:wrap;
    gap:6px;
    padding:8px 10px;
  }

  body.question-open #backToLibrary{
    flex:0 0 auto;
    padding:7px 9px;
    font-size:12px;
  }

  body.question-open .question-jump{
    flex:1 1 180px;
    width:auto;
    min-width:0;
    font-size:13px;
  }

  body.question-open .question-path{
    display:none;
  }

  body.question-open .question-hero{
    display:block;
    padding:9px 12px;
  }

  body.question-open .question-hero h2{
    font-size:17px;
    line-height:1.28;
  }

  body.question-open .question-hero p{
    margin-top:4px;
    font-size:12px;
    line-height:1.4;
  }

  body.question-open .question-hero .tags{
    display:none;
  }

  .mobile-question-tabs{
    position:fixed;
    left:0;
    right:0;
    bottom:0;
    z-index:30;
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:6px;
    padding:8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top:1px solid #dbe4f0;
    background:rgba(255,255,255,.96);
    box-shadow:0 -10px 28px rgba(15,23,42,.08);
  }

  .mobile-question-tabs button{
    min-width:0;
    border-radius:999px;
    padding:9px 8px;
    background:#fff;
    color:#334155;
    font-size:13px;
  }

  .mobile-question-tabs button.active{
    background:#2563eb;
    border-color:#2563eb;
    color:#fff;
  }

  body.question-open .question-grid{
    display:block;
    flex:1 1 auto;
    min-height:0;
    overflow:visible;
    padding-bottom:78px;
  }

  body.question-open .question-page .problem-surface,
  body.question-open .question-page .study-surface{
    display:none;
    height:auto;
    max-height:none;
    min-height:0;
    overflow:visible;
    padding:10px;
    border:0;
  }

  body.question-open .question-page[data-mobile-view="source"] .problem-surface,
  body.question-open .question-page[data-mobile-view="analysis"] .study-surface,
  body.question-open .question-page[data-mobile-view="record"] .study-surface{
    display:flex;
    flex-direction:column;
  }

  body[data-mode="admin"].question-open .question-page .problem-surface,
  body[data-mode="admin"].question-open .question-page .study-surface{
    display:flex;
    flex-direction:column;
  }

  body.question-open .question-page[data-mobile-view="source"] .problem-surface > .section-title{
    display:none;
  }

  body.question-open .study-surface{
    background:#fbfdff;
  }

  body.question-open .question-panel-tabs{
    display:none;
  }

  body.question-open .question-status-panel{
    flex:0 0 auto;
    padding-bottom:8px;
  }

  body.question-open .question-panel{
    flex:1 1 auto;
    min-height:0;
  }

  body.question-open .question-analysis-scroll,
  body.question-open .question-record-scroll,
  body.question-open .question-support-panel{
    flex:1 1 auto;
    min-height:0;
    overflow:visible;
    padding-bottom:96px;
    scroll-padding-bottom:96px;
  }

  body.question-open .question-record-scroll textarea{
    min-height:132px;
  }

  body.question-open .problem-source-combo,
  body.question-open .problem-source-main,
  body.question-open .image-panel,
  body.question-open .problem-image-card,
  body.question-open .source-text-card{
    min-height:0;
    flex:1 1 auto;
  }

  body.question-open .source-action-row{
    flex:0 0 auto;
    margin-bottom:8px;
  }

  body.question-open .problem-image-card .image-scroll,
  body.question-open .source-text-scroll{
    height:auto;
    max-height:none;
    min-height:300px;
    overflow:visible;
    scrollbar-gutter:stable;
    scroll-padding-bottom:96px;
  }

  body.question-open .image-page:last-child,
  body.question-open .source-text-page:last-child{
    padding-bottom:96px;
  }

  body.question-open .image-toolbar{
    align-items:stretch;
    gap:6px;
    padding:7px;
  }

  body.question-open .image-actions{
    width:100%;
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:5px;
  }

  body.question-open .image-actions button{
    padding:7px 4px;
    font-size:11px;
  }

  body.question-open .image-zoom{
    align-self:center;
    min-width:0;
    font-size:11px;
  }

  body.question-open .source-text-page{
    padding:18px 16px;
  }

  body:not(.question-open) .library-panel{
    padding:14px;
  }

  body:not(.question-open) .library-heading{
    display:block;
    margin-bottom:12px;
  }

  body:not(.question-open) .library-heading h2{
    font-size:22px;
  }

  body:not(.question-open) .file-list{
    gap:8px;
  }

  body:not(.question-open) .file-row{
    min-height:0;
    padding:10px;
    gap:7px;
  }

  body:not(.question-open) .file-card-head{
    min-height:auto;
  }

  body:not(.question-open) .file-main strong{
    font-size:14px;
    line-height:1.35;
  }

  body:not(.question-open) .file-main .file-meta{
    font-size:11px;
    line-height:1.35;
  }

  body:not(.question-open) .file-tags{
    display:none !important;
  }
}

@media(max-width:760px){
  .evidence-anchor{
    -webkit-box-decoration-break:clone;
    box-decoration-break:clone;
    padding:1px 2px;
    line-height:1.8;
    touch-action:manipulation;
  }

  .evidence-pill{
    min-height:22px;
    margin:0 2px 0 4px;
    padding:2px 7px;
    font-size:10px;
    line-height:1.4;
    vertical-align:2px;
  }

  .mobile-evidence-sheet{
    position:fixed;
    left:10px;
    right:auto;
    bottom:calc(70px + env(safe-area-inset-bottom));
    z-index:36;
    display:flex;
    flex-direction:column;
    width:min(370px, calc(100vw - 20px));
    height:var(--mobile-evidence-sheet-height, min(42dvh, 320px));
    min-height:140px;
    max-height:65dvh;
    overflow:hidden;
    border:1px solid #fed7aa;
    border-radius:12px;
    background:#fff;
    box-shadow:0 -12px 34px rgba(15,23,42,.16);
    opacity:0;
    pointer-events:none;
    transform:translateY(18px);
    visibility:hidden;
    transition:opacity .16s ease, transform .16s ease, visibility .16s ease;
  }

  .mobile-evidence-sheet.is-open{
    opacity:1;
    pointer-events:auto;
    transform:translateY(0);
    visibility:visible;
  }

  .mobile-evidence-sheet.is-resizing,
  .mobile-evidence-sheet.is-resizing *{
    user-select:none;
  }

  .mobile-evidence-sheet__resize,
  .mobile-source-overlay__resize{
    display:block;
    position:relative;
    flex:0 0 18px;
    width:100%;
    min-height:18px;
    padding:0;
    border:0;
    border-radius:0;
    cursor:ns-resize;
    touch-action:none;
  }

  .mobile-evidence-sheet__resize::before,
  .mobile-source-overlay__resize::before{
    content:"";
    position:absolute;
    left:50%;
    top:50%;
    width:44px;
    height:4px;
    border-radius:999px;
    background:#94a3b8;
    transform:translate(-50%, -50%);
  }

  .mobile-evidence-sheet__resize{
    border-bottom:1px solid #ffedd5;
    background:#fff7ed;
  }

  .mobile-evidence-sheet__head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:10px 12px;
    border-bottom:1px solid #ffedd5;
    background:#fff7ed;
    cursor:default;
    touch-action:auto;
  }

  .mobile-evidence-sheet__head strong{
    min-width:0;
    color:#9a3412;
    font-size:14px;
    line-height:1.3;
  }

  .mobile-evidence-sheet__actions{
    display:grid;
    grid-template-columns:repeat(2,48px);
    flex:0 0 auto;
    gap:6px;
  }

  .mobile-evidence-sheet__actions button{
    min-width:0;
    width:48px;
    padding:7px 0;
    border-radius:8px;
    font-size:12px;
    white-space:nowrap;
  }

  .mobile-evidence-sheet__actions [data-mobile-evidence-source]{
    border-color:#fb923c;
    background:#f97316;
    color:#fff;
  }

  .mobile-evidence-sheet__body{
    flex:1 1 auto;
    min-height:0;
    overflow:auto;
    padding:10px 12px 12px;
    -webkit-overflow-scrolling:touch;
  }

  .mobile-evidence-sheet__quote,
  .mobile-evidence-sheet__empty{
    margin:0;
    color:#172033;
    font-size:14px;
    line-height:1.55;
  }

  .mobile-evidence-sheet__quote + .mobile-evidence-sheet__quote{
    margin-top:8px;
    padding-top:8px;
    border-top:1px solid #f1f5f9;
  }

  .mobile-evidence-sheet__empty{
    color:#b91c1c;
    font-weight:800;
  }

  body.question-open .detail.evidence-sheet-open{
    scroll-padding-bottom:calc(var(--mobile-evidence-sheet-height, min(42dvh, 320px)) + 90px);
  }

  body.question-open .detail.evidence-sheet-open .question-analysis-scroll{
    padding-bottom:calc(var(--mobile-evidence-sheet-height, min(42dvh, 320px)) + 70px);
  }

  .mobile-source-overlay{
    position:fixed;
    top:0;
    left:0;
    right:auto;
    z-index:38;
    display:flex;
    flex-direction:column;
    width:min(390px, 100vw);
    height:var(--mobile-source-overlay-height, 40dvh);
    min-height:180px;
    max-height:78dvh;
    border-bottom:1px solid #c7d2fe;
    background:#fff;
    box-shadow:0 14px 36px rgba(15,23,42,.18);
    opacity:0;
    pointer-events:none;
    transform:translateY(0);
    visibility:hidden;
    transition:opacity .16s ease, visibility .16s ease;
  }

  .mobile-source-overlay.is-open{
    opacity:1;
    pointer-events:auto;
    transform:translateY(0);
    visibility:visible;
  }

  .mobile-source-overlay.is-resizing,
  .mobile-source-overlay.is-resizing *{
    user-select:none;
  }

  .mobile-source-overlay__head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    flex:0 0 auto;
    padding:8px 10px;
    border-bottom:1px solid #e0e7ff;
    background:#eef2ff;
    cursor:default;
    touch-action:auto;
  }

  .mobile-source-overlay__head strong{
    min-width:0;
    color:#3730a3;
    font-size:14px;
    line-height:1.3;
  }

  .mobile-source-overlay__head button{
    flex:0 0 auto;
    min-width:48px;
    padding:7px 9px;
    border-radius:8px;
    background:#fff;
    font-size:12px;
    white-space:nowrap;
  }

  .mobile-source-overlay__resize{
    border-top:1px solid #e0e7ff;
    background:#f8fafc;
  }

  .mobile-source-overlay__body{
    flex:1 1 auto;
    min-height:0;
    overflow:auto;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain;
    padding:10px 12px 18px;
    background:#fff;
  }

  .mobile-source-overlay__content{
    padding:0;
    color:#172033;
    font-size:14px;
    line-height:1.65;
  }

  .mobile-source-overlay__content p,
  .mobile-source-overlay__content li{
    line-height:1.65;
  }

  body.question-open .detail.source-overlay-open{
    scroll-padding-top:calc(var(--mobile-source-overlay-height, 40dvh) + 12px);
  }
}
