/* =========================================================
   NR 종합검사 결과표 — 인쇄 / PDF 전용 스타일 (A4 최적화)
   media="print" 로 로드됩니다.

   · @page 로 A4(210×297mm)·여백 12mm 지정, .sheet 1개 = A4 1장
   · 인쇄 직전 JS가 이 파일을 잠시 media="all" 로 전환해 각 시트의
     실제 높이를 측정하고, 한 페이지를 넘는 시트만 자동 축소합니다.
   ========================================================= */

@page {
  size: A4 portrait;
  margin: 12mm;
}

:root {
  --page-w: 186mm;   /* 210mm - 12mm×2 */
  --page-h: 272mm;   /* 297mm - 12mm×2 - 1mm(반올림 여유) */
}

/* 브라우저 '잉크 절약' 모드에서도 막대 색상 유지 */
html, body, .sheet, .sheet * {
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

html, body {
  margin: 0 !important;
  padding: 0 !important;
  background: #fff !important;
  font-size: 9.6pt;
  line-height: 1.55;
}

.toolbar, .to-top, .fit-hint { display: none !important; }
.doc { display: block !important; max-width: none !important; margin: 0 !important; }

/* =========================================================
   시트 = A4 1페이지
   ========================================================= */
.sheet {
  display: block;
  width: var(--page-w) !important;
  max-width: 100%;
  height: var(--page-h) !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: hidden;                 /* JS 미동작 시에도 1장 유지 */
  background: #fff !important;
  break-after: page;
  page-break-after: always;
}
.sheet::before { display: none !important; }
.sheet:last-of-type { break-after: auto; page-break-after: auto; }

/* JS 자동 맞춤이 적용된 시트 — zoom 으로 레이아웃 자체를 축소 */
.sheet.is-scaled {
  zoom: var(--fit-scale, 1);
  width: calc(var(--page-w) / var(--fit-scale, 1)) !important;
  height: calc(var(--page-h) / var(--fit-scale, 1)) !important;
  overflow: hidden;
}

/* ---------- 페이지 나눔 안전장치 ---------- */
h1, h2, h3 { break-after: avoid-page; page-break-after: avoid; }
.block, .hero, .nr-table, .attitude, .attitude__row, .goalrow, .goaldesc,
.factorgroups, .factorgroup, .factorgroup__list li, .commentary, .commentary p,
.rowchart, .rowchart__row, .part-title, .pctbar, .pctbar-legend {
  break-inside: avoid;
  page-break-inside: avoid;
}

/* =========================================================
   화면 'A4 미리보기' / 인쇄 진행 중 레이아웃
   (JS가 미리보기·인쇄 시에만 body 클래스를 붙입니다)
   ========================================================= */
body.is-previewing,
body.is-printing { background: #dfe3e8 !important; padding: 26px 12px 80px !important; }
body.is-previewing .doc,
body.is-printing .doc {
  display: flex !important; flex-direction: column; align-items: center;
}
body.is-previewing .sheet,
body.is-printing .sheet {
  width: var(--page-w, 186mm) !important;
  height: var(--page-h, 272mm) !important;
  margin: 0 auto 18px !important;
  box-shadow: 0 3px 26px -12px rgba(22,32,43,.55) !important;
}
body.is-previewing .sheet.is-scaled,
body.is-printing .sheet.is-scaled {
  width: calc(var(--page-w, 186mm) / var(--fit-scale, 1)) !important;
  height: calc(var(--page-h, 272mm) / var(--fit-scale, 1)) !important;
}

/* =========================================================
   타이포그래피 · 여백 압축 (A4 1장에 맞춤)
   ========================================================= */
.sheet__head {
  padding-bottom: 2.2mm; margin-bottom: 4mm;
  font-size: 7.4pt; letter-spacing: .09em;
}
.doc-title { font-size: 18pt; margin: 0 0 4.5mm; line-height: 1.14; }
.doc-title span { font-size: 7.6pt; margin-top: 1.8mm; letter-spacing: .2em; }

.idcard { margin-bottom: 5mm; }
.idcard__cell { padding: 2.2mm 1.8mm; }
.idcard__cell dt { font-size: 7pt; margin-bottom: .8mm; }
.idcard__cell dd { font-size: 9pt; }

.block { margin-bottom: 3.8mm; }
.block__title { font-size: 10.6pt; margin-bottom: 2.6mm; gap: 2.2mm; }
.block__title small { font-size: 7.6pt; }
.block__letter { min-width: 5.4mm; height: 5.4mm; font-size: 8.4pt; border-radius: 1.3mm; }

.part-title { font-size: 13.4pt; margin-bottom: 2.8mm; padding-bottom: 1.7mm; gap: 2.4mm; border-bottom-width: 1.5pt; }
.part-title > span { min-width: 6.6mm; height: 6.6mm; font-size: 11.4pt; border-radius: 1.7mm; }

/* ---------- ★ 직무능력 종합판정 (1p 전면) ---------- */
.hero { margin-bottom: 4.2mm; border-radius: 3mm; }
.hero__label { padding: 2.2mm 4.2mm; gap: 2.4mm; }
.hero__badge { font-size: 10.6pt; }
.hero__note { font-size: 7.4pt; }
.hero__body { padding: 3.4mm 4.4mm; grid-template-columns: 1.05fr 1px .72fr .86fr 1.5fr; }
.hero__score strong { font-size: 36pt; }
.hero__score span { font-size: 8.2pt; }
.hero__divider { margin: 0 3.4mm; }
.hero__stat { gap: .8mm; }
.hero__stat-label { font-size: 7.2pt; }
.hero__stat-val { font-size: 20pt; }
.hero__stat-val small { font-size: 9pt; }
.hero__stat-text { font-size: 8.6pt; line-height: 1.48; }
.grade--xl { font-size: 15.5pt; padding: 1.2mm 3.6mm; border-radius: 2mm; }

/* ---------- NR 표 ---------- */
.nr-table { font-size: 9pt; }
.nr-table thead th { padding: 2.2mm 2.8mm; font-size: 8pt; }
.nr-table tbody th { padding: 2.4mm 2.8mm; font-size: 9pt; }
.nr-table tbody td { padding: 2.4mm 2.8mm; }
.nr-table .num { font-size: 10.5pt; }
.nr-table .rank { font-size: 9.4pt; }
.nr-table td:nth-child(2) { min-width: 44mm; }

.grade { font-size: 9pt; padding: .5mm 2.2mm; border-radius: 1.4mm; }

.pctbar { height: 2.6mm; border-radius: 1mm; }
.pctbar::before { border-radius: 1mm; }
.pctbar--sm { height: 2.4mm; }
.pctbar-legend { margin-top: 2.4mm; font-size: 7.6pt; }
.pctbar-legend__mark { height: 2.6mm; }

/* ---------- I-2 수검자 태도 ---------- */
.attitude { border-radius: 2mm; }
.attitude__row { grid-template-columns: 24mm 1fr; }
.attitude__name { padding: 2.4mm 3mm; font-size: 9pt; }
.attitude__desc { padding: 2.4mm 3mm; font-size: 9pt; gap: 2.4mm; }
.attitude__val { font-size: 11pt; padding: .4mm 2.4mm; border-radius: 1.4mm; }
.attitude__opinion { padding: 2.4mm 3mm; font-size: 9pt; }

/* ---------- I-3 기대능력 ---------- */
.goalrow { gap: 1.4mm; margin-bottom: 3.4mm; }
.goalrow li { padding: 3mm 1.4mm; font-size: 9pt; border-radius: 1.8mm; }
.goalrow li::after {
  border-top-width: 2.8mm; border-bottom-width: 2.8mm; border-left-width: 1.5mm;
  right: -1.5mm;
}
.goalrow__check { width: 4mm; height: 4mm; font-size: 7.6pt; }

.goaldesc { padding: 3mm 3.6mm; border-left-width: 3px; border-radius: 2mm; }
.goaldesc__lead { font-size: 8.8pt; line-height: 1.68; margin-bottom: 2.2mm; }
.goaldesc__list { padding-left: 5mm; }
.goaldesc__list li { font-size: 8.4pt; line-height: 1.68; }

/* ---------- II-2 세부 요인 ---------- */
.factorgroups { grid-template-columns: 1fr 1fr; gap: 2.6mm; }
.factorgroup { padding: 2.2mm 2.8mm; border-top-width: 2px; border-radius: 2mm; }
.factorgroup__title { font-size: 9.2pt; margin-bottom: 1.6mm; padding-bottom: 1.2mm; }
.factorgroup__title small { font-size: 9.6pt; }
.factorgroup__list { gap: 1.3mm; }
.factorgroup__list li { grid-template-columns: 21mm 1fr 12mm; gap: 2.4mm; }
.factor-name { font-size: 8.2pt; }
.factor-val { font-size: 9.4pt; }
.factor-val > span { font-size: 6.8pt; }

/* ---------- II-3 해설 ---------- */
.commentary { padding: 2.6mm 3.2mm; border-radius: 2mm; }
.commentary p { font-size: 8.2pt; line-height: 1.64; margin-bottom: 1.5mm; }
.commentary__final { padding-top: 1.6mm; }

/* ---------- III-3 직무적성 결과표 ---------- */
.rowchart { border-radius: 2mm; }
.rowchart__head {
  grid-template-columns: 9mm 33mm 1fr 1.35fr;
  gap: 2.6mm; padding: 1.8mm 3mm; font-size: 8pt;
}
.rowchart__row {
  grid-template-columns: 9mm 33mm 1fr 1.35fr;
  gap: 2.6mm; padding: 1.9mm 3mm;
}
.rowchart__rank { width: 6.4mm; height: 6.4mm; font-size: 8pt; border-radius: 1.4mm; }
.rowchart__name { font-size: 8.6pt; }
.rowchart__bar-wrap { grid-template-columns: 1fr 12mm; gap: 2.6mm; }
.rowchart__bar { height: 2.8mm; }
.rowchart__bar-wrap b { font-size: 10pt; }
.rowchart__desc { font-size: 7.6pt; line-height: 1.5; }

.footnote { margin-top: 2.4mm; font-size: 7.4pt; }
.foot-note { margin-top: 5mm; padding-top: 3mm; font-size: 7.2pt; }
