/* A quiet, guided workspace. Worksheet styles stay scoped to this view. */
body[data-workspace-view="worksheets"] .workspace-heading,
body[data-workspace-view="worksheets"] #stats { display: none; }
body[data-workspace-view="worksheets"] .topbar { height: 70px; }
body[data-workspace-view="worksheets"] main { max-width: 1140px; padding-top: 18px; }
body[data-workspace-view="worksheets"] .tabs { margin-bottom: 28px; }
body[data-workspace-view="worksheets"] .notice { padding: 10px 16px; margin-bottom: 16px; }
#worksheets-view { min-width: 0; }
.worksheet-provenance { overflow-wrap: anywhere; line-height: 1.5; }
#worksheets-view button, #worksheets-view input, #worksheets-view textarea { touch-action: manipulation; }
#worksheets-view .primary, #worksheets-view .secondary { min-height: 44px; }
#worksheets-view button:focus-visible { outline: 3px solid #4b772b; outline-offset: 4px; }
#worksheets-view .primary:not(:disabled) { box-shadow: 0 2px 0 #153428; }
#worksheets-view h2:focus, #worksheets-view .question-stage:focus { outline: none; }
#worksheets-view h2:focus-visible, #worksheets-view .question-stage:focus-visible { outline: 2px solid #63992e; outline-offset: 7px; }
.worksheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.worksheet-heading h2 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.85rem, 3vw, 2.45rem); font-weight: 400; letter-spacing: -.035em; }
.worksheet-heading p { margin: 6px 0 0; font-size: .91rem; color: var(--muted); }
.worksheet-back { padding: 0; min-height: 32px; margin-bottom: 12px; font-weight: 400; }
.worksheet-heading > .primary { flex-shrink: 0; }
#worksheets-view[data-stage="review"] .worksheet-heading { margin-bottom: 12px; }
#worksheets-view[data-stage="review"] .worksheet-heading h2 { font-size: clamp(1.75rem, 2.6vw, 2.1rem); }
#worksheets-view[data-stage="review"] .worksheet-back { margin-bottom: 4px; }
.worksheet-steps { display: flex; align-items: center; gap: 8px; margin: 0 0 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.worksheet-steps button { display: flex; align-items: center; gap: 9px; padding: 6px 14px 6px 0; border: 0; background: transparent; color: var(--muted); font-size: .85rem; min-height: 44px; }
.worksheet-steps button > span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #e9ede2; font-size: .75rem; }
.worksheet-steps button[aria-current="step"] { color: var(--green); font-weight: 700; }
.worksheet-steps button[aria-current="step"] > span { color: white; background: var(--green); }
.worksheet-steps button:disabled { opacity: .55; }
#worksheets-view[data-stage="review"] .worksheet-steps { padding-bottom: 10px; margin-bottom: 16px; }
.worksheet-library { margin-top: 42px; }
.worksheet-library .library-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.worksheet-library h3 { margin: 0; font-size: .82rem; color: var(--muted); font-weight: 500; }
.worksheet-search { max-width: 400px; }
.worksheet-row.list-choice { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 0; padding: 21px 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.worksheet-row.list-choice[aria-pressed="true"] { background: #edf2e5; }
.worksheet-row.list-choice strong { font-size: 1rem; font-weight: 600; }
.worksheet-row-description { min-width: 0; }
.worksheet-row.list-choice .worksheet-row-action { white-space: nowrap; font-size: .83rem; }
#worksheets-view > .panel, #worksheet-editor.panel { padding: 0; border: 0; background: transparent; box-shadow: none; border-radius: 0; }
#book-generation { max-width: 830px; margin: 0 auto; }
#book-generation .section-heading { margin-bottom: 22px; }
#book-generation .section-heading h3 { font-size: 1rem; margin-bottom: 4px; }
#book-generation .section-heading p { font-size: .82rem; }
.generation-book-row { display: flex; align-items: center; gap: 24px; }
.generation-book-row label { margin-bottom: 0; }
.generation-book-stepper { display: flex; align-items: center; gap: 5px; margin-top: 7px; }
.generation-book-stepper input { width: 80px; text-align: center; margin: 0; font-size: 1.45rem; padding: 8px; font-weight: 600; -moz-appearance: textfield; }
.generation-book-stepper input::-webkit-inner-spin-button, .generation-book-stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.generation-book-stepper button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; font-size: 1.35rem; color: var(--green); }
.generation-book-stepper button:hover:not(:disabled) { background: var(--mint); }
.generation-course-label { color: var(--muted); font-size: .85rem; margin: 20px 0 0; }
.generation-scope-row { display: flex; flex-wrap: wrap; gap: 22px; margin: 22px 0 12px; }
.generation-control-label { display: block; font-size: .83rem; font-weight: 600; margin-bottom: 7px; }
.generation-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.generation-pills .secondary { min-width: 44px; border-color: transparent; border-radius: 24px; background: transparent; padding: 8px 16px; font-weight: 500; }
.generation-pills .secondary[aria-pressed="true"] { background: var(--green); color: white; }
#book-generation .generation-fields { margin-top: 22px; padding-top: 18px; }
.generation-mix-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.generation-mix-card { border: 1px solid transparent; border-radius: 12px; padding: 16px; background: transparent; color: var(--green); text-align: left; min-width: 0; }
.generation-mix-card strong, .generation-mix-card span { display: block; }
.generation-mix-card strong { font-size: .93rem; font-weight: 600; }
.generation-mix-card span { color: var(--muted); font-size: .77rem; margin-top: 5px; }
.generation-mix-card:hover:not(:disabled) { background: #eef3e7; }
.generation-mix-card[aria-pressed="true"] { border-color: #8aab73; background: #edf3e4; }
#book-generation .generation-counts { max-width: 560px; margin-top: 15px; }
#book-generation .generation-allocation { margin: 12px 0 2px; font-size: .87rem; }
.generation-writing-note { margin-bottom: 22px; }
.generation-difficulty-row { display: flex; align-items: center; gap: 24px; margin-top: 22px; }
.generation-difficulty-row .generation-control-label { margin: 0; }
.generation-difficulty-row + .hint { margin-top: 8px; }
.generation-extra { margin-top: 15px; }
#book-generation [data-testid="generate-worksheet"] { display: flex; margin-top: 24px; padding-inline: 26px; }
.generation-secondary-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 0; border-top: 1px solid var(--line); padding-top: 8px; }
.generation-secondary-actions .quiet { font-weight: 400; font-size: .78rem; color: var(--muted); }
.generation-activity-panel, .generation-reference-list { padding: 16px 0; font-size: .84rem; }
.worksheet-overview { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.worksheet-overview > div { flex: 1; min-width: 0; }
.worksheet-overview h3 { font-size: 1rem; margin: 0 0 3px; overflow-wrap: anywhere; }
.worksheet-overview .worksheet-meta { margin: 0; color: var(--muted); font-size: .78rem; }
.worksheet-overview .badge { background: transparent; color: var(--muted); padding-inline: 0; }
.worksheet-overview .quiet { font-size: .77rem; font-weight: 400; }
.worksheet-detail-fields { max-width: 680px; margin: 24px 0; border-left: 2px solid var(--line); padding-left: 20px; }
.question-workspace { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; min-width: 0; }
.question-navigator { display: flex; align-items: center; gap: 9px; overflow-x: auto; padding: 14px 28px; border-bottom: 1px solid var(--line); }
.question-nav-button { width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--muted); font-size: .82rem; position: relative; }
.question-nav-button:hover:not(:disabled) { background: var(--mint); }
.question-nav-button.is-approved { color: var(--green); background: var(--mint); }
.question-nav-button.is-approved::after { content: ""; position: absolute; bottom: 2px; left: 16px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.question-nav-button.needs-changes { border-color: #dcbca3; color: #864b2c; }
.question-nav-button.is-current { background: var(--green); color: white; border-color: var(--green); font-weight: 700; }
.question-nav-button.is-current:hover:not(:disabled) { background: var(--green-hover); }
.question-nav-button.is-group { width: auto; min-width: 56px; flex-basis: auto; padding-inline: 12px; border-radius: 20px; }
.question-nav-button.is-group.is-approved::after { left: calc(50% - 2px); }
.question-stage { display: grid; grid-template-columns: minmax(0, 1fr) 280px; column-gap: 30px; padding: 26px 30px 12px; min-width: 0; }
.question-stage-header { display: flex; grid-column: 1 / -1; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 24px; }
.question-stage-header .eyebrow { display: block; margin-bottom: 4px; font-size: .64rem; }
.question-stage-header h4 { margin: 0; font-size: .82rem; font-weight: 500; color: var(--muted); }
.question-stage-header .secondary { min-height: 44px; font-size: .85rem; padding: 10px 16px; background: #f0f5e8; border-color: #8da47e; }
.question-preview, .question-edit-fields { min-width: 0; }
.question-edit-fields input, .question-edit-fields textarea { scroll-margin-block: 24px 140px; }
.question-edit-actions { position: sticky; bottom: 16px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; padding: 16px; border: 1px solid #a7bd98; border-radius: 10px; background: #eff5e6; box-shadow: 0 4px 16px #234c3d12; }
.question-edit-hint { margin: 0; max-width: 30ch; color: var(--green); font-size: .84rem; line-height: 1.5; }
.question-edit-actions > .primary { flex-shrink: 0; min-height: 48px; padding: 12px 22px; font-size: .9rem; }
.question-edit-error { margin: 12px 0 0; padding: 12px 16px; border-left: 3px solid var(--danger); background: #fbf1ed; font-size: .85rem; }
.matching-pairs { width: 100%; table-layout: fixed; border-collapse: collapse; margin: 8px 0 16px; text-align: left; }
.matching-caption { text-align: left; font-size: .94rem; font-weight: 600; color: var(--green); padding: 0 0 18px; }
.matching-pairs th, .matching-pairs td { border-bottom: 1px solid var(--line); padding: 14px 10px; vertical-align: top; overflow-wrap: anywhere; }
.matching-pairs thead th { font-size: .71rem; font-weight: 500; color: var(--muted); padding-block: 0 10px; }
.matching-pairs th:first-child { width: 54px; padding-inline: 5px; }
.matching-pairs tbody th { font-weight: 400; }
.matching-pairs tbody tr.is-current { background: #f1f5e9; }
.matching-pairs tbody tr.is-current > th { box-shadow: inset 3px 0 var(--green); }
.matching-pair-review, .matching-pair-number { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--green); font-size: .85rem; }
.matching-pair-review:hover:not(:disabled) { background: var(--mint); }
.matching-pair-review[aria-pressed="true"] { font-weight: 700; }
.matching-word, .matching-answer { display: block; font-size: .9rem; line-height: 1.6; white-space: pre-wrap; padding-top: 9px; }
.matching-word { font-weight: 600; }
.matching-pair-status { display: block; font-size: .66rem; font-weight: 400; color: var(--muted); margin-top: 5px; }
.matching-pair-status.is-approved { color: #46702f; }
.matching-pairs label { margin: 0; }
.matching-pairs textarea { margin: 0; font-size: .85rem; font-weight: 400; line-height: 1.5; padding: 9px; min-height: 78px; }
.matching-field-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.matching-group-details { margin: 20px 0; font-size: .8rem; }
.matching-group-details summary { cursor: pointer; padding: 10px 0; color: var(--muted); }
.matching-group-details[open] summary { margin-bottom: 10px; }
.matching-review-heading { margin: 0 0 16px; font-size: .88rem; color: var(--green); }
#worksheet-editor .question-prompt { font-size: clamp(1.35rem, 2vw, 1.75rem); line-height: 1.45; letter-spacing: -.025em; font-weight: 500; margin: 12px 0 24px; }
.worksheet-instructions, .question-instructions { color: var(--muted); font-size: .81rem; line-height: 1.65; margin: 0 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.question-options { list-style: upper-alpha; padding-left: 28px; margin: 0 0 25px; }
.question-option { padding: 10px 12px; margin-bottom: 2px; font-size: .94rem; border-radius: 6px; overflow-wrap: anywhere; }
.question-option::marker { color: var(--muted); font-size: .8rem; }
.question-option.is-answer { background: #eef4e5; }
.answer-tag { display: inline-block; margin-left: 12px; color: #4b7138; font-size: .68rem; }
.shared-context { padding: 4px 0 12px; }
.shared-context .eyebrow, .answer-reference .eyebrow { font-size: .61rem; display: block; margin-bottom: 8px; }
.answer-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.answer-chip { font-size: .84rem; background: #f1f3ea; padding: 5px 12px; border-radius: 20px; overflow-wrap: anywhere; }
.answer-reference { border-left: 2px solid #a9c48d; padding: 5px 0 5px 16px; margin: 14px 0 26px; }
.answer-reference p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .94rem; }
.writing-guidance { font-size: .88rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-strip { border-left: 1px solid var(--line); padding-left: 24px; min-width: 0; overflow-wrap: anywhere; }
.review-source strong { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 5px; }
.review-source span { display: block; color: var(--muted); font-size: .71rem; }
.review-strip .quality-status { font-size: .77rem; margin: 15px 0 0; }
.quality-status.is-approved { color: #46702f; }
.review-check-toggle { margin-top: 12px; padding: 8px 14px; font-size: .8rem; }
.review-attestation { font-size: .77rem; color: var(--muted); margin: 18px 0 12px; line-height: 1.65; }
.question-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.question-actions > .primary { grid-column: 1 / -1; min-height: 48px; font-size: .9rem; }
.question-actions > .secondary { min-width: 0; padding: 10px 9px; border-color: #8da47e; font-size: .8rem; line-height: 1.4; }
.question-actions > .secondary[aria-expanded="true"], .review-check-toggle[aria-expanded="true"] { background: #eaf1dc; border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.review-note-panel > button { width: 100%; min-height: 44px; }
.review-checks, .review-note-panel { margin: 14px 0; padding-top: 14px; border-top: 1px solid var(--line); }
.review-checks p, .review-note-panel p, .review-strip label { font-size: .77rem; }
.review-strip textarea { font-size: .82rem; }
.review-strip > label { margin-top: 16px; }
.question-pagination { display: flex; grid-column: 1 / -1; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); margin-top: 28px; padding-top: 9px; }
.question-pagination .question-quality-summary { padding: 0; background: transparent; border: 0; font-size: .76rem; text-align: center; color: var(--muted); }
.question-pagination .question-quality-summary h3 { font-size: .76rem; margin-bottom: 2px; }
.question-pagination .question-quality-summary p { margin: 0; font-size: .72rem; }
.question-pagination .quiet { font-size: .75rem; font-weight: 400; flex-shrink: 0; }
.question-pagination > .quality-status { margin: 0; font-size: .76rem; color: var(--muted); text-align: center; }
.worksheet-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 18px 0; }
.worksheet-footer .hint { margin: 0; }
.worksheet-footer button { flex-shrink: 0; }
.legacy-worksheet-preview { max-width: 850px; margin: 0 auto; }
.legacy-preview-section { padding: 25px 0; border-top: 1px solid var(--line); }
.legacy-preview-section > h3 { font-size: 1.05rem; margin-bottom: 10px; }
.legacy-preview-item { margin-top: 24px; }
.legacy-preview-item .question-prompt { font-size: 1.2rem !important; margin-bottom: 14px !important; }
.legacy-preview-item .answer-reference { margin-top: 10px; }
.correct-answer-choices { border: 0; padding: 0; margin: 20px 0; display: flex; flex-wrap: wrap; gap: 12px; }
.correct-answer-choices legend { font-size: .83rem; font-weight: 600; margin-bottom: 10px; }
.correct-answer-choices label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; min-height: 44px; }
#worksheets-view input[type="radio"] { width: 18px; height: 18px; min-height: 18px; margin: 0; accent-color: var(--green); flex-shrink: 0; }
#generation-sources { margin: 26px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
#generation-sources h4 { display: inline; font-size: .74rem; margin-right: 15px; }
#generation-sources > p { display: inline; font-size: .76rem; margin: 0; }
#generation-sources > .quiet { font-size: .73rem; font-weight: 400; }
.worksheet-publish { max-width: 720px; margin: 30px auto; }
.worksheet-publish > h3 { font-size: 1.4rem; margin-bottom: 7px; }
.publish-summary { color: var(--muted); font-size: .88rem; margin-bottom: 28px; overflow-wrap: anywhere; }
.publish-classes, .publish-strictness { border: 0; padding: 0; margin: 24px 0; }
.publish-classes legend, .publish-strictness legend { font-size: .82rem; font-weight: 600; margin-bottom: 12px; }
.publish-class-choice, .publish-strictness label { display: flex; align-items: center; gap: 15px; padding: 16px; margin: 0; border-bottom: 1px solid var(--line); font-size: .9rem; cursor: pointer; }
.publish-class-choice:has(input:checked), .publish-strictness label:has(input:checked) { background: #edf3e4; border-radius: 8px; }
.publish-class-choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.publish-class-choice span, .publish-strictness label span { min-width: 0; overflow-wrap: anywhere; }
.publish-class-choice strong, .publish-class-choice .muted, .publish-strictness strong, .publish-strictness .muted { display: block; }
.publish-class-choice .muted, .publish-strictness .muted { font-size: .77rem; font-weight: 400; margin-top: 3px; }
.publish-secondary { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-bottom: 15px; }
.publish-secondary > .quiet { font-size: .8rem; font-weight: 400; padding-left: 0; }
.publish-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.worksheet-heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.worksheet-recovery { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.worksheet-recovery[hidden] { display: none; }
.worksheet-recovery > span { margin-right: auto; }
@media (max-width: 800px) {
  .question-stage { grid-template-columns: minmax(0, 1fr); padding: 22px 24px 12px; }
  .review-strip { border-left: 0; border-top: 1px solid var(--line); padding: 20px 0 0; }
  .question-actions { max-width: 440px; }
  .review-attestation { margin-top: 12px; }
  .question-pagination { margin-top: 22px; }
}
@media (max-width: 540px) {
  body[data-workspace-view="worksheets"] main { padding: 14px 16px 40px; }
  body[data-workspace-view="worksheets"] .topbar { height: 64px; padding-inline: 16px; }
  body[data-workspace-view="worksheets"] .tabs { margin-bottom: 24px; }
  .worksheet-heading { gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
  .worksheet-heading p { font-size: .83rem; }
  .worksheet-steps { gap: 5px; margin-bottom: 20px; padding-bottom: 13px; }
  .worksheet-steps button { font-size: .78rem; gap: 7px; padding-right: 9px; }
  .worksheet-library { margin-top: 28px; }
  .worksheet-row.list-choice { padding: 18px 5px; gap: 12px; }
  .worksheet-row.list-choice strong { font-size: .91rem; }
  .worksheet-row.list-choice .worksheet-row-action { font-size: .75rem; }
  .generation-book-row { gap: 16px; }
  .generation-course-label { font-size: .77rem; }
  .generation-mix-presets { grid-template-columns: 1fr; gap: 4px; }
  .generation-mix-card { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 13px; }
  .generation-mix-card span { margin: 0; max-width: 55%; text-align: right; }
  .generation-mix-card strong { font-size: .85rem; }
  .generation-difficulty-row { flex-wrap: wrap; gap: 9px; }
  .generation-difficulty-row .generation-control-label { flex: 1 0 100%; }
  .worksheet-overview { flex-wrap: wrap; gap: 5px 12px; }
  .worksheet-overview > div { flex-basis: calc(100% - 115px); }
  .worksheet-overview .quiet { padding-left: 0; }
  .question-navigator { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 10px 14px; gap: 2px 6px; }
  .question-nav-button { width: 44px; height: 44px; justify-self: center; }
  .question-nav-button.is-approved::after { left: 19px; }
  .question-nav-button.is-group { min-width: 48px; padding-inline: 7px; }
  .question-stage { padding: 20px 18px 10px; }
  .question-stage-header { gap: 12px; margin-bottom: 20px; }
  .question-stage-header .secondary { flex-shrink: 0; }
  .question-stage-header { flex-wrap: wrap; }
  .question-stage.is-matching .question-stage-header { flex-wrap: wrap; }
  .matching-pairs th, .matching-pairs td { padding-inline: 6px; }
  .matching-pairs th:first-child { width: 44px; padding-inline: 0; }
  .matching-word, .matching-answer { font-size: .82rem; }
  .matching-pairs textarea { font-size: .82rem; padding: 7px; min-height: 98px; }
  .question-edit-actions { bottom: 8px; flex-wrap: wrap; gap: 12px; padding: 14px; }
  .question-edit-hint { max-width: none; }
  .question-edit-actions > .primary { width: 100%; }
  .question-pagination { gap: 4px; }
  .question-pagination .quiet { padding: 8px 3px; font-size: .7rem; }
  .question-pagination .question-quality-summary { font-size: .7rem; }
  .worksheet-footer { flex-wrap: wrap; gap: 12px; }
  .worksheet-footer button { width: 100%; }
  #generation-sources > .quiet { display: flex; padding-left: 0; }
  .publish-actions > .primary { flex: 1 0 100%; }
}
