/*
 * 문서 저장소 PDF 편집기(pdf.php) 스타일 — 복합기 메일박스 mfp/assets/style.css 에서 편집기에 필요한 부분만 그대로 옮김(2026-11-02).
 * 빠진 것: 복합기 상단 바·토너·파일 목록·폴더 칸·새 창 편집기(body.pe-window). 원본 편집기 모양을 고치면 여기도 같이.
 * 이 화면 전용 틀(.pdf-*)은 맨 아래.
 */
@import url('vendor/pretendard.css');
/* PDF 편집기 글꼴(2026-11-02 사용자 요청): 기본 서울한강체 L, 고를 수 있는 글꼴은 함께 둔 무료 글꼴만(pdf-editor.js FONT_CHOICES — 서울한강체 L·M·B·EB, Pretendard).
   진하게(700)는 한 단계 굵은 파일로(문서 저장소 forms.css 와 같은 방식 — 브라우저 가짜 굵게는 너무 굵음) */
@font-face { font-family: '서울한강체 L'; src: url('../../medicine/assets/fonts/SeoulHangangL.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: '서울한강체 M'; src: url('../../medicine/assets/fonts/SeoulHangangM.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: '서울한강체 B'; src: url('../../medicine/assets/fonts/SeoulHangangB.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: '서울한강체 EB'; src: url('../../medicine/assets/fonts/SeoulHangangEB.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: '서울한강체 L'; font-weight: 700; src: url('../../medicine/assets/fonts/SeoulHangangM.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: '서울한강체 M'; font-weight: 700; src: url('../../medicine/assets/fonts/SeoulHangangB.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: '서울한강체 B'; font-weight: 700; src: url('../../medicine/assets/fonts/SeoulHangangEB.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: '서울한강체 EB'; font-weight: 700; src: url('../../medicine/assets/fonts/SeoulHangangEB.ttf') format('truetype'); font-display: swap; }
body.pdf-page {
  --bg: #eef1f6; --surface: #ffffff; --text: #1d2433; --muted: #667085; --line: #d9dee8; --head: #3f4a6b;
  --accent: #3559c7; --accent-soft: #e6ecfb; --danger: #c63c3c;
}
/* 대화 창(서명·용량 줄이기·PDF 추가 방식) — 원본 .host-dlg */
.host-dlg { width: min(380px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(20,30,60,.25); color: var(--text); }
.host-dlg::backdrop { background: rgba(20,28,48,.45); }
.host-dlg form { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.host-dlg h2 { margin: 0; font-size: 17px; }
.host-dlg p { margin: 0; color: var(--muted); font-size: 13px; }
.host-dlg label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.host-dlg input { height: 36px; padding: 0 10px; border: 1px solid #dfe3ea; border-radius: 8px; font: inherit; font-size: 15px; font-weight: 400; }
.host-dlg input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.host-dlg small { color: var(--muted); font-size: 12px; }
.host-dlg .dlg-act { display: flex; gap: 6px; margin-top: 6px; }
.host-dlg .dlg-act .sp { flex: 1; }

/* 버튼 (스플릿 버튼 디자인) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border: 1px solid #dfe3ea; border-radius: 8px;
  background: var(--surface); color: #2b2f38; font: inherit; font-size: 13px; font-weight: 500;
  white-space: nowrap; cursor: pointer; transition: background .15s;
}
.btn:hover { background: #f6f8fb; text-decoration: none; }
.btn .i { width: 15px; height: 15px; flex: none; }
.btn.sm { height: 28px; padding: 0 10px; }
.btn.sm .i { width: 14px; height: 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: #d93f3f; }
.btn.ghost { background: transparent; }

.preview-body { position: relative; flex: 1; background: #525659; }
/* PDF 편집기 (assets/pdf-editor.js): 한 페이지를 칸에 맞춰 가운데에 */
.pe-stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
.pe-page { position: relative; box-shadow: 0 2px 12px rgba(0,0,0,.35); background: #fff; }
.pe-page[hidden] { display: none; }
.pe-canvas, .pe-overlay { position: absolute; inset: 0; display: block; }
.pe-overlay { touch-action: none; cursor: crosshair; }
.pe-overlay[data-tool="select"] { cursor: default; }
.pe-overlay[data-tool="text"], .pe-overlay[data-tool="note"] { cursor: text; }
.pe-text {
  position: absolute; z-index: 2; margin: 0; padding: 0; border: 1px dashed var(--accent); border-radius: 2px;
  background: rgba(255,255,255,.9); font-family: '서울한강체 L', sans-serif; line-height: 1.25;
  resize: none; overflow: hidden; outline: none; white-space: pre;
}
.pe-text.note { background: #fff3a0; border: 1px solid #e0b400; padding: .5em; color: #222; }
.pe-text.edit { background: #fff; border: 1px solid var(--accent); box-shadow: 0 0 0 3px rgba(53, 89, 199, .18); }
.pe-overlay[data-tool="edit"] { cursor: text; }
/* 글자 모양 막대: 입력 칸이 열려 있는 동안 미리보기 칸 위쪽 가운데 */
.pe-style {
  position: absolute; top: 8px; left: 50%; z-index: 5; transform: translateX(-50%); max-width: calc(100% - 16px);
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 5px 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.pe-style-label { font-size: 12px; font-weight: 600; color: var(--head); margin-right: 2px; white-space: nowrap; }
.pe-style select { height: 26px; max-width: 170px; border: 1px solid #dfe3ea; border-radius: 6px; font: inherit; font-size: 12.5px; }
.pe-style input[type=number] { width: 54px; height: 26px; padding: 0 4px; border: 1px solid #dfe3ea; border-radius: 6px; font: inherit; font-size: 12.5px; }
.pe-style-unit { font-size: 12px; color: var(--muted); margin-left: -2px; }
.pe-style input[type=color] { width: 30px; height: 26px; padding: 1px; border: 1px solid #dfe3ea; border-radius: 6px; background: #fff; cursor: pointer; }
.pe-style .btn.sm { height: 26px; min-width: 28px; padding: 0 8px; font-size: 13px; }
.pe-style .btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pe-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: #f6f8fb; }
.pe-tools[hidden] { display: none; }
.pe-tools .btn.sm { height: 26px; padding: 0 8px; font-size: 12.5px; }
.pe-tools .btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pe-tools .btn:disabled { opacity: .45; cursor: default; }
.pe-tools.busy { pointer-events: none; opacity: .7; }
.pe-sep { width: 1px; height: 18px; margin: 0 2px; background: var(--line); }
.pe-size { height: 26px; border: 1px solid #dfe3ea; border-radius: 6px; font: inherit; font-size: 12.5px; }
.pe-color { width: 30px; height: 26px; padding: 1px; border: 1px solid #dfe3ea; border-radius: 6px; background: #fff; cursor: pointer; }
.pe-status {
  position: absolute; left: 50%; bottom: 10px; z-index: 4; transform: translateX(-50%); max-width: calc(100% - 24px);
  padding: 6px 14px; border-radius: 999px; background: rgba(20, 28, 48, .85); color: #fff; font-size: 12.5px;
  text-align: center; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.pe-status:empty { display: none; }
/* 페이지 정리 판 */
.pe-pages { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; background: #3b3f44; }
.pe-pages[hidden] { display: none; }
.pe-pages-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 10px; background: #f6f8fb; border-bottom: 1px solid var(--line); }
.pe-pages-head .pe-pick { margin-right: auto; color: var(--muted); font-size: 12px; }
/* 열 수·그림 높이는 pdf-editor.js thumbLayout 이 정함(3쪽까지는 크게, 많을수록 작게) */
.pe-thumbs { flex: 1; min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 12px; align-content: start; justify-content: center; }
.pe-thumb { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border-radius: 8px; background: #fff; cursor: grab; }
.pe-thumb.dragging { opacity: .45; }
/* 끌어다 놓을 자리: 카드 앞(왼쪽)·뒤(오른쪽)에 파란 막대 */
.pe-thumb.drop-before::before, .pe-thumb.drop-after::after { content: ''; position: absolute; top: 4px; bottom: 4px; width: 4px; border-radius: 2px; background: var(--accent); }
.pe-thumb.drop-before::before { left: -9px; }
.pe-thumb.drop-after::after { right: -9px; }
.pe-thumb.cur { box-shadow: 0 0 0 3px var(--accent); }
.pe-thumb canvas { width: auto; border: 1px solid var(--line); cursor: pointer; }
.pe-thumb-row { display: flex; align-items: center; gap: 2px; font-size: 12px; }
.pe-thumb-row label { display: inline-flex; align-items: center; gap: 2px; margin-right: 4px; font-weight: 600; cursor: pointer; }
.pe-thumb-row button { width: 22px; height: 22px; padding: 0; border: 1px solid #dfe3ea; border-radius: 5px; background: #fff; font-size: 11px; cursor: pointer; }
.pe-thumb-row button:hover { background: var(--accent-soft); }
/* 서명 창 · 인쇄용 숨은 틀 */
.pe-sign { width: min(660px, calc(100vw - 32px)); }
.pe-sign-body { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.pe-sign-body h2 { margin: 0; font-size: 17px; }
.pe-sign-body p { margin: 0; color: var(--muted); font-size: 13px; }
.pe-sign-pad { width: 100%; height: auto; aspect-ratio: 600 / 220; border: 1px dashed #b8c0d4; border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; }
.pe-sign .dlg-act { display: flex; align-items: center; gap: 6px; }
.pe-sign .dlg-act .sp { flex: 1; }
.pe-sign input[type=color] { width: 36px; height: 30px; padding: 1px; border: 1px solid #dfe3ea; border-radius: 6px; }
/* PDF 를 끌어다 놓는 중 */
.preview-body.pe-drop { outline: 3px dashed #8fb0ff; outline-offset: -10px; }
.preview-body.pe-drop .preview-empty { color: #fff; }
/* 용량 줄이기 창 */
.pe-shrink { width: min(480px, calc(100vw - 32px)); }
.pe-dlg-body { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.pe-dlg-body h2 { margin: 0; font-size: 17px; }
.pe-dlg-body > p { margin: 0; color: var(--muted); font-size: 13px; }
.pe-opt { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.pe-opt:hover { background: #f6f8fb; }
.pe-opt input { margin-top: 3px; flex: none; }
.pe-opt b { display: block; font-size: 13.5px; }
.pe-opt small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.pe-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
/* 주소 변경 창(.host-dlg)의 label·input 모양이 덮어쓰지 않게 */
.host-dlg .pe-opt { flex-direction: row; font-weight: 400; }
.host-dlg .pe-opt input { width: auto; height: auto; padding: 0; border: 0; }
.pe-opt-group { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; }
.pe-opt-group legend { margin-bottom: 6px; padding: 0; font-size: 13px; font-weight: 700; color: var(--head); }
.pe-dlg-body .pe-note { padding: 8px 10px; border-radius: 8px; background: #f3f5f9; color: #4a5571; font-size: 12px; line-height: 1.5; }
/* 현재 → 예상 크기 막대그래프 */
.pe-viz { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 10px; background: #f3f5f9; }
.pe-viz-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 12.5px; }
.pe-viz-label { color: #4a5571; font-weight: 600; }
.pe-viz-bar { height: 14px; border-radius: 7px; background: #e3e7ef; overflow: hidden; }
.pe-viz-bar i { display: block; height: 100%; border-radius: 7px; transition: width .35s ease; }
.pe-viz-now .pe-viz-bar i { width: 100%; background: #9aa4ba; }
.pe-viz-after .pe-viz-bar i { width: 0; background: var(--accent); }
.pe-viz-val { min-width: 64px; text-align: right; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pe-viz-after .pe-viz-val { color: var(--accent); }
.pe-viz.busy .pe-viz-after .pe-viz-val { color: var(--muted); font-weight: 400; }
.pe-viz-note { font-size: 12px; color: #9a5b00; }
.pe-viz-note:empty { display: none; }
.pe-opt-est { margin-left: 6px; font-style: normal; font-weight: 600; color: var(--accent); font-size: 12px; }
/* PDF 추가 방식 선택 창 */
.pe-add { width: min(440px, calc(100vw - 32px)); }
.pe-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.pe-choice:hover, .pe-choice:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.pe-choice.rec { border-color: #b9c7ef; }
.pe-choice b { font-size: 14px; }
.pe-choice small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.pe-choice-warn { color: var(--danger); font-size: 12px; font-weight: 600; }
.pe-choice-warn:empty { display: none; }
.pe-add .dlg-act { display: flex; align-items: center; gap: 6px; }
.pe-add .dlg-act .sp { flex: 1; }
.pe-shrink .dlg-act { display: flex; align-items: center; gap: 6px; }
.pe-shrink .dlg-act .sp { flex: 1; }
/* 글자 모양 창(pdf-editor.js buildCharDialog — 글자 표시 오른쪽 단추 · Alt+L) */
.pe-cs { width: min(620px, calc(100vw - 32px)); }
.pe-cs-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.pe-cs .pe-cs-f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--head); }
.pe-cs-in { display: inline-flex; align-items: center; gap: 4px; }
.pe-cs .pe-cs-f input[type=number] { width: 84px; height: 30px; padding: 0 6px; border: 1px solid #dfe3ea; border-radius: 6px; font: inherit; font-size: 13px; font-weight: 400; }
.pe-cs .pe-cs-f select { height: 30px; padding: 0 6px; border: 1px solid #dfe3ea; border-radius: 6px; font: inherit; font-size: 13px; font-weight: 400; }
.pe-cs .pe-cs-font select { min-width: 200px; }
.pe-cs .pe-cs-f small { color: var(--muted); font-size: 12px; font-weight: 400; }
.pe-cs .pe-cs-f input[type=color] { width: 44px; height: 30px; padding: 1px; border: 1px solid #dfe3ea; border-radius: 6px; background: #fff; cursor: pointer; }
.pe-cs .pe-cs-f input[type=checkbox] { width: 16px; height: 16px; padding: 0; margin: 0; }
.pe-cs-attrs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.pe-cs-attrs legend { padding: 0 4px; font-size: 12.5px; font-weight: 700; color: var(--head); }
.pe-cs-attrs .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.pe-cs-preview { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.pe-cs .dlg-act { display: flex; align-items: center; gap: 6px; }
.pe-cs .dlg-act .sp { flex: 1; }
.pe-print { position: fixed; width: 0; height: 0; border: 0; visibility: hidden; }
.preview-loading, .preview-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-align: center; }
.preview-loading { z-index: 1; padding: 16px; background: rgba(82, 86, 89, .6); }
.preview-empty { color: #c9ccd1; line-height: 1.8; }
.preview-loading[hidden], .preview-empty[hidden] { display: none; }
.pv-nav { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pv-nav[hidden] { display: none; }
.pv-nav .btn { width: 28px; padding: 0; font-size: 11px; }
.pv-nav .btn:disabled { opacity: .4; cursor: default; }

/* ---------- 이 화면 틀: 맨 위 공통 메뉴 · 제목·저장 줄 · 편집 도구 줄 · 편집 칸(남은 높이 전부) ---------- */
html, body.pdf-page { height: 100%; }
body.pdf-page { margin: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); color: var(--text);
  font: 14px/1.5 Pretendard, "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif; letter-spacing: -0.01em; }
body.pdf-page *, body.pdf-page *::before, body.pdf-page *::after { box-sizing: border-box; }
body.pdf-page > .gnav, .pdf-bar, body.pdf-page .pe-tools { flex: none; }
.pdf-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.pdf-back { color: var(--accent); font-weight: 700; text-decoration: none; white-space: nowrap; }
.pdf-back:hover { text-decoration: underline; }
.pdf-bar h1 { margin: 0; font-size: 17px; white-space: nowrap; }
.pdf-titlewrap { display: inline-flex; align-items: center; gap: 6px; flex: 1 1 260px; min-width: 180px; max-width: 520px; font-weight: 700; font-size: 13px; }
.pdf-titlewrap input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid #dfe3ea; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 400; }
.pdf-titlewrap input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.pdf-saved { font-size: 12.5px; color: var(--muted); }
.pdf-saved.err { color: var(--danger); font-weight: 700; }
body.pdf-page .pv-nav { margin-left: auto; }
body.pdf-page .preview-body { flex: 1; min-height: 0; }
body.pdf-page .pe-tools .btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
@media (max-width: 760px) { .pdf-bar { padding: 8px 12px; } .pdf-titlewrap { flex-basis: 100%; max-width: none; } }
@media print { .pdf-bar, body.pdf-page .pe-tools { display: none; } }
