/* =============================================================================
   협력업체(ct) 합동안전점검 — 화면 + 인쇄 서식 (2026-10-10)   js/ct-inspect-*.js · modules/ct-inspect.js
   앞부분: 화면 전용(.cti-*, 색은 앱 토큰). 뒷부분: 인쇄 서식 — 모든 선택자가 #hsPrintHost 로 시작, Apple 스타일 없이 맑은 고딕 · 검정 선.
   ========================================================================== */

/* ---------- 목록 ---------- */
.cti-qgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.cti-qcard { position: relative; display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 12px 10px; border: 1px solid var(--line, #d2d2d7); border-radius: var(--radius, 12px); background: #fff; color: var(--ink, #1d1d1f); font: inherit; cursor: pointer; min-height: 88px; }
.cti-qcard b { font-size: 15px; }
.cti-qcard .cti-qnum { font-size: 17px; font-weight: 800; color: #17653a; }
.cti-qcard .cti-qnum.cti-qnone { color: #b45309; font-size: 15px; }
.cti-qcard i { font-style: normal; font-size: 12px; color: var(--ink-2, #6e6e73); }
.cti-qcard em { font-style: normal; font-size: 12px; color: #0b5cad; font-weight: 700; }
.cti-qcard.is-empty { border-style: dashed; background: #fffaf0; }
.cti-qcard.is-done { background: #f3fbf6; }
.cti-qcard.is-on { border-color: var(--mint, #0071e3); box-shadow: 0 0 0 2px rgba(0, 113, 227, .18); }
.cti-qcard:focus-visible { outline: 2px solid var(--mint, #0071e3); outline-offset: 2px; }
.cti-list { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
a.hs-item.cti-row { text-decoration: none; color: inherit; display: block; }
.cti-row-date { font-size: 16px; }
.cti-row-date small { white-space: nowrap; font-weight: 500; color: var(--ink-2, #6e6e73); margin-left: 4px; }
.cti-row-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.cti-row-place { margin-top: 4px; font-size: 14px; }
.cti-row-ctr { margin-top: 2px; font-size: 13px; color: var(--ink-2, #6e6e73); overflow-wrap: anywhere; }
.cti-ng b { color: #b42318; }

/* ---------- 작성 폼 ---------- */
.cti-form .field label { font-weight: 700; }
.cti-pick { border: 1px solid var(--line, #d2d2d7); border-radius: var(--radius, 12px); background: #fff; max-height: 52vh; overflow: auto; margin: 6px 0; }
.cti-pickrow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line, #e5e5ea); cursor: pointer; min-height: 48px; }
.cti-pickrow:last-child { border-bottom: 0; }
.cti-pickrow input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 auto; }
.cti-pickname { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.cti-pickname small { color: var(--ink-2, #6e6e73); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cti-pickhc { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: 0 0 auto; }
.cti-pickhc small { color: var(--ink-2, #6e6e73); font-size: 12px; }

/* ---------- 점검 화면 ---------- */
.cti-date { font-size: 18px; font-weight: 800; }
.cti-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 14px; margin: 6px 0 10px; }
.cti-dl div { min-width: 0; }
.cti-dl dt { font-size: 12px; color: var(--ink-2, #6e6e73); }
.cti-dl dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.cti-dl-wide { grid-column: 1 / -1; }
.cti-acts .cti-void { color: #a1281d; border-color: #f0a8a1; }
.cti-tabs button i { font-style: normal; opacity: .85; margin-left: 4px; }
.cti-items { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
.cti-item { margin: 0; scroll-margin-top: 70px; }
.cti-item.is-ng { border-color: #f0a8a1; box-shadow: 0 0 0 1px #f6c9c4; }
.cti-item-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cti-item-h b { flex: 1 1 auto; font-size: 15px; line-height: 1.35; }
.cti-no { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2, #f5f5f7); font-weight: 800; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.cti-saved { flex: 0 0 auto; font-size: 12px; color: var(--ink-2, #6e6e73); min-width: 54px; text-align: right; }
.cti-saved.is-ok { color: #17653a; }
.cti-saved.is-err { color: #b42318; font-weight: 700; }
.cti-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 10px; }
.cti-r { min-height: 46px; border: 1px solid var(--line-strong, #c7c7cc); border-radius: 10px; background: #fff; color: var(--ink, #1d1d1f); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; padding: 0 6px; }
.cti-r.is-on.cti-r-ok { background: #e6f6ec; border-color: #1baf7a; color: #17653a; }
.cti-r.is-on.cti-r-ng { background: #fdecea; border-color: #d4467e; color: #a1281d; }
.cti-r.is-on.cti-r-na { background: #f1f1f4; border-color: #8e8e93; color: #3a3a3c; }
.cti-r:focus-visible { outline: 2px solid var(--mint, #0071e3); outline-offset: 1px; }
.cti-item textarea { width: 100%; font-size: 16px; min-height: 64px; }
.cti-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; border: 1px solid var(--line-strong, #c7c7cc); }
.cti-chip.cti-r-ok { background: #e6f6ec; color: #17653a; border-color: #86cda0; }
.cti-chip.cti-r-ng { background: #fdecea; color: #a1281d; border-color: #f0a8a1; }
.cti-chip.cti-r-na { background: #f1f1f4; color: #3a3a3c; }
.cti-ro { display: grid; gap: 6px; }
.cti-ro p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.cti-ro-l { font-size: 12px; color: var(--ink-2, #6e6e73); font-weight: 700; }

/* 사진 상자 */
.cti-pb { margin-top: 10px; border-top: 1px dashed var(--line, #d2d2d7); padding-top: 8px; }
.cti-pb-h { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.cti-pb-h small { color: var(--ink-2, #6e6e73); font-weight: 500; }
.cti-pb-empty { font-size: 13px; color: var(--ink-2, #6e6e73); padding: 4px 0 8px; }
.cti-pb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-bottom: 8px; }
.cti-ph { position: relative; margin: 0; border: 1px solid var(--line, #d2d2d7); border-radius: 8px; overflow: hidden; background: var(--surface-2, #f5f5f7); }
.cti-ph img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; cursor: zoom-in; }
.cti-ph figcaption { position: absolute; left: 0; bottom: 0; right: 0; padding: 2px 6px; font-size: 11px; background: rgba(0, 0, 0, .55); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cti-ph .cti-ph-x { position: absolute; top: 0; right: 0; width: 40px; height: 40px; min-height: 40px; border: 0; background: transparent; color: transparent; font-size: 0; padding: 0; cursor: pointer; border-radius: 0; }
.cti-ph .cti-ph-x::after { content: '×'; position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, .62); color: #fff; font-size: 18px; line-height: 25px; text-align: center; }
.cti-ph-up { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; aspect-ratio: 4 / 3; padding: 6px; font-size: 12px; text-align: center; }
.cti-ph-up.is-err { color: #b42318; background: #fdecea; }
.cti-pb-bar { display: block; width: 90%; height: 5px; background: var(--line, #d2d2d7); border-radius: 3px; overflow: hidden; }
.cti-pb-bar u { display: block; height: 100%; width: 0; background: var(--mint, #0071e3); text-decoration: none; }
.cti-pb-bar2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cti-pb-cap { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.cti-pb-cap select { min-height: 40px; border: 1px solid var(--line-strong, #c7c7cc); border-radius: 8px; padding: 0 8px; font: inherit; font-size: 15px; background: #fff; }
.cti-pb-add { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 42px; cursor: pointer; }
.cti-pb-add.is-off { opacity: .5; cursor: not-allowed; }
.cti-pb-add:focus-within { outline: 2px solid var(--mint, #0071e3); outline-offset: 2px; }
.cti-pb-in { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.cti-pb-in:disabled { cursor: not-allowed; }

/* ---------- 서명 현황 보드 ---------- */
.cti-sign .hs-meter { margin: 10px 0 4px; }
.cti-ctr { margin-top: 12px; }
.cti-ctr .hs-card-h .cti-rm { margin-left: auto; }
.cti-slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cti-slot { border: 1px solid var(--line, #d2d2d7); border-radius: 10px; padding: 10px 12px; background: #fff; }
.cti-slot-signed { background: #f3fbf6; border-color: #bfe3cc; }
.cti-slot-absent { background: #fffaf0; border-color: #ecd9a4; }
.cti-slot-exempt { background: #f7f7f9; }
.cti-slot-main { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.cti-slot-l { font-weight: 800; font-size: 14px; min-width: 96px; }
.cti-slot-who { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
.cti-slot-who small { color: var(--ink-2, #6e6e73); }
.cti-slot-note { margin-top: 4px; font-size: 12.5px; color: var(--ink-2, #6e6e73); }
.cti-slot-acts { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.cti-when { color: var(--ink-2, #6e6e73); }
.cti-slot img.ct-sig { max-height: 40px; background: #fff; border: 1px solid var(--line, #e5e5ea); border-radius: 6px; padding: 2px 6px; }
.cti-hist { margin-top: 14px; font-size: 13px; color: var(--ink-2, #6e6e73); }
.cti-hist ul { margin: 6px 0 0; padding-left: 18px; }
.cti-hist li.is-void { text-decoration: line-through; opacity: .75; }
.cti-hist li.is-void b { text-decoration: none; color: #a1281d; display: inline-block; }

/* ---------- 양식 편집기(관리 화면 안) ---------- */
.cti-tp-fs { border: 1px solid var(--line, #d2d2d7); border-radius: var(--radius, 12px); padding: 10px 12px; margin: 10px 0; min-width: 0; }
.cti-tp-fs legend { font-weight: 800; font-size: 14px; padding: 0 6px; }
.cti-tp-r { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid var(--line, #e5e5ea); }
.cti-tp-r:last-child { border-bottom: 0; }
.cti-tp-r.is-off { opacity: .6; }
.cti-tp-no { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2, #f5f5f7); font-weight: 800; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.cti-tp-f { flex: 1 1 260px; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.cti-tp-f input { width: 100%; min-height: 40px; font-size: 16px; }
.cti-tp-f code { font-size: 11px; color: var(--ink-2, #6e6e73); }
.cti-tp-mv { display: inline-flex; gap: 4px; }
.cti-tp-pv h4 { margin: 0 0 4px; }
.cti-tp-pv p { margin: 4px 0; font-size: 13px; }
.cti-tp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cti-tp-cols ol { margin: 4px 0; padding-left: 20px; font-size: 13px; }

@media (min-width: 900px) {
  .cti-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cti-pb-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
@media (max-width: 640px) {
  .cti-qgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cti-list { grid-template-columns: minmax(0, 1fr); }
  .cti-slot-l { min-width: 0; flex: 1 1 100%; }
  .cti-slot-acts .btn { flex: 1 1 auto; }
  .cti-acts .btn { flex: 1 1 auto; }
}
@media (max-width: 768px) {
  body.hs-mod .cti-pb-add, body.hs-mod .cti-r { min-height: 46px; }
  body.hs-mod .cti-slot-acts .btn-sm, body.hs-mod .cti-acts .btn-sm { min-height: 42px; }
}

/* =============================================================================
   인쇄 서식 — 「도급사업의 합동 안전·보건 점검일지」 (A4 세로, 가로폭 188mm = 210 − 좌우 11mm)
   ========================================================================== */
#hsPrintHost .cti-pg { font-family: 'Malgun Gothic', '맑은 고딕', 'Apple SD Gothic Neo', sans-serif; font-size: 10pt; color: #000; line-height: 1.3; }
#hsPrintHost .cti-meas { position: absolute; left: -12000px; top: 0; height: auto !important; overflow: visible !important; visibility: hidden; page: auto; zoom: 1 !important; }
#hsPrintHost .cti-title { text-align: center; font-size: 20pt; font-weight: 800; letter-spacing: .6mm; margin: 0 0 6mm; }
#hsPrintHost .cti-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 4mm; margin-bottom: 3mm; }
#hsPrintHost .cti-dt { flex: 1 1 auto; min-width: 0; }
#hsPrintHost .cti-dt p { margin: 0 0 1.4mm; }
#hsPrintHost .cti-d1 { font-size: 11.5pt; font-weight: 700; }
#hsPrintHost .cti-d2 { font-size: 9.5pt; color: #222; overflow-wrap: anywhere; }
#hsPrintHost .cti-stamp { flex: 0 0 auto; border-collapse: collapse; table-layout: fixed; }
#hsPrintHost .cti-stamp th, #hsPrintHost .cti-stamp td { border: .25mm solid #000; text-align: center; padding: 1mm 1.5mm; }
#hsPrintHost .cti-stamp th { background: #fff; font-size: 9pt; font-weight: 700; width: 27mm; height: 7mm; }
#hsPrintHost .cti-stamp .cti-stamp-h { width: 8mm; font-size: 10pt; line-height: 1.2; }
#hsPrintHost .cti-stamp td { height: 17mm; vertical-align: middle; }
#hsPrintHost .cti-stamp .cti-sg { max-height: 11mm; }
#hsPrintHost .cti-sn { display: block; font-size: 7.5pt; margin-top: .4mm; }
#hsPrintHost .cti-tb { border-collapse: collapse; table-layout: fixed; width: 188mm; }
#hsPrintHost .cti-tb th, #hsPrintHost .cti-tb td { border: .25mm solid #000; padding: 1mm 1.5mm; vertical-align: middle; overflow-wrap: anywhere; word-break: keep-all; }
#hsPrintHost .cti-tb th { background: #d9d9d9; font-weight: 700; text-align: center; height: 8mm; font-size: 9.5pt; letter-spacing: .3mm; }
#hsPrintHost .cti-tb tr { break-inside: avoid; }
#hsPrintHost .cti-ir td { height: 16mm; font-size: 9pt; }
#hsPrintHost .cti-ti b { display: block; font-weight: 700; font-size: 9pt; }
#hsPrintHost .cti-res { margin-top: 1mm; font-size: 8.5pt; }
#hsPrintHost .cti-res-ng { font-weight: 800; }
#hsPrintHost .cti-tx { text-align: left; font-size: 8.5pt; vertical-align: top; }
#hsPrintHost .cti-cap { font-size: 10pt; font-weight: 700; margin: 5mm 0 2mm; }
#hsPrintHost .cti-sr td { height: 14mm; text-align: center; font-size: 9.5pt; }
#hsPrintHost .cti-sr td small { display: block; font-size: 7.5pt; color: #333; margin-top: .3mm; }
#hsPrintHost .cti-co { font-weight: 700; }
#hsPrintHost .cti-sc { padding: .5mm 1mm; }
#hsPrintHost .cti-sg { display: block; max-height: 11.5mm; max-width: 100%; margin: 0 auto; object-fit: contain; }
#hsPrintHost .cti-ab { font-size: 9pt; }
#hsPrintHost .cti-ex { font-weight: 700; font-size: 9.5pt; background: #fff; }
#hsPrintHost .cti-cont { font-size: 9pt; color: #444; border-bottom: .25mm solid #808080; padding-bottom: 1.5mm; margin-bottom: 4mm; }
#hsPrintHost .cti-sect { font-size: 15pt; font-weight: 800; margin: 0 0 4mm; padding-bottom: 2mm; border-bottom: .5mm solid #000; }
#hsPrintHost .cti-ph-h { font-size: 10.5pt; margin: 3mm 0 2mm; }
#hsPrintHost .cti-ph-h .cti-res { margin-left: 2mm; font-size: 9pt; }
#hsPrintHost .cti-ph-h p { margin: 1mm 0 0; font-size: 8.5pt; color: #222; }
#hsPrintHost .cti-pr { display: flex; gap: 4mm; margin-bottom: 3mm; }
#hsPrintHost .cti-pf { margin: 0; width: 90mm; }
#hsPrintHost .cti-pfi { width: 90mm; height: 66mm; border: .25mm solid #808080; display: flex; align-items: center; justify-content: center; background: #fff; overflow: hidden; }
#hsPrintHost .cti-pfi img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
#hsPrintHost .cti-pf figcaption { height: 5mm; font-size: 8.5pt; text-align: center; padding-top: .8mm; }
#hsPrintHost .cti-foot { position: absolute; left: 11mm; right: 11mm; bottom: 6mm; display: flex; justify-content: space-between; font-size: 8pt; color: #444; border-top: .25mm solid #808080; padding-top: 1.2mm; }
