:root {
  --ink: #1d2733;
  --muted: #5d6b7a;
  --line: #d9e0e7;
  --bg: #f4f6f8;
  --card: #ffffff;
  --brand: #1f4e79;
  --brand-soft: #e7eff7;
  --warn: #9a6400;
  --warn-bg: #fff6e0;
  --err: #b42318;
  --err-bg: #fdecea;
  --ok: #2f7a3e;
  --ok-bg: #e8f5ea;
  --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.top { background: var(--brand); color: #fff; padding: 28px 0 24px; }
.top h1 { margin: 2px 0 0; font-size: 26px; letter-spacing: -0.02em; }
.eyebrow { margin: 0; opacity: .8; font-size: 14px; }
.banner { padding: 10px 0; font-size: 14px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.err { background: var(--err-bg); color: var(--err); }
main { padding: 24px 0 48px; }
.view { display: block; }
.view[hidden] { display: none; }
.lead { font-size: 18px; margin: 0 0 20px; }
h2 { margin: 0 0 12px; font-size: 21px; letter-spacing: -0.01em; }
h3 { margin: 0 0 6px; font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}
.panel.narrow { max-width: 460px; margin: 40px auto; }
.center { text-align: center; }
.step-label { margin: 0; color: var(--brand); font-weight: 700; font-size: 13px; }

/* 첫 화면 카드 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; gap: 10px;
}
.card h2 { margin: 0; }
.card dl { margin: 0; display: grid; grid-template-columns: 64px 1fr; gap: 2px 10px; font-size: 15px; }
.card dt { color: var(--muted); }
.card dd { margin: 0; }
.card .btn { margin-top: auto; align-self: flex-start; }
.steps { margin: 0 0 12px; padding-left: 22px; }
.steps li { margin-bottom: 6px; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 9px 16px; font: inherit; font-size: 15px; cursor: pointer;
}
.btn:hover { border-color: #b5c1cc; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #183f63; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: default; }
.file-btn { cursor: pointer; }

/* 폼 */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 18px; }
.grid-form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
.grid-form .spacer { display: none; }
.grid-form em { color: var(--err); font-style: normal; }
input[type="text"], input:not([type]), input[type="email"], input[inputmode] {
  font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 0;
}
input:focus { outline: 2px solid #8fb3d6; outline-offset: 0; border-color: #8fb3d6; }
fieldset.inline { border: 0; padding: 0; margin: 0; grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 20px; }
fieldset.inline legend { font-size: 14px; font-weight: 600; margin-bottom: 4px; padding: 0; }
fieldset.inline label { flex-direction: row; align-items: center; font-weight: 400; font-size: 15px; gap: 6px; }
.actions { grid-column: 1 / -1; display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.row-form { display: flex; gap: 10px; }
.row-form input { width: 120px; font-size: 22px; text-align: center; letter-spacing: .3em; }
.msg { min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }

/* 관리 링크 */
.link-box { border-color: #9fbfdc; background: var(--brand-soft); }
.link-row { display: flex; gap: 8px; margin-top: 8px; }
.link-row input { flex: 1; font-size: 14px; background: #fff; }

.church-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.church-head h2 { margin: 2px 0 0; }
#churchEditForm { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.tag { display: inline-block; padding: 0 8px; border-radius: 99px; font-size: 12px; background: #eef1f4; color: var(--muted); }
.tag.final { background: var(--ok-bg); color: var(--ok); }
.tag.draft { background: var(--warn-bg); color: var(--warn); }

.howto { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.howto > div { background: #f8fafb; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.howto p { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
kbd { font: 12px/1 monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; background: #fff; color: var(--ink); }

/* 명단 표 */
.table-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.count { font-weight: 700; color: var(--brand); white-space: nowrap; }
.col-hint { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.table-scroll { overflow-x: auto; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 8px; }
table.sheet { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 15px; }
table.sheet th {
  background: #f1f4f7; font-size: 13px; font-weight: 600; color: var(--muted);
  text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.sheet td { border-bottom: 1px solid #edf0f3; border-right: 1px solid #edf0f3; padding: 0; }
table.sheet td.num { width: 38px; text-align: center; color: #9aa6b2; font-size: 12px; background: #fafbfc; }
table.sheet td.del { width: 38px; text-align: center; border-right: 0; }
table.sheet td input {
  width: 100%; border: 0; border-radius: 0; padding: 8px; font: inherit; background: transparent;
}
table.sheet td input:focus { outline: 2px solid #8fb3d6; outline-offset: -2px; background: #fff; }
table.sheet td.c-err input { background: var(--err-bg); }
table.sheet td.c-warn input { background: var(--warn-bg); }
.del-btn { border: 0; background: none; color: #a0aab4; font-size: 18px; cursor: pointer; line-height: 1; padding: 6px; }
.del-btn:hover { color: var(--err); }

.summary { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 15px; }
.summary b { color: var(--brand); }
.issues { margin: 0 0 12px; padding-left: 20px; font-size: 14px; }
.issues li.err { color: var(--err); }
.issues li.warn { color: var(--warn); }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; margin: 6px 0; }
.consent input { margin-top: 5px; width: 18px; height: 18px; flex: none; }
.privacy { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.privacy summary { cursor: pointer; }
.actions.sticky {
  position: sticky; bottom: 0; background: var(--card);
  padding: 12px 0 2px; border-top: 1px solid var(--line); margin-top: 8px;
}
.actions.sticky .msg { margin: 0 auto 0 0; }

.foot { border-top: 1px solid var(--line); padding: 18px 0 30px; font-size: 14px; color: var(--muted); }

@media (max-width: 640px) {
  .top h1 { font-size: 21px; }
  .panel { padding: 16px; }
  .grid-form { grid-template-columns: 1fr; }
}
