/*
 * Prompt #119 / #122 / #131 / #133 / #137 — ONE shared collapsible MANAGEMENT PANEL pattern
 * (list panels AND form/settings/tool cards) plus compact RECORD disclosures (inner rows).
 * Opt in outer: <details class="card teacherCollapsibleList"> or nested
 * <details class="teacherCollapsibleList teacherCollapsibleList--nested">.
 * Opt in record: <details class="lanternMgmtRecord">.
 * Collapsed panel = summary row only. Expanded panel = existing body content.
 * Prefer one open top-level peer at a time; prefer one open record at a time.
 * Class name teacherCollapsibleList is the established opt-in token (Teacher + Admin).
 */

.teacherCollapsibleList > summary.teacherCollapsibleListHd {
  list-style: none;
  cursor: pointer;
  user-select: none;
  min-height: 48px;
  box-sizing: border-box;
}
.teacherCollapsibleList > summary.teacherCollapsibleListHd::-webkit-details-marker {
  display: none;
}
.teacherCollapsibleList > summary.teacherCollapsibleListHd::before {
  content: '▸';
  color: var(--muted, #b9c6ea);
  font-weight: 900;
  margin-right: 6px;
  flex-shrink: 0;
  line-height: 1;
}
.teacherCollapsibleList[open] > summary.teacherCollapsibleListHd::before {
  content: '▾';
}
.teacherCollapsibleList > summary.teacherCollapsibleListHd:focus-visible {
  outline: 2px solid var(--accent, #5aa7ff);
  outline-offset: 2px;
}
.teacherCollapsibleList:not([open]) > summary.teacherCollapsibleListHd {
  border-bottom: none;
}

/*
 * Prompt #131 — enforce true one-row collapsed geometry without relying solely on UA details.
 * Hide EVERYTHING that is not the summary header while collapsed (table, filters, editors, body).
 * Do not use max-height clipping of a still-laid-out body.
 */
.teacherCollapsibleList:not([open]) > *:not(summary) {
  display: none !important;
}

.teacherCollapsibleListTitle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.teacherCollapsibleListMeta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
/* Comfortable expanded list height — several full rows; body scrolls when needed. */
.teacherCollapsibleListScroll {
  max-height: clamp(280px, 48vh, 560px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 16px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.12));
  background: rgba(0, 0, 0, 0.12);
}
@media (max-width: 640px) {
  .teacherCollapsibleListScroll {
    max-height: clamp(240px, 42vh, 420px);
  }
}
/* Nested list panels inside a parent card. */
.teacherCollapsibleList--nested {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line, rgba(255, 255, 255, 0.12));
  background: transparent;
  box-shadow: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-radius: 0;
}
.teacherCollapsibleList--nested > summary.teacherCollapsibleListHd {
  padding: 8px 0;
  border-bottom: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.teacherCollapsibleList--nested > .teacherCollapsibleListBd {
  padding: 8px 0 0;
}
.teacherCollapsibleList--nested .teacherCollapsibleListHd .h {
  font-size: 22px;
}

/* ========== Prompt #133 — compact RECORD disclosures inside an expanded list panel ========== */

.lanternMgmtRecordListHd {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(72px, 0.7fr) minmax(72px, 0.7fr) 28px;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 800;
  color: var(--muted, #b9c6ea);
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, 0.12));
  position: sticky;
  top: 0;
  /* Prompt #206 — solid opaque navy so scrolling rows cannot show through. */
  background: #132038;
  z-index: 2;
}
.lanternMgmtRecordListHd--staff {
  grid-template-columns: minmax(72px, 0.65fr) minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1fr) minmax(64px, 0.55fr) minmax(110px, 1.1fr) minmax(88px, 0.75fr) 28px;
}
.lanternMgmtRecordListHd--students {
  grid-template-columns: minmax(64px, 0.75fr) minmax(0, 0.95fr) minmax(0, 0.95fr) minmax(48px, 0.45fr) minmax(72px, 0.9fr) minmax(96px, 0.95fr) 28px;
}
.lanternMgmtRecordListHd--missions {
  grid-template-columns: minmax(0, 1.6fr) minmax(72px, 0.7fr) minmax(88px, 0.8fr) 28px;
}
.lanternMgmtRecordListHd--marquee {
  grid-template-columns: minmax(108px, 0.85fr) minmax(0, 1.8fr) minmax(96px, 0.7fr) minmax(72px, 0.55fr) 28px;
}

.lanternMgmtRecordList {
  display: block;
}

.lanternMgmtRecord {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
}
.lanternMgmtRecord:last-child {
  border-bottom: none;
}

.lanternMgmtRecord > summary.lanternMgmtRecordHd {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(72px, 0.7fr) minmax(72px, 0.7fr) 28px;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  box-sizing: border-box;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
}
.lanternMgmtRecord > summary.lanternMgmtRecordHd::-webkit-details-marker {
  display: none;
}
.lanternMgmtRecord--staff > summary.lanternMgmtRecordHd {
  grid-template-columns: minmax(72px, 0.65fr) minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1fr) minmax(64px, 0.55fr) minmax(110px, 1.1fr) minmax(88px, 0.75fr) 28px;
}
.lanternMgmtRecord--students > summary.lanternMgmtRecordHd {
  grid-template-columns: minmax(64px, 0.75fr) minmax(0, 0.95fr) minmax(0, 0.95fr) minmax(48px, 0.45fr) minmax(72px, 0.9fr) minmax(96px, 0.95fr) 28px;
}
.lanternMgmtRecord--missions > summary.lanternMgmtRecordHd {
  grid-template-columns: minmax(0, 1.6fr) minmax(72px, 0.7fr) minmax(88px, 0.8fr) 28px;
}
.lanternMgmtRecord--marquee > summary.lanternMgmtRecordHd {
  grid-template-columns: minmax(108px, 0.85fr) minmax(0, 1.8fr) minmax(96px, 0.7fr) minmax(72px, 0.55fr) 28px;
}

.lanternMgmtRecordCol {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lanternMgmtRecordCol--muted {
  color: var(--muted, #b9c6ea);
  font-weight: 700;
  font-size: 18px;
}
.lanternMgmtRecordChev {
  justify-self: end;
  color: var(--muted, #b9c6ea);
  font-weight: 900;
  line-height: 1;
}
.lanternMgmtRecordChev::before {
  content: '▸';
}
.lanternMgmtRecord[open] > summary .lanternMgmtRecordChev::before {
  content: '▾';
}

.lanternMgmtRecord > summary.lanternMgmtRecordHd:focus-visible {
  outline: 2px solid var(--accent, #5aa7ff);
  outline-offset: 2px;
}
.lanternMgmtRecord > summary.lanternMgmtRecordHd:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Prompt #133 — collapsed record = summary only (no reserved action stack). */
.lanternMgmtRecord:not([open]) > *:not(summary) {
  display: none !important;
}

.lanternMgmtRecordBd {
  padding: 10px 12px 14px;
  border-top: 1px dashed var(--line, rgba(255, 255, 255, 0.12));
  background: rgba(0, 0, 0, 0.14);
}
.lanternMgmtRecordMeta {
  margin: 0 0 10px;
  color: var(--muted, #b9c6ea);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
}
.lanternMgmtRecordActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.lanternMgmtRecordActions .btn {
  margin-top: 0;
  margin-right: 0;
}
.lanternMgmtRecordEditor {
  margin-top: 12px;
}
.lanternMgmtRecordEditor .acctInlinePanel,
.lanternMgmtRecordEditor > .acctInlinePanel {
  max-width: none;
  margin-top: 0;
}

@media (max-width: 720px) {
  .lanternMgmtRecordListHd,
  .lanternMgmtRecordListHd--staff,
  .lanternMgmtRecordListHd--students,
  .lanternMgmtRecordListHd--missions {
    display: none;
  }
  .lanternMgmtRecord > summary.lanternMgmtRecordHd,
  .lanternMgmtRecord--staff > summary.lanternMgmtRecordHd,
  .lanternMgmtRecord--students > summary.lanternMgmtRecordHd,
  .lanternMgmtRecord--missions > summary.lanternMgmtRecordHd {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    grid-template-columns: none;
    align-items: baseline;
  }
  .lanternMgmtRecordChev {
    margin-left: auto;
  }
  .lanternMgmtRecordCol {
    white-space: nowrap;
  }
}

/* Prompt #197 — staff Needs Attention + status chips */
.staffNeedsAttention {
  margin-top: 8px;
  padding-top: 4px;
  border-top: 1px dashed var(--line, rgba(255, 255, 255, 0.12));
}
.staffNeedsAttentionList {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.staffNeedsAttentionRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  padding: 8px 10px;
  font-size: 18px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.14);
  border-radius: 8px;
}
.rosterStatusChip {
  font-weight: 800;
}
.rosterStatusChip--warn {
  color: #f0c674;
}
.rosterStatusChip--ok {
  color: #7dcea0;
}
.rosterStatusChip--muted {
  color: var(--muted, #b9c6ea);
}
.rosterStatusChip--bad {
  color: #f1948a;
}
.staffBlLinkPanel {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line, rgba(255, 255, 255, 0.12));
}
.staffBlLinkPanel label {
  display: block;
  margin-top: 8px;
}
.staffBlLinkPanel select {
  width: 100%;
  max-width: 420px;
}
