/* ==========================================================
   와우오더 전자계약 — 고객 화면 스타일 (my.woworder.kr)
   · 디자인은 기능이 확정된 뒤 입힌다. 지금은 깔끔한 기본: 시스템 글꼴 · 회색 선 · 파랑 버튼
   · 휴대폰(카카오톡 안 브라우저) 우선. 누르는 것은 높이 48px 이상,
     입력칸 글자는 16px 이상(아이폰이 확대하지 않게)
   · 순수 검정 금지(#171717). 인라인 style 속성 금지(CSP) — 칸 위치 · 글자 크기 숫자는 JS 가 el.style 로
   ========================================================== */

:root {
  --ink: #171717;
  --ink-2: #474747;
  --muted: #767676;
  --faint: #a8a8a8;
  --line: #e4e4e4;
  --line-2: #cfcfcf;
  --bg: #ffffff;
  --bg-2: #f4f5f7;
  --blue: #3d7efe;
  --blue-press: #2d6ae6;
  --blue-soft: #edf3ff;
  --red: #d71900;
  --radius: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bar-space: calc(100px + var(--safe-bottom));   /* 아래 고정 막대에 가리지 않을 여백 */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕",
    "Noto Sans KR", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--blue);
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}


/* ---------- 기본 화면 틀 ---------- */

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 20px 48px;
}

.screen.has-bar {
  padding-bottom: calc(var(--bar-space) + 24px);
}

.loading {
  margin: 30vh 0 0;
  text-align: center;
  color: var(--muted);
}

.noscript {
  padding: 40px 20px;
  text-align: center;
}

.title {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.32;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.doc-name {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
}

.body {
  margin: 0 0 24px;
  color: var(--ink-2);
  font-size: 17px;
}

.label {
  display: block;
  margin: 28px 0 10px;
  font-size: 17px;
  font-weight: 600;
}

.hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.muted {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.error {
  margin: 8px 0 0;
  color: var(--red);
  font-size: 15px;
}

.stack > * + * {
  margin-top: 12px;
}

.notice-extra:empty {
  display: none;
}

/* 고객센터 줄 (번호는 누르면 전화 — 위아래로 누를 자리를 넓힘) */
.support {
  margin: 36px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.support a {
  display: inline-block;
  margin: -14px 0;
  padding: 14px 2px;
  color: var(--ink-2);
  font-weight: 700;
  text-decoration: none;
}


/* ---------- 버튼 · 입력칸 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  margin: 0;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}

.btn:active {
  background: var(--bg-2);
}

.btn.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.btn.primary:active {
  background: var(--blue-press);
}

.btn:disabled,
.btn.is-off {
  opacity: 0.4;
  cursor: default;
}

.btn.primary:disabled:active {
  background: var(--blue);
}

.btn.wide {
  display: flex;
  width: 100%;
}

.input {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}

.input.big {
  min-height: 56px;
  font-size: 20px;
}

/* 여러 줄 입력칸 (글자 칸 '여러 줄') */
.input.multi {
  min-height: 132px;
  line-height: 1.4;
  resize: vertical;
}

.input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(61, 126, 254, 0.18);
}

.input::placeholder {
  color: var(--faint);
}

/* 아이폰 날짜 칸: 값이 가운데로 몰리지 않게 */
.input[type="date"] {
  text-align: left;
}

.input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

/* 체크 줄 (전체 동의 · 항목) — 줄 전체가 누르는 자리 */
.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 0;
  cursor: pointer;
}

.check-row input {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--blue);
}

.link-btn {
  flex: none;
  min-height: 48px;
  margin: 0;
  padding: 0 4px 0 12px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}


/* ---------- 번호 입력 ---------- */

.verify .verify-form .btn {
  margin-top: 16px;
}


/* ---------- 서명: 쪽 그림 + 칸 ---------- */

.sign-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.sign-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}

.sign-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.doc {
  padding: 12px 0 var(--bar-space);
  background: var(--bg-2);
}

.doc-empty {
  margin: 0;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.page {
  max-width: 820px;
  margin: 0 auto 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(23, 23, 23, 0.14);
}

/* 높이 0 + padding-top(세로÷가로 %) 로 그림이 오기 전에도 비율대로 자리를 잡음 */
.page-box {
  position: relative;
  height: 0;
  overflow: hidden;
}

.page-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.field {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  line-height: 1.1;
  text-align: left;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
}

/* 내 칸: 파랑 테두리 · 연파랑 면 */
.field.mine {
  border: 1.5px solid var(--blue);
  background: rgba(61, 126, 254, 0.16);
  color: var(--blue);
  cursor: pointer;
  touch-action: manipulation;
}

/* 작은 칸도 누르기 쉽게 누르는 자리만 넓힘(보이는 크기는 그대로) */
.field.mine::after {
  content: "";
  position: absolute;
  top: -8px;
  right: -4px;
  bottom: -8px;
  left: -4px;
}

.field.mine.filled {
  background: rgba(61, 126, 254, 0.05);
  color: var(--ink);
}

.field.mine.active {
  z-index: 2;
  background: rgba(61, 126, 254, 0.24);
  box-shadow: 0 0 0 3px rgba(61, 126, 254, 0.35);
}

.field.mine.filled.active {
  background: rgba(61, 126, 254, 0.12);
}

/* 선택 칸(필수 아님): 점선 테두리 — 필수 칸은 실선 (설계.md 2-2) */
.field.mine.opt {
  border-style: dashed;
}

/* 필수 · 선택 작은 표: 칸 위에 붙음(누르는 자리는 칸 그대로). 채우면 숨김.
   글자는 sign.js 가 붙인 data-tag — 칸 안 글자(textContent)에 섞이지 않게 ::before 로 그림 (::after 는 누르는 자리) */
.field.mine::before {
  content: attr(data-tag);
  position: absolute;
  left: -1.5px;
  bottom: 100%;
  padding: 0 3px;
  border: 1px solid var(--blue);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: var(--blue);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 12px;
  white-space: nowrap;
  pointer-events: none;
}

.field.mine.opt::before {
  border-style: dashed;
  background: #fff;
  color: var(--blue);
}

.field.mine.filled::before {
  display: none;
}

/* 체크 · 서명 칸은 그림을 가운데에 (두 칸 자리는 sign.js 가 칸 안의 가장 큰 정사각형으로 잡음) */
.field.type-check,
.field.type-sign {
  justify-content: center;
  padding: 1px;
}

/* 글자 정렬 (칸 값 align · valign — 없으면 왼쪽 · 세로 가운데, 년 · 월 · 일 날짜 칸은 가운데 · sign.js 가 클래스를 붙임) */
.field.align-center {
  justify-content: center;
  text-align: center;
}

.field.align-right {
  justify-content: flex-end;
  text-align: right;
}

.field.valign-top {
  align-items: flex-start;
  padding-top: 1px;
}

.field.valign-bottom {
  align-items: flex-end;
  padding-bottom: 1px;
}

.field-text,
.field-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

/* 여러 줄 글자 칸: 줄바꿈 그대로 · 칸 폭에서 줄을 나눔(띄어쓰기에서 — 긴 낱말은 글자 단위로) · 줄 간격은 완성 PDF 와 같게 */
.field.multi .field-text {
  width: 100%;
  max-height: 100%;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.field-label {
  font-weight: 600;
  text-overflow: ellipsis;
}

.field-sign {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.field-check {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--ink);
}


/* ---------- 아래 고정 막대 ---------- */

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: #fff;
}

.bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
}

.bar-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
}

.bar .btn {
  flex: none;
  min-width: 124px;
  min-height: 52px;
}


/* ---------- 입력 판 (아래에서 올라옴) ---------- */

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  max-width: 560px;
  max-height: 85vh;
  max-height: 85dvh;
  margin: 0 auto;
  padding: 4px 16px calc(16px + var(--safe-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 16px 16px 0 0;
  background: #fff;
  box-shadow: 0 -8px 28px rgba(23, 23, 23, 0.16);
  visibility: hidden;
  pointer-events: none;   /* 내려가는 동안 아래 막대 누르기를 막지 않게 */
  transform: translateY(105%);
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
}

.sheet.open {
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: transform 0.22s ease, visibility 0s;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 52px;
}

.sheet-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
}

.sheet-close {
  flex: none;
  min-height: 48px;
  margin: 0;
  padding: 0 4px 0 16px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

.sheet-form > * + * {
  margin-top: 12px;
}

/* 손서명 판 */
.pad {
  position: relative;
}

.pad-canvas {
  display: block;
  width: 100%;
  height: 200px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.pad-guide {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  color: var(--faint);
  font-size: 16px;
  text-align: center;
  pointer-events: none;
}

.row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.row > .btn {
  flex: 1;
}


/* ---------- 서류 접수 ---------- */

/* 진행 단계 (작게) */
.steps-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 20px;
  padding: 0;
  list-style: none;
}

.step-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.4;
}

.step-mini.done {
  color: var(--ink-2);
}

.step-mini.current {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.step-mini-icon {
  width: 14px;
  height: 14px;
  color: var(--blue);
}

/* 안심 문구 */
.notice-box {
  margin: 0 0 20px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: 15px;
}

/* 동의 */
.consent {
  margin: 0 0 12px;
  padding: 4px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.consent .all {
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  font-weight: 700;
}

.consent-items {
  margin: 0;
  padding: 4px 0;
  list-style: none;
}

.consent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.consent-row .check-row {
  flex: 1;
  min-width: 0;
  color: var(--ink-2);
  font-size: 15px;
}

.consent-body {
  margin: 0 0 12px 36px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: 14px;
}

.consent-done {
  margin: 0;
  padding: 0 0 12px;
  color: var(--blue);
  font-size: 15px;
  font-weight: 600;
}

/* 동의한 뒤: 체크는 파랗게 둔 채 눌러도 바뀌지 않게 ('자세히'는 그대로 열림) */
.consent.done .check-row {
  pointer-events: none;
}

/* 서류 칸 */
.slots {
  margin-top: 12px;
}

.slot {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.slot-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slot-name {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.slot-tag {
  flex: none;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--bg-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.slot-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.slot-status {
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
}

.slot-status.ok {
  color: var(--blue);
}

.slot-status.bad {
  color: var(--red);
}

.files {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.file {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 6px 0;
}

.file + .file {
  border-top: 1px solid var(--line);
}

.thumb {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  object-fit: cover;
}

.file-main {
  flex: 1;
  min-width: 0;
}

.file-name {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.file-sub {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.file-sub.bad {
  color: var(--red);
}

.file-btn {
  flex: none;
  padding: 0 14px;
  font-size: 15px;
}

/* 못 올린 파일: 사유 아래 줄에 [다시 시도] [취소] */
.file.failed {
  flex-wrap: wrap;
}

.file-actions {
  display: flex;
  flex-basis: 100%;
  gap: 8px;
  padding-left: 54px;
}

.file-actions .btn {
  flex: 1;
}

/* 올리는 중 진행 막대 (폭은 JS 가 %) — 진행 상황 화면(.screen.progress)과 이름이 겹치지 않게 */
.upload-bar {
  display: block;
  height: 6px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: #e9e9e9;
}

.upload-bar i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
  transition: width 0.15s linear;
}

.slot-btns {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

/* 파일 고르기 칸은 숨기되 display:none 은 피함(아이폰에서 안 열릴 때가 있음) */
.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}


/* ---------- 진행 상황 ---------- */

.now {
  margin: 8px 0 8px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--blue-soft);
}

.now-label {
  margin: 0;
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
}

.now-name {
  margin: 4px 0 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
}

.now-check {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
}

.section-title {
  margin: 32px 0 8px;
  font-size: 18px;
  font-weight: 700;
}

.redo .slot:first-child {
  border-top: 0;
  padding-top: 4px;
}

.card {
  margin: 24px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card .section-title {
  margin-top: 0;
}

.ship-no {
  margin: 0 0 12px;
  font-size: 16px;
}

.ship-no strong {
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.step-icon {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--blue);
}

.step-main {
  flex: 1;
  min-width: 0;
}

.step-name {
  display: block;
  font-size: 16px;
}

.step.todo .step-name {
  color: var(--faint);
}

.step.current .step-name {
  color: var(--blue);
  font-weight: 700;
}

.step-check {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.step-date {
  flex: none;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.step-now {
  flex: none;
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
}

.pdf-btn {
  margin-top: 24px;
}


/* ---------- 알림 한 줄 (위쪽) ---------- */

.toast {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 16px;
  right: 16px;
  z-index: 50;
  max-width: 528px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(23, 23, 23, 0.92);
  color: #fff;
  font-size: 15px;
  text-align: center;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}
