:root {
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --radius: 16px;
  --shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.05), 0 8px 10px -6px rgba(15, 23, 42, 0.02);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans KR", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* 브랜드 헤더 */
.brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.logo-icon {
  font-size: 24px;
  background: #eff6ff;
  padding: 8px;
  border-radius: 12px;
}
.brand-title {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}

/* 카드 카드 디자인 */
.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

h1 { font-size: 22px; margin: 0 0 8px; font-weight: 700; }
.card-title { font-size: 18px; margin: 0 0 12px; font-weight: 700; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; line-height: 1.5; }

/* 폼 요소 */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; }
.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.req { color: var(--danger); }

input[type=text], input[type=date] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  background: #f8fafc;
  color: var(--text);
  transition: all 0.2s ease;
  outline: none;
}
input[type=text]:focus, input[type=date]:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* 서약 내용 */
.agreement {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  line-height: 1.7;
  max-height: 240px;
  overflow-y: auto;
  background: #f8fafc;
  white-space: pre-line;
  font-size: 14px;
  color: #334155;
}

.check-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.check-box input { width: 18px; height: 18px; accent-color: var(--primary); }

/* 서명 패드 */
.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 210px;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.2s;
}
.canvas-wrapper:hover { border-color: var(--primary); }

canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
  display: block;
}
.sig-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #94a3b8;
  font-size: 14px;
  pointer-events: none;
}

/* 버튼 스타일 */
.row { display: flex; gap: 10px; }
.button-row { margin-top: 12px; }

.btn {
  border: 0;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  margin-top: 16px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #f1f5f9; color: #334155; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

/* 안내 박스 */
.notice {
  padding: 12px 16px;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 13px;
  margin-top: 16px;
}

/* 완료 화면 */
.success-card { text-align: center; padding: 40px 24px; }
.icon-wrap {
  width: 64px;
  height: 64px;
  background: #dcfce7;
  color: #16a34a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.success-icon { font-size: 32px; font-weight: bold; }
.success-desc { color: var(--muted); font-size: 15px; margin-bottom: 24px; }

.receipt-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align: left;
}
.record-item {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 0;
}
.record-item span { color: var(--muted); }

/* 관리자 테이블 */
.hidden { display: none !important; }
.adminbar { display: flex; justify-content: space-between; align-items: center; }
.small { font-size: 13px; color: var(--muted); }
.table-responsive { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; background: #f8fafc; }

@media (max-width: 520px) {
  .form-grid { grid-template-columns: 1fr; }
  .card { padding: 18px; }
}