/* ========================================================
   관리자 공통 화면 프레임 (①메뉴 안내 ②주일 집계 ③세부집계 ④그래프)
   ======================================================== */
.cl-frame { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.cl-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

/* ① 선택한 메뉴명 안내 */
.cl-title { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.25rem; border-left: 5px solid var(--primary); }
.cl-title-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex: 0 0 46px; }
.cl-crumb { font-size: .75rem; color: var(--text-muted); font-weight: 600; }
.cl-title h2 { font-size: 1.35rem; line-height: 1.25; }
.cl-title p { font-size: .85rem; color: var(--text-secondary); margin-top: .1rem; }
.cl-scope { margin-left: auto; font-size: .78rem; font-weight: 700; color: var(--primary-strong); background: var(--primary-soft); border-radius: 999px; padding: .3rem .8rem; white-space: nowrap; }

/* ② 주일 집계 띠 */
.cl-today { padding: .9rem 1.25rem; }
.cl-today-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .7rem; }
.cl-today-head strong { font-size: .95rem; }
.cl-chip { font-size: .72rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; background: var(--bg-elevated); color: var(--text-secondary); }
.cl-chip.live { background: var(--success-soft); color: var(--success); }
.cl-chip.past { background: var(--warning-soft); color: var(--warning); }
.cl-services { display: flex; gap: .6rem; overflow-x: auto; padding-bottom: .2rem; }
.cl-svc { flex: 1 0 240px; background: var(--bg-app); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: .7rem .9rem; }
.cl-svc-top { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; margin-bottom: .4rem; }
.cl-svc-time { font-family: var(--font-heading); font-weight: 800; font-size: 1.1rem; }
.cl-svc-title { font-size: .76rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-nums { display: grid; grid-template-columns: repeat(5, 1fr); gap: .3rem; text-align: center; }
.cl-nums div span { display: block; font-size: .66rem; color: var(--text-muted); font-weight: 600; }
.cl-nums div b { font-size: 1.05rem; font-family: var(--font-heading); }
.cl-nums .ok b { color: var(--success); } .cl-nums .warn b { color: var(--warning); } .cl-nums .bad b { color: var(--danger); } .cl-nums .rate b { color: var(--primary); }
.cl-total-row { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: .7rem; padding-top: .7rem; border-top: 1px dashed var(--border-subtle); font-size: .85rem; color: var(--text-secondary); }
.cl-total-row b { color: var(--text-main); }
.cl-empty { font-size: .85rem; color: var(--text-muted); padding: .6rem 0; }

/* ③ 세부집계 */
.cl-detail > summary { list-style: none; display: flex; align-items: center; gap: .6rem; padding: .85rem 1.25rem; cursor: pointer; font-weight: 800; }
.cl-detail > summary::-webkit-details-marker { display: none; }
.cl-detail > summary::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); flex: 0 0 10px; }
.cl-detail > summary .cl-caret { margin-left: auto; transition: transform .2s; color: var(--text-muted); }
.cl-detail[open] > summary .cl-caret { transform: rotate(180deg); }
.cl-detail-body { padding: 0 1.25rem 1.1rem; display: flex; flex-direction: column; gap: .7rem; }
.cl-sum { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--primary-soft); border-radius: var(--radius-md); padding: .8rem 1rem; }
.cl-sum span { font-size: .8rem; font-weight: 700; color: var(--primary-strong); }
.cl-sum strong { font-size: 1.4rem; font-family: var(--font-heading); }
.cl-sum em { font-style: normal; font-size: .78rem; color: var(--text-secondary); }
.cl-table-wrap { overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); max-height: 340px; }
.cl-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.cl-table th { position: sticky; top: 0; background: var(--bg-elevated); text-align: left; font-size: .74rem; color: var(--text-secondary); padding: .55rem .8rem; white-space: nowrap; }
.cl-table td { padding: .55rem .8rem; border-top: 1px solid var(--border-subtle); white-space: nowrap; }
.cl-table td:first-child { font-weight: 700; }

/* ④ 그래프 영역 */
.cl-chart { padding: 1rem 1.25rem 1.1rem; }
.cl-chart h3 { font-size: 1rem; margin-bottom: .9rem; }
.cl-bars { display: flex; align-items: flex-end; gap: .6rem; height: 220px; border-bottom: 1px solid var(--border-subtle); padding: 0 .2rem; }
.cl-bar-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .25rem; }
.cl-bar { width: 100%; max-width: 54px; background: var(--primary); border-radius: 8px 8px 0 0; min-height: 3px; transition: height .4s; }
.cl-bar-col em { font-style: normal; font-size: .74rem; font-weight: 700; color: var(--text-secondary); white-space: nowrap; }
.cl-bar-labels { display: flex; gap: .6rem; padding: .35rem .2rem 0; }
.cl-bar-labels span { flex: 1; min-width: 0; text-align: center; font-size: .72rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-loading { color: var(--text-muted); font-size: .85rem; padding: 1rem; text-align: center; }

@media (max-width: 700px) {
  .cl-title { flex-wrap: wrap; } .cl-scope { margin-left: 0; }
  .cl-bars { height: 180px; }
}

/* ---- 기존 구성 정렬용 보정 ---- */
.cl-block { margin-bottom: 1rem; }
.cl-title.glass-card { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.25rem; border-left: 5px solid var(--primary); }
.cl-title-existing { position: relative; border-left: 5px solid var(--primary) !important; }
.cl-title-existing > .cl-crumb { display: block; width: 100%; flex-basis: 100%; margin-bottom: .15rem; }
.cl-title-existing > .cl-scope { margin-left: auto; align-self: flex-start; }
.cl-today.glass-card { padding: .9rem 1.25rem; }
.cl-dhead { display: flex; align-items: center; gap: .6rem; padding: .85rem 1.25rem 0; font-weight: 800; }
.cl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); display: inline-block; }
.cl-detail.glass-card, .cl-chart.glass-card { padding: 0 0 1rem; }
.cl-chart.glass-card { padding: 1rem 1.25rem 1.1rem; }
.cl-detail-existing .unified-split-grid > .cl-sublabel, .cl-sublabel { grid-column: 1 / -1; font-size: .78rem; font-weight: 800; color: var(--primary-strong); padding: .1rem .2rem; }
.cl-detail-existing .unified-split-grid > .unified-split-cell:first-of-type { grid-column: 1 / -1; background: var(--primary-soft); }

/* 집계 예배 선택: 표 조건 줄 */
.cl-grid-cond { display: inline-flex; align-items: center; gap: .45rem; font-size: .78rem; font-weight: 700; color: var(--primary-strong); background: var(--primary-soft); border-radius: 10px; padding: .25rem .6rem .25rem .8rem; }
.cl-grid-cond select { width: auto !important; min-width: 220px; max-width: 100%; font-weight: 700; border-color: var(--primary) !important; background: var(--bg-surface) !important; }
.cl-svc-main { font-size: .95rem !important; font-weight: 800; color: var(--text-main) !important; white-space: normal !important; }
.cl-svc-top { margin-bottom: .55rem; }
.cl-title-h { font-weight: 800; }


.cl-modal { position: fixed; inset: 0; z-index: 9000; background: var(--bg-overlay); display: flex; align-items: flex-start; justify-content: center; padding: 1rem; overflow-y: auto; }
.cl-modal-card { width: min(1100px, 100%); background: var(--bg-surface); border-radius: var(--radius-xl); padding: 1.2rem 1.3rem 1.5rem; margin: 1rem auto; box-shadow: var(--shadow-xl); }
.cl-modal-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-bottom: 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--border-subtle); }
.cl-modal-head b { font-size: 1.05rem; }
.cl-modal-body { min-width: 0; overflow-x: auto; }

/* ---- 상단 영역 컴팩트화 (제목 / 주일 집계 / 출석부 전환) ---- */
.cl-block { margin-bottom: .7rem !important; }
.cl-title-existing, .cl-title.glass-card { padding: .55rem 1rem !important; gap: .15rem .8rem; align-items: center; }
.cl-title-existing > .cl-crumb, .cl-title .cl-crumb { display: none !important; }       /* 제목이 메뉴명과 같아 '메뉴 › …' 줄은 중복 */
.cl-title-existing .cl-title-h, .cl-title h2 { font-size: 1.05rem !important; line-height: 1.25; margin: 0; }
.cl-title-existing p, .cl-title p { font-size: .74rem !important; margin: 0 !important; line-height: 1.3; }
.cl-title-existing .ic, .cl-title .cl-title-icon { font-size: 1rem; }
.cl-title .cl-title-icon { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; }
.cl-scope { padding: .2rem .65rem !important; font-size: .72rem !important; }

.cl-today.glass-card { padding: .6rem 1rem !important; }
.cl-today-head { margin-bottom: .45rem; gap: .5rem; }
.cl-today-head strong { font-size: .82rem; }
.cl-services { gap: .5rem; }
.cl-svc { flex: 1 1 100% !important; display: flex; align-items: center; gap: .6rem 1.2rem; flex-wrap: wrap; padding: .4rem .8rem !important; }
.cl-svc-top { margin: 0 !important; flex: 1 1 220px; }
.cl-svc-main { font-size: .85rem !important; }
.cl-nums { flex: 2 1 320px; gap: .2rem; }
.cl-nums div span { font-size: .62rem; } .cl-nums div b { font-size: .92rem; }
.cl-total-row { margin-top: .4rem !important; padding-top: .4rem !important; font-size: .78rem !important; gap: .4rem 1rem !important; }
.cl-empty { padding: .3rem 0; font-size: .8rem; }

.attendance-mode-selector { gap: .5rem !important; margin-bottom: .7rem !important; }
.attendance-mode-selector .btn-tab-pill { padding: .45rem 1rem !important; font-size: .9rem !important; gap: .45rem !important; border-radius: 12px !important; }
.attendance-mode-selector .btn-tab-pill .badge { font-size: .72rem !important; padding: .1rem .5rem !important; }

.cl-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); }
.cl-nums .off b { font-size: .85rem; white-space: nowrap; }

/* ===== 출석현황 세부 집계 헤더 컨트롤 (정돈) ===== */
.cl-att-header { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.cl-att-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-left: auto; }
.cl-att-controls .cl-grid-cond { height: 36px; padding: 0 .35rem 0 .7rem; gap: .4rem; font-size: .75rem; border-radius: 10px; }
.cl-att-controls .cl-grid-cond select { height: 28px; min-width: 200px; max-width: 260px; padding: 0 1.6rem 0 .55rem; font-size: .8rem; border-radius: 8px; }
.cl-att-btn { height: 36px; display: inline-flex; align-items: center; gap: .35rem; padding: 0 .85rem; border-radius: 10px; border: 1px solid var(--border-subtle); background: var(--bg-surface); color: var(--text-main); font: 700 .8rem/1 var(--font-body); cursor: pointer; white-space: nowrap; }
.cl-att-btn:hover { background: var(--bg-elevated); }
.cl-att-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; } .cl-att-btn.primary:hover { background: var(--primary-strong); }
@media (max-width: 700px) { .cl-att-controls { width: 100%; margin-left: 0; } .cl-att-controls .cl-grid-cond { flex: 1 1 100%; } .cl-att-controls .cl-grid-cond select { flex: 1; max-width: none; } }

/* ===== 상세 그래프 팝업 ===== */
.cl-modal-card { width: min(980px, 100%); }
.cl-modal-head b { display: inline; } .cl-modal-head small { color: var(--text-muted); font-size: .8rem; font-weight: 600; }
.cl-modal-ctl { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.cl-seg { display: inline-flex; background: var(--bg-elevated); border-radius: 10px; padding: .2rem; }
.cl-seg button { border: none; background: none; border-radius: 8px; padding: .4rem .9rem; font: 700 .8rem var(--font-body); color: var(--text-secondary); cursor: pointer; }
.cl-seg button.on { background: var(--bg-surface); color: var(--primary-strong); box-shadow: var(--shadow-sm); }
.cl-donuts { display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 1.5rem; align-items: start; }
.cl-donut-main, .cl-donut-side { background: var(--bg-app); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 1.2rem 1rem; }
.cl-donut-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.cl-donut { display: flex; flex-direction: column; align-items: center; gap: .25rem; text-align: center; }
.cl-donut b { font-size: .95rem; } .cl-donut small { color: var(--text-muted); font-size: .74rem; }
.cl-donut ul { list-style: none; padding: 0; margin: .4rem 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: .25rem .9rem; font-size: .78rem; color: var(--text-secondary); }
.cl-donut ul li { display: flex; align-items: center; gap: .35rem; } .cl-donut ul i, .cl-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cl-d-rate { font: 800 22px var(--font-heading); fill: var(--text-main); } .cl-d-sub { font: 600 9px var(--font-body); fill: var(--text-muted); }
.cl-modal-body h4 { font-size: .95rem; margin: 1.1rem 0 .6rem; } .cl-modal-body h4:first-child { margin-top: 0; }
.cl-bars2 { display: flex; flex-direction: column; gap: .5rem; }
.cl-brow { display: grid; grid-template-columns: 150px 1fr 52px; gap: .8rem; align-items: center; font-size: .82rem; }
.cl-bl { font-weight: 700; } .cl-bl small { color: var(--text-muted); font-weight: 600; margin-left: .35rem; }
.cl-bar2 { display: flex; height: 16px; background: #EEF2FA; border-radius: 999px; overflow: hidden; } .cl-bar2 i { display: block; height: 100%; }
.cl-br { text-align: right; font-weight: 800; }
.cl-legend { display: flex; gap: 1rem; margin-top: .7rem; font-size: .76rem; color: var(--text-secondary); } .cl-legend span { display: inline-flex; align-items: center; gap: .35rem; }
@media (max-width: 760px) { .cl-donuts { grid-template-columns: 1fr; } .cl-brow { grid-template-columns: 110px 1fr 44px; gap: .5rem; } }

/* ===== 사이드바 접기/펴기 ===== */
.admin-sidebar .sidebar-header-badge { cursor: pointer; user-select: none; display: flex; align-items: center; gap: .5rem; }
.admin-sidebar .sidebar-header-badge:hover { background: var(--primary-soft); }
.cl-sb-chev { margin-left: auto; font-weight: 800; color: var(--text-muted); font-size: 1.1rem; line-height: 1; }
.admin-sidebar, .admin-main-area, .admin-layout { transition: width .2s ease, min-width .2s ease, max-width .2s ease; }
body.sb-collapsed .admin-sidebar { width: 56px !important; min-width: 56px !important; overflow: hidden; }
body.sb-collapsed .admin-sidebar > *:not(.sidebar-header-badge) { display: none !important; }
body.sb-collapsed .admin-sidebar .sidebar-header-badge { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; height: 44px; }
body.sb-collapsed .admin-sidebar .sidebar-header-badge > span:not(.ic):not(.cl-sb-chev) { display: none; }
body.sb-collapsed .admin-sidebar .sidebar-header-badge .cl-sb-chev { margin-left: .2rem; }
body.sb-collapsed .admin-layout { max-width: none !important; }
@media (max-width: 1024px) {
  /* 좁은 화면: 사이드바가 위에 가로로 놓이므로 메뉴 카드만 접고 제목 줄은 남긴다 */
  body.sb-collapsed .admin-sidebar { width: 100% !important; min-width: 0 !important; }
  body.sb-collapsed .admin-sidebar .sidebar-header-badge { justify-content: flex-start; padding-left: .9rem; gap: .5rem; height: auto; }
  body.sb-collapsed .admin-sidebar .sidebar-header-badge > span:not(.ic):not(.cl-sb-chev) { display: inline; }
  body.sb-collapsed .admin-sidebar .sidebar-header-badge .cl-sb-chev { margin-left: auto; }
}

/* 학생 세부 집계에서 교사 통계 카드 제외 (요소는 기능 코드가 참조하므로 숨김 처리) */
#card-group-teacher { display: none !important; }
.unified-split-card .dept-comparison-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important; }

/* 세부 집계 헤더: 제목(왼쪽) / 컨트롤(오른쪽 위) / 필터링 안내+접기 버튼(컨트롤 바로 아래, 오른쪽 정렬) */
.cl-att-header { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 1rem; row-gap: .45rem; align-items: center; }
.cl-att-header > .cl-att-title { grid-column: 1; grid-row: 1 / span 2; align-self: center; min-width: 0; }
.cl-att-header > .cl-att-controls { grid-column: 2; grid-row: 1; margin-left: 0; justify-self: end; }
.cl-att-header > .cl-att-pillbox { grid-column: 2; grid-row: 2; justify-self: end; display: flex !important; align-items: center; gap: .6rem; margin: 0 !important; padding: 0 !important; }
.cl-att-pillbox > * { font-size: .72rem !important; }
.cl-att-pillbox [class*="pill"], .cl-att-pillbox span { padding: .15rem .65rem !important; }
@media (max-width: 900px) {
  .cl-att-header { grid-template-columns: 1fr; }
  .cl-att-header > .cl-att-title, .cl-att-header > .cl-att-controls, .cl-att-header > .cl-att-pillbox { grid-column: 1; grid-row: auto; justify-self: stretch; }
  .cl-att-header > .cl-att-pillbox { justify-content: flex-end; }
}

/* 헌금현황: 세부 집계 카드 안에 묶인 막대 그래프 */
.cl-chart-in { grid-column: 1 / -1; margin-top: .4rem; padding: 1rem 1.1rem 1.1rem; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.cl-chart-in h3 { font-size: .92rem; margin-bottom: .7rem; }
.cl-chart-in .cl-bars { height: 190px; }
.cl-bar-labels small { display: block; font-size: .66rem; color: var(--text-muted); font-weight: 600; }
.cl-bar-labels span { font-weight: 700; color: var(--text-secondary); }

/* 필터링 안내는 화살표 툴팁으로 */
.cl-tip { position: relative; cursor: pointer; }
.cl-tip:hover::after { content: attr(data-tip); position: absolute; right: -4px; top: calc(100% + 8px); background: #0F172A; color: #fff; font: 600 .74rem/1.2 var(--font-body); padding: .4rem .65rem; border-radius: 8px; white-space: nowrap; z-index: 60; box-shadow: var(--shadow-lg); pointer-events: none; }
.cl-tip:hover::before { content: ''; position: absolute; right: 6px; top: calc(100% + 3px); border: 5px solid transparent; border-bottom-color: #0F172A; border-top: 0; z-index: 60; pointer-events: none; }
/* 출석 세부 집계 헤더: 제목 | 컨트롤 | 화살표 한 줄 */
.cl-att-header { grid-template-columns: minmax(0, 1fr) auto auto !important; grid-template-rows: auto !important; }
.cl-att-header > .cl-att-title { grid-column: 1; grid-row: 1; }
.cl-att-header > .cl-att-controls { grid-column: 2; grid-row: 1; }
.cl-att-header > .cl-att-pillbox { grid-column: 3; grid-row: 1; justify-self: end; }
@media (max-width: 900px) { .cl-att-header { grid-template-columns: minmax(0, 1fr) auto !important; } .cl-att-header > .cl-att-title { grid-column: 1 / -1; } .cl-att-header > .cl-att-controls { grid-column: 1; grid-row: 2; justify-self: stretch; } .cl-att-header > .cl-att-pillbox { grid-column: 2; grid-row: 2; } }

/* 접기/펼치기 화살표: 글자 대신 컨트롤과 같은 아이콘 버튼 */
.cl-chev { position: relative; display: inline-flex !important; align-items: center; justify-content: center; width: 36px; height: 36px; margin: 0 !important; padding: 0 !important; flex: 0 0 36px;
  font-size: 0 !important; line-height: 0; color: transparent !important; border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--bg-surface); cursor: pointer; transition: background .15s, border-color .15s; }
.cl-chev:hover { background: var(--primary-soft); border-color: var(--primary); }
.cl-chev::before { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--text-secondary); border-bottom: 2px solid var(--text-secondary); transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
.cl-chev:hover::before { border-color: var(--primary-strong); }
.cl-chev[data-open="1"]::before { transform: translateY(2px) rotate(225deg); }
.cl-chev.cl-tip:hover::before { content: ''; position: static; border: 0; border-right: 2px solid var(--primary-strong); border-bottom: 2px solid var(--primary-strong); border-top: 0; border-left: 0; }

/* 출석부 표 헤더의 집계 예배 조건 */
.table-card .cl-grid-cond { height: 36px; padding: 0 .35rem 0 .7rem; border-radius: 10px; }
.table-card .cl-grid-cond select { height: 28px; min-width: 190px; max-width: 250px; padding: 0 1.6rem 0 .55rem; font-size: .8rem; border-radius: 8px; }

.cl-chart-in h3 small { font-weight: 600; font-size: .72rem; color: var(--text-muted); margin-left: .4rem; }
.cl-chart-in .cl-bar { max-width: 46px; }

.cl-upper-cond { background: var(--primary-soft); }

/* 출석부/헌금 표 헤더: 제목 글자 바로 뒤에 조건·버튼을 한 줄로 이어 붙인다 */
#tab-attendances .table-card > .card-header-row,
#tab-offerings .table-card > .card-header-row { display: flex !important; flex-wrap: nowrap; align-items: center; justify-content: flex-start !important; gap: .5rem 1rem; }
#tab-attendances .table-card > .card-header-row > h3,
#tab-offerings .table-card > .card-header-row > h3 { flex: 0 1 auto; min-width: 0; font-size: 1.15rem; margin: 0; white-space: normal; }
#tab-attendances .table-card > .card-header-row > .header-btn-group,
#tab-offerings .table-card > .card-header-row > .header-btn-group { flex: 1 1 auto; display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: .4rem; margin: 0; min-width: 0; }
#tab-attendances .table-card .header-btn-group .btn-header-action,
#tab-offerings .table-card .header-btn-group .btn-header-action { height: 34px; padding: 0 .65rem !important; font-size: .78rem !important; white-space: nowrap; }
#tab-attendances .table-card .header-btn-group .cl-grid-cond,
#tab-offerings .table-card .header-btn-group .cl-grid-cond { height: 34px; padding: 0 .3rem 0 .6rem; gap: .35rem; font-size: .72rem; }
#tab-attendances .table-card .header-btn-group .cl-grid-cond select,
#tab-offerings .table-card .header-btn-group .cl-grid-cond select { height: 26px; min-width: 150px; max-width: 200px; font-size: .76rem; }
@media (max-width: 900px) { #tab-attendances .table-card > .card-header-row, #tab-offerings .table-card > .card-header-row { flex-wrap: wrap; } }

/* 미래 예배 옵션(선택 불가) */
select option:disabled { color: #94A3B8; }

/* 교사 상세 명단 팝업 */
.cl-roster-wrap { overflow: auto; max-height: 60vh; border: 1px solid var(--border-subtle); border-radius: 12px; }
.cl-roster { width: 100%; border-collapse: collapse; font-size: .85rem; }
.cl-roster th { position: sticky; top: 0; background: var(--bg-elevated); text-align: left; font-size: .75rem; color: var(--text-secondary); padding: .55rem .8rem; white-space: nowrap; }
.cl-roster td { padding: .55rem .8rem; border-top: 1px solid var(--border-subtle); white-space: nowrap; }
.cl-st { font-size: .72rem; font-weight: 800; padding: .15rem .55rem; border-radius: 999px; background: var(--bg-elevated); color: var(--text-muted); }
.cl-st.PRESENT { background: var(--success-soft); color: var(--success); } .cl-st.LATE { background: var(--warning-soft); color: var(--warning); } .cl-st.ABSENT { background: var(--danger-soft); color: var(--danger); }

.cl-offrow { display: grid; grid-template-columns: 12px 1fr auto auto 46px; gap: .6rem; align-items: center; padding: .5rem .2rem; border-bottom: 1px solid var(--border-subtle); font-size: .85rem; }
.cl-offrow i { width: 10px; height: 10px; border-radius: 50%; } .cl-offrow small { color: var(--text-muted); } .cl-offrow em { font-style: normal; text-align: right; font-weight: 800; color: var(--text-secondary); }
.cl-cat { font-size: .72rem; font-weight: 800; padding: .15rem .55rem; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); }
/* 헌금 세부 집계 헤더: 그리드 배치 (출석현황과 동일) */
#card-offering-breakdown > .cl-att-header { padding-right: .2rem; }

/* 총 내역: 세부 내역 위를 가로로 꽉 채우는 한 줄 배너 */
.cl-detail-existing .unified-split-grid > .cl-total-cell { grid-column: 1 / -1 !important; display: flex !important; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1.5rem; padding: .9rem 1.3rem !important; background: var(--primary-soft); border-radius: var(--radius-md); }
.cl-total-cell > :first-child { flex: 1 1 200px; margin: 0 !important; }
.cl-total-cell > * { margin-top: 0 !important; margin-bottom: 0 !important; }
.cl-total-cell [id$="-total"], .cl-total-cell .offering-card-amount, .cl-total-cell .stat-value { text-align: right !important; }
.cl-total-cell .offering-card-sub, .cl-total-cell .stat-sub { text-align: right !important; min-width: 90px; }
@media (max-width: 700px) { .cl-total-cell > :first-child { flex-basis: 100%; } }

.cl-donut-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.2rem; }
.cl-dlist { list-style: none; padding: 0; margin: .4rem 0 0; width: 100%; }
.cl-dlist li { display: grid; grid-template-columns: 12px 1fr auto 42px; gap: .5rem; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--border-subtle); font-size: .82rem; }
.cl-dlist li i { width: 10px; height: 10px; border-radius: 50%; } .cl-dlist em { font-style: normal; text-align: right; font-weight: 800; color: var(--text-secondary); }
.cl-chart-acad { margin: .8rem 1.2rem 1.2rem; }
.cl-bar2 { min-width: 0; }

/* 모든 집계 카드: 헤더와 하단 카드 사이 여백 공통 */
.unified-split-card > div:first-of-type { margin-bottom: .5rem !important; }
.unified-split-card .unified-split-grid { margin-top: 0; }

/* 상단 제목줄의 부서명(중고등부) 배지 제거 */
.cl-scope { display: none !important; }

/* 제목 배너 오른쪽 태그 우측 정렬 통일 */
.cl-title-existing > .cl-pill-box { margin-left: auto !important; justify-content: flex-end; min-width: 0 !important; flex-grow: 0 !important; max-width: none !important; }
@media (max-width: 720px) { .cl-title-existing > .cl-pill-box { margin-left: 0 !important; } }

/* 출석 집계 바깥 흰 배경 카드 제거 (안쪽 세부 집계 카드만 남김) */
#card-unified-att-stats, #card-unified-teacher-att-stats { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; backdrop-filter: none !important; }
#card-unified-att-stats > .unified-split-card, #card-unified-teacher-att-stats > .unified-split-card { margin-bottom: 0; }

/* 모든 표 카드 헤더의 버튼 묶음은 오른쪽 정렬 공통 */
.table-card > .card-header-row > .header-btn-group,
#tab-attendances .table-card > .card-header-row > .header-btn-group,
#tab-offerings .table-card > .card-header-row > .header-btn-group { margin-left: auto; justify-content: flex-end !important; flex: 0 1 auto; }
.table-card > .card-header-row { justify-content: space-between; }

/* 지난 주일 예배 시간별 집계 띠: 출석·헌금 외 메뉴 화면에서는 제거 */
.tab-content:not(#tab-attendances):not(#tab-offerings) .cl-today { display: none !important; }
.cl-sublabel { display: flex; align-items: center; gap: .35rem; }
.cl-sublabel .ic, .cl-sublabel svg { width: 15px; height: 15px; }

/* Total 배너 색상 전 화면 통일 (연한 파랑 배경 + 진한 파랑 글자) */
.cl-detail-existing .unified-split-grid > .cl-total-cell { background: #DBE4FD !important; border: 0 !important; box-shadow: none !important; }
.cl-total-cell > :first-child, .cl-total-cell > :first-child * { color: #0B5394 !important; }
.cl-total-cell [id$="-total"], .cl-total-cell .stat-value, .cl-total-cell .offering-card-amount, .cl-total-cell [style*="font-weight: 800"] { color: #0B5394 !important; }
.cl-total-cell .offering-card-sub, .cl-total-cell .stat-sub, .cl-total-cell [style*="text-muted"] { color: var(--text-muted) !important; }

/* 집계 카드 공통: 여백 최소화 */
.unified-split-card { padding: .8rem 1rem !important; margin-bottom: .75rem !important; }
.unified-split-card > .cl-att-header { margin-bottom: .4rem !important; row-gap: .2rem; }
.cl-block { margin-bottom: .65rem !important; }
#card-care-stats-breakdown .badge { display: none !important; }

/* 학사관리 세부 집계 카드를 공통 디자인(제목 | 버튼 | 접기)에 맞춤: 학교 구분 탭은 다음 줄 오른쪽 */
#card-academics-stats-breakdown { padding: .8rem 1rem !important; border-left-width: 4px !important; }
#card-academics-stats-breakdown > .cl-att-header > .cl-att-pillbox { grid-column: 1 / -1 !important; grid-row: 2 !important; justify-self: end; margin: 0 !important; }
#card-academics-stats-breakdown .cl-att-title > div:first-child { font-size: .98rem !important; }
#card-academics-stats-breakdown .cl-att-title > div:first-child > span:first-child { font-size: 1.05rem !important; }
#card-academics-stats-breakdown .acad-dept-tab-btn { white-space: nowrap; }
#card-academics-stats-breakdown #acad-section-middle, #card-academics-stats-breakdown #acad-section-high { margin-bottom: .75rem !important; }
/* 학사관리: 전체 통합 / 중등부 / 고등부 탭 제거 (기능 연결용 요소는 숨김 처리) */
#card-academics-stats-breakdown > .cl-att-header > .cl-att-pillbox { display: none !important; }
#member-stats-dashboard.unified-split-grid { grid-template-columns: repeat(6, 1fr) !important; }
@media (max-width: 1100px) { #member-stats-dashboard.unified-split-grid { grid-template-columns: repeat(3, 1fr) !important; } }
#card-session-stats-breakdown .badge { display: none !important; }

/* ===== 학교관리 표 가독성 개선 ===== */
#school-table-body td { padding: .85rem .7rem !important; vertical-align: middle; line-height: 1.45; }
#school-table-body tr td { background: #fff !important; border-bottom: 1px solid #E5EAF5; }
#school-table-body tr:nth-child(even) td { background: #F6F8FD !important; }
#school-table-body tr:hover td { background: #EAF1FF !important; }
#school-table-body td:nth-child(1) { width: 44px; text-align: center; color: var(--text-muted); font-size: .8rem; }
#school-table-body td:nth-child(3) { min-width: 210px; }
#school-table-body td:nth-child(3) > *:first-child, #school-table-body td:nth-child(3) strong, #school-table-body td:nth-child(3) a { font-size: 1.02rem; font-weight: 800; color: #0F172A; }
#school-table-body td:nth-child(3) a, #school-table-body td:nth-child(3) button { font-size: .76rem; }
#school-table-body td:nth-child(4) span { background: transparent !important; border: 0 !important; font-size: .92rem !important; font-weight: 700; color: #1E293B !important; padding: 0 !important; }
#school-table-body td:nth-child(5) { text-align: center; font-weight: 800; }
#school-table-body td:nth-child(6) { min-width: 250px; }
#school-table-body td:nth-child(6) .btn { padding: .18rem .5rem !important; font-size: .74rem !important; border-radius: 999px; }
#school-table-body td:nth-child(6) > div > div:first-child { gap: .3rem !important; }
#school-table-body td:nth-child(6) > div > div:last-child { font-size: .78rem !important; color: #475569 !important; max-width: 280px !important; white-space: normal !important; }
#school-table-body td:nth-child(7) { min-width: 230px; font-size: .84rem; white-space: normal; word-break: keep-all; }
#school-table-body td:nth-child(7) .btn, #school-table-body td:nth-child(7) a.btn { padding: .2rem .55rem !important; font-size: .74rem !important; }
#tab-schools .data-table thead th { font-size: .86rem; font-weight: 800; color: #1E3A8A; padding: .85rem .7rem; white-space: nowrap; }
#tab-schools .data-table { min-width: 1080px !important; }

/* 항목설정: 기준 코드 카테고리 탭 */
.codes-cat-btn { padding: .45rem 1rem; border-radius: 999px; border: 1px solid var(--border-subtle); background: var(--bg-surface); color: var(--text-secondary); font-weight: 700; font-size: .88rem; cursor: pointer; }
.codes-cat-btn:hover { background: var(--primary-soft); }
.codes-cat-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
#codes-category-card .codes-list { max-width: 520px; }
.badge-checkedin { background: rgba(37, 99, 235, .14); color: #1D4ED8; border: 1px solid rgba(37, 99, 235, .35); }
#card-budget-stats-breakdown .badge { display: none !important; }
#card-event-stats-breakdown .badge { display: none !important; }
/* 항목설정: 출석 집계용 세부집계·그래프 카드는 의미가 없어 제거 */
#tab-items > .cl-detail, #tab-items > .cl-chart, #tab-items > .cl-today { display: none !important; }

/* 예산: 과목별 집행 현황 카드를 세부 집계 카드와 같은 틀로 */
#card-budget-items > #budget-items-head { display: flex !important; align-items: center; }
#card-budget-items #budget-categories-grid { margin-top: .25rem; }
#card-budget-items { padding: .8rem 1rem !important; margin-bottom: .75rem !important; }
.codes-stat:hover { background: var(--primary-soft) !important; }
