/* 장비 대장·이력카드 (ledger.js) */
.lg-mini { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 12px; }
.lg-ctl { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.lg-q { min-width: 220px; flex: 1 1 220px; font: inherit; font-size: 13px; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.mini-sel { font: inherit; font-size: 13px; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; min-width: 0; }
svg.chart .lg-over { fill: var(--crit); }
.lg-tbl { min-width: 0; }
.lg-tbl td { font-size: 13px; white-space: nowrap; }
.lg-tbl td:last-child { white-space: normal; min-width: 140px; }
.lg-tbl th { padding-left: 12px; padding-right: 12px; }
@media (max-width: 760px) { .lg-tbl td { white-space: normal; } }
.lg-tbl tr.lg-off td { color: var(--muted); }
.lg-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; }
.lg-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.lg-form input, .lg-form select { font: inherit; font-size: 14px; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; min-width: 0; width: 100%; }
.lg-form input[readonly], .lg-form select:disabled { background: color-mix(in srgb, var(--line) 35%, var(--surface)); color: var(--muted); }
.lg-wide { grid-column: 1 / -1; }
.lg-cal { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; }
.lg-cal[hidden] { display: none !important; }
.lg-cal .lg-chk { grid-column: span 2; flex-direction: row; align-items: center; gap: 8px; color: var(--fg); font-size: 13px; }
.lg-cal .lg-chk input { width: auto; }
.lg-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; margin-bottom: 12px; }
.lg-facts div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lg-facts span { font-size: 12px; color: var(--muted); }
.lg-facts b { font-weight: 500; overflow-wrap: anywhere; }

/* 이력카드(첨부 Word 양식과 같은 표) */
.lg-paper { overflow-x: auto; }
.lgs-box { display: flex; }
.lgs-box > .lgs { margin: 0 auto; flex: none; }
.lgs { background: #fff; color: #000; padding: 12px; font-family: 'Malgun Gothic', '맑은 고딕', 'Apple SD Gothic Neo', sans-serif; box-sizing: content-box; }
.lgs-t { table-layout: fixed; border-collapse: collapse; min-width: 0; background: #fff; }
.lgs-t td { font-size: 13.33px; white-space: normal; overflow: hidden; overflow-wrap: anywhere; color: #000; box-sizing: border-box; }
.lgs-t td .lgs-ph { position: absolute; left: 45px; top: -3px; width: 231.6px; height: 224.7px; object-fit: contain; }
.lgs-ft { display: flex; justify-content: space-between; font-size: 10.5px; margin-top: 8px; padding: 0 4px; }
.lg-pg { page-break-after: always; break-after: page; }
.lg-pg:last-child { page-break-after: auto; break-after: auto; }
#lgPrintAll { display: none; }

@media (max-width: 1100px) { .lg-form, .lg-cal, .lg-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lg-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .lg-form, .lg-cal, .lg-facts { grid-template-columns: minmax(0, 1fr); } .lg-cal .lg-chk { grid-column: auto; } .lg-q { min-width: 0; } }

/* 인쇄: 이력카드만 A4 가로로 (원본 Word와 같은 여백) */
/* 여백은 쪽 안쪽 여백(padding)으로 줍니다. @page 여백을 0으로 해야 브라우저가 찍는 날짜·주소·쪽수·제목이 나오지 않습니다. */
@page { size: A4 landscape; margin: 0; }
@media print {
  html, body { margin: 0 !important; }
  body.lg-print-one { padding: 20mm 22mm 15mm 25mm !important; background: #fff !important; }
  body.lg-print-all { padding: 0 !important; background: #fff !important; }
  body.lg-print-all .lg-pg { box-sizing: border-box; width: 297mm; height: 209mm; padding: 20mm 22mm 15mm 25mm; overflow: hidden; }
  body.lg-print-one .wrap, body.lg-print-all .wrap, body.lg-print-all .auth-ov { display: none !important; }
  body.lg-print-one .wrap { display: block !important; }
  body.lg-print-one .top, body.lg-print-one .side, body.lg-print-one #listMsg, body.lg-print-one #accessBanner, body.lg-print-one .view-head, body.lg-print-one .crumb, body.lg-print-one .kpis, body.lg-print-one .msg, body.lg-print-one .foot, body.lg-print-one #v-card > section:not(.lg-paper) { display: none !important; }
  body.lg-print-one .shell { display: block !important; }
  body.lg-print-one .lg-paper { border: 0 !important; padding: 0 !important; background: #fff !important; overflow: visible !important; }
  body.lg-print-all #lgPrintAll { display: block !important; }
  .noprint { display: none !important; }
  .lgs { padding: 0; zoom: 1 !important; }
  .lgs-box { display: block; }
  .lgs-t, .lgs-t td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
#v-lg .msg:empty, #v-card .msg:empty { display: none; }
.lgs-t tr:last-child td { border-bottom: 1px solid #000 !important; }
.lg-phadj { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-top: 10px; }
.lg-phadj label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.lg-phadj output { min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.perm-box { background: rgba(127,127,127,.08); border: 1px solid rgba(127,127,127,.3); border-radius: 8px; padding: 12px 14px; }
.perm-title { margin-bottom: 10px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 16px; margin-bottom: 12px; }
.perm-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }

.lg-zoombar { display: none; margin: 0 0 8px; }
.hl-act { white-space: nowrap; }
@media (max-width: 760px) {
  #v-lg .view-head, #v-card .view-head { flex-wrap: wrap; align-items: flex-start; gap: 10px; }
  #v-lg .view-head .form-btns, #v-card .view-head .form-btns, #v-card .form-btns { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; max-width: 100%; }
  #v-lg .view-head .form-btns .btn, #v-card .view-head .form-btns .btn { flex: 1 1 auto; min-width: 0; padding-left: 10px; padding-right: 10px; }
  .lg-zoombar { display: block; }
  .lg-paper { padding: 8px !important; -webkit-overflow-scrolling: touch; }
  .lg-phadj { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .lg-phadj label { display: grid; grid-template-columns: 72px 1fr 48px; align-items: center; gap: 8px; }
  .lg-phadj input[type=range] { width: 100%; min-width: 0; }
  .lg-phadj .btn { justify-self: start; }
  td.hl-act { display: flex !important; flex-wrap: wrap; gap: 8px; justify-content: flex-start !important; }
  td.hl-act .btn { width: auto !important; flex: 0 0 auto; }
  .perm-grid { grid-template-columns: 1fr; }
  .xrow { flex-wrap: wrap; }
}

/* 머리글·바닥글 편집 */
.hfbox { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line, #d9dee5); }
.hfrow { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.hfrow label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.hfrow .hfwide { flex: 1 1 260px; }
.hfrow input[type=text], .hfrow select { min-height: 38px; }
.hfgrp { margin: 10px 0; }
.hfsec { display: grid; grid-template-columns: 52px minmax(0, 1fr) 70px auto; gap: 6px; align-items: center; margin-top: 6px; }
.hfsec span { font-size: 13px; color: var(--muted, #667); }
.hfsec input[type=text], .hfsec input[type=number] { min-height: 38px; width: 100%; box-sizing: border-box; }
.hfb { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.hfpv { margin: 12px 0; border: 1px solid var(--line, #d9dee5); border-radius: 6px; padding: 8px 10px; background: #fff; color: #111; }
.hfpv-t { font-size: 11px; color: #777; margin-bottom: 4px; }
.hfpv-l { display: grid; grid-template-columns: 1fr 1fr 1fr; font-size: 12px; min-height: 18px; }
.hfpv-l span:nth-child(2) { text-align: center; } .hfpv-l span:nth-child(3) { text-align: right; }
.hfpv-b { text-align: center; padding: 14px 0; border-top: 1px dashed #ccc; border-bottom: 1px dashed #ccc; margin: 6px 0; font-size: 13px; color: #555; }
@media (max-width: 600px) { .hfsec { grid-template-columns: 44px minmax(0, 1fr) 60px; } .hfsec .hfb { grid-column: 2 / 4; } }

/* 누를 수 있는 현황 카드·그래프 막대 */
button.lg-kpi { text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%; }
button.lg-kpi:hover { border-color: var(--accent, #2b6cb0); }
button.lg-kpi.on { border-color: var(--accent, #2b6cb0); box-shadow: 0 0 0 2px var(--accent, #2b6cb0) inset; }
.lg-bar { cursor: pointer; outline: none; }
.lg-bar .hit { fill: transparent; }
.lg-bar:hover .hit, .lg-bar:focus-visible .hit { fill: rgba(43, 108, 176, .10); }
.lg-bar.on .hit { fill: rgba(43, 108, 176, .16); }
.lg-bar.on text:last-child { font-weight: 700; }

.xplace { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--line, #d9dee5); border-radius: 8px; }
.xp-h { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.xp-h .hint { flex: 1 1 auto; }
.xp-l { display: flex; flex-wrap: wrap; gap: 6px 14px; max-height: 160px; overflow: auto; }
.xp-i { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; min-height: 32px; }
.xp-i small { color: var(--muted, #667); }
