/* =============================================================================
   협력업체 산업안전보건관리비 운영 (2026-10-10) — js/modules/ct-cost.js · ct-cost-view.js · ct-admin-cost.js · ct-cost-print.js 와 한 쌍
   화면: .ctc-* (사용 화면) · .ctca-* (관리자 탭)    인쇄 문서: #hsPrintHost .ctcp-* (공식 사내문서 모양 — 흑백 표 · 맑은 고딕, Apple 스타일 아님)
   색·글꼴은 theme-apple 토큰(--mint · --line · --ink-2 · --surface-2 · --radius)을 따른다. 숫자·파일 이름은 CSS 가 아니라 서버 응답에서만 온다.
   ========================================================================== */
body.hs-mod-ct-cost #app { max-width: 1120px; }

.ctc-secure { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius); background: var(--surface-2); color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.ctc-noaccess { max-width: 560px; margin: 24px auto; }
.ctc-sel, .ctc-flt { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 8px 0; }
.ctc-fl { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); min-width: 0; }
.ctc-fl select, .ctc-fl input[type="search"] { min-height: 44px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 10px; background: #fff; color: var(--ink); font: inherit; font-size: 16px; min-width: 0; }
.ctc-sel .ctc-fl select { min-width: 200px; }
.ctc-fl-q { flex: 1 1 180px; }
.ctc-fl-q input { width: 100%; }
.ctc-inc { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 14px; color: var(--ink); }

/* 카드 4개 */
.ctc-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 6px 0 10px; }
.ctc-card { position: relative; display: flex; flex-direction: column; gap: 5px; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.ctc-card-l { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.ctc-card-v { font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ctc-card small { font-size: 12px; color: var(--ink-2); }
.ctc-card.is-empty .ctc-card-v { color: var(--ink-2); }
.ctc-card.is-over, .ctc-card.is-over .ctc-card-v { border-color: #f0a8a1; }
.ctc-card.is-over .ctc-card-v { color: #a1281d; }
.ctc-card.is-warn .ctc-card-v { color: #b45309; }
.ctc-bad { color: #a1281d !important; font-weight: 700; }
.ctc-card-btn { align-self: flex-start; margin-top: 2px; }
.ctc-gauge { height: 10px; margin: 6px 0 0; }
.ctc-card.is-warn .ctc-gauge i { background: #d97706; }
.ctc-card.is-over .ctc-gauge i { background: #d4467e; }

/* 업체별 요약 */
.ctc-ov { margin: 6px 0 10px; }
.ctc-ov > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-weight: 700; font-size: 14px; color: var(--mint-ink); }
.ctc-ovt tbody tr { cursor: pointer; }
.ctc-ovt tbody tr:hover, .ctc-ovt tbody tr.is-on { background: var(--mint-tint); }
.ctc-ovt .ctc-tot td { font-weight: 800; background: var(--surface-2); cursor: default; }

/* 사용내역 표 */
.ctc-tbl .ctc-row { cursor: pointer; }
.ctc-tbl .ctc-row:hover, .ctc-tbl .ctc-row:focus-visible { background: var(--mint-tint); outline: none; }
.ctc-tbl .ctc-row.is-void { color: var(--ink-2); }
.ctc-tbl .ctc-row.is-void .ctc-content, .ctc-tbl .ctc-row.is-void .ctc-n { text-decoration: line-through; }
.ctc-n { text-align: right; font-variant-numeric: tabular-nums; }
.ctc-content { overflow-wrap: anywhere; }
.ctc-ev-n { font-size: 13px; color: var(--ink-2); }
#ctcList.is-loading { opacity: .55; pointer-events: none; }

/* 입력 · 상세 */
.ctc-han { min-height: 1.4em; color: var(--mint-ink); font-weight: 700; margin-top: 4px; }
.ctc-picked { margin: 6px 0; }
.ctc-picked:empty { display: none; }
.ctc-picked li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.ctc-imgview { text-align: center; }
.ctc-imgview img { max-width: 100%; max-height: 70vh; border-radius: 8px; }
.ctc-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.ctc-dl > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ctc-dl .ctc-dl-w { grid-column: 1 / -1; }
.ctc-dl span { font-size: 12px; color: var(--ink-2); font-weight: 700; }
.ctc-dl b { font-size: 15px; overflow-wrap: anywhere; font-weight: 700; }
.ctc-dl .ctc-amt { font-size: 20px; font-variant-numeric: tabular-nums; }
.ctc-voidbox { background: #fdecea; border-radius: 8px; padding: 8px 10px; }
.ctc-voidbox i { font-style: normal; font-size: 12px; color: var(--ink-2); }
.ctc-hist { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink); line-height: 1.7; }
.ctc-ev .hs-fb-list { margin-bottom: 8px; }

/* 관리자 탭 */
.ctca-wrap { display: grid; gap: 14px; }
.ctca-sec { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.ctca-sec h3 { margin: 0 0 8px; font-size: 16px; }
.ctca-who { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 6px 0; }
.ctca-who .hs-chip b { font-weight: 800; }
.ctca-grid { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 8px 0; }
.ctca-row { display: grid; grid-template-columns: minmax(130px, 1.4fr) repeat(4, minmax(78px, 1fr)); gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.ctca-row:last-child { border-bottom: 0; }
.ctca-head { background: var(--surface-2); font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.ctca-name b { display: block; }
.ctca-name i { font-style: normal; font-size: 12px; color: var(--ink-2); }
.ctca-sw { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; cursor: pointer; font-size: 13px; }
.ctca-sw input { width: 22px; height: 22px; }
.ctca-sw.is-implied { opacity: .6; cursor: default; }
.ctca-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 10px; }
.ctca-add .hs-staff { flex: 1 1 260px; margin: 0; }
.ctca-hist { margin: 8px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.7; color: var(--ink-2); }
.ctca-cat { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ctca-cat:last-child { border-bottom: 0; }
.ctca-cat input[type="text"], .ctca-cat input[type="number"] { min-height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 8px; font: inherit; font-size: 16px; min-width: 0; width: 100%; }
.ctca-cat.is-off input[type="text"] { color: var(--ink-2); background: var(--surface-2); }

@media (max-width: 860px) {
  .ctc-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ctc-card-v { font-size: 19px; }
}
@media (max-width: 720px) {
  .ctc-sel .ctc-fl, .ctc-sel .ctc-fl select { width: 100%; min-width: 0; }
  .ctc-flt .ctc-fl { flex: 1 1 140px; }
  .ctc-flt .ctc-fl select { width: 100%; }
  .ctc-tbl .hs-tr { padding: 10px 12px; }
  .ctc-tbl .ctc-n { text-align: left; }
  .ctc-tbl .ctc-content { font-weight: 700; }
  .ctc-dl { grid-template-columns: minmax(0, 1fr); }
  .ctca-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ctca-row.ctca-head { display: none; }
  .ctca-row .ctca-name { grid-column: 1 / -1; }
  .ctca-cat { display: flex; flex-wrap: wrap; gap: 8px; }
  .ctca-cat input[data-f="order"] { flex: 0 0 56px; width: 56px; }
  .ctca-cat input[data-f="name"] { flex: 1 1 calc(100% - 68px); width: auto; }
  .ctca-cat .btn { flex: 1 1 calc(50% - 4px); }
}
@media (max-width: 430px) {
  .ctc-card { padding: 10px 12px; }
  .ctc-card-v { font-size: 17px; }
}

/* =============================================================================
   인쇄 문서 — 산업안전보건관리비 사용내역 (A4 세로)
   ========================================================================== */
#hsPrintHost .ctcp-doc { height: 100%; display: flex; flex-direction: column; font-family: 'Malgun Gothic', '맑은 고딕', 'Apple SD Gothic Neo', sans-serif; font-size: 9.5pt; color: #000; }
#hsPrintHost .ctcp-main { flex: 1 1 auto; min-height: 0; overflow: hidden; }
#hsPrintHost .ctcp-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6mm; margin-bottom: 5mm; }
#hsPrintHost .ctcp-title { flex: 1 1 auto; margin: 0; padding-top: 5mm; text-align: center; font-size: 20pt; font-weight: 800; letter-spacing: 2px; }
#hsPrintHost .ctcp-sign { flex: 0 0 auto; border-collapse: collapse; table-layout: fixed; }
#hsPrintHost .ctcp-sign th, #hsPrintHost .ctcp-sign td { border: 1px solid #000; text-align: center; padding: 1mm 1.5mm; font-size: 8.5pt; line-height: 1.25; }
#hsPrintHost .ctcp-sign th { background: #ececec; font-weight: 700; }
#hsPrintHost .ctcp-sign th[rowspan] { width: 7mm; }
#hsPrintHost .ctcp-sign th + th, #hsPrintHost .ctcp-sign td { width: 27mm; }
#hsPrintHost .ctcp-sign td { height: 15mm; }
#hsPrintHost .ctcp-t { width: 100%; border-collapse: collapse; table-layout: fixed; }
#hsPrintHost .ctcp-t th, #hsPrintHost .ctcp-t td { border: 1px solid #000; padding: 1.4mm 2mm; line-height: 1.35; vertical-align: middle; overflow-wrap: anywhere; word-break: keep-all; text-align: left; }
#hsPrintHost .ctcp-t th { background: #ececec; font-weight: 700; text-align: center; }
#hsPrintHost .ctcp-t td.r { text-align: right; font-variant-numeric: tabular-nums; }
#hsPrintHost .ctcp-t td.c { text-align: center; }
#hsPrintHost .ctcp-info { margin-bottom: 4mm; }
#hsPrintHost .ctcp-info th { width: 28mm; }
#hsPrintHost .ctcp-list tr { break-inside: avoid; }
#hsPrintHost .ctcp-sum td { background: #ececec; font-weight: 800; }
#hsPrintHost .ctcp-cont { margin: 0 0 3mm; font-size: 9pt; font-weight: 700; }
#hsPrintHost .ctcp-none { margin: 6mm 0; text-align: center; color: #333; }
#hsPrintHost .ctcp-note { margin-top: 3mm; font-size: 8.5pt; color: #333; }
#hsPrintHost .ctcp-foot { flex: 0 0 auto; padding-top: 3mm; border-top: 1px solid #000; font-size: 8pt; color: #333; text-align: center; }
