/* ---------------------------------------------------------------------------
 * 서체 — 두 갈래다
 *
 *   큰 타이틀·큰 숫자   Jua          둥근 제목용. 크게 쓸 때만 제 몫을 한다
 *   그 밖의 모든 글      Pretendard   중간 크기부터 본문·표·뱃지·라벨·단추까지
 *
 * 중간 크기에 제목용 서체를 쓰지 않는다. 윈도우 DirectWrite 는 작은 크기에서
 * 획을 픽셀 격자에 맞춰 깎는데, 제목용 서체는 그 과정에서 획이 뭉개진다.
 * 맥에서는 멀쩡해 보여도 윈도우에서 깨져 보이는 것이 이 때문이다.
 *
 * --font-ui 는 그 「중간부터 작은 글씨」 자리를 가리킨다. 자리마다 서체를
 * 직접 적지 않고 토큰 하나로 모아 둬야 다음에 또 갈아 낄 때 여기만 고친다.
 * --------------------------------------------------------------------------- */
:root {
  --font-ui: 'Pretendard', 'Pretendard Variable', 'Nanum Gothic', 'MICEGothic',
    -apple-system, BlinkMacSystemFont, sans-serif;
  /*
   * 18px 부터 쓴다. 그 아래에서는 윈도우 DirectWrite 가 획을 픽셀 격자에
   * 맞춰 깎아 둥근 획이 붙어 버린다. 굵기는 400 하나뿐이라 700 을 걸면
   * 브라우저가 억지로 굵혀 같은 증상이 난다.
   */
  --font-display: 'Jua', 'Pretendard', 'Nanum Gothic', sans-serif;
}

/*
 * 브라우저 기본 글꼴이 새어 나오는 자리를 막는다.
 *
 *   폼 요소  input·select·textarea·button 은 서체를 물려받지 않는다. 부트스트랩이
 *            .btn·.form-control·.form-select 에는 inherit 을 걸어 주지만, 그
 *            클래스가 없는 알몸 요소는 운영체제 기본 글꼴로 그려진다
 *   고정폭   code·kbd·pre·samp 는 기본이 monospace 다. 한글이 섞이면 한글만
 *            기본 글꼴로 떨어져 한 줄에 두 글꼴이 섞인다
 *
 * 키오스크는 이 파일을 싣지 않는다 — 자기 CSS 에서 따로 잡는다.
 */
input,
select,
textarea,
button,
optgroup,
option,
code,
kbd,
pre,
samp {
  font-family: inherit;
}

/**
 * PMRTI v5.4 — 포스 다면적 독서유형 검사
 * ---------------------------------------------------------------------------
 * 이 파일은 검사 화면·교사 대시보드·모달 등 전체 UI의 스타일을 정의합니다.
 * 색상은 CSS 변수(:root)로 모아 두었으며, 다크 모드는 prefers-color-scheme로 전환됩니다.
 * 폰트: Pretendard·나눔(구글), MICE고딕·잘난고딕(noonfonts CDN @font-face) — 라이선스는 각 배포처 기준.
 */

/* ---------------------------------------------------------------------------
 * 웹폰트 (MICE고딕, 여기어때 잘난고딕 계열)
 * --------------------------------------------------------------------------- */
@font-face {
  font-family: 'MICEGothic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2206-01@1.0/MICEGothic.woff2') format('woff2');
}
@font-face {
  font-family: 'JalnanGothic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('JalnanGothic'),
       url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_231029@1.1/JalnanGothic.woff') format('woff');
}

/* ---------------------------------------------------------------------------
 * 전역 리셋 및 박스 모델
 * 모든 요소에 border-box를 적용해 padding이 width에 포함되도록 합니다.
 * --------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/**
 * 디자인 토큰(색·반경 등)
 * - 라이트 모드 기본값
 * - 텍스트/배경/강조색은 섹션별(블루, 틸, 코랄 등)로 구분
 */
:root {
  --bg:#ffffff; --bg2:#f5f5f0; --bg3:#eeede8;
  --text:#1a1a1a; --text2:#5f5e5a; --text3:#303030;
  --border:rgba(0,0,0,0.12); --border2:rgba(0,0,0,0.22);
  --blue-bg:#E6F1FB; --blue-mid:#378ADD; --blue-dark:#0C447C; --blue-med:#185FA5; --blue-light:#85B7EB;
  --teal-bg:#E1F5EE; --teal-dark:#085041; --green-mid:#1D9E75;
  --coral-bg:#FAECE7; --coral-dark:#8F3A22;
  --amber-bg:#FAEEDA; --amber-dark:#633806; --amber-mid:#BA7517;
  --purple-bg:#EEEDFE; --purple-dark:#3C3489; --purple-mid:#7F77DD;
  --red-bg:#FCEBEB; --red-dark:#A32D2D;
  --radius:10px; --radius-lg:12px;
}

/**
 * 시스템 다크 모드 선호 시 색상 역전
 * 사용자 OS/브라우저 설정에 맞춰 자동으로 어두운 팔레트로 전환됩니다.
 */
@media (prefers-color-scheme:dark) {
  :root {
    --bg:#1e1e1e; --bg2:#2a2a2a; --bg3:#333333;
    --text:#f0f0f0; --text2:#aaaaaa; --text3:#303030;
    --border:rgba(255,255,255,0.12); --border2:rgba(255,255,255,0.22);
    --blue-bg:#0c2a45; --blue-dark:#85B7EB; --blue-med:#B5D4F4; --blue-light:#185FA5;
    --teal-bg:#04342c; --teal-dark:#9FE1CB;
    --coral-bg:#4a1b0c; --coral-dark:#F0997B;
    --amber-bg:#412402; --amber-dark:#FAC775;
    --purple-bg:#26215c; --purple-dark:#AFA9EC;
    --red-bg:#501313; --red-dark:#F09595;
  }
}

/* 본문: Pretendard → 나눔고딕 → MICE고딕 순, 배경·여백 */
body.pmrti-body {
  font-family: 'Pretendard', 'Pretendard Variable', 'Nanum Gothic', 'MICEGothic', -apple-system, BlinkMacSystemFont,
    'Segoe UI', 'Noto Sans KR', sans-serif;
  font-size: 1.05rem;
  background: var(--bg2);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 48px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.pmrti-page.container {
  max-width: 960px;
}
body.teacher-dashboard-wide .pmrti-page.container {
  max-width: 1200px;
}
.pmrti-title-display {
  font-family: 'JalnanGothic', 'Pretendard', 'Nanum Gothic', 'MICEGothic', sans-serif;
  font-size: clamp(1.45rem, 3.8vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
}
.header h1.pmrti-title-display {
  font-family: 'JalnanGothic', 'Pretendard', 'Nanum Gothic', 'MICEGothic', sans-serif !important;
  font-size: clamp(1.45rem, 3.8vw, 2rem);
  font-weight: 400;
}
.intro-title,
.auth-page-title,
.pw-title,
.modal-title {
  font-family: 'Pretendard', 'Nanum Myeongjo', 'Nanum Gothic', serif;
  letter-spacing: -0.02em;
}
.auth-page-title {
  font-family: 'JalnanGothic', 'Pretendard', 'Nanum Gothic', 'MICEGothic', sans-serif;
  font-weight: 400 !important;
  font-synthesis: none;
  -webkit-text-stroke: 0;
  text-shadow: none;
}

/* ========== 상단 헤더(로고 뱃지 + 제목) ========== */
.header { text-align:center; margin-bottom:0; background:transparent; border:none; border-radius:0; }
.header .card-body { text-align:center; background:var(--bg); }
.header-badge { display:inline-block; padding:4px 12px; background:var(--blue-bg); color:var(--blue-dark); font-size:13px; font-weight:700; border-radius:20px; margin-bottom:8px; letter-spacing:0.4px; }
.header h1 { font-size:21px; font-weight:700; margin-bottom:5px; }
.header p { font-size:12px; color:var(--text2); }
#headerSchoolName {
  font-size: 1.02rem !important;
  font-weight: 700;
}

/* 학생 인증: 링크로 확정된 학교명 */
.auth-school-banner {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--blue-dark, #1a4d8f);
  padding: 10px 14px;
  background: var(--blue-bg, #e8f0fa);
  border-radius: 0.5rem;
  line-height: 1.5;
}
.auth-school-banner i { margin-right: 6px; opacity: 0.85; }
.auth-library-verify-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.auth-library-verify-row .form-control {
  min-width: 0;
  flex: 1 1 auto;
}
.auth-library-verify-row .btn {
  flex: 0 0 auto;
  min-width: 88px;
  white-space: nowrap;
}
.auth-library-verify-msg {
  margin-top: 6px;
  font-size: .9rem;
  color: var(--text3);
}
.auth-library-verify-msg.ok { color: var(--green-dark, #1f7a45); font-weight: 700; }
.auth-library-verify-msg.error { color: var(--red-dark); font-weight: 700; }
.auth-library-verify-msg.pending { color: var(--blue-dark); font-weight: 700; }

body.pmrti-admin-body .pmrti-page.container {
  max-width: 1200px;
}

.dash-top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.teacher-settings-wrap {
  margin-bottom: 24px;
}
.teacher-settings-section {
  margin-bottom: 1.5rem;
}
.teacher-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 22px;
  align-items: start;
}
.teacher-settings-grid .teacher-settings-section {
  margin-bottom: 0;
}
.teacher-settings-dls-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 22px;
  align-items: start;
}
.teacher-settings-select {
  width: 100%;
}
.teacher-settings-meta code {
  font-size: 0.85em;
}
.teacher-settings-grade-section {
  grid-column: 1 / -1;
}
.teacher-settings-grade-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 4px;
}
.teacher-settings-grade-checks .form-check {
  margin-bottom: 0;
  min-width: 4.5rem;
}
.teacher-settings-save-bar {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--bs-border-color, rgba(0, 0, 0, 0.12));
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}
@media (max-width: 992px) {
  .teacher-settings-grid,
  .teacher-settings-dls-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== 학생/교사 탭 전환(레거시 단일 페이지) ========== */
.tab-row {
  display: flex;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--bs-border-color, rgba(0,0,0,.12));
  border-radius: 0.9rem;
  padding: 8px;
  margin-bottom: 18px;
}
.tab-row.card {
  flex-direction: row;
}
.tab-btn {
  flex: 1;
  min-height: 42px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  background: var(--bs-light, #f8f9fa);
  color: var(--text2);
  cursor: pointer;
  transition: all .15s ease;
}
.tab-btn:hover {
  color: var(--bs-primary, #158cba);
  border-color: rgba(21, 140, 186, .22);
  background: #f4faff;
}
.tab-btn.active {
  background: var(--bs-primary, #158cba);
  color: #fff;
  border-color: var(--bs-primary, #158cba);
  box-shadow: 0 6px 14px rgba(21, 140, 186, .22);
}

/* ========== 공통 버튼·내비게이션 ========== */
.nav { display:flex; gap:10px; margin-top:18px; flex-wrap:wrap; align-items:center; }

/* 교사·마스터 대시보드 하단 액션 버튼 색상 */
#teacher-view .nav .btn-dash-print {
  color: #fff;
  background: #6b7280;
  border-color: #6b7280;
}
#teacher-view .nav .btn-dash-print:hover,
#teacher-view .nav .btn-dash-print:focus {
  color: #fff;
  background: #52525b;
  border-color: #52525b;
}

/* 학생 결과 화면 — 출력(회색) · 다시 검사(파란 primary) */
.student-result-nav {
  gap: 12px;
  margin-top: 22px;
}
.student-result-nav .btn-print-result {
  flex: 1 1 42%;
  min-width: 160px;
  min-height: 48px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.student-result-nav .btn-restart-exam {
  flex: 1 1 52%;
  min-width: 160px;
  min-height: 48px;
  font-weight: 700;
}
@media (max-width: 480px) {
  .student-result-nav .btn-print-result,
  .student-result-nav .btn-restart-exam {
    flex: 1 1 100%;
    width: 100%;
  }
}
.warn-msg { font-size:.92rem; color:var(--red-dark); margin-top:8px; }
.single-next-auto-hint { margin-top: 0; margin-left: 6px; white-space: nowrap; }

/* ========== Ollama 연결 상태 표시줄 ========== */
.ollama-status { display:flex; align-items:center; gap:8px; padding:8px 14px; border-radius:8px; font-size:12px; margin-bottom:14px; border:0.5px solid var(--border); background:var(--bg); }
.status-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.status-dot.ok   { background:#1D9E75; }
.status-dot.fail { background:#A32D2D; }
.status-dot.wait { background:#BA7517; animation:blink 1.2s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ========== AI 학급 분석 결과 박스 ========== */
.ai-box { background:var(--bg); border:0.5px solid var(--purple-mid); border-radius:10px; padding:16px; margin-top:12px; }
.ai-box-header { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.ai-badge { display:inline-flex; align-items:center; gap:4px; padding:3px 9px; background:var(--purple-bg); color:var(--purple-dark); border-radius:5px; font-size:12px; font-weight:700; }
.ai-content { font-size:13px; color:var(--text); line-height:1.85; white-space:pre-wrap; }
.ai-content.streaming::after { content:'▋'; display:inline-block; animation:blink .7s infinite; color:var(--purple-mid); }


.ai-loading { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--text2); padding:10px 0; }
.ai-spinner { width:14px; height:14px; border:2px solid var(--border2); border-top-color:var(--purple-mid); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to{transform:rotate(360deg)} }

/* ========== 학생 상세 팝업 내 AI 지도안 영역 ========== */
.stu-ai-wrap { margin-top:12px; border-top:0.5px solid var(--border); padding-top:12px; }
.stu-ai-title { font-size:12px; font-weight:700; color:var(--purple-dark); margin-bottom:8px; display:flex; align-items:center; gap:6px; }
.stu-ai-content { font-size:12px; color:var(--text); line-height:1.8; white-space:pre-wrap; background:var(--purple-bg); border-radius:8px; padding:10px 12px; min-height:40px; }
.stu-ai-content.streaming::after { content:'▋'; display:inline-block; animation:blink .7s infinite; color:var(--purple-mid); }

/* ========== 인증키 조회(첫 화면) ========== */
.auth-wrap {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--bs-border-color, rgba(0, 0, 0, 0.12));
  border-radius: 1rem;
  padding: 1.25rem 1.15rem 1.35rem;
  box-shadow: var(--bs-box-shadow-sm, 0 .125rem .25rem rgba(0,0,0,.075));
}
.auth-page-title {
  font-size: clamp(1.2rem, 2.6vw, 1.5rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: .4rem;
  color: var(--text);
}
.auth-page-desc {
  font-size: .93rem;
  color: var(--text2);
  text-align: center;
  line-height: 1.65;
  margin-bottom: 1rem;
}
.auth-section-label {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .65rem;
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--text);
}
.auth-section-label .auth-icon {
  display: inline-block;
  width: .55rem;
  height: .55rem;
  background: var(--bs-primary, #158cba);
  border-radius: 50%;
}
.auth-hint-text {
  color: #2b3138 !important;
}
.auth-box {
  border: 1px solid var(--bs-border-color, rgba(0, 0, 0, 0.15));
  background: var(--bg);
  border-radius: .9rem;
  padding: 1rem .95rem .95rem;
  margin-bottom: 1rem;
}
.auth-box.border-primary {
  border-color: var(--bs-primary, #158cba) !important;
}
.auth-field-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: .78rem;
  flex-wrap: nowrap;
}
.auth-field-row label {
  width: 116px;
  flex-shrink: 0;
  font-size: .86rem;
  font-weight: 600;
  color: var(--text);
}
.auth-inline-control {
  flex: 1 1 auto;
  min-width: 0;
}
.auth-field-row input,
.auth-school-controls .auth-input-readonly,
.school-search-input {
  width: 100%;
  min-width: 0;
  padding: .6rem .78rem;
  font-size: .9rem;
  border: var(--bs-border-width, 1px) solid var(--bs-border-color, rgba(0, 0, 0, .2));
  border-radius: var(--bs-border-radius, .375rem);
  background: var(--bg);
  color: var(--text);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, .035);
  outline: none;
  transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
.auth-field-row select.form-select {
  width: 100%;
  min-width: 0;
  font-size: .9rem;
  border: var(--bs-border-width, 1px) solid var(--bs-border-color, rgba(0, 0, 0, .2));
  border-radius: var(--bs-border-radius, .375rem);
  color: var(--text);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, .035);
  transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
  background-color: var(--bg);
}
.auth-field-row input:focus,
.auth-field-row select:focus,
.school-search-input:focus {
  border-color: rgba(21, 140, 186, .45);
  box-shadow: 0 0 0 .2rem rgba(21, 140, 186, .2);
}

/* 인증: 학년 + 반 한 줄 */
.auth-grade-class-inputs {
  margin: 0;
  display: flex;
  gap: .5rem;
}
.auth-grade-class-inputs .form-select,
.auth-grade-class-inputs .form-control {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
}
.auth-privacy-block { margin-bottom: 1rem; }
.auth-privacy-title {
  font-size: .84rem;
  font-weight: 700;
  margin-bottom: .45rem;
  color: var(--text);
}
.auth-privacy-scroll {
  height: 220px;
  overflow-y: auto;
  outline: none;
  border: 1px solid var(--bs-border-color, rgba(0, 0, 0, .12));
  border-radius: .65rem;
  padding: .72rem .82rem;
  font-size: .8rem;
  line-height: 1.7;
  color: var(--text2);
  background: var(--bs-tertiary-bg, var(--bg2));
}
.auth-privacy-scroll p { margin-bottom:10px; }
.auth-privacy-scroll p:last-child { margin-bottom:0; }
.auth-consent-row {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin-bottom: 1rem;
  font-size: .86rem;
  color: var(--text);
  cursor: pointer;
}
.auth-consent-row input {
  margin-top: .14rem;
  flex-shrink: 0;
  accent-color: var(--bs-primary, #158cba);
  transform: scale(1.22);
  transform-origin: center;
  cursor: pointer;
}
.auth-consent-row .form-check-label {
  cursor: pointer;
}
.btn-auth-submit {
  font-weight: 700;
  transition: filter .15s, transform .05s;
}
.btn-auth-submit:hover { filter: brightness(0.985); }
.btn-auth-submit:active { transform:scale(.99); }
.btn-auth-submit:disabled { opacity:.45; cursor:not-allowed; }

/* 인증: 학교명은 읽기 전용 + 검색 버튼 */
.auth-school-row .auth-school-controls {
  display: flex;
  flex: 1;
  min-width: 160px;
  gap: 0;
  align-items: stretch;
}
.auth-school-controls .auth-input-readonly { background: var(--bs-tertiary-bg, var(--bg3)); cursor: default; }
.auth-school-controls .btn {
  flex-shrink: 0;
  flex: 0 0 120px;
  width: 120px;
  padding: 10px 16px;
  white-space: nowrap;
}
.auth-school-controls.input-group {
  flex-wrap: nowrap;
}
.auth-school-controls .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 학교 검색 모달 */
.school-search-modal { max-width: 520px; }
.school-search-modal .modal-header {
  margin-bottom: 0 !important;
}
.school-search-modal .modal-body.school-search-body {
  padding: 0.2rem 0.75rem 0.75rem !important;
}
.school-search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: stretch;
}
.school-search-input { min-width: 0; }
.school-search-bar .btn {
  width: 120px;
  flex: 0 0 120px;
}
.school-search-hint {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 10px;
  line-height: 1.5;
}
.school-search-results {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: .75rem;
  background: #f8fbff;
  padding: 6px;
  box-shadow: none;
}
.school-search-item {
  position: relative;
  padding: 11px 12px 11px 14px;
  border: 1px solid rgba(0, 0, 0, .07);
  border-radius: .6rem;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  line-height: 1.45;
  background: #fff;
  margin-bottom: 6px;
  width: 100%;
  color: var(--text);
  font-family: inherit;
  transition: background-color .14s ease, border-color .14s ease, box-shadow .14s ease, transform .12s ease;
}
.school-search-item:last-child { margin-bottom: 0; }
.school-search-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 99px;
  background: transparent;
  transition: background-color .14s ease;
}
.school-search-item:hover {
  background: #f3f8ff;
  border-color: rgba(21, 140, 186, .35);
  box-shadow: 0 4px 12px rgba(21, 140, 186, .12);
  transform: translateY(-1px);
}
.school-search-item:hover::before {
  background: var(--bs-primary, #158cba);
}
/* 한 줄: 학교명(굵게) · 주소 — 학교ID는 표시하지 않음 */
.school-search-item .school-one-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
}
.school-search-item .school-name-main {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
}
.school-search-item .school-addr-inline {
  display: block;
  color: var(--text2);
  font-weight: 500;
  font-size: 14px;
}
.school-search-item .school-addr-empty {
  color: var(--text3);
  font-style: italic;
}
.school-search-empty { padding: 16px; font-size: 15px; color: var(--text3); text-align: center; }

@media (max-width: 768px) {
  .auth-field-row {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .auth-field-row label {
    width: 100%;
  }
  .auth-grade-class-inputs {
    flex-direction: column;
  }
  .intro-card {
    padding: 1.05rem .95rem 1.15rem;
  }
  .intro-grid {
    gap: 8px;
  }
  .intro-item {
    padding: 10px 11px;
  }
  .intro-item-val {
    font-size: 1.25rem;
  }
  .prog-label {
    font-size: .93rem;
  }
  .sec-title {
    font-size: 1.4rem;
  }
  .pip-examiner-line {
    font-size: 1.25rem;
  }
  .pip-examiner-label,
  .pip-examiner-after-label,
  .pip-examiner-val,
  .pip-examiner-sep {
    font-size: 1.25rem;
  }
  .q-text {
    font-size: 1.12rem;
  }
  .lk-btn,
  .qty-btn {
    font-size: .94rem;
    padding: 10px 5px;
  }
}

/* ========== 검사 시작 전 안내 카드 ========== */
.intro-card {
  background: var(--bg);
  border: 1px solid var(--bs-border-color, rgba(0, 0, 0, 0.12));
  border-radius: 1rem;
  padding: 1.25rem 1.15rem 1.35rem;
  margin-bottom: 14px;
  box-shadow: var(--bs-box-shadow-sm, 0 .125rem .25rem rgba(0,0,0,.075));
}
.intro-title {
  font-family: 'JalnanGothic', 'Pretendard', 'Nanum Gothic', 'MICEGothic', sans-serif;
  font-size: clamp(1.2rem, 2.8vw, 1.45rem);
  font-weight: 400;
  margin-bottom: 4px;
}
.intro-sub { font-size: .94rem; color: var(--text2); margin-bottom: 14px; }
.intro-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:16px; }
.intro-item {
  background: #f8fbff;
  border: 1px solid rgba(21, 140, 186, .14);
  border-radius: .75rem;
  padding: 12px 13px;
}
.intro-item-head {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: 3px;
  white-space: nowrap;
}
.intro-item-icon {
  font-size: 17px;
  margin-bottom: 0;
  color: var(--bs-primary, #158cba);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}
.intro-item-label {
  font-size: 13px;
  color: var(--bs-primary, #158cba);
  margin-bottom: 0;
  line-height: 1;
  white-space: nowrap;
}
.intro-item-val { font-size:1.45rem; font-weight:700; color: var(--text); }
.intro-notice {
  background: #fff8ea;
  border: 1px solid rgba(255, 193, 7, .35);
  border-radius: .75rem;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.intro-notice p {
  font-size: 1rem;
  color: #6b4d12;
  line-height: 1.7;
  margin-bottom: .45rem;
}
.intro-notice p:last-child {
  margin-bottom: 0;
}
.intro-notice p::before { content:""; }
.intro-guide-text {
  font-size: .94rem !important;
  line-height: 1.8 !important;
}

/* ========== 교사 대시보드 비밀번호 화면 ========== */
.pw-wrap {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--bs-border-color, rgba(0,0,0,.12));
  border-radius: 1rem;
  padding: 1.4rem 1.15rem 1.35rem;
  text-align: center;
  box-shadow: var(--bs-box-shadow-sm, 0 .125rem .25rem rgba(0,0,0,.075));
}
.pw-title {
  font-family: 'JalnanGothic' !important;
  font-size: clamp(1.15rem, 2.6vw, 1.45rem);
  font-weight: 400 !important;
  font-synthesis: none;
  -webkit-text-stroke: 0;
  text-shadow: none;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin-bottom: .4rem;
  color: var(--text);
}
.pw-sub {
  font-size: .95rem;
  color: var(--text2);
  margin-bottom: 1rem;
  line-height: 1.65;
}
.pw-input {
  width: 100%;
  max-width: 320px;
  padding: 11px 14px;
  font-size: 1rem;
  text-align: center;
  letter-spacing: 4px;
  border: 1px solid var(--border2);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 6px;
  outline: none;
}
.pw-input:focus { border-color: var(--bs-primary, var(--blue-mid)); box-shadow: none; }
.pw-err { font-size: .92rem; color: var(--red-dark); margin-bottom: 4px; min-height: 16px; }
.pw-wrap button.btn-primary {
  width: 100%;
  max-width: 320px;
  display: block;
  margin: 0 auto;
}
.pw-hint { font-size: .9rem; color: var(--text3); margin-top: 12px; line-height: 1.7; }

@media (max-width:480px) {
  .pw-input { max-width: 100%; }
  .pw-wrap .btn-primary { width: 100%; }
}

/* ========== 섹션 진행률 바 ========== */
.prog-wrap { margin-bottom:16px; }
.prog-label { font-size:.98rem; color:var(--text2); margin-bottom:7px; }
.prog-meta { font-size:.85rem; color:var(--text3); }
.prog-bar {
  --bs-progress-height: 9px;
  height: var(--bs-progress-height);
  background: var(--bg3);
  border-radius: 999px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  background-color: var(--bs-primary, #158cba) !important;
  transition: width .35s;
}
/* 1문항 모드: 현재 영역 진행바(bg-success) — primary 덮어쓰기 없이 높이만 맞춤 */
.progress.prog-bar > .progress-bar.pmrti-prog-bar-fill {
  height: 100%;
}
.prog-wrap.prog-wrap-dual {
  margin-bottom: 10px;
}
.prog-dual-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.98rem;
  color: var(--text2);
  gap: 10px;
}
.prog-dual-head strong {
  font-weight: 600;
  color: var(--text);
}
.prog-dual-head span:last-child {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.reason-experience-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -2px 0 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 193, 7, 0.32);
  background: linear-gradient(135deg, rgba(255, 248, 214, 0.98), rgba(255, 242, 184, 0.95));
  color: #7a5600;
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.45;
}
.reason-experience-banner i {
  color: #d39100;
}

/* ========== 검사 중 검사자 정보(제목+학교명·학년·이름 한 줄) ========== */
.sec-title { font-size:1.65rem; font-weight:700; margin-bottom:14px; }
.participant-info-panel {
  background: var(--bg);
  border: 1px solid var(--bs-border-color, var(--border2));
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 18px;
  box-shadow: var(--bs-box-shadow-sm, 0 .125rem .25rem rgba(0,0,0,.075));
}
.pip-examiner-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.55;
  word-break: break-word;
}
.pip-examiner-label {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--bs-primary, #158cba);
  flex-shrink: 0;
}
.pip-examiner-after-label {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--bs-primary, #158cba);
  flex-shrink: 0;
  user-select: none;
}
.pip-examiner-val { min-width: 0; font-weight: 700; font-size: 1.25rem; }
.pip-examiner-sep {
  color: var(--text3);
  font-weight: 700;
  font-size: 1.25rem;
  flex-shrink: 0;
  user-select: none;
}
.info-row { display:flex; gap:10px; margin-bottom:14px; flex-wrap:wrap; }
.info-row input, .info-row select { flex:1; min-width:130px; padding:9px 11px; font-size:13px; border:0.5px solid var(--border2); border-radius:8px; background:var(--bg); color:var(--text); outline:none; }
.info-row input:focus, .info-row select:focus { border-color:var(--blue-mid); }

@media (prefers-color-scheme: dark) {
  .participant-info-panel { box-shadow: none; }
}

/* ========== 문항 카드(리커트·독서량 선택) ========== */
.q-card {
  background: var(--bg);
  border: 1px solid var(--bs-border-color, var(--border));
  border-radius: .9rem;
  padding: 16px 16px 14px;
  margin-bottom: 12px;
  box-shadow: var(--bs-box-shadow-sm, 0 .125rem .25rem rgba(0,0,0,.075));
}
.q-num { font-size:1rem; color:var(--text3); margin-bottom:3px; }
/*
 * 문항 글은 제목용 서체를 쓰지 않는다. 29문항을 계속 읽는 자리라
 * 획이 굵고 둥근 서체는 한 문장만 봐도 무겁다. 본문 서체로 둔다.
 */
.q-text {
  font-size: 1.28rem;
  margin-bottom: 12px;
  line-height: 1.6;
  color: var(--text);
}
.likert { display:grid; grid-template-columns:repeat(4,1fr); gap:7px; }
.lk-btn {
  padding: 11px 8px;
  min-height: 72px;
  font-size: 1.02rem;
  text-align: center;
  line-height: 1.35;
  display: block;
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--bs-border-color, var(--border));
  border-radius: .65rem;
  cursor: pointer;
  color: var(--text2);
  transition: all .12s ease;
  font-weight: 500;
}
.lk-btn .lk-label,
.qty-btn .lk-label {
  white-space: pre-line;
  text-align: center;
  display: block;
  width: 100%;
}
/* 4지 버튼 좌측 숫자: Font Awesome 1~4 (배지 없이 아이콘만) */
.likert .lk-num-icon,
.qty-row .lk-num-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: auto;
  height: auto;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  color: var(--text2);
  pointer-events: none;
}
.likert .lk-num-icon > i,
.qty-row .lk-num-icon > i {
  font-size: 0.75rem;
  line-height: 1;
  display: block;
}
.lk-btn.sel .lk-num-icon,
.qty-btn.sel .lk-num-icon {
  background: none;
  border: none;
  color: var(--blue-dark);
}
.lk-btn .lk-check-icon,
.qty-btn .lk-check-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  font-size: .8rem;
  line-height: 1;
  color: var(--blue-mid);
  opacity: 0;
}
.lk-btn .lk-check-icon.on,
.qty-btn .lk-check-icon.on {
  opacity: 1;
}
/* 학생 검사 4지: 버튼 전체가 아닌 라벨 텍스트만 색상 구분 */
.likert .lk-btn:nth-child(1) .lk-label,
.qty-row .qty-btn:nth-child(1) .lk-label { color: #ef4444; }
.likert .lk-btn:nth-child(2) .lk-label,
.qty-row .qty-btn:nth-child(2) .lk-label { color: #f05d3b; }
.likert .lk-btn:nth-child(3) .lk-label,
.qty-row .qty-btn:nth-child(3) .lk-label { color: #1f8cff; }
.likert .lk-btn:nth-child(4) .lk-label,
.qty-row .qty-btn:nth-child(4) .lk-label { color: #2563eb; }

.lk-btn:hover,
.qty-btn:hover {
  background: var(--bg2);
  border-color: var(--bs-border-color, var(--border));
}
.lk-btn.sel,
.qty-btn.sel {
  background: var(--blue-bg);
  color: var(--blue-dark);
  border-color: var(--blue-mid);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(21, 140, 186, .2);
}
.qty-row { display:grid; grid-template-columns:repeat(4,1fr); gap:7px; margin-top:9px; }
.qty-btn {
  padding: 11px 8px;
  min-height: 72px;
  font-size: 1.02rem;
  text-align: center;
  line-height: 1.35;
  display: block;
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--bs-border-color, var(--border));
  border-radius: .65rem;
  cursor: pointer;
  color: var(--text2);
  transition: all .12s ease;
  font-weight: 500;
}
.qty-btn:hover { background:var(--blue-bg); color:var(--blue-dark); }
.qty-btn.sel { background:var(--blue-bg); color:var(--blue-dark); border-color:var(--blue-mid); font-weight:700; box-shadow: inset 0 0 0 1px rgba(21, 140, 186, .2); }

/* ========== 학생 결과 화면(히어로·그리드) ========== */
.result-hero { background:var(--blue-bg); border:1px solid var(--blue-light); border-radius:var(--radius-lg); padding:18px 20px; margin-bottom:12px; }
.result-hero-label { font-size:1rem; color:var(--blue-med); margin-bottom:4px; font-weight:700; letter-spacing:.25px; }
.result-hero-name { font-size:1.45rem; font-weight:700; color:var(--blue-dark); margin-bottom:6px; }
.result-hero-desc { font-size:1rem; color:var(--blue-med); line-height:1.65; }

/* 학생 최종 결과 상단: 키오스크와 동일 구조 — 캐릭터 카드 + 종합 유형·맞춤 가이드 결합 카드 */
.result-top-row {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 12px;
}
.result-character-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 0;
  padding: 0;
  min-height: 320px;
  /* 이미지 카드: 파란 테두리 없음 — 일반 결과 카드와 비슷한 중립 프레임 */
  background: var(--bg);
  border: 1px solid var(--bs-border-color, var(--border2));
  border-radius: var(--radius-lg);
  box-shadow: var(--bs-box-shadow-sm, 0 .125rem .25rem rgba(0,0,0,.06));
  overflow: hidden;
}
.result-character-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  border: 0;
  box-shadow: none;
  background: var(--bg2);
}
.result-character-emoji {
  font-size: clamp(3rem, 8vw, 4.5rem);
  line-height: 1;
}
.result-character-name {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--blue-dark);
  text-align: center;
  line-height: 1.4;
  word-break: keep-all;
}
.result-combo-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 18px;
}
.result-combo-head {
  flex-shrink: 0;
}
.result-combo-label {
  font-size: 1rem;
  color: var(--blue-med);
  font-weight: 700;
  letter-spacing: .25px;
  margin-bottom: 6px;
}
.result-combo-value {
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 8px;
  line-height: 1.3;
  word-break: keep-all;
}
.result-combo-desc {
  font-size: 1rem;
  color: var(--text2);
  line-height: 1.65;
}
.result-combo-guide {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border2);
  flex: 1;
  min-height: 0;
}
.result-combo-guide-heading {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--blue-dark);
}
.result-combo-guide .guide-label { color: var(--blue-med); }
.result-combo-guide .guide-item { color: var(--blue-dark); }
.result-combo-guide .guide-item::before { color: var(--blue-med); }
.result-combo-guide .guide-section:last-child {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .result-top-row {
    grid-template-columns: 1fr;
  }
  .result-character-card {
    min-height: 240px;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    padding: 0;
  }
  .result-character-img {
    width: 100%;
    height: 100%;
  }
}

.r-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:8px; }
.r-card {
  background: var(--bg);
  border: 1px solid var(--bs-border-color, var(--border2));
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--bs-box-shadow-sm, 0 .125rem .25rem rgba(0,0,0,.06));
}
.r-card.full { grid-column:1/-1; }
.r-card > .badge {
  font-size: .86rem;
  font-weight: 500;
  padding: .35rem .75rem;
  line-height: 1;
}
.qty-mini .stu-card-label {
  font-size: .86rem;
  font-weight: 500;
  line-height: 1;
  padding: .35rem .75rem;
}
.badge { display:inline-block; padding:2px 7px; border-radius:5px; font-size:.82rem; font-weight:500; margin-bottom:6px; }
.badge-blue {
  background: var(--blue-bg);
  background: color-mix(in srgb, currentColor 22%, transparent);
  color: var(--blue-dark);
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}
.badge-teal {
  background: var(--teal-bg);
  background: color-mix(in srgb, currentColor 22%, transparent);
  color: var(--teal-dark);
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}
.badge-purple {
  background: var(--purple-bg);
  background: color-mix(in srgb, currentColor 22%, transparent);
  color: var(--purple-dark);
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}
.badge-amber {
  background: var(--amber-bg);
  background: color-mix(in srgb, currentColor 22%, transparent);
  color: var(--amber-dark);
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}
.rc-type { font-size:1.05rem; font-weight:700; margin-bottom:4px; }
.rc-desc { font-size:.95rem; color:var(--text2); line-height:1.6; }
.qty-mini { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:10px; }
.qm { background:var(--bg2); border-radius:8px; padding:11px 13px; }
.qm-label { font-size:1rem; color:var(--text3); margin-bottom:2px; font-weight:700; }
.qm-type { font-size:1rem; font-weight:700; }

.stu-amount-val {
  font-size: 1rem;
  font-weight: 700;
}

.rc-mini-desc { font-size:1rem; margin-top:3px; line-height:1.55; font-weight:600; color:var(--text2); }

/* ========== 맞춤 독서 지도 가이드(카드형) ========== */
.guide-wrap { background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-lg); padding:16px; margin-bottom:10px; }
.guide-title { font-size:1.05rem; font-weight:700; margin-bottom:12px; display:flex; align-items:center; gap:6px; }
.guide-section { margin-bottom:12px; }
.guide-section:last-child { margin-bottom:0; }
.guide-label { font-size:1rem; font-weight:700; color:var(--text3); margin-bottom:4px; letter-spacing:.25px; }
.guide-tag { display:inline-block; padding:3px 8px; border-radius:5px; font-size:.85rem; font-weight:700; margin:2px; }
.guide-item { font-size:.98rem; color:var(--text2); line-height:1.7; padding-left:12px; position:relative; }
.guide-item::before { content:"·"; position:absolute; left:0; color:var(--text3); }
.toast { background:var(--teal-bg); border:0.5px solid var(--green-mid); color:var(--teal-dark); border-radius:8px; padding:10px 14px; font-size:13px; margin-bottom:12px; }

/* 학생 결과(개별 모달) - 행동 종합: 왼쪽 이미지 카드 / 오른쪽 종합 유형 카드 */
.stu-behavior-top-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 8px;
}
#stuModal .stu-behavior-type-card {
  flex: 0 0 auto;
  width: 160px;
  height: 220px;
  border-radius: 14px;
  overflow: hidden;
  /* 지도 가이드 이미지 카드와 동일한 중립 톤 */
  border: 0.5px solid rgba(0,0,0,0.08);
  background: var(--bg2);
  box-shadow: 0 10px 26px rgba(0,0,0,0.10);
}
#stuModal .stu-behavior-type-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 0;
  border-radius: 0;
}
.stu-behavior-hero {
  flex: 1 1 auto;
  min-width: 0;
  background:var(--blue-bg);
  border:1px solid var(--blue-light);
  border-radius:9px;
  padding:12px 14px;
  margin-bottom:0;
  display:block;
}
.stu-behavior-hero-label { font-size:1rem; color:var(--blue-med); font-weight:700; margin-bottom:4px; }
.stu-behavior-hero-name { font-size:1.25rem; font-weight:700; color:var(--blue-dark); margin-bottom:4px; }
.stu-behavior-hero-desc { font-size:.95rem; color:var(--blue-med); line-height:1.6; }

@media (max-width: 720px) {
  .stu-behavior-top-row {
    flex-direction: column;
    align-items: stretch;
  }
  #stuModal .stu-behavior-type-card {
    width: 100%;
    max-width: 160px;
    height: 220px;
    margin: 0 auto;
  }
}

/* ========== 교사 대시보드(통계·표·분포 막대) ========== */
#teacher-view {
  font-size: 1rem;
}
#teacher-view [style*="font-size:10px"],
#teacher-view [style*="font-size:11px"],
#teacher-view [style*="font-size:12px"],
#teacher-view [style*="font-size:9px"],
#teacher-view [style*="font-size:8px"] {
  font-size: 1rem !important;
}
#teacher-view .student-table { font-size: 0.9rem !important; }
#teacher-view .student-table th { font-size: 0.8rem !important; }
#teacher-view .student-table td { font-size: 0.8rem !important; }
#teacher-view .student-table [style*="font-size:10px"],
#teacher-view .student-table [style*="font-size:11px"],
#teacher-view .student-table [style*="font-size:12px"],
#teacher-view .student-table [style*="font-size:9px"],
#teacher-view .student-table [style*="font-size:8px"] {
  font-size: 11px !important;
}
#teacher-view .stat-label { font-size: 1rem !important; }
#teacher-view .dist-label { font-size: 1rem !important; }
#teacher-view .dist-title { font-size: 1rem !important; }
#teacher-view .dist-count { font-size: 1rem !important; }
#teacher-view .warn-msg { font-size: 1rem !important; }
#teacher-view .ollama-status { font-size: 1rem !important; }

.dash-header { display:flex; gap:10px; align-items:center; margin-bottom:16px; flex-wrap:wrap; }
.dash-header h2 { font-size:16px; font-weight:700; flex:1; }
.filter-row { display:flex; gap:8px; flex-wrap:nowrap; margin-bottom:14px; align-items:center; }
/* 교사 대시보드: 필터 행 오른쪽 문항 표시 설정(라벨+콤보) */
.filter-row .dash-school-test-mode-row {
  flex-shrink: 0;
}
.filter-row select {
  flex: 0 0 150px;
  max-width: 150px;
}
.filter-row span { white-space: nowrap; }
@media (max-width: 768px) {
  .filter-row { flex-wrap:wrap; }
}
.stat-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:16px; }
.stat-card { background:var(--bg2); border-radius:8px; padding:12px; text-align:center; }
.stat-num { font-size:24px; font-weight:700; }
.stat-label { font-size:10px; color:var(--text3); margin-top:2px; }
.dist-section { background:var(--bg); border:0.5px solid var(--border); border-radius:var(--radius-lg); padding:16px; margin-bottom:10px; }
.dist-title { font-size:13px; font-weight:700; margin-bottom:12px; }
.dist-row { display:flex; align-items:center; gap:8px; margin-bottom:7px; }
.dist-label { font-size:11px; width:135px; flex-shrink:0; }
.dist-bar-wrap { flex:1; height:17px; background:var(--bg3); border-radius:4px; overflow:hidden; }
.dist-bar { height:17px; border-radius:4px; transition:width .45s; }
.dist-count { font-size:11px; color:var(--text2); width:50px; text-align:right; flex-shrink:0; }
.section-wrap { background:var(--bg); border:0.5px solid var(--border); border-radius:var(--radius-lg); padding:16px; margin-bottom:10px; }

/* ---------------------------------------------------------------------------
 * 교사 대시보드 — 패널 머리줄 · 인쇄 표제
 * --------------------------------------------------------------------------- */
.dash-panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.dash-panel-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
}
/* 종이에만 나가는 줄 — 화면에는 패널 제목이 이미 있다 */
.dash-print-head { display: none; }

/* ---------------------------------------------------------------------------
 * 교사 대시보드 — 요약 4칸(KPI)
 * 칸 안에 칸을 넣지 않는다. 네 칸이 각각 하나의 칸이다.
 * --------------------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.kpi-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
}
.kpi-icon {
  flex: 0 0 auto;
  width: 20px;
  font-size: 18px;
  text-align: center;
  color: var(--text2);
}
/* 이름이 남은 폭을 먹어 숫자를 오른쪽 끝으로 민다 */
.kpi-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.94rem;
  color: var(--text2);
}
.kpi-num {
  flex: 0 0 auto;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: var(--text);
}
.kpi-unit {
  margin-left: 2px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text2);
}

@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/*
 * 손바닥 폭 — 두 칸 격자에서 「고유 학생(추정)」과 숫자가 한 줄에 못 선다.
 * 이름 위, 숫자 아래로 눕힌다. 아이콘은 뜻이 없는 그림이라 자리를 내준다.
 */
@media screen and (max-width: 640px) {
  .kpi-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 12px 13px;
  }
  .kpi-icon { display: none; }
  .kpi-label { flex: 0 0 auto; width: 100%; font-size: 0.88rem; }
  .kpi-num { font-size: 1.55rem; }
}

/* ---------------------------------------------------------------------------
 * 교사 대시보드 — 통계 2단, 지도 가이드 패널
 * 색은 테마가 얹는다. 여기서는 자리와 크기만 잡는다.
 * --------------------------------------------------------------------------- */
/*
 * 네 열짜리 격자에 두 열씩 얹어 한 줄에 둘씩 놓는다.
 * 두 열 격자로 잡지 않은 이유 — 나중에 한 열(4분의 1)짜리 칸을 섞을 수 있다.
 */
.dash-stat-cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.dash-stat-cols .dist-section {
  grid-column: span 2;
  margin-bottom: 0;
}
.dash-stat-cols .dash-span-1 { grid-column: span 1; }
.dash-stat-cols .dash-span-3 { grid-column: span 3; }
.dash-stat-cols .dash-span-4 { grid-column: span 4; }

/* ── 한 줄 띠 (성별·선호 매체) ─────────────────────────────────────────── */
.stack-bar {
  display: flex;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg3);
}
.stack-seg { display: block; height: 100%; }
.stack-legend {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.88rem;
  color: var(--text2);
}
/* 점 · 이름 · 건수 · 비율 네 칸. 이름만 늘어나고 숫자는 제자리를 지킨다 */
.stack-legend li {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
.stack-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack-v { min-width: 42px; text-align: right; color: var(--text); }
.stack-p { min-width: 34px; text-align: right; }
.stack-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

/* ── 두 계열 견주기 (학기 중 vs 방학 중) ───────────────────────────────── */
.cmp-key {
  display: inline-flex;
  gap: 12px;
  margin-left: 10px;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text2);
}
.cmp-key span { display: inline-flex; align-items: center; gap: 5px; }
.cmp-key i,
.cmp-bar {
  border-radius: 4px;
}
.cmp-key i { width: 10px; height: 10px; }
/* 학기 중 파랑 · 방학 중 봄형 초록 (JS 의 C_BLUE / C_GREEN_SOFT 와 같은 값) */
.cmp-key i.is-a,
.cmp-bar.is-a { background: #5FA0E2; }
.cmp-key i.is-b,
.cmp-bar.is-b { background: #74C89A; }

.cmp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}
.cmp-row:last-child { margin-bottom: 0; }
.cmp-label {
  width: 74px;
  flex-shrink: 0;
  font-size: 0.94rem;
}
/* 두 막대가 한 칸을 나눠 쓴다 — 같은 잣대라 길이를 바로 견줄 수 있다 */
.cmp-bars {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cmp-line {
  display: flex;
  align-items: center;
  gap: 7px;
}
/* 막대가 놓이는 홈. 길이는 홈 안에서만 달라지고 값 칸은 늘 같은 자리다 */
.cmp-track {
  flex: 1 1 auto;
  min-width: 0;
  height: 14px;
  border-radius: 4px;
  background: var(--bg3);
  overflow: hidden;
}
.cmp-bar {
  height: 14px;
  transition: width 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.cmp-v {
  flex: 0 0 auto;
  min-width: 30px;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* 늘고 줄어든 폭 — 이 표에서 가장 알고 싶은 숫자다 */
.cmp-diff {
  width: 46px;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cmp-diff.is-up { color: #1c7a4f; }
.cmp-diff.is-down { color: #a8443c; }
.cmp-diff.is-same { color: var(--text2); font-weight: 400; }

@media (max-width: 1100px) {
  .dash-stat-cols { grid-template-columns: minmax(0, 1fr); }
  .dash-stat-cols .dist-section,
  .dash-stat-cols .dash-span-1,
  .dash-stat-cols .dash-span-3,
  .dash-stat-cols .dash-span-4 { grid-column: auto; }
}

/* 원형 분포 — 왼쪽 원, 오른쪽 막대. 색과 차례가 같아 막대가 곧 범례다 */
.dash-donut-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.dash-donut {
  position: relative;
  flex: 0 0 auto;
  width: 140px;
  height: 140px;
}
/* SVG 는 3시 방향에서 시작한다 — 12시로 돌려야 읽는 차례와 맞는다 */
.dash-donut-svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.dash-donut-seg {
  /* 채워지는 동안은 여유롭게, 마우스 반응은 즉각적으로 */
  transition: stroke-dasharray 0.8s cubic-bezier(0.22, 0.61, 0.36, 1),
    stroke-width 0.12s;
  cursor: default;
}
.dash-donut-seg:hover { stroke-width: 10; }

/* 누를 수 있는 조각 — 손가락 커서와 초점 테두리로 알린다 */
.dash-donut-seg.is-link { cursor: pointer; }
.dash-donut-seg.is-link:focus-visible {
  outline: none;
  stroke-width: 11;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.45));
}

@media print {
  .dash-donut-seg.is-link { cursor: default; }
}

/* 가운데는 SVG 가 비워 둔 자리다 — 바탕을 깔지 않는다 */
.dash-donut-hole {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  pointer-events: none; /* 구멍이 조각의 마우스를 가로채면 안 된다 */
  text-align: center;
}
.dash-donut-hole span {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}
.dash-donut-hole small {
  margin-top: 2px;
  max-width: 76px; /* 고리 안쪽 지름(≈79px)보다 좁아야 글자가 고리를 안 넘는다 */
  font-size: 0.74rem;
  line-height: 1.25;
  color: var(--text2);
}
/* 막대 쪽이 남은 폭을 다 먹어야 원 옆에서 찌그러지지 않는다 */
.dash-donut-bars {
  flex: 1 1 190px;
  min-width: 0;
}
/* 「초등학교 5학년」이 한 줄에 들어가야 한다 (#teacher-view 에서 1rem) */
.dash-donut-bars .dist-label { width: 136px; }
.dash-donut-bars .dist-row:last-child { margin-bottom: 0; }

/* 한 줄을 통째로 쓰는 칸 — 여덟 줄짜리 막대와 키를 맞추려면 원도 커야 한다 */
.dist-section.is-wide .dash-donut-row { gap: 30px; }
.dist-section.is-wide .dash-donut { width: 208px; height: 208px; }
.dist-section.is-wide .dash-donut-hole span { font-size: 2rem; }
.dist-section.is-wide .dash-donut-hole small { max-width: 118px; font-size: 0.86rem; }
.dist-section.is-wide .dash-donut-bars .dist-label { width: 156px; }

/*
 * 건수·비율은 각각 제 칸에서 오른쪽 맞춤. 한 덩이로 두면 「8건 16%」와
 * 「13건 27%」의 글자 폭이 달라 줄마다 자리가 어긋난다.
 * tabular-nums 는 숫자 글자 폭을 고정해 1 과 8 이 같은 자리를 차지하게 한다.
 */
.dist-count {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.dist-count.has-pct { width: 96px; }
.dist-n { flex: 0 0 auto; min-width: 44px; text-align: right; }
.dist-pct {
  flex: 0 0 auto;
  min-width: 34px;
  text-align: right;
  color: var(--text2);
  font-size: 0.86em;
}

/* 처음 그려질 때 0 에서 차오른다 — dashAnimateCharts() 가 값을 옮긴다 */
.dist-bar,
.stack-seg { transition: width 0.8s cubic-bezier(0.22, 0.61, 0.36, 1); }

@media (prefers-reduced-motion: reduce) {
  .dist-bar,
  .stack-seg,
  .cmp-bar,
  .dash-donut-seg {
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
}

/*
 * 손바닥 폭 — 이름 칸과 값 칸을 뺀 나머지가 30px 남짓이라 막대가 길이 차이를
 * 못 보여 준다. 막대를 걷고 이름에 그 폭을 준다. 값은 그대로 오른쪽 끝.
 * 원형 분포에는 원이 남아 있어 구성비는 여전히 그림으로 보인다.
 */
@media screen and (max-width: 520px) {
  .dist-bar-wrap { display: none; }
  .dist-label,
  .dash-donut-bars .dist-label,
  .dist-section.is-wide .dash-donut-bars .dist-label {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
  }
}

.guide-panel {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.guide-picker {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
}
.guide-picker-title {
  margin: 10px 4px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text2);
}
.guide-picker-title:first-child { margin-top: 0; }

/* 좁은 화면에서만 쓰는 메뉴 둘 — 넓으면 왼쪽 목록이 그 몫을 한다 */
.guide-picker-sel { display: none; }

.guide-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font-size: 0.94rem;
  line-height: 1.35;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}
.guide-pick:hover { background: var(--bg2); }
.guide-pick.is-on {
  background: var(--blue-bg);
  border-color: var(--blue-light);
  color: var(--blue-dark);
  font-weight: 700;
}
.guide-pick-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.guide-pick-name { flex: 1 1 auto; min-width: 0; }
/* 건수는 자리를 고정해야 이름 길이가 달라도 오른쪽 끝이 안 흔들린다 */
.guide-pick-cnt {
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text2);
}

.guide-body {
  padding: 22px 24px 24px;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
}
.guide-empty { margin: 0; color: var(--text2); }

/* 그림 왼쪽, 글(제목·설명·장르·지도 방법) 오른쪽 한 기둥 */
.guide-detail-main {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}
/*
 * 주의 사항 — 나머지와 성격이 다르다. 「이렇게 하세요」 사이에 「이건 조심하세요」가
 * 같은 모양으로 섞이면 눈에 안 걸린다. 두 칸 아래에서 폭을 다 쓰고,
 * 선 하나로 갈라 내고 제목과 글자를 코랄로 두는 것으로 충분하다.
 */
/* 「지도 방법」과 성격이 다른 덩이다 — 선 위아래로 넉넉히 띄워 갈라 놓는다 */
.guide-detail > .guide-caution,
.stu-guide > .guide-caution {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.guide-caution-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--coral-dark);
}
.guide-caution-title i { font-size: 0.92rem; }
.guide-caution-list {
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--coral-dark);
  font-size: 0.98rem;
  line-height: 1.7;
}
/* 점을 직접 그린다 — 기본 목록 점은 상자 밖으로 삐져나온다 */
.guide-caution-list li {
  position: relative;
  padding-left: 15px;
  margin-bottom: 5px;
}
.guide-caution-list li:last-child { margin-bottom: 0; }
.guide-caution-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.66em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}
.guide-detail-body {
  flex: 1 1 auto;
  min-width: 0;
}
.guide-detail-intro {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
/*
 * 카드 그림은 520x932 세로형이다. 정사각 칸에 cover 로 담으면 위아래가 잘린다.
 * 칸을 그림 비율(0.558)에 맞추고 contain 으로 담아 어떤 그림이 와도 안 자른다.
 */
.guide-detail-img {
  flex: 0 0 auto;
  width: 112px;
  height: 200px;
  object-fit: contain;
  border-radius: var(--radius-lg);
  background: var(--bg2);
}
.guide-detail-name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
.guide-detail-count {
  margin: 3px 0 10px;
  font-size: 0.86rem;
  color: var(--text2);
}
.guide-detail-desc {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--text);
}

.guide-block { margin-top: 18px; }
.guide-block-title {
  margin: 0 0 9px;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text2);
}
.guide-approach {
  display: inline-block;
  margin: 0;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--teal-bg);
  color: var(--teal-dark);
  font-size: 0.94rem;
  font-weight: 700;
}
.guide-taglist { display: flex; flex-wrap: wrap; gap: 7px; }
/* inline 이면 아래 여백이 먹지 않는다 — 장르 딱지와 도서 목록이 붙어 버린다 */
.guide-tag2 {
  display: inline-block;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--blue-bg);
  color: var(--blue-dark);
  font-size: 0.92rem;
}
.guide-steps {
  margin: 0;
  padding-left: 1.3em;
  font-size: 1rem;
  line-height: 1.75;
}
.guide-steps li { margin-bottom: 6px; }

/* 저장 줄 — 초기화는 저장 반대편으로 밀어 잘못 누르지 않게 한다 */
.teacher-settings-save-bar { justify-content: space-between; }
.teacher-settings-save-bar .teacher-settings-danger { order: -1; }

@media (max-width: 900px) {
  .guide-panel { grid-template-columns: minmax(0, 1fr); }
  .guide-picker { position: static; }
  /* 좁으면 그림을 위로 올리고 글을 아래로 — 나란히 두면 글이 한 줄에 서너 자다 */
  .guide-detail-main { flex-direction: column; align-items: center; }
  .guide-detail-body { width: 100%; }

  /*
   * 기둥이 아니라 폭을 다 쓰는 칸이 되면 세로 목록은 뜻이 없다 — 열두 줄이
   * 내용 앞을 막는다. 메뉴 둘로 바꾼다. 건수는 항목 이름에 붙여 넣었다.
   */
  .guide-picker { gap: 8px; padding: 12px; }
  .guide-picker-title,
  .guide-pick { display: none; }
  .guide-picker-sel {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .guide-sel { width: 100%; }
}
.student-table { width:100%; border-collapse:collapse; font-size:0.9rem; }
.student-table th { text-align:left; padding:7px 9px; border-bottom:0.5px solid var(--border2); color:var(--text2); font-weight:700; font-size:10px; background:var(--bg2); }
.student-table td { padding:7px 9px; border-bottom:0.5px solid var(--border); }
.student-table tbody tr:hover td { background:var(--bg2); }

/* 목록 규칙은 표시만 두고 올렸을 때 띄운다 — 제목 옆에 설명을 늘어놓지 않는다 */
.dash-list-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--bg3);
  color: var(--text2);
  font-size: 11px !important;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
}
.dash-list-hint:hover,
.dash-list-hint:focus-visible {
  background: var(--blue-light);
  color: var(--blue-dark);
}

/* ---------------------------------------------------------------------------
 * 검사 상세 결과 — 손바닥 폭에서는 줄마다 카드
 *
 * 열이 열둘이라 375px 에서 표로 두면 한 번에 석 줄밖에 안 보이고, 「초등학교
 * 6학년」이 두 줄로 쪼개져 줄 높이가 배로 뛴다. 줄을 카드로 눕히고 값마다
 * data-th 이름표를 달면 열 넷 다섯이 한 화면에 들어온다.
 * 정렬 머리줄은 카드에서 쓸 수 없어 감춘다 — 기본 차례(최근 검사 먼저)로 본다.
 * --------------------------------------------------------------------------- */
@media screen and (max-width: 560px) {
  /* 감싸개가 그리던 테두리와 가로 밀기는 카드에서 필요 없다 */
  .dash-res-frame {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .dash-res-table,
  .dash-res-table tbody { display: block; }
  .dash-res-table thead { display: none; }

  .dash-res-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    margin-bottom: 8px;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg);
  }
  .dash-res-table tr:last-child { margin-bottom: 0; }

  #teacher-view .dash-res-table td {
    display: flex;
    align-items: baseline;
    gap: 5px;
    padding: 0;
    border: 0;
  }
  /* 칸마다 칠하면 카드 안에 얼룩이 진다 */
  #teacher-view .dash-res-table tbody tr:hover td { background: transparent; }

  #teacher-view .dash-res-table td::before {
    content: attr(data-th);
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text3);
  }

  /* 이름은 카드의 이름표다 — 한 줄을 다 쓰고 값 이름표를 달지 않는다 */
  #teacher-view .dash-res-table .rescol-name {
    flex: 1 1 100%;
    margin-bottom: 2px;
    font-size: 1.02rem !important;
    font-weight: 700;
  }
  #teacher-view .dash-res-table .rescol-name::before { display: none; }

  /*
   * 교사 대시보드는 학교가 하나뿐이라 줄마다 같은 값이 되어 읽을 것이 없다.
   * 위 td 규칙이 #id 를 물고 있어 여기도 #teacher-view 를 끼워야 이긴다.
   */
  body:not(.pmrti-master-body) #teacher-view .dash-res-table .rescol-school {
    display: none;
  }

  /* 다섯 개가 한 줄에 못 선다. 첫 쪽·끝 쪽은 이전·다음으로 갈 수 있다 */
  #teacher-view .dash-pager-edge { display: none; }

  /* 고르는 칸은 한 줄씩, 건수는 그 아래 한 줄 */
  .filter-row select { flex: 1 1 100%; max-width: none; }
  .filter-row .filter-count { flex: 1 1 100%; white-space: normal; }

  /* 세 단추가 두 줄로 어긋나 걸린다 — 한 줄에 하나씩 */
  #teacher-view .nav .btn { flex: 1 1 100%; }
}

.master-school-manage-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 360px;
}
.master-school-manage-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}
.master-school-manage-toolbar .form-control {
  flex: 1 1 220px;
  max-width: 420px;
}
.master-school-manage-count {
  font-size: 0.85rem;
  color: var(--text2);
  white-space: nowrap;
}
.master-school-manage-table-wrap {
  position: relative;
  flex: 1 1 auto;
  height: min(58vh, 480px);
  min-height: 320px;
  overflow: auto;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.master-school-manage-empty-msg {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  z-index: 2;
  margin: 0;
  padding: 0 16px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text2);
  transform: translateY(-50%);
  pointer-events: none;
}
.master-school-manage-table.student-table {
  font-size: 0.82rem;
}
.master-school-manage-table.student-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg2);
  box-shadow: 0 1px 0 var(--border);
  font-size: 0.85rem;
  white-space: nowrap;
}
.master-school-manage-table.student-table td {
  font-size: 0.82rem;
  vertical-align: middle;
  white-space: nowrap;
}
.master-school-manage-table td code {
  font-size: inherit;
  word-break: normal;
}
.master-school-manage-table .master-school-address {
  max-width: 200px;
  font-size: inherit;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
}
.master-school-manage-table .master-school-access-key-cell {
  max-width: 172px;
  min-width: 100px;
}
.master-school-manage-table .master-school-access-key {
  display: block;
  max-width: 100%;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
}
.master-school-manage-table .master-school-expiry-cell {
  min-width: 0;
}
.master-school-manage-table .master-school-expiry-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  max-width: 100%;
}
.master-school-manage-table .master-school-expiry-input {
  width: 128px;
  min-width: 128px;
  flex: 0 0 auto;
  font-size: 0.78rem;
  margin: 0;
}
.master-school-manage-table .master-school-expired-badge {
  margin: 0;
  line-height: 1.2;
  flex: 0 0 auto;
  white-space: nowrap;
}
.master-school-manage-table .master-school-manage-cell,
.master-school-manage-table .master-school-links-cell {
  white-space: nowrap;
  vertical-align: middle;
}
/* pw-wrap 과 동일 폭(상단 헤더 카드와 맞춤) — 별도 max-width 없음 */
.service-expired-wrap,
.school-access-blocked-wrap {
  width: 100%;
  max-width: none;
  margin: 0;
}
.master-school-manage-table .master-school-links-cell .master-school-links {
  white-space: nowrap;
}
.master-school-manage-table .master-school-links .btn {
  font-size: inherit;
  font-weight: 500;
  padding: 3px 8px;
  margin: 0 2px 0 0;
  min-width: 0;
  line-height: 1.35;
  vertical-align: middle;
}
.chip { display:inline-block; padding:2px 6px; border-radius:5px; font-weight:700; }
.no-data {
  text-align: center;
  padding: 36px 20px;
  color: var(--text2);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.95;
}
.no-data strong {
  font-size: 1.08em;
  font-weight: 800;
}

/* ========== 독서 지도 가이드 모달(오버레이) ========== */
.modal-bg { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.45); z-index:100; align-items:center; justify-content:center; padding:16px; }
.modal-bg.open { display:flex; }
.modal-bg > .modal {
  display:block;
  position:relative;
  inset:auto;
  z-index:auto;
  margin:0;
  background:var(--bg);
  border-radius:var(--radius-lg);
  padding:22px;
  max-width:560px;
  width:100%;
  max-height:82vh;
  overflow-y:auto;
  border:0.5px solid var(--border2);
}
.modal-bg > .modal .modal-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.modal-bg > .modal .modal-title { font-size:16px; font-weight:700; }
.modal-bg > .modal .modal-close { padding:4px 10px; font-size:16px; border:none; background:transparent; color:var(--text2); cursor:pointer; border-radius:6px; }
.modal-bg > .modal .modal-close:hover { background:var(--bg2); }

/* ========== 학생 개별 결과 팝업 모달 ========== */
.guide-modal-type-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0;
  letter-spacing: -0.01em;
}
.guide-modal-desc {
  font-size: 0.98rem;
  color: var(--text2);
  line-height: 1.7;
  margin-bottom: 4px;
}

/* Bootstrap 기본 모달(#guidModal) 여백 타이트하게 */
#guidModal .modal-header {
  padding-top: 1rem !important;
  padding-bottom: .4rem;
}
#guidModal .modal-body {
  padding-top: .55rem;
  padding-bottom: 1rem !important;
}

/* reason(봄/여름/가을/겨울형) 가이드 모달: 왼쪽 이미지 + 오른쪽 내용 */
.reason-guide-modal {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  align-items: start;
}
.reason-guide-left {
  flex: 0 0 auto;
}
.reason-guide-img {
  width: 220px;
  height: 300px;
  object-fit: cover;
  border-radius: 14px;
  border: 0.5px solid rgba(0,0,0,0.08);
  box-shadow: 0 10px 26px rgba(0,0,0,0.10);
  background: var(--bg2);
}
.reason-guide-right {
  min-width: 0;
}
@media (max-width: 560px) {
  .reason-guide-modal {
    grid-template-columns: 1fr;
  }
  .reason-guide-img {
    width: 100%;
    height: 260px;
  }
}

.stu-modal { max-width:620px; }

/*
 * 예전에 이 자리에 #stuModal 안쪽을 전부 0.9rem 으로 못 박는 !important 묶음이
 * 있었다. 그때는 마크업에 8~13px 인라인 글씨가 흩어져 있어 그걸 눌러야 했다.
 * 지금은 창을 학생 결과 화면 뼈대로 다시 써서 인라인 크기가 없다 —
 * 남겨 두면 테마가 정한 크기·여백(#stuAiContent 여백 등)을 되레 덮는다.
 */

.stu-hero { background:var(--blue-bg); border:0.5px solid var(--blue-light); border-radius:10px; padding:14px 16px; margin-bottom:12px; }
.stu-hero-name { font-size:17px; font-weight:700; color:var(--blue-dark); margin-bottom:2px; }
.stu-hero-sub  { font-size:11px; color:var(--blue-med); }
.stu-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:8px; }
.stu-card {
  background: var(--bg);
  border: 1px solid var(--bs-border-color, var(--border2));
  border-radius: 10px;
  padding: 12px 13px;
  box-shadow: var(--bs-box-shadow-sm, 0 .125rem .25rem rgba(0,0,0,.06));
}
.stu-card > .badge {
  font-size: .86rem;
  font-weight: 500;
  padding: .35rem .75rem;
  line-height: 1;
}
.stu-card-label {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .86rem;
  line-height: 1.1;
  color: var(--blue-mid);
  background: color-mix(in srgb, currentColor 20%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
  margin-bottom: 6px;
  font-weight: 700;
}
.stu-card-val   { font-size:14px; font-weight:700; }
.stu-card-desc  { font-size:11.5px; color:var(--text); margin-top:2px; line-height:1.5; }
.stu-guide { background:var(--bg); border:0.5px solid var(--border); border-radius:9px; padding:13px 15px; margin-top:10px; }
.stu-guide-title { font-size:12px; font-weight:700; margin-bottom:8px; color:var(--text2); }

.stu-book-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.stu-book-card {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  min-width: 0;
  overflow: hidden;
}
.stu-book-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  overflow: hidden;
  white-space: nowrap;
}
.stu-book-author {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
  overflow: hidden;
  white-space: nowrap;
}
.name-link { color:var(--blue-dark); cursor:pointer; text-decoration:underline; text-underline-offset:2px; font-weight:600; }
.name-link:hover { color:var(--blue-mid); }

/* ========== 임시저장 복원 배너 ========== */
.resume-banner {
  background: var(--teal-bg);
  border: 1px solid var(--green-mid);
  border-radius: .85rem;
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.resume-banner-text {
  font-size: 1.05rem;
  color: var(--teal-dark);
  font-weight: 700;
}
.resume-banner-sub  {
  font-size: .95rem;
  color: var(--teal-dark);
  opacity: .88;
  margin-top: 3px;
}
.resume-btns {
  display: flex;
  gap: 8px;
}
.resume-btns .btn {
  font-size: .92rem;
  font-weight: 600;
  padding: .42rem .9rem;
}
.autosave-dot { display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--green-mid); margin-right:5px; animation:pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ========== 좁은 화면(모바일) 대응 ========== */
/* ========== 검사 이력·성향 변화 모달 ========== */
.trend-summary-box {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.75;
  background: var(--bg2);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 0.5px solid var(--border);
  white-space: pre-wrap;
}
.trend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.trend-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 0.5px solid var(--border2);
  color: var(--text2);
  font-weight: 700;
  font-size: 10px;
  background: var(--bg2);
}
.trend-table td {
  padding: 6px 8px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: top;
}
.trend-table tbody tr:hover td {
  background: var(--bg2);
}
button.trend-date-link {
  all: unset;
  cursor: pointer;
  color: var(--purple-mid);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: inherit;
  white-space: nowrap;
}
button.trend-date-link:hover {
  color: var(--purple-dark);
}
.answers-detail-modal {
  max-width: 560px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
#stuModal .modal-body,
#trendModal .modal-body,
#answersModal .modal-body {
  max-height: 92vh;
  overflow-y: auto;
}
#answersModalBody {
  overflow: auto;
  padding: 0 16px 16px;
  font-size: 12px;
}
#answersModalBody,
#answersModalBody * {
  font-size: 0.9rem !important;
}
.answers-detail-hint {
  font-size: 11px;
  color: var(--text3);
  margin: 0 0 10px;
  line-height: 1.5;
}

/* trendModal 내부: 작은 글씨(인라인 px 포함)를 0.9rem으로 통일 */
#trendModal [style*="font-size:8px"],
#trendModal [style*="font-size:9px"],
#trendModal [style*="font-size:10px"],
#trendModal [style*="font-size:11px"],
#trendModal [style*="font-size:12px"],
#trendModal [style*="font-size:13px"] {
  font-size: 0.9rem !important;
}
#trendModal .trend-summary-box { font-size: 0.9rem !important; }
#trendModal .trend-table { font-size: 0.9rem !important; }
#trendModal .trend-table th { font-size: 0.9rem !important; }
#trendModal .trend-table td { font-size: 0.9rem !important; }
#trendModal .stu-ai-title { font-size: 0.9rem !important; }
#trendModal .stu-ai-content { font-size: 0.9rem !important; }
#trendModal #trendAiContent { color: #303030 !important; }

/* 검사 이력 모달이 열려 있을 때 학생 결과 모달은 배경처럼 흐리게 처리 */
/*
 * 뒤 창 흐리기.
 * 예전에는 ::after 로 회색 판을 덮었는데, 그 판의 둥근 모서리가 창 모서리와
 * 1px 어긋나 구석에 흰 초승달이 비쳤다(테두리 두께·radius 계산이 갈린다).
 * filter 는 그려진 화면에 그대로 걸려 모서리가 어긋날 여지가 없다.
 */
body.modal-trend-focus #stuModal.show .modal-dialog {
  pointer-events: none;
}
body.modal-trend-focus #stuModal.show .modal-content {
  filter: brightness(0.74) saturate(0.75);
  transition: filter 0.15s;
}

/* 문항별 응답 모달이 열려 있을 때 검사 이력 모달도 배경처럼 흐리게 처리 */
body.modal-answers-focus #trendModal.show .modal-dialog {
  pointer-events: none;
}
body.modal-answers-focus #trendModal.show .modal-content {
  filter: brightness(0.74) saturate(0.75);
  transition: filter 0.15s;
}
.answers-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem !important;
  table-layout: fixed;
}
.answers-detail-table th {
  text-align: center;
  padding: 6px 8px;
  border-bottom: 0.5px solid var(--border2);
  color: var(--text2);
  font-weight: 700;
  font-size: 0.9rem !important;
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 1;
}
.answers-detail-table td {
  padding: 6px 8px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: top;
  font-size: 0.9rem !important;
}
.answers-detail-table tbody td:nth-child(1) {
  text-align: center;
  white-space: nowrap;
}
.answers-detail-table tbody td:nth-child(2) {
  text-align: left;
  line-height: 1.45;
  word-break: keep-all;
}
.answers-detail-table tbody td:nth-child(3) {
  text-align: left;
  white-space: nowrap;
}

@media (max-width:480px) {
  .r-grid,.qty-mini,.stat-grid { grid-template-columns:1fr 1fr; }
  .intro-grid { grid-template-columns:1fr; }
  .stat-grid { grid-template-columns:repeat(2,1fr); }
  .likert { grid-template-columns:repeat(2,1fr); }
  .qty-row { grid-template-columns:repeat(2,1fr); }
  .student-table { font-size:10px; }
  .prog-meta {
    font-size: .8rem;
  }
  .sec-title {
    font-size: 1.2rem;
  }
  .pip-examiner-line {
    font-size: 1.05rem;
    gap: 5px 8px;
  }
  .pip-examiner-label,
  .pip-examiner-after-label,
  .pip-examiner-val,
  .pip-examiner-sep {
    font-size: 1.05rem;
  }
  .q-card {
    padding: 13px 12px 12px;
  }
  .q-text {
    font-size: 1rem;
  }
  .likert,
  .qty-row {
    gap: 6px;
  }
  .lk-btn,
  .qty-btn {
    font-size: .88rem;
    padding: 9px 4px;
  }
  .resume-banner-text {
    font-size: .98rem;
  }
  .resume-banner-sub {
    font-size: .88rem;
  }
  .resume-btns {
    width: 100%;
  }
  .resume-btns .btn {
    flex: 1 1 0;
  }
  .intro-item-head {
    gap: .28rem;
  }
  .intro-item-icon {
    width: 20px;
    height: 20px;
    font-size: 15px;
  }
  .intro-item-label {
    font-size: 12px;
  }
  .intro-item-val {
    font-size: 1.1rem;
  }
}

/* ---------------------------------------------------------------------------
 * 검사 영역 전환 안내 (매체→행동 → 행동→이유 → 이유→독서량)
 * --------------------------------------------------------------------------- */
.pmrti-section-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 10880;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 32px);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.pmrti-section-transition-overlay.is-visible {
  opacity: 1;
}
.pmrti-section-transition-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}
.pmrti-section-transition-panel {
  position: relative;
  max-width: 460px;
  width: 100%;
  padding: 26px 30px 24px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(245, 250, 255, 0.94));
  border: 1px solid rgba(21, 140, 186, 0.16);
  box-shadow:
    0 6px 20px rgba(13, 48, 80, 0.12),
    0 22px 48px rgba(13, 48, 80, 0.18);
  transform: scale(0.95) translateY(10px);
  opacity: 0;
  transition:
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.42s ease;
}
.pmrti-section-transition-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 30%, #5eb6dc, #158cba);
  color: #fff;
  box-shadow: 0 8px 18px rgba(21, 140, 186, 0.32);
}
.pmrti-section-transition-icon i {
  font-size: 1.32rem;
}
.pmrti-section-transition-overlay.is-visible .pmrti-section-transition-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.pmrti-section-transition-text {
  margin: 0;
  font-size: 1.14rem;
  font-weight: 600;
  line-height: 1.7;
  color: var(--text);
  text-align: center;
  letter-spacing: -0.02em;
}
@media (prefers-color-scheme: dark) {
  .pmrti-section-transition-panel {
    background: linear-gradient(145deg, rgba(40, 43, 50, 0.96), rgba(32, 36, 44, 0.94));
    border-color: rgba(133, 183, 235, 0.22);
    box-shadow:
      0 6px 22px rgba(0, 0, 0, 0.36),
      0 22px 52px rgba(0, 0, 0, 0.42);
  }
  .pmrti-section-transition-icon {
    background: radial-gradient(circle at 30% 30%, #7bc4e5, #2f90bc);
    box-shadow: 0 8px 18px rgba(47, 144, 188, 0.38);
  }
  .pmrti-section-transition-text {
    color: #eef6ff;
  }
  .pmrti-section-transition-backdrop {
    background: transparent;
  }
}

/* ---------------------------------------------------------------------------
 * 교사 대시보드 — A4 인쇄
 *
 * 인쇄용 문서를 따로 만들지 않고 화면에서 껍데기만 걷어 낸다.
 * 두 벌을 두면 통계를 하나 더할 때마다 양쪽을 고쳐야 하고, 언젠가 어긋난다.
 * --------------------------------------------------------------------------- */
@media print {
  /*
   * 방향은 못 박지 않는다 — @page 에 landscape 를 적어도 인쇄 대화상자에서
   * 세로를 고르면 그 값이 이긴다. 두 방향 모두 한 쪽에 들어가게
   * 아래에서 orientation 으로 갈라 잡는다.
   *   세로 190 x 277mm · 가로 277 x 190mm
   */
  @page {
    size: A4;
    margin: 10mm;
  }

  /* 조작용 요소는 종이에 쓸모가 없다 */
  .sky-side-col,
  .dash-top-actions,
  .dash-panel-bar,
  .ollama-status,
  .modal,
  .modal-backdrop,
  .swal2-container {
    display: none !important;
  }

  /*
   * min-height:100vh 는 인쇄에서 「한 쪽 꽉 채우기」가 된다. 내용이 그보다
   * 짧아도 쪽 높이가 유지되고, 1px 이라도 넘치면 빈 쪽이 하나 더 나온다.
   * body.pmrti-body 의 padding-bottom:48px 도 같은 이유로 걷는다.
   */
  html,
  body.pmrti-admin-body {
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
  }

  .pmrti-page.container {
    display: block !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
  }

  /*
   * 마지막 칸이 1~2mm 넘치면 테두리만 다음 쪽에 찍혀 빈 장이 생긴다.
   * 아래 여백을 걷고, 격자·본문이 제 높이 이상으로 늘지 않게 막는다.
   */
  .dash-stat-cols,
  #teacher-view > *:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }
  .dash-stat-cols > *:last-child { margin-bottom: 0 !important; }

  #teacher-view {
    padding: 0 !important;
    border: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .header.card,
  .sky-head-cast {
    display: none !important;
  }

  .dash-print-head {
    display: flex !important;
    align-items: baseline;
    gap: 12px;
    padding-bottom: 6px;
    margin-bottom: 8px;
    border-bottom: 1.5px solid #333;
    font-size: 10pt;
    color: #444;
  }
  .dash-print-title {
    flex: 1 1 auto;
    font-size: 13pt;
    font-weight: 700;
    color: #111;
  }

  /*
   * 막대와 조각은 색이 곧 자료다. 브라우저 기본값은 배경색을 빼고 찍으므로
   * 이걸 켜지 않으면 막대가 전부 흰 칸으로 나간다.
   */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /*
   * 글자 크기. 화면에서는 #teacher-view 안이 1rem(16px) 로 못 박혀 있는데,
   * A4 폭은 186mm(≈703px)뿐이라 그대로 두면 이름표가 칸을 다 먹고 막대가 사라진다.
   */
  #teacher-view .dist-label,
  #teacher-view .dist-count,
  #teacher-view .dist-title,
  #teacher-view .warn-msg {
    font-size: 8.6pt !important;
  }
  .stack-legend,
  .cmp-label,
  .cmp-v,
  .cmp-diff,
  .cmp-key,
  .kpi-label {
    font-size: 8pt !important;
  }

  /*
   * 두 칸씩. 화면의 넉 칸 격자를 종이에 그대로 쓰면 4분의 1 칸이 42mm 라
   * 「종이책 선호형」이 「종…」으로 잘린다.
   */
  /* 칸 수는 방향에 따라 갈린다(아래) — 공통은 간격만 */
  .dash-stat-cols { gap: 4px !important; }

  /* 이름표·숫자 칸을 좁혀 막대에 자리를 내준다 */
  .dist-label { width: 82px !important; }
  .dash-donut-bars .dist-label { width: 82px !important; }
  .dist-section.is-wide .dash-donut-bars .dist-label { width: 104px !important; }
  .dist-count.has-pct { width: 66px !important; }
  .dist-n { min-width: 32px !important; }
  .dist-pct { min-width: 26px !important; }
  .cmp-label { width: 52px !important; }
  .cmp-diff { width: 34px !important; }

  /* 띠 범례 이름은 자르지 않는다 — 종이에서는 스크롤도 툴팁도 없다 */
  .stack-name {
    overflow: visible !important;
    text-overflow: clip !important;
  }
  .stack-v { min-width: 32px !important; }
  .stack-p { min-width: 26px !important; }

  /* 종이에서는 원을 줄여야 한 장에 더 담긴다 */
  .dash-donut { width: 74px !important; height: 74px !important; }
  .dist-section.is-wide .dash-donut { width: 88px !important; height: 88px !important; }
  .dash-donut-row { gap: 9px !important; }
  .dist-section.is-wide .dash-donut-row { gap: 10px !important; }
  .dash-donut-hole span { font-size: 10pt !important; }

  .kpi-grid { gap: 4px !important; margin-bottom: 4px !important; }
  .kpi-card { padding: 6px 10px !important; gap: 7px !important; }
  .kpi-num { font-size: 13pt !important; }
  .kpi-icon { font-size: 11pt !important; width: 13px !important; }
  .dist-section { padding: 7px 9px !important; }
  .dist-title { margin-bottom: 5px !important; }
  .dist-row { margin-bottom: 1px !important; }
  .dist-bar-wrap, .dist-bar { height: 11px !important; }
  .cmp-row { margin-bottom: 4px !important; }
  .cmp-line { gap: 5px !important; }
  .cmp-track, .cmp-bar { height: 11px !important; }
  .stack-bar { height: 16px !important; }
  .stack-legend { margin-top: 5px !important; gap: 2px !important; }

  /*
   * 페이지 경계에서 반 토막 나면 안 되는 것만 avoid 를 건다.
   * 칸 전체에 걸면, 남은 자리에 안 들어가는 큰 칸을 사파리가 다음 쪽으로
   * 넘기지 못하고 통째로 떨어뜨린다.
   */
  .kpi-card,
  .dist-section,
  .cmp-row,
  .dist-row,
  .stack-legend li {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* 차오르는 효과는 종이에 의미가 없다 */
  .dist-bar,
  .stack-seg,
  .cmp-bar,
  .dash-donut-seg {
    transition: none !important;
  }
}

/* ---------------------------------------------------------------------------
 * 학생 상세 창 — 새로 쓴 마크업의 자리·크기
 * 색은 테마가 얹는다. 예전 인라인 style 을 걷어 내며 같이 정리한 규칙들이다.
 * --------------------------------------------------------------------------- */
.stu-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.stu-note { font-size: 0.86rem; color: var(--text2); }

.stu-grid-3 { grid-template-columns: repeat(3, 1fr); }

.stu-guide-desc {
  margin: 0 0 14px;
  font-size: 0.96rem;
  line-height: 1.7;
  color: var(--text);
}

.stu-sec-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 8px;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text2);
}
.stu-sec-title:first-of-type { margin-top: 0; }
.stu-sec-note { font-weight: 400; font-size: 0.8rem; color: var(--text3); }

.stu-genre {
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--bg2);
  margin-bottom: 7px;
}
.stu-genre .guide-tag2 { margin-bottom: 8px; }

.stu-reason-box {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg2);
}
.stu-reason-box .stu-sec-title { margin: 0 0 6px; }
.stu-reason-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.94rem;
  line-height: 1.7;
}
/* 점을 직접 그린다 — 두 줄로 넘어갈 때 글이 점 아래로 흐르지 않는다 */
.stu-reason-list li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 4px;
}
.stu-reason-list li:last-child { margin-bottom: 0; }
.stu-reason-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.66em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.stu-ai-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.stu-ai-btn { width: 100%; margin-bottom: 10px; }

/* 오류는 그대로 보여 준다 — 줄바꿈을 살리되 글꼴은 본문을 따른다 */
.result-ai-err {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--red-dark);
}

/*
 * AI 글 꾸미기 — pmrtiAiGuideHtml() 이 소제목(.ai-h)·항목(.ai-li)·단락(.ai-p) 으로
 * 쪼개 준다. 통짜 글에서는 pre-wrap 이 줄바꿈을 살렸지만, 이제 블록으로
 * 나뉘므로 꺼야 빈 줄이 겹치지 않는다.
 *
 * 이 덩이는 파일 끝에 있어야 한다 — .stu-ai-content 의 pre-wrap 과 자릿수가
 * 같아서, 앞에 두면 뒤엣것이 이겨 줄바꿈이 그대로 살아난다.
 */
.ai-body { white-space: normal; }
.ai-body .ai-h {
  margin: 16px 0 7px;
  font-size: 1.02em;
  font-weight: 700;
  color: var(--text);
}
.ai-body .ai-h:first-child { margin-top: 0; }
/* 점을 ::before 로 두어 두 줄로 넘어갈 때 글이 점 아래로 흐르지 않는다 */
.ai-body .ai-li {
  position: relative;
  padding-left: 15px;
  margin: 0 0 5px;
}
.ai-body .ai-li::before {
  content: '·';
  position: absolute;
  left: 3px;
  font-weight: 700;
  color: var(--text2);
}
.ai-body .ai-p { margin: 0 0 8px; }
.ai-body .ai-p:last-child,
.ai-body .ai-li:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------------------
 * 검사 이력 창 — 변화 요약 · 쪽 넘김
 * 색은 테마가 얹는다. 여기서는 자리와 크기만 잡는다.
 * --------------------------------------------------------------------------- */
.trend-sum-head {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text2);
}
.trend-sum-note {
  margin: 8px 0 0;
  font-size: 0.95rem;
  line-height: 1.65;
}
.trend-sum-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 6px 18px;
}
/* 이름표 폭을 고정해야 줄마다 화살표 자리가 맞는다 */
.trend-sum-list li {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  font-size: 0.95rem;
  line-height: 1.6;
}
.trend-sum-label { font-weight: 700; }
.trend-sum-from { text-align: right; }
.trend-sum-arrow { font-weight: 700; }
.trend-sum-to { font-weight: 700; }

.trend-table-box { margin-top: 12px; }
.trend-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
.trend-pager-btns { display: flex; gap: 6px; }

/* ---------------------------------------------------------------------------
 * 통계 인쇄 — 배치
 *
 * 방향별로 나누지 않는다. WebKit 은 인쇄에서 orientation 미디어 특성을
 * 쪽 상자가 아니라 화면 기준으로 판정해서, 세로로 뽑아도 가로 규칙이 잡힌다.
 * 좁은 쪽(세로 190mm)에 맞춰 한 배치로 두면 가로에서는 칸만 넓어진다.
 *
 * 여덟 칸 격자에 세 줄:
 *   성별2 + 매체2 + 이유4   = 8
 *   학년별4 + 독서량4       = 8
 *   행동8                  = 8
 *
 * 화면 차례(성별·매체·이유·학년별·독서량·행동)와 같으므로 order 를 쓰지 않는다.
 * 칸 수만 정해 주면 격자가 제 차례대로 세 줄에 나눠 담는다 —
 * 예전에는 학년별을 첫 줄로 끌어올리느라 order 를 여섯 개 달았고, 그래서
 * 화면과 종이의 차례가 서로 달랐다.
 *
 * 화면의 좁은 폭 규칙(1100px 이하 한 칸)이 인쇄에도 걸리므로 다시 못 박는다.
 * --------------------------------------------------------------------------- */
@media print {
  .dash-stat-cols {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
    gap: 5px !important;
  }

  /*
   * 「(원을 누르면 지도 가이드)」는 화면에서만 뜻이 있다.
   * 종이에서는 누를 수도 없는데 제목을 두 줄로 밀어 칸을 잡아먹는다.
   */
  .dist-title span { display: none !important; }

  /* 이름이 길면 줄을 바꾼다 — 잘리거나 옆 글자와 겹치는 것보다 낫다 */
  .stack-name,
  .dist-label,
  .cmp-label,
  .kpi-label {
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  .dash-stat-cols .stat-gender { grid-column: span 2 !important; }
  .dash-stat-cols .stat-media { grid-column: span 2 !important; }
  .dash-stat-cols .stat-reason { grid-column: span 4 !important; }
  .dash-stat-cols .stat-grade { grid-column: span 4 !important; }
  .dash-stat-cols .stat-qty { grid-column: span 4 !important; }
  .dash-stat-cols .stat-behavior { grid-column: span 8 !important; }

  #teacher-view .dist-label,
  #teacher-view .dist-count,
  #teacher-view .dist-title,
  #teacher-view .warn-msg { font-size: 9.2pt !important; }
  .dist-label { width: 100px !important; }
  .dash-donut-bars .dist-label { width: 100px !important; }
  .dist-count.has-pct { width: 72px !important; }
  .dash-donut { width: 76px !important; height: 76px !important; }
  .dist-section.is-wide .dash-donut { width: 92px !important; height: 92px !important; }
  /*
   * 첫 줄 높이를 재던 칸이 학년별(막대 여섯 줄)에서 이유(원)로 바뀌었다.
   * 원이 그만큼 크면 세 줄 합이 늘어 가로가 다시 두 쪽이 된다 —
   * 옆 막대는 넉 줄뿐이라 원만 조금 줄이면 줄 높이가 예전과 같아진다.
   */
  .stat-reason .dash-donut { width: 72px !important; height: 72px !important; }

  /*
   * 성별·매체는 8분의 2(세로에서 약 47mm)다. 범례를 한 줄에 붙이면
   * 이름과 숫자가 겹치므로 숫자를 이름 아래로 내린다.
   * 다만 건수와 비율은 같은 줄에 둔다 — 셋을 다 내리면 항목마다 세 줄이 되어
   * 가로(190mm)에서 마지막 칸이 다음 장으로 밀린다.
   */
  .stat-gender .stack-legend li,
  .stat-media .stack-legend li {
    grid-template-columns: 9px auto minmax(0, 1fr);
    row-gap: 0;
  }
  .stat-gender .stack-name,
  .stat-media .stack-name {
    grid-column: 2 / -1;
  }
  .stat-gender .stack-v,
  .stat-media .stack-v {
    grid-column: 2;
    min-width: 0;
    text-align: left;
  }
  .stat-gender .stack-p,
  .stat-media .stack-p {
    grid-column: 3;
    min-width: 0;
    text-align: left;
  }
}

/* ---------------------------------------------------------------------------
 * 공지 팝업 안쪽 — 교사 대시보드(SweetAlert)와 학생 화면(cuteDialog)이 같이 쓴다.
 * 껍데기는 화면마다 제 대화상자를 쓰고, 안쪽 글만 여기서 맞춘다.
 * --------------------------------------------------------------------------- */
.ntp {
  text-align: left;
}
.ntp-item + .ntp-item {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.ntp-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text);
}
/* 관리자가 쓴 줄바꿈을 그대로 살린다 — 문단이 붙으면 읽히지 않는다 */
.ntp-body {
  font-size: 0.94rem;
  line-height: 1.75;
  color: var(--text2);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
/* 공지가 길면 대화상자가 화면을 넘는다 — 안쪽만 굴린다 */
.ntp-dlg .swal2-html-container {
  max-height: min(56vh, 460px);
  overflow-y: auto;
  margin: 8px 0 0;
}
