/* 서류 제출 사이트 공용 스타일 — 모바일 우선 */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --ink: #1d2433;
  --ink-2: #5a6478;
  --line: #dde2ea;
  --accent: #2f4e9e;
  --accent-soft: #e8edf8;
  --good: #256b45;
  --good-soft: #e3f1e8;
  --bad: #b8452f;
  --bad-soft: #f9ece8;
  --warn: #8a5a12;
  --warn-soft: #f7efdd;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
.page { max-width: 560px; margin: 0 auto; padding: 20px 16px 80px; }
.page.wide { max-width: 1080px; }

a { color: var(--accent); }
.hidden { display: none !important; }

/* ---------- 헤더 ---------- */
.site-head { margin-bottom: 20px; }
.site-head .proj {
  font-size: 12.5px; font-weight: 700; color: var(--accent);
  letter-spacing: .02em;
}
.site-head h1 { font-size: 24px; margin: 2px 0 4px; }
.site-head .host { font-size: 13px; color: var(--ink-2); margin: 0; }

/* ---------- 화면 전환 ---------- */
.screen { display: none; }
.screen.active { display: block; }

h2 { font-size: 19px; margin: 0 0 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--ink-2); font-size: 14px; }
.fineprint { color: var(--ink-2); font-size: 12.5px; margin-top: 14px; }
.error { color: var(--bad); font-size: 14px; font-weight: 600; }

/* ---------- 버튼·입력 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 10px 16px; font-size: 15px; font-weight: 600;
  cursor: pointer; min-height: 44px; font-family: inherit;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); border-color: var(--bad); background: var(--surface); }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; margin-top: 16px; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

input[type="text"], input[type="tel"], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-size: 16px; background: var(--surface); color: var(--ink);
  font-family: inherit;
}
textarea { min-height: 90px; resize: vertical; }
label.field { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
label.field input, label.field select, label.field textarea { margin-top: 5px; font-weight: 400; }

.pin-box { max-width: 220px; text-align: center; letter-spacing: .4em; font-size: 22px !important; }

/* ---------- 배너·진행률 ---------- */
.banner {
  border-radius: 10px; padding: 12px 14px; font-size: 14px; font-weight: 600;
  margin-bottom: 14px; background: var(--warn-soft); color: var(--warn);
}
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.good { background: var(--good-soft); color: var(--good); }

.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 4px 0 6px; }
.progress > div { height: 100%; width: 0%; background: var(--accent); border-radius: 999px; transition: width .3s; }
#progress-text { font-size: 13.5px; color: var(--ink-2); margin-bottom: 16px; }

/* ---------- 서류 카드 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 15px 16px; margin-bottom: 12px;
}
.card.done { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.card.rejected { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-head h3 { margin: 0; font-size: 15.5px; }
.card .help { font-size: 13px; color: var(--ink-2); margin: 4px 0 0; }
.card .reject-msg { font-size: 13.5px; color: var(--bad); font-weight: 600; margin-top: 6px; }

.badge {
  flex: 0 0 auto; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px;
  white-space: nowrap;
}
.badge.todo { background: var(--surface-2); color: var(--ink-2); }
.badge.done { background: var(--good-soft); color: var(--good); }
.badge.rejected { background: var(--bad-soft); color: var(--bad); }
.badge.uploading { background: var(--accent-soft); color: var(--accent); }

.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.file-info {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  font-size: 13.5px; color: var(--ink-2); word-break: break-all;
}
.file-info img.thumb {
  width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line);
  flex: 0 0 auto;
}
.upbar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.upbar > div { height: 100%; width: 0%; background: var(--accent); transition: width .2s; }

.mask-check { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-size: 13.5px; }
.mask-check input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; }

/* ---------- 동의 화면 ---------- */
.consent-body {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; font-size: 13.5px; max-height: 45vh; overflow-y: auto; margin-bottom: 14px;
}
.consent-body h3 { font-size: 14px; margin: 12px 0 4px; }
.consent-body h3:first-child { margin-top: 0; }
.consent-body td, .consent-body th { font-size: 13px; padding: 5px 8px; border: 1px solid var(--line); text-align: left; }
.consent-body table { border-collapse: collapse; width: 100%; }
.agree-row { display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 15px; }
.agree-row input { width: 20px; height: 20px; }

/* ---------- 회원 검토 (인용 확인) ---------- */
details.mc-guide {
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  margin: 14px 0 20px; font-size: 13.5px;
}
details.mc-guide > summary { cursor: pointer; padding: 11px 14px; font-weight: 600; }
details.mc-guide > div { padding: 0 14px 12px; color: var(--ink-2); }
details.mc-guide p { margin: 0 0 8px; }
.mc-summary {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 14px 16px; font-size: 14.5px; line-height: 1.75;
  white-space: pre-wrap; margin-bottom: 14px;
}
.mc-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 12px;
}
.mc-card.answered { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.mc-card .mc-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.mc-card .mc-id { font-weight: 700; font-size: 14px; }
.mc-card .mc-src { font-size: 12.5px; color: var(--ink-2); }
.mc-quote {
  font-size: 15px; line-height: 1.75; margin: 10px 0 8px; padding-left: 12px;
  border-left: 3px solid var(--surface-2); white-space: pre-wrap;
}
.mc-support { font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.mc-marks { display: flex; gap: 8px; flex-wrap: wrap; }
.mc-marks label {
  flex: 1 1 30%; display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 6px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; background: var(--surface); min-height: 44px; text-align: center;
}
.mc-marks input { width: 16px; height: 16px; flex: 0 0 auto; }
.mc-marks label.sel-ok { border-color: var(--good); background: var(--good-soft); color: var(--good); }
.mc-marks label.sel-edit { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.mc-marks label.sel-no { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.mc-card textarea { margin-top: 10px; min-height: 70px; }
.mc-card.failed { border-color: var(--bad); background: var(--bad-soft); }
.mc-unsaved { color: var(--bad); font-size: 13px; font-weight: 600; margin: 8px 0 0; }

/* ---------- 완료 화면 ---------- */
.done-mark {
  width: 64px; height: 64px; border-radius: 50%; background: var(--good-soft); color: var(--good);
  display: flex; align-items: center; justify-content: center; font-size: 32px; margin: 10px auto 14px;
}
.summary-list { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px; }
.summary-list div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.summary-list div:last-child { border-bottom: none; }
.summary-list .fname { color: var(--ink-2); word-break: break-all; text-align: right; }

/* ---------- 서명 모달 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(20, 24, 34, .55);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.modal-panel {
  background: var(--surface); border-radius: 16px 16px 0 0; width: 100%; max-width: 560px;
  padding: 18px 16px 24px;
}
@media (min-width: 600px) {
  .modal { align-items: center; }
  .modal-panel { border-radius: 16px; }
}
.tabbar { display: flex; gap: 6px; margin-bottom: 14px; }
.tabbar button {
  flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 8px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink-2); font-family: inherit;
}
.tabbar button.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
#sig-canvas {
  width: 100%; height: 200px; border: 1px dashed var(--line); border-radius: 10px;
  background: #fff; touch-action: none; display: block;
}
.sig-hint { font-size: 12.5px; color: var(--ink-2); text-align: center; margin: 6px 0 0; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 14px; padding: 10px 18px;
  border-radius: 999px; z-index: 99; max-width: 90vw; text-align: center;
}

/* ================= 관리자 ================= */
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-top .who { font-size: 13px; color: var(--ink-2); }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; margin-bottom: 16px;
}
.panel h2 { font-size: 16px; margin-bottom: 12px; }
.panel .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.panel .row > label.field { flex: 1 1 160px; margin-bottom: 0; }

details.acc { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 16px; }
details.acc > summary { cursor: pointer; font-weight: 700; font-size: 15px; padding: 13px 18px; list-style: none; }
details.acc > summary::before { content: "▸ "; color: var(--accent); }
details.acc[open] > summary::before { content: "▾ "; }
details.acc > .acc-body { padding: 0 18px 16px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 5px 14px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; font-family: inherit;
}
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table.grid { border-collapse: collapse; width: 100%; font-size: 13.5px; min-width: 720px; }
table.grid th, table.grid td { padding: 9px 12px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.grid thead th { border-top: none; background: var(--surface-2); font-size: 12.5px; white-space: nowrap; }
td.proj { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dots { display: flex; gap: 5px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); }
.dot.done { background: var(--good); border-color: var(--good); }
.dot.rejected { background: var(--bad); border-color: var(--bad); }
.status-chip { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.status-chip.pending { background: var(--surface-2); color: var(--ink-2); }
.status-chip.submitted { background: var(--accent-soft); color: var(--accent); }
.status-chip.confirmed { background: var(--good-soft); color: var(--good); }

.detail-row td { background: var(--bg); }
.slot-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.slot-line:last-child { border-bottom: none; }
.slot-line .nm { min-width: 180px; font-weight: 600; }
.slot-line .st { color: var(--ink-2); }

.tpl-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.tpl-line:last-child { border-bottom: none; }
.tpl-line .nm { min-width: 220px; font-weight: 600; }
.tpl-state { font-size: 12.5px; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
