@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard-dynamic-subset.css');

:root {
  /* KNOCK(노크전도운동) 공식 브랜드 컬러 — 로고 파일(app/static/logo.png)에서
     실제 픽셀값을 추출한 정확한 색상(#e9462b)을 기준으로 파생했다. */
  --bg: #faf6f5;
  --panel: #ffffff;
  --panel-alt: #fdf3f2;
  --ink: #201613;
  --ink-soft: #4a3733;
  --muted: #8a7672;
  --line: #ecdedb;
  --line-strong: #e0cbc7;
  --accent: #e9462b;
  --accent-strong: #a8321f;
  --accent-soft: #fdecea;
  --accent-soft-strong: #fad6d0;
  --ok: #3f7d54;
  --ok-soft: #e7f2ea;
  --danger: #c1503a;
  --danger-soft: #fbeee9;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(33, 31, 27, 0.05);
  --shadow: 0 6px 20px rgba(33, 31, 27, 0.07);
  --shadow-lg: 0 16px 40px rgba(33, 31, 27, 0.14);
  --ease: cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior-y: none;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft-strong); color: var(--accent-strong); }

/* ---- 아이콘 ---- */
.icon {
  display: inline-block; width: 1em; height: 1em; vertical-align: -0.15em;
  stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none;
  flex-shrink: 0;
}

/* ---- 상단바 ---- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 14px 28px;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--accent-strong);
  text-decoration: none;
  white-space: nowrap;
}
.brand img { height: 26px; width: auto; flex-shrink: 0; }

.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-left: auto; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  color: var(--ink-soft); cursor: pointer; padding: 0;
}
.nav-toggle .icon { width: 20px; height: 20px; }
.nav-toggle:hover { background: var(--accent-soft); border-color: var(--accent-soft-strong); color: var(--accent-strong); }

.topbar-menu { display: contents; }

.topbar nav { display: flex; flex-wrap: wrap; gap: 2px; }
.topbar nav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.topbar nav a .icon { color: var(--muted); transition: color .15s var(--ease); }
.topbar nav a.active, .topbar nav a:hover { background: var(--accent-soft); color: var(--accent-strong); }
.topbar nav a.active .icon, .topbar nav a:hover .icon { color: var(--accent); }

.quick-search { margin-left: auto; position: relative; }
.quick-search input {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px 8px 34px;
  width: 240px;
  max-width: 100%;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c8574' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 12px center;
  background-size: 15px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.quick-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.container { max-width: 1600px; width: 94%; margin: 0 auto; padding: 32px 0 56px; }
.back-btn { margin-bottom: 16px; }

h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.015em; margin: 0 0 16px; }
h2 { font-size: 14px; font-weight: 700; margin: 0 0 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
h2 a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.muted { color: var(--muted); font-weight: 400; font-size: 0.85em; }
.label { color: var(--muted); font-size: 12px; margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

p { line-height: 1.7; }

/* ---- 교구/부서 카드 ---- */
.parish-overview { margin-bottom: 24px; }
.parish-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.parish-card {
  display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  text-decoration: none; color: var(--ink); background: var(--panel); box-shadow: var(--shadow-sm);
  transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.parish-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.parish-card.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.parish-card.newfamily { border-color: #c7dccb; background: var(--panel); }
.parish-card.newfamily .parish-card-name { color: var(--ok); }
.parish-card.newfamily.active { background: var(--ok-soft); border-color: var(--ok); }
.parish-card-name { font-weight: 700; color: var(--accent); font-size: 13px; margin-bottom: 8px; letter-spacing: -.01em; }
.parish-card-num { font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

/* ---- 새가족부: 연도별 등록 막대그래프 ---- */
.bar-chart {
  display: flex; align-items: flex-end; gap: 14px; height: 200px; padding: 8px 4px 0;
  overflow-x: auto;
}
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1; min-width: 44px; height: 100%; }
.bar-value { font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { width: 100%; max-width: 46px; background: linear-gradient(180deg, var(--accent), var(--accent-strong)); border-radius: 8px 8px 0 0; min-height: 2px; transition: opacity .15s; }
.bar-col:hover .bar { opacity: .85; }
.bar-label { margin-top: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.stat-card.accent { border-color: var(--accent); }
.stat-card.warn { border-color: #e3c4b8; background: var(--danger-soft); }
.stat-num { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 6px; font-weight: 500; }

a.stat-link {
  display: block; text-decoration: none; color: inherit; transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
a.stat-link:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.two-col > * { min-width: 0; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.warn-panel { border-color: #e3c4b8; background: var(--danger-soft); }
.leader-panel { margin-bottom: 16px; }
.leader-panel .inline-form { margin-bottom: 6px; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini-table td, .mini-table th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }

.data-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.data-table th {
  text-align: left; background: var(--panel-alt); color: var(--ink-soft);
  font-size: 11.5px; padding: 12px 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}
.data-table td { padding: 12px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.data-table tbody tr { transition: background .1s var(--ease); }
.data-table tbody tr:hover { background: var(--panel-alt); cursor: pointer; }
.name-cell { font-weight: 700; }

.wide-table th, .wide-table td { padding: 12px 10px; vertical-align: top; }
.wide-table td.photo-cell, .wide-table td.name-cell { padding-top: 14px; }

.kv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 7px 8px 7px 0; width: 90px; vertical-align: top; }
.kv-table td { padding: 7px 0; }

.list { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.list a { color: var(--accent); text-decoration: none; font-weight: 600; }
.list a:hover { text-decoration: underline; }
.wrap-list li { word-break: break-word; line-height: 1.6; }

.prayer-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.prayer-list li.done span:first-child { text-decoration: line-through; color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-shrink: 0; }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-alt); color: var(--ink-soft); border: 1px solid var(--line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent-soft-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.btn.danger:hover { background: #f6ddd5; border-color: #f0c8bb; }
.btn.small { padding: 5px 11px; font-size: 12.5px; }
/* 신청서 폼의 "교회 주소와 동일" 같은 보조 액션 버튼: 흰 배경이라 눈에 잘
   안 띄던 것을 브랜드 소프트 컬러로 채워 존재감을 준다. */
.btn.helper {
  width: 100%; justify-content: center; padding: 12px 16px; min-height: 44px;
  background: var(--accent-soft); border: 1.5px solid var(--accent-soft-strong);
  color: var(--accent-strong); font-weight: 700;
}
.btn.helper:hover { background: var(--accent-soft-strong); }
.btn.large {
  padding: 16px 26px; font-size: 18px; font-weight: 800; min-height: 56px;
  border-radius: var(--radius); width: 100%; justify-content: center;
}

.filter-bar { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); font-size: 14px; font-family: inherit;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.district-switch {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); font-size: 14px;
  color: var(--ink); font-family: inherit; font-weight: 600;
}

.inline-form { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.inline-form input { padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; }
.inline-form .grow { flex: 1; min-width: 180px; }

.form-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; display: flex; flex-direction: column; gap: 16px; max-width: 560px;
  box-shadow: var(--shadow-sm);
}
.form-card label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--ink-soft); font-weight: 700; }
.form-card input, .form-card select, .form-card textarea {
  padding: 13px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); font-size: 16px; font-family: inherit; color: var(--ink); font-weight: 400;
  min-height: 48px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.form-card textarea { min-height: 0; }
.form-card input:focus, .form-card select:focus, .form-card textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-row { display: flex; gap: 12px; }
.form-row label { flex: 1; }
.form-actions { display: flex; gap: 8px; margin-top: 6px; }
.form-card input[readonly] { background: var(--bg); color: var(--muted); cursor: default; }

/* ---- 정산 폼: 위드노크 정산서를 보고 직접 입력하는 칸 강조 ---- */
.auto-meta-row { display: flex; gap: 20px; font-size: 13px; color: var(--muted); }
.auto-meta-row b { color: var(--ink); font-weight: 700; }
.vendor-field {
  background: var(--accent-soft); border: 1.5px solid var(--accent-soft-strong);
  border-radius: var(--radius-sm); padding: 12px 14px 14px;
}
.vendor-field input { background: var(--panel); }
.vendor-badge {
  display: inline-block; font-size: 11px; font-weight: 700; color: var(--accent-strong);
  background: var(--panel); border: 1px solid var(--accent-soft-strong);
  padding: 2px 8px; border-radius: 999px; margin-left: 6px; text-transform: none;
  vertical-align: middle;
}

/* ---- 정산 목록: 연월 클릭 시 뜨는 읽기전용 상세 모달 ---- */
.settlement-month-link { cursor: pointer; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-weight: 700; }
.settlement-modal-inner {
  width: 640px; max-width: calc(100vw - 32px); height: auto; max-height: calc(100vh - 32px);
  overflow-y: auto; align-items: stretch;
}
.settlement-modal-inner .form-card { box-shadow: none; border: none; padding: 0; gap: 14px; }
.settlement-modal-inner textarea { min-height: 60px; }
.section-label {
  font-weight: 700; margin: 14px 0 0; color: var(--accent); font-size: 13px;
  text-transform: uppercase; letter-spacing: .05em;
}

/* 필수 항목 표시: 40대 이상 사용자도 한눈에 알아보도록 진한 빨강 + 굵게 */
.req { color: var(--danger); font-weight: 800; }

.raw-block { margin-top: 20px; }
.raw-block summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.raw-block pre, details pre {
  white-space: pre-wrap; background: var(--panel-alt); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px; font-size: 13px; margin-top: 8px; line-height: 1.6;
}

/* ---- 사진 ---- */
.identity-row { display: flex; align-items: center; gap: 18px; }
.photo-upload-widget { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.member-photo {
  width: 120px; height: 120px; border-radius: var(--radius-lg); object-fit: cover; border: 1px solid var(--line);
  background: var(--accent-soft); box-shadow: var(--shadow-sm);
}
img.member-photo { cursor: zoom-in; transition: transform .15s var(--ease); }
img.member-photo:hover { transform: scale(1.02); }
.member-photo.placeholder {
  display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 800; color: var(--accent);
}
.photo-actions { display: flex; gap: 6px; }
.photo-pick-btn { cursor: pointer; }

.thumb { width: 48px; height: 48px; border-radius: var(--radius-sm); object-fit: cover; border: 1px solid var(--line); }
.thumb.placeholder {
  display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent);
  font-size: 18px; font-weight: 800;
}
.photo-cell { width: 58px; }

/* ---- 좁은 화면에서 표 가로 스크롤 ----
   overflow-x:auto만 쓰면 브라우저/OS에 따라 스크롤바가 아예 안 보이거나
   (오버레이 스크롤바), 터치 드래그가 세로 스크롤에 먹혀서 가로로 못 넘기는
   경우가 있어 화면이 짤려 보인다는 문의가 있었음. 스크롤바를 항상 보이게
   하고 가로 터치 제스처를 명시적으로 허용해서 어떤 브라우저에서도 가로
   스크롤이 가능하고, 스크롤 가능하다는 게 눈에 보이게 한다. */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
  scrollbar-width: auto;
  scrollbar-color: var(--muted) var(--bg);
}
.table-scroll::-webkit-scrollbar { height: 12px; }
.table-scroll::-webkit-scrollbar-track { background: var(--bg); }
.table-scroll::-webkit-scrollbar-thumb {
  background: var(--muted); border-radius: 6px; border: 2px solid var(--bg);
}
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.table-scroll .data-table { min-width: 560px; }
.table-scroll .wide-table { min-width: 920px; }

/* ---- 새가족부: 양육현황 표 ---- */
.table-scroll .progress-table { min-width: 1550px; }
.progress-table .row-actions { white-space: nowrap; }
.cell-input {
  width: 100%; min-width: 70px; padding: 6px 7px; border: 1px solid var(--line);
  border-radius: 6px; font-size: 13px; font-family: inherit; color: var(--ink); background: var(--panel);
  transition: border-color .15s var(--ease);
}
.cell-input:focus { outline: none; border-color: var(--accent); }
.cell-input:disabled { background: var(--bg); color: var(--muted); }
.cell-narrow { min-width: 52px; }
.cell-phone { min-width: 130px; }
.cell-nowrap { white-space: nowrap; }
.birth-cell { display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; }
.birth-cell input[type="text"] { flex: 1 1 92px; min-width: 92px; }
.birth-cell input.birth-picker { flex: 0 0 40px; min-width: 40px; width: 40px; padding: 5px 2px; }

/* ---- 목록 표 확장(상황노트/기도제목) ---- */
.wide-table { table-layout: fixed; }
.wrap-cell {
  font-size: 14px; color: var(--ink); white-space: normal; word-break: break-word;
  overflow-wrap: break-word; line-height: 1.6; vertical-align: top;
}

/* ---- 엑셀/워드 다운로드-업로드 바 ---- */
.export-import-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.export-links { display: flex; gap: 8px; }
.upload-form { display: flex; align-items: center; gap: 8px; }
.upload-form input[type=file] { font-size: 13px; max-width: 220px; }

.flash { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 15px; margin: 0 0 16px; font-weight: 700; line-height: 1.5; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-notify { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }

/* ---- 등록 폼: 예배 체크박스 / 주소검색 ---- */
.checkbox-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: -4px; }
.checkbox-pill {
  display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: 999px;
  padding: 12px 18px; font-size: 16px; font-weight: 600; color: var(--ink); cursor: pointer;
  min-height: 48px;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.checkbox-pill:hover { border-color: var(--accent-soft-strong); background: var(--accent-soft); }
.checkbox-pill:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.checkbox-pill input { accent-color: var(--accent); width: 18px; height: 18px; }

.family-rows { display: flex; flex-direction: column; gap: 8px; margin-top: -4px; }
.family-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.family-row input[type=text] {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; flex: 1; min-width: 90px;
}
.checkbox-inline { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
.checkbox-inline input { accent-color: var(--accent); width: 20px; height: 20px; }
.address-row { display: flex; gap: 8px; }
.address-row input { flex: 1; min-width: 0; background: var(--panel-alt); }
.hint { font-size: 12px; color: var(--muted); margin: -8px 0 4px; }

.postcode-modal {
  display: none; position: fixed; inset: 0; background: rgba(33,31,27,.55);
  align-items: center; justify-content: center; z-index: 100;
}
.postcode-modal.show { display: flex; }
.postcode-modal-inner {
  background: #fff; border-radius: var(--radius); padding: 14px; width: 420px; max-width: calc(100vw - 32px); height: 480px; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-lg);
}
.postcode-close { align-self: flex-end; }
#postcode-layer { flex: 1; }

.move-btn { vertical-align: middle; margin-left: 6px; }
.move-modal-inner { height: auto; width: 380px; max-width: calc(100vw - 32px); }
.confirm-modal-inner { height: auto; width: 320px; max-width: calc(100vw - 32px); text-align: center; }
.confirm-modal-inner .form-actions { justify-content: center; }

.photo-lightbox {
  display: none; position: fixed; inset: 0; background: rgba(20,18,15,.88);
  align-items: center; justify-content: center; z-index: 200; cursor: zoom-out;
  padding: 24px;
}
.photo-lightbox.show { display: flex; }
.photo-lightbox img {
  max-width: 100%; max-height: 100%; border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.move-form { padding: 4px 0 0; border: none; }
.move-form .form-actions { margin-top: 4px; }

/* ---- 대시보드 등록 버튼 ---- */
.btn-icon { display: inline-flex; align-items: center; gap: 6px; }
.plus-icon { font-size: 16px; font-weight: 700; }

/* ---- 신청 현황 조회: 진행 단계 스테퍼 ---- */
.stepper { display: flex; align-items: flex-start; margin: 24px 0 8px; }
.stepper-step { display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; }
.stepper-dot {
  width: 34px; height: 34px; border-radius: 50%; background: var(--panel-alt); border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; color: var(--muted);
  flex-shrink: 0; z-index: 1;
}
.stepper-line { position: absolute; top: 17px; left: 50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.stepper-step:last-child .stepper-line { display: none; }
.stepper-label { margin-top: 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.3; }
.stepper-step.done .stepper-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper-step.done .stepper-line { background: var(--accent); }
.stepper-step.current .stepper-dot { background: var(--panel); border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stepper-step.current .stepper-label { color: var(--accent-strong); }
.stepper-step.done .stepper-label { color: var(--ink-soft); }
a.stepper-step { text-decoration: none; cursor: pointer; }
a.stepper-step:hover .stepper-dot { box-shadow: 0 0 0 4px var(--accent-soft); }

/* ---- 대시보드 막대 그래프(세로형: 가로축=세부항목, 세로축=건수/비율) ----
   grid-template-columns를 항목 수만큼 균등 분할해 화면 폭에 맞춰 자동으로
   줄어들게 해서, 항목이 많아도 스크롤 없이 한눈에 다 보이게 한다. */
.col-chart { display: grid; align-items: end; column-gap: 4px; height: 210px; padding: 6px 2px 0; }
.col-chart-item {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  min-width: 0; height: 100%; text-decoration: none; color: inherit;
  border-radius: 8px; padding: 4px 1px 6px; transition: background .12s;
}
.col-chart-item:hover { background: var(--accent-soft); }
.col-chart-value {
  font-size: 11px; font-weight: 800; color: var(--ink-soft); text-align: center; line-height: 1.25;
  margin-bottom: 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.col-chart-pct { display: block; font-size: 9.5px; font-weight: 600; color: var(--muted); }
.col-chart-track {
  width: 60%; max-width: 30px; flex: 1; display: flex; align-items: flex-end;
  background: var(--panel-alt); border-radius: 6px 6px 2px 2px; overflow: hidden;
}
.col-chart-bar { width: 100%; height: var(--pct, 0%); min-height: 3px; background: linear-gradient(180deg, var(--accent), var(--accent-strong)); border-radius: 6px 6px 0 0; }
.col-chart-label {
  margin-top: 8px; font-size: 10.5px; font-weight: 700; color: var(--muted); text-align: center;
  line-height: 1.25; max-width: 100%; overflow-wrap: break-word;
}

/* 항목이 많은 세로 막대그래프는 폰(≤640px)에서는 칸이 너무 좁아져 숫자가
   잘려 보이므로, 가로 막대 목록(라벨-막대-수치 한 줄)으로 전환해 페이지를
   따라 세로로 스크롤하며 모두 읽을 수 있게 한다. */
@media (max-width: 640px) {
  .col-chart { display: flex; flex-direction: column; height: auto; gap: 6px; padding: 4px 0; }
  .col-chart-item {
    flex-direction: row; align-items: center; justify-content: flex-start;
    width: 100%; height: auto; gap: 10px; padding: 9px 8px; min-height: 44px;
  }
  .col-chart-label {
    order: 1; margin-top: 0; width: 74px; max-width: 74px; flex-shrink: 0; text-align: left;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .col-chart-track { order: 2; width: auto; max-width: none; height: 14px; flex: 1; align-items: stretch; }
  .col-chart-bar { width: var(--pct, 0%); height: 100%; border-radius: 7px; }
  .col-chart-value {
    order: 3; margin-bottom: 0; width: auto; max-width: none; flex-shrink: 0;
    white-space: nowrap; font-size: 12.5px; text-align: right;
  }
  .col-chart-pct { display: inline; margin-left: 4px; font-size: 11px; }
}

/* ---- 대시보드: 800만 전도카드 발행 목표 ---- */
.goal-panel {
  display: block; text-decoration: none; color: inherit; margin-bottom: 16px;
  transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.goal-panel:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.goal-numbers { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.goal-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.goal-current { font-size: 26px; font-weight: 800; color: var(--accent-strong); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.goal-target { font-size: 14px; font-weight: 600; color: var(--muted); }
.goal-pct { margin-left: auto; font-size: 18px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.goal-track { width: 100%; height: 16px; background: var(--panel-alt); border-radius: 999px; overflow: hidden; }
.goal-fill { height: 100%; min-width: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-strong)); border-radius: 999px; transition: width .3s var(--ease); }

/* ---- 대시보드 원그래프 ---- */
.pie-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.pie-chart {
  width: 150px; height: 150px; border-radius: 50%; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px var(--line);
}
.pie-legend { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 200px; }
.pie-legend-item {
  display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit;
  padding: 5px 6px; border-radius: 7px; transition: background .12s;
}
.pie-legend-item:hover { background: var(--accent-soft); }
.pie-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.pie-legend-label {
  flex: 1; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pie-legend-count { font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
@media (max-width: 480px) {
  .pie-wrap { gap: 14px; }
  .pie-chart { width: 120px; height: 120px; }
}

.status-banner {
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; text-align: center;
  font-weight: 800; font-size: 17px;
}
.status-banner.hold { background: var(--danger-soft); color: var(--danger); }
.status-banner.done { background: var(--ok-soft); color: var(--ok); }

@media (max-width: 480px) {
  .stepper-label { font-size: 10.5px; }
  .stepper-dot { width: 28px; height: 28px; font-size: 12px; }
  .stepper-line { top: 14px; }
}

/* ---- 로그인 ---- */
.login-body {
  background: radial-gradient(circle at 20% 20%, var(--accent-soft), transparent 45%), var(--bg);
  display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0;
}
.login-wrap { width: 100%; max-width: 380px; padding: 20px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 36px 32px; box-shadow: var(--shadow-lg); }
.login-title { font-size: 22px; font-weight: 800; letter-spacing: -.01em; color: var(--accent-strong); margin: 0 0 4px; text-align: center; }
.login-card > .muted { text-align: center; margin-bottom: 20px; display: block; }
.login-form { border: none; padding: 0; }
.login-form .form-actions { justify-content: stretch; }
.login-form .form-actions .btn { flex: 1; text-align: center; justify-content: center; }

/* ---- 상단바 사용자 영역 ---- */
.user-box { display: flex; align-items: center; gap: 10px; margin-left: 12px; font-size: 13px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.user-box form { display: inline; }
.user-box button { display: inline-flex; align-items: center; gap: 4px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; font-family: inherit; padding: 0; transition: color .15s var(--ease); }
.user-box button:hover { color: var(--danger); }
.role-badge { background: var(--accent-soft); color: var(--accent-strong); padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }

/* ---- 모바일(스마트폰) 화면 대응 ---- */
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; gap: 8px 16px; }
  .brand { font-size: 16px; }
  .nav-toggle { display: flex; }

  /* 메뉴(대시보드/신청교회/... + 검색 + 계정)는 기본적으로 접혀 있다가
     햄버거 버튼을 누르면 브랜드 줄 아래로 펼쳐지게 한다. 스마트폰에서
     매번 6개 메뉴 + 검색창이 화면 절반을 차지하던 문제를 없앤다. */
  .topbar-menu { display: none; flex-direction: column; align-items: stretch; width: 100%; gap: 10px; }
  .topbar-menu.open { display: flex; }
  .topbar nav { flex-direction: column; gap: 2px; width: 100%; }
  .topbar nav a { width: 100%; padding: 10px 12px; }
  .topbar nav a span.nav-label { display: inline; }
  .quick-search { order: 0; margin-left: 0; width: 100%; }
  .quick-search input { width: 100%; }
  .user-box { margin-left: 0; width: 100%; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line); }

  .container { width: 100%; padding: 20px 16px 40px; }
  h1 { font-size: 19px; }

  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head .actions { width: 100%; flex-direction: column; }
  .page-head .actions .btn { width: 100%; text-align: center; justify-content: center; }

  .identity-row { flex-wrap: wrap; }

  /* 로그인/신청서/조회 페이지: login-wrap > login-card > form-card가 겹겹이
     좌우 padding을 갖고 있어(20px+32px+18px=70px씩) 폰에서 입력창이
     375px 화면 기준 231px로 좁게 보이는 문제를 줄인다. */
  .login-wrap { padding: 12px; }
  .login-card { padding: 22px 14px; }
  .form-card { padding: 16px; }
  .form-row { flex-direction: column; gap: 14px; }
  .address-row { flex-wrap: wrap; }
  .address-row input { min-width: 0; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  .export-import-bar { flex-direction: column; align-items: flex-start; }
  .upload-form { flex-wrap: wrap; }
  .upload-form input[type=file] { max-width: 100%; }
}

/* ---- 등록번호 구간 인쇄 ---- */
.print-range {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.print-range label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.print-range input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; width: 90px; font-family: inherit; }

.print-only-table { display: none; }

@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; }
  .topbar, .back-btn, .no-print, .flash, .filter-bar, .page-head .actions,
  .form-actions, .print-picker-modal, .actions form { display: none !important; }
  .container { width: 100%; max-width: none; padding: 0; }
  .panel { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .table-scroll { overflow: visible !important; }
  .table-scroll::-webkit-scrollbar { display: none; }
  .data-table, .wide-table, .mini-table, .kv-table { box-shadow: none; }
  .data-table th, .data-table td { font-size: 10pt; padding: 6px 8px; }
  .data-table tbody tr:hover { background: none; }
  h1 { font-size: 16pt; }
  h2 { font-size: 10pt; }
  a { color: inherit !important; text-decoration: none !important; }
  .stat-grid { break-inside: avoid; }
  .no-print-col { display: none !important; }
}

/* ---- 항목 선택 인쇄: 공통 모달 ---- */
.print-picker-modal {
  display: none; position: fixed; inset: 0; background: rgba(33,31,27,.55);
  align-items: center; justify-content: center; z-index: 150;
}
.print-picker-modal.show { display: flex; }
.print-picker-inner {
  background: #fff; border-radius: var(--radius); padding: 22px; width: 420px;
  max-width: calc(100vw - 32px); max-height: calc(100vh - 64px); overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.print-picker-inner h3 { margin: 0 0 4px; font-size: 16px; }
.print-picker-inner p.muted { margin: 0 0 14px; }
.print-picker-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.print-picker-list label {
  display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 6px; font-size: 14px; cursor: pointer;
}
.print-picker-list label:hover { background: var(--panel-alt); }
.print-picker-list input { accent-color: var(--accent); width: 17px; height: 17px; }
.print-picker-toggle-all { font-size: 12.5px; color: var(--accent); text-decoration: underline; cursor: pointer; background: none; border: none; padding: 0; font-family: inherit; }
