:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #dfe5ec;
  --navy: #173867;
  --navy-2: #24558c;
  --green: #38a351;
  --green-dark: #26753a;
  --green-soft: #edf8f0;
  --warning: #9a6700;
  --warning-soft: #fff7d6;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(31, 45, 72, .12);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
a { color: var(--navy-2); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }

.auth-page {
  background:
    radial-gradient(circle at top left, rgba(56,163,81,.12), transparent 36%),
    radial-gradient(circle at bottom right, rgba(36,85,140,.13), transparent 40%),
    var(--bg);
}
.mobile-auth-shell {
  min-height: 100vh;
  padding: max(24px, env(safe-area-inset-top)) 16px max(30px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
}
.mobile-auth-shell.wide { padding-top: 28px; padding-bottom: 44px; }
.mobile-auth-card {
  width: min(460px, 100%);
  overflow: hidden;
  border: 1px solid rgba(223,229,236,.94);
  border-radius: 26px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}
.mobile-auth-card.wide { width: min(720px, 100%); }
.integrated-brand {
  padding: 30px 30px 24px;
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
  border-bottom: 1px solid #edf1f5;
}
.integrated-brand.compact { padding-bottom: 20px; }
.church-logo {
  display: block;
  width: min(260px, 78vw);
  height: auto;
  margin: 0 auto 10px;
  object-fit: contain;
}
.service-kicker { margin-top: 2px; color: var(--green-dark); font-size: 13px; font-weight: 800; letter-spacing: .02em; }
.integrated-brand h1 { margin: 5px 0 8px; color: var(--navy); font-size: 30px; letter-spacing: -.045em; }
.integrated-brand p { max-width: 520px; margin: 0 auto; color: var(--muted); font-size: 14px; line-height: 1.65; }
.auth-content { padding: 26px 30px 30px; }
.auth-content h2 { margin: 0 0 7px; font-size: 24px; letter-spacing: -.035em; }
.subtext { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.65; }

.field { margin-bottom: 17px; }
.field label { display: block; margin-bottom: 8px; font-weight: 750; font-size: 14px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; border: 1px solid #cad4e0; border-radius: 13px;
  padding: 12px 14px; background: #fff; color: var(--ink); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(36,85,140,.12); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help { margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.primary-btn {
  width: 100%; min-height: 49px; border: 0; border-radius: 13px; padding: 13px 18px;
  background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: white; font-weight: 850;
  box-shadow: 0 9px 20px rgba(23,56,103,.18);
}
.primary-btn:hover { filter: brightness(.96); }
.primary-btn.compact-btn { width: auto; min-height: 42px; padding: 10px 18px; }
.secondary-btn { border: 1px solid var(--line); border-radius: 11px; padding: 10px 14px; background: white; color: var(--ink); font-weight: 750; }
.auth-menu { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 22px; color: #98a2b3; font-size: 14px; }
.auth-menu a { color: var(--navy); font-weight: 700; }
.auth-link { margin-top: 20px; text-align: center; color: var(--muted); font-size: 14px; }
.message { display: none; margin: 14px 0; padding: 12px 14px; border-radius: 11px; font-size: 14px; line-height: 1.55; }
.message.show { display: block; }
.message.error { background: #fff0ee; color: var(--danger); }
.message.success { background: var(--green-soft); color: #175c3d; }
.recovery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.recovery-panel { border: 1px solid var(--line); border-radius: 17px; padding: 20px; background: #fff; }
.recovery-grid > .auth-link { grid-column: 1 / -1; }

.topbar {
  min-height: 70px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line);
  padding: 9px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px);
}
.topbar-title { min-width: 0; display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 850; letter-spacing: -.03em; }
.topbar-title img { width: 118px; max-height: 45px; object-fit: contain; }
.user-area { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.dashboard { max-width: 1240px; margin: 0 auto; padding: 30px 24px 60px; }
.hero-card { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: white; border-radius: 22px; padding: 30px; display: flex; justify-content: space-between; gap: 20px; box-shadow: var(--shadow); }
.hero-card h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.045em; }
.hero-card p { margin: 0; color: rgba(255,255,255,.76); }
.status-chip { align-self: flex-start; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 8px 12px; font-size: 13px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 20px 0; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 17px; padding: 20px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 30px; font-weight: 850; margin-top: 10px; letter-spacing: -.04em; }
.content-grid { display: grid; grid-template-columns: 1.45fr .75fr; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.panel-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.panel-head h2 { margin: 0; font-size: 18px; }
.panel-body { padding: 18px 20px; }
.notice { padding: 15px 0; border-bottom: 1px solid #edf0f4; }
.notice:last-child { border-bottom: 0; }
.notice-title { font-weight: 800; margin-bottom: 6px; }
.notice-body { color: var(--muted); font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.notice-meta { margin-top: 8px; font-size: 12px; color: #98a2b3; }
.quick-list { display: grid; gap: 10px; }
.quick-item { display: block; padding: 14px; border-radius: 12px; background: #f7f9fc; border: 1px solid #e9edf3; color: var(--ink); }
.quick-item strong { display: block; margin-bottom: 4px; }
.quick-item span { color: var(--muted); font-size: 13px; }
.quick-link:hover { border-color: #b8c9da; transform: translateY(-1px); }
.quick-link.is-disabled { opacity: .58; cursor: not-allowed; }
.empty { color: var(--muted); text-align: center; padding: 34px 8px; }
.preview-badge { display: inline-flex; align-items: center; color: var(--warning); background: var(--warning-soft); padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }

.member-page { max-width: 1100px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 14px; }
.breadcrumb button { border: 0; background: none; padding: 0; color: var(--navy-2); }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.page-heading h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--muted); line-height: 1.6; }
.organization-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.organization-card {
  position: relative; min-height: 145px; border: 1px solid var(--line); border-radius: 18px; padding: 20px 48px 20px 20px;
  background: var(--surface); text-align: left; box-shadow: 0 8px 24px rgba(31,45,72,.05); color: var(--ink);
}
.organization-card:hover { border-color: #afc3d8; box-shadow: 0 12px 28px rgba(31,45,72,.09); transform: translateY(-1px); }
.organization-card strong { display: block; margin-bottom: 12px; font-size: 20px; }
.organization-card .organization-owner { display: block; margin-bottom: 14px; color: var(--green-dark); font-weight: 750; font-size: 14px; }
.organization-card small { color: var(--muted); }
.organization-card b { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); color: #98a2b3; font-size: 30px; font-weight: 400; }
.member-list-head { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.member-list { display: grid; gap: 10px; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.member-main { min-width: 0; display: grid; gap: 5px; }
.member-main strong { font-size: 17px; }
.member-main span { color: var(--muted); font-size: 13px; }
.call-button { flex: 0 0 auto; border-radius: 999px; padding: 10px 14px; background: var(--green-soft); color: var(--green-dark); font-weight: 800; white-space: nowrap; }
.member-dialog { width: min(680px, calc(100% - 28px)); border: 0; border-radius: 22px; padding: 0; box-shadow: var(--shadow); }
.member-dialog::backdrop { background: rgba(15,23,42,.48); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 22px 24px 15px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0 0 5px; }
.dialog-head p { margin: 0; color: var(--muted); font-size: 13px; }
.icon-btn { width: 38px; height: 38px; border: 0; border-radius: 10px; background: #f2f4f7; font-size: 25px; line-height: 1; }
.dialog-body { padding: 20px 24px 4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 22px; }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .organization-card-grid { grid-template-columns: 1fr 1fr; }
  .recovery-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .mobile-auth-shell { display: block; padding: 0; background: #fff; }
  .mobile-auth-card, .mobile-auth-card.wide { width: 100%; min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
  .integrated-brand { padding: max(25px, env(safe-area-inset-top)) 20px 20px; }
  .church-logo { width: min(245px, 78vw); margin-bottom: 8px; }
  .integrated-brand h1 { font-size: 27px; }
  .auth-content { padding: 23px 20px max(34px, env(safe-area-inset-bottom)); }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .recovery-panel { padding: 18px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .topbar { padding: 8px 14px; }
  .topbar-title img { width: 92px; }
  .topbar-title span { display: none; }
  .user-area span { display: none; }
  .dashboard { padding: 20px 14px 44px; }
  .hero-card { padding: 22px; flex-direction: column; }
  .hero-card h1 { font-size: 25px; }
  .stat-grid { gap: 10px; }
  .stat-card { padding: 15px; }
  .stat-value { font-size: 25px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading h1 { font-size: 26px; }
  .page-heading .compact-btn { width: 100%; }
  .organization-card-grid { grid-template-columns: 1fr; }
  .organization-card { min-height: 128px; }
  .member-list-head { display: block; line-height: 1.6; }
  .member-row { align-items: stretch; flex-direction: column; }
  .call-button { text-align: center; }
  .member-dialog { width: 100%; max-height: 92vh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  .dialog-body { max-height: 64vh; overflow: auto; }
  .dialog-actions { position: sticky; bottom: 0; background: #fff; }
}
.page-actions { display: flex; align-items: center; gap: 10px; }
.assignment-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.assignment-section h3 { margin: 0 0 12px; font-size: 16px; }
.assignment-list { display: grid; gap: 9px; }
.assignment-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; background: #f9fbfd; }
.assignment-row div { min-width: 0; display: grid; gap: 4px; }
.assignment-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assignment-row span { color: var(--muted); font-size: 12px; }
.danger-text-btn { flex: 0 0 auto; border: 0; background: #fff0ee; color: var(--danger); border-radius: 9px; padding: 8px 10px; font-weight: 750; }
@media (max-width: 600px) {
  .page-actions { width: 100%; }
  .page-actions > * { flex: 1; }
  .assignment-row { align-items: stretch; flex-direction: column; }
  .danger-text-btn { width: 100%; }
}

/* UMM v0.5: 신규회원·모바일 가입·단계형 회원관리 */
.registration-welcome {
  margin: 0 0 22px;
  padding: 16px 17px;
  border: 1px solid #cfe8d5;
  border-radius: 15px;
  background: var(--green-soft);
  color: #175c3d;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.7;
}
.register-single-column { max-width: 560px; margin: 0 auto; }
.register-single-column .field { width: 100%; }

.stat-link {
  position: relative;
  display: block;
  color: var(--ink);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.stat-link:hover {
  color: var(--ink);
  border-color: #aac2d9;
  box-shadow: 0 10px 26px rgba(31,45,72,.09);
  transform: translateY(-1px);
}
.stat-link.is-disabled { opacity: .62; pointer-events: none; }
.stat-period { margin-left: 4px; color: var(--green-dark); font-size: 11px; font-weight: 800; }
.stat-action { margin-top: 8px; color: var(--navy-2); font-size: 12px; font-weight: 800; }

.back-nav-button {
  margin: 0 0 16px;
  border: 1px solid #cfd9e5;
  border-radius: 11px;
  padding: 10px 14px;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
}
.back-nav-button:hover { border-color: #9fb7ce; background: #f8fbfe; }

.member-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.member-manage-button {
  border: 1px solid #cbd7e3;
  border-radius: 999px;
  padding: 9px 13px;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
  white-space: nowrap;
}
.member-manage-button:hover { border-color: #94aec7; background: #f6f9fc; }
.call-button { min-width: 108px; text-align: center; }

@media (max-width: 600px) {
  .registration-welcome { margin-bottom: 20px; }
  .stat-action { margin-top: 5px; }
  .back-nav-button { width: 100%; }
  .member-actions { width: 100%; display: grid; grid-template-columns: 1fr; }
  .member-manage-button, .call-button { width: 100%; text-align: center; }
}
