/* ───────── 디자인 토큰 ───────── */
:root {
  --bg: #f2f4f6;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --fill: #f2f4f6;
  --fill-strong: #e5e8eb;
  --line: #eceef1;
  --text: #191f28;
  --text-2: #4e5968;
  --text-3: #8b95a1;
  --accent: #3478f6;
  --accent-press: #2563dc;
  --accent-soft: #e8f1ff;
  --accent-text: #1b64da;
  --green: #12b76a;  --green-soft: #e3f8ee;
  --amber: #f5a524;  --amber-soft: #fff4dc;
  --red: #f04452;    --red-soft: #ffebed;
  --overlay: rgba(0, 12, 30, 0.42);
  --shadow-pop: 0 12px 40px rgba(0, 16, 48, 0.14), 0 2px 6px rgba(0, 16, 48, 0.06);
  --r-xl: 24px; --r-lg: 20px; --r-md: 14px; --r-sm: 10px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  /* 글꼴: Pretendard (한글·영문). Pretendard에 없는 몽골어 키릴 문자는
     Pretendard의 영문 바탕이 된 Inter로 자연스럽게 이어 받습니다. */
  --font: 'Pretendard Variable', Pretendard, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;

  /* 토스 디자인 시스템(TDS)과 같은 굵기 5단계 */
  --fw-light: 300;       /* Light    — 큰 보조 숫자, 단위, 입력 안내 */
  --fw-regular: 400;     /* Regular  — 본문, 보조 정보 */
  --fw-medium: 500;      /* Medium   — 라벨, 값, 살짝 강조 */
  --fw-semibold: 600;    /* Semibold — 이름, 버튼, 배지 */
  --fw-bold: 700;        /* Bold     — 제목, 핵심 숫자 */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101113;
    --surface: #1b1c1f;
    --surface-2: #222327;
    --fill: #26272b;
    --fill-strong: #303136;
    --line: #2a2b30;
    --text: #f2f3f5;
    --text-2: #b4b9c1;
    --text-3: #7e858f;
    --accent: #4b8bff;
    --accent-press: #6a9eff;
    --accent-soft: rgba(75, 139, 255, 0.16);
    --accent-text: #8db5ff;
    --green-soft: rgba(18, 183, 106, 0.16);
    --amber-soft: rgba(245, 165, 36, 0.16);
    --red-soft: rgba(240, 68, 82, 0.16);
    --overlay: rgba(0, 0, 0, 0.6);
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

/* ───────── 기본 ───────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.5; letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; }

/* ───────── 버튼 ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 18px; border: 0; border-radius: var(--r-md);
  font-weight: var(--fw-semibold); font-size: 15px; white-space: nowrap;
  transition: transform 0.16s var(--ease), background-color 0.2s, opacity 0.2s, box-shadow 0.2s;
}
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-press); }
.btn-soft { background: var(--accent-soft); color: var(--accent-text); }
.btn-gray { background: var(--fill); color: var(--text-2); }
.btn-gray:hover:not(:disabled) { background: var(--fill-strong); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--fill); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-lg { height: 54px; font-size: 16px; border-radius: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 12px; }
.btn .ic { width: 18px; height: 18px; }
.btn .spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── 입력 ───────── */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .field-label { font-size: 13px; font-weight: var(--fw-semibold); color: var(--text-2); }
.field .req { color: var(--accent); margin-left: 2px; }
.field .help { font-size: 12.5px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; height: 50px; padding: 0 16px; border: 1.5px solid transparent; border-radius: var(--r-md);
  background: var(--fill); font-size: 16px; outline: none;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.textarea { height: auto; min-height: 96px; padding: 14px 16px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%238b95a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input[type='date'] { min-width: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 14px; }
.form-grid .span2 { grid-column: span 2; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span2 { grid-column: auto; } }
.form-error { min-height: 20px; font-size: 13.5px; color: var(--red); font-weight: var(--fw-medium); }

/* 세그먼트(여러 개 중 하나 고르기) */
.segment { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: 12px; background: var(--fill); }
.segment button { position: relative; z-index: 1; height: 32px; padding: 0 12px; border: 0; background: none; border-radius: 9px; font-size: 13px; font-weight: var(--fw-semibold); color: var(--text-3); transition: color 0.25s; }
.segment button[aria-pressed='true'] { color: var(--text); }
.segment .thumb { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; border-radius: 9px; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,0.08); transition: transform 0.35s var(--ease-out), width 0.35s var(--ease-out); }
.segment.block { display: grid; width: 100%; }
.segment.block button { height: 42px; font-size: 14px; }

.choice-row { display: flex; gap: 8px; flex-wrap: wrap; }
.choice {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); font-size: 14px; font-weight: var(--fw-semibold); color: var(--text-2);
  transition: border-color 0.2s, background-color 0.2s, color 0.2s, transform 0.15s var(--ease);
}
.choice:active { transform: scale(0.97); }
.choice[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.choice .dot { width: 8px; height: 8px; border-radius: 50%; }

/* 칩(구역 필터) */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--fill);
  font-size: 14px; font-weight: var(--fw-semibold); color: var(--text-2); transition: background-color 0.2s, color 0.2s, transform 0.15s var(--ease);
}
.chip:active { transform: scale(0.95); }
.chip[aria-pressed='true'] { background: var(--text); color: var(--surface); }

/* ───────── 인증 화면 ───────── */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--r-xl); padding: 40px 32px 32px; animation: rise 0.6s var(--ease-out) both; }
.auth-top { position: fixed; top: 16px; right: 16px; }
.brand-mark { width: 48px; height: 48px; border-radius: 16px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: var(--fw-bold); font-size: 20px; margin-bottom: 24px; }
.auth h1 { font-size: 26px; font-weight: var(--fw-bold); letter-spacing: -0.03em; line-height: 1.3; }
.auth .desc { color: var(--text-2); margin-top: 8px; margin-bottom: 32px; white-space: pre-line; }
.auth form { display: flex; flex-direction: column; gap: 16px; }
.auth .foot { margin-top: 20px; font-size: 13px; color: var(--text-3); text-align: center; }
.notice { padding: 14px 16px; border-radius: var(--r-md); background: var(--amber-soft); color: var(--text); font-size: 14px; }
@media (max-width: 480px) { .auth-card { padding: 32px 22px 24px; border-radius: var(--r-lg); } }

/* ───────── 앱 껍데기 ───────── */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 12px;
  padding: 0 max(16px, calc((100vw - 1320px) / 2 + 24px));
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: var(--fw-bold); font-size: 17px; letter-spacing: -0.02em; border: 0; background: none; padding: 0; }
.topbar .brand .brand-mark { width: 32px; height: 32px; border-radius: 10px; font-size: 14px; margin: 0; }
.topbar .brand small { font-weight: var(--fw-medium); color: var(--text-3); font-size: 14px; margin-left: 2px; }
.topbar .spacer { flex: 1; }
.avatar-btn { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 6px 0 4px; border: 0; border-radius: 12px; background: none; transition: background-color 0.2s; }
.avatar-btn:hover { background: var(--fill); }
.avatar-btn .who { text-align: left; line-height: 1.2; }
.avatar-btn .who b { display: block; font-size: 14px; }
.avatar-btn .who span { font-size: 12px; color: var(--text-3); }
@media (max-width: 640px) { .avatar-btn .who, .topbar .brand small { display: none; } }

.page { max-width: 1320px; margin: 0 auto; padding: 8px 24px 48px; }
@media (max-width: 640px) { .page { padding: 4px 16px 96px; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 16px 0 20px; }
.page-head h1 { font-size: 28px; font-weight: var(--fw-bold); letter-spacing: -0.03em; }
.page-head p { color: var(--text-2); margin-top: 4px; }
@media (max-width: 640px) { .page-head h1 { font-size: 24px; } .page-head .btn-add { display: none; } }

/* 화면 전체 래퍼에는 애니메이션을 주지 않음: 조상에 transform·opacity 애니메이션이 있으면
   휴대폰 상세 화면(position: fixed)이 상단 바 아래에 갇혀 버리기 때문 */
.view-enter > .page-head, .view-enter > .card-list, .view-enter > .audit-list, .view-enter > .grid-2 { animation: rise 0.45s var(--ease-out) both; }
.list-panel { animation: rise 0.5s var(--ease-out) 0.12s both; }
@media (min-width: 961px) { .detail-panel { animation: rise 0.5s var(--ease-out) 0.18s both; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ───────── 요약 카드 ───────── */
.stats { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border-radius: var(--r-lg); padding: 20px 22px; animation: rise 0.5s var(--ease-out) both; }
.stat:nth-child(2) { animation-delay: 0.05s; } .stat:nth-child(3) { animation-delay: 0.1s; }
.stat .label { font-size: 14px; color: var(--text-2); font-weight: var(--fw-medium); }
.stat .value { font-size: 28px; font-weight: var(--fw-bold); letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 16px; font-weight: var(--fw-semibold); color: var(--text-2); margin-left: 2px; }
.salv-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--fill); margin: 14px 0 12px; gap: 2px; }
.salv-bar i { display: block; height: 100%; width: 0; transition: width 0.9s var(--ease-out); }
.salv-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.salv-legend button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: none; font-size: 13px; color: var(--text-2); transition: background-color 0.2s; }
.salv-legend button:hover { background: var(--fill); }
.salv-legend button[aria-pressed='true'] { background: var(--fill); color: var(--text); font-weight: var(--fw-semibold); }
.salv-legend b { font-variant-numeric: tabular-nums; color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.c1 { background: var(--green); } .c2 { background: var(--amber); } .c3 { background: var(--red); }
@media (max-width: 860px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat-salv { grid-column: span 2; }
  .stat { padding: 18px; }
  .stat .value { font-size: 24px; }
}

/* ───────── 성도 목록 + 상세 ───────── */
.split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { background: var(--surface); border-radius: var(--r-lg); }
.list-panel { padding: 20px 8px 8px; min-height: 480px; }
.list-tools { display: flex; flex-direction: column; gap: 12px; padding: 0 12px 12px; }
.search { position: relative; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 44px; height: 48px; }
.tool-row { display: flex; gap: 8px; align-items: center; }
.tool-row .select { height: 40px; font-size: 14px; border-radius: 12px; width: auto; flex: 1; min-width: 0; }
.list-meta { padding: 4px 12px 8px; font-size: 13px; color: var(--text-3); }

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 12px; border-radius: 16px; cursor: pointer; position: relative;
  transition: background-color 0.18s, transform 0.18s var(--ease);
}
.rows.anim .row { animation: rowIn 0.4s var(--ease-out) both; }
.sn { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: var(--fw-bold); }
.sn.s1 { background: var(--green-soft); color: var(--green); }
.sn.s2 { background: var(--amber-soft); color: var(--amber); }
.sn.s3 { background: var(--red-soft); color: var(--red); }
.role-opts { display: flex; flex-direction: column; gap: 8px; }
.role-opt {
  display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 14px 16px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--surface);
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s var(--ease);
}
.role-opt:active { transform: scale(0.985); }
.role-opt b { font-size: 15px; }
.role-opt span { font-size: 13px; color: var(--text-3); }
.role-opt[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
.role-opt[aria-pressed='true'] b { color: var(--accent-text); }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.row:hover { background: var(--surface-2); }
.row:active { transform: scale(0.985); background: var(--fill); }
.row[aria-selected='true'] { background: var(--accent-soft); }
.row .main { min-width: 0; }
.row .name { font-weight: var(--fw-semibold); font-size: 16px; display: flex; align-items: center; gap: 8px; }
.row .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .side { text-align: right; font-size: 13px; color: var(--text-3); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row .side .rel.old { color: var(--amber); font-weight: var(--fw-semibold); }
.row .side .rel.never { color: var(--text-3); }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: var(--fw-semibold); white-space: nowrap; background: var(--fill); color: var(--text-2); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.s1 { background: var(--green-soft); color: var(--green); }
.badge.s2 { background: var(--amber-soft); color: #c27c00; }
.badge.s3 { background: var(--red-soft); color: var(--red); }
@media (prefers-color-scheme: dark) { .badge.s2 { color: var(--amber); } }

.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-weight: var(--fw-bold); font-size: 17px; color: #fff; flex: none; overflow: hidden; background: var(--fill-strong); }
.avatar.lg { width: 72px; height: 72px; font-size: 28px; border-radius: 50%; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
img.avatar { background: var(--fill); }

.empty { text-align: center; color: var(--text-3); padding: 64px 16px; white-space: pre-line; }
.empty .ic { width: 40px; height: 40px; margin: 0 auto 12px; opacity: 0.5; }

.skeleton { border-radius: 8px; background: linear-gradient(90deg, var(--fill) 25%, var(--fill-strong) 37%, var(--fill) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* 상세 */
.detail-panel { position: sticky; top: 80px; max-height: calc(100dvh - 96px); overflow: auto; padding: 24px; scrollbar-width: thin; }
.detail-inner { animation: rise 0.42s var(--ease-out) both; }
.detail-mobile-bar { display: none; }
.profile { display: flex; gap: 16px; align-items: center; }
.profile .who { flex: 1; min-width: 0; }
.profile h2 { font-size: 24px; font-weight: var(--fw-bold); letter-spacing: -0.03em; }
.profile .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.profile-actions { display: flex; gap: 8px; margin-top: 20px; }
.profile-actions .btn { flex: 1; }

.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-head h3 { font-size: 17px; font-weight: var(--fw-bold); letter-spacing: -0.02em; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.kv dt { color: var(--text-3); white-space: nowrap; }
.kv dd { margin: 0; font-weight: var(--fw-medium); text-align: right; overflow-wrap: anywhere; }
.kv dd a { color: var(--accent-text); text-decoration: none; }
@media (max-width: 1100px) { .kv { grid-template-columns: 1fr; } }
.note-card { background: var(--surface-2); border-radius: var(--r-md); padding: 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; color: var(--text); }
.note-card.empty-note { color: var(--text-3); }

.timeline { display: flex; flex-direction: column; gap: 10px; }
.visit { border-radius: var(--r-md); padding: 16px; background: var(--surface-2); animation: rowIn 0.4s var(--ease-out) both; }
.visit-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.visit-date { font-weight: var(--fw-bold); font-size: 15px; }
.visit-meta { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.visit-actions { display: flex; gap: 2px; }
.visit-actions .btn-icon { width: 32px; height: 32px; border-radius: 9px; }
.visit-actions .ic { width: 16px; height: 16px; }
.visit .scripture { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; font-weight: var(--fw-semibold); color: var(--accent-text); }
.visit .scripture .ic { width: 14px; height: 14px; }
.visit .summary { margin-top: 8px; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.visit .prayer { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface); font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.visit .prayer b { display: block; font-size: 12px; color: var(--text-3); font-weight: var(--fw-semibold); margin-bottom: 4px; }
.placeholder { display: grid; place-items: center; text-align: center; min-height: 420px; color: var(--text-3); white-space: pre-line; }
.placeholder .ic { width: 44px; height: 44px; margin: 0 auto 14px; opacity: 0.45; }

/* 휴대폰: 상세 화면이 오른쪽에서 밀려 들어옴 */
@media (max-width: 960px) {
  .split { grid-template-columns: 1fr; }
  .list-panel { padding: 14px 4px 4px; }
  .detail-panel {
    position: fixed; inset: 0; z-index: 40; max-height: none; border-radius: 0; padding: 0 16px 40px;
    transform: translateX(100%); visibility: hidden; transition: transform 0.42s var(--ease-out), visibility 0s linear 0.42s;
    background: var(--surface);
  }
  .detail-panel.open { transform: none; visibility: visible; transition: transform 0.42s var(--ease-out), visibility 0s; }
  .detail-mobile-bar { display: flex; position: sticky; top: 0; z-index: 2; height: 56px; align-items: center; gap: 4px; margin: 0 -16px 8px; padding: 0 8px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
  .detail-mobile-bar .title { font-weight: var(--fw-semibold); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .detail-panel .placeholder { display: none; }
}

.fab {
  display: none; position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 35;
  width: 58px; height: 58px; border-radius: 20px; border: 0; background: var(--accent); color: #fff;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 45%, transparent);
  place-items: center; transition: transform 0.2s var(--ease);
}
.fab:active { transform: scale(0.92); }
.fab .ic { width: 26px; height: 26px; }
@media (max-width: 640px) { .fab { display: grid; } }

/* ───────── 관리자 화면 ───────── */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border-radius: var(--r-lg); padding: 20px 22px; animation: rise 0.45s var(--ease-out) both; }
.card h3 { font-size: 17px; font-weight: var(--fw-bold); letter-spacing: -0.02em; }
.card .desc { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.user-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.user-row .name { font-weight: var(--fw-semibold); font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-row .sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.user-row.inactive { opacity: 0.55; }
@media (max-width: 560px) { .user-row { grid-template-columns: 44px minmax(0, 1fr); } .user-row .actions { grid-column: 1 / -1; margin-top: 4px; } }

.audit-list { background: var(--surface); border-radius: var(--r-lg); padding: 8px 20px; }
.audit-item { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.audit-item:last-child { border-bottom: 0; }
.audit-item time { color: var(--text-3); font-variant-numeric: tabular-nums; }
.audit-item .what b { font-weight: var(--fw-semibold); }
.audit-item .what span { color: var(--text-2); }
.audit-item .what small { display: block; color: var(--text-3); margin-top: 2px; }
.audit-item.warn .what b { color: var(--red); }
@media (max-width: 560px) { .audit-item { grid-template-columns: 1fr; gap: 2px; } }

.progress { height: 8px; border-radius: 99px; background: var(--fill); overflow: hidden; margin-top: 14px; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s var(--ease-out); }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--fill); border-radius: 12px; padding: 4px; }
.stepper .btn-icon { width: 36px; height: 36px; background: var(--surface); border-radius: 9px; }
.stepper output { min-width: 48px; text-align: center; font-weight: var(--fw-bold); font-size: 17px; font-variant-numeric: tabular-nums; }
.temp-pw { display: flex; gap: 8px; }
.temp-pw .input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.02em; }

/* ───────── 대화상자 / 시트 ───────── */
dialog.sheet {
  width: min(560px, calc(100vw - 32px)); max-height: min(88dvh, 860px); padding: 0; border: 0; border-radius: var(--r-xl);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); overflow: hidden;
  animation: popIn 0.34s var(--ease-out) both;
}
dialog.sheet.small { width: min(400px, calc(100vw - 32px)); }
dialog.sheet::backdrop { background: var(--overlay); animation: fade 0.3s ease both; }
dialog.sheet.closing { animation: popOut 0.2s ease both; }
dialog.sheet.closing::backdrop { animation: fade 0.2s ease reverse both; }
@keyframes popIn { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes popOut { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
.sheet-form { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 24px 24px 8px; }
.sheet-head h2 { font-size: 20px; font-weight: var(--fw-bold); letter-spacing: -0.03em; }
.sheet-body { padding: 12px 24px 8px; overflow: auto; flex: 1; }
.sheet-body > p { color: var(--text-2); white-space: pre-line; }
.sheet-foot { display: flex; gap: 8px; padding: 16px 24px 24px; }
.sheet-foot .btn { flex: 1; height: 52px; font-size: 16px; }
.grabber { display: none; }
@media (max-width: 640px) {
  dialog.sheet, dialog.sheet.small {
    width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 24px 24px 0 0;
    animation: sheetUp 0.42s var(--ease-out) both;
  }
  dialog.sheet.closing { animation: sheetDown 0.24s ease both; }
  .grabber { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--fill-strong); margin: 10px auto 0; }
  .sheet-head { padding: 14px 20px 4px; }
  .sheet-body { padding: 12px 20px 8px; }
  .sheet-foot { padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); }
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetDown { to { transform: translateY(100%); } }

.photo-pick { display: flex; align-items: center; gap: 16px; }
.photo-pick .btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* 메뉴(팝오버) */
.menu {
  position: fixed; z-index: 60; min-width: 220px; padding: 8px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-pop);
  transform-origin: top right; animation: menuIn 0.24s var(--ease-out) both;
}
.menu.closing { animation: menuOut 0.15s ease both; }
@keyframes menuIn { from { opacity: 0; transform: scale(0.94) translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes menuOut { to { opacity: 0; transform: scale(0.96) translateY(-4px); } }
.menu .head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .head b { display: block; }
.menu .head span { font-size: 13px; color: var(--text-3); }
.menu button { display: flex; width: 100%; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: none; font-size: 15px; font-weight: var(--fw-medium); text-align: left; transition: background-color 0.15s; }
.menu button:hover { background: var(--fill); }
.menu button .ic { width: 20px; height: 20px; color: var(--text-3); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* 알림(토스트) */
.toasts { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 14px 20px; border-radius: 16px; background: #2b2f36; color: #fff; font-size: 15px; font-weight: var(--fw-medium); box-shadow: 0 10px 30px rgba(0,0,0,0.2); animation: toastIn 0.4s var(--ease-out) both; }
.toast.out { animation: toastOut 0.25s ease both; }
.toast .ic { width: 20px; height: 20px; flex: none; }
.toast.ok .ic { color: #3ddc97; } .toast.err .ic { color: #ff7b86; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

.ic { width: 20px; height: 20px; flex: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}

/* ───────── 타이포그래피 (토스 TDS 체계) ─────────
   크기·줄 간격은 TDS 단계(t1 30/40 · t2 26/35 · st5 24/33 · t4 20/29 · t5 17/25.5 · st10 16/24
   · t6 15/22.5 · st11 14/21 · t7 13/19.5 · st12 12/18)를 따르고, 굵기는 Light~Bold 5단계만 씁니다.
   Bold: 제목·핵심 숫자 / Semibold: 이름·버튼·배지 / Medium: 라벨·값 / Regular: 본문·보조 / Light: 큰 보조 숫자·단위 */
body { font-size: 15px; line-height: 22.5px; font-weight: var(--fw-regular); }
.brand-mark, .topbar .brand { font-weight: var(--fw-bold); }
.topbar .brand { font-size: 17px; line-height: 25.5px; }
.topbar .brand small { font-weight: var(--fw-regular); font-size: 13px; }
.auth h1, .page-head h1 { font-size: 26px; line-height: 35px; font-weight: var(--fw-bold); }
.auth .desc, .page-head p { font-size: 15px; line-height: 22.5px; font-weight: var(--fw-regular); }
.auth .foot { font-size: 13px; line-height: 19.5px; font-weight: var(--fw-regular); }
@media (max-width: 640px) { .page-head h1 { font-size: 24px; line-height: 33px; } }
.stat .label { font-size: 14px; line-height: 21px; font-weight: var(--fw-medium); }
.stat .value { font-size: 26px; line-height: 35px; font-weight: var(--fw-bold); }
@media (max-width: 860px) { .stat .value { font-size: 24px; line-height: 33px; } }
.stat .value small { font-size: 17px; font-weight: var(--fw-regular); }
.stat .pct { font-size: 30px; line-height: 40px; font-weight: var(--fw-light); letter-spacing: -0.03em; color: var(--text-3); font-variant-numeric: tabular-nums; }
.stat .pct small { font-size: 17px; font-weight: var(--fw-light); margin-left: 1px; }
.stat-salv .head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.profile h2 { font-size: 24px; line-height: 33px; font-weight: var(--fw-bold); }
.sheet-head h2 { font-size: 20px; line-height: 29px; font-weight: var(--fw-bold); }
.section-head h3, .card h3 { font-size: 17px; line-height: 25.5px; font-weight: var(--fw-bold); }
.section-head h3 .count { font-weight: var(--fw-regular); color: var(--text-3); margin-left: 4px; }
.row .name, .user-row .name { font-size: 16px; line-height: 24px; font-weight: var(--fw-semibold); }
.visit-date, .menu .head b, .avatar-btn .who b { font-weight: var(--fw-semibold); }
.btn, .chip, .choice, .segment button, .role-opt b { font-weight: var(--fw-semibold); }
.field > label, .field-label { font-size: 13px; line-height: 19.5px; font-weight: var(--fw-medium); }
.input, .select, .textarea { font-weight: var(--fw-regular); }
.input::placeholder, .textarea::placeholder { font-weight: var(--fw-regular); }
.kv > div { font-size: 15px; line-height: 22.5px; }
.kv dt { font-weight: var(--fw-regular); }
.kv dd { font-weight: var(--fw-medium); }
.row .sub, .user-row .sub, .visit-meta, .list-meta, .help { font-size: 13px; line-height: 19.5px; font-weight: var(--fw-regular); }
.row .side .rel { font-weight: var(--fw-regular); }
.row .side .rel.old { font-weight: var(--fw-semibold); }
.badge, .sn { font-size: 12px; font-weight: var(--fw-semibold); }
.visit .prayer b, .menu .head span, .avatar-btn .who span { font-weight: var(--fw-medium); }
.placeholder, .empty, .note-card.empty-note { font-weight: var(--fw-regular); }
.salv-legend button { font-weight: var(--fw-medium); }
.salv-legend b { font-weight: var(--fw-bold); }
.audit-item time { font-weight: var(--fw-regular); }
.audit-item .what b { font-weight: var(--fw-semibold); }
.stepper output { font-weight: var(--fw-bold); }
.toast { font-weight: var(--fw-medium); }

/* 두 언어 이름 */
.row .name .alt { font-size: 13px; font-weight: var(--fw-regular); color: var(--text-3); flex: none; }
.alt-name { margin-top: 2px; font-size: 15px; font-weight: var(--fw-medium); color: var(--text-3); }

/* 사진 영역 선택 */
.crop { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.crop-stage {
  position: relative; width: min(100%, 320px); aspect-ratio: 1; overflow: hidden; border-radius: 20px;
  background: #0d0f12; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
}
.crop-stage.dragging { cursor: grabbing; }
.crop-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; will-change: transform; pointer-events: none; -webkit-user-drag: none; }
.crop-mask { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(13, 15, 18, 0.55); pointer-events: none; outline: 2px solid rgba(255, 255, 255, 0.9); outline-offset: -2px; }
.crop-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.25s;
  background:
    linear-gradient(to right, transparent calc(33.33% - 0.5px), rgba(255,255,255,0.45) calc(33.33% - 0.5px), rgba(255,255,255,0.45) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px), transparent calc(66.66% - 0.5px), rgba(255,255,255,0.45) calc(66.66% - 0.5px), rgba(255,255,255,0.45) calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px)),
    linear-gradient(to bottom, transparent calc(33.33% - 0.5px), rgba(255,255,255,0.45) calc(33.33% - 0.5px), rgba(255,255,255,0.45) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px), transparent calc(66.66% - 0.5px), rgba(255,255,255,0.45) calc(66.66% - 0.5px), rgba(255,255,255,0.45) calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px));
}
.crop-stage.dragging .crop-grid { opacity: 1; }
.crop-zoom { display: flex; align-items: center; gap: 6px; width: min(100%, 320px); }
.crop-range { flex: 1; accent-color: var(--accent); height: 28px; }
.crop-help { text-align: center; font-weight: var(--fw-regular); }

/* 계정 층위 · 임원 권한 */
.role-opt { flex-direction: row; align-items: center; gap: 14px; }
.role-opt > div { display: flex; flex-direction: column; gap: 2px; }
.role-opt .tier { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--fill); color: var(--text-3); font-size: 13px; font-weight: var(--fw-bold); transition: background-color 0.2s, color 0.2s; }
.role-opt[aria-pressed='true'] .tier { background: var(--accent); color: #fff; }
.perm-list { display: flex; flex-direction: column; border-radius: var(--r-md); background: var(--surface-2); padding: 4px 16px; }
.perm { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; }
.perm:last-child { border-bottom: 0; }
.perm > div { display: flex; flex-direction: column; gap: 2px; }
.perm b { font-size: 15px; line-height: 22.5px; font-weight: var(--fw-semibold); }
.perm span { font-size: 13px; line-height: 19.5px; font-weight: var(--fw-regular); color: var(--text-3); }
.toggle { position: relative; flex: none; width: 46px; height: 28px; border-radius: 99px; background: var(--fill-strong); transition: background-color 0.25s var(--ease); }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.3s var(--ease-out); }
.perm[aria-checked='true'] .toggle { background: var(--accent); }
.perm[aria-checked='true'] .toggle::after { transform: translateX(18px); }
.badge.owner { background: var(--text); color: var(--surface); }

/* 교회 로고 */
.brand-logo { width: 32px; height: 32px; object-fit: contain; flex: none; display: block; }
.brand-logo.lg { width: 56px; height: 56px; margin-bottom: 20px; }

/* 회원가입 · 인증 코드 · 비밀번호 찾기 */
.auth-links { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; }
.auth-links .sep { width: 1px; height: 12px; background: var(--fill-strong); }
.link { border: 0; background: none; padding: 4px 2px; font-size: 14px; line-height: 21px; font-weight: var(--fw-medium); color: var(--text-2); border-radius: 6px; transition: color 0.2s; }
.link:hover:not(:disabled) { color: var(--accent-text); }
.link:disabled { color: var(--text-3); cursor: default; }
.back-link { display: inline-flex; align-items: center; gap: 2px; margin: -8px 0 16px -6px; color: var(--text-3); }
.back-link .ic { width: 18px; height: 18px; }
.notice.ok { background: var(--green-soft); }

.steps { display: flex; gap: 6px; list-style: none; margin: 0 0 24px; padding: 0; }
.steps li { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: 12px; line-height: 18px; font-weight: var(--fw-medium); color: var(--text-3); }
.steps li::before { content: ''; height: 4px; border-radius: 99px; background: var(--fill-strong); transition: background-color 0.4s var(--ease); }
.steps li.done::before, .steps li.now::before { background: var(--accent); }
.steps li.now { color: var(--text); font-weight: var(--fw-semibold); }
.steps li span { display: none; }

.code-input { height: 60px; text-align: center; font-size: 26px; font-weight: var(--fw-semibold); letter-spacing: 0.4em; font-variant-numeric: tabular-nums; padding-left: 0.4em; }
.code-input::placeholder { letter-spacing: 0.4em; color: var(--fill-strong); font-weight: var(--fw-regular); }
.code-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; line-height: 19.5px; }
.timer { color: var(--accent-text); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }

.done-card { text-align: center; }
.done-mark { width: 64px; height: 64px; margin: 8px auto 20px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green); animation: pop 0.5s var(--ease-out) both; }
.done-mark .ic { width: 32px; height: 32px; stroke-width: 2.5; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-desc { font-size: 14px; line-height: 21px; color: var(--text-2); margin: 0; }

.menu .head .mail { display: block; font-size: 12px; line-height: 18px; color: var(--text-3); margin-top: 2px; }
.menu button em.count { margin-left: auto; font-style: normal; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--red); color: #fff; font-size: 12px; font-weight: var(--fw-bold); display: inline-grid; place-items: center; }
.pending-card { box-shadow: inset 0 0 0 1.5px var(--amber-soft); }
