
/* Instructor materials editor. The attributes are set only by the class editing surface. */
[data-material-edit-dialog] {
  display: flex;
  flex-direction: column;
  width: min(32rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
  padding: 0;
  color: #20362c;
  background: #fff;
  border: 1px solid #d2ddd5;
  border-radius: 16px;
  box-shadow: 0 18px 72px #13291e38;
}
[data-material-edit-dialog] > h2 {
  flex: none;
  margin: 0;
  padding: 1.25rem 1.4rem 1rem;
  border-bottom: 1px solid #e4eae5;
  font-size: 1.18rem;
  line-height: 1.35;
}
[data-material-edit-dialog] > h2 + div {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 1rem 1.4rem;
  color: #415448;
  font-size: .875rem;
  line-height: 1.55;
}
[data-material-edit-dialog] > h2 + div p { margin: .7rem 0 0; }
[data-material-edit-dialog] > h2 + div p:first-child {
  margin: 0;
  padding: .7rem .85rem;
  border-inline-start: 3px solid #638671;
  background: #f0f5f0;
  color: #244d3d;
  font-weight: 550;
}
[data-material-edit-dialog] > [role="alert"] { margin: 0 1.4rem .75rem; }
[data-material-edit-dialog] > div:last-child {
  flex: none;
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: .85rem 1.4rem;
  background: #f8faf7;
  border-top: 1px solid #dfe7df;
}
[data-material-edit-dialog] > div:last-child button {
  height: auto;
  min-height: 40px;
  max-width: 100%;
  padding: .45rem .85rem;
  border-radius: 8px;
  line-height: 1.25;
  white-space: normal;
}
[data-material-edit-dialog] > div:last-child button:last-child,
[data-material-editor-toolbar] > button { background: #244d3d; border-color: #244d3d; color: #fff; }
[data-material-edit-dialog] > div:last-child button:last-child:hover:enabled,
[data-material-editor-toolbar] > button:hover:enabled { background: #183d2f; }

/* The split normally assigns one third of the materials area to Files.  Keep
   the teacher's controls readable while leaving the saved split intact. */
.llm-student-desktop [data-panel][id="files"]:has(.llm-material-browser:not([inert]) [data-material-editor]) {
  min-width: min(20.5rem, 70%) !important; /* The resizer sets min-width inline. */
}
[data-material-editor] { container: material-editor / inline-size; }
[data-material-editor-toolbar] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .55rem;
  margin-bottom: .55rem;
  padding: .75rem;
  border: 1px solid #d6e1d6;
  border-radius: 10px;
  background: #f3f7f2;
}
[data-material-editor-toolbar] > * { margin: 0; }
[data-material-editor-toolbar] > strong { color: #244d3d; font-size: .88rem; line-height: 1.3; }
[data-material-editor-toolbar] > button { width: auto; min-height: 32px; padding-inline: .7rem; }
[data-material-editor-toolbar] > div,
[data-material-editor-toolbar] > p { grid-column: 1 / -1; }
[data-material-editor-toolbar] > div button { min-height: 36px; font-size: .75rem; }
[data-material-editor-toolbar] > p { color: #516457; font-size: .69rem; line-height: 1.45; }
[data-material-editor] .llm-file-tree-row {
  position: relative;
  flex-wrap: wrap;
  align-content: center;
  gap: 0;
  min-height: 42px;
  padding-block: 0;
  border-bottom: 1px solid #e4eae5;
  border-radius: 4px;
}
[data-material-editor] .llm-file-tree-row > button:first-child {
  min-height: 42px;
  padding: .25rem 42px .25rem 0;
}
[data-material-editor] .llm-file-tree-row > button:first-child .truncate {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
[data-material-editor] .llm-file-tree-row:has(details[open]) { background: #f1f5f0; }
[data-material-editor] .maven-editor-row-actions { flex: 0 0 100%; min-width: 0; }
[data-material-editor] .maven-editor-row-actions > summary {
  position: absolute;
  inset-inline-end: 4px;
  top: 3px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #3b5445;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  list-style: none;
}
[data-material-editor] .maven-editor-row-actions > summary::-webkit-details-marker { display: none; }
[data-material-editor] .maven-editor-row-actions[open] > summary,
[data-material-editor] .maven-editor-row-actions > summary:hover { border-color: #cbd8cd; background: #fff; }
[data-material-editor] .maven-editor-row-actions > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr));
  gap: .25rem;
  margin: 0 .25rem .5rem 0;
}
[data-material-editor] .maven-editor-row-actions button {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-height: 36px;
  padding: .35rem .55rem;
  border: 1px solid #dce5dc;
  border-radius: 6px;
  background: #fff;
  color: #385143;
  text-align: start;
  font-size: .75rem;
  line-height: 1.2;
}
[data-material-editor] .maven-editor-row-actions button:hover:enabled { border-color: #8ba491; }
[data-material-editor] .maven-editor-row-actions button:has(.lucide-trash-2) { color: #923f36; }
[data-material-editor] .maven-editor-row-actions svg { flex: none; }
[data-material-editor] :is(button, summary):focus-visible,
[data-material-edit-dialog] button:focus-visible { outline: 2px solid #38684e; outline-offset: 1px; }
@container material-editor (max-width: 15rem) {
  [data-material-editor-toolbar] { grid-template-columns: minmax(0, 1fr); }
  [data-material-editor-toolbar] > div { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  [data-material-edit-dialog] {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    --tw-translate-x: 0px;
    --tw-translate-y: 0px;
    translate: none;
    transform: none;
    width: 100%;
    max-height: calc(100dvh - .75rem);
    border-radius: 16px 16px 0 0;
  }
  [data-material-edit-dialog] > h2,
  [data-material-edit-dialog] > h2 + div,
  [data-material-edit-dialog] > div:last-child { padding-inline: 1rem; }
  [data-material-edit-dialog] > div:last-child { padding-bottom: max(.85rem, env(safe-area-inset-bottom)); }
  [data-material-edit-dialog] > div:last-child button { flex: 1 1 0; min-height: 44px; }
}
@media (pointer: coarse) {
  [data-material-editor] .llm-file-tree-row,
  [data-material-editor] .llm-file-tree-row > button:first-child,
  [data-material-editor-toolbar] button,
  [data-material-editor] .maven-editor-row-actions button { min-height: 44px; }
  [data-material-editor] .maven-editor-row-actions > summary { top: 0; width: 44px; height: 44px; }
  [data-material-editor] .llm-file-tree-row > button:first-child { padding-inline-end: 50px; }
}

/* Keep the mounted chat and the saved panel sizes while editing materials. */
#course-pilot-teacher-main[data-editing-materials] > [data-panel][id="materials"] {
  flex-grow: 1 !important;
}
#course-pilot-teacher-main[data-editing-materials] > [data-panel][id="tutor"],
#course-pilot-teacher-main[data-editing-materials] > [data-separator] {
  display: none !important;
}
