/* =============================================================================
   안전보건체계 — 인쇄 전용 보기 · A4 쪽  (2026-10-09)   js/hs-print.js 와 한 쌍
   - 쪽 설정은 '이름 있는 @page' 만 쓴다(전역 @page 규칙 없음 → 다른 업무의 인쇄 여백·방향에 영향 없음).
       hsPortrait = A4 세로 · hsLandscape = A4 가로, 둘 다 여백 0. 쪽 여백은 .hs-page 의 padding 이 맡는다
       (여백 0 이면 크롬이 머리글·바닥글(주소·날짜)을 찍지 않고, 화면 미리보기와 인쇄가 같은 모양이 된다).
   - 각 쪽(.hs-page.hs-port | .hs-land)이 page: 속성으로 자기 이름을 골라 한 문서에 세로·가로가 섞일 수 있다.
   - 이 파일의 모든 규칙은 #hsPrintHost / body.hs-print-on 안에서만 작동한다.
   ========================================================================== */
@page hsPortrait { size: A4 portrait; margin: 0; }
@page hsLandscape { size: A4 landscape; margin: 0; }

/* ---- 쪽 상자 ---- */
#hsPrintHost .hs-page { position: relative; box-sizing: border-box; background: #fff; color: #000; overflow: hidden; padding: var(--hs-pad, 10mm); text-align: left; letter-spacing: 0;
  font-family: Pretendard, 'Malgun Gothic', '맑은 고딕', 'Apple SD Gothic Neo', sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
#hsPrintHost .hs-page *, #hsPrintHost .hs-page *::before, #hsPrintHost .hs-page *::after { box-sizing: border-box; }
#hsPrintHost .hs-page.hs-port { width: 210mm; height: 297mm; page: hsPortrait; }
#hsPrintHost .hs-page.hs-land { width: 297mm; height: 210mm; page: hsLandscape; }
/* 문서 안 기본 요소(업무별 서식이 덧입힌다) */
#hsPrintHost .hs-page img { max-width: 100%; }
#hsPrintHost .hs-t { border-collapse: collapse; table-layout: fixed; width: 100%; }
#hsPrintHost .hs-t th, #hsPrintHost .hs-t td { border: 1px solid #000; padding: 2px 4px; line-height: 1.3; overflow-wrap: anywhere; vertical-align: middle; }
#hsPrintHost .hs-t tr { break-inside: avoid; }
#hsPrintHost .hs-sig { display: block; height: 34px; width: auto; max-width: 100%; margin: 0 auto; object-fit: contain; }

/* ---- 화면: 쪽을 흰 종이처럼, 좁은 화면에서는 줄여 보이기 ---- */
body.hs-print-on > *:not(#hsPrintHost) { display: none !important; }
body.hs-print-on { background: #e9e9ed !important; overflow: auto !important; }
#hsPrintHost { display: block; min-height: 100vh; }
@media screen {
  /* 인쇄 보기 위에 뜨는 확인창·사유창·알림은 보여야 한다(인쇄물에는 나가지 않음) */
  body.hs-print-on > #overlayRoot, body.hs-print-on > #toast { display: block !important; }
  #hsPrintHost .hs-pages { display: flex; flex-direction: column; align-items: center; padding: 4px 0 40px; }
  #hsPrintHost .hs-page { margin: 14px auto; box-shadow: 0 1px 8px rgba(0, 0, 0, .28); flex: 0 0 auto; }
  #hsPrintHost .hs-page.hs-port { zoom: var(--hs-zp, 1); }
  #hsPrintHost .hs-page.hs-land { zoom: var(--hs-zl, 1); }
}
#hsPrintHost .hs-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; background: #fff; border-bottom: 1px solid #d2d2d7; font-family: Pretendard, 'Malgun Gothic', sans-serif; }
#hsPrintHost .hs-bar-title { flex: 1 1 200px; font-size: 15px; font-weight: 600; min-width: 0; color: #1d1d1f; }
#hsPrintHost .hs-bar-ctl { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#hsPrintHost .hs-bar-ctl:empty { display: none; }
#hsPrintHost .hs-bar-note { flex: 1 1 100%; font-size: 13px; color: #6e6e73; }
#hsPrintHost .hs-bar-note:empty { display: none; }
#hsPrintHost .hs-bar label { font-size: 13px; display: inline-flex; align-items: center; gap: 6px; color: #1d1d1f; }
#hsPrintHost .hs-bar select, #hsPrintHost .hs-bar input[type="text"], #hsPrintHost .hs-bar input[type="number"] { min-height: 34px; border: 1px solid #c7c7cc; border-radius: 8px; padding: 0 8px; background: #fff; color: #1d1d1f; font: inherit; font-size: 13px; }

/* ---- 인쇄: 도구줄은 빼고, 쪽마다 새 종이 ---- */
@media print {
  body.hs-print-on { background: #fff !important; overflow: visible !important; }
  #hsPrintHost { min-height: 0; }
  #hsPrintHost .hs-bar { display: none !important; }
  #hsPrintHost .hs-pages { display: block; padding: 0; }
  #hsPrintHost .hs-page { margin: 0; box-shadow: none; zoom: 1; break-after: page; page-break-after: always; }
  /* 297mm 높이 그대로면 반올림으로 빈 쪽이 하나 더 나올 수 있어 조금 낮춘다 */
  #hsPrintHost .hs-page.hs-port { height: 296.4mm; }
  #hsPrintHost .hs-page.hs-land { height: 209.4mm; }
  #hsPrintHost .hs-page:last-child { break-after: auto; page-break-after: auto; }
}
/* 휴대폰: 인쇄 보기 도구줄 버튼 40px 이상(R3UI-2) */
@media screen and (max-width: 768px) { #hsPrintHost .hs-bar .btn-sm { min-height: 40px; } }
