/* Course settings and searchable source picker; scoped to this dialog. */
.course-settings-backdrop { padding: 12px; }
.modal--course-settings { width: min(1040px, 96vw); max-width: calc(100vw - 24px); height: min(780px, calc(100dvh - 24px)); max-height: calc(100dvh - 24px); }
.modal--course-settings .modal-body { display: flex; overflow: hidden; padding: 18px; }
.course-settings-form { flex: 1; min-height: 0; min-width: 0; display: grid; grid-template-columns: minmax(220px, 290px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 16px 20px; }
.course-settings-details { min-width: 0; min-height: 0; display: grid; align-content: start; gap: 18px; overflow: auto; }
.course-settings-details details { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.course-settings-details summary { cursor: pointer; color: var(--ink); font-size: 14px; }
.course-settings-details details label { margin-top: 12px; }
.course-settings-details .permission-note { font-size: 13px; line-height: 1.7; }
.course-settings-form label { min-width: 0; font-size: 14px; line-height: 1.5; }
.course-settings-form input, .course-settings-form select, .course-settings-form textarea { min-width: 0; font-size: 16px; }
.course-settings-footer { grid-column: 1 / -1; display: flex; justify-content: flex-end; padding-top: 10px; border-top: 1px solid var(--line); }
.course-settings-footer .button { min-height: 44px; }
.course-material-picker { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.course-material-picker > * { flex-shrink: 0; }
.cmp-selected { position: relative; min-width: 0; max-height: 130px; overflow: auto; display: grid; gap: 5px; padding: 12px 14px; border: 1px solid var(--line); background: var(--ivory); border-radius: 8px; }
.cmp-selected > span { font-size: 12px; color: var(--teal); font-weight: 700; }
.cmp-selected b { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; padding-right: 62px; }
.cmp-selected small, .cmp-option small { color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.cmp-selected p, .cmp-locked-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.cmp-selected button { position: absolute; right: 10px; top: 10px; padding: 6px; border: 0; background: transparent; color: var(--blue); font-size: 12px; }
.cmp-search-row { display: flex; align-items: flex-end; gap: 10px; }
.cmp-search-row label { flex: 1; display: grid; gap: 6px; }
.cmp-search-row button { flex-shrink: 0; height: 42px; padding: 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; }
.cmp-search-row input, .cmp-filters select { width: 100%; height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--ink); }
.cmp-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cmp-filters label { display: grid; gap: 6px; font-size: 12px; }
.cmp-filters select { font-size: 14px; }
.cmp-count { color: var(--muted); font-size: 12px; line-height: 1.6; }
.course-material-picker .cmp-results { flex: 1; min-width: 0; min-height: 64px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; overscroll-behavior: contain; }
.cmp-results .cmp-option { display: flex; gap: 12px; width: 100%; min-width: 0; padding: 12px; align-items: center; text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); background: var(--paper); }
.cmp-results .cmp-option:last-child { border-bottom: 0; }
.cmp-option.is-selected { box-shadow: inset 4px 0 var(--teal); background: var(--ivory); }
.cmp-option-copy { display: grid; gap: 5px; flex: 1; min-width: 0; }
.cmp-option-copy b { font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.cmp-choice { flex-shrink: 0; font-size: 12px; color: var(--blue); }
.cmp-file-name { display: block; overflow-wrap: anywhere; word-break: break-word; }
.cmp-pagination { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cmp-pagination button { padding: 7px 12px; min-height: 36px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
.cmp-pagination span { color: var(--muted); font-size: 12px; }
.cmp-empty { margin: 0; padding: 24px 16px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.cmp-error { margin: 0; color: var(--warning); font-size: 13px; }
.course-material-picker button:focus-visible { outline: 3px solid var(--teal); outline-offset: -3px; }
@media (max-width: 760px) {
  .course-settings-backdrop { padding: 6px; }
  .modal--course-settings { width: 100%; max-width: 100%; height: auto; max-height: calc(100dvh - 12px); }
  .modal--course-settings .modal-body { display: block; overflow: auto; padding: 16px; }
  .course-settings-form { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; gap: 16px; }
  .course-settings-details { gap: 12px; overflow: visible; }
  .course-material-picker { display: grid; overflow: visible; }
  .course-settings-details .permission-note { display: none; }
  .cmp-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cmp-filters label:last-child { grid-column: 1 / -1; }
  .course-material-picker .cmp-results { max-height: 220px; }
  .course-settings-footer { position: sticky; bottom: -16px; padding: 12px 0; background: var(--paper); z-index: 2; }
  .course-settings-footer .button { width: 100%; }
  .cmp-selected b { padding-right: 0; }
  .cmp-selected button { position: static; justify-self: start; padding: 5px 0; }
}
