:root {
  --bg: #f5f6f8;
  --paper: #fff;
  --text: #202124;
  --muted: #68707a;
  --line: #d8dde5;
  --primary: #1f5da8;
  --primary-dark: #17477f;
  --ok: #137b4b;
  --warn: #9a6414;
  --danger: #b3261e;
  --shadow: 0 8px 30px rgba(18, 31, 53, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); }
.topbar {
  min-height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand { font-weight: 800; font-size: 18px; }
.userbar { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.userbar form { margin: 0; }
.container { width: min(1120px, calc(100% - 32px)); margin: 28px auto 70px; }
h1 { margin: 0 0 12px; font-size: clamp(26px, 3vw, 34px); }
h2 { margin: 0 0 12px; font-size: 21px; }
.muted { color: var(--muted); }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.narrow { max-width: 520px; margin: 60px auto; }
.stack-form { display: grid; gap: 16px; }
label { font-weight: 700; }
input, select {
  width: 100%;
  margin-top: 7px;
  border: 1px solid #b9c1cc;
  border-radius: 10px;
  min-height: 48px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}
input:focus, select:focus { outline: 3px solid rgba(31,93,168,.16); border-color: var(--primary); }
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid #aeb7c4;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.large { min-height: 52px; font-size: 17px; }
.btn.xlarge { min-height: 58px; padding: 12px 28px; font-size: 19px; }
.btn.small { min-height: 38px; padding: 7px 12px; font-size: 14px; }
.link-button { border: 0; background: transparent; color: var(--primary); font: inherit; cursor: pointer; padding: 8px; }
.flash-list { display: grid; gap: 8px; margin-bottom: 18px; }
.flash { border-radius: 10px; padding: 12px 15px; background: #eef2f7; }
.flash.error { background: #fff0ef; color: var(--danger); }
.flash.success { background: #edf8f2; color: var(--ok); }
.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; }
.case-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.case-card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 22px;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
}
.case-card:active { transform: scale(.997); }
.case-card h2 { margin-top: 13px; font-size: 20px; }
.case-status { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.case-status.done { background: #e9f6ef; color: var(--ok); }
.case-status.pending { background: #fff6e7; color: var(--warn); }
dl { display: grid; grid-template-columns: 80px 1fr; gap: 6px 12px; margin-bottom: 0; }
dt { color: var(--muted); } dd { margin: 0; }
.back-link { display: inline-block; margin-bottom: 14px; text-decoration: none; font-weight: 700; }
.case-detail { max-width: 800px; margin: 0 auto; }
.info-row { display: grid; grid-template-columns: 100px 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.info-row span { color: var(--muted); }
.action-panel { margin-top: 26px; padding: 22px; border-radius: 12px; background: #f7f9fc; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.button-row.center { justify-content: center; }
.status-line.done { color: var(--ok); font-weight: 800; }

/* 서약서 */
.pledge-sheet {
  max-width: 960px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid #cfd5dd;
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 52px);
}
.document-head h1 { text-align: center; font-size: 28px; margin-bottom: 28px; }
.meta-table { display: grid; grid-template-columns: 145px 1fr; border: 1px solid #5f6368; }
.meta-table > div { padding: 12px 14px; border-bottom: 1px solid #5f6368; }
.meta-table > div:nth-last-child(-n+2) { border-bottom: 0; }
.meta-label { background: #f2f2f2; text-align: center; font-weight: 800; border-right: 1px solid #5f6368; }
.document-text { line-height: 1.85; margin: 32px 0; }
.question-table {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 76px 88px;
  border-top: 1px solid #555;
  border-left: 1px solid #555;
}
.question-table > div, .question-table > label {
  border-right: 1px solid #555;
  border-bottom: 1px solid #555;
}
.q-head { background: #f1f1f1; font-weight: 800; text-align: center; padding: 12px 6px; }
.q-num { display: flex; align-items: center; justify-content: center; padding: 12px 6px; }
.q-text { display: flex; align-items: center; min-height: 78px; line-height: 1.5; padding: 12px 14px; }
.choice-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 78px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.choice-cell input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.check-box {
  width: 42px;
  height: 42px;
  border: 2px solid #68707a;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 31px;
  line-height: 1;
  color: transparent;
  background: #fff;
}
.choice-cell input:checked + .check-box { color: #111; border-color: #111; background: #f2f6fb; }
.choice-cell:active .check-box { transform: scale(.96); }
.pen-hint { color: var(--muted); font-size: 14px; margin: 10px 0 30px; }
.sign-section { margin-top: 38px; }
.date-preview { text-align: center; font-size: 18px; margin: 20px 0 25px; }
.identity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 700px; margin: 0 auto 24px; }
.identity-grid input[readonly] { background: #f4f5f6; }
.signature-wrap { max-width: 760px; margin: 28px auto 24px; }
.signature-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.signature-title span { color: var(--muted); font-size: 14px; }
#signatureCanvas {
  display: block;
  width: 100%;
  height: 240px;
  border: 2px solid #5f6368;
  border-radius: 12px;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}
.signature-actions { display: flex; justify-content: flex-end; margin-top: 9px; }
.recipient { text-align: center; font-size: 21px; font-weight: 800; margin: 38px 0 12px; }
.final-confirm {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 760px;
  margin: 36px auto 18px;
  padding: 16px;
  border-radius: 10px;
  background: #f4f7fb;
}
.final-confirm input { width: 28px; height: 28px; min-height: 0; margin: 0; flex: 0 0 auto; }
.submit-bar { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 24px; text-align: center; }
.submit-bar p { color: var(--muted); font-size: 14px; }

.done-card { max-width: 780px; text-align: center; margin: 50px auto; }
.success-mark { width: 70px; height: 70px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: #e9f6ef; color: var(--ok); font-size: 38px; font-weight: 900; }
.hash-box { margin: 25px auto; padding: 14px; border-radius: 10px; background: #f6f7f8; text-align: left; overflow-wrap: anywhere; }
.hash-box span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }

.admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 22px 0; }
.admin-list { margin-top: 18px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); }
th { background: #f4f6f8; }

@media (max-width: 820px) {
  .container { width: min(100% - 20px, 1000px); margin-top: 18px; }
  .topbar { padding: 0 14px; }
  .brand { font-size: 16px; }
  .pledge-sheet { padding: 18px 14px 34px; }
  .question-table { grid-template-columns: 42px minmax(0, 1fr) 64px 70px; }
  .q-text { min-height: 94px; font-size: 15px; padding: 10px; }
  .choice-cell { min-height: 94px; }
  .check-box { width: 44px; height: 44px; }
  .identity-grid { grid-template-columns: 1fr; }
  .signature-title { display: block; }
  .signature-title span { display: block; margin-top: 5px; }
  .admin-grid { grid-template-columns: 1fr; }
}
