/* PE-Class 1.22.03 — roster icon and centered wide student title. */
html.assessmentRosterReconcileOpen,
body.assessmentRosterReconcileOpen,
html.studentStatusModalOpen,
body.studentStatusModalOpen,
html.adminDataUploadOpen,
body.adminDataUploadOpen {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

.assessmentRosterReconcileModal,
.studentStatusModal {
  position: fixed;
  inset: 0;
  z-index: 14020;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  background: rgba(14, 31, 49, .58);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.assessmentRosterReconcileDialog,
.studentStatusDialog {
  width: min(920px, 100%);
  max-width: 100%;
  max-height: min(780px, calc(100dvh - 36px));
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 0;
  overflow: hidden;
  border: 1px solid #d7e3ee;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(9, 29, 48, .3);
  color: #1f374c;
  text-align: center;
  touch-action: pan-y;
}

.assessmentRosterReconcileHead,
.studentStatusHead {
  min-height: 76px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid #e4edf4;
  background: linear-gradient(135deg, #f8fbfe, #edf7ff);
}

.assessmentRosterReconcileHead > div,
.studentStatusHead > div {
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 3px;
}

.assessmentRosterReconcileHead h2,
.assessmentRosterReconcileHead p,
.studentStatusHead h2,
.studentStatusHead p {
  margin: 0;
  text-align: center;
  word-break: keep-all;
}

.assessmentRosterReconcileHead h2,
.studentStatusHead h2 { font-size: 21px; line-height: 1.35; }
.assessmentRosterReconcileHead p,
.studentStatusHead p { color: #688096; font-size: 13px; font-weight: 750; }

.assessmentRosterReconcileClose,
.studentStatusClose {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid #cad9e5;
  border-radius: 12px;
  background: #fff;
  color: #456177;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.assessmentReconcileMetrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px 8px;
}

.assessmentReconcileMetrics > div {
  min-width: 0;
  min-height: 72px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid #dce7ef;
  border-radius: 14px;
  background: #f7fafc;
  text-align: center;
}

.assessmentReconcileMetrics span { color: #61798e; font-size: 12px; font-weight: 800; }
.assessmentReconcileMetrics strong { font-size: 21px; line-height: 1; }
.assessmentReconcileMetrics .is-matched { border-color: #bfe7d1; background: #f0fbf5; color: #127340; }
.assessmentReconcileMetrics .is-missing { border-color: #ffd1a8; background: #fff8ef; color: #ad4e00; }

.assessmentReconcileSafety,
.assessmentReconcileWarning {
  margin: 8px 18px 0;
  min-height: 58px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 14px;
  border-radius: 13px;
  text-align: center;
  word-break: keep-all;
}

.assessmentReconcileSafety { border: 1px solid #bfe2f8; background: #eef8ff; color: #315b79; }
.assessmentReconcileWarning { border: 1px solid #ffd3a7; background: #fff7eb; color: #8b4c13; }
.assessmentReconcileSafety strong,
.assessmentReconcileWarning strong { font-size: 14px; }
.assessmentReconcileSafety span,
.assessmentReconcileWarning span { font-size: 12px; font-weight: 700; line-height: 1.45; }

.assessmentReconcileBody,
.studentStatusBody {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding: 14px 18px 18px;
  scrollbar-gutter: stable;
}

.assessmentReconcileBody section { display: grid; gap: 8px; }
.assessmentReconcileBody section + section { margin-top: 16px; }
.assessmentReconcileBody h3 { margin: 0; font-size: 15px; text-align: center; }
.assessmentReconcileStudentList { display: grid; gap: 8px; }

.assessmentReconcileStudentRow {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(180px, .9fr) minmax(240px, 1.25fr) minmax(150px, .75fr);
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  border: 1px solid #dbe6ee;
  border-radius: 14px;
  background: #fbfdff;
}

.assessmentReconcileIdentity,
.assessmentReconcileAction,
.assessmentReconcileDate,
.assessmentReconcileDate.is-placeholder {
  min-width: 0;
  min-height: 64px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f2f7fb;
  text-align: center;
}

.assessmentReconcileIdentity strong { font-size: 15px; line-height: 1.4; }
.assessmentReconcileIdentity span,
.assessmentReconcileAction > span,
.assessmentReconcileDate > span { color: #657d91; font-size: 11px; font-weight: 800; }

.assessmentReconcileAction select,
.assessmentReconcileDate input,
.studentStatusBody select,
.studentStatusBody input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid #c7d6e2;
  border-radius: 9px;
  background: #fff;
  color: #223d54;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
  text-align-last: center;
}

.assessmentReconcileDate.is-hidden { visibility: hidden; pointer-events: none; }
.assessmentReconcileEmpty { min-height: 90px; display: grid; place-items: center; color: #71869a; font-weight: 750; text-align: center; }

.assessmentRosterReconcileActions,
.studentStatusActions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid #e2eaf1;
  background: #fff;
}

.assessmentRosterReconcileActions > button,
.studentStatusActions > button {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 48px !important;
  height: 48px !important;
  box-sizing: border-box;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 14px !important;
  text-align: center !important;
  white-space: normal !important;
}

.studentStatusBody { display: grid; gap: 12px; }
.studentStatusStudent {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: 12px;
  background: #f2f7fb;
  text-align: center;
}
.studentStatusField { display: grid; gap: 6px; text-align: center; }
.studentStatusField > span { color: #627a8e; font-size: 12px; font-weight: 850; }
.studentStatusPreserve { margin: 0; padding: 11px; border-radius: 11px; background: #eef8ff; color: #365f7a; font-size: 12px; font-weight: 750; line-height: 1.55; text-align: center; }

.studentRosterInactiveToggle {
  min-height: 42px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

.studentRosterButtonIcon {
  flex: 0 0 auto;
  margin-inline-end: .3em;
}
.studentRosterButtonLines {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3em;
  white-space: nowrap;
}

/* 비활성 학생이 있을 때만 왼쪽 칸을 추가하고, 없으면 기존 두 칸만 쓴다. */
@media (min-width: 769px) {
  html[data-pe-tab="students"] #app.studentScreen
  > .studentManagementHeader > .studentHeaderRosterActions {
    width: min(39vw, 440px) !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  html[data-pe-tab="students"] #app.studentScreen
  > .studentManagementHeader > .studentHeaderRosterActions.hasInactiveStudents {
    width: min(58vw, 660px) !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  html[data-pe-tab="students"] #app.studentScreen
  > .studentManagementHeader > .studentHeaderRosterActions > .btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 9px !important;
    white-space: normal !important;
    line-height: 1.2 !important;
  }
}

@media (max-width: 768px) {
  body:has(#mobileStudentSelector) #app .studentRosterActions {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 7px !important;
    margin-left: 0 !important;
  }

  body:has(#mobileStudentSelector) #app .studentRosterActions.hasInactiveStudents {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body:has(#mobileStudentSelector) #app .studentRosterActions > .btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    height: 48px !important;
    box-sizing: border-box !important;
    padding: 4px 5px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: normal !important;
    line-height: 1.15 !important;
    text-align: center !important;
    font-size: 11px !important;
  }

  body:has(#mobileStudentSelector) #app .studentRosterButtonLines {
    flex-direction: column;
    gap: 0;
    line-height: 1.15;
  }
}
.studentBtn.is-inactive { opacity: .82; background: #f4f6f8; }
.studentStatusBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  margin-left: 7px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff1e6;
  color: #a44800;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}
.studentDetailTitleRow {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100% !important;
  text-align: center !important;
}
.studentDetailTitleText {
  min-width: 0;
  text-align: center;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.studentDetailStatusButton {
  min-width: 136px;
  min-height: 44px;
  margin-left: auto;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

/* 넓은 화면에서는 양쪽 바깥 칸을 같은 너비로 두어 제목을 카드 정중앙에 고정한다. */
@media (min-width: 769px) {
  .studentDetailTitleRow {
    grid-template-columns: minmax(136px, 1fr) minmax(0, auto) minmax(136px, 1fr) !important;
  }
  .studentDetailTitleText {
    grid-column: 2;
    justify-self: center;
  }
  .studentDetailStatusButton {
    grid-column: 3;
    justify-self: end;
    margin-left: 0;
  }

  /* Fold 펼침의 좁은 상세 칸에서도 대칭을 유지하되 제목과 버튼이 겹치지 않게 한다. */
  html[data-pe-fold-wide="true"] .studentDetailTitleRow,
  html.pe87FoldWide .studentDetailTitleRow {
    grid-template-columns: minmax(88px, 1fr) minmax(0, auto) minmax(88px, 1fr) !important;
    gap: 8px !important;
  }
  html[data-pe-fold-wide="true"] .studentDetailTitleText,
  html.pe87FoldWide .studentDetailTitleText {
    font-size: 15px;
    line-height: 1.25;
  }
  html[data-pe-fold-wide="true"] .studentDetailStatusButton,
  html.pe87FoldWide .studentDetailStatusButton {
    width: 88px;
    min-width: 88px;
    padding: 7px 6px !important;
    font-size: 11px;
    line-height: 1.15;
    white-space: normal;
  }
}

@media (max-width: 700px) {
  .assessmentRosterReconcileModal,
  .studentStatusModal { padding: 10px; }
  .assessmentRosterReconcileDialog,
  .studentStatusDialog { max-height: calc(100dvh - 20px); border-radius: 18px; }
  .assessmentRosterReconcileHead,
  .studentStatusHead { min-height: 68px; padding: 12px 14px; }
  .assessmentRosterReconcileHead h2,
  .studentStatusHead h2 { font-size: 18px; }
  .assessmentReconcileMetrics { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px 12px 5px; gap: 7px; }
  .assessmentReconcileMetrics > div { min-height: 58px; padding: 7px; }
  .assessmentReconcileSafety,
  .assessmentReconcileWarning { margin: 7px 12px 0; }
  .assessmentReconcileBody,
  .studentStatusBody { padding: 11px 12px 14px; }
  .assessmentReconcileStudentRow { grid-template-columns: 1fr; }
  .assessmentReconcileIdentity,
  .assessmentReconcileAction,
  .assessmentReconcileDate,
  .assessmentReconcileDate.is-placeholder { min-height: 54px; }
  .assessmentReconcileDate.is-hidden { display: none; }
  .assessmentRosterReconcileActions,
  .studentStatusActions { padding: 11px 12px 13px; gap: 8px; }
  .studentDetailTitleRow { gap: 8px !important; }
  .studentDetailTitleText { font-size: 15px; }
  .studentDetailStatusButton {
    min-width: 116px;
    min-height: 44px;
    padding: 8px 9px;
    font-size: 12px;
  }
}
