/* SignPen 공용 UI — 랜딩과 같은 토큰. 모든 화면이 이 파일을 먼저 읽는다. */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

:root {
  --ink: #14213d;
  --ink-2: #2b3a5c;
  --muted: #5b6478;
  --faint: #8a909d;
  --line: #e4e7ee;
  --line-2: #eef0f4;
  --bg: #fbfaf7;
  --bg-2: #f3f1ec;
  --card: #ffffff;
  --accent: #e4572e;
  --accent-soft: #fdeee9;
  --good: #1f8a5b;
  --good-soft: #e7f6ee;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --bad: #c53030;
  --bad-soft: #fdecec;
  --info: #2b6cb0;
  --info-soft: #e8f1fb;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(20, 33, 61, 0.06), 0 8px 24px -12px rgba(20, 33, 61, 0.18);
  --shadow-lg: 0 30px 60px -20px rgba(20, 33, 61, 0.3);
  --font: 'Pretendard Variable', Pretendard, system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.55; word-break: keep-all; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 로고 */
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); }
.logo small { font-weight: 600; color: var(--muted); font-size: 12.5px; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 10px; font-weight: 700; font-size: 14.5px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s; background: var(--card); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #0d172d; box-shadow: 0 6px 16px rgba(20, 33, 61, 0.22); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled) { background: #cf4a24; }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--card); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink-2); }
.btn-danger { border-color: #f1c4c4; color: var(--bad); background: var(--card); }
.btn-danger:hover:not(:disabled) { background: var(--bad-soft); }
.btn-text { background: none; border: 0; color: var(--muted); padding: 0 8px; height: 34px; }
.btn-text:hover { color: var(--ink); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 폼 */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 14px; }
.label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea { width: 100%; height: 44px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); font-size: 15px; transition: border-color 0.15s, box-shadow 0.15s; }
.textarea { height: auto; min-height: 90px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(43, 58, 92, 0.12); }
.input.invalid { border-color: var(--bad); }
.input-sm { height: 36px; font-size: 14px; padding: 0 10px; border-radius: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ink); flex: none; }
.code-input { letter-spacing: 0.5em; font-family: var(--mono); font-size: 22px; text-align: center; font-weight: 700; height: 56px; }

/* 카드 · 배지 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card-pad { padding: 24px; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.badge.plain::before { display: none; }
.b-draft { background: var(--line-2); color: var(--muted); }
.b-sent, .b-waiting { background: var(--info-soft); color: var(--info); }
.b-in_progress, .b-viewed { background: var(--warn-soft); color: var(--warn); }
.b-completed, .b-signed { background: var(--good-soft); color: var(--good); }
.b-declined { background: var(--bad-soft); color: var(--bad); }
.b-canceled, .b-expired { background: #f1f1f1; color: #7a7a7a; }

/* 알림 · 토스트 */
.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; line-height: 1.5; }
.alert-bad { background: var(--bad-soft); color: var(--bad); }
.alert-good { background: var(--good-soft); color: var(--good); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warn { background: var(--warn-soft); color: #8a5a10; }
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 1000; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toastIn 0.25s ease-out; pointer-events: auto; }
.toast.bad { background: var(--bad); }
.toast.good::before { content: '✓  '; color: #7ee2a8; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* 모달 */
.modal-back { position: fixed; inset: 0; background: rgba(20, 33, 61, 0.45); display: grid; place-items: center; z-index: 900; padding: 16px; animation: fade 0.15s; }
.modal { background: var(--card); border-radius: 20px; width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(720px, 100%); }
.modal-head { padding: 22px 24px 0; display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.modal-head h3 { font-size: 19px; letter-spacing: -0.02em; }
.modal-body { padding: 16px 24px 8px; }
.modal-foot { padding: 16px 24px 22px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }

/* 표 */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: #fafaf8; }

.mono { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.skeleton { background: linear-gradient(90deg, #f0f0ee 25%, #f7f7f5 50%, #f0f0ee 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* 회사 정보 푸터 */
.site-foot { border-top: 1px solid var(--line); padding: 32px 0 44px; font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.site-foot .links { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; font-weight: 600; color: var(--ink-2); }
.site-foot .links a { text-decoration: none; }
.site-foot .links a:hover { color: var(--accent); }

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