/* 서명 화면 — 모바일 우선. 문자/카카오 링크로 로그인 없이 들어온다. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--canvas); }
body {
  color: var(--text);
  font: 15px/1.6 var(--font-ui);
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

.app { max-width: 520px; margin: 0 auto; min-height: 100dvh; background: var(--paper); display: flex; flex-direction: column; }
.center { text-align: center; } .muted { color: var(--muted); }

/* 상단바: 로고 고정 + 언어전환. 피싱 의심 방지를 위해 모든 화면에 항상 보인다. */
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--paper);
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.brand { font: 800 16px var(--font-ui); letter-spacing: .02em; display: flex; align-items: center; gap: 6px; }
.brand .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--seal); }
.lang-toggle { display: flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.lang-toggle button {
  border: 0; background: var(--surface); color: var(--sub); padding: 6px 12px; font: 600 12px var(--font-ui); cursor: pointer;
}
.lang-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* 진행 단계 바 */
.stepper { display: flex; gap: 3px; padding: 10px 16px 0; }
.stepper i { flex: 1; height: 4px; border-radius: 999px; background: var(--line-strong); }
.stepper i.done { background: var(--ink); }
.stepper i.now { background: var(--seal); }
.step-label { padding: 6px 16px 0; font-size: 12px; color: var(--muted); }

.content { flex: 1; padding: 16px 16px 24px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.summary-grid .k { font-size: 12px; color: var(--muted); }
.summary-grid .v { font: 600 15px/1.3 var(--font-ui); margin-top: 2px; }
.summary-grid .v.mono { font-family: var(--font-mono); }

.doc-title { font: 800 20px var(--font-doc); margin: 4px 0 12px; }
.doc-body { white-space: pre-wrap; font-size: 14px; line-height: 1.8; color: var(--text); }
/* 긴 구분선(────)·64자 지문이 360px 에서 옆으로 넘치던 것(10/18 QA) — 계약서·날인본 글 모두 줄바꿈. 카드·본문이 내용 폭만큼 커지지 않게 min-width 0 */
.doc-body { overflow-wrap: anywhere; word-break: break-word; min-width: 0; max-width: 100%; }
.card, .content, .doc-scroll { min-width: 0; max-width: 100%; }
.seal-note { font-size: 12.5px; margin: -4px 2px 14px; }

.agreement { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; cursor: pointer; }
.agreement input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--seal); flex-shrink: 0; }
.agreement .t { font: 600 14px var(--font-ui); } .agreement .d { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

label { display: block; font-size: 13px; color: var(--sub); margin: 14px 0 6px; }
label:first-child { margin-top: 0; }
input[type=text], input[type=tel] {
  width: 100%; padding: 13px 14px; font: 16px var(--font-ui); color: var(--text);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px;
}
input[readonly] { background: var(--off-bg); color: var(--sub); }
input:focus { outline: 2px solid var(--seal); outline-offset: -1px; }

.otp-input { font: 600 26px/1 var(--font-mono); letter-spacing: .3em; text-align: center; padding: 16px; }

.btn-row { display: flex; gap: 10px; margin-top: 16px; }
button.btn {
  flex: 1; padding: 15px; font: 700 16px var(--font-ui); border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); min-height: 52px;
}
/* 만료 화면 [ILTER에 문의하기] 는 tel: 링크(a.btn) — 버튼과 같은 모양 */
a.btn {
  display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; text-decoration: none;
  padding: 15px 20px; font: 700 16px var(--font-ui); border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); min-height: 52px;
}
a.btn + a.btn { margin-top: 10px; }
a.btn.seal { background: var(--seal); border-color: var(--seal); color: #fff; }
button.btn.seal { background: var(--seal); border-color: var(--seal); color: #fff; }
button.btn:disabled { background: var(--line-strong); border-color: var(--line-strong); color: var(--muted); cursor: default; }
button.btn.text { border: 0; background: none; color: var(--sub); flex: none; padding: 10px; }

/* 하단 고정 CTA */
.bottom-cta {
  position: sticky; bottom: 0; background: var(--paper); border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.bottom-cta button.btn { width: 100%; }
.bottom-cta .hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* 서명 패드 */
.sigpad-wrap { border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--bg); }
canvas.sigpad { width: 100%; height: 180px; display: block; touch-action: none; border-radius: 12px; }
.sig-name-preview { font: 52px/1 var(--font-sign); text-align: center; padding: 40px 0; color: var(--ink); }

/* 오류/상태 화면(S02-S05) */
.state-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 24px; }
.state-screen .badge { margin-bottom: 18px; }
.state-screen h1 { font: 700 21px var(--font-ui); margin: 0 0 10px; }
.state-screen p { color: var(--sub); font-size: 14px; line-height: 1.6; margin: 0 0 24px; }
/* 상태 화면의 버튼은 세로로 늘어나지 않게(button.btn 의 flex:1 이 세로 열에서 화면 높이만큼 커지던 문제) */
.state-screen .btn { flex: none; min-width: 200px; }
.state-screen .support { margin-top: 20px; font-size: 12.5px; color: var(--muted); }

.checklist-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.checklist-item:last-child { border-bottom: 0; }
.checklist-item input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--seal); margin-top: 1px; }
.checklist-item input[type=file] { margin-top: 8px; font-size: 13px; }
/* 서류 고르기 버튼(기본 파일 버튼 대신, 10/16) — 입력은 화면에서만 숨김(display:none 이 아니라 포커스·시험 유지) */
.doc-pick { position: relative; margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: 600 14px var(--font-ui); cursor: pointer; }
.doc-pick.is-id { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.doc-pick:focus-within { outline: 2px solid var(--seal); outline-offset: 2px; }
.doc-pick-ico { font-size: 13px; line-height: 1; }
.checklist-item .doc-pick-input { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); border: 0; white-space: nowrap; opacity: 0; }

.msg { font-size: 13px; margin-top: 8px; min-height: 1.2em; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok-fg); }

.doc-upload-note { background: var(--warn-bg); color: var(--warn-fg); border-radius: 10px; padding: 12px 14px; font-size: 13px; }

/* ---- CSP(style-src 에 unsafe-inline 없음) 때문에 인라인 style 대신 쓰는 클래스(2026-10-15). 예전 인라인과 같은 우선순위가 되도록 !important ---- */
.doc-scroll { max-height: 48vh; overflow-y: auto; }
.u-mt14 { margin-top: 14px !important; }
.u-mt20 { margin-top: 20px !important; }
.u-mb12 { margin-bottom: 12px !important; }
.u-fs12 { font-size: 12px !important; }
.u-fs12-5 { font-size: 12.5px !important; }
.u-grow { flex: 1 !important; }
.u-w-full { width: 100% !important; }
.u-minh40vh { min-height: 40vh !important; }

/* 서류 단계: 서버가 빠졌다고 알려 준 줄(docs_missing) */
.checklist-item.is-missing { background: var(--err-bg); border-radius: 10px; padding: 10px; }
.docs-only-title { font: 700 18px var(--font-ui); margin: 0 0 8px; }

/* 0108 이미 서명됨 화면 안내 · 날인 계약서 보기(shared/executed-view.js, /copy/ 도 같이 씀) */
.state-screen .signed-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.state-screen .signed-note.err { color: var(--err-fg); }
.state-screen a.btn { margin-top: 12px; }
.state-screen a.btn.seal { margin-top: 0; }
.executed-view .ex-title { font: 700 21px var(--font-ui); margin: 12px 0 6px; }
.executed-view .ex-meta { margin: 0 0 4px; font-size: 13px; }
.executed-view .card { margin-top: 12px; }
.executed-view .ex-save { width: 100%; }
.executed-view .ex-hash, .executed-view .ex-note { font-size: 12px; margin: 10px 0 0; }
/* 0133 승낙서 · 도장 겹치기 · 인쇄(PDF 저장) */
.executed-view .ex-actions { display: flex; gap: 8px; margin-top: 10px; }
.executed-view .ex-actions .btn { flex: 1 1 0; min-width: 0; }
.executed-view .ex-consent { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line, #e5e5e5); }
.executed-view h2.ex-title { font-size: 19px; }
.executed-view .seal-wrap { position: relative; display: inline-block; }
.executed-view .seal-img { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; object-fit: contain; transform: translate(-50%, -50%); opacity: .92; pointer-events: none; }
@media print {
  .topbar, .ex-noprint, .executed-view .ex-actions, .executed-view .ex-hash { display: none !important; }
  body[data-print="executed"] .ex-doc[data-doc="consent"], body[data-print="consent"] .ex-doc[data-doc="executed"] { display: none !important; }
  .executed-view .ex-consent { margin: 0; padding: 0; border: 0; }
  .executed-view .card { border: 0; box-shadow: none; padding: 0; }
  .doc-body { color: #000; font-size: 12pt; }
}

/* 0143 입금 안내 카드(서명 끝·이미 서명됨 화면) — [계좌번호 복사]·[입금자명 복사]·[금액 복사] */
.state-screen .pay-guide { width: 100%; max-width: 420px; margin-top: 14px; text-align: left; box-sizing: border-box; }
.pay-guide .pay-title { margin: 0 0 8px; font: 700 15px var(--font-ui); }
.pay-guide .pay-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.pay-guide .pay-kv { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pay-guide .pay-k { font-size: 12px; color: var(--muted); }
.pay-guide .pay-v { font-size: 16px; word-break: break-all; }
.pay-guide button.btn.pay-copy { flex: none; min-height: 40px; padding: 8px 12px; font-size: 14px; }
.pay-guide button.btn.pay-copy[data-copied="ok"] { border-color: var(--ink); }
.pay-guide .pay-hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); white-space: pre-line; }
.pay-copy-ta { position: fixed; top: 0; left: 0; opacity: 0; }
