.course-editor { color: #26334b; min-width: 0; }
.course-editor *, .course-editor *::before, .course-editor *::after { box-sizing: border-box; }
.course-editor [hidden] { display: none !important; }
.course-editor .ce-mode-switch { display: flex; gap: 6px; padding: 5px; margin-bottom: 14px; border: 1px solid #dbe4f3; border-radius: 13px; background: #f4f7fd; }
.course-editor .ce-mode-switch button { flex: 1; min-height: 44px; border: 0; border-radius: 9px; color: #66738e; background: transparent; font-size: 14px; font-weight: 700; cursor: pointer; }
.course-editor .ce-mode-switch button[aria-pressed="true"] { color: #315edb; background: #fff; box-shadow: 0 2px 9px #314a7b12; }
.course-editor .ce-note { margin: 8px 0 15px; color: #66748e; font-size: 13px; line-height: 1.7; }
.course-editor .ce-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.course-editor .ce-toolbar button, .course-editor .ce-toolbar a, .course-editor .ce-import-actions button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 7px 12px; border: 1px solid #d5dfef; border-radius: 9px; background: #fff; color: #31539a; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; }
body:has(#teacherView.active) > .tool-rail,
body:has(#adminView.active) > .tool-rail { display: none; }
.course-editor .ce-toolbar button:hover, .course-editor .ce-toolbar a:hover { background: #eef3ff; }
.course-editor .ce-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.course-editor .ce-full { grid-column: 1 / -1; }
.course-editor label.ce-field, .course-editor fieldset { display: flex; min-width: 0; flex-direction: column; gap: 6px; margin: 0; font-size: 14px; font-weight: 650; }
.course-editor .ce-field small, .course-editor .ce-field-help { color: #6d7a92; font-size: 12px; font-weight: 400; line-height: 1.6; }
.course-editor .ce-field input, .course-editor .ce-field select, .course-editor .ce-field textarea { width: 100%; min-width: 0; margin: 0; padding: 10px 12px; border: 1px solid #d7e0ef; border-radius: 10px; color: #25344d; background: #fff; font: inherit; font-weight: 400; }
.course-editor .ce-field textarea { resize: vertical; line-height: 1.7; min-height: 84px; }
.course-editor .ce-field input[readonly] { color: #6c7b93; background: #f2f5fa; }
.course-editor fieldset { padding: 0; border: 0; }
.course-editor legend { margin-bottom: 8px; padding: 0; font-size: 14px; font-weight: 650; }
.course-editor .ce-checks { display: flex; flex-wrap: wrap; gap: 7px; }
.course-editor .ce-check { display: inline-flex; flex-direction: row; align-items: center; gap: 7px; min-height: 40px; margin: 0; padding: 7px 10px; border: 1px solid #dce4f1; border-radius: 9px; background: #fff; color: #53627c; font-size: 13px; font-weight: 500; cursor: pointer; }
.course-editor .ce-check:has(input:checked) { border-color: #a9bdf0; background: #edf3ff; color: #3158a9; }
.course-editor .ce-check input { width: 16px; height: 16px; margin: 0; padding: 0; accent-color: #315edb; }
.course-editor details.ce-section { margin: 16px 0; padding: 0 16px 16px; border: 1px solid #e0e7f1; border-radius: 13px; background: #fbfcff; }
.course-editor details.ce-section > summary { padding: 13px 0 0; font-size: 14px; font-weight: 750; cursor: pointer; }
.course-editor details.ce-section > summary small { margin-left: 7px; font-weight: 400; color: #7b879d; font-size: 12px; }
.course-editor details.ce-section[open] > summary { margin-bottom: 16px; }
.course-editor details.ce-section:not([open]) { padding-bottom: 13px; }
.course-editor .ce-source { padding: 14px; margin-bottom: 16px; border: 1px solid #cbd9f5; border-radius: 12px; background: #f2f6ff; }
.course-editor .ce-source .ce-note { margin-bottom: 0; }
.course-editor .ce-missing { margin: 14px 0; padding: 12px 14px; border-left: 3px solid #c98f3f; border-radius: 5px 10px 10px 5px; background: #fff8ec; color: #7f6035; font-size: 13px; line-height: 1.7; }
.course-editor .ce-missing.is-complete { border-color: #26957b; background: #edf8f4; color: #286e60; }
.course-editor .ce-import-preview { padding: 16px; margin: 14px 0; border: 1px solid #c7d7f5; border-radius: 12px; background: #f5f8ff; }
.course-editor .ce-import-preview h3 { margin: 0 0 8px; font-size: 16px; }
.course-editor .ce-import-preview p { margin: 7px 0; font-size: 13px; color: #66738b; }
.course-editor .ce-diff-list { max-height: 330px; overflow: auto; padding: 0; margin: 12px 0; list-style: none; }
.course-editor .ce-diff-list li { padding: 10px 0; border-bottom: 1px solid #dce5f4; }
.course-editor .ce-diff-list strong { display: block; margin-bottom: 4px; font-size: 13px; }
.course-editor .ce-diff-values { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); gap: 7px; color: #51617e; font-size: 12px; }
.course-editor .ce-diff-values span { white-space: pre-wrap; overflow-wrap: anywhere; }
.course-editor .ce-diff-values span:first-child { color: #7a879d; }
.course-editor .ce-import-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.course-editor .ce-import-actions .ce-apply { color: #fff; background: #315edb; border-color: #315edb; }
.course-editor .ce-import-actions button:disabled { cursor: not-allowed; opacity: .5; }
.course-editor .ce-status { min-height: 1.5em; margin: 8px 0; color: #52698f; font-size: 13px; line-height: 1.65; }
.course-editor .ce-status.is-error { color: #b54737; }
#editDialog:has(.course-editor) { width: min(860px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 0; border-radius: 19px; background: #fff; }
#editDialog:has(.course-editor) form { padding: 26px; border: 0; border-radius: 0; box-shadow: none; }
#editDialog:has(.course-editor) .dialog-actions { position: sticky; bottom: -26px; margin: 18px -26px -26px; padding: 14px 26px; border-top: 1px solid #e2e7f0; background: #fffffff5; backdrop-filter: blur(8px); }
.metadata-status { display: inline-flex; align-items: center; max-width: 100%; padding: 4px 9px; border: 1px solid #cde9df; border-radius: 8px; background: #eef8f4; color: #287260; font-size: 12px; font-weight: 650; line-height: 1.5; }
.metadata-status.is-incomplete { border-color: #efddbc; background: #fff8eb; color: #8a652c; }
.metadata-health { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; margin-top: 12px; }
.metadata-health small { flex: 1 1 240px; min-width: 0; color: #7b6d56; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.metadata-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.metadata-row-actions .ghost, .metadata-list-filters .ghost { min-height: 38px; padding: 7px 12px; border: 1px solid #dbe3ef; border-radius: 9px; background: #fff; color: #52637e; font-size: 13px; line-height: 1.5; }
.metadata-row-actions .ghost:hover, .metadata-list-filters .ghost:hover { border-color: #b5c7ec; background: #f4f7ff; color: #315edb; }
.metadata-list-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.metadata-list-filters .ghost[aria-pressed="true"] { border-color: #acc2ef; background: #edf3ff; color: #315edb; font-weight: 750; }
.admin-card:has(.metadata-health) > div:first-child { flex: 1 1 55%; min-width: 0; overflow-wrap: anywhere; }
.admin-card:has(.metadata-health) .admin-actions { flex: 0 1 350px; min-width: 0; }
@media (max-width: 860px) {
  .admin-card:has(.metadata-health) > div:first-child, .admin-card:has(.metadata-health) .admin-actions { flex: 0 1 auto; width: 100%; }
}
@media (max-width: 600px) {
  .metadata-row-actions .ghost, .metadata-list-filters .ghost, .admin-card:has(.metadata-health) .admin-actions button { min-height: 44px; }
  .metadata-health { align-items: flex-start; }
  .metadata-health small { flex-basis: 100%; }
  .metadata-list-filters { width: 100%; }
  .metadata-list-filters .ghost { flex: 1 1 120px; }
  .course-editor .ce-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .course-editor .ce-toolbar button, .course-editor .ce-toolbar a, .course-editor .ce-check, .course-editor .ce-import-actions button { min-height: 44px; }
  .course-editor .ce-mode-switch button { font-size: 13px; padding: 7px 5px; }
  .course-editor details.ce-section { padding-inline: 12px; }
  .course-editor details.ce-section > summary small { display: block; margin: 3px 0 0; }
  .course-editor .ce-diff-values { grid-template-columns: minmax(0, 1fr); }
  .course-editor .ce-diff-values > span:nth-child(2) { display: none; }
  #editDialog:has(.course-editor) { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); padding: 0; }
  #editDialog:has(.course-editor) form { padding: 18px; }
  #editDialog:has(.course-editor) .dialog-actions { bottom: -18px; margin-inline: -18px; margin-bottom: -18px; padding: 12px 18px; }
}
