/* 편집·서명, 한글 보기, 워드→한글 화면 */

/* ---------- 탭이 많아져서 줄바꿈 ---------- */
.tabs { flex-wrap: wrap; justify-content: center; max-width: 100%; }
.tab { padding: 8px 18px; white-space: nowrap; }
.tab.active[data-mode="edit"] { background: var(--c5); color: var(--c5-on); }
.tab.active[data-mode="hwp"] { background: var(--c3); color: var(--c3-on); }
.tab.active[data-mode="docx"] { background: var(--c2); color: var(--c2-on); }
.tool-head { align-items: flex-start; }
@media (max-width: 720px) {
  .tool-head { flex-direction: column; align-items: stretch; }
  .tabs { border-radius: 24px; }
  .tab { padding: 8px 12px; font-size: 15px; flex: 1 1 auto; }
}
.cta .btn.lg { padding: 13px 22px; font-size: 17px; }

/* ---------- 편집 도구 막대 ---------- */
.editor .toolbar {
  position: sticky; top: 72px; z-index: 20;
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  padding: 8px; box-shadow: 0 4px 0 var(--sticker);
}
.tool-group { display: flex; gap: 4px; flex-wrap: wrap; }
.etool {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 56px; padding: 6px 8px; border: 0; border-radius: 14px; background: transparent;
  color: var(--text); font-family: var(--font-cute, inherit); font-size: 13px;
}
.etool svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.etool:hover { background: var(--soft); }
.etool.active { background: var(--c5-soft); color: var(--c5-text); box-shadow: inset 0 0 0 2px var(--c5); }
.etool.sign { color: var(--c1-text); }
.etool.sign:hover { background: var(--c1-soft); }
@media (max-width: 640px) {
  .editor .toolbar { top: 64px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tool-group { flex-wrap: nowrap; }
  .etool { min-width: 50px; padding: 6px 4px; font-size: 12px; }
}

.props { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 12px 4px 4px; transition: opacity .2s; }
.props.dim { opacity: .45; }
.swatches { display: inline-flex; gap: 8px; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--card); background: var(--sw); box-shadow: 0 0 0 1px var(--line); padding: 0; transition: transform .15s; }
.sw:hover { transform: scale(1.1); }
.sw.active { box-shadow: 0 0 0 2px var(--text); }
.swatches.small .sw { width: 24px; height: 24px; }
.size-field, .font-field { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.size-field input { width: 140px; accent-color: var(--c5); }
.font-field select { font: inherit; color: var(--text); background: var(--bg); border: 2px solid var(--line); border-radius: 12px; padding: 4px 10px; }
.edit-hint { margin: 6px 4px 14px; font-size: 13px; color: var(--text-2); min-height: 1.2em; }

/* ---------- 편집 페이지 ---------- */
.edit-pages { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 8px 0 4px; }
.ed-page { position: relative; background: #fff; border-radius: 6px; box-shadow: 0 4px 0 var(--sticker), 0 0 0 1px var(--line); overflow: hidden; max-width: 100%; }
.ed-page:not(.ready)::before { content: ""; position: absolute; left: 50%; top: 80px; width: 28px; height: 28px; margin-left: -14px; border: 3px solid var(--soft-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.ed-pdf, .ed-ov { position: absolute; inset: 0; width: 100%; height: 100%; }
.ed-ov { touch-action: pan-y pinch-zoom; }
.ed-no { position: absolute; right: 10px; bottom: 8px; font-size: 12px; background: rgba(0, 0, 0, .55); color: #fff; border-radius: 999px; padding: 2px 10px; pointer-events: none; }
.ed-text {
  position: absolute; z-index: 5; margin: 0; padding: 0 2px; border: 2px dashed #8b5cf6; border-radius: 4px;
  background: rgba(255, 255, 255, .85); resize: none; overflow: hidden; outline: none; white-space: pre; min-width: 2em;
}

/* ---------- 서명 창 ---------- */
.sign-dialog { border: 0; padding: 0; border-radius: 28px; background: var(--card); color: var(--text); width: min(600px, calc(100vw - 32px)); box-shadow: 0 8px 0 var(--sticker), 0 30px 60px rgba(0, 0, 0, .25); }
.sign-dialog::backdrop { background: var(--overlay); }
.sign-box { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.sign-head { display: flex; justify-content: space-between; align-items: center; }
.sign-head h2 { margin: 0; font-size: 22px; }
.sign-tabs { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 999px; }
.sign-tab { flex: 1; border: 0; background: transparent; border-radius: 999px; padding: 8px 10px; font-family: var(--font-cute, inherit); font-size: 15px; color: var(--accent-text); }
.sign-tab.active { background: var(--c1); color: var(--c1-on); }
.sign-pad { width: 100%; aspect-ratio: 1040 / 400; background: #fffdfa; border: 2px solid var(--line); border-radius: 18px; touch-action: none; cursor: crosshair; display: block; }
.sign-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.sign-name { width: 100%; font: inherit; font-size: 20px; color: var(--text); background: var(--bg); border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; outline: none; }
.sign-name:focus { border-color: var(--c1); }
.sign-fonts { display: grid; gap: 8px; margin-top: 10px; }
.sign-font { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fffdfa; border: 2px solid var(--line); border-radius: 16px; padding: 6px 16px; text-align: left; }
.sign-font.active { border-color: var(--c1); }
.sf-sample { font-size: 34px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sign-font small { color: #8a6d5e; font-size: 12px; flex-shrink: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 10px; }
.sign-preview { margin-top: 10px; min-height: 90px; display: flex; align-items: center; justify-content: center; border-radius: 16px; background-color: #fff; background-image: linear-gradient(45deg, #f2ece6 25%, transparent 25%, transparent 75%, #f2ece6 75%), linear-gradient(45deg, #f2ece6 25%, transparent 25%, transparent 75%, #f2ece6 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.sign-preview img { max-width: 100%; max-height: 160px; }
.sign-preview img:not([src]), .sign-preview img[src=""] { display: none; }
.sign-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- 안내 문구 ---------- */
.notice { font-size: 13px; color: var(--c4-text); background: var(--c4-soft); border-radius: 14px; padding: 10px 14px; margin: 0 0 14px; }
.notice:empty { display: none; }
.notice.warn { color: var(--c2-text); background: var(--c2-soft); }

/* ---------- 한글 문서 보기 ---------- */
.hwp-view { background: #e9e4df; border-radius: 18px; padding: 20px 12px; max-height: 80vh; overflow: auto; }
.hwp-view:empty { display: none; }
.hwp-paper {
  background: #fff; color: #000; margin: 0 auto 20px; box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
  font-family: "함초롬바탕", "HCR Batang", "Batang", "바탕", "Noto Serif KR", serif;
  font-size: 10pt; line-height: 1.6; word-break: keep-all; overflow-wrap: break-word; max-width: 100%;
  -webkit-font-smoothing: auto;
}
.hwp-paper p { margin: 0; min-height: 1em; white-space: pre-wrap; }
.hwp-paper table { border-collapse: collapse; margin: 4px 0; max-width: 100%; }
.hwp-paper td { vertical-align: middle; padding: 2px 5px; }
.hwp-paper img { max-width: 100%; height: auto; }
.hwp-paper .pb { border-top: 1px dashed #c8c0b8; margin: 18px -40px; position: relative; }
.hwp-paper .pb::after { content: "쪽 나눔"; position: absolute; right: 44px; top: -10px; font: 11px sans-serif; color: #a89c90; background: #fff; padding: 0 6px; }
.hwp-native { height: 80vh; border-radius: 18px; overflow: hidden; }
.hwp-view:has(.hwp-native) { padding: 0; max-height: none; overflow: visible; background: transparent; }
@media (max-width: 640px) {
  .hwp-view { padding: 10px 4px; }
}

/* 인쇄할 때는 문서만 */
@media print {
  body.printing-hwp > *:not(main), body.printing-hwp main > *:not(#tool), body.printing-hwp #tool > *:not(#panel-hwp),
  body.printing-hwp #panel-hwp > *:not(#hwp-area), body.printing-hwp #hwp-area > *:not(#hwp-view) { display: none !important; }
  body.printing-hwp { background: #fff !important; }
  body.printing-hwp .card-area, body.printing-hwp .hwp-view { border: 0; box-shadow: none; padding: 0; background: #fff; max-height: none; overflow: visible; }
  body.printing-hwp .hwp-paper { box-shadow: none; margin: 0; padding: 0 !important; width: auto !important; min-height: 0 !important; }
  body.printing-hwp .hwp-paper .pb { break-after: page; border: 0; margin: 0; }
  body.printing-hwp .hwp-paper .pb::after { display: none; }
}

/* ---------- 워드 → 한글 ---------- */
.stat-list { list-style: none; padding: 0; margin: 0 0 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.stat-list li { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 14px; }
.stat-list b { font-family: var(--font-cute, inherit); font-weight: 400; color: var(--c2-text); }
.actions.top { margin: 0 0 18px; padding: 0 0 16px; border-top: 0; border-bottom: 1px solid var(--line); }
.preview-label { font-family: var(--font-cute, inherit); margin: 0 0 8px; color: var(--text-2); }

/* ---------- 가이드 카드 색 (3~5번째) ---------- */
.guide-card:nth-child(3) { --k: var(--c5); --ks: var(--c5-soft); --kt: var(--c5-text); --ko: var(--c5-on); }
.guide-card:nth-child(4) { --k: var(--c3); --ks: var(--c3-soft); --kt: var(--c3-text); --ko: var(--c3-on); }
.guide-card:nth-child(5) { --k: var(--c2); --ks: var(--c2-soft); --kt: var(--c2-text); --ko: var(--c2-on); }
.guide-card:nth-child(3) .g-steps li, .guide-card:nth-child(4) .g-steps li, .guide-card:nth-child(5) .g-steps li { --k: inherit; }
