:root {
  --bg: #f2f5f3;
  --surface: #ffffff;
  --surface-muted: #e9efec;
  --surface-warm: #f7f3ee;
  --ink: #17211f;
  --ink-soft: #4f5d59;
  --ink-muted: #7d8985;
  --line: #d7dfdb;
  --line-strong: #becac4;
  --primary: #17211f;
  --primary-hover: #263330;
  --accent: #ef8354;
  --accent-soft: #fff0e9;
  --blue: #315f78;
  --blue-soft: #e4eef2;
  --success: #39715a;
  --success-soft: #e2f0e8;
  --danger: #b34343;
  --danger-soft: #faeaea;
  --radius: 8px;
  --shadow: 0 20px 60px rgba(23, 33, 31, 0.09);
  --shadow-soft: 0 8px 24px rgba(23, 33, 31, 0.06);
  --content-width: 1200px;
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

/* Online exams */
.exam-panel { min-height: 65vh; }
.assessment-category-filter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
}
.assessment-category-filter > span {
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 800;
}
.assessment-category-filter > div {
  display: flex;
  min-width: 0;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 1px 5px;
  scrollbar-width: thin;
}
.assessment-category-filter button {
  min-height: 38px;
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .76);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}
.assessment-category-filter button.is-active {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 6px 18px rgba(23, 33, 31, .12);
}
.test-bank-arrange-button {
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .88);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.test-bank-arrange-button.is-active { color: #fff; border-color: var(--primary); background: var(--primary); }
.exam-summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 22px 0; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.72); }
.exam-summary-strip > div { display: grid; gap: 3px; padding: 18px 22px; }
.exam-summary-strip > div + div { border-left: 1px solid var(--line); }
.exam-summary-strip strong { font-size: 26px; color: var(--ink); }
.exam-summary-strip span { color: var(--muted); font-size: 13px; }
.exam-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 16px; }
.exam-card { display: grid; gap: 16px; min-height: 230px; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.9); box-shadow: 0 12px 32px rgba(23,33,31,.06); }
.exam-card-head,.exam-card-meta,.exam-card-actions,.exam-card-flags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.exam-card-head { justify-content: space-between; }
.exam-subject-chip,.exam-status-chip,.exam-warning-chip { padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.exam-subject-chip { color: #315e52; background: #e7f0ec; }
.exam-status-chip { color: #66541b; background: #f4edcf; }
.exam-status-chip.is-published { color: #315e52; background: #dcebe5; }
.exam-warning-chip { color: #8b4b27; background: #fff0df; }
.exam-card h2 { margin: 0; font-size: 20px; line-height: 1.35; }
.exam-card-meta { color: var(--muted); font-size: 13px; }
.exam-card-actions { align-self: end; }
.exam-card-actions .button { flex: 1; min-width: 86px; }
.exam-history { margin-top: 30px; }
.exam-history-list,.exam-attempts-list { display: grid; gap: 10px; }
.exam-history-row,.exam-attempt-row { display: grid; grid-template-columns: minmax(180px,1fr) repeat(4,minmax(90px,auto)); gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.exam-history-row span,.exam-attempt-row span { color: var(--muted); font-size: 13px; }

.exam-workbench-dialog,.exam-taking-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: #eef2ef; }
.exam-workbench-dialog::backdrop,.exam-taking-dialog::backdrop { background: rgba(8,16,14,.72); }
.exam-workbench-shell,.exam-taking-shell { height: 100dvh; display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden; }
.exam-workbench-header,.exam-taking-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 76px; padding: 12px 20px; border-bottom: 1px solid #dbe2de; background: rgba(255,255,255,.96); }
.exam-workbench-header h2,.exam-taking-header h2 { margin: 2px 0; font-size: 20px; }
.exam-workbench-header p,.exam-taking-header p { margin: 0; color: var(--muted); font-size: 12px; }
.exam-workbench-actions,.taking-status { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.exam-save-status,.taking-status > span { color: var(--muted); font-size: 12px; }
.exam-workbench { --pdf-width: 45%; display: grid; grid-template-columns: minmax(320px,var(--pdf-width)) 8px minmax(420px,1fr); min-height: 0; overflow: hidden; }
.pdf-bench { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0,1fr); background: #e9eeeb; }
.exam-editor-bench { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #e9eeeb; }
.exam-editor-bench { background: #f5f7f5; }
.exam-mobile-pdf-toggle { display:none; }
.bench-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 49px; padding: 9px 14px; border-bottom: 1px solid #d7dfda; background: #fff; }
.bench-toolbar-actions,.pdf-controls { display: flex; align-items: center; gap: 6px; }
.pdf-controls { min-height: 44px; padding: 6px 10px; overflow-x: auto; border-bottom: 1px solid #d7dfda; background: rgba(255,255,255,.88); }
.pdf-controls button { white-space: nowrap; border: 1px solid #d5ddd8; border-radius: 8px; background: #fff; color: #26332f; padding: 6px 9px; }
.pdf-controls button.is-active { color: #fff; background: #315e52; border-color: #315e52; }
.pdf-controls label { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.pdf-controls input { width: 54px; padding: 5px; border: 1px solid #d5ddd8; border-radius: 7px; }
.pdf-empty { grid-row: 2 / -1; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 30px; text-align: center; color: var(--muted); }
.pdf-empty > span { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 22px; background: #dfe8e3; color: #315e52; font-weight: 900; font-size: 20px; }
.pdf-empty strong { color: var(--ink); font-size: 20px; }
.pdf-empty p { max-width: 300px; margin: 0; }
.pdf-canvas-viewport { min-height: 0; overflow: auto; padding: 18px; background: #cfd7d2; }
.pdf-canvas-stage { position: relative; width: max-content; margin: 0 auto; line-height: 0; box-shadow: 0 12px 28px rgba(22,30,27,.18); }
#pdfCanvas { display: block; background: #fff; }
.pdf-crop-selection { position: absolute; border: 2px solid #1f7665; background: rgba(50,154,132,.12); box-shadow: 0 0 0 9999px rgba(15,23,20,.25); pointer-events: none; }
.crop-size { position: absolute; left: 0; bottom: -27px; padding: 3px 7px; border-radius: 6px; color: #fff; background: #17211f; font-size: 11px; line-height: 1.4; white-space: nowrap; }
.crop-dock { grid-row: 3; z-index: 3; align-self: end; display: grid; grid-template-columns: 150px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px; border-top: 1px solid #cbd5cf; background: rgba(255,255,255,.98); box-shadow: 0 -10px 28px rgba(23,33,31,.1); }
.crop-preview { height: 96px; overflow: hidden; display: grid; place-items: center; border: 1px solid #d5ddd8; border-radius: 10px; background: #f6f7f6; }
.crop-preview canvas { max-width: 100%; max-height: 100%; }
.crop-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.crop-fields label { display: grid; gap: 3px; color: var(--muted); font-size: 11px; }
.crop-fields input,.crop-fields select { min-width: 0; padding: 7px 8px; border: 1px solid #d5ddd8; border-radius: 8px; background: #fff; }
.crop-actions { display: grid; gap: 7px; }
.exam-splitter { position: relative; cursor: col-resize; background: #d5ddd8; }
.exam-splitter::after { content: ""; position: absolute; inset: 0 2px; background: #aebeb6; opacity: 0; transition: opacity .2s; }
.exam-splitter:hover::after,.exam-splitter:focus::after { opacity: 1; }
.exam-editor-toolbar { grid-column: 1; }
.exam-diagnostics { max-height: 120px; overflow: auto; padding: 9px 14px; border-bottom: 1px solid #ead2b9; color: #7b4224; background: #fff7ee; font-size: 12px; }
.exam-diagnostics ul { margin: 4px 0 0 18px; padding: 0; }
.exam-metadata-editor { display: grid; grid-template-columns: minmax(240px,2fr) repeat(3,minmax(110px,1fr)); gap: 9px; padding: 10px 14px; border-bottom: 1px solid #d7dfda; background: #fff; }
.exam-metadata-editor label { display: grid; gap: 3px; color: var(--muted); font-size: 11px; }
.exam-metadata-editor input,.exam-metadata-editor select { min-width: 0; padding: 8px 9px; border: 1px solid #d4dcd7; border-radius: 8px; background: #fff; color: var(--ink); }
.exam-editor-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: auto minmax(0,1fr); }
.exam-question-navigator,.taking-navigator { width: 210px; min-height: 0; overflow-y: auto; padding: 12px; border-right: 1px solid #d7dfda; background: #f0f4f1; }
.question-nav-section { margin-bottom: 14px; }
.question-nav-section strong { display: block; margin-bottom: 7px; font-size: 12px; }
.question-nav-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 5px; }
.question-nav-grid button { aspect-ratio: 1; padding: 0; border: 1px solid #ccd6d0; border-radius: 7px; background: #fff; font-size: 11px; }
.question-nav-grid button.has-warning { color: #9a4e22; border-color: #e5b98f; background: #fff2e5; }
.question-nav-grid button.is-answered { color: #fff; border-color: #315e52; background: #315e52; }
.exam-paper-scroll,.taking-paper-scroll { min-width: 0; min-height: 0; overflow: auto; padding: 18px clamp(12px,2vw,28px) 50px; }
.exam-paper { width: min(100%, 980px); margin: 0 auto; padding: clamp(24px,3vw,48px); color: #18211f; background: #fff; box-shadow: 0 12px 36px rgba(23,33,31,.1); font-family: "Noto Serif SC","Songti SC",SimSun,serif; }
.exam-paper-title { margin-bottom: 22px; text-align: center; }
.exam-paper-title h1 { margin: 0 0 7px; font-size: clamp(22px,3vw,30px); }
.exam-paper-title p { margin: 0; color: #68736f; font-size: 13px; }
.exam-section { margin-top: 24px; }
.exam-section:first-of-type { margin-top: 0; }
.exam-section-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; padding-bottom: 7px; border-bottom: 1.5px solid #25322e; }
.exam-section-header h2 { margin: 0; font-size: 18px; }
.exam-section-description { color: #59645f; font-size: 13px; }
.exam-question-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 0; }
.exam-question { position: relative; min-width: 0; padding: 14px 8px 16px 42px; border-bottom: 1px solid #e1e6e3; line-height: 1.75; }
.exam-question.is-long,.exam-question.has-image,.exam-question[data-type="short_answer"] { grid-column: 1 / -1; }
.exam-question-number { position: absolute; top: 14px; left: 4px; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: #fff; background: #253b35; font: 700 12px/1 sans-serif; }
.exam-question-score { position: absolute; top: 15px; right: 6px; color: #8a938f; font: 11px/1.2 sans-serif; }
.exam-block { margin: 0 0 7px; }
.exam-block-math { overflow-x: auto; text-align: center; }
.exam-block-image { text-align: center; }
.exam-block-image img { max-width: min(100%,620px); max-height: 420px; object-fit: contain; }
.exam-block-image[data-width="small"] img { max-width: 220px; max-height: 180px; }
.exam-block-image[data-width="medium"] img { max-width: 420px; max-height: 300px; }
.exam-block-image figcaption { color: #7a8580; font-size: 12px; }
.exam-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 2px 28px; margin-top: 5px; }
.exam-option { display: grid; grid-template-columns: 22px minmax(0,1fr); align-items: start; gap: 3px; min-width: 0; padding: 3px 5px; border: 1px solid transparent; border-radius: 7px; }
button.exam-option { width: 100%; text-align: left; color: inherit; background: #fff; cursor: pointer; font: inherit; }
button.exam-option:hover { border-color: #bed0c7; background: #f2f7f4; }
button.exam-option.is-selected { border-color: #315e52; background: #e7f1ed; }
.exam-option-key { font-weight: 700; }
.exam-option img { max-width: 100%; max-height: 180px; object-fit: contain; }
.exam-edit-field { display: grid; gap: 4px; margin: 6px 0; font-family: system-ui,sans-serif; }
.exam-edit-field > span { color: #6e7974; font-size: 11px; }
.exam-edit-field textarea,.exam-edit-field input,.exam-edit-field select { width: 100%; padding: 7px 8px; border: 1px solid #ccd6d0; border-radius: 8px; background: #fff; font: 13px/1.45 system-ui,sans-serif; }
.exam-edit-line { display: grid; grid-template-columns: 1fr 90px 145px; gap: 8px; margin-bottom: 8px; }
.exam-answer-editor { margin-top: 8px; padding: 9px; border-radius: 10px; background: #f1f5f2; font-family: system-ui,sans-serif; }
.exam-answer-editor label { display: grid; gap: 4px; color: #59645f; font-size: 11px; }
.exam-answer-editor input,.exam-answer-editor textarea,.exam-answer-editor select { width: 100%; padding: 7px; border: 1px solid #cbd5cf; border-radius: 7px; background: #fff; }
.exam-text-answer,.exam-fill-answer { width: 100%; margin-top: 8px; padding: 10px 11px; border: 1px solid #bfcac4; border-radius: 9px; font: 15px/1.5 system-ui,sans-serif; }
.exam-text-answer { min-height: 110px; resize: vertical; }
.exam-fill-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.exam-fill-list input { flex: 1 1 150px; padding: 9px; border: 1px solid #bfcac4; border-radius: 8px; }
.student-exam-paper .exam-question { scroll-margin-top: 90px; }
.exam-taking-header { box-shadow: 0 4px 18px rgba(23,33,31,.08); z-index: 2; }
.taking-status strong { min-width: 96px; font-size: 18px; color: #213c34; font-variant-numeric: tabular-nums; }
.exam-taking-layout { min-height: 0; display: grid; grid-template-columns: 220px minmax(0,1fr); }
.taking-navigator { width: auto; }
.exam-result-score { display: grid; place-items: center; gap: 5px; margin: 18px auto; width: 150px; height: 150px; border-radius: 50%; color: #fff; background: #27473e; }
.exam-result-score strong { font-size: 42px; }
.exam-result-metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.exam-result-metrics div { padding: 11px; border-radius: 10px; text-align: center; background: #f0f4f1; }
.exam-result-metrics strong,.exam-result-metrics span { display: block; }
.exam-result-metrics span { margin-top: 3px; color: var(--muted); font-size: 11px; }

/* Exam runtime bindings */
.exam-card-top,.exam-card-stats { display:flex; align-items:center; gap:9px; flex-wrap:wrap; }
.exam-card-top { justify-content:space-between; }
.exam-subject,.exam-status { padding:5px 9px; border-radius:999px; font-size:12px; font-weight:700; }
.exam-subject { color:#315e52; background:#e7f0ec; }
.exam-status { color:#66541b; background:#f4edcf; }
.exam-status.is-published { color:#315e52; background:#dcebe5; }
.exam-card > p,.exam-card-stats { margin:0; color:var(--ink-muted); font-size:13px; }
.exam-card-stats .has-warning { color:#9a4e22; }
.exam-history-item { width:100%; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 16px; border:1px solid var(--line); border-radius:14px; color:var(--ink); background:#fff; text-align:left; cursor:pointer; }
.exam-history-item span:first-child { display:grid; gap:3px; }
.exam-history-item small,.exam-attempt-row small { display:block; margin-top:3px; color:var(--ink-muted); }
.exam-attempt-row { grid-template-columns:minmax(180px,1fr) auto; }
.exam-section > header { display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:10px; padding-bottom:7px; border-bottom:1.5px solid #25322e; }
.exam-section > header h3 { margin:0; font-size:18px; }
.exam-section > header p { margin:0; color:var(--ink-muted); font-size:13px; }
.exam-question-main { min-width:0; }
.exam-question-top { display:flex; align-items:center; justify-content:flex-end; gap:8px; margin-bottom:4px; color:var(--ink-muted); font:12px/1.3 system-ui,sans-serif; }
.exam-question-top select,.exam-question-top input { padding:5px 7px; border:1px solid #ccd6d0; border-radius:7px; background:#fff; }
.exam-question-top label { display:flex; align-items:center; gap:5px; }
.exam-question-top input { width:70px; }
.exam-rich-text { margin:0 0 7px; }
.exam-math { overflow-x:auto; margin:7px 0; text-align:center; }
.exam-math .katex { line-height:1.2; }
.exam-math .katex-display { margin:.35em 0; overflow:visible; }
.exam-figure { margin:9px auto; text-align:center; }
.exam-figure img { display:block; max-width:100%; max-height:420px; margin:0 auto; object-fit:contain; }
.exam-figure figcaption { color:var(--ink-muted); font-size:12px; }
.exam-edit-block { margin:5px 0 8px; }
.exam-live-render { min-width:0; }
.exam-source-editor { margin-top:3px; color:var(--ink-muted); font:12px/1.4 system-ui,sans-serif; }
.exam-source-editor summary { width:max-content; padding:2px 6px; border-radius:5px; cursor:pointer; list-style:none; color:#49675d; background:#eef4f1; }
.exam-source-editor summary::-webkit-details-marker { display:none; }
.exam-source-editor textarea,.exam-source-editor input { width:100%; margin-top:5px; padding:7px 8px; border:1px solid #ccd6d0; border-radius:8px; color:var(--ink); background:#fff; resize:vertical; font:13px/1.5 system-ui,sans-serif; }
.exam-options-editor { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px 18px; margin-top:7px; }
.exam-option-editor { display:grid; grid-template-columns:22px minmax(0,1fr) auto; align-items:start; gap:4px; min-width:0; padding:3px 5px; border-radius:8px; font-family:system-ui,sans-serif; }
.exam-option-editor > strong { line-height:28px; }
.exam-option-live { min-height:28px; padding:2px 4px; line-height:1.65; }
.exam-option-live .exam-rich-text { margin:0; }
.exam-option-source { margin:2px 0 0; }
.exam-option-source[open] { grid-column:2 / -1; width:100%; }
.exam-option-source[open] summary { margin-left:auto; }
.exam-edit-image { margin:7px 0; padding:8px 10px 9px; border:1px dashed #ccd6d0; border-radius:10px; background:#fbfcfb; }
.exam-option-image { grid-column:1 / -1; }
.exam-image-size { display:flex; align-items:center; justify-content:center; gap:10px; margin:7px auto 0; color:var(--ink-muted); font:12px/1.3 system-ui,sans-serif; }
.exam-image-size span { min-width:86px; }
.exam-image-size output { color:#315e52; font-weight:700; }
.exam-image-size input { width:min(240px,55%); accent-color:#315e52; }
.exam-answer-editor { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.exam-choice-option { position:relative; grid-template-columns:16px 20px minmax(0,1fr); align-items:start; cursor:pointer; transition:background-color .15s,border-color .15s; }
.exam-choice-option:hover,.exam-choice-option:focus-within { border-color:#b9cbc3; background:#f6f9f7; }
.exam-choice-option.is-selected { border-color:transparent; background:#eef6f2; }
.exam-choice-input { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.exam-choice-dot { display:block; width:13px; height:13px; margin-top:7px; border:1.5px solid #899791; border-radius:50%; background:#fff; box-shadow:inset 0 0 0 3px #fff; }
.exam-choice-option.is-selected .exam-choice-dot,.exam-choice-option:has(.exam-choice-input:checked) .exam-choice-dot { border-color:#2f735d; background:#2f735d; }
.exam-choice-option > strong { line-height:27px; }
.exam-inline-blank { display:inline-block; width:7.5em; min-width:84px; margin:0 3px; padding:0 5px 2px; border:0; border-bottom:1.5px solid #65736d; border-radius:0; outline:0; color:#173c31; background:transparent; text-align:center; font:inherit; line-height:1.25; vertical-align:baseline; }
.exam-inline-blank:hover { border-bottom-color:#2f735d; background:#f1f7f4; }
.exam-inline-blank:focus { border-bottom-width:2px; border-bottom-color:#2f735d; background:#e9f4ef; }
.student-text-answer { display:grid; gap:5px; margin-top:10px; color:var(--ink-muted); font:12px/1.4 system-ui,sans-serif; }
.student-text-answer input,.student-text-answer textarea { width:100%; padding:10px 11px; border:1px solid #bfcac4; border-radius:9px; color:var(--ink); background:#fff; font:15px/1.5 system-ui,sans-serif; resize:vertical; }
.exam-question-navigator button { width:100%; display:flex; justify-content:space-between; gap:6px; margin-bottom:5px; padding:7px; border:1px solid #ccd6d0; border-radius:7px; background:#fff; cursor:pointer; }
.taking-navigator { display:grid; grid-template-columns:repeat(5,1fr); align-content:start; gap:6px; }
.taking-navigator button { aspect-ratio:1; border:1px solid #ccd6d0; border-radius:7px; background:#fff; }
.taking-navigator button.is-answered { color:#fff; border-color:#315e52; background:#315e52; }
.exam-result-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.exam-result-grid div { padding:11px; border-radius:10px; text-align:center; background:#f0f4f1; }
.exam-result-grid strong,.exam-result-grid span { display:block; }
.exam-result-note,.exam-result-pending { margin-top:14px; padding:13px; border-radius:10px; background:#fff7e9; }
.pdf-canvas-stage.is-cropping { cursor:crosshair; }

@media (max-width: 1000px) {
  .exam-workbench { grid-template-columns: minmax(280px,var(--pdf-width)) 7px minmax(360px,1fr); }
  .exam-metadata-editor { grid-template-columns: 2fr 1fr 1fr; }
  .exam-metadata-editor label:last-child { grid-column: 1 / -1; }
  .exam-question-grid { grid-template-columns: 1fr; }
  .exam-question { grid-column: 1; }
}

@media (max-width: 760px) {
  .exam-summary-strip { grid-template-columns: 1fr; }
  .exam-summary-strip > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .exam-card-grid { grid-template-columns: 1fr; }
  .exam-history-row,.exam-attempt-row { grid-template-columns: 1fr 1fr; }
  .exam-history-row > :first-child,.exam-attempt-row > :first-child { grid-column: 1 / -1; }
  .exam-workbench-header,.exam-taking-header { align-items: flex-start; padding: 10px 12px; }
  .exam-workbench-header > div:first-child p,.exam-taking-header > div:first-child p { display: none; }
  .exam-workbench-actions .exam-save-status,.exam-workbench-actions .button-quiet { display: none; }
  .exam-workbench-actions .button { padding: 8px 10px; }
  .exam-workbench { display: block; overflow: auto; }
  .exam-splitter { display: none; }
  .pdf-bench,.exam-editor-bench { height: calc(100dvh - 76px); }
  .pdf-bench { display: none; }
  .exam-workbench.is-pdf-view .pdf-bench { display: grid; }
  .exam-workbench.is-pdf-view .exam-editor-bench { display: none; }
  .exam-mobile-pdf-toggle { display:inline-flex; margin-left:auto; }
  .pdf-bench .bench-toolbar strong { cursor:pointer; }
  .pdf-bench .bench-toolbar strong::before { content:"← "; }
  .crop-dock { grid-template-columns: 90px 1fr; }
  .crop-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .crop-fields { grid-template-columns: 1fr; }
  .exam-metadata-editor { grid-template-columns: 1fr 1fr; }
  .exam-metadata-editor label:first-child { grid-column: 1 / -1; }
  .exam-question-navigator { position: absolute; z-index: 4; width: 230px; height: calc(100% - 50px); box-shadow: 8px 0 24px rgba(20,30,26,.15); }
  .exam-paper-scroll,.taking-paper-scroll { padding: 8px 0 35px; }
  .exam-paper { padding: 22px 14px 40px; box-shadow: none; }
  .exam-question { padding: 12px 2px 14px 36px; }
  .exam-options,.exam-options-editor { grid-template-columns: 1fr; gap: 3px; }
  .exam-option { padding: 5px 2px; }
  .exam-taking-layout { display: block; overflow: auto; }
  .taking-navigator { position: fixed; z-index: 4; left: 0; top: 76px; bottom: 0; width: 230px; transform: translateX(-100%); transition: transform .2s; box-shadow: 8px 0 24px rgba(20,30,26,.15); }
  .taking-navigator.is-open { transform: translateX(0); }
  .taking-status > span { display: none; }
  .taking-status strong { min-width: 76px; font-size: 15px; }
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 84% 12%, rgba(49, 95, 120, 0.055), transparent 25%),
    var(--bg);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a, input, select, textarea, label { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(49, 95, 120, 0.2);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-frame { min-height: 100vh; padding-bottom: 42px; }
.site-compliance {
  position: fixed;
  z-index: 10;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  color: rgba(79, 93, 89, .62);
  border: 1px solid rgba(190, 202, 196, .38);
  border-radius: 999px;
  background: rgba(242, 245, 243, .78);
  box-shadow: 0 5px 18px rgba(23, 33, 31, .04);
  backdrop-filter: blur(12px);
  font-size: 11px;
  line-height: 1;
  letter-spacing: .02em;
}
.site-compliance a {
  color: inherit;
  text-decoration: none;
  transition: color .18s ease;
}
.site-compliance a:hover { color: var(--ink-soft); }
.site-compliance-separator {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: .72;
}
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 10px max(24px, calc((100vw - var(--content-width)) / 2));
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(242, 245, 243, 0.94);
  border-bottom: 1px solid rgba(215, 223, 219, 0.86);
  backdrop-filter: blur(14px);
}
.brand {
  display: inline-flex;
  min-width: 0;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  font-size: 18px;
  font-weight: 760;
  text-decoration: none;
}
.brand-name { overflow-wrap: anywhere; }
.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 8px;
  font-size: 17px;
  font-weight: 800;
}
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.account-control { position: relative; }
.avatar-button, .icon-button { display: inline-grid; place-items: center; border: 0; cursor: pointer; }
.avatar-button {
  width: 40px;
  height: 40px;
  color: var(--primary);
  background: #dbe6e1;
  border-radius: 50%;
  font-weight: 760;
}
.account-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 10px);
  right: 0;
  width: 220px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.account-menu-head { display: grid; gap: 4px; padding: 17px 18px 14px; border-bottom: 1px solid var(--line); }
.account-menu-head strong { overflow-wrap: anywhere; font-size: 14px; }
.account-menu-head span { color: var(--ink-muted); font-size: 12px; }
.account-menu-action {
  width: 100%;
  padding: 13px 18px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.account-menu-action:hover { color: var(--ink); background: var(--surface-muted); }

.auth-view { display: grid; min-height: calc(100vh - 71px); padding: 48px 24px; place-items: center; }
.auth-panel {
  display: grid;
  width: min(100%, 1000px);
  min-height: 540px;
  grid-template-columns: minmax(0, 1.16fr) minmax(340px, 0.84fr);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.auth-copy {
  position: relative;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  justify-content: flex-end;
  padding: 64px;
  color: #f8fbf9;
  background: var(--primary);
}
.auth-copy::before {
  position: absolute;
  top: -130px;
  right: -105px;
  width: 340px;
  height: 340px;
  content: "";
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  box-shadow: 0 0 0 60px rgba(255,255,255,.025), 0 0 0 120px rgba(255,255,255,.018);
}
.auth-copy h1 {
  position: relative;
  max-width: 490px;
  margin: 16px 0 18px;
  font-weight: 780;
}
.auth-brand-title {
  display: grid;
  gap: 11px;
}
.auth-brand-primary {
  display: block;
  font-size: clamp(48px, 5.2vw, 64px);
  line-height: .98;
  letter-spacing: -.04em;
  white-space: nowrap;
}
.auth-brand-secondary {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: clamp(30px, 3.5vw, 42px);
  line-height: 1.08;
  letter-spacing: .08em;
  white-space: nowrap;
}
.auth-brand-rule {
  width: 38px;
  height: 2px;
  flex: 0 0 auto;
  background: #94b2a7;
  border-radius: 99px;
}
.auth-copy > p:last-of-type { position: relative; max-width: 430px; margin: 0; color: #c8d4d0; font-size: 16px; line-height: 1.8; }
.auth-orbit { position: absolute; top: 50px; left: 58px; display: flex; gap: 8px; }
.auth-orbit span { padding: 6px 9px; color: #afc4bd; border: 1px solid rgba(255,255,255,.15); border-radius: 99px; font-size: 10px; font-weight: 760; }
.eyebrow { margin: 0; color: var(--blue); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.auth-copy .eyebrow { position: relative; color: #94b2a7; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 58px; }
.form-heading { margin-bottom: 30px; }
.form-heading h2, .modal-head h2 { margin: 7px 0 6px; font-size: 26px; line-height: 1.25; }
.form-heading p, .modal-head p { margin: 0; color: var(--ink-muted); line-height: 1.6; }
.auth-footnote { margin: 16px 0 0; color: var(--ink-muted); font-size: 12px; text-align: center; }

.field { display: grid; gap: 8px; margin-bottom: 18px; color: var(--ink-soft); font-size: 13px; font-weight: 670; }
.field input, .field select, .field textarea, .search-field input, .select-field select {
  width: 100%;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field input, .field select, .search-field input, .select-field select { height: 48px; padding: 0 14px; }
.field textarea { min-height: 86px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
.field input:hover, .field select:hover, .field textarea:hover, .search-field input:hover, .select-field select:hover { border-color: var(--line-strong); }
.field input:focus, .field select:focus, .field textarea:focus, .search-field input:focus, .select-field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49,95,120,.1); outline: none; }
.form-error { min-height: 22px; margin: 0 0 12px; color: var(--danger); font-size: 13px; line-height: 1.5; }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}
.button:active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button-primary { color: #fff; background: var(--primary); }
.button-primary:hover { background: var(--primary-hover); }
.button-secondary { color: var(--primary); background: var(--surface-muted); }
.button-secondary:hover { background: #dde7e2; }
.button-quiet { color: var(--ink-soft); background: transparent; border-color: var(--line); }
.button-quiet:hover { color: var(--ink); background: var(--surface); }
.button-block { width: 100%; min-height: 50px; }

.dashboard { width: min(100%, calc(var(--content-width) + 48px)); margin: 0 auto; padding: 34px 24px 96px; }
.workspace-nav {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-bottom: 48px;
  padding: 4px;
  background: #e4eae7;
  border-radius: 8px;
}
.workspace-nav-button {
  min-width: 112px;
  min-height: 38px;
  padding: 0 15px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.workspace-nav-button.is-active { color: var(--ink); background: var(--surface); box-shadow: 0 2px 8px rgba(23,33,31,.08); }
#adminNav { grid-template-columns: repeat(9, minmax(72px, 1fr)); width: 100%; }
.student-nav { grid-template-columns: repeat(3,1fr); }
.dashboard-head { display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 30px; }
.dashboard-head h1 { margin: 9px 0 8px; font-size: clamp(34px, 5vw, 52px); line-height: 1.08; }
.dashboard-subtitle { margin: 0; color: var(--ink-muted); font-size: 15px; }
.upload-open { min-width: 118px; }
.head-actions { display: flex; gap: 10px; }

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 22px;
  padding: 19px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.summary-strip > div { display: grid; gap: 3px; padding: 0 24px; border-right: 1px solid var(--line); }
.summary-strip > div:first-child { padding-left: 0; }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip strong { font-size: 24px; line-height: 1.1; }
.summary-strip span { color: var(--ink-muted); font-size: 12px; }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 150px; gap: 12px; margin-bottom: 22px; }
body[data-role="user"] .toolbar { grid-template-columns: minmax(220px, 1fr); }
.search-field, .select-field { position: relative; }
.search-field input, .select-field select { height: 46px; background: rgba(255,255,255,.78); }
.select-field select {
  padding-right: 35px;
  appearance: none;
  background-image: linear-gradient(45deg,transparent 50%,var(--ink-soft) 50%), linear-gradient(135deg,var(--ink-soft) 50%,transparent 50%);
  background-position: calc(100% - 17px) 20px, calc(100% - 12px) 20px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}
.student-grade-filter { display: grid; gap: 12px; margin: 0 0 18px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.grade-filter-row { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 12px; align-items: center; }
.grade-filter-label { color: var(--ink-muted); font-size: 12px; font-weight: 700; }
.segmented-control { display: inline-grid; width: min(100%,360px); grid-template-columns: repeat(3,minmax(0,1fr)); gap: 3px; padding: 4px; background: #e4eae7; border-radius: 8px; }
.segmented-control button, .grade-filter-button { min-height: 38px; padding: 0 14px; color: var(--ink-soft); background: transparent; border: 0; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 700; }
.segmented-control button.is-active { color: var(--ink); background: var(--surface); box-shadow: 0 2px 8px rgba(23,33,31,.08); }
.grade-control { display: flex; min-width: 0; gap: 6px; flex-wrap: wrap; }
.grade-filter-button { min-height: 36px; background: rgba(255,255,255,.58); border: 1px solid var(--line); white-space: nowrap; }
.grade-filter-button.is-active { color: #fff; background: var(--primary); border-color: var(--primary); }
.tool-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
.tool-card {
  display: flex;
  min-height: 276px;
  flex-direction: column;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.tool-card:hover { transform: translateY(-2px); border-color: #c4d0cb; box-shadow: 0 14px 32px rgba(23,33,31,.09); }
.tool-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.tool-symbol, .account-avatar {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  font-weight: 790;
}
.tool-symbol { width: 46px; height: 46px; border-radius: 7px; font-size: 18px; }
.tone-1 { background: var(--blue); }
.tone-2 { background: #536b54; }
.tone-3 { background: #72554d; }
.tone-4 { background: #4d596f; }
.tool-chips { display: flex; gap: 6px; align-items: center; }
.type-chip, .publish-status, .account-status {
  padding: 5px 9px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 730;
}
.type-chip { text-transform: uppercase; }
.publish-status { color: #8c5f38; background: #f7eadc; }
.publish-status.is-published { color: var(--success); background: var(--success-soft); }
.tool-card-body { flex: 1; padding: 26px 0 22px; }
.tool-grades { display: flex; min-height: 24px; gap: 5px; flex-wrap: wrap; margin: 0 0 9px; }
.grade-tag { max-width: 100%; padding: 4px 7px; overflow-wrap: anywhere; color: var(--blue); background: var(--blue-soft); border-radius: 5px; font-size: 10px; font-weight: 700; line-height: 1.4; }
.grade-tag.subject-tag { color: #7b4b30; background: var(--accent-soft); }
.grade-tag.is-legacy { color: var(--ink-muted); background: var(--surface-muted); }
.tool-name { margin: 0 0 12px; overflow-wrap: anywhere; font-size: 21px; line-height: 1.35; }
.tool-meta { margin: 0; color: var(--ink-muted); font-size: 12px; line-height: 1.5; }
.tool-card-actions { display: grid; grid-template-columns: 1fr auto auto; gap: 7px; }
.tool-card-actions .button { min-width: 0; padding-right: 13px; padding-left: 13px; }
.tool-card-actions.user-actions { grid-template-columns: 1fr; }

.loading-state { display: flex; min-height: 260px; gap: 12px; align-items: center; justify-content: center; color: var(--ink-muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state {
  display: grid;
  min-height: 340px;
  padding: 56px 24px;
  place-items: center;
  text-align: center;
  background: rgba(255,255,255,.48);
  border: 1px dashed #bdcac4;
  border-radius: var(--radius);
}
.empty-state > * { margin: 0; }
.empty-state h2 { margin-top: 18px; font-size: 22px; }
.empty-state p { margin-top: 8px; color: var(--ink-muted); }
.empty-state .button { margin-top: 22px; }
.empty-state.compact { min-height: 210px; }
.empty-mark { display: grid; width: 64px; height: 64px; place-items: center; color: var(--blue); background: #dfeaed; border-radius: 50%; font-family: ui-monospace,SFMono-Regular,Consolas,monospace; font-weight: 740; }

.student-schedule-hero {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 26px;
  padding: 28px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.student-schedule-hero h1 { margin: 8px 0 6px; font-size: clamp(32px,5vw,48px); line-height: 1.1; }
.student-schedule-hero p { margin: 0; color: var(--ink-muted); }
.schedule-range { display: grid; gap: 4px; text-align: right; }
.schedule-range span { color: var(--ink-muted); font-size: 11px; }
.schedule-range strong { font-size: 14px; }
.student-schedule-list { display: grid; gap: 24px; }
.student-schedule-day { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 22px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.student-schedule-day-head { display: flex; flex-direction: column; gap: 6px; }
.student-schedule-day-head h2 { margin: 0; font-size: 17px; }
.student-schedule-day-head span { color: var(--ink-muted); font-size: 11px; }
.student-course-list { display: grid; gap: 10px; }
.student-course-card { display: grid; grid-template-columns: 76px minmax(0,1fr) auto; gap: 16px; align-items: center; padding: 17px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.student-course-time { display: grid; gap: 2px; }
.student-course-time strong { font-size: 17px; }
.student-course-time span { color: var(--ink-muted); font-size: 11px; }
.student-course-content { min-width: 0; }
.student-course-content h3 { margin: 0 0 5px; overflow-wrap: anywhere; font-size: 16px; }
.student-course-content p { margin: 0; overflow-wrap: anywhere; color: var(--ink-muted); font-size: 12px; }
.schedule-type-chip { padding: 5px 8px; color: var(--success); background: var(--success-soft); border-radius: 999px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.schedule-type-chip.is-dated { color: var(--blue); background: var(--blue-soft); }

.account-dashboard-head { margin-bottom: 27px; }
.account-toolbar { display: grid; grid-template-columns: minmax(240px,1fr) 180px; gap: 12px; margin-bottom: 16px; }
.account-list { overflow: hidden; background: rgba(255,255,255,.68); border: 1px solid var(--line); border-radius: var(--radius); }
.account-row {
  display: grid;
  min-height: 88px;
  grid-template-columns: minmax(180px,1.2fr) minmax(140px,1fr) 95px 105px auto minmax(380px,auto);
  gap: 14px;
  align-items: center;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}
.account-row:last-child { border-bottom: 0; }
.account-identity { display: flex; min-width: 0; gap: 12px; align-items: center; }
.account-avatar { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 50%; }
.account-identity > div { display: grid; min-width: 0; gap: 3px; }
.account-student-name, .account-class-name, .account-username, .account-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-student-name { font-size: 14px; }
.account-class-name, .account-note { color: var(--ink-muted); font-size: 12px; }
.account-login { display: grid; min-width: 0; gap: 3px; }
.account-username { color: var(--ink-soft); font-size: 12px; }
.account-time { display: grid; gap: 3px; }
.account-time span { color: var(--ink-muted); font-size: 10px; }
.account-time strong { color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.account-usage-summary { display: flex; gap: 6px; flex-wrap: wrap; }
.account-usage-summary span { padding: 5px 7px; color: var(--ink-muted); background: var(--surface-muted); border-radius: 999px; font-size: 10px; white-space: nowrap; }
.account-usage-summary strong { color: var(--blue); font-size: 11px; }
.account-status { justify-self: start; color: var(--success); background: var(--success-soft); white-space: nowrap; }
.account-status.is-disabled { color: var(--danger); background: var(--danger-soft); }
.account-actions { display: flex; gap: 13px; flex-wrap: wrap; justify-content: flex-end; }
.account-dialog-username { color: var(--ink) !important; font-weight: 720; }

.usage-modal { width: min(calc(100% - 32px),760px); }
.usage-modal-card { width: 100%; }
.usage-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)) minmax(180px,1.2fr); gap: 10px; margin-bottom: 22px; }
.usage-summary > div { display: flex; min-height: 92px; gap: 5px; align-items: baseline; padding: 16px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 7px; }
.usage-summary > div:last-child { display: grid; align-content: center; }
.usage-summary span { width: 100%; color: var(--ink-muted); font-size: 11px; }
.usage-summary strong { color: var(--blue); font-size: 30px; line-height: 1; }
.usage-summary small { color: var(--ink-muted); font-size: 11px; }
.usage-summary .usage-last-access { color: var(--ink); font-size: 13px; line-height: 1.4; }
.usage-loading { min-height: 260px; }
.usage-section { padding: 18px 0; border-top: 1px solid var(--line); }
.usage-section .section-heading { margin-bottom: 14px; }
.usage-section .section-heading h3 { margin: 3px 0 0; font-size: 16px; }
.usage-daily-list, .usage-tool-list { display: grid; gap: 8px; }
.usage-daily-row { display: grid; grid-template-columns: 92px minmax(0,1fr) 48px; gap: 12px; align-items: center; min-height: 34px; }
.usage-daily-row > span { color: var(--ink-soft); font-size: 11px; }
.usage-daily-row > strong { color: var(--ink); font-size: 11px; text-align: right; }
.usage-daily-track { height: 8px; overflow: hidden; background: var(--surface-muted); border-radius: 99px; }
.usage-daily-track i { display: block; min-width: 0; height: 100%; background: linear-gradient(90deg,var(--blue),#789b8d); border-radius: inherit; }
.usage-tool-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--surface-muted); border-radius: 7px; }
.usage-tool-row > div { display: grid; min-width: 0; gap: 4px; }
.usage-tool-row > div strong, .usage-tool-row > div span { overflow-wrap: anywhere; }
.usage-tool-row > div strong { font-size: 13px; }
.usage-tool-row > div span { color: var(--ink-muted); font-size: 10px; }
.usage-tool-count { flex: 0 0 auto; color: var(--blue); font-size: 15px; }
.usage-empty { padding: 28px 14px; color: var(--ink-muted); background: var(--surface-muted); border-radius: 7px; text-align: center; font-size: 12px; }

.announcement-form { max-width: 760px; padding-top: 26px; border-top: 1px solid var(--line); }
.announcement-form .field textarea { min-height: 240px; overflow-wrap: anywhere; }
.toggle-field {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 16px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.toggle-field > span:first-child { display: grid; gap: 4px; }
.toggle-field strong { font-size: 14px; }
.toggle-field small { color: var(--ink-muted); font-size: 12px; line-height: 1.5; }
.toggle-field input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle-control { position: relative; width: 48px; height: 28px; flex: 0 0 auto; background: var(--line-strong); border-radius: 999px; transition: background 160ms ease; }
.toggle-control::after { position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; content: ""; background: var(--surface); border-radius: 50%; box-shadow: 0 1px 4px rgba(23,33,31,.2); transition: transform 160ms ease; }
.toggle-field input:checked + .toggle-control { background: var(--success); }
.toggle-field input:checked + .toggle-control::after { transform: translateX(20px); }
.toggle-field input:focus-visible + .toggle-control { outline: 3px solid rgba(49,95,120,.2); outline-offset: 2px; }
.announcement-actions { display: flex; gap: 20px; align-items: center; justify-content: space-between; }
.form-status { min-height: 22px; margin: 0; color: var(--ink-muted); font-size: 13px; line-height: 1.5; }
.form-status.is-error { color: var(--danger); }
.form-status.is-success { color: var(--success); }

.modal { width: min(calc(100% - 32px),640px); max-height: min(90vh,780px); padding: 0; overflow: auto; color: var(--ink); background: transparent; border: 0; }
.modal::backdrop { background: rgba(13,20,18,.6); }
.modal-card { padding: 30px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal-card-small { max-width: 520px; margin: 0 auto; }
#editDialog {
  width: min(calc(100% - 20px),520px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  scrollbar-color: #aeb9b4 var(--surface);
}
#editDialog::-webkit-scrollbar-track { background: var(--surface); }
#editDialog .modal-card {
  width: 100%;
  max-width: none;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.modal-head { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; margin-bottom: 26px; }
.modal-head > div { min-width: 0; }
.modal-head p { font-size: 13px; }
.icon-button { width: 38px; height: 38px; flex: 0 0 auto; color: var(--ink-soft); background: var(--surface-muted); border-radius: 50%; font-size: 24px; line-height: 1; }
.drop-zone {
  display: grid;
  min-height: 164px;
  margin-bottom: 22px;
  padding: 24px;
  place-items: center;
  align-content: center;
  cursor: pointer;
  background: #f7faf8;
  border: 1px dashed #aebdb6;
  border-radius: var(--radius);
  transition: background 160ms ease,border-color 160ms ease;
}
.drop-zone:hover, .drop-zone.is-dragging { background: #edf4f0; border-color: var(--blue); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-title { font-size: 16px; font-weight: 720; }
.drop-note, .file-name { margin-top: 7px; color: var(--ink-muted); font-size: 12px; }
.file-name { color: var(--blue); font-weight: 650; overflow-wrap: anywhere; }
.two-column-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grade-picker { margin: 2px 0 20px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.grade-picker-heading { display: flex; gap: 14px; align-items: baseline; justify-content: space-between; margin-bottom: 15px; }
.grade-picker-heading strong { color: var(--ink-soft); font-size: 13px; }
.grade-picker-heading span { color: var(--ink-muted); font-size: 11px; }
.grade-group-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.grade-checkbox-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.grade-checkbox-group legend { width: 100%; margin-bottom: 9px; padding: 0 0 7px; color: var(--ink); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 750; }
.grade-checkbox-options { display: grid; gap: 8px; }
.grade-checkbox-option { display: flex; min-width: 0; gap: 7px; align-items: center; color: var(--ink-soft); cursor: pointer; font-size: 12px; line-height: 1.4; }
.grade-checkbox-option input { width: 17px; height: 17px; flex: 0 0 auto; margin: 0; accent-color: var(--primary); }
.grade-checkbox-option span { overflow-wrap: anywhere; }
.progress-track { height: 5px; margin: 2px 0 14px; overflow: hidden; background: var(--surface-muted); border-radius: 99px; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); transition: width 120ms linear; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.management-row { display: flex; flex-wrap: wrap; gap: 18px; padding: 4px 0 22px; border-bottom: 1px solid var(--line); }
.text-button { padding: 0; color: var(--blue); background: transparent; border: 0; cursor: pointer; font-size: 13px; font-weight: 690; text-decoration: none; }
.danger-text { color: var(--danger); }
.status-control { display: flex; gap: 18px; align-items: center; justify-content: space-between; margin: 2px 0 20px; padding: 16px; background: var(--surface-muted); border-radius: var(--radius); }
.status-control > div { display: grid; gap: 4px; }
.status-control strong { font-size: 13px; }
.status-control span { color: var(--ink-muted); font-size: 11px; line-height: 1.5; }
.field-help { margin: -8px 0 18px; color: var(--ink-muted); font-size: 12px; line-height: 1.6; }

.schedule-modal-card { width: min(860px,100%); margin: 0 auto; }
.schedule-preview-modal { width: min(calc(100% - 32px),920px); }
.schedule-preview-card { width: 100%; }
.schedule-preview-card .student-schedule-hero { margin-bottom: 24px; }
.schedule-preview-card .student-schedule-list { max-height: 55vh; padding-right: 4px; overflow: auto; }
.schedule-mode-control { width: 100%; grid-template-columns: repeat(2,minmax(0,1fr)); margin-bottom: 20px; }
.schedule-course-form { margin-bottom: 22px; padding: 20px; background: var(--surface-muted); border-radius: var(--radius); }
.schedule-form-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.schedule-weekday-field { min-width: 0; margin: 0; padding: 0; grid-column: 1 / -1; border: 0; }
.schedule-weekday-field legend { margin-bottom: 9px; color: var(--ink-soft); font-size: 12px; font-weight: 680; }
.schedule-weekday-options { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 8px; }
.schedule-weekday-option { display: flex; min-width: 0; min-height: 42px; gap: 7px; align-items: center; justify-content: center; padding: 8px 6px; color: var(--ink-soft); cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; font-size: 12px; font-weight: 650; }
.schedule-weekday-option.is-selected { color: var(--blue); background: var(--blue-soft); border-color: var(--blue); }
.schedule-weekday-option input { width: 17px; height: 17px; flex: 0 0 auto; margin: 0; accent-color: var(--primary); }
.schedule-weekday-field > p { margin-top: 8px; color: var(--ink-muted); font-size: 11px; line-height: 1.5; }
.schedule-course-name-field { grid-column: span 2; }
.schedule-note-field { grid-column: span 2; }
.schedule-form-actions { display: flex; gap: 10px; justify-content: flex-end; }
.schedule-editor-list { display: grid; max-height: 310px; margin-bottom: 18px; overflow: auto; border-top: 1px solid var(--line); }
.schedule-editor-item { display: grid; grid-template-columns: 130px minmax(0,1fr) auto; gap: 16px; align-items: center; padding: 15px 4px; border-bottom: 1px solid var(--line); }
.schedule-editor-when, .schedule-editor-content { display: grid; min-width: 0; gap: 3px; }
.schedule-editor-when span, .schedule-editor-content span { overflow-wrap: anywhere; color: var(--ink-muted); font-size: 11px; }
.schedule-editor-actions { display: flex; gap: 14px; }
.schedule-editor-empty { min-height: 170px; margin-bottom: 18px; }

.button-small { min-height: 36px; padding: 0 13px; font-size: 12px; }
.feedback-hero {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 26px 28px;
  color: #f8fbf9;
  background: linear-gradient(135deg,#17211f 0%,#29433d 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.feedback-hero h1 { margin: 7px 0 5px; font-size: clamp(30px,4.5vw,44px); line-height: 1.1; }
.feedback-hero p { margin: 0; color: rgba(248,251,249,.72); }
.feedback-hero .eyebrow { color: rgba(248,251,249,.62); }
.latest-score { display: grid; min-width: 112px; gap: 3px; padding: 15px 18px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.13); border-radius: 7px; text-align: center; }
.latest-score span { color: rgba(248,251,249,.66); font-size: 11px; }
.latest-score strong { font-size: 30px; line-height: 1; }
.score-trend-card { margin-bottom: 22px; padding: 22px 24px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.section-heading { display: flex; gap: 18px; align-items: flex-end; justify-content: space-between; }
.section-heading h2 { margin: 4px 0 0; font-size: 20px; }
.section-heading > span { color: var(--ink-muted); font-size: 12px; }
.score-chart { height: 220px; margin-top: 14px; overflow: hidden; }
.score-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.score-chart-grid { stroke: #e4eae7; stroke-width: 1; }
.score-chart-label { fill: var(--ink-muted); font-size: 10px; }
.score-chart-area { fill: url(#scoreAreaGradient); }
.score-chart-line { fill: none; stroke: var(--blue); stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.score-chart-point { fill: var(--surface); stroke: var(--blue); stroke-width: 3; }
.score-chart-value { fill: var(--ink); font-size: 11px; font-weight: 750; text-anchor: middle; }
.score-chart-empty { padding: 54px 0; color: var(--ink-muted); text-align: center; font-size: 13px; }
.student-feedback-list { display: grid; gap: 14px; }
.student-feedback-card { padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.student-feedback-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.student-feedback-head h2 { margin: 5px 0 0; font-size: 19px; }
.student-feedback-date { color: var(--ink-muted); font-size: 11px; }
.student-feedback-score { min-width: 60px; padding: 9px 10px; color: var(--blue); background: var(--blue-soft); border-radius: 7px; text-align: center; }
.student-feedback-score strong { font-size: 22px; }
.student-feedback-score span { margin-left: 2px; font-size: 10px; }
.student-feedback-tasks { display: grid; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.student-feedback-task { display: grid; grid-template-columns: 22px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px 12px; background: var(--surface-muted); border-radius: 7px; }
.student-feedback-task-index { display: grid; width: 22px; height: 22px; place-items: center; color: var(--ink-soft); background: var(--surface); border-radius: 50%; font-size: 10px; font-weight: 760; }
.student-feedback-task span { overflow-wrap: anywhere; font-size: 13px; }
.student-feedback-task a { color: var(--blue); font-size: 12px; font-weight: 720; text-decoration: none; }
.student-feedback-note { margin: 16px 0 0; padding: 14px 16px; white-space: pre-wrap; color: var(--ink-soft); background: var(--surface-warm); border-left: 3px solid var(--accent); border-radius: 0 7px 7px 0; font-size: 13px; line-height: 1.7; }
.student-feedback-images { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; margin-top: 16px; }
.student-feedback-images a { display: block; overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 7px; }
.student-feedback-images img { display: block; width: 100%; height: 100%; object-fit: cover; }

.feedback-modal { width: min(calc(100% - 32px),1080px); }
.feedback-modal-card { width: 100%; }
.feedback-admin-layout { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(300px,.8fr); gap: 24px; }
.feedback-form { min-width: 0; padding: 20px; background: var(--surface-muted); border-radius: var(--radius); }
.feedback-form-heading, .feedback-block-heading { display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.feedback-form-heading { margin-bottom: 17px; }
.feedback-form-heading > div, .feedback-block-heading > div { display: grid; gap: 3px; }
.feedback-form-heading strong, .feedback-block-heading strong { font-size: 14px; }
.feedback-form-heading span, .feedback-block-heading span { color: var(--ink-muted); font-size: 11px; line-height: 1.4; }
.feedback-fields { display: grid; grid-template-columns: 140px minmax(0,1fr) 110px; gap: 11px; }
.feedback-task-editor, .feedback-image-picker { margin-bottom: 18px; padding: 15px; background: rgba(255,255,255,.68); border: 1px solid var(--line); border-radius: 7px; }
.feedback-block-heading { margin-bottom: 12px; }
.feedback-model-filters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)) auto; gap: 9px; align-items: end; margin-bottom: 12px; padding: 11px; background: var(--surface-muted); border-radius: 7px; }
.feedback-model-filters .field { gap: 5px; margin: 0; font-size: 11px; }
.feedback-model-filters .field select { height: 40px; padding: 0 10px; font-size: 12px; }
.feedback-model-filters p { min-width: 116px; margin: 0 0 12px; color: var(--ink-muted); font-size: 11px; line-height: 1.4; }
.feedback-task-list { display: grid; gap: 9px; }
.feedback-task-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(145px,.55fr) auto; gap: 8px; align-items: center; }
.feedback-task-row input, .feedback-task-row select { width: 100%; min-height: 42px; padding: 0 11px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.feedback-task-remove { width: 34px; height: 34px; padding: 0; color: var(--danger); background: transparent; border: 0; cursor: pointer; font-size: 20px; }
.feedback-image-input { display: inline-flex; min-height: 38px; align-items: center; padding: 0 13px; color: var(--blue); cursor: pointer; background: var(--blue-soft); border-radius: 6px; font-size: 12px; font-weight: 700; }
.feedback-image-input input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.feedback-image-selection { display: grid; gap: 7px; margin-top: 10px; }
.feedback-image-item { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-size: 11px; }
.feedback-image-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feedback-image-item button { flex: 0 0 auto; }
.feedback-history { min-width: 0; }
.feedback-admin-list { display: grid; max-height: 590px; gap: 10px; overflow: auto; }
.feedback-admin-card { padding: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.feedback-admin-card-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.feedback-admin-card-head strong { overflow-wrap: anywhere; font-size: 14px; }
.feedback-admin-card-head span { color: var(--ink-muted); font-size: 11px; white-space: nowrap; }
.feedback-admin-card-meta { margin: 8px 0 11px; color: var(--ink-muted); font-size: 11px; }
.feedback-admin-card-actions { display: flex; gap: 14px; }
.feedback-history-empty { padding: 60px 15px; color: var(--ink-muted); background: rgba(255,255,255,.52); border: 1px dashed var(--line-strong); border-radius: 7px; text-align: center; font-size: 12px; }

.credentials-modal { width: min(calc(100% - 32px),760px); }
.credential-list { display: grid; max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.credential-row { display: grid; grid-template-columns: minmax(130px,1fr) minmax(180px,1fr); gap: 18px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.credential-row:last-child { border-bottom: 0; }
.credential-row > div { display: grid; gap: 3px; min-width: 0; }
.credential-row strong, .credential-row span { overflow-wrap: anywhere; }
.credential-row span { color: var(--ink-muted); font-size: 11px; }
.credential-row code { padding: 8px 10px; overflow-wrap: anywhere; color: var(--ink); background: var(--surface-muted); border-radius: 5px; font-size: 13px; }
.credential-note { margin: 14px 0 20px; padding: 12px 14px; color: #6c4b3b; background: var(--accent-soft); border-radius: 6px; font-size: 12px; line-height: 1.6; }
.credentials-actions { justify-content: stretch; }
.credentials-actions .button:last-child { margin-left: auto; }

.announcement-dialog-body { max-height: min(50vh,420px); margin-bottom: 26px; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; color: var(--ink-soft); font-size: 15px; line-height: 1.8; }
.announcement-dialog-actions .button { min-width: 120px; }

.toast { position: fixed; z-index: 60; right: 22px; bottom: max(22px,env(safe-area-inset-bottom)); max-width: min(360px,calc(100vw - 44px)); padding: 13px 16px; color: #fff; background: var(--primary); border-radius: 6px; box-shadow: var(--shadow); font-size: 13px; }
.offline-banner { position: fixed; z-index: 55; right: 0; bottom: 0; left: 0; padding: 10px 20px max(10px,env(safe-area-inset-bottom)); color: #5d3b2b; background: var(--accent-soft); border-top: 1px solid #f2c9b5; text-align: center; font-size: 12px; }

@media (max-width: 1120px) {
  .tool-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .account-row { grid-template-columns: minmax(180px,1.2fr) minmax(130px,1fr) auto auto; }
  .account-time { display: none; }
  .account-actions { grid-column: 1 / -1; justify-content: flex-start; padding-left: 54px; }
}

@media (max-width: 900px) {
  #adminNav { grid-template-columns: repeat(4, minmax(92px, 1fr)); }
  .auth-panel { grid-template-columns: 1fr; }
  .auth-copy { min-height: 250px; padding: 40px; }
  .auth-brand-primary { font-size: 46px; }
  .auth-brand-secondary { font-size: 32px; }
  .auth-orbit { top: 28px; left: 38px; }
  .auth-form { padding: 42px 40px 48px; }
  .tool-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .account-row { grid-template-columns: minmax(170px,1.2fr) minmax(120px,1fr) auto; gap: 14px; }
  .account-status { display: none; }
  .account-actions { grid-column: 1 / -1; justify-content: flex-start; padding-left: 54px; }
  .schedule-form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .feedback-admin-layout { grid-template-columns: 1fr; }
  .feedback-admin-list { max-height: 360px; }
  .announcement-form { max-width: none; }
  .grade-group-list { gap: 13px; }
}

@media (max-width: 640px) {
  #adminNav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-frame { padding-bottom: 48px; }
  .assessment-category-filter { grid-template-columns: 1fr; gap: 7px; margin: 16px 0 20px; }
  .assessment-category-filter > span { padding-left: 2px; }
  .assessment-category-filter > div { margin: 0 -14px; padding: 2px 14px 7px; }
  .assessment-category-filter button { min-height: 36px; padding: 7px 12px; font-size: 12px; }
  .test-bank-arrange-button { width: 100%; }
  .site-compliance {
    right: 50%;
    bottom: max(8px, env(safe-area-inset-bottom));
    transform: translateX(50%);
    max-width: calc(100vw - 24px);
    white-space: nowrap;
  }
  .topbar { min-height: 64px; padding-right: 14px; padding-left: 14px; }
  .brand { max-width: calc(100vw - 72px); gap: 8px; font-size: 14px; line-height: 1.25; }
  .brand-name { display: block; max-width: 190px; }
  .brand-mark { width: 34px; height: 34px; font-size: 15px; }
  .avatar-button { width: 38px; height: 38px; }
  .install-button { display: none !important; }
  .account-menu { right: -1px; width: min(220px,calc(100vw - 28px)); }
  .auth-view { min-height: calc(100vh - 65px); padding: 16px 12px 28px; }
  .auth-panel { min-height: auto; }
  .auth-copy { min-height: 260px; justify-content: flex-start; padding: 72px 25px 30px; }
  .auth-copy h1 { max-width: none; margin: 12px 0 16px; }
  .auth-brand-title { gap: 8px; }
  .auth-brand-primary { font-size: 37px; }
  .auth-brand-secondary { gap: 10px; font-size: 27px; }
  .auth-brand-rule { width: 26px; }
  .auth-copy > p:last-of-type { font-size: 14px; }
  .auth-orbit { top: 22px; left: 24px; }
  .auth-form { padding: 32px 23px 36px; }
  .dashboard { padding: 24px 15px 80px; }
  .workspace-nav { display: grid; width: 100%; margin-bottom: 34px; }
  .workspace-nav-button { min-width: 0; }
  .dashboard-head { align-items: flex-start; margin-bottom: 25px; }
  .dashboard-head h1 { font-size: 34px; }
  .dashboard-head:not(.account-dashboard-head) { flex-direction: column; }
  .upload-open { width: 100%; min-width: 0; }
  .account-dashboard-head { flex-direction: column; }
  .head-actions { width: 100%; }
  .head-actions .button { flex: 1; padding: 0 12px; }
  .summary-strip { margin-bottom: 18px; }
  .summary-strip > div { padding: 0 12px; }
  .summary-strip > div:first-child { padding-left: 0; }
  .summary-strip strong { font-size: 20px; }
  .toolbar, body[data-role="user"] .toolbar, .account-toolbar { grid-template-columns: 1fr; }
  .student-schedule-hero { align-items: flex-start; flex-direction: column; padding: 22px; }
  .feedback-hero { align-items: flex-start; padding: 22px; }
  .latest-score { min-width: 92px; padding: 12px; }
  .score-trend-card { padding: 19px 14px 12px; }
  .score-chart { height: 190px; }
  .student-feedback-card { padding: 18px 16px; }
  .student-feedback-images { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .schedule-range { text-align: left; }
  .student-schedule-day { grid-template-columns: 1fr; gap: 12px; }
  .student-schedule-day-head { flex-direction: row; align-items: baseline; justify-content: space-between; }
  .student-course-card { grid-template-columns: 66px minmax(0,1fr); }
  .schedule-type-chip { grid-column: 2; justify-self: start; }
  .grade-filter-row { grid-template-columns: 1fr; gap: 7px; }
  .segmented-control { width: 100%; }
  .grade-control { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .grade-filter-button { min-width: 0; padding-right: 7px; padding-left: 7px; white-space: normal; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 244px; }
  .tool-card-actions { grid-template-columns: 1fr 1fr; }
  .tool-card-actions .open-tool { grid-column: 1 / -1; }
  .tool-card-actions.user-actions .open-tool { grid-column: auto; }
  .account-row { grid-template-columns: 1fr auto; gap: 12px; padding: 17px 16px; }
  .account-usage-summary { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .account-login { grid-column: 1 / -1; padding-left: 54px; }
  .account-note { white-space: normal; }
  .account-actions { grid-column: 1 / -1; flex-wrap: wrap; padding: 11px 0 0 54px; border-top: 1px solid var(--line); }
  .account-status { display: inline-flex; }
  .two-column-fields, .grade-group-list { grid-template-columns: 1fr; gap: 0; }
  .schedule-modal-card { padding: 22px 18px; }
  .schedule-form-grid { grid-template-columns: 1fr; }
  .schedule-weekday-options { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .schedule-course-name-field, .schedule-note-field { grid-column: auto; }
  .schedule-editor-item { grid-template-columns: 1fr auto; }
  .schedule-editor-content { grid-column: 1 / -1; grid-row: 2; }
  .schedule-preview-card .student-schedule-list { max-height: none; overflow: visible; }
  .feedback-modal-card { padding: 22px 16px; }
  .feedback-form { padding: 15px; }
  .feedback-fields { grid-template-columns: 1fr 1fr; }
  .feedback-title-field { grid-column: 1 / -1; grid-row: 1; }
  .feedback-model-filters { grid-template-columns: 1fr; }
  .feedback-model-filters p { min-width: 0; margin: 0; }
  .feedback-task-row { grid-template-columns: minmax(0,1fr) auto; }
  .feedback-task-row select { grid-column: 1 / -1; grid-row: 2; }
  .feedback-task-row .feedback-task-remove { grid-column: 2; grid-row: 1; }
  .grade-checkbox-group { padding: 11px 0; border-bottom: 1px solid var(--line); }
  .grade-checkbox-group:last-child { border-bottom: 0; }
  .grade-checkbox-group legend { border-bottom: 0; }
  .grade-checkbox-options { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .modal { width: calc(100% - 20px); max-height: calc(100dvh - 20px); }
  .modal-card { padding: 24px 19px; }
  .modal-head h2 { font-size: 23px; }
  .usage-summary { grid-template-columns: 1fr 1fr; }
  .usage-summary > div:last-child { grid-column: 1 / -1; min-height: 74px; }
  .modal-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .modal-actions .button { min-width: 0; padding-right: 10px; padding-left: 10px; white-space: normal; }
  .schedule-modal-actions .button:first-child { grid-column: 1 / -1; }
  .credentials-actions { grid-template-columns: 1fr 1fr; }
  .credentials-actions .button:last-child { grid-column: 1 / -1; margin-left: 0; }
  .credential-row { grid-template-columns: 1fr; gap: 9px; }
  .status-control { align-items: flex-start; flex-direction: column; }
  .status-control .button { width: 100%; }
  .announcement-actions { align-items: stretch; flex-direction: column; }
  .announcement-actions .button { width: 100%; }
  .announcement-dialog-body { max-height: 52dvh; }
}

@media (max-width: 390px) {
  .brand-name { max-width: 145px; font-size: 13px; }
  .auth-brand-primary { font-size: 34px; }
  .auth-brand-secondary { gap: 8px; font-size: 24px; }
  .auth-brand-rule { width: 22px; }
  .account-actions { gap: 11px; padding-left: 0; }
  .tool-chips { flex-direction: column; align-items: flex-end; }
  .grade-checkbox-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .feedback-hero { flex-direction: column; }
  .latest-score { width: 100%; }
  .student-feedback-head { flex-direction: column; }
  .student-feedback-score { align-self: flex-start; }
  .student-feedback-task { grid-template-columns: 22px minmax(0,1fr); }
  .student-feedback-task a { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
/* Learning assessment center */
.test-center-panel,
.test-catalog-dialog,
.test-taking-dialog,
.test-result-dialog,
.test-records-dialog,
.test-import-dialog {
  --test-ink: #17302a;
  --test-green: #2f735d;
  --test-mint: #eaf3ef;
  --test-line: #dce7e2;
  max-width: 1260px;
  margin: 0 auto;
}

.test-center-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 8px 2px 30px;
  border-bottom: 1px solid var(--test-line);
}

.test-center-hero h1 {
  margin: 5px 0 8px;
  color: var(--test-ink);
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  letter-spacing: -.065em;
  line-height: .98;
}

.test-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 26px 0;
  overflow: hidden;
  border: 1px solid var(--test-line);
  border-radius: 18px;
  background: #fff;
}

.test-summary-strip > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 24px;
  border-right: 1px solid var(--test-line);
}

.test-summary-strip > div:last-child { border-right: 0; }
.test-summary-strip strong { color: var(--test-ink); font-size: 1.6rem; }
.test-summary-strip span { color: #72817c; font-size: .86rem; }

.test-center-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 25px 0;
}

.test-center-toolbar .search-field { flex: 1; max-width: 560px; }

.test-view-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: #e9efec;
}

.test-view-switch button {
  min-width: 92px;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  color: #60706b;
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.test-view-switch button.is-active {
  color: var(--test-ink);
  background: #fff;
  box-shadow: 0 3px 12px rgba(23, 48, 42, .08);
}

.test-bank-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 26px;
}

.test-bank-card {
  display: flex;
  min-height: 310px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--test-line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(35, 61, 54, .055);
}
.test-bank-grid.is-arranging .test-bank-card { cursor: grab; border-color: #9eb8ae; box-shadow: 0 14px 34px rgba(35, 61, 54, .1); }
.test-bank-grid.is-arranging .test-bank-card:active { cursor: grabbing; }
.test-bank-grid.is-arranging .test-bank-card.is-dragging { opacity: .45; transform: scale(.98); }
.test-bank-grid.is-arranging .test-bank-card-actions { opacity: .4; pointer-events: none; }
.test-bank-arrange-bar {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  color: #536b62;
  border-bottom: 1px solid #d6e3dd;
  background: #edf5f1;
  font-size: .75rem;
}
.test-bank-drag-handle { color: var(--test-green); font-size: 1.35rem; line-height: 1; }
.test-bank-arrange-bar > span:nth-child(3) { color: #7a8b84; }
.test-bank-arrange-bar > div { display: flex; gap: 5px; }
.test-bank-arrange-bar button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid #c5d6cf;
  border-radius: 8px;
  color: var(--test-ink);
  background: #fff;
  cursor: pointer;
}
.test-bank-arrange-bar button:disabled { opacity: .35; cursor: default; }

.test-bank-card-top,
.test-bank-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 20px;
}

.test-bank-card-body { flex: 1; padding: 18px 20px 24px; }
.test-bank-card-body p { margin: 0 0 6px; color: #788781; font-size: .88rem; }
.test-bank-card-body h2 { margin: 0; color: var(--test-ink); font-size: 1.55rem; line-height: 1.2; }
.test-bank-card-actions { border-top: 1px solid #edf2ef; background: #fbfcfb; }

.test-subject-chip,
.test-bank-status {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 800;
}

.test-subject-chip { color: #255c4b; background: #e8f2ed; }
.test-bank-status { color: #7a6d55; background: #f3efe6; }
.test-bank-status.is-published { color: #22624d; background: #e3f2eb; }
.test-bank-status.is-archived { color: #747a78; background: #edf0ef; }

.test-bank-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 28px;
}

.test-bank-stats span {
  padding: 11px 12px;
  border-radius: 11px;
  color: #6c7b76;
  background: #f5f8f6;
  font-size: .8rem;
}

.test-bank-stats strong { color: var(--test-ink); font-size: 1rem; }
.test-empty-mark { display: grid; width: 54px; height: 54px; margin: 0 auto 14px; place-items: center; border-radius: 18px; color: #fff; background: var(--test-ink); font-size: 1.35rem; font-weight: 900; }

.test-history-section { margin-top: 28px; }
.test-history-list { display: grid; gap: 10px; }
.test-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 20px;
  padding: 17px 19px;
  border: 1px solid var(--test-line);
  border-radius: 14px;
  color: var(--test-ink);
  text-align: left;
  background: #fff;
  cursor: pointer;
}
.test-history-item span:first-child { display: flex; flex-direction: column; gap: 5px; }
.test-history-item small { color: #7a8984; font-weight: 500; }
.test-history-item > span:last-child { color: var(--test-green); font-weight: 800; white-space: nowrap; }

.test-catalog-dialog,
.test-taking-dialog {
  width: min(96vw, 1440px);
  height: min(92vh, 960px);
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background: #f7faf8;
  box-shadow: 0 35px 100px rgba(10, 28, 23, .28);
}

.test-taking-dialog {
  overflow: clip;
  overscroll-behavior: none;
}

.test-catalog-shell,
.test-taking-shell { display: flex; height: 100%; flex-direction: column; }

.test-catalog-header,
.test-taking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  gap: 20px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--test-line);
  background: #fff;
}

.test-catalog-header h2,
.test-taking-header h2 { margin: 3px 0 2px; color: var(--test-ink); font-size: 1.45rem; }
.test-catalog-header p,
.test-taking-header p { margin: 0; color: #71807b; }

.test-catalog-layout { display: block; min-height: 0; flex: 1; overflow: auto; background: #f1f6f3; }
.test-catalog-sidebar { width: min(100%, 980px); min-height: 100%; margin: 0 auto; overflow: visible; padding: clamp(20px, 4vw, 44px); background: #f1f6f3; }
.test-catalog-main { display: none; min-width: 0; min-height: 100%; padding: clamp(24px, 5vw, 68px); place-items: center; background: #fff; }
.test-catalog-layout.is-previewing { background: #fff; }
.test-catalog-layout.is-previewing .test-catalog-sidebar { display: none; }
.test-catalog-layout.is-previewing .test-catalog-main { display: grid; }
.test-catalog-path { margin-bottom: 17px; color: #75847f; font-size: .78rem; line-height: 1.6; }
.test-catalog-student-review { margin: 0 0 14px; padding: 12px; border: 1px solid #cddbd6; border-radius: 13px; background: #fff; box-shadow: 0 8px 24px rgba(20, 55, 45, .06); }
.test-catalog-student-review label { display: grid; gap: 7px; }
.test-catalog-student-review label span { color: #294f44; font-size: .78rem; font-weight: 800; }
.test-catalog-student-review select { width: 100%; min-height: 40px; padding: 8px 34px 8px 10px; border: 1px solid #c6d4cf; border-radius: 9px; color: #173f34; background: #f7faf9; font: inherit; }
.test-catalog-student-review small { display: block; margin-top: 8px; color: #71817c; font-size: .7rem; line-height: 1.5; }
.test-catalog-tree { display: grid; gap: 8px; }
.test-tree-group { border: 1px solid #dbe6e1; border-radius: 13px; background: rgba(255, 255, 255, .72); }
.test-tree-group summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; color: var(--test-ink); font-weight: 800; cursor: pointer; }
.test-tree-group summary small { color: #82918c; font-size: .72rem; font-weight: 600; }
.test-tree-group > div { display: grid; gap: 7px; padding: 0 8px 8px 18px; }
.test-tree-test { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 10px; padding: 11px 12px; border: 0; border-radius: 10px; color: #325d50; text-align: left; background: #eaf3ef; cursor: pointer; }
.test-tree-test small { color: #5f7e73; white-space: nowrap; }
.test-tree-kp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 4px; border: 1px solid #dbe6e1; border-radius: 12px; background: rgba(255, 255, 255, .86); }
.test-tree-kp-row .test-tree-test { min-width: 0; background: transparent; }
.test-tree-kp-record { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-right: 7px; white-space: nowrap; }
.test-kp-score { color: #62746e; font-size: .76rem; }
.test-kp-score strong { color: #173f34; font-size: .82rem; }
.test-kp-score.is-empty { color: #9aa7a3; }
.test-kp-score.is-perfect { padding: 5px 9px; border-radius: 999px; color: #2c6b58; background: #e6f4ec; font-weight: 800; }
.test-kp-wrong { padding: 6px 9px; border: 1px solid #bfcfc9; border-radius: 8px; color: #315f52; background: #fff; font-size: .75rem; font-weight: 800; cursor: pointer; }
.test-kp-wrong:hover { border-color: #315f52; background: #f3f8f6; }
.test-tree-empty { padding: 18px; border: 1px dashed #bccdc6; border-radius: 13px; color: #71817b; text-align: center; }

.test-catalog-welcome { display: none; }

.test-set-overview { width: min(100%, 680px); padding: clamp(26px, 5vw, 54px); border: 1px solid var(--test-line); border-radius: 24px; background: #f9fbfa; }
.test-preview-back { margin: 0 0 24px; padding: 0; border: 0; color: var(--test-green); background: transparent; font-size: .86rem; font-weight: 800; cursor: pointer; }
.test-set-overview h2 { margin: 8px 0 12px; color: var(--test-ink); font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -.045em; }
.test-set-overview > p:not(.eyebrow) { color: #667771; line-height: 1.75; }
.test-set-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 28px 0; }
.test-set-facts span { display: flex; flex-direction: column; gap: 4px; padding: 15px; border-radius: 14px; color: #74837e; background: #edf3f0; font-size: .78rem; }
.test-set-facts strong { color: var(--test-ink); font-size: 1.35rem; }
.test-set-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.test-taking-actions { display: flex; align-items: center; gap: 12px; }
.test-taking-actions > span { color: #71817b; font-size: .82rem; }
.test-taking-progress { display: flex; align-items: center; flex: none; gap: 18px; padding: 10px 28px; border-bottom: 1px solid var(--test-line); background: #f5f8f6; }
.test-taking-progress > div:first-child { display: flex; align-items: baseline; gap: 4px; color: var(--test-ink); }
.test-taking-progress small { margin-left: 5px; color: #7b8984; }
.test-progress-track { height: 5px; flex: 1; overflow: hidden; border-radius: 999px; background: #dfe9e4; }
.test-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--test-green); transition: width .2s ease; }
.test-taking-layout { display: grid; min-height: 0; flex: 1; grid-template-columns: 190px minmax(0, 1fr); }
.test-question-nav { display: grid; align-content: start; gap: 7px; overflow: auto; padding: 18px; border-right: 1px solid var(--test-line); background: #f1f5f3; }
.test-question-nav button { display: flex; align-items: center; gap: 9px; padding: 9px; border: 0; border-radius: 10px; color: #687872; text-align: left; background: transparent; cursor: pointer; }
.test-question-nav button strong { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid #b8c9c2; border-radius: 50%; color: var(--test-ink); background: #fff; font-size: .78rem; }
.test-question-nav button.is-answered strong { border-color: var(--test-green); color: #fff; background: var(--test-green); }
.test-question-nav button.is-uncertain strong { border-color: #c4862e; color: #8a5917; background: #fff3dd; box-shadow: 0 0 0 2px rgba(196, 134, 46, .14); }
.test-question-nav button.is-answered.is-uncertain strong { color: #fff; background: linear-gradient(135deg, var(--test-green) 0 70%, #d59a42 70% 100%); }
.test-question-nav button.is-active { color: var(--test-ink); background: #dfeae5; }
.test-question-nav button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-paper-scroll { overflow: auto; background: #e8eeeb; }
.test-paper { width: min(100% - 30px, 920px); min-height: 100%; margin: 0 auto; padding: clamp(24px, 4vw, 52px); background: #fff; }

.test-question { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 16px; padding: 25px 0 30px; border-bottom: 1px solid #e4ebe8; scroll-margin-top: 16px; }
.test-question:first-child { padding-top: 0; }
.test-question-number { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: #fff; background: var(--test-ink); font-size: .84rem; font-weight: 900; }
.test-question-body { min-width: 0; color: #1d2925; font-size: 1rem; line-height: 1.75; }
.test-question-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: #82908b; font-size: .72rem; }
.test-question-meta > div { display: flex; align-items: center; gap: 12px; }
.test-question-meta strong { color: #5f716a; }
.test-uncertain-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid #d7dfdb;
  border-radius: 999px;
  color: #6f7d78;
  background: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.test-uncertain-button > span:first-child {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #96a39e;
  font-size: 11px;
}
.test-uncertain-button.is-active { border-color: #d8a45a; color: #815217; background: #fff5e4; }
.test-uncertain-button.is-active > span:first-child { background: #c4862e; }
.test-question.is-uncertain { box-shadow: inset 3px 0 0 #d8a45a; }
.test-rich-text { overflow-wrap: anywhere; }
.test-math { max-width: 100%; margin: 10px 0; overflow-x: auto; overflow-y: hidden; }
.test-math .katex-display { margin: .35em 0; text-align: left; }
.test-content-divider { border: 0; border-top: 1px solid #dfe7e3; }
.test-render-warning { display: inline-block; padding: 6px 9px; border-radius: 8px; color: #8b6746; background: #f8efe4; font-size: .8rem; }
.test-figure { margin: 16px 0; }
.test-figure.align-center { text-align: center; }
.test-figure.align-right { text-align: right; }
.test-figure img { max-width: 100%; height: auto; border-radius: 7px; object-fit: contain; }
.test-figure figcaption { margin-top: 6px; color: #80908a; font-size: .76rem; }

.test-options { display: grid; gap: 9px; margin-top: 16px; }
.test-option { position: relative; display: grid; grid-template-columns: 16px 22px minmax(0, 1fr); align-items: start; gap: 10px; padding: 11px 13px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.test-option:hover { border-color: #bed2ca; background: #f7faf8; }
.test-option.is-selected { border-color: #78a997; background: #edf6f2; }
.test-option-input { position: absolute; top: 12px; left: 12px; width: 14px; height: 14px; margin: 0; opacity: 0; pointer-events: none; }
.test-option-dot { width: 13px; height: 13px; margin-top: 7px; border: 1.5px solid #9db0a8; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 3px #fff; }
.test-option.is-selected .test-option-dot { border-color: var(--test-green); background: var(--test-green); }
.test-option:focus-within { outline: 2px solid rgba(47, 115, 93, .2); outline-offset: 2px; }
.test-option > strong { padding-top: 0; color: #35453f; }
.test-option .test-rich-text { line-height: 1.65; }
.test-option .test-figure { margin: 2px 0 7px; }

.test-inline-blank { width: min(180px, 42vw); min-width: 86px; margin: 0 5px; padding: 2px 6px 3px; border: 0; border-bottom: 1.5px solid #596a64; border-radius: 0; color: var(--test-ink); font: inherit; text-align: center; background: transparent; outline: 0; }
.test-inline-blank:hover { border-bottom-color: var(--test-green); background: #f4f8f6; }
.test-inline-blank:focus { border-bottom-width: 2px; border-bottom-color: var(--test-green); background: #edf6f2; }
.test-blank-list { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; }
.test-blank-list label { display: flex; align-items: center; gap: 7px; color: #71807b; font-size: .78rem; }

.test-result-dialog {
  width: min(calc(100% - 32px), 1040px);
  max-height: min(92vh, 920px);
  overflow: hidden;
}
.test-result-card {
  display: grid;
  width: 100%;
  max-height: min(92vh, 920px);
  padding: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.test-result-card > .modal-head { margin: 0; padding: 26px 30px 20px; border-bottom: 1px solid var(--test-line); }
.test-result-card > .modal-actions { padding: 16px 30px; border-top: 1px solid var(--test-line); background: #fbfcfb; }
#testResultContent { min-width: 0; overflow: auto; padding: 24px 30px 30px; }
.test-score-hero { padding: 22px 20px 27px; border-radius: 18px; color: #fff; text-align: center; background: var(--test-ink); }
.test-score-hero > span { display: block; color: #bad2c9; font-size: .78rem; letter-spacing: .08em; }
.test-score-hero strong { display: block; margin: 7px 0; font-size: 3.2rem; line-height: 1; }
.test-score-hero strong small { margin-left: 5px; color: #abc5bb; font-size: 1rem; }
.test-score-hero p { margin: 0; color: #dce9e4; }
.test-result-wrong { margin-top: 24px; }
.test-result-wrong h3 { color: var(--test-ink); }
.test-result-wrong article { min-width: 0; margin-top: 12px; padding: 18px; overflow: hidden; border: 1px solid var(--test-line); border-radius: 14px; background: #fbfcfb; }
.test-result-question-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid #e5ece8; }
.test-result-question-heading strong { color: var(--test-ink); font-size: 1rem; }
.test-result-question-heading span { color: #72817c; font-size: .76rem; }
.test-result-question-content {
  min-width: 0;
  margin-top: 12px;
  padding: 14px;
  color: var(--test-ink);
  background: #fff;
  border: 1px solid #e3ebe7;
  border-radius: 11px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.test-result-question-content .test-rich-text { margin: 0; }
.test-result-question-content .test-math { margin: 8px 0; }
.test-result-question-content .test-figure { margin: 12px 0; }
.test-result-question-content .test-figure img { max-height: 340px; object-fit: contain; }
.test-result-options { display: grid; gap: 7px; margin: 12px 0 0; padding: 0; list-style: none; }
.test-result-options li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; align-items: start; }
.test-result-options li > strong { color: #36594f; }
.test-result-options li .test-rich-text { margin: 0; }
.test-result-answer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.test-result-answer-grid p { display: grid; min-width: 0; gap: 5px; margin: 0; padding: 12px 14px; border-radius: 10px; color: #61716b; background: #f0f5f2; }
.test-result-answer-grid p > span,.test-review-suggestion > span { color: #788781; font-size: .72rem; font-weight: 700; }
.test-result-answer-grid strong { min-width: 0; overflow-wrap: anywhere; color: var(--test-ink); font-weight: 700; }
.test-result-answer-grid .katex { max-width: 100%; }
.test-result-wrong .test-diagnosis { padding: 10px 12px; border-radius: 9px; color: #325c4f; background: #eaf3ef; }
.test-answer-analysis { display: grid; gap: 7px; margin-top: 10px; padding: 12px; border-radius: 10px; color: #485b54; background: #f4f7f5; line-height: 1.65; }
.test-answer-analysis > span { color: #788781; font-size: .72rem; font-weight: 800; }
.test-answer-analysis .test-rich-text,.test-answer-analysis .test-math { margin: 0; }
.test-result-wrong .test-diagnosis .katex,
.test-review-suggestion .katex { font-size: 1em; }
.test-result-wrong .katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.test-review-suggestion { display: grid; gap: 4px; margin: 10px 0 0; color: #53645e; line-height: 1.6; overflow-wrap: anywhere; }
.test-perfect-result { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 34px; color: #6d7d77; }
.test-perfect-result strong { color: var(--test-green); font-size: 1.4rem; }

.test-records-list { display: grid; gap: 9px; }
.test-record-row { display: grid; width: 100%; grid-template-columns: 1.5fr .8fr .8fr auto; align-items: center; gap: 18px; padding: 15px 17px; border: 1px solid var(--test-line); border-radius: 13px; color: inherit; text-align: left; background: #fff; font: inherit; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.test-record-row:hover { border-color: #9fbaaf; background: #f7faf8; transform: translateY(-1px); }
.test-record-row > div { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.test-record-row strong { overflow: hidden; color: var(--test-ink); text-overflow: ellipsis; white-space: nowrap; }
.test-record-row span { color: #7c8a85; font-size: .78rem; }
.test-record-open { color: var(--test-green) !important; font-weight: 800; white-space: nowrap; }
.test-score-hero.is-progress { background: #31574d; }
.test-attempt-progress-detail { display: grid; gap: 12px; margin-top: 22px; }
.test-attempt-progress-detail > article { padding: 20px; border: 1px solid var(--test-line); border-radius: 14px; }
.test-result-answer-grid.single { grid-template-columns: 1fr; }

.test-editor-dialog {
  width: min(96vw, 1380px);
  height: min(92vh, 940px);
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background: #f7faf8;
  box-shadow: 0 35px 100px rgba(10, 28, 23, .28);
}
.test-editor-shell { display: flex; height: 100%; flex-direction: column; }
.test-editor-header { display: flex; align-items: center; justify-content: space-between; flex: none; gap: 18px; padding: 20px 26px; border-bottom: 1px solid var(--test-line); background: #fff; }
.test-editor-header h2 { margin: 3px 0; color: var(--test-ink); }
.test-editor-header p { margin: 0; color: #71807b; }
.test-editor-header-actions { display: flex; align-items: center; gap: 13px; color: #71817b; font-size: .82rem; }
.test-editor-layout { display: grid; min-height: 0; flex: 1; grid-template-columns: 210px minmax(0, 1fr); }
.test-editor-nav { display: grid; align-content: start; gap: 7px; overflow: auto; padding: 16px; border-right: 1px solid var(--test-line); background: #edf3f0; }
.test-editor-nav button { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 9px; width: 100%; padding: 9px; border: 0; border-radius: 10px; color: #65756f; text-align: left; background: transparent; cursor: pointer; }
.test-editor-nav button:hover,.test-editor-nav button.is-active { color: var(--test-ink); background: #fff; box-shadow: 0 5px 18px rgba(28, 58, 48, .07); }
.test-editor-nav button strong { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: #fff; background: var(--test-ink); font-size: .76rem; }
.test-editor-nav button small { color: #3d7a65; font-size: .68rem; }
.test-editor-form { overflow: auto; padding: clamp(20px, 4vw, 42px); background: #fff; }
.test-editor-question-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--test-line); }
.test-editor-question-heading > div { display: flex; flex-direction: column; gap: 4px; }
.test-editor-question-heading span { color: #74837e; font-size: .8rem; }
.test-editor-question-heading strong { color: var(--test-ink); overflow-wrap: anywhere; }
.test-editor-field-grid { display: grid; grid-template-columns: 1fr 180px; gap: 14px; }
.test-editor-section-heading { display: flex; align-items: center; justify-content: space-between; margin: 25px 0 11px; }
.test-editor-section-heading > div { display: flex; flex-direction: column; gap: 3px; }
.test-editor-section-heading strong { color: var(--test-ink); }
.test-editor-section-heading span { color: #7a8984; font-size: .76rem; }
.test-editor-options { display: grid; gap: 9px; }
.test-editor-option { display: grid; grid-template-columns: 34px 1fr; align-items: start; gap: 10px; }
.test-editor-option strong { display: grid; width: 32px; height: 32px; margin-top: 6px; place-items: center; border-radius: 50%; color: #fff; background: var(--test-ink); }
.test-editor-option textarea { width: 100%; min-height: 62px; padding: 10px 12px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.test-editor-answer-choices { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; border: 0; }
.test-editor-answer-choices legend { width: 100%; margin-bottom: 5px; color: #72817c; font-size: .78rem; }
.test-editor-answer-choices label { display: flex; align-items: center; gap: 7px; padding: 9px 14px; border: 1px solid var(--test-line); border-radius: 10px; cursor: pointer; }
.test-editor-images { display: grid; gap: 14px; }
.test-editor-image-card { display: grid; grid-template-columns: minmax(220px, 42%) 1fr; gap: 18px; padding: 14px; border: 1px solid var(--test-line); border-radius: 16px; background: #f8fbf9; }
.test-editor-image-preview { display: grid; min-height: 180px; padding: 10px; place-items: center; border-radius: 12px; background: #fff; }
.test-editor-image-preview img { max-width: 100%; max-height: 290px; object-fit: contain; }
.test-editor-image-controls { display: grid; align-content: center; gap: 14px; }
.test-editor-image-controls > label:not(.button) { display: grid; gap: 7px; color: #687872; font-size: .8rem; }
.test-editor-image-controls input[type="range"] { width: 100%; accent-color: var(--test-green); }
.test-image-replace { position: relative; justify-self: start; overflow: hidden; cursor: pointer; }
.test-image-replace input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.test-editor-no-images { padding: 20px; border: 1px dashed #bfd0c8; border-radius: 13px; color: #74847e; text-align: center; }
.test-editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--test-line); }
.test-editor-footer > div { display: flex; gap: 8px; }

@media (max-width: 980px) {
  .test-bank-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .test-catalog-layout { grid-template-columns: 300px 1fr; }
  .test-taking-layout { grid-template-columns: 74px minmax(0, 1fr); }
  .test-question-nav { padding: 12px; }
  .test-question-nav button { justify-content: center; padding: 6px; }
  .test-question-nav button span { display: none; }
}

@media (max-width: 720px) {
  .test-center-hero { align-items: stretch; flex-direction: column; padding-bottom: 22px; }
  .test-summary-strip { grid-template-columns: repeat(2, 1fr); }
  .test-summary-strip > div:nth-child(2) { border-right: 0; }
  .test-summary-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--test-line); }
  .test-bank-grid { grid-template-columns: 1fr; }
  .test-center-toolbar { align-items: stretch; flex-direction: column; }
  .test-center-toolbar .search-field { max-width: none; }
  .test-view-switch { width: 100%; }
  .test-view-switch button { flex: 1; }
  .test-catalog-dialog,
  .test-taking-dialog { width: 100vw; height: 100dvh; border-radius: 0; }
  .test-catalog-header,
  .test-taking-header { align-items: flex-start; padding: 16px; }
  .test-taking-header { flex-direction: column; }
  .test-taking-actions { width: 100%; justify-content: space-between; }
  .test-taking-actions > span { max-width: 110px; }
  .test-catalog-layout { display: block; overflow-y: auto; }
  .test-catalog-sidebar { width: 100%; min-height: 100%; padding: 16px 14px 30px; }
  .test-catalog-main { min-height: 100%; padding: 18px 14px 32px; }
  .test-catalog-layout.is-previewing .test-catalog-main { display: block; }
  .test-catalog-path { margin: 0 3px 13px; }
  .test-tree-group summary { padding: 12px; }
  .test-tree-group > div { padding: 0 6px 7px 12px; }
  .test-tree-test { padding: 11px 10px; }
  .test-tree-kp-row { grid-template-columns: 1fr; gap: 0; }
  .test-tree-kp-record { justify-content: flex-start; padding: 0 10px 9px; }
  .test-set-overview { padding: 22px 18px; border-radius: 18px; }
  .test-set-overview h2 { font-size: 1.75rem; }
  .test-preview-back { margin-bottom: 20px; }
  .test-taking-progress { padding: 9px 16px; }
  .test-taking-layout { display: flex; flex-direction: column; }
  .test-question-nav { display: flex; flex: none; gap: 6px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--test-line); }
  .test-question-nav button { flex: none; }
  .test-paper-scroll { flex: 1; }
  .test-paper { width: 100%; padding: 22px 15px 52px; }
  .test-question { grid-template-columns: 31px minmax(0, 1fr); gap: 10px; padding: 22px 0; }
  .test-question-number { width: 27px; height: 27px; }
  .test-option { grid-template-columns: 15px 20px minmax(0, 1fr); gap: 8px; padding: 10px 8px; }
  .test-set-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 20px 0; }
  .test-set-facts span { padding: 11px 8px; text-align: center; }
  .test-set-facts strong { font-size: 1.18rem; }
  .test-set-actions .button { width: 100%; }
  .test-record-row { grid-template-columns: 1fr; }
  .test-history-item { align-items: flex-start; flex-direction: column; gap: 9px; }
  .test-editor-dialog { width: 100vw; height: 100dvh; border-radius: 0; }
  .test-editor-header { align-items: flex-start; padding: 15px; }
  .test-editor-header-actions > span { display: none; }
  .test-editor-layout { display: flex; overflow: hidden; flex-direction: column; }
  .test-editor-nav { display: flex; flex: none; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--test-line); }
  .test-editor-nav button { width: auto; flex: none; grid-template-columns: 28px auto; }
  .test-editor-nav button small { display: none; }
  .test-editor-form { flex: 1; padding: 19px 15px 34px; }
  .test-editor-question-heading { flex-direction: column; }
  .test-editor-field-grid { grid-template-columns: 1fr 110px; }
  .test-editor-image-card { grid-template-columns: 1fr; }
  .test-editor-footer { align-items: stretch; flex-direction: column; }
  .test-editor-footer > div,.test-editor-footer > button { width: 100%; }
  .test-editor-footer > div .button { flex: 1; }
  .test-result-dialog { width: 100vw; height: 100dvh; max-height: none; margin: 0; border-radius: 0; }
  .test-result-card { height: 100dvh; max-height: none; border: 0; border-radius: 0; }
  .test-result-card > .modal-head { padding: 17px 16px 14px; }
  .test-result-card > .modal-actions { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
  #testResultContent { padding: 16px; }
  .test-score-hero { padding: 18px 14px 20px; }
  .test-score-hero strong { font-size: 2.65rem; }
  .test-result-answer-grid { grid-template-columns: 1fr; }
}

/* Teacher-only VR project library */
.vr-panel { padding-bottom: 42px; }
.vr-hero {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
}
.vr-hero h1 {
  margin: 9px 0 8px;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.08;
}
.vr-guidance {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  padding: 14px 18px;
  color: var(--ink-soft);
  background: #eef5f1;
  border: 1px solid #dce9e2;
  border-radius: 16px;
  font-size: 14px;
}
.vr-guidance strong { flex: 0 0 auto; color: var(--ink); }
.vr-project-grid { display: grid; gap: 16px; }
.vr-project-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 12px 28px rgba(23, 51, 45, .06);
}
.vr-project-mark,
.vr-empty-mark {
  display: grid;
  place-items: center;
  color: #fff;
  background: #153a32;
  border-radius: 24px;
  font-weight: 800;
  letter-spacing: -.03em;
}
.vr-project-mark { width: 92px; height: 92px; font-size: 27px; }
.vr-empty-mark { width: 68px; height: 68px; margin: 0 auto 18px; font-size: 20px; }
.vr-project-content { min-width: 0; }
.vr-project-heading {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}
.vr-project-heading h2 { margin: 4px 0 0; font-size: clamp(21px, 3vw, 28px); }
.vr-version-chip {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: #40655b;
  background: #edf4f1;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.vr-project-description { margin: 12px 0; color: var(--ink-soft); line-height: 1.7; }
.vr-project-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.vr-project-meta span {
  padding: 5px 9px;
  color: #526e66;
  background: #f3f7f5;
  border-radius: 999px;
  font-size: 12px;
}
.vr-project-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.vr-project-actions .button { min-height: 40px; padding: 0 15px; }
.button-danger { color: #a3453d; background: #fff5f3; border-color: #efd8d4; }
.button-danger:hover { background: #fbe8e4; }
.compact-modal-card { max-width: 620px; }

.admin-tool-grade-filter {
  margin: -4px 0 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .76);
}
.admin-tool-grade-filter summary { cursor: pointer; color: var(--ink); font-weight: 700; }
.admin-tool-grade-filter summary span { margin-left: 8px; color: var(--ink-soft); font-size: 12px; font-weight: 500; }
.admin-grade-filter-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.admin-grade-filter-option { display: flex; gap: 7px; align-items: center; padding: 8px 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; }
.admin-grade-filter-option input { accent-color: #17483d; }

.batch-import-results { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.batch-import-results h3 { margin: 2px 0 0; }
.batch-result-item { margin-top: 10px; padding: 14px; border: 1px solid var(--line); border-left: 4px solid #82978f; border-radius: 12px; background: #fff; }
.batch-result-item.is-success { border-left-color: #3d7d68; background: #f5faf7; }
.batch-result-item.is-error { border-left-color: #b6544b; background: #fff8f7; }
.batch-result-heading { display: flex; gap: 12px; justify-content: space-between; }
.batch-result-heading strong { min-width: 0; overflow-wrap: anywhere; }
.batch-result-heading span { flex: 0 0 auto; color: var(--ink-soft); font-size: 12px; }
.batch-result-item p { margin: 7px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.batch-result-item details { margin-top: 9px; color: #5d6e68; font-size: 13px; }
.batch-result-item li { margin-top: 6px; overflow-wrap: anywhere; }
.compact-toggle { margin-top: 14px; }

.standard-tool-details { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; padding: 14px; border: 1px solid #dce8e2; border-radius: 14px; background: #f3f8f5; }
.standard-tool-details > div:not(.standard-tool-actions):not(.tool-release-list) { display: grid; gap: 3px; }
.standard-tool-details span { color: var(--ink-soft); font-size: 12px; }
.standard-tool-details strong { overflow-wrap: anywhere; font-size: 13px; }
.standard-tool-details .tool-runtime-settings { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; padding-top: 12px; border-top: 1px solid #d8e5df; }
.tool-runtime-settings .toggle-field.compact { min-height: 58px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.tool-runtime-settings .field { margin: 0; }
.standard-tool-actions { grid-column: 1 / -1; display: flex; gap: 14px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid #dce8e2; }
.tool-release-list { grid-column: 1 / -1; display: grid; gap: 8px; }
.tool-release-list > div { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 9px 10px; border-radius: 10px; background: #fff; }

@media (max-width: 680px) {
  .vr-hero { align-items: stretch; flex-direction: column; }
  .vr-hero h1 { font-size: 34px; }
  .vr-guidance { align-items: flex-start; flex-direction: column; }
  .vr-project-card { grid-template-columns: 1fr; padding: 19px; }
  .vr-project-mark { width: 64px; height: 64px; border-radius: 18px; font-size: 20px; }
  .vr-project-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .vr-project-actions .button { width: 100%; }
  .admin-grade-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .standard-tool-details { grid-template-columns: 1fr; }
  .standard-tool-details .tool-runtime-settings { grid-template-columns: 1fr; }
  .standard-tool-actions,
  .tool-release-list { grid-column: 1; }
}

/* Paper Builder */
.paper-builder-panel { padding-bottom: 42px; }
.pb-home, .pb-editor { display: grid; gap: 20px; }
.pb-home-head { align-items: end; }
.pb-home-actions, .pb-pane-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.pb-pane-actions > span { color: var(--ink-soft); font-size: 13px; }
.pb-summary, .pb-editor-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.82); }
.pb-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pb-summary > div, .pb-editor-summary > div { display: grid; gap: 4px; min-height: 82px; padding: 18px 20px; border-right: 1px solid var(--line); }
.pb-summary > div:last-child, .pb-editor-summary > div:last-child { border-right: 0; }
.pb-summary strong, .pb-editor-summary strong { color: var(--ink); font-size: 24px; }
.pb-summary span, .pb-editor-summary span { color: var(--ink-soft); font-size: 13px; }
.pb-list-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) 180px auto; gap: 10px; }
.pb-list-toolbar input, .pb-list-toolbar select, .pb-title-wrap input, .pb-filter-grid select, .pb-search input, .pb-item-controls input, .pb-item-controls select, .pb-section-head input { width: 100%; min-height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fff; font: inherit; }
.pb-composition-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.pb-composition-card { display: grid; gap: 20px; min-height: 250px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 10px 30px rgba(20,48,41,.05); }
.pb-composition-card h2, .pb-composition-card p { margin: 0; }
.pb-composition-card p { margin-bottom: 7px; color: var(--ink-soft); font-size: 13px; }
.pb-composition-top, .pb-card-actions, .pb-pane-head, .pb-catalog-head, .pb-section-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.pb-composition-top > span:last-child { color: var(--ink-soft); font-size: 12px; }
.pb-status { padding: 5px 9px; border-radius: 999px; color: #775a20; background: #fff3d9; font-size: 12px; font-weight: 700; }
.pb-status.is-frozen { color: #2c6957; background: #e7f3ee; }
.pb-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pb-card-stats span { padding: 10px; border-radius: 10px; color: var(--ink-soft); background: #f4f7f5; font-size: 12px; }
.pb-card-stats strong { display: block; margin-bottom: 3px; color: var(--ink); font-size: 18px; }
.pb-card-actions { align-self: end; }
.pb-delete-button { min-height: 42px; padding: 0 15px; border: 1px solid #dfc4c0; border-radius: 9px; color: #9d463f; background: #fff; font-weight: 700; cursor: pointer; }
.pb-delete-button:hover { border-color: #c98279; background: #fff6f4; }
.danger-text { color: #aa4f48 !important; }

.pb-editor-head { position: sticky; top: 0; z-index: 12; display: grid; grid-template-columns: auto minmax(220px, 1fr) auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(247,250,248,.96); backdrop-filter: blur(12px); }
.pb-title-wrap { display: grid; gap: 4px; }
.pb-title-wrap input { min-height: 40px; font-size: 18px; font-weight: 750; }
.pb-title-wrap span { padding-left: 4px; color: var(--ink-soft); font-size: 11px; }
.pb-head-actions, .pb-export-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pb-workspace { display: grid; grid-template-columns: minmax(430px, .82fr) minmax(680px, 1.35fr); gap: 18px; align-items: start; }
.pb-bank, .pb-paper { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.9); }
.pb-page-locked { overflow: hidden; }
#paperBuilderPanel.pb-is-fullscreen { position: fixed; inset: 0; z-index: 1000; display: block !important; width: 100vw; height: 100dvh; padding: 14px 18px 24px; overflow: auto; background: #eef3f0; }
#paperBuilderPanel.pb-is-fullscreen #paperBuilderRoot { width: 100%; max-width: none; margin: 0; }
#paperBuilderPanel.pb-is-fullscreen .pb-editor-head { top: 0; }
#paperBuilderPanel.pb-is-fullscreen .pb-workspace { grid-template-columns: minmax(520px, .8fr) minmax(800px, 1.45fr); }
.pb-pane-head { margin-bottom: 15px; }
.pb-pane-head h2, .pb-export h2 { margin: 2px 0 0; }
.pb-pane-head > span { color: var(--ink-soft); font-size: 13px; }
.pb-stage-scopes { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; margin: 0 0 12px; }
.pb-stage-scopes button { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 14px; border: 1px solid #d4e1dc; border-radius: 13px; color: #315047; background: #f6f9f7; font: inherit; font-weight: 750; cursor: pointer; }
.pb-stage-scopes button b { min-width: 30px; padding: 4px 8px; border-radius: 999px; color: var(--ink-soft); background: #e8efec; font-size: 12px; text-align: center; }
.pb-stage-scopes button.is-active { border-color: #173b32; color: #fff; background: #173b32; box-shadow: 0 8px 22px rgba(23,59,50,.15); }
.pb-stage-scopes button.is-active b { color: #173b32; background: #fff; }

.pb-catalog-panel { overflow: hidden; margin-bottom: 12px; border: 1px solid #d9e5e0; border-radius: 14px; background: #f7faf8; }
.pb-catalog-head { padding: 12px 13px; border-bottom: 1px solid #dfe9e4; background: #eef5f1; }
.pb-catalog-head > div { display: grid; gap: 2px; }
.pb-catalog-head span { color: var(--ink-soft); font-size: 11px; }
.pb-catalog-head strong { font-size: 13px; }
.pb-catalog { max-height: 390px; overflow: auto; padding: 10px; scrollbar-width: thin; }
.pb-edition + .pb-edition { margin-top: 10px; }
.pb-edition-button, .pb-section-node > button { display: flex; gap: 10px; align-items: center; justify-content: space-between; width: 100%; border: 0; color: var(--ink); background: transparent; text-align: left; cursor: pointer; }
.pb-edition-button { padding: 10px 11px; border-radius: 10px; background: #173b32; color: #fff; font-weight: 750; }
.pb-book-list { display: grid; gap: 7px; margin-top: 8px; }
.pb-book, .pb-chapter { border: 1px solid #dce6e1; border-radius: 11px; background: #fff; }
.pb-book > summary, .pb-chapter > summary { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 11px; cursor: pointer; list-style: none; font-weight: 700; }
.pb-book > summary::-webkit-details-marker, .pb-chapter > summary::-webkit-details-marker { display: none; }
.pb-book > summary::before, .pb-chapter > summary::before { content: "›"; color: #698078; transition: transform .16s ease; }
.pb-book[open] > summary::before, .pb-chapter[open] > summary::before { transform: rotate(90deg); }
.pb-book.is-active, .pb-chapter.is-active, .pb-section-node.is-active { border-color: #679487; box-shadow: inset 0 0 0 1px #9bc0b5; }
.pb-chapter-list { display: grid; gap: 7px; padding: 0 9px 9px; }
.pb-chapter > summary { padding-left: 9px; font-size: 13px; }
.pb-scope-button { margin: 0 10px 8px; padding: 6px 9px; border: 0; border-radius: 8px; color: #35675a; background: #edf5f1; font-size: 12px; cursor: pointer; }
.pb-section-nav { display: grid; gap: 6px; padding: 0 8px 9px; }
.pb-section-node { padding: 7px; border: 1px solid #e2e9e5; border-radius: 9px; }
.pb-section-node > button { font-size: 12px; }
.pb-knowledge-list { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.pb-knowledge-list button { padding: 5px 7px; border: 1px solid #dce7e2; border-radius: 999px; color: #4e655e; background: #fff; font-size: 11px; cursor: pointer; }
.pb-knowledge-list button.is-active { color: #fff; border-color: #356e5e; background: #356e5e; }
.pb-count { flex: 0 0 auto; color: inherit; opacity: .72; font-size: 10px; font-weight: 600; }
.pb-advanced-filters { margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pb-advanced-filters > summary { cursor: pointer; font-size: 13px; font-weight: 700; }
.pb-advanced-filters > summary span { margin-left: 5px; color: var(--ink-soft); font-size: 11px; font-weight: 400; }
.pb-filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.pb-filter-grid label { display: grid; gap: 5px; color: var(--ink-soft); font-size: 11px; }
.pb-filter-grid select { min-height: 38px; padding: 0 8px; font-size: 12px; }
.pb-search { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 10px; }
.pb-selection-bar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; margin-bottom: 10px; padding: 9px 10px; border: 1px solid #dce7e2; border-radius: 11px; background: rgba(244,248,246,.95); font-size: 12px; }
.pb-selection-bar > span { color: var(--ink-soft); }
.pb-question-list { display: grid; gap: 8px; min-height: 280px; }
.pb-question-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.pb-question-card-content { min-width: 0; font-size: 13px; line-height: 1.65; }
.pb-question-card p { margin: 7px 0 0; overflow: hidden; color: #263b35; font-size: 13px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
.pb-question-context { display: -webkit-box; margin-top: 7px; overflow: hidden; color: #667a73; font-size: 11px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.pb-question-card > div:last-child { display: grid; gap: 5px; }

.pb-import-dialog { width: min(calc(100% - 32px), 620px); overflow: visible; transition: width .18s ease; }
.pb-import-dialog.has-preview { width: min(calc(100% - 32px), 920px); }
.pb-import-card { display: flex; flex-direction: column; gap: 16px; width: 100%; max-height: min(90vh, 880px); padding: 26px; overflow: hidden; }
.pb-import-card > .modal-head { flex: 0 0 auto; margin: 0; }
.pb-import-card > .modal-head h2 { margin: 3px 0 0; font-size: 27px; letter-spacing: -.02em; }
.pb-import-card > .modal-head p { margin: 6px 0 0; color: var(--ink-soft); font-size: 13px; }
.pb-import-dropzone { display: grid; grid-template-columns: 52px minmax(0,1fr) auto; gap: 14px; align-items: center; min-height: 96px; padding: 17px; border: 1px dashed #b9cbc4; border-radius: 16px; background: linear-gradient(135deg,#f7faf8,#eef5f1); cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.pb-import-dropzone:hover, .pb-import-dropzone.is-dragging { border-color: #3b7767; background: #edf6f2; transform: translateY(-1px); }
.pb-import-dropzone.has-file { border-style: solid; border-color: #aac7bc; background: #f3f8f5; }
.pb-import-file-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; color: #fff; background: #173b32; font-size: 12px; font-weight: 800; letter-spacing: .08em; box-shadow: 0 8px 18px rgba(23,59,50,.16); }
.pb-import-file-copy { display: grid; min-width: 0; gap: 5px; }
.pb-import-file-copy strong { overflow: hidden; color: var(--ink); font-size: 15px; white-space: nowrap; text-overflow: ellipsis; }
.pb-import-file-copy small { color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.pb-import-file-button { padding: 8px 12px; border: 1px solid #c7d6d0; border-radius: 10px; color: #315047; background: #fff; font-size: 12px; font-weight: 750; white-space: nowrap; }
.pb-import-actions { margin-top: 0; padding-top: 2px; border-top: 0; }
.pb-import-actions .button { min-width: 104px; }
.pb-import-actions [hidden] { display: none !important; }
.pb-import-preview { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 150px; overflow: hidden; border: 1px solid #d9e3df; border-radius: 16px; background: #f7faf8; box-shadow: 0 10px 26px rgba(23,59,50,.06); }
.pb-import-preview[hidden] { display: none; }
.pb-import-summary { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 15px 17px; border-bottom: 1px solid #dfe7e3; background: #fff; }
.pb-import-summary > div { display: grid; min-width: 0; gap: 3px; }
.pb-import-summary strong { overflow: hidden; font-size: 16px; white-space: nowrap; text-overflow: ellipsis; }
.pb-import-summary span { color: var(--ink-soft); font-size: 12px; }
.pb-import-summary .pb-import-summary-label { color: #4f6f64; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.pb-import-status { padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.pb-import-status.is-ready { color: #28634f; background: #e4f2ec; }
.pb-import-status.is-review { color: #7c5b18; background: #fff2cf; }
.pb-import-status.is-rejected { color: #9a443d; background: #fae8e6; }
.pb-import-selectbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #dfe7e3; color: var(--ink-soft); background: #f3f7f5; font-size: 12px; }
.pb-import-selectbar > label, .pb-import-selectbar > div { display: flex; gap: 8px; align-items: center; }
.pb-import-selectbar input { width: 16px; height: 16px; margin: 0; accent-color: #1e5f4f; }
.pb-import-selectbar button { padding: 4px 8px; border: 0; border-radius: 7px; color: #315047; background: #e5eeea; font: inherit; font-weight: 700; cursor: pointer; }
.pb-import-selectbar button:hover { background: #d9e8e1; }
.pb-import-selectbar strong { min-width: 72px; color: #173b32; text-align: right; }
.pb-import-list { display: grid; flex: 1 1 auto; gap: 7px; min-height: 110px; overflow: auto; padding: 10px; scrollbar-gutter: stable; }
.pb-import-row { display: grid; grid-template-columns: 22px 44px minmax(0,1fr); gap: 11px; align-items: center; min-height: 66px; padding: 10px 12px; border: 1px solid #e0e8e4; border-radius: 12px; background: #fff; cursor: pointer; transition: border-color .14s ease, background .14s ease, transform .14s ease; }
.pb-import-row:hover { border-color: #b9cec5; background: #fbfdfc; transform: translateY(-1px); }
.pb-import-row:has(input:checked) { border-color: #8eb7a8; background: #f2f8f5; }
.pb-import-row.is-context { border-style: dashed; background: #f5f7f6; cursor: default; opacity: .76; }
.pb-import-row.is-invalid { border-color: #ead7d3; background: #fff8f7; cursor: default; opacity: .84; }
.pb-import-check { position: relative; display: grid; place-items: center; width: 19px; height: 19px; }
.pb-import-check input { position: absolute; inset: 0; width: 19px; height: 19px; margin: 0; opacity: 0; cursor: pointer; }
.pb-import-check i { display: block; width: 18px; height: 18px; border: 1.5px solid #9db4ab; border-radius: 6px; background: #fff; }
.pb-import-check input:checked + i { border-color: #1f6855; background: #1f6855; box-shadow: inset 0 0 0 4px #1f6855; }
.pb-import-check input:checked + i::after { content: ""; display: block; width: 7px; height: 4px; margin: 4px 0 0 4px; border-bottom: 2px solid #fff; border-left: 2px solid #fff; transform: rotate(-45deg); }
.pb-import-check input:disabled + i { border-color: #ccd7d2; background: #e8eeeb; }
.pb-import-number { display: grid; place-items: center; min-height: 36px; padding: 0 5px; border-radius: 10px; color: #315047; background: #e8efec; font-size: 12px; font-weight: 800; }
.pb-import-content { display: grid; min-width: 0; gap: 5px; }
.pb-import-row-head { display: flex; gap: 6px; align-items: center; }
.pb-import-row-head b { color: #203a33; font-size: 13px; }
.pb-import-row em { padding: 2px 6px; border-radius: 999px; color: #4a6e63; background: #edf4f1; font-size: 10px; font-style: normal; }
.pb-import-row em.is-error { color: #94483f; background: #f8e8e5; }
.pb-import-row small { overflow: hidden; color: #647b73; font-size: 12px; line-height: 1.55; white-space: nowrap; text-overflow: ellipsis; }
.pb-import-review { display: block; padding: 12px 14px; border-top: 1px solid var(--line); color: #6f551c; font-size: 13px; }
.pb-question-check { padding-top: 2px; }
.pb-question-check input { width: 17px; height: 17px; accent-color: #1e5f4f; }
.pb-question-meta, .pb-item-meta, .pb-preview-meta { display: flex; gap: 5px; flex-wrap: wrap; }
.pb-question-meta span, .pb-item-meta span, .pb-item-meta b, .pb-preview-meta span { padding: 3px 6px; border-radius: 999px; color: #536d64; background: #edf4f1; font-size: 10px; font-weight: 650; }
.pb-pagination { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; }
.pb-pagination button, .pb-section-head button, .pb-item-controls button { min-width: 32px; min-height: 32px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.pb-pagination span { color: var(--ink-soft); font-size: 12px; }

.pb-paper-alert { margin-bottom: 10px; padding: 10px 12px; border-radius: 10px; color: #775a20; background: #fff3d9; font-size: 12px; }
.pb-paper-alert button { margin-left: 8px; border: 0; color: inherit; background: transparent; text-decoration: underline; cursor: pointer; }
.pb-section-list { display: grid; gap: 12px; }
.pb-section { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.pb-section-head { padding: 11px 12px; border-bottom: 1px solid var(--line); background: #f4f8f6; }
.pb-section-number, .pb-paper-number { display: inline-grid; flex: 0 0 auto; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; background: #173b32; font-size: 12px; font-weight: 800; }
.pb-section-title { flex: 1; font-size: 15px; letter-spacing: .01em; }
.pb-fixed-order-note { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.pb-section-head input { min-height: 34px; border: 0; background: transparent; font-weight: 750; }
.pb-section-head > span:nth-of-type(2) { color: var(--ink-soft); font-size: 11px; white-space: nowrap; }
.pb-section-head > div { display: flex; gap: 4px; }
.pb-section-items { display: grid; }
.pb-paper-item { display: grid; grid-template-columns: auto minmax(0,1fr) 176px; gap: 16px; padding: 18px 14px; border-bottom: 1px solid var(--line); }
.pb-paper-item:last-child { border-bottom: 0; }
.pb-paper-question { min-width: 0; font-size: 14px; line-height: 1.75; }
.pb-parent-context { margin: 10px 0 12px; padding: 11px 13px; border-left: 3px solid #7ba294; border-radius: 4px 10px 10px 4px; background: #f1f7f4; color: #304b42; }
.pb-parent-context > span { display: block; margin-bottom: 5px; color: #668078; font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.pb-rich-text { overflow-wrap: anywhere; }
.pb-inline-flow { margin: 5px 0; }
.pb-inline-math { display: inline-block; max-width: 100%; margin: 0 .08em; vertical-align: baseline; }
.pb-math { overflow-x: auto; padding: 4px 0; }
.pb-question-figure { margin: 10px 0; text-align: center; }
.pb-question-image { display: block; max-width: min(100%,620px); max-height: 380px; margin: 0 auto; object-fit: contain; }
.pb-question-image.is-compact { max-width: min(100%,360px); max-height: 210px; }
.pb-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px 16px; margin-top: 12px; }
.pb-option { display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 8px; align-items: start; min-width: 0; padding: 9px 10px; border: 1px solid #e0e7e3; border-radius: 10px; background: #fbfcfb; }
.pb-option > b { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: #315e52; background: #e8f1ed; font-size: 12px; }
.pb-option > div { min-width: 0; }
.pb-options.compact { gap: 7px 12px; }
.pb-options.compact .pb-option { padding: 7px 8px; }
.pb-item-controls { display: grid; gap: 8px; align-content: start; }
.pb-item-controls label { display: grid; gap: 4px; color: var(--ink-soft); font-size: 10px; }
.pb-item-controls input, .pb-item-controls select { min-height: 34px; padding: 0 8px; font-size: 12px; }
.pb-item-controls > div { display: flex; gap: 4px; flex-wrap: wrap; }
.pb-export { display: grid; gap: 16px; margin-top: 14px; padding: 16px; border: 1px solid #cfe0d9; border-radius: 14px; background: #f1f7f4; }
.pb-export p { margin: 6px 0 0; color: var(--ink-soft); font-size: 12px; }
.pb-empty-mark { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 14px; color: #fff; background: #173b32; font-size: 20px; font-weight: 800; }
.pb-inline-error { padding: 12px; border-radius: 10px; color: #a14540; background: #fff4f3; }
.pb-muted { color: var(--ink-soft); }
.pb-mobile-switch { display: none; }
.pb-grade-field { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.pb-grade-field legend { padding: 0 6px; font-weight: 700; }
.pb-grade-field > div { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 6px; }
.pb-grade-field label { color: var(--ink-soft); font-size: 13px; }
.pb-preview-dialog { width: min(calc(100vw - 36px),1120px); max-width: none; max-height: 94dvh; }
.pb-preview-dialog.is-fullscreen { width: calc(100vw - 12px); height: calc(100dvh - 12px); max-height: none; margin: 6px; }
.pb-preview-card { width: 100%; min-height: 460px; max-height: 94dvh; overflow: auto; }
.pb-preview-dialog.is-fullscreen .pb-preview-card { min-height: calc(100dvh - 12px); max-height: none; border-radius: 10px; }
.pb-preview-actions { display: flex; gap: 10px; align-items: center; }
.pb-preview-stem { width: min(100%,960px); margin: 16px auto 0; font-size: 17px; line-height: 1.85; }

@media (max-width: 1080px) {
  .pb-composition-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .pb-workspace { grid-template-columns: minmax(320px, .9fr) minmax(430px, 1.1fr); }
  .pb-paper-item { grid-template-columns: auto minmax(0,1fr); }
  .pb-item-controls { grid-column: 2; grid-template-columns: 90px minmax(120px,1fr); }
  #paperBuilderPanel.pb-is-fullscreen .pb-workspace { grid-template-columns: minmax(400px,.9fr) minmax(520px,1.1fr); }
}

@media (max-width: 760px) {
  .paper-builder-panel { padding-inline: 12px; }
  .pb-home-head { align-items: stretch; flex-direction: column; }
  .pb-home-head .button { width: 100%; }
  .pb-home-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .pb-summary, .pb-editor-summary { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .pb-summary > div:nth-child(2), .pb-editor-summary > div:nth-child(2) { border-right: 0; }
  .pb-list-toolbar, .pb-composition-grid { grid-template-columns: 1fr; }
  .pb-editor-head { position: static; grid-template-columns: 1fr; }
  .pb-head-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .pb-head-actions .button { width: 100%; }
  .pb-mobile-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: #e6eeea; }
  .pb-mobile-switch button { min-height: 42px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; }
  .pb-mobile-switch button.is-active { background: #fff; box-shadow: 0 4px 14px rgba(20,48,41,.08); }
  .pb-workspace { display: block; }
  .pb-workspace[data-mobile-view="bank"] .pb-paper, .pb-workspace:not([data-mobile-view]) .pb-paper { display: none; }
  .pb-workspace[data-mobile-view="paper"] .pb-bank { display: none; }
  .pb-bank, .pb-paper { padding: 13px; border-radius: 14px; }
  .pb-catalog { max-height: 52vh; }
  .pb-filter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .pb-selection-bar { grid-template-columns: 1fr auto; }
  .pb-selection-bar .button { grid-column: 1 / -1; width: 100%; }
  .pb-question-card { grid-template-columns: auto minmax(0,1fr); }
  .pb-question-card > div:last-child { grid-column: 2; display: flex; }
  .pb-import-dialog, .pb-import-dialog.has-preview { width: calc(100% - 20px); }
  .pb-import-card { gap: 14px; padding: 21px 17px; }
  .pb-import-dropzone { grid-template-columns: 44px minmax(0,1fr); min-height: 88px; padding: 14px; }
  .pb-import-file-icon { width: 44px; height: 44px; border-radius: 12px; }
  .pb-import-file-button { display: none; }
  .pb-import-actions { grid-template-columns: 1fr 1fr; }
  .pb-import-actions #pbImportSubmit:not([hidden]) { grid-column: 1 / -1; }
  .pb-import-row { grid-template-columns: auto 34px minmax(0,1fr); }
  .pb-import-row em { display: none; }
  .pb-paper-item { grid-template-columns: auto minmax(0,1fr); padding: 13px 10px; }
  .pb-item-controls { grid-column: 2; grid-template-columns: 1fr; }
  .pb-options { grid-template-columns: 1fr; }
  .pb-preview-actions .button { display: none; }
  .pb-grade-field > div { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* Paper Builder v2.7: A4-first editor and stable full-screen workspace */
.pb-paper { overflow: visible; padding: 16px; background: #edf2ef; }
.pb-paper > .pb-pane-head { position: sticky; top: 0; z-index: 7; margin: -4px -4px 14px; padding: 9px 10px; border: 1px solid rgba(205,218,212,.92); border-radius: 12px; background: rgba(250,252,251,.96); backdrop-filter: blur(10px); }
.pb-paper-view-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.pb-paper-view-actions .text-button { min-height: 34px; padding: 0 11px; border: 1px solid #cbd8d2; border-radius: 9px; background: #fff; }
.pb-paper-sheet { width: min(100%,210mm); min-height: 297mm; margin: 0 auto; padding: 15mm 14mm 18mm; color: #111; background: #fff; box-shadow: 0 12px 34px rgba(23,33,31,.12); font-family: "Noto Serif CJK SC","Source Han Serif SC","Songti SC",SimSun,serif; }
.pb-paper-sheet-head { margin-bottom: 10mm; text-align: center; }
.pb-paper-sheet-head h1 { margin: 0; font-size: 23px; line-height: 1.35; letter-spacing: .05em; }
.pb-paper-sheet-head p { margin: 12px 0 0; color: #3f4744; font: 12px/1.4 Inter,"PingFang SC","Microsoft YaHei",sans-serif; letter-spacing: .02em; }
.pb-paper-sheet .pb-section-list { gap: 5mm; }
.pb-paper-sheet .pb-section { overflow: visible; border: 0; border-radius: 0; background: transparent; }
.pb-paper-sheet .pb-section-head { min-height: 0; margin: 0 0 2mm; padding: 0; border: 0; background: transparent; }
.pb-paper-sheet .pb-section-title { color: #111; font-size: 17px; line-height: 1.5; letter-spacing: .02em; }
.pb-paper-sheet .pb-section-head > span { color: #7a817e; font: 11px/1.4 Inter,"PingFang SC","Microsoft YaHei",sans-serif; }
.pb-paper-sheet .pb-section-items { gap: 0; }
.pb-paper-sheet .pb-paper-item { position: relative; display: grid; grid-template-columns: 7mm minmax(0,1fr); gap: 0 1.5mm; padding: 2mm 0 3mm; border: 0; }
.pb-paper-sheet .pb-paper-item.is-dragging { opacity: .42; }
.pb-paper-sheet .pb-paper-item.is-drop-before::before,.pb-paper-sheet .pb-paper-item.is-drop-after::after { content: ""; position: absolute; right: 0; left: 0; height: 2px; border-radius: 999px; background: var(--accent); box-shadow: 0 0 0 3px rgba(239,131,84,.14); }
.pb-paper-sheet .pb-paper-item.is-drop-before::before { top: 0; }
.pb-paper-sheet .pb-paper-item.is-drop-after::after { bottom: 0; }
.pb-paper-sheet .pb-paper-number { display: block; width: auto; height: auto; padding-top: 1px; color: #111; background: transparent; font: 700 15px/1.65 "Noto Serif CJK SC","Source Han Serif SC","Songti SC",SimSun,serif; text-align: right; }
.pb-paper-sheet .pb-paper-question { min-width: 0; color: #111; font-size: 15px; line-height: 1.72; }
.pb-paper-sheet .pb-item-toolbar { grid-column: 1 / -1; display: flex; gap: 7px; align-items: center; justify-content: flex-end; min-height: 32px; margin: 0 0 1mm; padding: 4px 6px; border: 1px solid #e1e8e4; border-radius: 8px; color: #61706b; background: #f7f9f8; font: 11px/1.3 Inter,"PingFang SC","Microsoft YaHei",sans-serif; transition: opacity .15s ease; }
.pb-paper-sheet .pb-paper-item:not(:hover):not(:focus-within) .pb-item-toolbar { opacity: .62; }
.pb-paper-sheet .pb-item-toolbar > b { color: #8d5a22; font-size: 10px; }
.pb-paper-sheet .pb-item-toolbar label { display: flex; gap: 5px; align-items: center; }
.pb-paper-sheet .pb-item-toolbar input { width: 68px; min-height: 27px; padding: 0 7px; border: 1px solid #ccd8d2; border-radius: 7px; background: #fff; font: 12px/1 Inter,"PingFang SC","Microsoft YaHei",sans-serif; }
.pb-item-actions { display: flex; gap: 4px; align-items: center; }
.pb-item-actions button { min-width: 29px; min-height: 27px; padding: 0 7px; border: 1px solid #ced9d4; border-radius: 7px; color: #33443f; background: #fff; font: 12px/1 Inter,"PingFang SC","Microsoft YaHei",sans-serif; cursor: pointer; }
.pb-item-actions button:hover { border-color: #8eaaa0; background: #eef5f2; }
.pb-item-actions .pb-drag-handle { color: #527068; cursor: grab; letter-spacing: -2px; }
.pb-item-actions .pb-drag-handle:active { cursor: grabbing; }
.pb-paper-sheet .pb-parent-context { margin: 0 0 2mm; padding: 0; border: 0; border-radius: 0; color: #111; background: transparent; }
.pb-paper-sheet .pb-parent-context > span { margin-bottom: 1mm; color: #69716e; font: 10px/1.4 Inter,"PingFang SC","Microsoft YaHei",sans-serif; letter-spacing: .04em; }
.pb-paper-sheet .pb-inline-flow { margin: 1mm 0; }
.pb-paper-sheet .pb-math { padding: 1mm 0; }
.pb-question-figure { width: var(--pb-image-width,55%); max-width: 100%; margin: 10px auto; }
.pb-question-figure.align-left { margin-left: 0; margin-right: auto; }
.pb-question-figure.align-right { margin-left: auto; margin-right: 0; }
.pb-question-image { width: 100%; max-width: 100%; }
.pb-question-image.is-compact { width: 100%; max-width: 360px; }
.pb-paper-sheet .pb-question-image.is-compact { max-width: 100%; max-height: 66mm; }
.pb-paper-sheet .pb-options { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1mm 7mm; margin-top: 1.5mm; }
.pb-paper-sheet .pb-option,.pb-paper-sheet .pb-options.compact .pb-option { grid-template-columns: 6mm minmax(0,1fr); gap: 1mm; padding: .6mm 0; border: 0; border-radius: 0; background: transparent; }
.pb-paper-sheet .pb-option > b { display: block; width: auto; height: auto; color: #111; background: transparent; font: 700 14px/1.72 "Noto Serif CJK SC","Source Han Serif SC","Songti SC",SimSun,serif; }
.pb-paper-sheet .pb-option > b::after { content: "．"; }
.pb-paper.is-clean-preview .pb-item-toolbar { display: none; }
.pb-paper.is-clean-preview .pb-paper-item { padding-top: 1.5mm; }
.pb-paper.is-clean-preview .pb-paper-sheet { box-shadow: 0 10px 28px rgba(23,33,31,.1); }

#paperBuilderPanel.pb-is-fullscreen { height: 100dvh; padding: 12px 16px 16px; overflow: hidden; }
#paperBuilderPanel.pb-is-fullscreen .pb-editor { height: 100%; grid-template-rows: auto auto minmax(0,1fr); gap: 12px; }
#paperBuilderPanel.pb-is-fullscreen .pb-workspace { grid-template-columns: minmax(430px,36%) minmax(720px,64%); min-height: 0; height: 100%; align-items: stretch; }
#paperBuilderPanel.pb-is-fullscreen .pb-bank,#paperBuilderPanel.pb-is-fullscreen .pb-paper { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
#paperBuilderPanel.pb-is-fullscreen .pb-paper > .pb-pane-head { top: -4px; }

@media (max-width: 1080px) {
  .pb-paper-sheet { padding: 38px 34px 46px; }
  #paperBuilderPanel.pb-is-fullscreen .pb-workspace { grid-template-columns: minmax(360px,42%) minmax(520px,58%); }
}

@media (max-width: 760px) {
  .pb-paper { padding: 10px; }
  .pb-paper-view-actions { justify-content: flex-start; }
  .pb-fixed-order-note { white-space: normal; }
  .pb-paper-sheet { min-height: 0; padding: 25px 18px 34px; box-shadow: none; }
  .pb-paper-sheet-head { margin-bottom: 24px; }
  .pb-paper-sheet-head h1 { font-size: 20px; }
  .pb-paper-sheet-head p { font-size: 10px; }
  .pb-paper-sheet .pb-paper-item { grid-template-columns: 24px minmax(0,1fr); }
  .pb-paper-sheet .pb-item-toolbar { justify-content: flex-start; flex-wrap: wrap; }
  .pb-paper-sheet .pb-options { grid-template-columns: 1fr; gap: 2px; }
  #paperBuilderPanel.pb-is-fullscreen { padding: 8px; }
}
