/* Base tokens and shared components (dashboard and public signing page). */
:root {
  --navy: #1c294c;
  --navy-h: #2a3a66;
  --navy-50: #eef1f7;
  --text: #191f28;
  --text-2: #4e5968;
  --text-3: #8b95a1;
  --line: #e5e8eb;
  --line-2: #d1d6db;
  --gray: #f2f4f6;
  --gray-h: #e9ecef;
  --green: #12805c;
  --green-bg: #e5f4ec;
  --red: #e0442a;
  --font: Pretendard, "Pretendard Variable", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --shadow-float: 0 0 0 1px rgba(25, 31, 40, 0.07), 0 10px 30px rgba(25, 31, 40, 0.14);
  font-family: var(--font);
  color: var(--text);
  background: #fff;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  font-synthesis: none;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* buttons */
.btn, .primary, .secondary {
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px; font-weight: 600; white-space: nowrap; transition: background 0.12s, border-color 0.12s;
}
.primary { background: var(--navy); color: #fff; }
.primary:hover:not(:disabled) { background: var(--navy-h); }
.secondary, .btn.line { background: #fff; border-color: var(--line); color: var(--text); }
.secondary:hover:not(:disabled), .btn.line:hover:not(:disabled) { background: var(--gray); }
.btn.soft { background: var(--gray); color: var(--text-2); }
.btn.soft:hover:not(:disabled) { background: var(--gray-h); color: var(--text); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.danger-line { background: #fff; border-color: var(--line); color: var(--red); }
.btn.danger-line:hover { background: #fdf1ee; }
.delete-button { height: 40px; padding: 0 16px; border-radius: 10px; border: 0; background: var(--red); color: #fff; font-weight: 600; }
.text-button { background: none; border: 0; padding: 6px 0; color: var(--navy); font-size: 13px; font-weight: 600; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-button.danger, .danger { color: var(--red); }
.icon, .icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 0; background: none;
  display: inline-grid; place-items: center; color: var(--text-3); font-size: 22px; line-height: 1;
}
.icon:hover, .icon-btn:hover { background: var(--gray); color: var(--text); }

/* forms */
label { display: block; margin: 14px 0; font-size: 14px; font-weight: 600; color: var(--text-2); }
:where(input:not([type=checkbox], [type=radio], [type=range], [type=file], [type=search])), :where(select, textarea) {
  display: block; width: 100%; height: 44px; margin-top: 6px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--text);
  font-size: 15px; font-weight: 400; outline: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--navy); }
input[type=checkbox], input[type=radio] { accent-color: var(--navy); width: 17px; height: 17px; margin: 0; }
input[type=range] { accent-color: var(--navy); width: 100%; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 500; line-height: 1.55; color: var(--text); cursor: pointer; }
.consent input { margin-top: 2px; flex: none; }
.required-label { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); }
.item-error { color: var(--red); font-size: 13px; margin-top: 8px; }

/* dialogs */
dialog {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  border: 0; border-radius: 16px; padding: 24px; background: #fff; color: var(--text);
  box-shadow: 0 24px 64px rgba(25, 31, 40, 0.24);
}
dialog::backdrop { background: rgba(25, 31, 40, 0.4); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dialog-heading h2 { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.dialog-heading .icon { margin-right: -8px; }
dialog p { color: var(--text-2); line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.dialog-actions > * { height: 44px; min-width: 88px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 90; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 16px; max-width: calc(100vw - 32px);
  background: #2b313b; color: #fff; padding: 13px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.error { background: #a3321f; }
.toast button { background: none; border: 0; padding: 0; color: #9db4ff; font-weight: 700; }

/* PDF viewer (shared) */
.pdf-panel { min-width: 0; }
.pdf-workspace { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 20px; align-items: start; }
.pdf-workspace.no-thumbs { display: block; }
.page-thumbnails { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 4px 0 16px; }
.page-thumbnail { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; padding: 0; color: var(--text-3); font-size: 12px; font-weight: 600; }
.page-thumbnail canvas { width: 64px; min-height: 40px; background: #fff; border: 1px solid var(--line); border-radius: 4px; display: block; }
.page-thumbnail.active { color: var(--navy); }
.page-thumbnail.active canvas { outline: 2px solid var(--navy); outline-offset: 2px; }
.document-scroll { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.document-page { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pdf-sheet { position: relative; width: 100%; background: #fff; box-shadow: 0 0 0 1px rgba(25, 31, 40, 0.05), 0 4px 14px rgba(25, 31, 40, 0.07); }
.pdf-sheet > canvas { width: 100%; height: 100%; display: block; }
.placements, .form-fields { position: absolute; inset: 0; }
.page-number { font-size: 12px; font-weight: 600; color: var(--text-3); }
.loading { padding: 80px 0; text-align: center; color: var(--text-3); }
