/* 색상·타이포·라운드·스페이싱 토큰은 DESIGN.md(getdesign "meta" 테마)에서 가져와
   관리자 화면(표+입력폼) 맥락에 맞게 적용함 — 원본은 마케팅 사이트용 필(pill) 버튼/
   화려한 카드 위주라, 여기서는 색상·간격·둥근 정도 체계만 취하고 컴포넌트는
   첨부 참고 이미지(인보이스 리스트형 관리자 화면)에 맞춰 새로 구성함. */
:root {
  --primary: #0064e0;
  --primary-deep: #0457cb;
  --on-primary: #ffffff;
  --canvas: #ffffff;
  --surface-soft: #f1f4f7;
  --ink: #1c1e21;
  --charcoal: #444950;
  --steel: #5d6c7b;
  --stone: #8595a4;
  --hairline: #ced0d4;
  --hairline-soft: #dee3e9;
  --success: #31a24c;
  --warning: #f7b928;
  --critical: #e41e3f;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 16px;
  --radius-full: 100px;

  --space-xs: 8px;
  --space-sm: 10px;
  --space-md: 12px;
  --space-base: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-xxl: 32px;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  min-height: 100vh;
  background: var(--surface-soft);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* ===== 상단: 로고 + 메뉴 + 프로필 ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  height: 60px;
  padding: 0 var(--space-xl);
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline-soft);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  white-space: nowrap;
}
.topbar-logo .mark {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.topbar-spacer {
  flex: 1;
}
.topbar-hamburger {
  display: inline-flex;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--canvas);
  color: var(--steel);
  cursor: pointer;
}
.topbar-hamburger:hover {
  background: var(--surface-soft);
  color: var(--ink);
}
.topbar-menu {
  display: none;
  position: absolute;
  top: 52px;
  right: var(--space-xl);
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 180px;
  background: var(--canvas);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  box-shadow: 0 12px 30px rgba(10, 19, 23, 0.15);
  z-index: 30;
}
.topbar-menu.open {
  display: flex;
}
.topbar-menu button {
  border: none;
  background: none;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: var(--steel);
}
.topbar-menu button:hover {
  background: var(--surface-soft);
}
.topbar-menu button.active {
  background: var(--primary);
  color: #fff;
}
.topbar-menu-divider {
  height: 1px;
  margin: var(--space-xs) 4px;
  background: var(--hairline-soft);
}
.topbar-menu-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--steel);
}
.topbar-profile {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--steel);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid var(--hairline-soft);
  flex-shrink: 0;
}

/* PC에서는 메뉴를 상단 중앙에 항상 노출(햄버거 없이) — 900px 이하 모바일에서만 햄버거+드롭다운 */
@media (min-width: 901px) {
  .topbar-spacer {
    display: none;
  }
  .topbar-hamburger {
    display: none;
  }
  /* 로고·프로필 폭이 서로 달라 justify-content:center만으로는 메뉴가 화면 정중앙이 아니라
     둘 사이 여백의 중앙에 치우쳐 보였음 — 메뉴를 topbar 전체 폭에 겹치는 오버레이로 분리해
     로고·프로필 폭과 무관하게 항상 화면(topbar) 정중앙에 오도록 함 */
  .topbar-menu {
    display: flex;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 60px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    pointer-events: none;
  }
  .topbar-menu button {
    pointer-events: auto;
  }
  .topbar-menu-divider {
    display: none;
  }
  .topbar-menu-profile {
    position: absolute;
    right: var(--space-xl);
    top: 50%;
    transform: translateY(-50%);
    padding: 0;
    margin-left: 0;
    pointer-events: auto;
  }
}

/* ===== 본문: 좌 320 / 우 880, 전체 1200 ===== */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl);
}
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}
.page-desc {
  color: var(--steel);
  font-size: 13px;
  margin: 0 0 var(--space-xl);
}
.page-refresh-btn {
  flex-shrink: 0;
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 var(--space-md);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-full);
  background: var(--canvas);
  color: var(--steel);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.page-refresh-btn:hover {
  background: var(--surface-soft);
  color: var(--ink);
}
.page-shell {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xl);
}
.col-input {
  flex: 0 0 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 76px;
  max-height: var(--shell-avail-height, calc(100vh - 165px));
  overflow-y: auto;
}
/* .col-input이 display:flex를 명시하고 있어 [hidden] 기본 동작(display:none)이
   묻히므로, 보고서 화면에서 입력 폼을 숨겨 우측 내역이 폭을 다 쓰게 할 때 실제로
   사라지도록 명시적으로 덮어써야 한다. */
.col-input[hidden] {
  display: none;
}
#income-form-container {
  flex-shrink: 0;
}
/* 헌금 명단 노출 순서를 펼쳤을 때만, 우측 수입 내역 카드 하단과 높이를 맞추고
   그 안(목록)에서만 스크롤되도록 함 — 접혀 있을 때는 원래 크기 그대로.
   #donor-order-container(#col-input의 실제 flex 자식)에 펼침 여부를 표시해야
   그 안의 .donor-order-card까지 남는 공간을 제대로 물려받는다(card 자체는
   flex 아이템이 아니라 컨테이너의 손자 요소라 card에만 flex:1을 줘도 효과 없음). */
#donor-order-container.expanded {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#donor-order-container.expanded .donor-order-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#donor-order-container.expanded .donor-order-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#donor-order-container.expanded .donor-order-list {
  flex: 1;
  min-height: 140px;
  overflow-y: auto;
}
#donor-order-container.expanded .name-input-wrap,
#donor-order-container.expanded #donor-order-save,
#donor-order-container.expanded .form-status {
  flex-shrink: 0;
}
.col-list {
  flex: 1 1 auto;
  min-width: 0;
}

/* ===== 좌측: 수입입력 폼 ===== */
.card {
  background: var(--canvas);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
}
.donor-order-card {
  margin-top: var(--space-xl);
}
.card-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}
button.card-toggle h2 {
  margin: 0;
}
.card-toggle-icon {
  flex-shrink: 0;
  color: var(--steel);
  transition: transform 0.15s ease;
}
.card-toggle[aria-expanded='true'] .card-toggle-icon {
  transform: rotate(180deg);
}
.donor-order-body {
  margin-top: var(--space-lg);
}
.card h2 {
  font-size: 15px;
  margin: 0 0 var(--space-lg);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}
.card-head h2 {
  margin: 0;
}
.crud-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-sm) 0;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-base);
}
.field[hidden] {
  display: none;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--steel);
}
.field label .note {
  font-weight: 500;
  color: var(--stone);
  margin-left: 4px;
}
.date-week-hint {
  margin-left: 6px;
  font-weight: 700;
  color: var(--primary);
}
.form-section {
  padding-top: var(--space-lg);
  margin-top: var(--space-lg);
  border-top: 1px solid var(--hairline-soft);
}
.form-section:first-child {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}
.form-section-title {
  margin: 0 0 var(--space-base);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}
.field-row {
  display: flex;
  gap: var(--space-base);
  flex-wrap: wrap;
}
.field-row .field {
  flex: 1 1 120px;
  min-width: 0;
}
.kind-toggle {
  display: flex;
  gap: 6px;
}
.kind-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}
.kind-toggle label {
  border: 1px solid var(--hairline);
  background: var(--canvas);
  color: var(--steel);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
}
.kind-toggle input:checked + label {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.kind-toggle input:focus-visible + label {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.field input,
.field select {
  height: 40px;
  padding: 0 var(--space-md);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  font-size: 14px;
  background: var(--canvas);
  color: var(--ink);
  font-family: inherit;
}
.field input:focus,
.field select:focus {
  outline: none;
  border: 2px solid var(--primary);
  padding-left: calc(var(--space-md) - 1px);
}
.name-field-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.name-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.name-input-wrap input {
  width: 100%;
}
.name-field-row .btn-reset {
  flex-shrink: 0;
  height: 40px;
  white-space: nowrap;
}
.btn {
  width: 100%;
  height: 42px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: var(--space-xs);
}
.btn:active {
  background: var(--primary-deep);
}
.btn.secondary {
  background: none;
  border: 1px solid var(--hairline);
  color: var(--ink);
  width: auto;
  padding: 0 var(--space-lg);
}
.form-status {
  margin-top: var(--space-sm);
  font-size: 12.5px;
  color: var(--steel);
  text-align: center;
}
.thousand-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--steel);
  cursor: pointer;
}
.thousand-toggle input {
  height: auto;
  width: auto;
}
.amount-unit-toggle {
  display: flex;
  gap: var(--space-base);
  margin-top: 6px;
  flex-wrap: wrap;
}
.amount-unit-toggle label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--steel);
  cursor: pointer;
  font-weight: 400;
}
.amount-unit-toggle input {
  height: auto;
  width: auto;
}
.category-group-radios {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: nowrap;
}
.category-group-radios label {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--steel);
  cursor: pointer;
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
}
.category-group-radios input {
  height: auto;
  width: auto;
  flex-shrink: 0;
}

/* ===== 헌금 명단 노출 순서 ===== */
.donor-order-list {
  list-style: none;
  margin: var(--space-sm) 0;
  padding: 6px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.order-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
  background: var(--canvas);
  cursor: grab;
}
.order-item:active {
  cursor: grabbing;
}
.order-drag-handle {
  flex-shrink: 0;
  color: var(--stone);
  font-size: 13px;
}
.order-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-actions {
  flex-shrink: 0;
  display: flex;
  gap: 2px;
}
.order-actions button {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--steel);
  font-size: 12px;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
}
.order-actions button:hover {
  background: var(--hairline-soft);
  color: var(--ink);
}
.order-actions button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.order-actions .order-remove:hover {
  color: var(--critical);
}
.donor-order-list .empty-state {
  padding: var(--space-lg);
  font-size: 12.5px;
}

/* ===== 우측: 목록(주차별 게시글) ===== */
.list-card {
  background: var(--canvas);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
/* 우측 목록 카드는 페이지 전체 스크롤 대신, 진입 시 화면에 한눈에 들어오도록 뷰포트
   높이에 맞춰 고정하고(상단 sticky 오프셋 76px과 동일 기준 + 하단 여백), 내역
   목록(#week-rows 등)만 카드 내부에서 스크롤되게 한다. */
.list-card-scroll {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  max-height: var(--shell-avail-height, calc(100vh - 165px));
}
.list-card-scroll-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
/* 상세 페이지 하단 '목록으로' 버튼 — 스크롤 영역(.list-card-scroll-body) 밖에 둬서
   내용만 스크롤되고 버튼은 카드 하단에 항상 고정 노출되게 함 */
.list-card-footer {
  flex-shrink: 0;
  border-bottom: none;
  border-top: 1px solid var(--hairline-soft);
  background: var(--canvas);
}
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--hairline-soft);
}
.list-head h2 {
  font-size: 15px;
  margin: 0;
}
.list-count {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.detail-amount-stats {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--steel);
}

/* ── 검색 + 연/월 필터 ── */
.list-filter {
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--hairline-soft);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.list-search-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.detail-search-row {
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--hairline-soft);
}
.list-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.search-scope-select {
  flex-shrink: 0;
  height: 38px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  font-size: 13px;
  background: var(--canvas);
  color: var(--ink);
  font-family: inherit;
}
.btn-reset {
  flex-shrink: 0;
  height: 38px;
  padding: 0 var(--space-md);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--canvas);
  color: var(--steel);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-reset:hover {
  background: var(--surface-soft);
  color: var(--ink);
}
.btn-print {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.btn-print:hover {
  background: #0052bd;
  color: #fff;
}
.nh-upload-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--hairline-soft);
}
.nh-upload-label {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.nh-date-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--steel);
}
.nh-date-picker input[type='date'] {
  height: 34px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
}
tr.nh-row-used td {
  background: var(--surface-soft);
  color: var(--stone);
}
.nh-online-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: rgba(0, 100, 224, 0.12);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}
table#nh-table {
  table-layout: fixed;
}
table#nh-table th:nth-child(1),
table#nh-table td:nth-child(1) {
  width: 9%;
}
table#nh-table th:nth-child(2),
table#nh-table td:nth-child(2) {
  width: 8%;
}
table#nh-table th:nth-child(3),
table#nh-table td:nth-child(3) {
  width: 9%;
}
table#nh-table th:nth-child(4),
table#nh-table td:nth-child(4) {
  width: 9%;
}
table#nh-table th:nth-child(5),
table#nh-table td:nth-child(5) {
  width: 18%;
}
table#nh-table th:nth-child(6),
table#nh-table td:nth-child(6) {
  width: 6%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
table#nh-table th:nth-child(7),
table#nh-table td:nth-child(7) {
  width: 10%;
}
table#nh-table th:nth-child(8),
table#nh-table td:nth-child(8) {
  width: 18%;
}
table#nh-table th:nth-child(9),
table#nh-table td:nth-child(9) {
  width: 13%;
}
.nh-category-cell {
  min-width: 0;
}
.nh-category-cell select {
  width: 100%;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-family: inherit;
  background: var(--canvas);
}
.nh-dept-cat-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.list-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 var(--space-md);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}
.list-search svg {
  flex-shrink: 0;
  color: var(--stone);
}
.list-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
}

/* 검색창 자동완성 드롭다운 */
.search-suggest {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 20px rgba(20, 22, 26, 0.12);
  max-height: 220px;
  overflow-y: auto;
}
.search-suggest li + li {
  margin-top: 2px;
}
.search-suggest button {
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
}
.search-suggest button:hover {
  background: var(--surface-soft);
}
.search-suggest button.active {
  background: var(--surface-soft);
}
.search-suggest button.suggest-all {
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid var(--hairline-soft);
  border-radius: 0;
}

/* 검색어 지우기(X) 버튼 */
.search-clear {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  border-radius: 50%;
  color: var(--stone);
  cursor: pointer;
}
.search-clear:hover {
  background: var(--hairline-soft);
  color: var(--ink);
}

/* 선택된 성명 뱃지(여러 명 OR 검색) */
.search-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.search-badges:empty {
  display: none;
}
.name-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
}
.name-badge button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  color: #fff;
  cursor: pointer;
}
.name-badge button svg {
  display: block;
}
.name-badge button:hover {
  background: rgba(255, 255, 255, 0.55);
}

/* 검색 결과 합계 */
.search-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(0, 100, 224, 0.08);
  color: var(--primary-deep);
  font-size: 12.5px;
}
.search-total strong {
  font-size: 13.5px;
}
.month-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.year-select {
  flex-shrink: 0;
  height: 32px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: var(--canvas);
  color: var(--ink);
  font-family: inherit;
}
.month-tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.month-tabs::-webkit-scrollbar {
  display: none;
}
.month-tabs button {
  flex-shrink: 0;
  border: 1px solid var(--hairline);
  background: var(--canvas);
  color: var(--steel);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
}
.month-tabs button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.week-row {
  display: flex;
  align-items: center;
  gap: var(--space-base);
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--hairline-soft);
  cursor: pointer;
  background: var(--canvas);
}
.week-row:last-child {
  border-bottom: none;
}
.week-row:hover {
  background: var(--surface-soft);
}
.week-row .badge {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.week-row .badge-week {
  background: var(--surface-soft);
  color: var(--steel);
  border: 1px solid var(--hairline);
}
.week-date-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.week-row .week-title {
  flex: 0 1 auto;
  min-width: 0;
}
.week-row .week-title strong {
  display: block;
  font-size: 14.5px;
}
.week-row .week-title span {
  font-size: 12.5px;
  color: var(--steel);
}
.week-amount-group {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.week-row .week-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.week-amount-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--steel);
}
.week-report-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--hairline);
  background: var(--canvas);
  color: var(--steel);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
}
.week-report-btn:hover {
  background: var(--surface-soft);
  color: var(--ink);
}
/* ===== 주일 헌금 현황 보고서 (A4 인쇄용, 실사용 양식 재현) ===== */
.income-print {
  width: 100%;
  margin: 0 auto;
  padding: 10mm;
  background: #fff;
  color: #191f28;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.05);
}
.income-print table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.income-print th,
.income-print td {
  border: 1px solid #191f28;
  padding: 4px 6px;
  font-size: 12.5px;
  line-height: 1.4;
  word-break: break-all;
  font-weight: 700;
}
.income-print th {
  background: rgba(0, 100, 224, 0.08);
  color: #0a3a7a;
  font-weight: 800;
}
.income-print td.num {
  text-align: right;
}

.print-header-table {
  margin-bottom: 6px;
}
/* 수입 보고서·수입/지출 보고서 공통 헤더 — 제목(좌, 2칸)과 출납·재정부장·당회장 서명 3칸(우)을
   한 줄에, 그 아래 서명용 빈 칸과 부제(발행처·날짜·주차)를 이어붙인다. */
.print-header-table .title-cell {
  width: 50%;
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0;
  vertical-align: middle;
}
.print-header-table .date-cell {
  width: 16.666%;
  text-align: center;
  font-weight: 600;
  background: #eef1f4;
}
.print-header-table .approval-label {
  width: 14%;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}
.print-header-table .approval-cell {
  padding: 0;
  height: 70px;
  vertical-align: bottom;
}
/* 당회보고용 결재란은 서명 대기용 빈 칸이 아니라 이름이 이미 채워진 칸이라, 다른 보고서의
   70px 빈 서명란 높이 대신 보통 행 높이로 되돌리고 세로 중앙 정렬한다. */
.council-approval-table .approval-cell {
  padding: 4px 6px;
  height: auto;
  vertical-align: middle;
}
.print-header-table .subtitle-cell {
  text-align: right;
  font-size: 12.5px;
  font-weight: 600;
  background: #fff;
  border-top: none;
}
.report-subtitle-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 700;
}

.print-summary-table th,
.print-summary-table td {
  text-align: center;
}
.print-summary-table td:first-child {
  font-weight: 700;
}
.print-detail-table {
  margin-bottom: 6px;
  table-layout: fixed;
}
.print-detail-table th,
.print-detail-table td {
  font-size: 12px;
  padding: 3px 4px;
}
.print-detail-table td:first-child:not(.num),
.print-detail-table td:nth-child(2):not(.num) {
  text-align: center;
  font-weight: 700;
}
.print-detail-table th:nth-child(1),
.print-detail-table td:nth-child(1) {
  width: 8%;
  word-break: keep-all;
}
.print-detail-table th:nth-child(2),
.print-detail-table td:nth-child(2) {
  width: 8%;
  word-break: keep-all;
}
.print-detail-table th:nth-child(3),
.print-detail-table td:nth-child(3) {
  width: 15%;
  word-break: keep-all;
}
.print-detail-table th:nth-child(4),
.print-detail-table td:nth-child(4) {
  width: 15%;
}
.print-detail-table th:nth-child(5),
.print-detail-table td:nth-child(5) {
  width: 10%;
}
.print-detail-table th:nth-child(6),
.print-detail-table td:nth-child(6) {
  width: 12%;
}
.print-detail-table th:nth-child(7),
.print-detail-table td:nth-child(7) {
  width: 15%;
}
.print-detail-table th:nth-child(8),
.print-detail-table td:nth-child(8) {
  width: 17%;
}

.week-total-bar {
  background: #fdeef0;
  border: 1px solid #191f28;
  border-left: 4px solid #d6336c;
  padding: 5px 9px;
  font-size: 14px;
  font-weight: 700;
  margin: 8px 0;
}
.week-total-bar .note {
  font-weight: 700;
  font-size: 12px;
  margin-left: 6px;
}

.donor-section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 10px;
  margin-top: 12px;
  margin-bottom: 4px;
  background: rgba(0, 100, 224, 0.06);
  border: 1px solid #191f28;
  border-left: 4px solid var(--primary);
  break-inside: avoid;
  break-after: avoid;
}
.donor-section-title .label {
  font-size: 13.5px;
  font-weight: 700;
}
.donor-section-title .amount {
  font-size: 16px;
  font-weight: 800;
}
.donor-section-title .note {
  font-weight: 700;
  font-size: 12px;
}
.donor-grid,
.dept-grid {
  margin-bottom: 4px;
  break-inside: avoid;
}
.income-print .donor-grid {
  table-layout: auto;
}
.donor-grid th,
.donor-grid td,
.dept-grid th,
.dept-grid td {
  text-align: center;
}
.donor-grid .pair-start,
.dept-grid .pair-start {
  border-left: 2px solid #191f28;
}
.donor-grid td.dg-name,
.donor-grid th.dg-name,
.donor-grid td.dg-amount,
.donor-grid th.dg-amount {
  white-space: nowrap;
}

/* ===== 금주 수입/지출 내역 (수입+지출 결합 보고서) ===== */
.ledger-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
  margin-bottom: 6px;
}
.ledger-columns-2-1 {
  grid-template-columns: 2fr 1fr;
}
.ledger-total-row {
  font-weight: 700;
  background: rgba(0, 100, 224, 0.08);
}
.ledger-total-row td:first-child {
  color: #0a3a7a;
}
.expense-total-bar {
  display: flex;
  border: 1px solid #191f28;
  border-bottom: none;
  font-size: 12px;
  font-weight: 700;
}
.expense-total-bar span {
  flex: 1;
  text-align: center;
  padding: 3px 8px;
}
.expense-total-bar .general {
  background: #f2f4f6;
}
.expense-total-bar .special {
  background: #f3e6d0;
}
.deposit-plan-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 90px;
  border: 1px solid #191f28;
  background: #eef4ff;
  color: #191f28;
  border-radius: 4px;
  padding: 8px;
}
.deposit-plan-box .label {
  font-size: 12px;
  font-weight: 700;
  color: #4e5968;
}
.deposit-plan-box .value {
  font-size: 20px;
  font-weight: 800;
}
.deposit-plan-box input {
  width: 90%;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  padding: 4px;
  border-radius: 4px;
  border: 1px solid #ced0d4;
}
.expense-detail-table th,
.expense-detail-table td {
  text-align: center;
}
.expense-detail-table th:nth-child(2),
.expense-detail-table td:nth-child(2),
.expense-detail-table th:last-child,
.expense-detail-table td:last-child {
  text-align: left;
}
.expense-detail-table {
  table-layout: fixed;
}
.expense-detail-table .col-no {
  width: 5%;
  color: inherit;
}
/* 내용 20% · 금액/부서/항목 균등하게 12%씩 · 비고는 남는 폭을 다 가져가 가장 넓게(39%) */
.expense-detail-table th:nth-child(2),
.expense-detail-table td:nth-child(2) {
  width: 20%;
}
.expense-detail-table th:nth-child(3),
.expense-detail-table td:nth-child(3),
.expense-detail-table th:nth-child(4),
.expense-detail-table td:nth-child(4),
.expense-detail-table th:nth-child(5),
.expense-detail-table td:nth-child(5) {
  width: 12%;
}
.expense-detail-table th:last-child,
.expense-detail-table td:last-child {
  width: 39%;
  word-break: break-all;
}
.expense-detail-table tbody tr:nth-child(even) td {
  background: #f7f9fc;
}
.overseas-ledger-table tbody tr:nth-child(even):not(.ledger-total-row) td {
  background: #f7f9fc;
}
.overseas-ledger-table th,
.overseas-ledger-table td {
  text-align: right;
  font-size: 12px;
  white-space: nowrap;
}
.overseas-ledger-table td:first-child {
  text-align: left;
  font-weight: 700;
  white-space: normal;
  word-break: break-all;
}
.overseas-ledger-table td:last-child {
  text-align: left;
  white-space: normal;
  word-break: break-all;
}

.insight-box {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #191f28;
  background: #f2f4f6;
  break-inside: avoid;
}
.insight-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}
.insight-list {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  line-height: 1.6;
}

/* ===== 당회보고용 '총' 시트 ===== */
.council-detail-table td:first-child {
  text-align: left;
}
.council-group-row td {
  background: rgba(0, 100, 224, 0.08);
  border-left: 3px solid var(--primary);
  color: #0a3a7a;
  font-weight: 800;
  text-align: left;
  padding: 3px 6px 3px 9px;
}
.council-general-columns {
  margin-bottom: 6px;
}
.council-top-table tbody tr:nth-child(odd):not(.ledger-total-row) td,
.council-detail-table tbody tr:nth-child(even):not(.ledger-total-row):not(.council-group-row) td {
  background: #f7f9fc;
}
.council-detail-table td.zero-value,
.council-top-table td.zero-value {
  color: #b0b6c0;
  font-weight: 600;
}
.council-approval-table {
  margin-top: 10px;
  table-layout: fixed;
}
.council-approval-signers td,
.council-approval-signers td.approval-label {
  width: 14.29%;
}
.council-approval-signers .logo-cell {
  text-align: center;
  vertical-align: middle;
  padding: 4px;
}
.council-approval-signers .church-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}
.council-approval-signers .church-name {
  display: inline-block;
  vertical-align: middle;
  margin-left: 4px;
  font-size: 12px;
  font-weight: 700;
}
.council-approval-audit tr:first-child > td:nth-child(1),
.council-approval-audit tr:first-child > td:nth-child(2),
.council-approval-audit tr:first-child > td:nth-child(4),
.council-approval-audit tr:first-child > td:nth-child(5) {
  width: 14.29%;
}
.council-approval-audit tr:first-child > td:nth-child(3) {
  width: 42.86%;
}
.print-header-table.council-approval-table .council-audit-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

/* ===== 부서별 지출 상세 ===== */
.dept-detail-tabs {
  flex-wrap: wrap;
}
.dept-detail-summary-table {
  table-layout: fixed;
  margin-bottom: 4px;
}
.dept-detail-summary-table th:first-child,
.dept-detail-summary-table td:first-child {
  width: 44%;
  text-align: left;
}
.dept-detail-summary-table th:not(:first-child),
.dept-detail-summary-table td:not(:first-child) {
  width: 14%;
}
.dept-detail-summary-table td.empty {
  text-align: center;
}
.dept-detail-section {
  margin-bottom: 10px;
  border: 1px solid #191f28;
  break-inside: avoid;
}
.dept-detail-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 8px;
  background: #eef1f4;
  border-bottom: 1px solid #191f28;
}
.dept-detail-section-head--over {
  border-left: 4px solid #d6336c;
}
.dept-detail-section-title {
  font-size: 13.5px;
  font-weight: 800;
}
.dept-detail-section-title--over {
  color: #d6336c;
}
.dept-detail-section-meta {
  font-size: 14px;
  font-weight: 700;
  color: #4b5563;
  white-space: nowrap;
}
.dept-detail-ratio-over {
  color: #d6336c;
  font-weight: 800;
}
.dept-detail-entries-table {
  table-layout: fixed;
}
.dept-detail-entries-table th:nth-child(1),
.dept-detail-entries-table td:nth-child(1) {
  width: 14%;
}
.dept-detail-entries-table th:nth-child(2),
.dept-detail-entries-table td:nth-child(2) {
  width: 34%;
  text-align: left;
}
.dept-detail-entries-table th:nth-child(3),
.dept-detail-entries-table td:nth-child(3),
.dept-detail-entries-table th:nth-child(4),
.dept-detail-entries-table td:nth-child(4) {
  width: 9%;
  white-space: nowrap;
}
.dept-detail-entries-table th:nth-child(5),
.dept-detail-entries-table td:nth-child(5) {
  width: 34%;
  text-align: left;
}
.dept-detail-section-empty {
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--steel);
}
.dept-detail-ranking-shell {
  margin-bottom: var(--space-md);
}
.dept-detail-rank-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
}
.dept-detail-rank-table {
  table-layout: fixed;
}
.dept-detail-rank-table th:nth-child(1),
.dept-detail-rank-table td:nth-child(1),
.dept-detail-rank-table th:nth-child(2),
.dept-detail-rank-table td:nth-child(2) {
  width: 24%;
  text-align: left;
}
.dept-detail-rank-table th:nth-child(3),
.dept-detail-rank-table td:nth-child(3),
.dept-detail-rank-table th:nth-child(4),
.dept-detail-rank-table td:nth-child(4) {
  width: 20%;
}
.dept-detail-rank-table th:nth-child(5),
.dept-detail-rank-table td:nth-child(5) {
  width: 12%;
}
.dept-detail-rank-table td.empty {
  text-align: center;
}
.dept-detail-all-block + .dept-detail-all-block {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 2px solid var(--hairline);
}

@media print {
  .dept-detail-page-break {
    break-before: page;
  }
  .topbar,
  .page-header-row,
  #col-input,
  .no-print {
    display: none !important;
  }
  .page {
    max-width: none;
    padding: 0;
  }
  .page-shell {
    display: block;
  }
  .col-list {
    width: 100% !important;
  }
  .list-card {
    border: none;
    border-radius: 0;
  }
  .income-print {
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  /* 표가 페이지 경계에서 행 중간(특히 헤더 행)이 잘려 다음 페이지로 넘어가지 않도록 —
     테이블 자체는 여러 페이지에 걸쳐 나뉘되, 각 행은 통째로 한 페이지 안에 들어가고
     헤더(thead)는 페이지가 바뀔 때마다 자동으로 다시 표시된다. */
  .income-print table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .income-print thead {
    display: table-header-group;
  }
  @page {
    size: A4;
    margin: 10mm;
  }
}
.empty-state {
  padding: var(--space-xxl);
  text-align: center;
  color: var(--stone);
  font-size: 13.5px;
}
table.tx-table td.empty {
  text-align: center;
  color: var(--stone);
  padding: var(--space-xl);
}

/* ===== 상세 페이지 ===== */
.detail-summary {
  display: flex;
  align-items: baseline;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--hairline-soft);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.detail-summary-overseas {
  font-size: 13px;
  font-weight: 600;
  color: var(--steel);
}
.table-scroll {
  overflow-x: auto;
}
table.tx-table {
  width: 100%;
  border-collapse: collapse;
}
table.tx-table th,
table.tx-table td {
  padding: var(--space-sm) var(--space-xl);
  text-align: left;
  font-size: 13.5px;
  border-bottom: 1px solid var(--hairline-soft);
  white-space: nowrap;
}
table.tx-table th {
  color: var(--steel);
  font-weight: 600;
  font-size: 12px;
}
table.tx-table td.col-no,
table.tx-table th.col-no {
  text-align: center;
  color: var(--stone);
  width: 40px;
}
table.tx-table td.num {
  text-align: right;
  font-weight: 600;
}
/* 내용/항목/비고/가족은 길면 두 줄로 줄바꿈되도록 해 가로 스크롤 없이 카드 폭 안에
   표가 들어오게 함 */
table.tx-table td.memo-cell,
table.tx-table td.content-cell,
table.tx-table td.category-cell,
table.tx-table td.family-cell {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
  min-width: 82px;
  max-width: 115px;
}
table.tx-table tbody tr:hover {
  background: var(--surface-soft);
}
table.tx-table tr.editing {
  background: rgba(0, 100, 224, 0.04);
}
/* 영수증 목록은 열이 하나(가족) 더 많아 기본 여백대로면 액션 버튼이 카드 폭을
   넘어가 잘려 보인다 — 이 표에서만 셀 여백·가족 칸·버튼을 좀 더 좁게 잡는다. */
table.receipt-table th,
table.receipt-table td {
  padding: var(--space-sm) var(--space-md);
}
table.receipt-table td.family-cell {
  min-width: 70px;
  max-width: 95px;
}
table.receipt-table .row-actions button {
  padding: 5px 8px;
  font-size: 11.5px;
}
table.receipt-table .row-actions button + button {
  margin-left: 4px;
}
table.tx-table .row-actions {
  white-space: nowrap;
  text-align: right;
}
table.tx-table .row-actions button {
  border: 1px solid var(--hairline);
  background: var(--canvas);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  color: var(--ink);
}
table.tx-table .row-actions button + button {
  margin-left: 6px;
}
table.tx-table .row-actions button:hover {
  background: var(--surface-soft);
}
table.tx-table .row-actions .delete-row {
  border-color: rgba(228, 30, 63, 0.35);
  color: var(--critical);
}
table.tx-table .row-actions .delete-row:hover {
  background: var(--critical);
  border-color: var(--critical);
  color: #fff;
}
table.tx-table .row-actions .save-row {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
table.tx-table .row-actions button.btn-print {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
table.tx-table .row-actions button.btn-print:hover {
  background: var(--primary-deep);
  border-color: var(--primary-deep);
  color: #fff;
}
table.tx-table .row-actions .save-row:hover {
  background: var(--primary-deep);
  border-color: var(--primary-deep);
}
table.tx-table .edit-category,
table.tx-table .edit-name,
table.tx-table .edit-memo,
table.tx-table .edit-amount {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: var(--canvas);
  color: var(--ink);
  font-family: inherit;
  width: 100%;
  min-width: 90px;
}

/* 검색 결과(뱃지 선택 시) 월별 구분선 */
table.tx-table tr.month-divider td {
  background: var(--surface-soft);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--steel);
  padding-top: 8px;
  padding-bottom: 8px;
}
tr.nh-week-divider td {
  background: rgba(0, 100, 224, 0.08);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--primary);
  padding-top: 8px;
  padding-bottom: 8px;
}

/* ===== 검증 화면 ===== */
.verify-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--hairline-soft);
  flex-wrap: wrap;
}
.verify-toolbar select {
  height: 38px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-family: inherit;
  background: var(--canvas);
}
.verify-table-wrap {
  padding: var(--space-xl);
}
.verify-comment-input {
  width: 100%;
  min-width: 96px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 4px 6px;
  font-family: inherit;
  font-size: 12.5px;
  resize: vertical;
  box-sizing: border-box;
  background: transparent;
  text-align: left;
}
.verify-comment-input:hover,
.verify-comment-input:focus {
  border-color: var(--hairline);
  background: var(--canvas);
}
table.verify-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}
table.verify-table th,
table.verify-table td {
  border: 1px solid var(--hairline-soft);
  padding: 10.5px 10px;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}
table.verify-table td.num,
table.verify-table .v-input-cell {
  text-align: right;
}
table.verify-table .verify-input {
  text-align: right;
}
table.verify-table th {
  background: var(--surface-soft);
  font-weight: 700;
  color: var(--steel);
}
table.verify-table .v-row-label {
  text-align: left;
  font-weight: 600;
  white-space: normal;
  min-width: 220px;
}
table.verify-table td.num {
  font-weight: 700;
}
#verify-table td.num,
#verify-table .verify-input {
  font-size: 16px;
}
table.verify-table tr.v-a td:not(.v-row-label) {
  background: #0a8f52;
  color: #fff;
  font-weight: 700;
}
table.verify-table tr.v-a .v-row-label {
  background: #e8f6ef;
}
table.verify-table tr.v-b td:not(.v-row-label),
table.verify-table tr.v-c td:not(.v-row-label) {
  background: #f2ede6;
}
table.verify-table tr.v-sub .v-row-label {
  background: var(--surface-soft);
  color: var(--steel);
  font-style: italic;
  font-weight: 500;
}
table.verify-table tr.v-income td:not(.v-row-label) {
  background: #eef4ff;
}
table.verify-table tr.v-expense td:not(.v-row-label) {
  background: #ffe8cf;
}
table.verify-table tr.v-purple td:not(.v-row-label) {
  color: #7c3aed;
  font-weight: 800;
}
table.verify-table tr.v-dark .v-row-label {
  background: #32383e;
  color: #fff;
}
table.verify-table tr.v-dark td:not(.v-row-label) {
  background: #f2f4f6;
  font-weight: 800;
}
table.verify-table tr.v-blue td:not(.v-row-label) {
  background: #0064e0;
  color: #fff;
  font-weight: 700;
}
table.verify-table tr.v-gray .v-row-label,
table.verify-table tr.v-gray td:not(.v-row-label) {
  background: #4e5968;
  color: #fff;
  font-weight: 700;
}
table.verify-table tr.v-diff td:not(.v-row-label) {
  color: #d6336c;
  font-weight: 800;
}
table.verify-table tr.v-result td:not(.v-row-label) {
  font-weight: 700;
}
table.verify-table tr.v-result-match td:not(.v-row-label) {
  background: #0a8f52;
  color: #fff;
}
table.verify-table tr.v-result-over td:not(.v-row-label) {
  background: #fef3c7;
  color: #92400e;
}
table.verify-table tr.v-result-under td:not(.v-row-label) {
  background: #ffe8cf;
  color: #92400e;
}
.v-input-cell {
  padding: 4px !important;
}
.verify-input {
  width: 100%;
  min-width: 90px;
  height: 32px;
  text-align: center;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  box-sizing: border-box;
  background: transparent;
  color: var(--ink);
}
/* 배경이 진한 행(A·F·H)만 입력 글씨를 흰색으로 — 나머지는 배경이 밝아 기본(검정) 유지 */
table.verify-table tr.v-a .verify-input,
table.verify-table tr.v-blue .verify-input,
table.verify-table tr.v-gray .verify-input {
  color: #fff;
}
table.dept-verify-table {
  table-layout: fixed;
}
table.dept-verify-table .dv-ledger {
  color: #7c3aed;
  font-weight: 800;
}
table.dept-verify-table th.dv-ledger {
  color: #fff;
  background: #7c3aed;
}

/* 상세 페이지 — 헌금구분별 탭 */
.detail-category-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: var(--space-sm) var(--space-xl);
  border-bottom: 1px solid var(--hairline-soft);
}
.detail-category-tabs button {
  border: 1px solid var(--hairline);
  background: var(--canvas);
  color: var(--steel);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
}
.detail-category-tabs button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ===== 헌금명단 관리 팝업 ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 19, 23, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  z-index: 100;
}
.modal-box {
  background: var(--canvas);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: 0 20px 60px rgba(10, 19, 23, 0.3);
}
.modal-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}
.modal-box-head h3 {
  margin: 0;
  font-size: 16px;
}
.donor-modal {
  width: 640px;
  height: 480px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
/* .name-input-wrap의 flex:1은 가로 배치(.name-field-row) 기준이라, .donor-modal의 세로
   flex 흐름에 바로 놓이면 남는 세로 공간을 검색창이 그대로 먹어 아래에 빈 공간이 생긴다 —
   이 컨테이너 바로 아래 놓일 땐 내용 크기만큼만 차지하게 고정한다. */
.donor-modal > .name-input-wrap {
  flex: 0 0 auto;
  margin-bottom: var(--space-sm);
}
.donor-modal > .name-input-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-md);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-family: inherit;
  background: var(--canvas);
  color: var(--ink);
}
.donor-modal > .name-input-wrap input:focus {
  outline: none;
  border: 2px solid var(--primary);
  padding-left: calc(var(--space-md) - 1px);
}
.donor-search-wrap {
  margin-bottom: var(--space-sm);
}
.donor-search-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-md);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-family: inherit;
}
.donor-add-new {
  width: 100%;
  height: 38px;
  margin-bottom: var(--space-sm);
  border: 1px dashed var(--primary);
  border-radius: var(--radius-lg);
  background: rgba(0, 100, 224, 0.06);
  color: var(--primary-deep);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.donor-add-new:hover {
  background: rgba(0, 100, 224, 0.12);
}
.donor-modal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.donor-modal-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}
.donor-modal-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.donor-modal-row button {
  flex-shrink: 0;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--steel);
}
.donor-modal-row button:hover {
  background: var(--hairline-soft);
  color: var(--ink);
}
.donor-modal-row .donor-delete:hover {
  color: var(--critical);
}

/* ===== 가족 합산 묶음 관리 ===== */
.family-modal {
  height: 640px;
}
.field-link-btn {
  border: none;
  background: none;
  padding: 0;
  margin-left: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}
.field-link-btn:hover {
  text-decoration: underline;
}
.family-suggest {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.family-suggest .family-suggest-add {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.family-suggest .family-suggest-dismiss {
  border: none;
  background: none;
  color: var(--steel);
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.family-modal-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}
.family-modal-row-main { min-width: 0; }
.family-modal-row-holder {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.family-modal-row-members {
  font-size: 12.5px;
  color: var(--steel);
  margin-top: 2px;
}
.family-modal-row-memo {
  font-size: 11.5px;
  color: var(--stone);
  margin-top: 2px;
}
.family-modal-row button {
  flex-shrink: 0;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--steel);
}
.family-modal-row button:hover {
  background: var(--hairline-soft);
  color: var(--ink);
}
.family-modal-row .donor-delete:hover {
  color: var(--critical);
}

/* ===== 고정지출 불러오기 팝업 ===== */
.fixed-expense-modal {
  width: 900px;
  height: 800px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.fixed-expense-section-title {
  margin: 0 0 var(--space-sm);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--steel);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.fixed-expense-list-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.fixed-expense-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin: var(--space-sm) 0 var(--space-xs);
}
#fixed-expense-add-row-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.fixed-expense-draft-row {
  display: grid;
  grid-template-columns: auto 1.3fr 1fr 1fr 1fr 1fr auto auto;
  gap: var(--space-xs);
  align-items: center;
  background: var(--surface-soft);
}
.fixed-expense-draft-row input,
.fixed-expense-draft-row select {
  height: 36px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  min-width: 0;
  box-sizing: border-box;
}
/* 팝업 안의 모든 버튼(닫기·+고정지출 추가·주차 탭·전체선택/해제·선택 항목 추가·추가/취소) 높이를 하나로 통일 */
.fixed-expense-modal .modal-box-head .fixed-expense-close,
.fixed-expense-modal .fixed-expense-count-row button,
.fixed-expense-modal .fixed-expense-draft-row button,
.fixed-expense-modal .detail-category-tabs button,
.fixed-expense-modal .crud-actions button {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  margin: 0;
  box-sizing: border-box;
  white-space: nowrap;
}
.fixed-expense-modal .crud-actions .btn {
  width: auto;
}
.fixed-expense-row-label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
}
.fixed-expense-row-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fixed-expense-subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--steel);
}
.fixed-expense-date-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.fixed-expense-date-row label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--steel);
}
.fixed-expense-date-row input[type='date'] {
  height: 36px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-family: inherit;
  background: var(--canvas);
  color: var(--ink);
}
.fixed-expense-date-week {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
}
.fixed-expense-close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--canvas);
  color: var(--steel);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.fixed-expense-close:hover {
  background: var(--surface-soft);
  color: var(--ink);
}
.fixed-expense-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}
.fixed-expense-toolbar .detail-category-tabs {
  margin: 0;
}
.fixed-expense-select-all-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--steel);
  cursor: pointer;
}
.fixed-expense-count {
  font-size: 12.5px;
  color: var(--steel);
}
.fixed-expense-row {
  padding: var(--space-sm) var(--space-md);
  gap: var(--space-sm);
}
.fixed-expense-row .fixed-expense-row-label {
  flex: 1 1 auto;
  min-width: 0;
  gap: 10px;
}
.fx-week-badge {
  flex-shrink: 0;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-soft);
  color: var(--steel);
}
.fx-week-1 {
  background: rgba(0, 100, 224, 0.12);
  color: #0064e0;
}
.fx-week-2 {
  background: rgba(224, 0, 64, 0.1);
  color: #d6336c;
}
.fx-week-3 {
  background: rgba(0, 160, 90, 0.12);
  color: #0a8f52;
}
.fx-week-4 {
  background: rgba(224, 130, 0, 0.12);
  color: #d97a00;
}
.fx-week-5 {
  background: rgba(120, 60, 224, 0.12);
  color: #7c3aed;
}
.fx-content {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fx-meta {
  flex-shrink: 1;
  min-width: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--steel);
}
.fx-amount {
  flex-shrink: 0;
  font-weight: 700;
  min-width: 80px;
  text-align: right;
}
.fixed-expense-row .fx-delete {
  color: var(--steel);
}
.fixed-expense-row .fx-delete:hover {
  color: var(--critical);
  background: var(--hairline-soft);
}

@media (max-width: 900px) {
  .page-shell {
    flex-direction: column;
  }
  .col-input,
  .col-list {
    flex-basis: auto;
    width: 100%;
    position: static;
    max-height: none;
    overflow-y: visible;
  }
  .list-card-scroll {
    position: static;
    max-height: none;
  }
  .list-card-scroll-body {
    overflow-y: visible;
  }
  table.tx-table {
    display: block;
    overflow-x: auto;
  }
  .list-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .topbar-menu {
    left: var(--space-xl);
    min-width: 0;
  }
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal-box {
    width: 100%;
    max-width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-sizing: border-box;
  }
  .donor-modal,
  .fixed-expense-modal {
    width: 100%;
    height: auto;
    max-height: 85vh;
  }
  .fixed-expense-add-form {
    grid-template-columns: 1fr;
  }
  .week-row {
    flex-wrap: wrap;
    row-gap: 8px;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
  }
  .week-row .week-title,
  .week-row .week-amount {
    white-space: nowrap;
  }
  .week-row .week-title strong {
    font-size: 13px;
  }
  .week-row .week-amount {
    font-size: 14px;
  }
  .week-report-btn {
    order: 10;
    width: 100%;
    justify-content: center;
    font-size: 12px;
    padding: 8px 10px;
  }
  .detail-summary {
    flex-wrap: nowrap;
    overflow-x: auto;
    font-size: 16px;
    white-space: nowrap;
  }
}

/* ===== 기부금영수증 — 요약 타일 ===== */
.receipt-basis-year-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.receipt-basis-year-group .year-select {
  height: 30px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  background: var(--canvas);
  color: var(--ink);
}
.receipt-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--hairline-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-lg);
}
.stat-tile {
  background: var(--canvas);
  padding: var(--space-md) var(--space-base);
}
.stat-tile-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--steel);
}
.stat-tile-amount {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 2px;
}
.stat-tile-words {
  font-size: 11px;
  color: var(--stone);
  margin-top: 1px;
}
.stat-tile-count {
  font-size: 12px;
  color: var(--stone);
  margin-top: 2px;
}

/* ===== 기부금영수증 — 인쇄 서식 =====
   표를 다시 그리지 않고, 정부 지정 서식 원본을 216dpi로 래스터화한 뒤 값만 지운 빈 양식
   이미지(public/donation-receipt-form.png, 1785x2526px)를 배경으로 깔고 그 위에 값만 정확한
   좌표(app.js의 receiptFieldStyle)로 얹는다 — 정부 양식의 테두리·라벨·법령 문구는 원본 그대로
   보존하기 위함. container-type으로 컨테이너 너비 기준 cqw 단위를 써서 미리보기·인쇄에서
   크기가 달라져도 이미지 위 같은 자리에 값이 맞춰진다. */
.receipt-doc {
  max-width: 720px;
  margin: 0 auto;
}
.receipt-doc-canvas {
  position: relative;
  width: 100%;
  container-type: inline-size;
}
.receipt-doc-bg {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
}
.receipt-doc-field {
  position: absolute;
  white-space: nowrap;
  line-height: 1.1;
  color: #191f28;
  font-weight: 400;
}
.receipt-doc-field.right {
  text-align: right;
}
.receipt-doc-seal-img {
  position: absolute;
  opacity: 0.92;
}
.receipt-fill-input {
  position: absolute;
  border: none;
  background: transparent;
  color: #191f28;
  font-family: inherit;
  font-weight: 400;
  line-height: 1.1;
  padding: 0;
}
.receipt-fill-input::placeholder {
  color: #b9c0c9;
  font-weight: 400;
}
.receipt-fill-input:focus {
  outline: none;
  background: rgba(0, 100, 224, 0.06);
}
