/* 라벨메이커 — ergo-C 표준: 크림 배경 + 테라코타, Pretendard, 번호·구분선 중심의 절제된 레이아웃 */
@font-face {
  font-family: "Pretendard Variable";
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url("../vendor/fonts/PretendardVariable.woff2") format("woff2-variations");
}
:root {
  --bg: #FAF6F0; --paper: #FFFDF9; --ink: #2A2420; --ink2: #6B6058; --ink3: #9A8F85;
  --line: #E6DDD0; --line2: #D8CCBB; --accent: #C9512B; --accent-d: #A84020; --accent-bg: #F7E7DF;
  --warn: #B26A00; --warn-bg: #FBF0D9; --ok: #2F7D4F; --ok-bg: #E6F2E9; --err: #B3261E; --err-bg: #FBE9E7;
  --r: 10px; --bar: 60px;
  --font: "Pretendard Variable", Pretendard, "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--font); letter-spacing: -0.01em; word-break: keep-all; overflow-wrap: anywhere; }
h1, h2, h3, p, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
[hidden] { display: none !important; }
em { font-style: normal; color: var(--accent); }

/* ---------- 상단 ---------- */
.top { position: sticky; top: 0; z-index: 20; height: var(--bar); display: flex; align-items: center; gap: 20px; padding: 0 20px;
  background: rgba(250, 246, 240, .94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; flex: none; }
.brand-mark { width: 22px; height: 22px; transform: rotate(45deg); border: 3px solid var(--accent); background: #fff; border-radius: 3px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 16px; font-weight: 800; }
.brand-text small { font-size: 11px; color: var(--ink2); }
.steps { display: flex; gap: 4px; margin: 0 auto; }
.steps li { display: flex; align-items: center; gap: 7px; padding: 6px 12px; font-size: 13.5px; color: var(--ink3); border-radius: 99px; white-space: nowrap; }
.steps li span { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; }
.steps li.on { color: var(--accent); font-weight: 700; background: var(--accent-bg); }
.steps li.on span { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps li.done { color: var(--ink2); }
.local-badge { flex: none; font-size: 12px; color: var(--ok); border: 1px solid #BFD9C8; background: var(--ok-bg); padding: 3px 10px; border-radius: 99px; cursor: help; }

/* ---------- 버튼 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 8px;
  border: 1px solid var(--line2); background: var(--paper); cursor: pointer; font-weight: 600; font-size: 14.5px; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { border-color: var(--ink3); }
.btn:focus-visible, .drop:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); }
.btn.ghost { background: transparent; }
.btn.small { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.big { height: 52px; font-size: 16px; width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }

/* ---------- 1. 불러오기 ---------- */
.wrap { max-width: 980px; margin: 0 auto; padding: 44px 20px 60px; }
.lead { font-size: clamp(24px, 4vw, 34px); font-weight: 800; line-height: 1.3; letter-spacing: -0.03em; }
.sub { margin-top: 10px; color: var(--ink2); max-width: 46em; }
.start { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; margin-top: 28px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 190px; padding: 24px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line2); border-radius: 14px; background: var(--paper); transition: border-color .12s, background .12s; }
.drop:hover, .drop.over { border-color: var(--accent); background: #FFF8F3; }
.drop b { font-size: 17px; }
.drop span { color: var(--ink2); font-size: 13.5px; }
.drop-icon { width: 34px; height: 42px; border: 2px solid var(--accent); border-radius: 4px; position: relative; margin-bottom: 6px; }
.drop-icon::after { content: "PDF"; position: absolute; left: -7px; bottom: 6px; background: var(--accent); color: #fff; font-size: 9px; font-weight: 800; padding: 1px 4px; border-radius: 2px; letter-spacing: .03em; }
.alt { display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 4px 0; }
.alt p { color: var(--ink2); font-size: 13.5px; }
.progress { margin-top: 16px; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--paper); font-size: 14px; }
.list-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 52px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.list-head h2 { font-size: 18px; font-weight: 800; }
.count { color: var(--ink3); font-weight: 500; font-size: 14px; margin-left: 4px; }
.list-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.mlist > li { display: grid; grid-template-columns: 24px 34px 1fr auto; gap: 12px; align-items: center; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.mlist .no { color: var(--ink3); font-variant-numeric: tabular-nums; font-size: 13px; }
.mlist .ttl { font-weight: 700; font-size: 15.5px; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.mlist .ttl:hover { color: var(--accent); }
.mlist .meta { color: var(--ink2); font-size: 13px; display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; align-items: center; }
.mlist .picts { display: inline-flex; gap: 2px; vertical-align: middle; }
.mlist .picts img { width: 22px; height: 22px; }
.mlist .acts { display: flex; gap: 4px; }
.mlist .empty { display: block; padding: 34px 0; color: var(--ink3); text-align: center; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 4px; border: 1px solid var(--line2); color: var(--ink2); background: var(--paper); white-space: nowrap; }
.tag.danger { background: #2A2420; color: #fff; border-color: #2A2420; }
.tag.todo { color: var(--warn); border-color: #E8CF9B; background: var(--warn-bg); }
.tag.ok { color: var(--ok); border-color: #BFD9C8; background: var(--ok-bg); }
.hint { margin-top: 14px; color: var(--ink3); font-size: 13px; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; flex: none; }

/* ---------- 2·3. 좌우 분할 ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: calc(100vh - var(--bar)); height: calc(100dvh - var(--bar)); }
.split-label { grid-template-columns: minmax(340px, 460px) minmax(0, 1fr); }
.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.pane-src, .pane-preview { background: #EFE8DC; border-right: 1px solid var(--line); }
.pane-preview { border-right: 0; border-left: 1px solid var(--line); }
.pane-bar { flex: none; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line2); font-size: 14px; background: rgba(255, 253, 249, .6); }
.pane-note { color: var(--ink2); font-size: 12.5px; margin-left: auto; text-align: right; }
.src-body { flex: 1; overflow: auto; padding: 14px; scroll-behavior: smooth; }
.form-scroll { flex: 1; overflow: auto; padding: 22px 26px 30px; }
.actbar { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-top: 1px solid var(--line2); background: var(--paper); }
.actbar .confirm { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; }
.actbar .btn.primary { min-width: 140px; }

/* PDF 쪽 */
.pg { position: relative; margin: 0 auto 14px; background: #fff; box-shadow: 0 1px 4px rgba(60, 40, 20, .18); }
.pg canvas { display: block; width: 100%; height: 100%; }
.pg .pno { position: absolute; top: 6px; right: 8px; font-size: 11px; color: var(--ink3); background: rgba(255, 255, 255, .85); padding: 0 6px; border-radius: 3px; }
.hl { position: absolute; background: rgba(201, 81, 43, .13); border-bottom: 1.5px solid rgba(201, 81, 43, .55); cursor: pointer; border-radius: 2px; }
.hl.on { background: rgba(255, 196, 0, .42); border: 2px solid var(--accent); animation: pulse 1s ease 2; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(201, 81, 43, .22); } }
.src-empty { padding: 30px 16px; color: var(--ink2); text-align: center; }

/* 번호 섹션 */
.sec { padding: 20px 0; border-bottom: 1px solid var(--line); }
.sec:first-child { padding-top: 0; }
.sec:last-child { border-bottom: 0; }
.sec > h3 { display: flex; align-items: baseline; gap: 10px; font-size: 16px; font-weight: 800; margin-bottom: 12px; }
.sec > h3 .n { color: var(--accent); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 800; min-width: 18px; }
.sec > h3 small { font-weight: 500; color: var(--ink3); font-size: 12.5px; }
.sec > h3 .right { margin-left: auto; font-weight: 500; }
.field { display: grid; grid-template-columns: 92px 1fr; gap: 6px 10px; align-items: center; margin-bottom: 8px; }
.field > label { color: var(--ink2); font-size: 13.5px; }
input[type=text], input[type=number], input[type=date], select, textarea { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 7px; background: #fff; }
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
input.need { border-color: var(--warn); background: #FFFBF2; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.tight > * { flex: 1; min-width: 0; }
.unit { color: var(--ink2); font-size: 13.5px; flex: none !important; }

/* 점검 결과 */
.notes li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 8px 0; font-size: 14px; border-top: 1px dashed var(--line); }
.notes li:first-child { border-top: 0; }
.notes .ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; margin-top: 2px; }
.notes .warn .ic { background: var(--warn); } .notes .error .ic { background: var(--err); } .notes .info .ic { background: var(--ink3); } .notes .ok .ic { background: var(--ok); }
.notes .art { color: var(--ink3); font-size: 12px; margin-left: 4px; white-space: nowrap; }
.notes button.link { font-size: 12.5px; margin-left: 6px; }

/* 요약(그림문자·신호어) */
.summary { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.summary .picts { display: flex; gap: 6px; }
.summary .picts figure { margin: 0; text-align: center; font-size: 11px; color: var(--ink2); }
.summary .picts img { width: 60px; height: 60px; display: block; }
.summary .picts .off img { opacity: .22; filter: grayscale(1); }
.summary .picts .off figcaption { text-decoration: line-through; }
.signal { font-size: 30px; font-weight: 900; letter-spacing: .08em; padding: 2px 16px; border: 3px solid var(--ink); border-radius: 6px; background: #fff; }
.signal.none { font-size: 14px; font-weight: 600; letter-spacing: 0; border: 1px dashed var(--line2); color: var(--ink3); padding: 8px 12px; }

/* 코드 목록 */
.codes > li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 9px 0; border-top: 1px solid var(--line); }
.codes > li:first-child { border-top: 0; }
.codes .code { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 13.5px; min-width: 46px; padding-top: 1px; }
.codes .txt { font-size: 14.5px; min-width: 0; }
.codes .msds { display: block; color: var(--ink3); font-size: 12.5px; margin-top: 2px; }
.codes .tools { display: flex; gap: 4px; align-items: center; }
.codes .grp { display: block; grid-template-columns: none; padding: 12px 0 2px; font-size: 12.5px; font-weight: 800; color: var(--accent); border-top: 1px solid var(--line); }
.codes li.low { background: linear-gradient(90deg, var(--warn-bg), transparent 70%); }
.codes textarea { font-size: 14px; }
.chip { font-size: 11.5px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line2); background: var(--paper); color: var(--ink2); cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.warn { color: var(--warn); border-color: #E8CF9B; background: var(--warn-bg); cursor: default; }
.x { width: 26px; height: 26px; border-radius: 6px; border: 0; background: transparent; color: var(--ink3); cursor: pointer; font-size: 16px; line-height: 1; }
.x:hover { background: var(--err-bg); color: var(--err); }
.pick select { height: 32px; font-size: 13px; margin-top: 5px; border-color: var(--warn); }
.dim { color: var(--ink3); }

/* 코드 고르기 */
.picker-search { position: sticky; top: 0; background: var(--paper); padding-bottom: 8px; z-index: 1; }
.pane-src .picker-search { top: -14px; padding-top: 14px; margin-top: -14px; }
.picker h4 { font-size: 12.5px; color: var(--accent); margin: 14px 0 2px; font-weight: 800; }
.picker label { display: grid; grid-template-columns: 18px 50px 1fr auto; gap: 8px; align-items: center; padding: 7px 4px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.picker label:hover { background: #FFF8F3; }
.picker label b { font-variant-numeric: tabular-nums; font-size: 13.5px; }
.picker label img { width: 22px; height: 22px; vertical-align: middle; }
.picker .sig { font-size: 11.5px; color: var(--ink2); margin-left: 4px; }
.pane-src .picker { background: var(--paper); padding: 14px 18px; border-radius: var(--r); min-height: 100%; }

/* 3. 표지 설정 */
.opt { display: flex; gap: 9px; align-items: flex-start; padding: 7px 0; font-size: 14.5px; cursor: pointer; }
.opt input { margin-top: 3px; }
.opt small { display: block; color: var(--ink3); font-size: 12.5px; line-height: 1.45; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; background: #fff; }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.seg button { height: 38px; border: 0; background: none; cursor: pointer; font-size: 13.5px; border-left: 1px solid var(--line2); padding: 0 4px; }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--accent); color: #fff; font-weight: 700; }
.lawbox { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--line2); background: var(--paper); font-size: 13px; color: var(--ink2); }
.lawbox b { color: var(--ink); }
.lawbox.ok { border-color: var(--ok); } .lawbox.bad { border-color: var(--err); background: var(--err-bg); color: var(--err); }
.sugs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.sugs .chip { font-size: 12.5px; padding: 3px 10px; }
.psel { margin: 4px 0 4px 26px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 4px 10px; max-height: 260px; overflow: auto; }
.psel label { display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 5px 0; font-size: 13.5px; cursor: pointer; border-top: 1px dashed var(--line); }
.psel label:first-of-type { border-top: 0; }
.psel .g { font-size: 11.5px; font-weight: 800; color: var(--accent); padding-top: 6px; }
.check li { display: grid; grid-template-columns: 22px 1fr; gap: 6px; padding: 5px 0; font-size: 14.5px; }
.check .m { font-weight: 800; }
.check .y .m { color: var(--ok); } .check .n .m { color: var(--err); } .check .na .m { color: var(--ink3); }
.check small { color: var(--ink3); margin-left: 6px; }
.out { display: grid; gap: 8px; }
.out .row { flex-wrap: nowrap; }
.out select { width: auto; }
.out input[type=number] { width: 74px; }
.gate { padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-size: 13.5px; }

.pv-body { flex: 1; min-height: 0; display: grid; place-items: center; padding: 26px; overflow: auto; }
.pv-body canvas { box-shadow: 0 4px 22px rgba(60, 40, 20, .22); background: #fff; max-width: none; }
.pv-warn { flex: none; padding: 0 20px 14px; font-size: 13.5px; }
.pv-warn p { padding: 7px 12px; border-radius: 7px; margin-top: 6px; }
.pv-warn .error { background: var(--err-bg); color: var(--err); } .pv-warn .warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- 하단·대화상자 ---------- */
.foot { border-top: 1px solid var(--line); padding: 22px 20px 34px; color: var(--ink3); font-size: 12.5px; text-align: center; display: grid; gap: 5px; }
.foot .disclaimer { color: var(--ink2); font-size: 13.5px; max-width: 60em; margin: 0 auto 4px; }
body.working .foot { display: none; }
.dlg { border: 0; border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 28px)); max-height: min(86vh, 800px); background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(40, 25, 10, .35); }
.dlg::backdrop { background: rgba(42, 36, 32, .45); }
.dlg-in { display: flex; flex-direction: column; max-height: min(86vh, 800px); }
.dlg-head { display: flex; align-items: center; padding: 16px 20px 10px; }
.dlg-head b { font-size: 17px; }
.dlg-head .x { margin-left: auto; }
.dlg-main { overflow: auto; padding: 0 20px 12px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.toast { pointer-events: none; position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); max-width: calc(100vw - 30px); }

/* ---------- 모바일 ---------- */
.mtabs { display: none; }
@media (max-width: 860px) {
  .top { gap: 10px; padding: 0 12px; }
  .brand-text small, .local-badge { display: none; }
  .steps li { padding: 5px 8px; font-size: 0; gap: 0; }
  .steps li.on { font-size: 13px; gap: 6px; }
  .start { grid-template-columns: 1fr; }
  .wrap { padding: 28px 16px 44px; }
  .mlist > li { grid-template-columns: 22px 1fr; }
  .mlist .no { display: none; }
  .mlist .acts { grid-column: 2; }
  .split, .split-label { grid-template-columns: 1fr; height: auto; }
  .pane-src { height: 46vh; border-right: 0; border-bottom: 1px solid var(--line2); }
  .pane-src.collapsed { height: 44px; }
  .pane-src.collapsed .src-body { display: none; }
  .pane-preview { order: -1; position: sticky; top: var(--bar); z-index: 5; height: 42vh; border-left: 0; border-bottom: 1px solid var(--line2); }
  .pane-form .form-scroll { overflow: visible; padding: 18px 16px 24px; }
  .actbar { position: sticky; bottom: 0; flex-wrap: wrap; padding: 10px 12px; }
  .actbar .confirm { order: -1; width: 100%; margin: 0 0 4px; }
  .actbar .btn.primary { flex: 1; }
  .field { grid-template-columns: 1fr; gap: 3px; }
  .mtabs { display: inline-flex; margin-left: auto; }
  .pane-note { display: none; }
  .pv-body { padding: 14px; }
}
@media print { .top, .foot, .actbar { display: none; } }

.dim-in { display: grid; gap: 2px; font-size: 12.5px; color: var(--ink2); }

/* 무료 버전: 여러 건 한꺼번에 출력 숨김 */
body.no-batch #btn-batch { display: none; }
body.no-batch .mlist .sel { visibility: hidden; }
