/* 버미큘라 코리아 보증서 — 공통 스타일 (고객 화면 + 관리자) */
:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --ink: #1c1b19;
  --sub: #57534e;
  --muted: #8a847c;
  --line: #ece8e2;
  --soft: #f1eee9;
  --accent: #23413a;
  --accent-ink: #ffffff;
  --accent-soft: #e6eeeb;
  --ok: #23413a;
  --ok-bg: #e6eeeb;
  --warn: #a8590d;
  --warn-bg: #fbf0e2;
  --err: #b3261e;
  --err-bg: #fbe9e8;
  --radius: 16px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.6; letter-spacing: -0.01em; -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: inherit; }
button { font-family: inherit; }

.wrap { max-width: 480px; margin: 0 auto; padding: 20px 20px 56px; }
.wrap.wide { max-width: 1120px; }
.brand { font-size: 11px; letter-spacing: .32em; color: var(--muted); font-weight: 700; }
h1 { font-size: 26px; line-height: 1.3; margin: 6px 0 6px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 19px; margin: 0 0 12px; font-weight: 700; letter-spacing: -0.02em; }
.lead { color: var(--sub); margin: 0 0 22px; }
.note { font-size: 13px; color: var(--muted); }
.spaced { margin-top: 12px; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 20px; margin-bottom: 12px; }

/* 입력 */
label.f { display: block; font-weight: 600; font-size: 14px; margin: 16px 0 8px; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=search], input[type=date], select {
  width: 100%; padding: 14px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; font-family: inherit;
  background: #fff; color: var(--ink);
}
input::placeholder { color: #b5afa7; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input { flex: 1; min-width: 140px; width: auto; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px;
  padding: 15px 18px; font-size: 16px; font-weight: 700; cursor: pointer; background: var(--accent); color: var(--accent-ink);
  text-decoration: none; letter-spacing: -0.01em;
}
.btn.block { display: flex; width: 100%; margin-top: 14px; }
.btn.sm { padding: 8px 12px; font-size: 13px; font-weight: 600; border-radius: 10px; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.soft { background: var(--soft); color: var(--ink); }
.btn.kakao { background: #fee500; color: #191919; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.btn-pair .btn { padding: 14px 10px; font-size: 15px; }

.msg { border-radius: 12px; padding: 12px 14px; margin-top: 14px; font-size: 14px; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.warn { background: var(--warn-bg); color: var(--warn); }
.msg.err { background: var(--err-bg); color: var(--err); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 20px 0 4px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.foot-links { text-align: center; font-size: 12px; color: var(--muted); margin-top: 28px; }
.foot-links a { color: var(--muted); }

/* ---------- 고객: 상단 ---------- */
.topnav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.topnav .brand { font-size: 12px; }
.link-btn { background: none; border: 0; padding: 6px 0; color: var(--muted); font-size: 13px; cursor: pointer; }
.back { display: inline-flex; align-items: center; gap: 2px; background: none; border: 0; padding: 6px 0; margin-bottom: 6px; color: var(--sub); font-size: 15px; cursor: pointer; }

/* ---------- 고객: 상태 표시 ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.off { background: var(--soft); color: var(--muted); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- 고객: 목록 ---------- */
.summary { color: var(--sub); margin: 0 0 18px; }
.banner {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--warn-bg); color: var(--warn);
  border-radius: 14px; padding: 14px 16px; font-size: 14px; font-weight: 600; text-decoration: none; margin-bottom: 12px;
}
.wl { display: flex; flex-direction: column; gap: 10px; }
.wl-item {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--surface); border: 0;
  border-radius: var(--radius); padding: 14px; cursor: pointer; color: inherit; font: inherit;
  transition: transform .08s ease;
}
.wl-item:active { transform: scale(.985); }
.thumb { width: 76px; height: 76px; flex: none; border-radius: 12px; background: var(--soft); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { width: 88%; height: 88%; object-fit: contain; }
.thumb .ph-mark { font-size: 24px; font-weight: 800; color: #cfc8be; }
.wl-body { flex: 1; min-width: 0; }
.wl-name { font-weight: 700; font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.wl-meta { font-size: 13px; color: var(--muted); margin: 2px 0 6px; }
.chev { color: #c2bcb3; font-size: 22px; line-height: 1; }
/* 무효(반품) 보증서: 흐리게 */
.wl-item.void { opacity: .5; }
.wl-item.void .thumb img { filter: grayscale(1); }
.void-card { opacity: .45; filter: grayscale(1); }
.void-box { background: var(--soft); color: var(--sub); border-radius: var(--radius); padding: 16px 18px; font-size: 14px; }
.btn-pair.single { grid-template-columns: 1fr; }
.empty { text-align: center; padding: 36px 20px; color: var(--sub); }

/* ---------- 고객: 보증서 카드 ----------
   층 구성: ① 배경(디자이너의 움직이는 배경 영상/이미지, 없으면 임시 그라데이션)
            ② 제품 사진(투명 PNG, 그림자)  ③ 글자(반투명 음영 위) */
.wcard {
  position: relative; width: min(260px, 66%); margin: 4px auto 18px; aspect-ratio: 1080 / 1700; border-radius: 20px; overflow: hidden;
  background: var(--accent); box-shadow: 0 14px 30px rgba(35, 65, 58, .22); isolation: isolate;
}
.wcard .w-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; }
/* 임시 배경: 천천히 흐르는 그라데이션 (디자인 파일이 오면 사용 안 함) */
.wcard .w-bg.temp {
  background: linear-gradient(125deg, #1f3d36, #3f6b5f, #a9c4b8, #e9e1d3, #7fa596, #23413a);
  background-size: 300% 300%; animation: flow 9s ease-in-out infinite alternate;
}
@keyframes flow { from { background-position: 0% 30%; } to { background-position: 100% 70%; } }
@media (prefers-reduced-motion: reduce) { .wcard .w-bg.temp { animation: none; } }

.wcard .w-product {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); width: 82%; aspect-ratio: 1; object-fit: contain;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, .28));
}
.wcard .w-product.ph { display: flex; align-items: center; justify-content: center; font-size: 46px; font-weight: 800; color: rgba(255, 255, 255, .55); filter: none; }
.wcard .w-foot {
  position: absolute; left: 6%; right: 6%; bottom: 5%; padding: 10px 12px; border-radius: 12px; color: var(--ink);
  background: rgba(255, 255, 255, .62); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font-size: 13px; font-weight: 600; line-height: 1.4; text-align: center; overflow-wrap: anywhere;
}

/* ---------- 고객: 상세 ---------- */
.d-title { text-align: center; margin-bottom: 18px; }
.d-title h2 { font-size: 21px; margin: 0 0 8px; }
.number-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; background: var(--surface);
  border: 0; border-radius: var(--radius); padding: 16px 18px; cursor: pointer; text-align: left; color: inherit; font: inherit;
}
.number-box small { display: block; font-size: 12px; color: var(--muted); }
.number-box b { font-family: var(--mono); font-size: 19px; letter-spacing: .03em; }
.number-box .copy-tag { font-size: 13px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.chips a { text-decoration: none; background: var(--surface); border-radius: 999px; padding: 9px 14px; font-size: 14px; font-weight: 600; }
.chips a::after { content: " ↗"; color: var(--muted); }
.group { background: var(--surface); border-radius: var(--radius); padding: 6px 18px; margin-bottom: 10px; }
.group h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 12px 0 2px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--sub); white-space: nowrap; }
.kv span:last-child { text-align: right; overflow-wrap: anywhere; font-weight: 500; }
details.notice { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 10px; }
details.notice summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
details.notice summary::-webkit-details-marker { display: none; }
details.notice summary::after { content: "펼치기"; font-size: 13px; color: var(--muted); font-weight: 500; }
details.notice[open] summary::after { content: "접기"; }
.notice h4 { font-size: 14px; margin: 16px 0 6px; }
.notice ul { margin: 0; padding: 0; list-style: none; color: var(--sub); font-size: 14px; }
.notice li { position: relative; padding-left: 12px; margin-bottom: 6px; white-space: pre-line; }
.notice li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 4px; height: 4px; border-radius: 50%; background: #c2bcb3; }
.transfer-line {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; background: none; border: 0;
  border-top: 1px solid var(--line); padding: 18px 2px 4px; margin-top: 8px; color: var(--sub); font: inherit; font-size: 14px; cursor: pointer; text-align: left;
}
.transfer-line b { color: var(--ink); white-space: nowrap; }
.pending-box { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 14px 16px; font-size: 14px; margin-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pending-box button { background: none; border: 0; color: var(--warn); font-weight: 700; cursor: pointer; text-decoration: underline; white-space: nowrap; font: inherit; }

/* ---------- 고객: 등록·분실 신청 ---------- */
.add-box { margin-top: 16px; }
.add-box .btn { width: 100%; }
.text-link { display: block; text-align: center; margin-top: 12px; color: var(--sub); font-size: 14px; background: none; border: 0; width: 100%; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.req-list { margin-top: 18px; }
.req-list h3 { font-size: 14px; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.req-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; font-size: 14px; }
.req-item small { display: block; color: var(--muted); font-size: 12px; }
input.code-input { font-family: var(--mono); font-size: 20px; letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.hint { font-size: 13px; margin-top: 6px; min-height: 18px; color: var(--muted); }
.hint.ok { color: var(--ok); }
.hint.err { color: var(--err); }
.agree { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; font-size: 14px; }
.agree input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--accent); }
details.terms { font-size: 13px; color: var(--muted); margin: 6px 0 0 30px; }
details.terms summary { cursor: pointer; }
.proof-preview { width: 100%; max-height: 260px; object-fit: contain; border-radius: 12px; background: var(--soft); margin-top: 10px; }
.done-box { text-align: center; padding: 30px 20px; }
.done-box .big { font-size: 40px; }

/* ---------- 고객: 양도 ---------- */
.step { font-size: 13px; color: var(--accent); font-weight: 700; }
.mini { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: var(--radius); padding: 12px; margin: 16px 0 6px; }
.mini .thumb { width: 56px; height: 56px; }
.confirm-list { background: var(--surface); border-radius: var(--radius); padding: 6px 18px; margin: 16px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(32px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(28, 27, 25, .92); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; z-index: 20; white-space: nowrap;
}

/* ---------- 오류 정보 상자 (복사해서 개발 담당에게 전달) ---------- */
.err-panel {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50; width: min(560px, calc(100% - 24px));
  background: #fff; border: 1px solid var(--err); border-radius: 14px; box-shadow: 0 14px 34px rgba(0,0,0,.18); padding: 14px 16px;
}
.err-panel b { color: var(--err); }
.err-panel pre {
  font-family: var(--mono); font-size: 12px; background: var(--soft); border-radius: 8px; padding: 10px; margin: 8px 0;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow-y: auto; user-select: all;
}

/* ---------- 관리자 ---------- */
.panel.admin { border: 1px solid var(--line); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 15px; font-size: 14px; cursor: pointer; color: var(--ink); }
.tabs button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--bg); border-radius: 12px; padding: 14px; }
.stat b { display: block; font-size: 24px; overflow-wrap: anywhere; }
.stat b.small { font-size: 16px; padding: 5px 0 4px; }
.stat span { font-size: 13px; color: var(--muted); }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
td.mono { font-family: var(--mono); }
td.wrap-cell { white-space: normal; min-width: 180px; }
td input[type=text], td select { padding: 7px 9px; font-size: 13px; min-width: 120px; border-radius: 8px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eee; color: #555; }
.badge.void { background: var(--err-bg); color: var(--err); }
select.auto { width: auto; padding: 9px 12px; font-size: 14px; }
input.narrow { flex: 0 0 160px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-top: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--sub); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.req { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.req-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.req dl { display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; font-size: 13px; margin: 10px 0; }
.req dt { color: var(--muted); }
.req dd { margin: 0; }
.req .alert { color: var(--warn); font-size: 13px; margin: 2px 0; }
.req img.proof { max-width: 100%; max-height: 520px; border-radius: 8px; border: 1px solid var(--line); margin-top: 8px; display: block; }
/* 검색해서 고르는 목록 */
.combo { position: relative; display: block; }
.combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 280px; overflow-y: auto; margin: 0; padding: 6px;
  list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 28px rgba(0,0,0,.12);
}
.combo-list li { padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink); }
.combo-list li.on, .combo-list li:hover { background: var(--accent-soft); }
.combo-list li.empty { color: var(--muted); cursor: default; background: none; }
.combo input.invalid { border-color: var(--err); }
.move { display: inline-flex; gap: 2px; }
.move button { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 12px; color: var(--sub); }
.move button:disabled { opacity: .3; cursor: default; }
.move { align-items: center; }
.move input.pos { width: 46px; min-width: 0; height: 28px; padding: 2px 4px; font-size: 13px; text-align: center; border-radius: 6px; margin-right: 4px; }
tr.hidden-row td { color: var(--muted); }
.prod-preview { width: 140px; height: 140px; object-fit: contain; background: var(--soft); border-radius: 10px; display: block; margin-bottom: 8px; }
dialog { max-height: calc(100vh - 32px); overflow-y: auto; }
dialog { border: 0; border-radius: 16px; padding: 22px; width: min(420px, calc(100% - 32px)); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(28, 27, 25, .45); }
label.radio { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; cursor: pointer; font-size: 14px; }
label.radio input { margin-top: 3px; accent-color: var(--accent); }
label.radio small { color: var(--muted); }
.temp-pw { background: var(--warn-bg); border-radius: 12px; padding: 14px 16px; margin-top: 12px; }
.temp-pw code { font-family: var(--mono); font-size: 18px; font-weight: 700; letter-spacing: .04em; background: #fff; padding: 4px 10px; border-radius: 6px; display: inline-block; margin: 6px 8px 6px 0; }
tr.undone td { color: var(--muted); text-decoration: line-through; }
.prod-img { width: 48px; height: 48px; object-fit: contain; background: var(--soft); border-radius: 8px; }
.qr { width: 200px; height: 200px; background: #fff; border: 1px solid var(--line); border-radius: 8px; display: block; margin: 12px 0; }
.secret { font-family: var(--mono); font-size: 13px; background: var(--soft); padding: 6px 8px; border-radius: 6px; overflow-wrap: anywhere; }
