/* VIS21 teacher workspace: white/gray working pages, decisive cyan/yellow task entry. */
:root {
  --teacher-bg: #f4f5f7;
  --teacher-surface: #ffffff;
  --teacher-ink: #282c2e;
  --teacher-muted: #626b70;
  --teacher-line: #e8ebed;
  --teacher-blue: #2463ad;
  --teacher-blue-soft: #edf4ff;
  --teacher-red: #b33945;
  --teacher-red-soft: #fff0f2;
  --teacher-green: #276749;
  --teacher-green-soft: #eaf7f0;
  --teacher-amber: #855500;
  --teacher-amber-soft: #fff5db;
  --teacher-peach: #ffd9d5;
  --teacher-sage: #dde9e0;
  --teacher-butter: #fff0b8;
  --teacher-primary: #007f8b;
  --teacher-primary-ink: #006875;
  --teacher-selected: #e2f8fc;
  --teacher-cyan: #18cbe3;
  --teacher-yellow: #ffd000;
  --teacher-batch: #fff4c2;
  --teacher-coral: #ff7184;
  --teacher-error: #a12d3a;
  --teacher-unavailable: #58646b;
  --teacher-radius: 20px;
  --teacher-radius-sm: 14px;
  --teacher-shadow: 0 1px 2px rgba(40, 44, 46, 0.04), 0 8px 24px rgba(40, 44, 46, 0.04);
  --teacher-nav: 68px;
  --accent: #007f8b;
  --accent-text: #ffffff;
  --control-fill: #f1f3f4;
  --border: #e8ebed;
  --radius-control: 14px;
  --danger: #a12d3a;
}

body {
  background: var(--teacher-bg);
  color: var(--teacher-ink);
}

body.teacher-sheet-open {
  overflow: hidden;
}

#app {
  background:
    radial-gradient(circle at 100% 0%, rgba(245, 211, 199, 0.34), transparent 42%),
    radial-gradient(circle at 0% 34%, rgba(217, 230, 210, 0.28), transparent 38%),
    var(--teacher-bg);
}

/* ---------- Header ---------- */
.teacher-header.app-header {
  justify-content: flex-start;
  align-items: stretch;
  flex-direction: column;
  gap: 9px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 10px;
  background: rgba(251, 247, 242, 0.92);
  border-bottom: 1px solid var(--teacher-line);
}

.teacher-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
}

.teacher-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--teacher-surface);
  box-shadow: inset 0 0 0 1px var(--teacher-line);
}

.brand-mark svg { width: 32px; height: 32px; display: block; }

.teacher-brand-text { min-width: 0; }

.teacher-brand-text h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-align: left;
}

.teacher-brand-text p {
  margin: 2px 0 0;
  color: var(--teacher-muted);
  font-size: 12px;
  line-height: 1.3;
}

.icon-btn {
  min-width: 52px;
  min-height: 44px;
  padding: 5px 8px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: transparent;
  color: var(--teacher-muted);
  border-radius: 14px;
  font-size: 11px;
  line-height: 1.1;
}

.icon-btn svg { width: 20px; height: 20px; }

.teacher-contextbar {
  display: flex;
  align-items: stretch;
  gap: 7px;
  min-width: 0;
}

.context-essay,
.context-action {
  min-height: 44px;
  border-radius: 15px;
  background: var(--teacher-surface);
  color: var(--teacher-ink);
  border: 1px solid var(--teacher-line);
  box-shadow: 0 1px 1px rgba(78, 57, 38, 0.03);
}

.context-essay {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  text-align: left;
  font-size: 14px;
}

.context-essay svg { width: 19px; height: 19px; flex: 0 0 auto; color: var(--teacher-blue); }

#teacher-current-essay {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.context-chevron { margin-left: auto; color: var(--teacher-muted); }

.context-action {
  flex: 0 0 auto;
  width: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px;
  font-size: 11px;
  color: var(--teacher-muted);
}

.context-action svg { width: 18px; height: 18px; color: var(--teacher-blue); }

/* Compact selected-essay context and requirements summary */
.teacher-context-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 50px;
  margin-bottom: 9px;
  padding: 7px 9px 7px 12px;
  border-radius: 15px;
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-line);
  box-shadow: 0 1px 1px rgba(78, 57, 38, 0.03);
}

.context-line-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.context-line-main .essay-title {
  font-size: 15px !important;
  line-height: 1.3;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.context-line-meta {
  color: var(--teacher-muted);
  font-size: 11px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.context-line-actions { display: flex; gap: 5px; flex: 0 0 auto; }
.context-line-actions .mini-button { min-height: 40px; padding: 6px 9px; font-size: 11px; }

.requirements-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 11px;
  padding: 7px 9px 7px 11px;
  border-radius: 14px;
  background: #f6f1ea;
  border: 1px solid rgba(127, 92, 65, 0.08);
  color: var(--teacher-muted);
  font-size: 11px;
  line-height: 1.4;
}

.requirements-strip.is-warning { background: var(--teacher-amber-soft); }
.requirements-strip-label {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.82);
  color: var(--teacher-ink);
  font-weight: 700;
  font-size: 10px;
}
.requirements-strip-text {
  flex: 1 1 160px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.requirements-strip-warning { color: var(--teacher-amber); font-weight: 700; }
.requirements-strip .mini-button { margin-left: auto; min-height: 38px; padding: 5px 8px; font-size: 11px; }

/* ---------- Scroll surface ---------- */
main#teacher-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px calc(var(--teacher-nav) + 30px + env(safe-area-inset-bottom));
  scroll-padding-bottom: calc(var(--teacher-nav) + 24px);
  outline: none;
}

main#tab-content.hidden { display: none !important; }

/* ---------- Hero ---------- */
.teacher-hero {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  padding: 20px 18px;
  margin-bottom: 14px;
  background:
    linear-gradient(135deg, rgba(247, 224, 214, 0.9), rgba(246, 236, 201, 0.72) 54%, rgba(220, 235, 214, 0.82));
  border: 1px solid rgba(127, 92, 65, 0.1);
  box-shadow: var(--teacher-shadow);
}

.hero-copy { position: relative; z-index: 1; max-width: 86%; }

.hero-eyebrow,
.card-eyebrow {
  margin: 0 0 5px;
  color: var(--teacher-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.teacher-hero h2 {
  margin: 0 0 6px;
  font-size: 23px;
  line-height: 1.22;
  letter-spacing: 0.01em;
}

.hero-lead {
  margin: 0 0 8px;
  color: #51483f;
  font-size: 14px;
  line-height: 1.55;
}

.hero-note {
  margin: 0;
  color: var(--teacher-muted);
  font-size: 12px;
  line-height: 1.4;
}

.hero-doodle {
  position: absolute;
  right: -6px;
  bottom: -12px;
  width: 104px;
  height: 104px;
  opacity: 0.85;
}

.doodle-sun {
  position: absolute;
  right: 26px;
  top: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--teacher-butter);
  box-shadow: 0 0 0 8px rgba(246, 233, 189, 0.28);
}

.doodle-leaf {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 78px;
  height: 78px;
  color: var(--teacher-green);
  opacity: 0.7;
}

.doodle-dot {
  position: absolute;
  right: 8px;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teacher-peach);
  box-shadow: 28px 12px 0 -2px rgba(169, 72, 67, 0.28), -6px 34px 0 -2px rgba(63, 111, 158, 0.26);
}

/* ---------- Cards ---------- */
.teacher-card,
.teacher-result {
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-line);
  border-radius: var(--teacher-radius);
  box-shadow: var(--teacher-shadow);
  padding: 16px;
  margin-bottom: 13px;
}

.teacher-card h2,
.teacher-result h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.card-head,
.essay-context-head,
.result-head,
.overall-head,
.batch-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.essay-title { font-size: 19px !important; }

.meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.teacher-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1ece5;
  color: #5e5247;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.teacher-pill.is-ok { background: var(--teacher-green-soft); color: var(--teacher-green); }
.teacher-pill.is-soft { background: #f2ede7; color: var(--teacher-muted); }
.teacher-pill.is-warn { background: var(--teacher-amber-soft); color: var(--teacher-amber); }
.teacher-pill.is-error { background: var(--teacher-red-soft); color: var(--teacher-red); }
.teacher-pill.is-comment { background: var(--teacher-blue-soft); color: var(--teacher-blue); }

.mini-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 8px 11px;
  border-radius: 13px;
  background: #f6f1ea;
  color: var(--teacher-blue);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.mini-button svg { width: 16px; height: 16px; }

.essay-context-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Requirements summary ---------- */
.requirement-grid {
  display: grid;
  gap: 9px;
  margin: 12px 0 0;
}

.requirement-grid > div {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.requirement-grid dt {
  color: var(--teacher-muted);
  font-size: 12px;
}

.requirement-grid dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  min-width: 0;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.requirements-empty {
  margin: 10px 0 0;
  color: var(--teacher-red);
  font-size: 13px;
  line-height: 1.5;
}

.inline-warning {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--teacher-amber-soft);
  color: var(--teacher-amber);
  font-size: 12px;
  line-height: 1.45;
}

/* ---------- Primary action ---------- */
.action-card {
  background:
    linear-gradient(160deg, #fffdf9 0%, #fffdf9 58%, rgba(223, 234, 246, 0.5) 100%);
}

.action-copy h2 { margin-bottom: 4px; }

.action-copy p {
  margin: 0 0 13px;
  color: var(--teacher-muted);
  font-size: 13px;
  line-height: 1.5;
}

.primary-action {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 16px;
  border-radius: 17px;
  background: var(--teacher-blue);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(63, 111, 158, 0.24);
}

.primary-action svg { width: 21px; height: 21px; }

.primary-action-tail {
  margin-left: 2px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 10px;
  font-weight: 600;
}

.action-foot {
  margin: 9px 0 0;
  color: var(--teacher-muted);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}

/* ---------- Progress ---------- */
.batch-card { border-color: rgba(63, 111, 158, 0.24); }
.batch-card.warn { border-color: rgba(141, 100, 45, 0.28); background: #fffaf0; }
.batch-card.error { border-color: rgba(169, 72, 67, 0.28); background: #fff7f5; }
.batch-card.ok { border-color: rgba(85, 122, 89, 0.28); background: #f8fcf6; }
.batch-card h2 { font-size: 16px; }

.progress-track {
  height: 10px;
  margin: 14px 0 10px;
  border-radius: 999px;
  background: #ece6df;
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #87a9c8, var(--teacher-blue));
  transition: width 240ms ease;
}

.batch-message {
  margin: 0 0 10px;
  color: var(--teacher-muted);
  font-size: 12px;
  line-height: 1.5;
}

.batch-entries { display: grid; gap: 4px; margin: 10px 0 6px; }
.batch-entry {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #f8f4ee;
  font-size: 12px;
  line-height: 1.4;
}
.batch-entry-title { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.batch-entry-state { flex: 0 0 auto; color: var(--teacher-muted); font-size: 11px; }
.batch-entry.is-done .batch-entry-state { color: var(--teacher-green); font-weight: 700; }
.batch-entry.is-error .batch-entry-state { color: var(--teacher-red); font-weight: 700; }
.batch-entry.is-unknown .batch-entry-state { color: var(--teacher-amber); font-weight: 700; }

.batch-mini {
  margin: 12px 0 0;
  border-radius: 14px;
  background: #f8f4ee;
  border: 1px solid var(--teacher-line);
  overflow: hidden;
}
.batch-mini summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 9px 12px;
  color: var(--teacher-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.batch-mini .batch-entries { margin: 0; padding: 0 10px 10px; }
.batch-mini.is-compact { padding: 10px 12px; }
.batch-mini-line { margin: 0; color: var(--teacher-muted); font-size: 12px; font-weight: 700; line-height: 1.5; }

.batch-entry { align-items: center; flex-wrap: wrap; }
.batch-entry-main { min-width: 0; display: grid; gap: 2px; flex: 1 1 150px; }
.batch-entry-message { color: var(--teacher-muted); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.batch-entry-actions { display: flex; flex-wrap: wrap; gap: 5px; flex: 0 0 auto; }
.batch-entry-actions .mini-button { min-height: 44px; padding: 6px 9px; }
.batch-entry-more { margin: 2px 0 0; color: var(--teacher-muted); font-size: 11px; line-height: 1.45; }
.batch-entry.is-needs_input .batch-entry-state,
.batch-entry.is-repair_pending .batch-entry-state,
.batch-entry.is-blocked .batch-entry-state,
.batch-entry.is-stale .batch-entry-state { color: var(--teacher-amber); font-weight: 700; }
.batch-entry.is-stale { background: #fff7ef; }

.batch-tools { margin-top: 12px; }
.batch-tools-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.batch-tools-head h2 { font-size: 17px; }
.batch-tools-note { margin: 6px 0 0; color: var(--teacher-muted); font-size: 12px; line-height: 1.55; }
.batch-tools-rows { display: grid; gap: 5px; margin-top: 10px; }
.batch-tools-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 11px;
  background: #f8f4ee;
  font-size: 12px;
}
.batch-tools-title { min-width: 0; flex: 1 1 120px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.batch-tools-state { color: var(--teacher-muted); font-size: 11px; }
.batch-tools-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.batch-tools-actions .primary { flex: 1 1 220px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.batch-tools-actions .secondary { min-height: 44px; }
.batch-tools-actions svg { width: 18px; height: 18px; }

.repair-banner,
.input-banner {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin: 0 0 12px;
  padding: 10px 11px;
  border-radius: 13px;
  background: var(--teacher-amber-soft);
  color: #6c5228;
  font-size: 12px;
  line-height: 1.5;
}
.repair-banner svg,
.input-banner svg { width: 18px; height: 18px; margin-top: 1px; }
.repair-banner p,
.input-banner p { margin: 0; }
.repair-banner button,
.input-banner .button-row { grid-column: 1 / -1; justify-self: start; }
.repair-banner button { min-height: 44px; }
.input-banner .button-row { margin-top: 2px; }
.input-banner .button-row button { min-height: 44px; }

.result-notes {
  margin-top: 10px;
  border-radius: 12px;
  background: #f8f4ee;
  padding: 0 10px;
}
.result-notes summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--teacher-muted);
  font-size: 12px;
  font-weight: 700;
}
.result-notes ul { margin: 0 0 10px; padding-left: 20px; color: var(--teacher-muted); font-size: 12px; line-height: 1.55; }
.export-reasons { margin: 8px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.6; }

/* ---------- Result ---------- */
.teacher-result { padding: 15px; }

.result-head { margin-bottom: 10px; }
.result-head h2 { font-size: 18px; }

.annotation-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 2px 0 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f8f4ee;
  color: var(--teacher-muted);
  font-size: 11px;
}

.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 4px; }
.legend-item.comment .legend-swatch { background: var(--teacher-blue-soft); border-bottom: 2px solid var(--teacher-blue); }
.legend-item.correction .legend-swatch { background: var(--teacher-red-soft); border-bottom: 2px solid var(--teacher-red); }

.annotated-source { margin-top: 4px; }

.source-paragraph {
  padding: 11px 0;
  border-bottom: 1px dashed var(--teacher-line);
}

.source-paragraph:last-child { border-bottom: none; }

.paragraph-label {
  margin: 0 0 5px;
  color: #a2968a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.paragraph-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.95;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.annotation {
  border-radius: 4px;
  padding: 1px 1px;
  cursor: pointer;
  outline: none;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.annotation:hover { filter: saturate(1.15); }
.annotation:active { filter: saturate(1.3); }

.annotation.is-comment {
  background: var(--teacher-blue-soft);
  border-bottom: 2px solid rgba(63, 111, 158, 0.55);
}

.annotation.is-correction {
  background: var(--teacher-red-soft);
  border-bottom: 2px solid rgba(169, 72, 67, 0.6);
}

.annotation.is-overlap {
  background: linear-gradient(180deg, var(--teacher-blue-soft) 55%, var(--teacher-red-soft) 55%);
  border-bottom: 2px solid var(--teacher-red);
}

.annotation:focus-visible {
  outline: 2px solid var(--teacher-ink);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.correction-details,
.comment-details {
  margin-top: 9px;
  border-radius: 14px;
  background: #fbf7f3;
  border: 1px solid var(--teacher-line);
  overflow: hidden;
}

.correction-details summary,
.comment-details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  color: var(--teacher-red);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.comment-details summary { color: var(--teacher-blue); }

.correction-item,
.comment-item {
  padding: 10px 12px;
  border-top: 1px solid var(--teacher-line);
}

.correction-item .teacher-pill { margin-bottom: 5px; }

.correction-item.is-pinned,
.comment-item.is-pinned {
  background: #fff6d9;
  outline: 2px solid var(--teacher-amber);
  outline-offset: -2px;
  border-radius: 8px;
}

.correction-quote,
.comment-quote {
  margin: 0 0 4px;
  font-size: 13px;
  line-height: 1.55;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.correction-suggestion { margin: 0; color: var(--teacher-green); font-size: 13px; line-height: 1.55; }
.correction-reason,
.comment-praise { margin: 4px 0 0; color: var(--teacher-muted); font-size: 12px; line-height: 1.55; }
.comment-meta { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; color: var(--teacher-muted); font-size: 11px; }

.stale-banner {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 2px 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--teacher-amber-soft);
  color: #745222;
}

.stale-banner svg { width: 19px; height: 19px; flex: 0 0 auto; margin-top: 1px; }
.stale-banner p { margin: 0; font-size: 12px; line-height: 1.5; }

.source-sync-banner {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin: 0 0 12px;
  padding: 10px 11px;
  border-radius: 13px;
  background: var(--teacher-amber-soft);
  color: #6c5228;
}
.source-sync-banner svg { width: 18px; height: 18px; margin-top: 1px; }
.source-sync-banner p { margin: 0; font-size: 12px; line-height: 1.5; }
.source-sync-banner .source-sync-title { font-weight: 700; }
.source-sync-banner .source-sync-detail { margin-top: 3px; color: #7a6244; font-size: 11px; }
.source-sync-banner button { grid-column: 1 / -1; justify-self: start; min-height: 44px; }

.legacy-banner {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 2px 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--teacher-blue-soft);
  color: #35506c;
}

.legacy-banner svg { width: 19px; height: 19px; flex: 0 0 auto; margin-top: 1px; }
.legacy-banner p { margin: 0; font-size: 12px; line-height: 1.55; }
.legacy-banner .legacy-source-note { margin-top: 3px; color: #5d6f82; font-size: 11px; }

.legacy-confirm {
  display: grid;
  gap: 8px;
  margin: 2px 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8f4ee;
  border: 1px solid rgba(127, 92, 65, 0.12);
}

.legacy-confirm-copy { margin: 0; color: var(--teacher-muted); font-size: 12px; line-height: 1.55; }

.legacy-audit-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 44px;
  padding: 4px 0;
  color: #5d534a;
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
}

.legacy-audit-check input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: 0 0 auto;
  accent-color: var(--teacher-blue);
}

.legacy-confirm-btn { justify-self: start; min-height: 44px; }

.legacy-confirmed-note {
  margin: 0 0 12px;
  padding: 8px 11px;
  border-radius: 12px;
  background: #f2f6ef;
  color: #4c6544;
  font-size: 12px;
  line-height: 1.5;
}

.editorial-note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 2px 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8f4ee;
  color: #6c5228;
}

.editorial-note svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; color: var(--teacher-amber); }
.editorial-note p { margin: 0; font-size: 12px; line-height: 1.55; }
.editorial-note .editorial-note-title { font-weight: 700; }

.overall-evaluation {
  margin-top: 18px;
  padding: 16px;
  border-radius: 20px;
  background:
    linear-gradient(155deg, #f8f2e9 0%, #fbf7f2 45%, rgba(223, 234, 246, 0.42) 100%);
  border: 1px solid rgba(127, 92, 65, 0.12);
}

.overall-head { align-items: center; margin-bottom: 10px; }
.overall-head h2 { font-size: 18px; }

.overall-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  color: var(--teacher-amber);
}

.overall-mark svg { width: 21px; height: 21px; }

.overall-text {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.dimension-list { display: grid; gap: 8px; margin: 0 0 14px; }

.dimension-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 9px;
  padding: 9px 10px;
  border-radius: 13px;
  background: rgba(255, 253, 249, 0.72);
  border: 1px solid rgba(127, 92, 65, 0.08);
}

.dimension-item dt { color: var(--teacher-muted); font-size: 12px; font-weight: 700; }
.dimension-item dd { margin: 0; min-width: 0; font-size: 12px; line-height: 1.5; }
.dimension-level { display: block; color: var(--teacher-blue); font-weight: 700; margin-bottom: 2px; }
.dimension-reason { color: #5d534a; }

.evaluation-list { margin-top: 12px; }
.evaluation-list h3 { margin: 0 0 6px; font-size: 13px; }
.evaluation-list ul { margin: 0; padding-left: 19px; }
.evaluation-list li { margin: 3px 0; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.evaluation-list.positive h3 { color: var(--teacher-green); }
.evaluation-list.negative h3 { color: var(--teacher-blue); }
.evaluation-list.warnings h3 { color: var(--teacher-amber); }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.result-actions button { flex: 1 1 130px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.result-actions svg { width: 18px; height: 18px; }

/* ---------- Misc cards ---------- */
.privacy-note {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin: 4px 2px 6px;
  color: #978b7f;
  font-size: 11px;
  line-height: 1.5;
}

.privacy-note svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; color: var(--teacher-green); }
.privacy-note span { min-width: 0; }

.empty-card { text-align: center; padding: 24px 18px; }
.empty-art { width: 62px; height: 62px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 20px; background: var(--teacher-blue-soft); color: var(--teacher-blue); }
.empty-art svg { width: 28px; height: 28px; }
.empty-card p { color: var(--teacher-muted); font-size: 13px; line-height: 1.55; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.button-row button { flex: 1 1 120px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.button-row svg { width: 18px; height: 18px; }
.error-card { border-color: rgba(169, 72, 67, 0.26); background: #fff8f6; }
.error-card p { color: var(--teacher-muted); font-size: 13px; line-height: 1.55; }
.error-card button { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; }

/* Skeleton */
.skeleton { overflow: hidden; }
.skeleton-line {
  display: block;
  height: 13px;
  margin: 9px 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #eee7df 25%, #f7f1ea 37%, #eee7df 63%);
  background-size: 400% 100%;
  animation: teacher-shimmer 1.5s ease infinite;
}
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-80 { width: 80%; }

@keyframes teacher-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
  background: rgba(255, 253, 249, 0.96);
  border-top: 1px solid var(--teacher-line);
  height: var(--teacher-nav);
  box-shadow: 0 -8px 26px rgba(78, 57, 38, 0.05);
}

.nav-btn {
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #8d8175;
  font-size: 14px;
  padding: 5px 8px;
}

.nav-btn svg { width: 23px; height: 23px; }

.nav-btn .nav-label { font-size: 14px; line-height: 1.2; }
.nav-btn .nav-hint { font-size: 10px; line-height: 1.1; color: #a89a8c; }
.nav-btn.active { color: var(--teacher-blue); }
.nav-btn.active .nav-hint { color: #6f8ca7; }
.nav-btn.active svg { filter: drop-shadow(0 2px 3px rgba(63, 111, 158, 0.18)); }

/* ---------- Sheet ---------- */
.teacher-sheet {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 0;
}

.teacher-sheet.hidden { display: none !important; }

.teacher-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(47, 42, 38, 0.36);
  backdrop-filter: blur(2px);
}

.teacher-sheet-panel {
  position: relative;
  width: 100%;
  max-width: 430px;
  max-height: calc(100dvh - 34px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--teacher-bg);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -18px 60px rgba(47, 42, 38, 0.22);
  padding-bottom: env(safe-area-inset-bottom);
  animation: teacher-sheet-in 240ms cubic-bezier(0.22, 0.8, 0.3, 1);
  overflow: hidden;
}

@keyframes teacher-sheet-in {
  from { transform: translateY(26px); opacity: 0.5; }
  to { transform: translateY(0); opacity: 1; }
}

.teacher-sheet-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px 11px 18px;
  border-bottom: 1px solid var(--teacher-line);
  background: rgba(251, 247, 242, 0.96);
}

.teacher-sheet-head h2 { margin: 0; font-size: 18px; line-height: 1.25; }

.sheet-close {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f1ebe4;
  color: var(--teacher-muted);
  padding: 0;
}

.sheet-close svg { width: 20px; height: 20px; }

.teacher-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 15px 14px calc(18px + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

.teacher-sheet-body.is-legacy {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.teacher-sheet-body.is-legacy #tab-content {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 12px calc(18px + env(safe-area-inset-bottom));
  background: var(--teacher-bg);
}

.sheet-stack { display: grid; gap: 12px; }
.sheet-stack > * { margin-bottom: 0; }

.loading-line { color: var(--teacher-muted); font-size: 13px; text-align: center; padding: 24px 10px; }

/* Essay picker */
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 15px;
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-line);
}

.search-field svg { width: 19px; height: 19px; color: var(--teacher-muted); flex: 0 0 auto; }
.search-field input { border: 0; background: transparent; min-height: 44px; padding: 0; }
.search-field input:focus { outline: none; }
.search-field:focus-within { outline: 2px solid var(--teacher-blue); outline-offset: 1px; }

.picker-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.picker-count { color: var(--teacher-muted); font-size: 12px; font-weight: 600; }
.picker-tools-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.picker-tool {
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 12px;
  background: #f1ebe4;
  color: var(--teacher-blue);
  font-size: 12px;
  font-weight: 600;
}

.picker-list {
  display: grid;
  gap: 7px;
  max-height: min(52dvh, 460px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 2px;
  scrollbar-gutter: stable;
}

.picker-item {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-height: 62px;
  border-radius: 15px;
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-line);
  color: var(--teacher-ink);
  overflow: hidden;
}

.picker-item.is-viewing { border-color: rgba(63, 111, 158, 0.45); }
.picker-item.is-checked { background: #f7fbff; }

.picker-check {
  position: relative;
  width: 46px;
  min-height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  margin: 0;
  cursor: pointer;
}

.picker-checkbox {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.picker-check-mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.5px solid #c5b9ad;
  background: #fffefb;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.picker-checkbox:checked + .picker-check-mark {
  border-color: var(--teacher-blue);
  background: var(--teacher-blue);
}

.picker-checkbox:checked + .picker-check-mark::after {
  content: '';
  width: 10px;
  height: 6px;
  margin-top: -2px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

.picker-checkbox:focus-visible + .picker-check-mark {
  outline: 2px solid var(--teacher-blue);
  outline-offset: 2px;
}

.picker-view {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 2px;
  background: transparent;
  color: var(--teacher-ink);
  text-align: left;
  border-radius: 0;
}

.picker-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.picker-copy strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-meta { color: var(--teacher-muted); font-size: 11px; }
.picker-view svg { width: 19px; height: 19px; flex: 0 0 auto; color: var(--teacher-muted); }
.picker-empty { margin: 8px 2px; color: var(--teacher-muted); font-size: 13px; }

.picker-links { display: flex; gap: 8px; }
.picker-links button {
  flex: 1 1 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
}
.picker-links svg { width: 18px; height: 18px; flex: 0 0 auto; }
.picker-footer { z-index: 2; }
.picker-footer .picker-action { flex: 1.4 1 0; min-height: 46px; font-size: 14px; }

.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.page-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 44px;
  padding: 8px;
  border-radius: 16px;
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-line);
  color: var(--teacher-muted);
  text-decoration: none;
  font-size: 12px;
  text-align: center;
}

.page-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  background: #eee7df;
}

.photo-details {
  margin-top: 11px;
  border-top: 1px dashed var(--teacher-line);
}

.photo-details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--teacher-muted);
  font-size: 12px;
  cursor: pointer;
}

.photo-details summary svg { width: 17px; height: 17px; color: var(--teacher-blue); }

.page-grid-mini {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 2px 0 8px;
}

.page-grid-mini .page-card { padding: 5px; font-size: 10px; gap: 3px; }
.page-grid-mini .page-card img { aspect-ratio: 1 / 1.2; }

/* Requirements form */
.requirements-form { display: grid; gap: 12px; }

.req-select-row { display: grid; gap: 5px; }
.req-select-row label { margin: 0; }

.req-group {
  margin: 0;
  padding: 14px;
  border-radius: 20px;
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-line);
  box-shadow: 0 1px 1px rgba(78, 57, 38, 0.03);
}

.req-group legend {
  padding: 0 6px;
  margin-left: -2px;
  color: var(--teacher-ink);
  font-size: 15px;
  font-weight: 700;
}

.field { margin-top: 10px; }
.field:first-of-type { margin-top: 4px; }
.field label { margin-bottom: 5px; color: var(--teacher-muted); font-size: 12px; }
.field input,
.field textarea,
.field select { border-radius: 13px; border-color: var(--teacher-line); background: #fffefb; }
.field textarea { min-height: 104px; }
.field-hint { margin: 6px 0 0; color: var(--teacher-muted); font-size: 11px; line-height: 1.5; }
.field-label { margin: 0; color: var(--teacher-muted); font-size: 12px; font-weight: 700; }

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: #f1ebe4;
}

.segment {
  flex: 1 1 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  border-radius: 11px;
  color: var(--teacher-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.segment input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.segment.is-active { background: var(--teacher-surface); color: var(--teacher-blue); box-shadow: 0 1px 4px rgba(78, 57, 38, 0.12); }
.segment:focus-within { outline: 2px solid var(--teacher-blue); outline-offset: 1px; }

.dimension-preview { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

.criteria-box { margin-top: 12px; display: grid; gap: 8px; }
.criteria-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.counter { color: var(--teacher-muted); font-size: 11px; }

.criterion-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
  padding: 8px;
  border-radius: 14px;
  background: #fbf7f3;
  border: 1px solid var(--teacher-line);
}

.criterion-fields { display: grid; gap: 5px; flex: 1 1 auto; min-width: 0; }
.criterion-fields input { min-height: 40px; padding: 8px 9px; font-size: 13px; border-radius: 10px; }
.criterion-actions { display: flex; gap: 2px; align-items: center; flex: 0 0 auto; }

.icon-action {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--teacher-muted);
  font-size: 17px;
}

.icon-action.danger-text { color: var(--teacher-red); }
.icon-action:disabled { opacity: 0.3; }

.add-criterion { width: 100%; min-height: 44px; font-size: 13px; }

.form-status {
  padding: 10px 12px;
  border-radius: 13px;
  background: var(--teacher-red-soft);
  color: var(--teacher-red);
  font-size: 12px;
  line-height: 1.5;
}

.sheet-footer {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.sheet-footer.sticky {
  position: sticky;
  bottom: -1px;
  padding: 10px 0 2px;
  background: linear-gradient(180deg, rgba(251, 247, 242, 0), var(--teacher-bg) 34%);
}

.sheet-footer button { flex: 1; }
.save-requirements { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.save-requirements svg { width: 18px; height: 18px; }

/* Settings */
.settings-card {
  padding: 16px;
  border-radius: 20px;
  background: var(--teacher-surface);
  border: 1px solid var(--teacher-line);
  box-shadow: var(--teacher-shadow);
}

.settings-card.soft { background: #f6f1e9; box-shadow: none; }
.settings-card h3 { margin: 0 0 6px; font-size: 18px; }
.settings-note { margin: 6px 0 0; color: var(--teacher-muted); font-size: 12px; line-height: 1.55; }
.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--teacher-blue);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.balance-result { margin: 8px 0 0; color: var(--teacher-muted); font-size: 12px; line-height: 1.55; }
.logout-card { text-align: center; }
.wide { width: 100%; }
.danger-text { color: var(--teacher-red); }

/* Text editor */
.editor-sheet .editor-field { margin-top: 8px; }
.editor-sheet textarea { min-height: 96px; font-size: 14px; line-height: 1.7; }

/* Toast */
.teacher-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--teacher-nav) + 18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90;
  max-width: min(390px, calc(100vw - 28px));
  padding: 10px 14px;
  border-radius: 14px;
  background: #3a342e;
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 10px 28px rgba(47, 42, 38, 0.24);
  animation: teacher-toast-in 180ms ease;
}

.teacher-toast.is-warn { background: #7c5427; }
.teacher-toast.is-ok { background: #3f6347; }
.teacher-toast.is-soft { background: #4c5f72; }
.teacher-toast.hidden { display: none !important; }

@keyframes teacher-toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Focus visibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 2px solid var(--teacher-blue);
  outline-offset: 2px;
}

/* ---------- Flow19 start and guided intake ---------- */
.teacher-start {
  padding: 20px 18px;
  border-radius: 24px;
  background: linear-gradient(145deg, #fffaf3 0%, #f6f0ff 58%, #edf7f1 100%);
  border: 1px solid rgba(229, 216, 201, 0.8);
  box-shadow: 0 10px 28px rgba(84, 66, 48, 0.07);
  margin-bottom: 12px;
}

.teacher-start h2 { margin: 2px 0 8px; font-size: 24px; line-height: 1.3; color: #433a32; }
.teacher-start .hero-lead { margin: 0 0 16px; color: #7e7062; font-size: 14px; line-height: 1.6; }
.start-actions { display: grid; gap: 10px; }
.start-secondary { min-height: 48px; }
.start-primary { min-height: 56px; }

.intake-progress {
  display: flex;
  align-items: stretch;
  gap: 4px;
  list-style: none;
  margin: 0 0 12px;
  padding: 8px 6px;
  border-radius: 16px;
  background: rgba(255, 253, 249, 0.92);
  border: 1px solid var(--teacher-line);
  overflow: hidden;
}

.intake-step {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  color: #a89a8c;
  font-size: 10px;
  line-height: 1.2;
}

.intake-step-index {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #f0e9df;
  color: #8c7d6e;
  font-size: 10px;
  font-weight: 700;
}

.intake-step.is-current { color: var(--teacher-blue); font-weight: 700; }
.intake-step.is-current .intake-step-index { background: var(--teacher-blue); color: #fff; }
.intake-step.is-done { color: #568162; }
.intake-step.is-done .intake-step-index { background: #dff0e2; color: #40704d; }

.intake-card { display: grid; gap: 9px; }
.intake-card h2 { margin: 0; font-size: 20px; }
.intake-context { margin: 0; color: #5f5347; font-size: 13px; line-height: 1.55; }
.intake-note { margin: 0; color: var(--teacher-muted); font-size: 13px; line-height: 1.55; }
.intake-warning { margin: 0; padding: 9px 11px; border-radius: 12px; background: #fdf0e6; color: #8a4f22; font-size: 13px; line-height: 1.5; }
.intake-run-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.intake-run-actions .primary { flex: 1 1 180px; min-height: 48px; }
.intake-run-actions .secondary { flex: 1 1 150px; min-height: 44px; }

.intake-mode-grid { display: grid; gap: 10px; }
.intake-mode-card {
  width: 100%;
  min-height: 96px;
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--teacher-line);
  color: #4b4138;
  box-shadow: 0 5px 14px rgba(84, 66, 48, 0.05);
}
.intake-mode-card strong { font-size: 17px; }
.intake-mode-card .intake-mode-caption { color: var(--teacher-muted); font-size: 12px; }
.intake-mode-card .intake-mode-count { color: var(--teacher-blue); font-size: 12px; font-weight: 700; }

.intake-result-list { display: grid; gap: 6px; }
.intake-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 12px;
  background: #fbf8f3;
  border: 1px solid rgba(229, 216, 201, 0.7);
}
.intake-result-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.intake-result-state { color: var(--teacher-muted); font-size: 11px; }
.intake-result-row.is-stale { background: #fdf3ea; }

.upload-source-sheet .upload-source-head { display: grid; gap: 3px; margin-bottom: 8px; }
.upload-source-sheet h3 { margin: 0; font-size: 20px; }
.upload-source-actions { display: grid; gap: 10px; }
.upload-source-actions .primary, .upload-source-actions .secondary { min-height: 52px; }
.upload-intake-note { display: grid; gap: 7px; margin-bottom: 10px; padding: 10px 11px; border-radius: 14px; background: #f5f8fb; border: 1px solid #dbe6f0; }
.upload-intake-note .intake-progress { margin: 0; padding: 6px 4px; }
.upload-intake-note .mini-button { justify-self: start; }

/* Guided-intake action icons: icon() emits a bare SVG, which otherwise keeps
   its intrinsic ~300px replaced-element width and stretches the button. Keep
   every Flow19 start/source/choice/run/result/export action icon compact while
   retaining the existing 44px+ button targets. */
.start-actions button,
.intake-card .button-row button,
.upload-source-sheet .sheet-footer button,
.upload-source-actions button,
.intake-run-actions button,
.intake-result-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.start-actions svg,
.intake-card .button-row svg,
.upload-source-sheet .sheet-footer svg,
.upload-source-actions svg,
.intake-run-actions svg,
.intake-result-row svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

/* ---------- Narrow phones ---------- */
@media (max-width: 359px) {
  .teacher-header.app-header { padding-left: 10px; padding-right: 10px; }
  .teacher-brand-text h1 { font-size: 17px; }
  .teacher-hero { padding: 16px 14px; border-radius: 22px; }
  .teacher-hero h2 { font-size: 20px; }
  .hero-copy { max-width: 92%; }
  .hero-doodle { opacity: 0.6; right: -16px; }
  .context-action { width: 52px; }
  main#teacher-content { padding-left: 10px; padding-right: 10px; }
  .teacher-card, .teacher-result { padding: 13px; border-radius: 19px; }
  .mini-button { padding: 7px 9px; }
  .essay-context-head { flex-direction: column; gap: 8px; }
  .essay-context-actions { justify-content: flex-start; }
  .dimension-item { grid-template-columns: 48px minmax(0, 1fr); }
  .criterion-row { flex-wrap: wrap; }
  .criterion-actions { width: 100%; justify-content: flex-end; }
  .teacher-sheet-body { padding-left: 10px; padding-right: 10px; }
}

/* ---------- Landscape ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  .teacher-sheet { align-items: center; padding: 10px; }
  .teacher-sheet-panel {
    max-width: 680px;
    max-height: calc(100dvh - 20px);
    border-radius: 22px;
    padding-bottom: 0;
  }
  .teacher-sheet-head { padding-top: 8px; padding-bottom: 8px; }
  .teacher-sheet-body { padding-top: 10px; }
  .teacher-header.app-header { padding-top: calc(5px + env(safe-area-inset-top)); padding-bottom: 6px; gap: 6px; }
  .teacher-hero { padding: 12px 16px; }
  .hero-doodle { width: 80px; height: 80px; }
  .nav-btn { flex-direction: row; gap: 7px; }
  .nav-hint { display: none; }
}

@media (orientation: landscape) and (min-width: 700px) {
  #app,
  .bottom-nav { max-width: 760px; }
  main#teacher-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-auto-rows: max-content;
    align-items: start;
    gap: 12px;
    align-content: start;
    padding-left: 20px;
    padding-right: 20px;
  }
  main#teacher-content > * { margin-bottom: 0; }
  .teacher-hero,
  .teacher-context-line,
  .requirements-strip,
  .action-card,
  .batch-card,
  .batch-tools,
  .teacher-result,
  .error-card,
  .empty-card,
  .skeleton,
  .privacy-note { grid-column: 1 / -1; }
  .teacher-hero h2 { font-size: 26px; }
  .hero-copy { max-width: 70%; }
}

/* ---------- UX20 task home, exact-scope check and editor ---------- */
.task-home .task-start-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
}

.task-start-option {
  min-height: 68px;
  justify-content: flex-start;
  text-align: left;
  padding: 12px 13px;
}

.task-start-option .task-start-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.task-start-option .task-start-copy strong { font-size: 16px; line-height: 1.2; white-space: nowrap; }
.task-start-option .task-start-copy span { font-size: 11px; line-height: 1.35; opacity: 0.88; }

.home-default-line {
  margin: 10px 0 0;
  color: var(--teacher-muted);
  font-size: 12px;
  line-height: 1.45;
}

.home-continue {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.home-continue h2 { margin: 0; font-size: 18px; line-height: 1.35; }
.home-continue-meta { margin: 0; color: var(--teacher-muted); font-size: 12px; line-height: 1.5; }
.home-links { display: grid; gap: 8px; margin-top: 12px; }

.intake-check { display: grid; gap: 10px; }
.intake-check-scope,
.intake-check-config { display: grid; gap: 6px; padding: 10px 11px; border-radius: 15px; background: #fbf8f3; border: 1px solid rgba(229, 216, 201, 0.75); }
.intake-scope-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.intake-scope-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 7px; min-height: 36px; padding: 4px 6px; border-radius: 10px; background: #fff; }
.intake-scope-index { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 999px; background: var(--teacher-blue-soft); color: var(--teacher-blue); font-size: 11px; font-weight: 700; }
.intake-scope-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.intake-scope-pages { color: var(--teacher-muted); font-size: 11px; }
.scope-conversion { display: grid; gap: 8px; }
.scope-conversion p { margin: 0; }

.mode-choice-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.intake-mode-card { position: relative; min-height: 110px; cursor: pointer; }
.intake-mode-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.intake-mode-card.is-selected { border-color: var(--teacher-blue); box-shadow: 0 0 0 2px rgba(63, 111, 158, 0.16); background: #f6faff; }
.check-actions { display: grid; gap: 6px; }
.check-actions .start-check { width: 100%; min-height: 52px; }
.check-cost-note { color: var(--teacher-muted); font-size: 11px; line-height: 1.4; text-align: center; }
.sticky-check { position: sticky; bottom: 0; padding: 8px 0 2px; background: linear-gradient(180deg, rgba(251, 247, 242, 0), var(--teacher-bg) 38%); }

.req-advanced { border: 1px solid var(--teacher-line); border-radius: 14px; padding: 8px 10px; background: #fbf8f3; }
.req-advanced > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: #5f5347; font-size: 13px; font-weight: 700; }
.req-advanced > summary::-webkit-details-marker { margin-right: 6px; }
.req-advanced[open] > summary { margin-bottom: 7px; }
.custom-settings .add-criterion { margin-top: 8px; }
.req-mode-group .desired-mode { margin-top: 2px; }

.editor-status.is-warn { background: #fdf0e6; color: #8a4f22; }
.editor-status.is-error { background: #fbe3e0; color: #8d3b35; }
.editor-status.is-ok { background: #e4f0e5; color: #3f6347; }
.editor-status.is-saving { background: #eef3f8; color: #415970; }
.editor-sheet textarea { width: 100%; min-height: 92px; }

.synthetic-example .synthetic-quote {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--teacher-blue);
  border-radius: 0 10px 10px 0;
  background: #f7fbff;
  color: #3f5367;
  font-size: 14px;
  line-height: 1.65;
}

/* One scroll surface; sheets own their own scrolling body. All action icons
   are compact 20px and every action target stays at least 44px tall. */
#teacher-content button svg,
#teacher-sheet button svg,
.teacher-header button svg,
.bottom-nav .nav-btn svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

#teacher-content button,
#teacher-sheet button,
.teacher-header button,
.bottom-nav .nav-btn {
  min-height: 44px;
}

@media (max-width: 359px) {
  .task-home .task-start-grid { grid-template-columns: minmax(0, 1fr); }
  .mode-choice-grid { grid-template-columns: minmax(0, 1fr); }
  .intake-check-scope, .intake-check-config { padding: 8px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .task-home .task-start-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .task-start-option { min-height: 56px; }
  .check-actions .start-check { min-height: 46px; }
  .sticky-check { position: sticky; bottom: 0; }
}

/* ---------- UX20.3 shared result views, human review, preview ---------- */
.result-head-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.human-review-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 999px; background: #eef3f8; color: #415970; font-size: 10px; font-weight: 700; }
.human-review-pill.is-confirmed { background: #e4f0e5; color: #3f6347; }
.human-review-pill.is-stale, .human-review-pill.is-unavailable { background: #fdf0e6; color: #8a4f22; }
.result-view-nav {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--teacher-line);
  border-radius: 14px;
  background: rgba(251, 247, 242, 0.96);
  backdrop-filter: blur(6px);
}
.result-view-tab { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: #55483c; font-size: 12px; font-weight: 700; }
.result-view-tab[aria-current="true"] { background: #fff; color: var(--teacher-blue); box-shadow: 0 1px 6px rgba(75, 58, 43, 0.12); }
.result-view { scroll-margin-top: 70px; display: grid; gap: 9px; padding: 4px 0 2px; }
.result-view-head h2 { margin: 0; font-size: 19px; line-height: 1.35; }
.result-view-head .card-eyebrow { margin-bottom: 1px; }
.result-context { display: grid; gap: 7px; padding: 9px 10px; border: 1px solid rgba(229, 216, 201, 0.8); border-radius: 14px; background: #fbf8f3; }
.result-context-label { margin: 0; color: var(--teacher-muted); font-size: 11px; font-weight: 700; }
.result-context-text { margin: 0; font-size: 12px; line-height: 1.55; }
.result-context-warning { margin: 0; color: #8a4f22; font-size: 11px; line-height: 1.5; }
.result-context-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.result-context .photo-details { margin-top: 2px; }
.human-review-line { margin: 0; font-size: 12px; line-height: 1.5; color: var(--teacher-muted); }
.human-review-line.is-confirmed { color: #3f6347; }
.human-review-line.is-unavailable, .human-review-line.is-stale { color: #8a4f22; }
.human-review-note { margin: 0; font-size: 13px; line-height: 1.6; }
.human-review-note.is-warn { color: #8a4f22; }
.human-review-confirmed { margin: 0; padding: 8px 10px; border-radius: 12px; background: #e4f0e5; color: #3f6347; font-size: 13px; line-height: 1.5; }
.result-editor-entry-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.comment-number { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #f0ece5; color: #6b5548; font-size: 10px; font-weight: 700; }
.ai-original { border: 1px solid var(--teacher-line); border-radius: 12px; padding: 7px 10px; background: #fff; }
.ai-original > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-size: 13px; font-weight: 700; }
.ai-original-overall { margin: 4px 0; font-size: 13px; line-height: 1.6; }
.ai-original-comments { margin: 4px 0 2px; padding-left: 18px; font-size: 12px; line-height: 1.55; }

.result-editor-sheet { max-height: none; }
.result-editor { display: grid; gap: 10px; }
.result-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.result-editor-head h3 { margin: 0; font-size: 18px; line-height: 1.4; }
.human-review-revision { flex: 0 0 auto; padding: 3px 8px; border-radius: 999px; background: #eef3f8; color: #415970; font-size: 11px; font-weight: 700; }
.result-editor-field { display: grid; gap: 5px; }
.result-editor-field label { font-size: 12px; font-weight: 700; }
.result-editor-ai { margin: 0; padding: 6px 8px; border-radius: 9px; background: #f6f1ea; color: #6b5f53; font-size: 11px; line-height: 1.5; }
.result-editor-quote { margin: 0; font-size: 12px; line-height: 1.5; color: #415970; }
.result-editor-group { display: grid; gap: 9px; margin: 0; padding: 8px 10px; border: 1px solid var(--teacher-line); border-radius: 14px; background: #fff; }
.result-editor-group > legend { padding: 0 4px; font-size: 12px; font-weight: 700; }
.result-editor-dimension-title { margin: 0; font-size: 13px; font-weight: 700; }
.result-editor-status { margin: 0; padding: 8px 10px; border-radius: 12px; background: #eef3f8; font-size: 12px; line-height: 1.55; }
.result-editor-status.is-warn { background: #fdf0e6; color: #8a4f22; }
.result-editor-status.is-error { background: #fbe3e0; color: #8d3b35; }
.result-editor-status.is-ok { background: #e4f0e5; color: #3f6347; }
.result-editor-status.is-saving { background: #eef3f8; color: #415970; }
.result-editor-frozen-note { margin: 0; padding: 8px 10px; border-radius: 12px; background: #fdf0e6; color: #8a4f22; font-size: 12px; line-height: 1.5; }
.result-editor[data-frozen="true"] textarea[readonly] { background: #f7f8fa; }
.result-editor-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.result-editor-actions .primary { order: -1; }
.result-editor-list { display: grid; gap: 6px; border: 1px solid var(--teacher-line); border-radius: 14px; padding: 8px 10px; background: #fff; }
.result-editor-list h4 { margin: 0; font-size: 12px; }
.result-editor-list-rows { display: grid; gap: 6px; }
.result-editor-list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.result-editor-list-row input { min-width: 0; }
.result-editor-ignore { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.result-editor-correction.is-ignored { background: #fbf8f3; }
.result-editor-correction textarea:disabled { opacity: 0.55; background: #f4efe8; }

.export-preview { display: grid; gap: 8px; }
.export-preview-summary { margin: 0; font-weight: 700; font-size: 13px; }
.export-preview-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; max-height: 46vh; overflow: auto; }
.export-preview-row { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 3px 6px; align-items: center; padding: 6px 7px; border-radius: 10px; background: #fbf8f3; }
.export-preview-index { grid-row: span 2; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 999px; background: var(--teacher-blue-soft); color: var(--teacher-blue); font-size: 11px; font-weight: 700; }
.export-preview-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.export-preview-meta { font-size: 11px; color: var(--teacher-muted); }
.export-preview-token { margin: 0; color: var(--teacher-muted); font-size: 10px; }
.export-preview-warning { margin: 0; padding: 7px 9px; border-radius: 10px; background: #fdf0e6; color: #8a4f22; font-size: 12px; line-height: 1.5; }
.confirm-scope { display: grid; gap: 8px; }
.confirm-scope-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; max-height: 40vh; overflow: auto; }
.confirm-scope-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 6px 7px; border-radius: 10px; background: #fbf8f3; }
.confirm-scope-index { display: inline-flex; align-items: center; justify-content: center; width: 21px; height: 21px; border-radius: 999px; background: var(--teacher-blue-soft); color: var(--teacher-blue); font-size: 11px; font-weight: 700; }
.confirm-scope-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.confirm-scope-meta { color: var(--teacher-muted); font-size: 11px; }
.confirm-scope-ack { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; line-height: 1.5; }
.confirm-scope-ack input { margin-top: 2px; }

@media (max-width: 359px) {
  .result-view-nav { grid-template-columns: 1fr; }
  .result-view-tab { min-height: 40px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   VIS21 fixed visual system (Root-owned specification)
   ============================================================ */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background: var(--teacher-bg);
  color: var(--teacher-ink);
}

#app { background: var(--teacher-bg); }

/* Header and navigation */
.teacher-header.app-header {
  background: #fff;
  border-bottom: 1px solid var(--teacher-line);
  box-shadow: none;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  gap: 10px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.teacher-topline { min-height: 48px; }

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--teacher-bg);
  box-shadow: inset 0 0 0 1px var(--teacher-line);
}

.teacher-brand-text h1 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
}

.teacher-brand-text p { font-size: 13px; line-height: 1.55; }

.icon-btn { font-size: 12px; color: var(--teacher-muted); }

.context-essay,
.context-action {
  background: #fff;
  border: 1px solid var(--teacher-line);
  border-radius: 14px;
  box-shadow: none;
}

.context-essay { font-size: 15px; padding: 8px 12px; }
.context-action { font-size: 12px; }
.context-essay svg,
.context-action svg { color: var(--teacher-primary-ink); }

main#teacher-content {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--teacher-nav) + 32px + env(safe-area-inset-bottom));
  scroll-padding-bottom: calc(var(--teacher-nav) + 24px);
  background: var(--teacher-bg);
}

.bottom-nav {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  background: #fff;
  border-top: 1px solid var(--teacher-line);
  box-shadow: none;
  height: calc(var(--teacher-nav) + env(safe-area-inset-bottom));
}

.nav-btn {
  min-height: 64px;
  gap: 3px;
  padding: 6px 8px;
  color: var(--teacher-muted);
  font-size: 13px;
}

.nav-btn .nav-label { font-size: 13px; line-height: 1.25; }
.nav-btn .nav-hint {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.nav-btn.active { color: var(--teacher-primary-ink); }
.bottom-nav .nav-btn.active { background: var(--teacher-selected); }
.nav-btn.active svg { filter: none; }

/* Shared cards, headings and helpers */
.teacher-card,
.teacher-result,
.settings-card {
  background: #fff;
  border: 1px solid var(--teacher-line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(40, 44, 46, 0.04);
  padding: 16px;
  margin-bottom: 16px;
}

.teacher-card h2,
.teacher-result h2 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
}

.hero-eyebrow,
.card-eyebrow {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: 0.06em;
  color: var(--teacher-muted);
}

.teacher-pill {
  min-height: 28px;
  padding: 3px 9px;
  background: #eef1f2;
  color: var(--teacher-muted);
  font-size: 13px;
  font-weight: 600;
}
.teacher-pill.is-ok { background: var(--teacher-green-soft); color: var(--teacher-green); }
.teacher-pill.is-soft { background: #eef1f2; color: var(--teacher-unavailable); }
.teacher-pill.is-warn { background: var(--teacher-amber-soft); color: var(--teacher-amber); }
.teacher-pill.is-error { background: var(--teacher-red-soft); color: var(--teacher-error); }
.teacher-pill.is-comment { background: var(--teacher-blue-soft); color: var(--teacher-blue); }

.mini-button {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #f1f3f4;
  color: var(--teacher-primary-ink);
  font-size: 14px;
}

/* Workspace hero */
.teacher-hero {
  background: #fff;
  border: 1px solid var(--teacher-line);
  border-radius: 18px;
  box-shadow: none;
  padding: 16px;
  overflow: visible;
}
.teacher-hero h2 { font-size: 24px; font-weight: 700; line-height: 1.3; }
.hero-copy { max-width: 100%; }
.hero-lead { margin: 0 0 12px; color: var(--teacher-muted); font-size: 16px; line-height: 1.6; }
.hero-doodle, .doodle-sun, .doodle-leaf, .doodle-dot { display: none; }
.action-card { background: #fff; }

/* Home task cards */
.teacher-start.task-home {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 8px 0 0;
  margin-bottom: 24px;
}

.teacher-start.task-home h2 {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--teacher-ink);
}

.teacher-start.task-home .hero-lead {
  margin: 0 0 24px;
  max-width: 72ch;
  font-size: 16px;
  line-height: 1.6;
  color: var(--teacher-muted);
}

.task-home .task-start-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.task-start-card { position: relative; display: flex; min-height: 128px; border-radius: 20px; }
#teacher-content .task-start-card { min-height: 128px; }

.task-start-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  gap: 16px;
  min-height: 128px;
  padding: 20px 128px 20px 20px;
  border-radius: 20px;
  text-align: left;
  color: var(--teacher-ink);
  box-shadow: none;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

#teacher-content .task-start-option { min-height: 128px; }

.task-start-single { background: var(--teacher-selected); border: 1px solid rgba(0, 127, 139, 0.2); }
.task-start-batch { background: var(--teacher-batch); border: 1px solid rgba(133, 85, 0, 0.18); }

.task-start-option .task-start-copy { display: grid; gap: 6px; flex: 1 1 auto; min-width: 0; }
.task-start-option .task-start-copy strong {
  font-size: 22px;
  line-height: 24px;
  font-weight: 700;
  white-space: normal;
  color: var(--teacher-ink);
}
.task-start-option .task-start-copy span { font-size: 13px; line-height: 1.55; color: var(--teacher-muted); opacity: 1; }

.task-start-visual {
  position: absolute;
  top: 50%;
  right: 20px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transform: translateY(-50%);
  pointer-events: none;
}
.task-illustration { display: block; width: 80px; height: 80px; }
.task-start-arrow { width: 22px; height: 22px; color: var(--teacher-primary-ink); }
.task-start-batch .task-start-arrow { color: #855500; }
#teacher-content .task-start-visual .task-illustration { width: 80px; height: 80px; }
#teacher-content .task-start-visual .task-start-arrow { width: 22px; height: 22px; }

.task-start-option:active { transform: translateY(1px); }
.task-start-option:focus-visible { outline: 3px solid var(--teacher-primary-ink); outline-offset: 2px; }

.task-home .home-default-line { margin: 16px 0 0; font-size: 13px; line-height: 1.55; color: var(--teacher-muted); }
.task-home .home-continue { margin-top: 24px; padding: 16px; border-radius: 18px; }
.home-continue h2 { font-size: 20px; font-weight: 600; }
.home-continue-meta { font-size: 13px; }

.task-home .home-links { display: grid; gap: 12px; margin-top: 24px; }
.task-home .home-link-secondary {
  min-height: 52px;
  background: #fff;
  border: 1px solid var(--teacher-line);
  border-radius: 14px;
  color: var(--teacher-ink);
  font-size: 16px;
  font-weight: 600;
  box-shadow: none;
}
.task-home .home-link-secondary svg { color: var(--teacher-primary-ink); }
.task-home .home-link-quiet {
  min-height: 44px;
  padding: 8px 4px;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--teacher-muted);
  font-size: 13px;
  font-weight: 600;
}

/* Sheets and forms */
.teacher-sheet-backdrop { background: rgba(40, 44, 46, 0.34); backdrop-filter: none; -webkit-backdrop-filter: none; }
.teacher-sheet-panel {
  max-width: 720px;
  background: var(--teacher-bg);
  border-radius: 24px 24px 0 0;
  animation-duration: 140ms;
}
.teacher-sheet-head { background: #fff; border-bottom: 1px solid var(--teacher-line); padding: 12px 16px; }
.teacher-sheet-head h2 { font-size: 20px; font-weight: 700; }
.sheet-close { background: var(--teacher-bg); color: var(--teacher-ink); }
.teacher-sheet-body {
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  scroll-padding-bottom: calc(120px + env(safe-area-inset-bottom));
}
.sheet-stack { gap: 16px; }

.requirements-form { display: grid; gap: 24px; max-width: 720px; margin: 0 auto; }
.req-group {
  margin: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--teacher-line);
  border-radius: 18px;
  box-shadow: none;
}
.req-group legend { padding: 0 4px; font-size: 20px; font-weight: 700; line-height: 1.4; color: var(--teacher-ink); }
.req-select-row label { color: var(--teacher-ink); font-size: 15px; font-weight: 600; }

/* VIS2105 app-drawn requirement chooser (no native select, no second sheet) */
.req-select-button {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--teacher-line);
  border-radius: 14px;
  box-shadow: none;
  color: var(--teacher-ink);
  font-size: 16px;
  line-height: 1.45;
  text-align: left;
}
.req-select-button:hover { border-color: rgba(0, 127, 139, 0.35); }
.req-select-button:focus-visible { outline: 3px solid var(--teacher-primary-ink); outline-offset: 2px; }
.req-select-name { flex: 0 1 auto; font-weight: 600; }
.req-select-current {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--teacher-primary-ink);
  font-weight: 600;
}
.req-select-value { max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-select-value.is-placeholder { color: var(--teacher-muted); }
.req-select-button svg { width: 18px; height: 18px; flex: 0 0 auto; }

.req-choice-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.req-choice-backdrop { position: absolute; inset: 0; background: rgba(40, 44, 46, 0.42); }
.req-choice-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  background: #fff;
  border-radius: var(--teacher-radius);
  box-shadow: 0 24px 60px rgba(40, 44, 46, 0.28);
  overflow: hidden;
  animation: teacher-choice-in 140ms ease-out;
}
@keyframes teacher-choice-in {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.req-choice-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 10px 18px;
  border-bottom: 1px solid var(--teacher-line);
  background: #fff;
}
.req-choice-title { margin: 0; color: var(--teacher-ink); font-size: 18px; font-weight: 700; line-height: 1.3; }
.req-choice-close {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: var(--teacher-bg);
  color: var(--teacher-ink);
}
.req-choice-close svg { width: 20px; height: 20px; }
.req-choice-search-field { margin: 12px 14px 0; background: #f7f8f9; }
.req-choice-search-field input { flex: 1 1 auto; min-width: 0; }
.req-choice-list {
  margin: 8px 0 0;
  padding: 6px 8px 12px;
  max-height: 55dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: grid;
  gap: 2px;
}
.req-choice-row {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: none;
  color: var(--teacher-ink);
  font-size: 16px;
  line-height: 1.4;
  text-align: left;
}
.req-choice-row:hover { background: #f7f8f9; }
.req-choice-row.is-current {
  background: var(--teacher-selected);
  border-color: rgba(0, 127, 139, 0.25);
  color: var(--teacher-primary-ink);
}
.req-choice-row:focus-visible { outline: 3px solid var(--teacher-primary-ink); outline-offset: -1px; }
.req-choice-row-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.req-choice-row-meta { flex: 0 0 auto; color: var(--teacher-muted); font-size: 13px; }
.req-choice-check { flex: 0 0 auto; display: inline-flex; color: var(--teacher-primary-ink); }
.req-choice-check svg { width: 20px; height: 20px; }

/* The sheet-wide compact 44px button floor is intentionally raised for the
   app-drawn requirement controls and every choice row. */
#teacher-sheet .req-select-button,
#teacher-sheet .req-choice-row { min-height: 48px; }

@media (max-width: 480px) {
  .req-choice-layer { padding: 10px; }
  .req-choice-panel { width: 100%; max-height: calc(100dvh - 20px); }
}

.field { margin-top: 16px; }
.field:first-of-type { margin-top: 12px; }
.field label, .field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--teacher-ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
}
.field input, .field textarea, .field select {
  min-height: 48px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--teacher-line);
  border-radius: 14px;
  color: var(--teacher-ink);
  font-size: 16px;
  line-height: 1.6;
}
.field textarea { min-height: 120px; }
.field-hint { margin: 6px 0 0; color: var(--teacher-muted); font-size: 13px; line-height: 1.55; }

.segmented { gap: 4px; padding: 4px; background: #eef1f2; border-radius: 14px; }
.segment { min-height: 48px; border-radius: 10px; color: var(--teacher-muted); font-size: 16px; font-weight: 600; }
.segment.is-active { background: var(--teacher-selected); color: var(--teacher-primary-ink); border: 1px solid rgba(0, 127, 139, 0.3); box-shadow: none; }
.segment:focus-within { outline: 3px solid var(--teacher-primary-ink); outline-offset: 2px; }
.dimension-preview .teacher-pill { font-size: 13px; }
.criterion-row { background: #f7f8f9; border-color: var(--teacher-line); border-radius: 14px; }
.criterion-fields input { min-height: 44px; font-size: 16px; }
.add-criterion { min-height: 48px; background: #fff; border: 1px solid var(--teacher-line); color: var(--teacher-primary-ink); font-size: 16px; }
.icon-action { border-radius: 12px; }
.req-advanced { background: #f7f8f9; border-color: var(--teacher-line); border-radius: 14px; }
.req-advanced > summary { min-height: 44px; color: var(--teacher-ink); font-size: 15px; }
.form-status { background: var(--teacher-red-soft); color: var(--teacher-error); font-size: 13px; line-height: 1.55; }
.sheet-footer { gap: 12px; }
.sheet-footer.sticky { background: linear-gradient(180deg, rgba(244, 245, 247, 0), var(--teacher-bg) 42%); padding: 12px 0 calc(2px + env(safe-area-inset-bottom)); }
.requirements-form > .sheet-footer.sticky {
  background: var(--teacher-bg);
  z-index: 5;
  border-top: 1px solid var(--teacher-line);
  box-shadow: 0 32px 0 var(--teacher-bg);
}
.sheet-footer button { min-height: 52px; border-radius: 14px; font-size: 16px; line-height: 1.35; white-space: normal; }
.save-requirements { gap: 8px; }

#teacher-content button.primary,
#teacher-sheet button.primary,
.teacher-sheet button.primary {
  background: var(--teacher-primary);
  border: 1px solid var(--teacher-primary);
  color: #fff;
}
#teacher-content button.secondary,
#teacher-sheet button.secondary,
.teacher-sheet button.secondary {
  background: #fff;
  border: 1px solid var(--teacher-line);
  color: var(--teacher-primary-ink);
  box-shadow: none;
}

/* Working-page summaries and progress */
.teacher-context-line {
  min-height: 56px;
  background: #fff;
  border: 1px solid var(--teacher-line);
  box-shadow: none;
}
.context-line-meta { font-size: 13px; }
.context-line-actions .mini-button { min-height: 44px; font-size: 13px; }
.requirements-strip {
  background: #f7f8f9;
  border: 1px solid var(--teacher-line);
  color: var(--teacher-muted);
  font-size: 13px;
  line-height: 1.55;
}
.requirements-strip-label { background: #fff; font-size: 12px; }
.requirements-strip .mini-button { min-height: 44px; font-size: 13px; }
.requirements-strip.is-warning { background: var(--teacher-amber-soft); }

.batch-card { border-color: var(--teacher-line); }
.batch-card.warn { background: #fff; border-color: rgba(133, 85, 0, 0.3); }
.batch-card.error { background: #fff; border-color: rgba(161, 45, 58, 0.3); }
.batch-card.ok { background: #fff; border-color: rgba(39, 103, 73, 0.3); }
.progress-track { background: #eef1f2; }
.progress-fill { background: var(--teacher-primary); }
.batch-message { font-size: 13px; }
.batch-entry { background: #f7f8f9; font-size: 14px; }
.batch-entry-state { font-size: 13px; }
.batch-entry-message, .batch-entry-more { font-size: 13px; }
.batch-mini { background: #f7f8f9; border-color: var(--teacher-line); }
.batch-mini summary { color: var(--teacher-muted); font-size: 14px; }
.batch-mini-line { color: var(--teacher-muted); font-size: 13px; }
.batch-tools-row { background: #f7f8f9; font-size: 14px; }
.batch-tools-note { font-size: 13px; }
.batch-tools-state { font-size: 13px; }

.repair-banner,
.input-banner,
.source-sync-banner,
.stale-banner,
.editorial-note {
  background: var(--teacher-amber-soft);
  border: 1px solid rgba(133, 85, 0, 0.18);
  color: var(--teacher-amber);
}
.repair-banner p, .input-banner p, .source-sync-banner p, .stale-banner p, .editorial-note p { font-size: 13px; line-height: 1.55; }
.legacy-banner { background: var(--teacher-blue-soft); border: 1px solid rgba(36, 99, 173, 0.16); color: #1f4d86; }
.legacy-banner p { font-size: 13px; }
.legacy-confirmed-note { background: var(--teacher-green-soft); color: var(--teacher-green); font-size: 13px; }
.legacy-confirm { background: #f7f8f9; border-color: var(--teacher-line); }
.legacy-confirm-copy, .legacy-audit-check { font-size: 13px; }
.legacy-audit-check input { accent-color: var(--teacher-primary); }

/* Result reading and review */
.teacher-result { background: #fff; }
.result-head h2 { font-size: 20px; }
.human-review-pill { background: #eef1f2; color: var(--teacher-unavailable); font-size: 13px; }
.human-review-pill.is-confirmed { background: var(--teacher-green-soft); color: var(--teacher-green); }
.human-review-pill.is-stale, .human-review-pill.is-unavailable { background: var(--teacher-amber-soft); color: var(--teacher-amber); }
.human-review-line { color: var(--teacher-muted); font-size: 13px; line-height: 1.55; }
.human-review-line.is-confirmed { color: var(--teacher-green); }
.human-review-line.is-unavailable, .human-review-line.is-stale { color: var(--teacher-amber); }
.human-review-note { font-size: 14px; line-height: 1.6; }
.human-review-confirmed { background: var(--teacher-green-soft); color: var(--teacher-green); font-size: 13px; }

.result-view-nav {
  background: #fff;
  border: 1px solid var(--teacher-line);
  box-shadow: 0 1px 2px rgba(40, 44, 46, 0.04);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.result-view-tab { color: var(--teacher-muted); font-size: 13px; }
.result-view-tab[aria-current="true"] {
  background: var(--teacher-selected);
  border-bottom: 3px solid var(--teacher-primary);
  color: var(--teacher-primary-ink);
  box-shadow: none;
}
.result-view { scroll-margin-top: 84px; }
.result-view[hidden] { display: none !important; }
.result-view-head h2 { font-size: 24px; font-weight: 700; }
.result-top-row {
  position: static;
  display: flex;
  justify-content: flex-end;
  margin: 12px 0;
}
.result-top-button {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(40, 44, 46, 0.14);
}
.result-context { background: #f7f8f9; border-color: var(--teacher-line); }
.result-context-label { color: var(--teacher-muted); font-size: 13px; }
.result-context-text { font-size: 14px; line-height: 1.6; }
.result-context-warning { color: var(--teacher-amber); font-size: 13px; }

.paragraph-label { color: var(--teacher-muted); font-size: 13px; }
.paragraph-text { max-width: 72ch; font-size: 17px; line-height: 1.85; }
.annotation-legend { background: #f7f8f9; color: var(--teacher-muted); font-size: 13px; }
.legend-item.comment .legend-swatch { background: var(--teacher-blue-soft); border-bottom: 2px solid var(--teacher-blue); }
.legend-item.correction .legend-swatch { background: var(--teacher-red-soft); border-bottom: 2px solid var(--teacher-red); }
.annotation.is-comment { background: var(--teacher-blue-soft); border-bottom: 2px solid var(--teacher-blue); }
.annotation.is-correction { background: var(--teacher-red-soft); border-bottom: 2px solid var(--teacher-red); }
.annotation.is-overlap { background: linear-gradient(180deg, var(--teacher-blue-soft) 55%, var(--teacher-red-soft) 55%); border-bottom: 2px solid var(--teacher-red); }
.annotation:focus-visible { outline: 3px solid var(--teacher-primary-ink); outline-offset: 2px; }

.correction-details, .comment-details { background: #f7f8f9; border-color: var(--teacher-line); }
.correction-details summary, .comment-details summary { color: var(--teacher-red); font-size: 13px; }
.comment-details summary { color: var(--teacher-blue); }
.correction-item, .comment-item { border-top-color: var(--teacher-line); }
.correction-quote, .comment-quote { font-size: 14px; line-height: 1.6; }
.correction-suggestion { color: var(--teacher-green); font-size: 14px; }
.correction-reason, .comment-praise { color: var(--teacher-muted); font-size: 13px; line-height: 1.6; }
.comment-meta { color: var(--teacher-muted); font-size: 13px; }
.comment-number { background: #eef1f2; color: var(--teacher-ink); font-size: 12px; }

.overall-evaluation { margin-top: 24px; padding: 16px; background: #f7f8f9; border: 1px solid var(--teacher-line); border-radius: 18px; }
.overall-head h2 { font-size: 20px; }
.overall-mark { background: #fff; color: var(--teacher-primary-ink); }
.overall-text { max-width: 72ch; font-size: 16px; line-height: 1.75; }
.dimension-item { background: #fff; border: 1px solid var(--teacher-line); border-radius: 14px; }
.dimension-item dt { color: var(--teacher-muted); font-size: 13px; }
.dimension-item dd { font-size: 16px; line-height: 1.6; }
.dimension-level { color: var(--teacher-blue); }
.dimension-reason { color: var(--teacher-ink); }
.evaluation-list h3 { font-size: 16px; }
.evaluation-list li { font-size: 16px; line-height: 1.65; }
.result-actions button { min-height: 48px; font-size: 16px; }
.result-notes { background: #f7f8f9; }
.result-notes summary { color: var(--teacher-muted); font-size: 13px; }
.result-notes ul { font-size: 13px; }

/* Editor and export preview */
.result-editor { gap: 16px; }
.result-editor-head h3 { font-size: 20px; }
.human-review-revision { background: #eef1f2; color: var(--teacher-unavailable); font-size: 13px; }
.result-editor-field label { color: var(--teacher-ink); font-size: 15px; }
.result-editor-field input, .result-editor-field textarea,
.result-editor-group input, .result-editor-group textarea, .result-editor-group select {
  min-height: 48px;
  background: #fff;
  border: 1px solid var(--teacher-line);
  border-radius: 14px;
  color: var(--teacher-ink);
  font-size: 16px;
  line-height: 1.6;
}
.result-editor-field textarea { min-height: 120px; }
.result-editor-ai { background: #f7f8f9; color: var(--teacher-muted); font-size: 13px; }
.result-editor-quote { color: var(--teacher-blue); font-size: 13px; }
.result-editor-group { background: #f7f8f9; border-color: var(--teacher-line); border-radius: 16px; padding: 12px; }
.result-editor-group > legend { color: var(--teacher-ink); font-size: 16px; }
.result-editor-dimension-title { font-size: 15px; }
.result-editor-status { background: #eef1f2; color: var(--teacher-unavailable); font-size: 13px; line-height: 1.55; }
.result-editor-status.is-warn { background: var(--teacher-amber-soft); color: var(--teacher-amber); }
.result-editor-status.is-error { background: var(--teacher-red-soft); color: var(--teacher-error); }
.result-editor-status.is-ok { background: var(--teacher-green-soft); color: var(--teacher-green); }
.result-editor-status.is-saving { background: var(--teacher-blue-soft); color: var(--teacher-blue); }
.result-editor-frozen-note { background: var(--teacher-amber-soft); color: var(--teacher-amber); font-size: 13px; }
.result-editor-actions button { min-height: 48px; font-size: 16px; }
.result-editor-list { background: #fff; border-color: var(--teacher-line); }
.result-editor-list h4 { font-size: 13px; }
.result-editor-ignore { font-size: 13px; }
.result-editor-correction.is-ignored { background: #f7f8f9; }

.export-preview-summary { font-size: 16px; }
.export-preview-list { max-height: 44vh; }
.export-preview-row { background: #f7f8f9; border-radius: 12px; padding: 8px; }
.export-preview-index { background: var(--teacher-blue-soft); color: var(--teacher-blue); font-size: 12px; }
.export-preview-title { font-size: 16px; }
.export-preview-meta { color: var(--teacher-muted); font-size: 13px; }
.export-preview-warning { background: var(--teacher-amber-soft); color: var(--teacher-amber); font-size: 13px; }
.export-preview-token { font-size: 13px; }

/* Picker and account */
.search-field { background: #fff; border: 1px solid var(--teacher-line); border-radius: 14px; }
.search-field input { font-size: 16px; }
.search-field:focus-within { outline: 3px solid var(--teacher-primary-ink); outline-offset: 2px; }
.picker-count { color: var(--teacher-muted); font-size: 13px; }
.picker-tool { min-height: 44px; background: #f1f3f4; color: var(--teacher-primary-ink); font-size: 13px; border-radius: 12px; }
.picker-list { max-height: min(48dvh, 430px); }
.picker-item { background: #fff; border: 1px solid var(--teacher-line); border-radius: 14px; }
.picker-item.is-viewing { border-color: var(--teacher-primary); }
.picker-item.is-checked { background: var(--teacher-selected); border-color: rgba(0, 127, 139, 0.45); }
.picker-check-mark { background: #fff; border-color: #b8c0c4; }
.picker-checkbox:checked + .picker-check-mark { background: var(--teacher-primary); border-color: var(--teacher-primary); }
.picker-copy strong { font-size: 16px; }
.picker-meta { font-size: 13px; }
.picker-links button { min-height: 48px; font-size: 14px; }
.picker-footer .picker-action { min-height: 52px; font-size: 16px; }
.settings-card { background: #fff; border: 1px solid var(--teacher-line); border-radius: 18px; box-shadow: none; }
.settings-card.soft { background: #f7f8f9; }
.settings-card h3 { font-size: 20px; }
.settings-note, .balance-result { font-size: 13px; }
.text-link { color: var(--teacher-primary-ink); font-size: 14px; }

/* Misc */
.teacher-toast { background: #282c2e; font-size: 13px; line-height: 1.5; }
.teacher-toast.is-warn { background: #855500; }
.teacher-toast.is-ok { background: #276749; }
.teacher-toast.is-soft { background: #58646b; }
.privacy-note { color: var(--teacher-muted); font-size: 13px; }
.privacy-note svg { color: var(--teacher-green); }
.skeleton-line { background: #eef1f2; animation: none; }
.picker-empty, .loading-line { font-size: 13px; color: var(--teacher-muted); }

/* Focus and interaction */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 3px solid var(--teacher-primary-ink);
  outline-offset: 2px;
}

@media (min-width: 600px) {
  .task-home .task-start-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 359px) {
  main#teacher-content { padding-top: 12px; padding-left: 12px; padding-right: 12px; }
  .teacher-start.task-home { padding-top: 0; }
  .teacher-start.task-home h2 { font-size: 24px; }
  .teacher-start.task-home .hero-lead { margin-bottom: 12px; }
  .task-home .task-start-grid { gap: 8px; }
  .intake-progress { margin-bottom: 8px; padding: 6px 4px; }
  .task-start-card { min-height: 128px; }
  #teacher-content .task-start-card { min-height: 128px; }
  .task-start-option { min-height: 128px; padding: 12px 118px 12px 12px; gap: 10px; }
  #teacher-content .task-start-option { min-height: 128px; }
  .task-start-visual { right: 12px; }
  .task-home .task-start-grid { gap: 12px; }
  .teacher-sheet-body { padding-left: 12px; padding-right: 12px; }
  .req-group { padding: 12px; }
  .teacher-card, .teacher-result { padding: 12px; }
  .result-view-tab { min-height: 44px; font-size: 13px; }
}

@media (orientation: landscape) and (max-height: 420px) {
  .teacher-start.task-home h2 { font-size: 24px; margin-bottom: 6px; }
  .teacher-start.task-home .hero-lead { margin-bottom: 16px; }
  .task-start-card { min-height: 96px; }
  #teacher-content .task-start-card { min-height: 96px; }
  .task-start-option { min-height: 96px; padding: 16px 120px 16px 16px; }
  #teacher-content .task-start-option { min-height: 96px; }
  .task-start-visual { right: 16px; }
  .task-start-option .task-start-copy strong { font-size: 20px; }
  .teacher-header.app-header { padding-top: calc(5px + env(safe-area-inset-top)); padding-bottom: 6px; gap: 6px; }
  .teacher-sheet { align-items: center; padding: 10px; }
  .teacher-sheet-panel { max-height: calc(100dvh - 20px); border-radius: 22px; }
}

@media (orientation: landscape) and (min-width: 700px) {
  main#teacher-content {
    display: block;
    grid-template-columns: none;
    align-items: initial;
    align-content: initial;
  }
}

@media (min-width: 1024px) {
  #app { max-width: 1100px; }
  .bottom-nav { max-width: 1100px; }
  main#teacher-content { padding-left: 24px; padding-right: 24px; }
  .teacher-sheet-panel { max-width: 720px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  button:not(:disabled):active,
  .task-start-option:active { transform: none !important; }
}

/* ============================================================
   VIS2103 task history sidebar and scoped workspace
   ============================================================ */
.bottom-nav,
.bottom-nav[data-role="legacy-global-nav"] { display: none !important; }

main#teacher-content {
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  scroll-padding-bottom: 24px;
}

.teacher-header-tasks {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.teacher-header-task {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 13px;
  border: 1px solid var(--teacher-line);
  background: #fff;
  color: var(--teacher-primary-ink);
  font-size: 13px;
  font-weight: 600;
}

.teacher-header-task svg { width: 19px; height: 19px; }

.task-sidebar-close,
.task-sidebar-new,
.task-expand,
.task-mode,
.task-all,
.task-context-mode {
  min-height: 44px;
}

.teacher-task-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 54;
  width: min(88vw, 340px);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
  background: #fff;
  border-right: 1px solid var(--teacher-line);
  box-shadow: 0 18px 48px rgba(40, 44, 46, 0.18);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(-105%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 160ms ease, visibility 160ms ease;
}

.teacher-task-sidebar.is-open {
  transform: none;
  visibility: visible;
  pointer-events: auto;
}

.teacher-task-sidebar:focus { outline: none; }

.task-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.task-sidebar-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
}

.task-sidebar-close {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--teacher-line);
  background: var(--teacher-bg);
  color: var(--teacher-ink);
}

.task-sidebar-close svg { width: 20px; height: 20px; }

.task-sidebar-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 13px;
  background: var(--teacher-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.task-sidebar-new svg { width: 18px; height: 18px; }

.task-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.task-empty {
  margin: 6px 2px;
  color: var(--teacher-muted);
  font-size: 13px;
}

.task-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 4px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 14px;
}

.task-row.is-current {
  background: var(--teacher-selected);
  border-color: rgba(0, 127, 139, 0.22);
}

.task-open {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 4px 3px;
  text-align: left;
  background: transparent;
  color: var(--teacher-ink);
}

.task-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.task-meta {
  color: var(--teacher-muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.task-expand {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--teacher-line);
  color: var(--teacher-primary-ink);
}

.task-expand svg {
  width: 20px;
  height: 20px;
  transition: transform 120ms ease;
}

.task-row.is-expanded .task-expand svg { transform: rotate(180deg); }

.task-modes {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding-top: 2px;
}

.task-mode {
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid var(--teacher-line);
  background: #fff;
  color: var(--teacher-primary-ink);
  font-size: 13px;
  font-weight: 600;
}

.task-delete {
  flex: 1 1 100%;
  width: 100%;
  min-height: 44px;
}

.task-all {
  width: 100%;
  padding: 9px 12px;
  border-radius: 13px;
  border: 1px solid var(--teacher-line);
  background: var(--teacher-bg);
  color: var(--teacher-ink);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.task-all[aria-current="true"] {
  background: var(--teacher-selected);
  border-color: rgba(0, 127, 139, 0.22);
  color: var(--teacher-primary-ink);
}

.task-all:disabled {
  color: var(--teacher-muted);
  opacity: 0.7;
}

.teacher-task-backdrop {
  position: fixed;
  inset: 0;
  z-index: 53;
  background: rgba(40, 44, 46, 0.32);
}

body.teacher-drawer-open { overflow: hidden; }

.task-context-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--teacher-line);
}

.task-context-main {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.task-context-eyebrow {
  color: var(--teacher-muted);
  font-size: 12px;
  line-height: 1.3;
}

.task-context-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 16px;
  line-height: 1.35;
}

.task-context-meta {
  color: var(--teacher-muted);
  font-size: 12px;
  line-height: 1.4;
}

.task-context-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.task-context-mode {
  min-width: 52px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--teacher-line);
  background: #fff;
  color: var(--teacher-muted);
  font-size: 13px;
}

.task-context-mode.is-current {
  background: var(--teacher-selected);
  border-color: rgba(0, 127, 139, 0.24);
  color: var(--teacher-primary-ink);
  font-weight: 700;
}

.picker-scope {
  margin: 0 0 2px;
  color: var(--teacher-muted);
  font-size: 12px;
  line-height: 1.45;
}

.picker-scope-switch {
  display: flex;
  gap: 6px;
}

.picker-scope-option {
  flex: 1 1 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--teacher-line);
  border-radius: 12px;
  background: #fff;
  color: var(--teacher-muted);
  font-size: 14px;
  font-weight: 600;
}

.picker-scope-option.is-current {
  background: var(--teacher-selected);
  border-color: rgba(0, 127, 139, 0.24);
  color: var(--teacher-primary-ink);
  font-weight: 700;
}

.picker-scope-option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 359px) {
  .teacher-header-tasks { gap: 6px; }
  .teacher-header-task { padding: 6px 9px; font-size: 12px; }
  .task-context-actions { width: 100%; }
  .task-context-mode { flex: 1 1 0; }
}

@media (min-width: 1100px) {
  #app { max-width: 1400px; }

  #app > #main-view {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .teacher-header {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .teacher-task-sidebar {
    position: relative;
    grid-column: 1;
    grid-row: 2;
    width: 260px;
    height: auto;
    min-height: 0;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    box-shadow: none;
    border-radius: 0;
    border-top: 0;
    border-bottom: 0;
    border-left: 0;
    padding: 16px 14px;
  }

  .teacher-task-sidebar .task-sidebar-close { display: none; }

  main#teacher-content {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    max-width: 1100px;
    margin: 0 auto;
    padding: 18px 24px 32px;
  }

  .teacher-task-backdrop { display: none !important; }
}
