/* 약 여권 시연 — 공통 스타일 (와이어프레임 톤: 베이지 + 짙은 청록) */
@font-face {
  font-family: "Pretendard";
  src: url("../vendor/fonts/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 45 920; font-style: normal; font-display: swap;
}

:root {
  --bg: #F3F1EC;
  --bg-2: #EAE7E0;
  --surface: #FFFFFF;
  --line: #DAD6CD;
  --line-2: #E8E5DE;
  --text: #1F1E1B;
  --muted: #6E6A62;
  --faint: #9A968D;
  --primary: #2F5D62;
  --primary-2: #24494D;
  --primary-weak: #E3EEEC;
  --danger: #8A3A1C;
  --danger-bg: #FBEAE3;
  --danger-line: #E9C4B4;
  --ok: #2E5B3A;
  --ok-bg: #E4EFE5;
  --ok-line: #C3D9C6;
  --warn: #7A5A12;
  --warn-bg: #FBF3DE;
  --warn-line: #EAD9A8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
.mono { font-family: var(--mono); letter-spacing: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1; min-width: 0; }

/* ---------- cards / buttons ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card.soft { background: var(--bg-2); border-color: var(--line-2); }
.card h3, .card h4 { margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: #FAF9F6; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.outline { border-color: var(--primary); color: var(--primary); }
.btn.danger { border-color: var(--danger-line); color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.block { width: 100%; }
.btn.lg { padding: 16px 20px; font-size: 18px; border-radius: 16px; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line-2);
}
.chip.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.chip.primary { background: var(--primary-weak); color: var(--primary); border-color: #C6DCD8; }

.alert {
  border-radius: var(--radius); padding: 14px 16px;
  border: 1px solid var(--danger-line); background: var(--danger-bg); color: var(--danger);
  display: flex; gap: 12px; align-items: flex-start;
}
.alert.warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.alert.ok { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.alert.info { border-color: var(--line); background: var(--bg-2); color: var(--muted); }

.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.lg { width: 28px; height: 28px; }
.icon.xl { width: 44px; height: 44px; }

/* ---------- forms ---------- */
label.field { display: block; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); padding: 10px 12px; outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,93,98,.12); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.seg { display: inline-flex; background: var(--bg-2); border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; }
.seg.small button { padding: 5px 9px; font-size: 12px; }

/* ---------- tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); background: #F7F6F2; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tr.hl td { background: #FCF4F0; }
table.tbl tr.click { cursor: pointer; }
table.tbl tr.click:hover td { background: #FAF9F6; }

/* ---------- QR ---------- */
.qr-box { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: inline-block; line-height: 0; }
.qr-box svg { display: block; width: 100%; height: auto; }

/* ---------- toast / modal ---------- */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #2A2926; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 1000; max-width: 92vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal-back { position: fixed; inset: 0; background: rgba(30,29,26,.45); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 16px; }
.modal { background: var(--surface); border-radius: 20px; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }

/* ---------- camera ---------- */
.cam { position: relative; background: #111; border-radius: 16px; overflow: hidden; aspect-ratio: 4/3; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam .frame { position: absolute; inset: 14%; border: 3px solid rgba(255,255,255,.85); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.cam .msg { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; color: #fff; font-size: 14px; text-shadow: 0 1px 3px #000; }

@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dot.live { animation: pulse 1.4s infinite; }
.dot.off { background: var(--faint); }

@media print {
  body { background: #fff; }
}
