/* Queue and upload page design rules. Kept separate from shared styles. */
/* Workspace refresh: reduce always-visible controls while keeping data and actions accessible. */
.queue-heading{margin-bottom:22px}
.queue-heading h1{font-size:clamp(27px,3vw,36px);letter-spacing:-.025em}
.queue-create{min-width:150px}
#queue-view .stats{gap:12px;margin-bottom:8px}
#queue-view .stats>div{box-shadow:none;border-radius:14px;padding:15px 18px}
#queue-view .stats strong{font-size:31px;margin:3px 0 1px;line-height:1.3;font-weight:600}
#queue-view .stats small{font-size:11px;line-height:1.45}
.stats-explanation{margin:0 0 25px;text-align:right}
.stats-explanation>summary{display:inline-flex;align-items:center;min-height:36px;cursor:pointer;color:var(--muted);font-size:12px}
.stats-explanation>.fine{max-width:650px;margin:0 0 0 auto;text-align:right}
.queue-section-heading{margin-bottom:14px}
#queue-view .filter-bar{gap:6px;margin-bottom:12px;padding:3px;background:var(--light);border-radius:12px;max-width:max-content}
#queue-view .filter{min-height:42px;padding:9px 17px;border-radius:9px;font-size:13px;font-weight:600}
#queue-view .filter.active{background:var(--paper);box-shadow:0 2px 8px #263d3610;border-color:var(--line)}
.job-filter-panel{margin:0 0 17px}
.job-filter-panel>summary{display:inline-flex;align-items:center;gap:8px;cursor:pointer;min-height:44px;padding:7px 10px;border-radius:8px;color:var(--muted);font-size:13px}
.job-filter-panel>summary:hover,.job-filter-panel[open]>summary{color:var(--green);background:var(--light)}
.job-filter-panel>summary .fine{background:var(--light);border-radius:999px;padding:3px 8px}
.job-filter-panel .job-filters{margin:5px 0 12px;padding:16px;max-width:770px;background:var(--paper);border:1px solid var(--line);border-radius:12px}
.job-card{display:flex;flex-direction:column;gap:12px;padding:19px 20px;box-shadow:none;transition:border-color .18s,box-shadow .18s}
.job-card:hover{border-color:var(--green);box-shadow:0 5px 18px #263d360c}
.job-card-head{margin:0}
.job-identity{flex:1;min-width:0}
.job-card-head strong{font-size:16px}
.job-card-head small{font-size:12px}
.job-card .badge{font-size:11px}
.job-card-hint{margin:0;font-size:13px;line-height:1.55;color:var(--muted)}
.job-card-footer{margin-top:auto;gap:8px;padding-top:12px;font-size:12px;border-top:1px solid var(--line);flex-wrap:wrap}
.job-card-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex:0 0 auto;max-width:100%;flex-wrap:wrap;margin-left:auto}
.job-card-actions>.button{margin:0;padding:10px 12px;font-size:13px}
.job-card-footer a{display:inline-flex;align-items:center;justify-content:center;min-height:44px;gap:6px;font-size:13px;padding:8px 0}
.job-card-footer a:focus-visible{outline:3px solid #93bda5;outline-offset:2px;border-radius:7px}
.upload-heading{margin-bottom:22px}
.upload-layout{align-items:start;gap:18px}
.upload-layout>.panel{min-width:0;box-shadow:none;padding:23px}
.upload-details-panel .input-row{display:grid;grid-template-columns:minmax(0,1fr) auto}
.upload-layout .panel-title{margin-bottom:18px}
.upload-layout .panel-title h2{font-size:17px}
.upload-help{margin-top:14px;border-top:1px solid var(--line);padding-top:6px}
.upload-help>summary{display:flex;align-items:center;min-height:44px;cursor:pointer;color:var(--muted);font-size:13px}
.upload-help p{margin:5px 0 8px;font-size:12px;line-height:1.7;color:var(--muted)}
.upload-photos-panel .dropzone{min-height:153px;gap:7px;transition:background .15s,border-color .15s}
.upload-photos-panel .dropzone:hover,.upload-photos-panel .dropzone:focus-within{background:var(--light);border-color:var(--green)}
.upload-photos-panel .dropzone strong{font-size:15px;font-weight:650;color:var(--green)}
.upload-photos-panel #photo-count{font-size:13px;margin:10px 0;color:var(--ink)}
.photo-tile{background:var(--paper)}
.photo-tile p{font-size:12px;line-height:1.45;white-space:normal;overflow-wrap:anywhere;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;min-height:46px}
.photo-actions>summary{cursor:pointer;display:flex;justify-content:center;align-items:center;min-height:44px;border-top:1px solid var(--line);background:var(--paper);color:var(--muted);font-size:12px;font-weight:600}
.photo-actions>summary:hover,.photo-actions[open]>summary{color:var(--green);background:var(--light)}
.photo-actions .photo-controls{border-top:1px solid var(--line)}
.photo-actions .photo-controls button{font-size:12px;min-height:44px}
.upload-footer{margin-top:19px;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px 16px}
.upload-submit-summary{display:flex;flex-direction:column;min-width:0;gap:4px}
.upload-submit-summary strong{font-size:15px;font-weight:650}
.upload-submit-summary span{color:var(--muted);font-size:12px;line-height:1.6;overflow-wrap:anywhere}
.upload-footer .button{justify-self:end;min-height:48px}
.upload-footer .upload-privacy{grid-column:1/-1;margin:4px 0 0;font-size:12px;line-height:1.65;color:var(--muted)}
:root[data-theme="dark"] .upload-layout>.panel,:root[data-theme="dark"] .job-card,:root[data-theme="dark"] .photo-actions>summary{background:var(--paper)}
:root[data-theme="dark"] .job-filter-panel .job-filters{background:var(--paper)}
:root[data-theme="dark"] .job-card:hover{border-color:var(--green)}
@media(max-width:900px){
  .queue-heading{gap:12px;align-items:start}
  .queue-create{min-width:0}
  #queue-view .stats{gap:7px}
  #queue-view .stats>div{padding:12px 9px;border-radius:11px}
  #queue-view .stats strong{font-size:27px}
  #queue-view .stats small{font-size:10px}
  #queue-view .filter-bar{max-width:100%;width:100%}
  #queue-view .filter{flex:1;padding:9px 5px}
  .job-filter-panel .job-filters{grid-template-columns:1fr;padding:12px}
  .job-filter-panel .date-filters{padding-top:0}
  .job-card{padding:16px;gap:10px}
  .upload-layout>.panel{padding:18px}
  .upload-footer{grid-template-columns:1fr}
  .upload-footer .button{justify-self:stretch;width:100%}
}
@media(max-width:480px){
  .queue-heading h1{font-size:27px}
  .queue-heading{flex-wrap:wrap}
  .queue-create{width:100%}
  #queue-view .stats{grid-template-columns:repeat(3,minmax(0,1fr))}
  #queue-view .stats>div>span{font-size:11px}
  #queue-view .stats small{display:none}
  .photo-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* Review focus path: quick jump without expanding the existing toolbar. */
.review-jump{margin:0 0 20px;padding:14px 18px;border:1px solid var(--line);background:var(--paper);border-radius:14px;box-shadow:var(--shadow)}
.review-jump-head{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:9px}
.review-jump-head strong{font-size:13px}
.review-jump-controls{display:flex;gap:8px;align-items:center}
.review-jump-controls select{min-width:110px;flex:1;width:0;min-height:44px;text-overflow:ellipsis}
.review-jump-controls .button{min-height:44px;padding:8px 14px}
.review-next-priority:not(:disabled){background:var(--light);color:var(--green)}
.question-card summary .question-summary-main{display:flex;flex-direction:column;gap:4px;min-width:0;grid-column:1/-1}
.question-card summary .question-summary-main strong{grid-column:auto}
.question-glance{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:400;color:var(--muted);min-width:0}
.question-card{scroll-margin-top:22px}
@media(max-width:680px){
 .review-jump{padding:12px;margin-bottom:18px}
 .review-jump-controls{display:grid;grid-template-columns:1fr 1fr 1fr;gap:7px}
 .review-jump-controls select{width:100%;grid-column:1/-1}
 .review-jump-controls .button{padding:8px 6px;font-size:12px;white-space:normal}
 .review-jump-head .fine{font-size:11px}
}


/* Desktop only: keep the document in view while moving between grading cards.
   Image overlays share the same normalized coordinate system as the existing dialog. */
.inline-photo-panel{min-width:0;border:1px solid var(--line);border-radius:14px;background:var(--paper);padding:14px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:9px;min-height:400px;max-height:calc(100dvh - 26px)}
.inline-photo-head{display:flex;align-items:start;justify-content:space-between;gap:8px}
.inline-photo-head strong{font-size:15px}
.inline-photo-head .fine{line-height:1.45}
.inline-photo-head button{padding:7px 9px}
.inline-photo-tools{display:flex;align-items:center;gap:6px}
.inline-photo-tools .button{min-height:44px;padding:8px 12px}
.inline-photo-tools [data-inline-enlarge]{margin-left:auto;font-size:12px;white-space:normal}
.inline-photo-scroll{position:relative;overflow:auto;overscroll-behavior:contain;min-height:220px;flex:1;background:var(--bg);border-radius:8px}
.inline-photo-stage{width:100%;position:relative;min-height:1px}
.inline-photo-stage img{width:100%;height:auto;max-width:none;display:block}
#inline-photo-regions{position:absolute;inset:0;pointer-events:none}
.inline-photo-region{position:absolute;border:2px solid var(--green);background:#306b5212;pointer-events:auto;padding:0;min-width:0;min-height:0;border-radius:2px}
.inline-photo-region.selected{border:3px solid var(--amber);background:#a97a2b22;z-index:1}
.inline-photo-region span{position:absolute;top:0;left:0;background:var(--paper);color:var(--ink);font-size:11px;padding:2px 3px;white-space:nowrap}
.inline-photo-panel>#inline-photo-hint{line-height:1.45}
#inline-photo-error{margin:12px;text-align:center}
@media(min-width:1160px){
  #review-view .review-layout[data-inline-open="true"]{grid-template-columns:minmax(300px,.88fr) minmax(0,1.12fr);align-items:start}
  #review-view .review-layout[data-inline-open="true"]>.inline-photo-panel{grid-column:1;grid-row:1/span 2;position:sticky;top:12px}
  #review-view .review-layout[data-inline-open="true"]>.review-question-column{grid-column:2;grid-row:1;min-width:0}
  #review-view .review-layout[data-inline-open="true"]>.review-sidebar{grid-column:2;grid-row:2;min-width:0}
  #review-view .review-layout[data-inline-open="false"]>.inline-photo-panel{display:none}
  #review-view .review-layout[data-inline-open="false"]{grid-template-columns:minmax(0,1.3fr) minmax(0,.8fr)}
}
@media(max-width:1159px){
  #review-view .inline-photo-panel,#review-view .inline-photo-toggle{display:none!important}
}
:root[data-theme="dark"] .inline-photo-panel{background:var(--paper);border-color:var(--line)}
:root[data-theme="dark"] .inline-photo-region span{background:var(--paper);color:var(--ink)}

/* Review focus v1: show grading and reply; disclose optional record editing. */
#review-view .review-task-heading{gap:12px;flex-wrap:wrap}
#review-view .review-heading-tools{display:flex;align-items:center;gap:6px;margin-left:auto;flex-wrap:wrap}
.review-question-utilities{position:relative;min-width:0}
.review-question-utilities>summary{display:inline-flex;align-items:center;cursor:pointer;min-height:44px;padding:8px 12px;border-radius:9px;color:var(--muted);font-size:13px;list-style:none}
.review-question-utilities>summary::-webkit-details-marker{display:none}
.review-question-utilities>summary::after{content:"⌄";margin-left:6px}
.review-question-utilities>summary:focus-visible,.review-secondary-details>summary:focus-visible{outline:3px solid #93bda5;outline-offset:3px}
.review-question-utilities[open]>summary,.review-question-utilities>summary:hover{background:var(--light);color:var(--green)}
.review-question-utilities-menu{position:absolute;top:100%;right:0;z-index:12;min-width:205px;padding:8px;background:var(--paper);border:1px solid var(--line);border-radius:11px;box-shadow:0 6px 22px #263d3618}
.review-question-utilities-menu>.text-button{width:100%;text-align:left;white-space:normal}
.review-secondary-panel{padding:14px 18px}
.review-secondary-details>summary{display:flex;justify-content:space-between;align-items:center;gap:10px;min-height:44px;cursor:pointer;flex-wrap:wrap;list-style:none}
.review-secondary-details>summary::-webkit-details-marker{display:none}
.review-secondary-details>summary strong{font-size:14px;font-weight:600}
.review-secondary-details>summary .fine{font-size:11px}
.review-secondary-details[open]>summary{padding-bottom:12px;margin-bottom:12px;border-bottom:1px solid var(--line)}
.review-secondary-details .review-records{margin-top:12px}
.review-secondary-details #draft-storage-status{margin:10px 0}
#review-view .review-feedback-panel{box-shadow:none}
@media(max-width:900px){
 #review-view .review-task-heading h2{font-size:17px}
 .review-heading-tools .text-button,.review-question-utilities>summary{min-height:44px}
 .review-secondary-panel{padding:12px 14px}
 .review-secondary-details>summary{align-items:flex-start;flex-direction:column;gap:2px}
}

/* Review focus v2: reduce first-screen scaffolding, keep paper and questions visible. */
#review-view.view{padding-top:20px}
#review-view .back-link{margin-bottom:9px}
#review-view .review-heading{margin-bottom:9px}
#review-view .review-heading h1{font-size:25px}
#review-view .review-meta{margin-top:5px}
#review-view .review-task-heading{margin-bottom:8px}
#review-view .review-photo-library{margin:0 0 10px;max-width:100%}
#review-view .review-photo-library>summary{display:inline-flex;align-items:center;gap:5px;cursor:pointer;min-height:40px;padding:6px 9px;margin-left:-9px;color:var(--muted);font-size:12px;border-radius:8px}
#review-view .review-photo-library>summary:hover{background:var(--light);color:var(--green)}
#review-view .review-photo-library>summary:focus-visible{outline:3px solid #93bda5;outline-offset:2px}
#review-view .review-photo-library>summary .fine{font-size:12px}
#review-view .review-photo-library .photo-strip{margin:4px 0 12px;max-width:100%;padding-bottom:4px}
#review-view .review-jump{display:flex;align-items:center;gap:12px;padding:7px 11px;margin-bottom:12px;box-shadow:none}
#review-view .review-jump-head{margin:0;flex:0 0 auto}
#review-view .review-jump-head [data-review-jump-count]{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
#review-view .review-jump-controls{flex:1;min-width:0}
@media(max-width:680px){
 #review-view .review-jump{display:block;padding:10px 12px;margin-bottom:13px}
 #review-view .review-jump-head{margin-bottom:6px}
 #review-view .review-jump-head [data-review-jump-count]{position:static;width:auto;height:auto;overflow:visible;clip:auto;white-space:normal}
 #review-view .review-heading h1{font-size:24px}
 #review-view .review-photo-library{margin-bottom:10px}
}

/* Review focus v3: put the pupil answer and model result before tools. */
.question-card .question-answer-glance{display:block;color:var(--muted);font-size:12px;line-height:1.45;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
.question-card[open] .question-answer-glance{display:none}
.question-card .question-reading-compact{padding:1px 0 4px;margin:0}
.question-card .question-reading-compact>div{margin-bottom:10px}
.question-card .question-reading-compact .answer-grid{gap:8px}
.question-card .question-reading-compact .answer-grid>div{padding:10px 12px;border:1px solid var(--line);background:var(--bg);border-radius:10px;min-width:0}
.question-card .question-reading-compact dt{font-size:11px}
.question-card .question-reading-compact dd{font-size:14px;margin-top:5px;line-height:1.7;max-width:100%;overflow-wrap:anywhere}
.question-card .question-reason{border-top:1px solid var(--line);margin:2px 0 12px}
.question-card .question-reason>summary{display:flex;align-items:center;cursor:pointer;color:var(--muted);font-size:12px;padding:10px 2px;min-height:44px}
.question-card .question-reason>summary:focus-visible{outline:3px solid #93bda5;outline-offset:2px}
.question-card .question-reason[open]>summary{color:var(--green)}
.question-card .question-reason dl{margin:0 0 8px}
.question-card .question-image-tools{margin:8px 0 10px}
.question-card .question-crop{margin:4px 0 10px}
.review-sections{display:flex;gap:8px;margin:12px 0 18px}
.review-sections .button{flex:1;min-height:44px}
.review-feedback-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.review-feedback-heading h2{margin:0}
.review-feedback-panel,.review-task-heading{scroll-margin-top:22px}
.button.secondary.danger{background:var(--light);border-color:var(--line);color:var(--red)}
.question-correction-tools{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-items:start;gap:8px;margin:12px 0}
.question-correction-tools>.question-editor{min-width:0;margin:0;padding:0;border:0}
.question-correction-tools>.button,.question-correction-tools>.question-editor>summary{min-width:0;min-height:44px;white-space:normal}
.question-correction-tools>.question-editor>summary::-webkit-details-marker{display:none}
.question-correction-tools:has(.question-editor[open]){grid-template-columns:repeat(2,minmax(0,1fr))}
.question-correction-tools>.question-editor[open]{grid-column:1/-1;grid-row:2}
.question-card .question-image-tools{flex-wrap:wrap}
.question-image-tools .text-button{min-height:44px}
.feedback-options{margin-top:12px}
@media(min-width:1160px){
 #review-view .review-layout[data-inline-open="true"] .question-crop{display:none}
}
@media(max-width:680px){
 .question-card .question-reading-compact .answer-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
 .question-card .question-reading-compact .answer-grid>div{padding:8px 9px}
 .question-card .question-reading-compact dd{font-size:13px}
 .question-card .question-image-tools .fine{display:none}
}

/* Keep stacked fractions legible in collapsed grading summaries. */
#review-view .question-card .question-glance{font-size:14px;line-height:1.6}
#review-view .question-card .question-answer-glance{font-size:13px;line-height:1.6}
#review-view .question-card .question-glance math,
#review-view .question-card .question-answer-math math{font-size:1.12em}
#review-view .question-card .question-answer-label{margin-right:2px}

/* Decisions: one clear primary action; alternative outcomes are disclosed only when needed. */
.quick-verdict{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;margin:14px 0 4px;align-items:stretch}
.quick-verdict>.verdict-primary{min-height:50px;white-space:normal;line-height:1.45}
.verdict-choice{position:relative;min-width:90px}
.question-card:has(.verdict-choice[open]){overflow:visible}
.verdict-choice[open]{z-index:12}
.verdict-choice>summary{cursor:pointer;min-height:50px;list-style:none;height:100%;font-size:14px}
.verdict-choice>summary::-webkit-details-marker{display:none}
.verdict-choice>summary:focus-visible,.question-advanced>summary:focus-visible,.question-correction-tools>.question-editor>summary:focus-visible{outline:3px solid #93bda5;outline-offset:2px}
.verdict-choice[open]>summary{border-color:var(--green);background:var(--light)}
.verdict-options{position:absolute;z-index:6;top:calc(100% + 6px);right:0;min-width:168px;max-width:calc(100vw - 40px);display:grid;gap:5px;padding:8px;border:1px solid var(--line);border-radius:12px;background:var(--paper);box-shadow:var(--shadow)}
.verdict-options .button{width:100%;min-height:44px;text-align:center;white-space:normal}
.verdict-options .verdict-incorrect{color:var(--red)}
.quick-verdict-help{margin:7px 0 12px;font-size:12px}
.question-advanced{margin:14px 0 0;border-top:1px solid var(--line)}
.question-advanced>summary{cursor:pointer;min-height:48px;display:flex;align-items:center;color:var(--green);font-size:13px;list-style:none}
.question-advanced>summary::-webkit-details-marker{display:none}
.question-advanced>summary::after{content:'⌄';margin-left:auto}
.question-advanced[open]>summary::after{content:'⌃'}
.question-extra-fields{border-top:1px solid var(--line);margin-top:12px}
.question-extra-fields>summary,.question-doubts>summary{min-height:44px;padding:12px 0;cursor:pointer;color:var(--muted);font-size:13px}
.question-extra-fields[open]>summary{margin-bottom:6px}
.question-doubts{margin:10px 0}
.question-doubts>p{font-size:13px;line-height:1.6}
.step-review-brief{border-top:1px solid var(--line);margin-top:16px;padding-top:14px}
.step-review-brief>strong{font-size:13px}
.step-review-brief>p{margin:6px 0}
.step-review-brief .question-tools{margin:8px 0}
.step-review-brief .text-button{font-size:12px;min-height:44px}
.step-review-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}
.step-review-heading>strong{font-size:13px}
.step-review-heading .text-button{font-size:12px;min-height:44px}
.image-step-review{flex-shrink:0;max-height:24dvh;overflow:auto;border-top:1px solid var(--line);padding-top:4px}
.image-step-review>.fine{margin:0 0 6px;font-size:12px}
.step-issue{border-top:1px solid var(--line);padding:8px 0;font-size:13px;line-height:1.5}
.step-issue>p{margin:0 0 5px}
.step-issue.dismissed>p{color:var(--muted);text-decoration:line-through}
.step-issue-actions{display:flex;align-items:center;gap:14px}
.step-issue-actions .text-button{min-height:44px;padding:8px 2px;font-size:13px}
#red-pen-canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
#red-pen-canvas.drawing{pointer-events:auto;touch-action:none;cursor:crosshair}
.ink-mode #question-regions{visibility:hidden}
.ink-mode #crop-toggle,.ink-mode .image-more{display:none}
.red-pen-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;flex-shrink:0;padding-top:5px;border-top:1px solid var(--line)}
.red-pen-actions>.fine{grid-column:1/-1;margin:0;font-size:11px}
.red-pen-actions .button{min-height:44px;padding:8px 6px;font-size:13px}
.red-export-actions{display:flex;flex-wrap:wrap;gap:8px;flex-shrink:0}
.red-export-actions .fine{width:100%;margin:0;font-size:12px}
.red-export-actions .button{flex:1;min-height:44px}
.image-dialog .image-tools #red-pen-toggle{padding:8px;white-space:nowrap}
.image-dialog .image-tools #red-pen-undo{padding:8px 5px;white-space:nowrap;font-size:12px}
@media(max-width:680px){.image-dialog .image-tools #red-pen-toggle{min-width:44px}}
@media(max-width:900px) and (max-height:400px) and (orientation:landscape){
 .image-dialog[open]{grid-template-rows:44px 44px minmax(0,1fr) auto auto}
 .image-dialog #image-step-review{grid-column:2;grid-row:3;max-height:none;min-height:0}
 .image-dialog #image-scroll{grid-column:1;grid-row:3}
 .image-dialog #red-pen-actions{grid-column:1/-1;grid-row:5;grid-template-columns:minmax(0,1fr) auto auto;align-items:center}
 .image-dialog #red-pen-status{grid-column:auto}
}
