.quiz-assignment-policy { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.quiz-assignment-policy button { flex: none; }

.modal form.answer-key-tracker { display: flex; flex-direction: column; }
.answer-key-tracker > :not(.answer-key-roster) { flex: none; }
.answer-key-tracker-intro { display: grid; gap: 4px; overflow-wrap: anywhere; }
.answer-key-tracker-intro > strong { font-size: 1.125rem; }
.answer-key-tracker-intro p { margin: 0; color: var(--muted); }

.answer-key-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.answer-key-filters button { display: flex; justify-content: space-between; align-items: center; gap: 6px; text-align: left; }
.answer-key-filters button[aria-pressed="true"] { border-color: var(--line-strong); color: var(--text); background: var(--brand-yellow-soft); }
.answer-key-filters strong { font-variant-numeric: tabular-nums; }

.answer-key-roster { min-height: 5rem; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.answer-key-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
}
.answer-key-row + .answer-key-row,
.answer-key-roster section:not([hidden]) ~ section:not([hidden]) { border-top: 1px solid var(--line); }
label.answer-key-row { cursor: pointer; }
label.answer-key-row:hover,
.answer-key-row:focus-within { background: var(--surface-soft); }
.answer-key-row > input { flex: none; width: 18px; min-height: 18px; margin: 0; }
.answer-key-student { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.answer-key-access-status { flex: none; text-align: right; }
.answer-key-row small { display: block; color: var(--muted); margin-top: 2px; }
.answer-key-tracker .form-status { margin-top: 0; }

@media (max-width: 640px) {
  .overlay:has(.answer-key-tracker) { align-items: center; }
  .modal:has(.answer-key-tracker) { max-height: calc(100dvh - 48px); }
  .answer-key-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .answer-key-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px 8px; padding-inline: 10px; }
  label.answer-key-row { grid-template-columns: auto minmax(0, 1fr); }
  label.answer-key-row .answer-key-access-status { grid-column: 2; }
  .answer-key-access-status { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; text-align: left; }
  .answer-key-access-status small { margin: 0; }
}

/* The date column has its own gutter without taking width from the assignment title. */
.workspace.is-assigned-work { max-width: 1640px; }
.class-work-table .class-work-assigned-col { width: 104px; text-align: center; }
.class-work-date {
  display: inline-grid;
  justify-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  white-space: nowrap;
}
.class-work-date > strong {
  color: var(--text);
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.class-work-date > span:not(.class-work-date-clock) { text-transform: uppercase; letter-spacing: .04em; }
.class-work-date-clock { color: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; }
.class-work-date-zone { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 400; white-space: nowrap; }
.class-work-date-missing { color: var(--muted); }
@container (max-width: 900px) {
  .class-work-table:has(.quiz-assignment-students) > table > tbody > tr:not(.assignment-analytics-row) {
    grid-template-columns: 38px 68px minmax(0, 1fr);
  }
  .class-work-table.compact:has(.quiz-assignment-students) > table > tbody > tr:not(.assignment-analytics-row) {
    grid-template-columns: 68px minmax(0, 1fr);
  }
  .class-work-table:has(.quiz-assignment-students) > table > tbody > tr:not(.assignment-analytics-row) > .class-work-assigned-col {
    grid-column: 2;
    grid-row: 1 / span 4;
    align-self: start;
    padding-inline: 4px;
  }
  .class-work-table:has(.quiz-assignment-students) > table > tbody > tr:not(.assignment-analytics-row) > :is(.class-work-title-cell, .class-work-status, .class-work-progress, .class-work-actions) {
    grid-column: 3;
  }
  .class-work-table.compact:has(.quiz-assignment-students) > table > tbody > tr:not(.assignment-analytics-row) > .class-work-assigned-col {
    grid-column: 1;
  }
  .class-work-table.compact:has(.quiz-assignment-students) > table > tbody > tr:not(.assignment-analytics-row) > :is(.class-work-title-cell, .class-work-status, .class-work-progress, .class-work-actions) {
    grid-column: 2;
  }
}


/* Keep the teacher navigation and workspaces on the same desktop grid. */
.teacher-app-shell { --teacher-workspace-max: 1640px; }
.teacher-app-shell .top-in,
.teacher-app-shell > .main .workspace { max-width: var(--teacher-workspace-max); }
.teacher-app-shell > .main .teacher-dashboard { width: 100%; }
.teacher-app-shell .imports-workspace .prompt-snippet { white-space: pre-wrap; overflow-wrap: anywhere; }
.teacher-app-shell .writing-feedback-workspace .table-wrap { position: relative; }

.assignment-progress-head,
.assignment-progress-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1180px;
  margin: 0 auto 12px;
}
.assignment-progress-foot { justify-content: flex-end; margin: 12px auto 0; }
.assignment-progress-collapse { min-height: 36px; }
.class-work-table .compact-row-actions:has(.class-assignment-controls-action) { flex-wrap: wrap; }
.class-work-table .compact-row-actions > .class-assignment-controls-action > span { display: inline; }


/* Keep the expanded quiz roster compact independently of the assignment table. */
.class-work-table .quiz-progress-row > td {
  padding: 10px clamp(10px, 1.4vw, 20px);
}
.quiz-progress-row .assignment-progress-head { margin-bottom: 6px; }
.quiz-progress-row .assignment-progress-foot { margin-top: 6px; }
.quiz-progress-row .assignment-progress-collapse { padding-inline: 8px; }
.class-work-table .quiz-progress-panel {
  container: quiz-progress / inline-size;
  gap: 6px;
  padding: 0;
}
.quiz-progress-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin: 0;
  background: var(--line);
  border: 1px solid var(--line);
}
.quiz-progress-metrics > div {
  display: flex;
  flex: 1 1 auto;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 7px;
  padding: 6px 9px;
  background: #fff;
}
.quiz-progress-metrics dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.quiz-progress-metrics dd {
  margin: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.quiz-progress-metrics dd small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.quiz-progress-policy,
.quiz-progress-policy-text,
.quiz-progress-policy-actions,
.quiz-progress-selection {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
.quiz-progress-policy {
  justify-content: space-between;
  padding: 2px 0;
}
.quiz-progress-policy-text { font-size: 12px; }
.quiz-progress-policy-text strong { margin-right: 2px; }
.quiz-progress-policy-actions { gap: 4px; }
.quiz-progress-panel .student-selection-toolbar {
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 4px 6px;
}
.quiz-progress-panel .student-selection-actions {
  flex: 1 1 auto;
  width: auto;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px;
}
.quiz-progress-panel .student-selection-count {
  min-width: 0;
  font-size: 12px;
}
.quiz-progress-policy-actions button,
.quiz-progress-panel .student-selection-toolbar button {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.25;
  white-space: normal;
}
.quiz-progress-roster {
  background: #fff;
  border: 1px solid var(--line);
}
.quiz-progress-columns,
.quiz-progress-student {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 3px 12px;
  padding: 3px 9px;
}
.quiz-progress-columns {
  padding-block: 5px;
  background: #f2f5f5;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}
.quiz-progress-columns > :first-child { padding-left: 26px; }
.quiz-progress-student {
  min-height: 38px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  overflow-wrap: anywhere;
  grid-template-areas: "name keys result attempts";
}
.quiz-progress-student:has(input:checked) { background: #fff8dc; }
.quiz-progress-student .reattempt-student-cell {
  grid-area: name;
  min-width: 0;
  min-height: 30px;
  font-weight: 700;
  cursor: pointer;
}
.quiz-progress-keys {
  grid-area: keys;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 6px;
  min-width: 0;
}
.quiz-progress-keys .status {
  padding: 2px 5px;
  font-size: 11px;
  white-space: normal;
}
.quiz-progress-keys small { color: var(--muted); font-size: 11px; }
.quiz-progress-result {
  grid-area: result;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 8px;
  font-variant-numeric: tabular-nums;
}
.quiz-progress-result .score-track { flex: 0 1 64px; height: 5px; }
.quiz-progress-result > span { color: var(--muted); font-size: 12px; }
.quiz-progress-attempts,
.quiz-progress-no-attempts { grid-area: attempts; min-width: 0; }
.quiz-progress-attempts summary {
  align-content: center;
  min-height: 30px;
  width: fit-content;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.quiz-progress-attempts summary:hover { text-decoration: underline; }
.quiz-progress-panel .attempt-chip-row { display: block; padding: 0 0 4px; }
.quiz-progress-panel .attempt-chip-row > div { flex-wrap: wrap; }
.quiz-progress-panel .attempt-chip { white-space: normal; max-width: 100%; }

@container quiz-progress (max-width: 600px) {
  .quiz-progress-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quiz-progress-metrics > div { padding: 4px 6px; }
  .quiz-progress-metrics > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .quiz-progress-metrics dt,
  .quiz-progress-policy-text { font-size: 11px; }
  .quiz-progress-policy-text { line-height: 1.4; }
  .quiz-progress-policy-actions,
  .quiz-progress-panel .student-selection-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quiz-progress-panel .student-selection-actions {
    flex-basis: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .quiz-progress-columns { display: none; }
  .quiz-progress-student {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    grid-template-areas: "name result" "keys attempts";
    padding-block: 4px;
  }
  .quiz-progress-keys { padding-left: 26px; }
  .quiz-progress-student .reattempt-student-cell,
  .quiz-progress-attempts summary { min-height: 24px; }
  .quiz-progress-result .score-track { display: none; }
  .quiz-progress-no-attempts { display: none; }
  .quiz-progress-policy-actions button,
  .quiz-progress-panel .student-selection-toolbar button {
    min-height: 36px;
    padding: 3px 4px;
    font-size: 11px;
  }
}
