
/* ─── 커서 스피너 ─── */
#cursor-spinner {
    position: fixed;
    pointer-events: none;
    z-index: 999999;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(85, 110, 230, 0.2);
    border-top-color: #556ee6;
    border-radius: 50%;
    animation: lc-spin 0.65s linear infinite;
    opacity: 0;
    transition: opacity 0.12s ease;
}
[data-theme="dark"] #cursor-spinner {
    border-color: rgba(147, 197, 253, 0.18);
    border-top-color: #93c5fd;
}
body.api-loading #cursor-spinner { opacity: 1; }
@keyframes lc-spin {
    to { transform: rotate(360deg); }
}

/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3a5fa0;
    --primary-hover: #315389;
    --secondary-color: #5a6478;
    --success-color: #2f7d5b;
    --danger-color: #b0473b;
    --warning-color: #9a7320;
    --info-color: #2f7d80;
    --dark-color: #1a1f36;
    --light-color: #f8f9fa;
    --white-color: #ffffff;
    --border-color: #edf0f5;
    --border-subtle: #e9ecf2;
    --bg-page: #f3f5fa;
    --bg-subtle: #fafbfc;
    --bg-hover: #f8f9fb;
    --text-primary: #1a1f36;
    --text-secondary: #5a6478;
    --text-muted: #9aa1b1;
    --card-shadow: 0 6px 22px rgba(44,58,92,.06);
    --card-radius: 18px;
    --navbar-bg: #2c3a5c;
    --sidebar-width: 264px;
    --sidebar-collapsed-width: 60px;
    --navbar-height: 62px;
}

body {
    font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    color: var(--text-primary);
    background-color: var(--bg-page);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* 상단 네비게이션 바 */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background-color: var(--navbar-bg);
    box-shadow: 0 2px 8px rgba(20,28,52,.18);
    z-index: 1000;
    color: #dfe3f0;
}

.navbar-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 100%;
    padding: 0 20px;
}

.navbar-container > .sidebar-toggle {
    justify-self: start;
}

.navbar-container > .navbar-title {
    justify-self: center;
}

.navbar-container > .navbar-user {
    justify-self: end;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #cdd3e6;
    position: relative;
    transition: all 0.3s ease;
}

.hamburger::before,
.hamburger::after {
    content: '';
    display: block;
    width: 20px;
    height: 2px;
    background-color: #cdd3e6;
    position: absolute;
    transition: all 0.3s ease;
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    top: 8px;
}

.navbar-title {
    font-weight: 700;
    color: #dfe3f0;
    line-height: 1;
    display: flex;
    align-items: center;
    height: 100%;
}

.navbar-title-link {
    color: #dfe3f0;
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
}

.navbar-title-link:hover {
    color: #fff;
    cursor: pointer;
}

.navbar-title-main { display: block; line-height: 1.1; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }

/* ── ChurchLedger 로고 ─────────────────────────────────── */

/* ── A안: Antioch Church(가늘게) + Ledger(굵게·흰색) ── */
.cl-logo {
    display: inline-flex;
    align-items: center;
    gap: 0;
    line-height: 1;
}
.cl-antioch {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
    padding-right: 5px;
}
.cl-church {
    font-size: 16px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.88);
    letter-spacing: 0.03em;
    padding-right: 6px;
}
.cl-ledger {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}
.cl-l {
    display: inline-block;
}
.cl-bounce .cl-church .cl-l {
    animation: cl-bounce 0.6s ease forwards;
    animation-delay: calc(var(--i) * 0.08s);
}
@keyframes cl-bounce {
    0%   { transform: translateY(0); }
    25%  { transform: translateY(-7px); }
    55%  { transform: translateY(2px); }
    75%  { transform: translateY(-3px); }
    100% { transform: translateY(0); }
}

/* ── B안: Ledger 에 그라디언트 적용 (보라-파랑) ──────────
.cl-ledger {
    font-size: 17px;
    font-weight: 800;
    background: linear-gradient(135deg, #93c5fd 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.01em;
}
── */

/* ── C안: Church 숨기고 · 앞에 작은 뱃지 ─────────────────
.cl-church {
    font-size: 10px;
    font-weight: 600;
    color: #93c5fd;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: rgba(147,197,253,0.12);
    padding: 2px 6px;
    border-radius: 4px;
}
.cl-ledger {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}
── */

.navbar-title-sub {
    font-size: 11.5px;
    font-weight: 400;
    color: #8e99bd;
    line-height: 1;
    letter-spacing: -0.2px;
}

.navbar-user {
    font-size: 13.5px;
    color: #aeb8d6;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 사이드바 */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background-color: var(--white-color);
    border-right: 1px solid var(--border-subtle);
    box-shadow: none;
    transition: none;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 999;
}

/* 사이드바 transition 중에는 서브메뉴 숨김 */
.sidebar.transitioning .submenu {
    display: none !important;
}

.sidebar.collapsed,
html.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    overflow-x: visible;
}

.sidebar-nav > ul {
    list-style: none;
    padding: 20px 0;
}

.sidebar-nav li {
    margin: 0;
}

.sidebar-nav > ul > li {
    margin-bottom: 5px;
}

/* 카테고리 헤더 */
.nav-category .category-header {
    display: flex;
    align-items: center;
    padding: 13px 20px;
    color: #3a4356;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-weight: 600;
    font-size: 15px;
    user-select: none;
    gap: 11px;
}

.nav-category .category-header:hover {
    background-color: var(--bg-hover);
    color: var(--dark-color);
}

/* 활성화된 카테고리 */
.nav-category.active > .category-header {
    color: var(--dark-color);
    font-weight: 700;
}

.category-toggle {
    margin-left: auto;

    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.nav-category.collapsed .category-toggle {
    transform: rotate(-90deg);
}

/* 서브메뉴 */
.submenu {
    list-style: none;
    padding: 0;
    max-height: 500px;
    overflow: hidden;
    transition: none;
}

.nav-category.collapsed .submenu {
    max-height: 0;
    visibility: hidden;
}

/* 사이드바가 펼쳐진 상태에서만 collapsed 서브메뉴 완전 숨김 */
.sidebar:not(.collapsed) .nav-category.collapsed .submenu {
    display: none !important;
}

.submenu li {
    margin: 0;
}

.submenu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1px 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-weight: 400;
    font-size: 14.5px;
    border-radius: 12px;
    gap: 8px;
}

.submenu a:hover {
    background-color: var(--bg-hover);
    color: var(--dark-color);
}

.submenu li.active a {
    background-color: #eef3fb;
    color: var(--primary-color);
    font-weight: 700;
}

/* 미구현(예정) 메뉴 아이템 — 클릭 차단 + 흐리게 */
.submenu a.menu-pending {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}
.menu-pending-text {

    color: var(--text-secondary, #6c757d);
    margin-left: 4px;
    font-weight: 400;
}

/* 일반 메뉴 아이템 */
.sidebar-nav > ul > li:not(.nav-category) > a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #999;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-weight: 400;
}

.sidebar-nav > ul > li:not(.nav-category) > a:hover {
    color: var(--primary-color);
}

.sidebar-nav > ul > li:not(.nav-category) > a.active {
    color: #000;
    font-weight: 700;
}

.nav-icon {

    width: 20px;
    text-align: center;
    margin-right: 15px;
    flex-shrink: 0;
}

/* grid-3x3 아이콘만 얇은 선으로 (Lucide 기본 stroke-width=2) */
.nav-icon svg.lucide-grid-3x3 {
    stroke-width: 1.25;
}

/* 한자 아이콘 — 入/出 등을 Lucide SVG 자리에 텍스트로 렌더 */
.nav-icon-hanja {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;

    font-weight: 700;
    line-height: 1;
    font-family: '바탕', Batang, 'Noto Serif KR', serif;
    border: 1px solid currentColor;
    border-radius: 3px;
    box-sizing: border-box;
    /* 색상은 부모(.nav-icon)에서 상속 — 사이드바 기본 회색 */
}

/* 사이드바 접힌 상태에서 일반 서브메뉴 완전 숨김 (show 클래스 제외) */
.sidebar.collapsed .nav-category:not(:hover) .submenu:not(.show),
html.sidebar-collapsed .sidebar .nav-category .submenu:not(.show) {
    display: none !important;
    visibility: hidden;
    opacity: 0;
}

/* 사이드바 접힌 상태에서 카테고리 헤더의 텍스트만 숨김 */
.sidebar.collapsed .category-header .nav-text,
html.sidebar-collapsed .sidebar .category-header .nav-text {
    display: none !important;
}

/* 사이드바 접힌 상태에서 일반 메뉴의 텍스트 숨김 */
.sidebar.collapsed > .sidebar-nav > ul > li:not(.nav-category) > a .nav-text,
html.sidebar-collapsed .sidebar > .sidebar-nav > ul > li:not(.nav-category) > a .nav-text {
    display: none !important;
}

.sidebar.collapsed .category-toggle,
html.sidebar-collapsed .sidebar .category-toggle {
    display: none !important;
}

/* 사이드바 접힌 상태에서 서브메뉴 처리 */
.sidebar.collapsed .submenu,
html.sidebar-collapsed .sidebar .submenu {
    position: fixed;
    left: var(--sidebar-collapsed-width);
    background-color: var(--white-color);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    transition-delay: 0.1s;
    max-height: none;
    z-index: 1050;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 8px 0;
}

/* 서브메뉴의 텍스트는 항상 보이게 */
.sidebar.collapsed .submenu .nav-text {
    display: block;
}

.sidebar.collapsed .nav-category {
    position: relative;
}

/* JavaScript로 제어되는 서브메뉴 표시 */
.sidebar.collapsed .submenu.show {
    display: block !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
    max-height: none;
}

/* 가상 요소는 JavaScript 제어로 대체됨 */

.sidebar.collapsed .submenu a {
    padding: 12px 24px;
    display: block;
    color: var(--dark-color);
    text-decoration: none;
}

.sidebar.collapsed .submenu a:hover {
    color: var(--primary-color);
}

/* 사이드바 접힌 상태에서 카테고리 헤더 호버 효과 */
.sidebar.collapsed .nav-category:hover .category-header {
    color: var(--primary-color);
}

/* 사이드바 접힌 상태에서 일반 메뉴 아이템 툴팁 */
.sidebar.collapsed > .sidebar-nav > ul > li:not(.nav-category) {
    position: relative;
}

.sidebar.collapsed > .sidebar-nav > ul > li:not(.nav-category)::after {
    content: attr(data-tooltip);
    position: absolute;
    left: var(--sidebar-collapsed-width);
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--dark-color);
    color: var(--white-color);
    padding: 8px 16px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1001;

    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar.collapsed > .sidebar-nav > ul > li:not(.nav-category):hover::after {
    opacity: 1;
    visibility: visible;
}

/* 메인 콘텐츠 */
.main-content {
    position: fixed;
    top: var(--navbar-height);
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    padding: 40px 44px;
    transition: none;
    overflow-y: auto;
    overflow-x: hidden;
}

.main-content.expanded,
html.sidebar-collapsed .main-content {
    left: var(--sidebar-collapsed-width);
}

.content-wrapper {
    background-color: var(--white-color);
    border-radius: var(--card-radius);
    padding: 28px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

/* 페이지 헤더 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.page-header h2 {
    font-size: 27px;
    font-weight: 700;
    color: var(--dark-color);
    letter-spacing: -.01em;
    margin: 0;
}

/* 검색 영역 */
.search-container {
    margin-bottom: 20px;
}

.search-basic {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input {
    width: 300px;
    padding: 10px 15px;
    border: 1px solid #d7dae3;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--white-color, #fff);
    transition: border-color .15s, box-shadow .15s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(58,95,160,.1);
}

.search-advanced {
    margin-top: 12px;
    padding: 20px;
    background-color: var(--bg-subtle, #fafbfc);
    border-radius: 14px;
    border: 1px solid var(--border-color, #edf0f5);
}

.search-filters {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 250px;
}

.filter-group.filter-small {
    flex: 0.33;
    min-width: 150px;
}

.filter-group.filter-date {
    flex: 0 0 130px;
    min-width: 130px;
    max-width: 130px;
}

.filter-group.filter-amount {
    flex: 0.6;
    min-width: 220px;
}

.filter-group.with-operators {
    flex-direction: column;
    gap: 5px;
}

.filter-group.with-operators label {
    width: 100%;
    margin: 0;
}

.filter-group.with-operators .operator-input-container {
    display: flex;
    flex-direction: row;
    gap: 5px;
    width: 100%;
}

.filter-group.with-operators .filter-operators {
    flex-shrink: 0;
    display: flex;
    gap: 3px;
}

.filter-group.with-operators .filter-input {
    flex: 1;
    min-width: 80px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #5a6478);
}

.operator-btn {
    padding: 6px 8px;
    border: 1px solid #d7dae3;
    background-color: var(--white-color);
    color: var(--text-secondary, #5a6478);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    flex: 1;
    min-width: 10px;
    max-width: 50px;
}

.operator-btn:hover {
    background-color: var(--bg-hover, #f8f9fb);
}

.operator-btn.active {
    background-color: var(--white-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
    border-width: 2px;
}

.filter-input,
.filter-select {
    padding: 9px 12px;
    border: 1px solid #d7dae3;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary, #1a1f36);
    background: var(--white-color, #fff);
    transition: border-color .15s, box-shadow .15s;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(58,95,160,.1);
}

/* number input 스피너 제거 */
.filter-input[type="number"]::-webkit-inner-spin-button,
.filter-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.filter-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* 건수, 금액 입력 필드 우측 정렬 */
#searchCount,
#searchAmount {
    text-align: right;
}

/* 버튼 스타일 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, background-color 0.15s ease;
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--white-color);
    color: var(--text-secondary);
    border: 1px solid #d7dae3;
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
}

.btn-secondary.outline {
    background-color: var(--white-color);
    color: var(--text-secondary);
    border: 1px solid #d7dae3;
}

.btn-secondary.outline:hover {
    background-color: var(--bg-hover);
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--white-color);
    border: none;
}

.btn-danger:hover {
    filter: brightness(1.08);
}

.btn-info {
    background-color: var(--info-color);
    color: var(--white-color);
    border: none;
}

.btn-info:hover {
    filter: brightness(1.08);
}

.btn-excel {
    background-color: var(--white-color);
    border: 1px solid #cfe5d8;
    color: #2f7d5b;
}

.btn-excel:hover {
    background-color: #f0fdf4;
}

.btn-sm {
    padding: 9px 16px;
    font-size: 14px;
}

/* 테이블 */
.table-container {
    overflow-x: auto;
}

.income-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.income-table thead {
    background-color: var(--bg-subtle);
}

.income-table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #6b7280;
    border-bottom: 2px solid var(--border-subtle);
    border-right: none;
    white-space: nowrap;
}

.income-table th:last-child {
    border-right: none;
}

.income-table td {
    padding: 13px 14px;
    border-bottom: 1px solid #f1f2f5;
    border-right: none;
}

.income-table td:last-child {
    border-right: none;
}

.income-table tbody tr:hover {
    background-color: var(--bg-hover);
}

/* 수입유형 설정 테이블 — 일반 .income-table 룰을 오버라이드 (페이지 전용)
   !important 사용: 후속 미디어쿼리/중복 규칙이 충돌하는 경우가 있어 강제 우선 적용 */
#incomeTypeTable {
    table-layout: fixed !important;
}
#incomeTypeTable th:nth-child(1),
#incomeTypeTable td:nth-child(1) {
    width: 60px !important;
    text-align: center !important;
}
#incomeTypeTable th:nth-child(2),
#incomeTypeTable td:nth-child(2) {
    width: 300px !important;
    text-align: left !important;
    white-space: nowrap !important;
    max-width: none !important;
}
#incomeTypeTable th:nth-child(3),
#incomeTypeTable td:nth-child(3) {
    width: auto !important;
    text-align: left !important;
    white-space: normal !important;
    max-width: none !important;
}
#incomeTypeTable th:nth-child(4),
#incomeTypeTable td:nth-child(4) {
    width: 100px !important;
    text-align: center !important;
}
#incomeTypeTable th:nth-child(5),
#incomeTypeTable td:nth-child(5) {
    width: 180px !important;
    text-align: center !important;
}

/* 수입대장 테이블 컬럼 너비 설정 */
.income-table th:nth-child(1),
.income-table td:nth-child(1) {
    width: 5%;
}

.income-table th:nth-child(2),
.income-table td:nth-child(2) {
    width: 30%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
    text-align: left;
}

.income-table th:nth-child(3),
.income-table td:nth-child(3),
.income-table th:nth-child(4),
.income-table td:nth-child(4) {
    width: 13%;
    text-align: right;
}

.income-table th:nth-child(5),
.income-table td:nth-child(5),
.income-table th:nth-child(6),
.income-table td:nth-child(6),
.income-table th:nth-child(7),
.income-table td:nth-child(7) {
    width: 13%;
    text-align: center;
}

.text-right {
    text-align: right;
}

/* 수입개별 목록 테이블 컬럼 너비 설정 (헌금조회) */
#income_list_table {
    table-layout: auto !important;
}

#income_list_table th:nth-child(1),
#income_list_table td:nth-child(1) {
    text-align: center !important;
}

#income_list_table th:nth-child(2),
#income_list_table td:nth-child(2) {
    text-align: center !important;
}

#income_list_table th:nth-child(3),
#income_list_table td:nth-child(3) {
    text-align: center !important;
}

#income_list_table th:nth-child(4),
#income_list_table td:nth-child(4) {
    text-align: right !important;
}

#income_list_table th:nth-child(5),
#income_list_table td:nth-child(5) {
    text-align: center !important;
}

#income_list_table th:nth-child(6),
#income_list_table td:nth-child(6) {
    text-align: left !important;
}

#income_list_table th:nth-child(7),
#income_list_table td:nth-child(7) {
    text-align: left !important;
}

/* 입금조회 테이블 — 헌금조회와 동일 패턴 (페이지 전용 오버라이드) */
#deposit_table {
    table-layout: auto !important;
}

#deposit_table th:nth-child(1),
#deposit_table td:nth-child(1) {
    text-align: center !important;
}

#deposit_table th:nth-child(2),
#deposit_table td:nth-child(2) {
    text-align: center !important;
}

#deposit_table th:nth-child(3),
#deposit_table td:nth-child(3) {
    text-align: center !important;
}

#deposit_table th:nth-child(4),
#deposit_table td:nth-child(4) {
    text-align: right !important;
}

#deposit_table th:nth-child(5),
#deposit_table td:nth-child(5) {
    text-align: center !important;
}

#deposit_table th:nth-child(6),
#deposit_table td:nth-child(6) {
    text-align: left !important;
}

#deposit_table th:nth-child(7),
#deposit_table td:nth-child(7) {
    text-align: left !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--secondary-color);

}

/* 테이블 외부에서 사용되는 액션 버튼 */
.action-buttons:not(td) {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

/* 테이블 내 액션 버튼 스타일 - display를 변경하지 않음 */
.income-table td.action-buttons {
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
}

.btn-action {
    background: none;
    border: none;
    cursor: pointer;

    padding: 4px 8px;
    transition: transform 0.2s ease;
    display: inline-block;
    vertical-align: middle;
}

.btn-action:hover {
    transform: scale(1.2);
}

.btn-action:active {
    transform: scale(1);
}

/* 테이블 셀 내 버튼 간격 */
td.action-buttons .btn-action {
    margin: 0 2px;
}

/* 배지 스타일 */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;

    font-weight: 400;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-warning {
    background-color: #fff3cd;
    color: #ff8c00;
    font-weight: 700;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

/* 모달 shake 애니메이션 (외부 클릭 시) */
@keyframes modal-shake {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.02); }
    50% { transform: scale(0.98); }
    75% { transform: scale(1.01); }
}

.modal-content.shake {
    animation: modal-shake 0.5s ease-in-out;
}

.modal-content {
    background-color: var(--white-color);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(44,58,92,.18);
    border: 1px solid var(--border-color);
}

.modal-small {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {

    font-weight: 600;
    color: var(--dark-color);
}

.modal-close {
    background: none;
    border: none;

    color: var(--secondary-color);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--dark-color);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    padding-bottom: 8px;
    border-top: 1px solid var(--border-color);
}

/* 폼 스타일 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
}

.required {
    color: var(--danger-color);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d7dae3;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(58,95,160,.1);
}

.form-group textarea {
    resize: vertical;
}

/* 임시 페이지 스타일 */
.temp-page-content {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    padding: 40px 20px;
}

.info-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white-color);
    border-radius: 12px;
    padding: 40px;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.info-icon {

    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.info-box h3 {

    margin-bottom: 15px;
    font-weight: 600;
}

.info-box p {

    margin-bottom: 25px;
    opacity: 0.9;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 30px 0;
    text-align: left;
}

.feature-list li {
    padding: 10px 0;

    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.feature-list li:last-child {
    border-bottom: none;
}

.page-status {
    margin-top: 30px;
}

.status-badge {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 20px;

    font-weight: 600;
}

.status-badge.status-pending {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--white-color);
}

/* 일반 메뉴 아이템 active 스타일은 위에서 정의됨 (line 238-241) */

/* 오버레이 (모바일용) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* 반응형 디자인 */
@media (max-width: 1366px) {
    .content-wrapper {
        padding: 20px;
    }
}

/* 버튼 레이블 기본 상태 (sm 아닌 경우) */
.btn-label-full { display: inline; }
.btn-label-sm   { display: none; }

/* 아이콘 + 텍스트 버튼 정렬 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.btn i[data-lucide] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ≤1100px: 사이드바 오버레이 방식 (모바일 + 중간 해상도 공통) */
@media (max-width: 1100px) {
    .main-content {
        padding: 22px 20px;
    }

    /* 사이드바: 기본 숨김, 슬라이드 오버레이 */
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.25s ease-out;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        transition: transform 0.3s ease-in;
    }

    /* collapsed 클래스 무시 — 오버레이 모드에서는 항상 전체 너비 */
    .sidebar.collapsed {
        width: var(--sidebar-width);
        transform: translateX(-100%);
    }

    .sidebar.collapsed.mobile-open {
        transform: translateX(0);
    }

    /* 메인 콘텐츠: 항상 전체 너비 (사이드바가 overlay이므로) */
    .main-content {
        left: 0;
    }

    .main-content.expanded,
    html.sidebar-collapsed .main-content {
        left: 0;
    }

    /* 열린 사이드바 서브메뉴: 아코디언 방식 */
    .sidebar.mobile-open .submenu {
        position: static;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0;
    }

    /* 열린 사이드바 텍스트/토글 항상 표시 */
    .sidebar.mobile-open .nav-text,
    .sidebar.mobile-open .category-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    /* 모바일 전용 추가 규칙 (1100px 블록에서 처리하지 않은 것들) */

    .navbar-title {

    }

    .page-header {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* 모바일 테이블 가로 스크롤: 컨테이너는 이미 overflow-x: auto */
    .income-table {
        min-width: 600px;
    }

    /* 헌금/입금 조회 테이블 (7컬럼) */
    #income_list_table,
    #deposit_table {
        min-width: 800px;
    }

    /* 헌금대장/입금장부 목록 테이블 (7컬럼) */
    #income_table,
    #deposit_group_table {
        min-width: 650px;
    }

    /* 수입유형 설정 테이블 */
    #incomeTypeTable {
        min-width: 500px;
    }

    /* 사용자 관리 테이블 (8컬럼) */
    .user-table-wrapper {
        overflow-x: auto;
    }
    .user-table {
        min-width: 700px;
    }

    .income-table th,
    .income-table td {
        padding: 10px;
    }

    .modal-content {
        width: 95%;
    }

    /* 테이블 외부 action-buttons만 세로 정렬, 테이블 내부는 가로 유지 */
    .action-buttons:not(td .action-buttons) {
        flex-direction: column;
    }
    /* 테이블 내 action-buttons는 항상 가로 정렬 */
    td .action-buttons {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 4px;
        justify-content: center;
        align-items: center;
    }

    /* sm 버튼 레이블 전환 */
    .btn-label-full { display: none; }
    .btn-label-sm   { display: inline; }

    /* sm 전체 텍스트 크기 98% */
    * { font-size: 98% !important; }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 15px;
    }

    .navbar-title {

    }

    .income-table th,
    .income-table td {
        padding: 8px;

    }
}

/* 1920x1080 최적화 */
@media (min-width: 1920px) {
    .content-wrapper {
        max-width: 1600px;
        margin: 0 auto;
    }

    .income-table {

    }

    .page-header h2 {

    }
}


/* pagination */
.pagination {
    display: inline-block;
    justify-content: center;
    text-align: center;
    padding-left: 0;
    margin: 20px 0;
    /*border-radius: 4px;*/
    border: 1px solid #fff;
}

.pagination > li {
    display: inline;
}

.pagination > li > a,
.pagination > li > span {
    position: relative;
    float: left;
    padding: 6px 12px;
    margin-left: -1px;
    line-height: 1.42857143;
    /*color: #337ab7;*/
    color: #595757;
    text-decoration: none;
    background-color: #fff;
    /*border: 1px solid #ddd;*/
}

.pagination > li:first-child > a,
.pagination > li:first-child > span {
    margin-left: 0;
    /*border-top-left-radius: 4px;*/
    /*border-bottom-left-radius: 4px;*/
}

.pagination > li:last-child > a,
.pagination > li:last-child > span {
    /*border-top-right-radius: 4px;*/
    /*border-bottom-right-radius: 4px;*/
}

.pagination > li > a:hover,
.pagination > li > span:hover,
.pagination > li > a:focus,
.pagination > li > span:focus {
    z-index: 2;
    /*color: #23527c;*/
    font-weight: bold;
    /*background-color: #eee;*/
    /*border-color: #ddd;*/
    cursor: pointer;
}

.pagination > .active > a {
    z-index: 3;
    background-color: var(--primary-color) !important;
    color: #fff !important;
    border-radius: 4px;
    cursor: default;
    font-size: inherit;
    top: 0;
    position: relative;
    text-decoration: none !important;
    font-weight: 600;
}

.pagination > .active > span,
.pagination > .active > a:hover,
.pagination > .active > span:hover,
.pagination > .active > a:focus,
.pagination > .active > span:focus {
    z-index: 3;
    background-color: var(--primary-color) !important;
    color: #fff !important;
    cursor: default;
}

.pagination > .disabled > span,
.pagination > .disabled > span:hover,
.pagination > .disabled > span:focus,
.pagination > .disabled > a,
.pagination > .disabled > a:hover,
.pagination > .disabled > a:focus {
    /*color: #777;*/
    color: #C9CACA;
    cursor: not-allowed !important;
    background-color: #fff;
    /*border-color: #ddd;*/
}

.pagination-lg > li > a,
.pagination-lg > li > span {
    padding: 10px 16px;

    line-height: 1.3333333;
}

.pagination-lg > li:first-child > a,
.pagination-lg > li:first-child > span {
    /*border-top-left-radius: 6px;*/
    /*border-bottom-left-radius: 6px;*/
}

.pagination-lg > li:last-child > a,
.pagination-lg > li:last-child > span {
    /*border-top-right-radius: 6px;*/
    /*border-bottom-right-radius: 6px;*/
}

.pagination-sm > li > a,
.pagination-sm > li > span {
    padding: 5px 10px;

    line-height: 1.5;
}

.pagination-sm > li:first-child > a,
.pagination-sm > li:first-child > span {
    /*border-top-left-radius: 3px;*/
    /*border-bottom-left-radius: 3px;*/
}

.pagination-sm > li:last-child > a,
.pagination-sm > li:last-child > span {
    /*border-top-right-radius: 3px;*/
    /*border-bottom-right-radius: 3px;*/
}
/* pagination */

/* 페이지네이션 중앙 정렬 */
.div_center {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* 테이블 정렬 기능 */
.cursor {
    cursor: pointer;
    user-select: none;
}

.sort-icon {
    display: inline-block;
    margin-right: 5px;
    line-height: 1;
    vertical-align: baseline;
    font-weight: bold;
}

.sort-icon::before {
    content: '-';
    color: #ccc;
    font-size: 1em;
    font-weight: bold;
}

.sort-icon.checked::before {
    content: '↑';
    color: var(--primary-color);
    font-weight: bold;
}

.sort-icon.dbl-checked::before {
    content: '↓';
    color: var(--primary-color);
    font-weight: bold;
}

/* DataTables 커스텀 스타일 */
.dataTables_wrapper {
    overflow-x: auto;
}

/* DataTables 컬럼 min-width 강제 지정 (모바일 줄바꿈/압축 방지) */

/* 헌금조회 / 입금조회 (7컬럼: # / 날짜 / 헌금자명 / 금액 / 유형 / 대장 / 비고) */
#income_list_table th:nth-child(1), #income_list_table td:nth-child(1),
#deposit_table      th:nth-child(1), #deposit_table      td:nth-child(1) { min-width: 40px !important; width: 40px !important; text-align: center !important; }
#income_list_table th:nth-child(2), #income_list_table td:nth-child(2),
#deposit_table      th:nth-child(2), #deposit_table      td:nth-child(2) { min-width: 100px !important; width: 100px !important; white-space: nowrap !important; }
#income_list_table th:nth-child(3), #income_list_table td:nth-child(3),
#deposit_table      th:nth-child(3), #deposit_table      td:nth-child(3) { min-width: 100px !important; }
#income_list_table th:nth-child(4), #income_list_table td:nth-child(4),
#deposit_table      th:nth-child(4), #deposit_table      td:nth-child(4) { min-width: 90px !important; }
#income_list_table th:nth-child(5), #income_list_table td:nth-child(5),
#deposit_table      th:nth-child(5), #deposit_table      td:nth-child(5) { min-width: 80px !important; }
#income_list_table th:nth-child(6), #income_list_table td:nth-child(6),
#deposit_table      th:nth-child(6), #deposit_table      td:nth-child(6) { min-width: 160px !important; }
#income_list_table th:nth-child(7), #income_list_table td:nth-child(7),
#deposit_table      th:nth-child(7), #deposit_table      td:nth-child(7) { min-width: 200px !important; }

/* 헌금대장목록 / 입금장부목록 (7컬럼: # / 제목 / 건수 / 금액 / 등록일 / 작성자 / 작업) */
#income_table        th:nth-child(1), #income_table        td:nth-child(1),
#deposit_group_table th:nth-child(1), #deposit_group_table td:nth-child(1) { min-width: 40px !important; width: 40px !important; text-align: center !important; }
#income_table        th:nth-child(2), #income_table        td:nth-child(2),
#deposit_group_table th:nth-child(2), #deposit_group_table td:nth-child(2) { min-width: 160px !important; }
#income_table        th:nth-child(3), #income_table        td:nth-child(3),
#deposit_group_table th:nth-child(3), #deposit_group_table td:nth-child(3) { min-width: 80px !important; }
#income_table        th:nth-child(4), #income_table        td:nth-child(4),
#deposit_group_table th:nth-child(4), #deposit_group_table td:nth-child(4) { min-width: 120px !important; }
#income_table        th:nth-child(5), #income_table        td:nth-child(5),
#deposit_group_table th:nth-child(5), #deposit_group_table td:nth-child(5) { min-width: 120px !important; text-align: right !important; }
#income_table        th:nth-child(6), #income_table        td:nth-child(6),
#deposit_group_table th:nth-child(6), #deposit_group_table td:nth-child(6) { min-width: 100px !important; text-align: right !important; }
#income_table        th:nth-child(7), #income_table        td:nth-child(7),
#deposit_group_table th:nth-child(7), #deposit_group_table td:nth-child(7) { min-width: 140px !important; }


/* Handsontable rowHeaders(#) 너비 강제 — 헌금등록·입금등록 그리드
   rowHeaderWidth 옵션이 다른 CSS 에 의해 가려지는 경우가 있어 !important 로 잠금 */
.handsontable .ht_clone_left col.rowHeader,
.handsontable .ht_clone_top_left_corner col.rowHeader,
.handsontable col.rowHeader,
.handsontable .ht_clone_left th,
.handsontable .ht_clone_top_left_corner th,
.handsontable .htCore tbody th,
.handsontable .ht_clone_top .htCore thead th:first-child {
    /* ⚠️ width 고정 금지: 이 선택자는 autocomplete/dropdown 드롭다운 내부
       Handsontable의 첫 번째(유일한) 컬럼에도 동일하게 적용된다.
       width를 40px로 고정하면 유형·구분 드롭다운 항목이 40px로 잘려 보이는 버그 발생.
       행 헤더 너비는 위쪽 col.rowHeader / .ht_clone_left th 규칙으로 이미 제어됨. */
    /*width: 40px !important;*/
    /*min-width: 40px !important;*/
    /*max-width: 40px !important;*/
    text-align: center !important;
}

/* DataTables 상단 컨트롤 영역 */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 15px;
}

.dataTables_wrapper .dataTables_length select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin: 0 5px;

}

.dataTables_wrapper .dataTables_filter input {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-left: 8px;

}

/* DataTables 테이블 스타일 */
table.dataTable {
    border-collapse: collapse !important;
    width: 100% !important;
    margin-top: 0 !important;
    border: none !important;
}

table.dataTable thead th {
    padding: 12px 14px !important;
    background-color: var(--bg-subtle) !important;
    background: var(--bg-subtle) !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    color: #6b7280 !important;
    border-top: none !important;
    border-bottom: 2px solid var(--border-subtle) !important;
    border-right: none !important;
    text-align: left;
    white-space: nowrap;
}

table.dataTable tbody td {
    padding: 13px 14px !important;
    border-bottom: 1px solid #f1f2f5 !important;
    border-right: none !important;
    vertical-align: middle;
}

/* DataTables 세로 줄 제거 (B안: 가로선만 사용) */
table.dataTable.cell-border thead th,
table.dataTable.cell-border tbody td {
    border-right: none;
}

table.dataTable.cell-border thead th:last-child,
table.dataTable.cell-border tbody td:last-child {
    border-right: none;
}

/* DataTables 행 호버 효과 */
table.dataTable tbody tr:hover {
    background-color: var(--bg-hover) !important;
}

/* DataTables 정렬 아이콘 */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
    cursor: pointer;
    position: relative;
}

table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    position: absolute;
    right: 8px;
    font-family: Arial, sans-serif;

    color: #999;
}

/* 우정렬 컬럼의 정렬 아이콘 공간 확보 */
.income-table th:nth-child(3),
.income-table th:nth-child(4) {
    padding-right: 30px !important;
}

table.dataTable thead .sorting:after {
    content: '⇅';
}

table.dataTable thead .sorting_asc:after {
    content: '↑';
    color: var(--primary-color);
}

table.dataTable thead .sorting_desc:after {
    content: '↓';
    color: var(--primary-color);
}

/* DataTables 하단 정보 및 페이징 */
.dataTables_wrapper .dataTables_info {
    padding-top: 15px;

    color: var(--secondary-color);
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 15px;
    text-align: right;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    min-width: 38px;
    height: 38px;
    padding: 0 11px;
    margin-left: 4px;
    border: 1px solid var(--border-color) !important;
    border-radius: 9px !important;
    color: var(--text-secondary) !important;
    background-color: var(--white-color) !important;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    font-family: inherit;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    transition: border-color 0.15s, color 0.15s;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
    background-color: var(--white-color) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background-color: var(--primary-color) !important;
    color: var(--white-color) !important;
    border-color: var(--primary-color) !important;
    font-weight: 700;
    box-shadow: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #c9cfdb !important;
    cursor: not-allowed !important;
    box-shadow: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background-color: var(--white-color) !important;
    border-color: var(--border-color) !important;
    color: #c9cfdb !important;
}

/* DataTables 처리중 표시 */
.dataTables_wrapper .dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin-left: -20px;
    margin-top: -20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 0;
}
.dt-proc-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid rgba(85, 110, 230, 0.2);
    border-top-color: #556ee6;
    border-radius: 50%;
    animation: lc-spin 0.65s linear infinite;
}
[data-theme="dark"] .dt-proc-spinner {
    border-color: rgba(147, 197, 253, 0.18);
    border-top-color: #93c5fd;
}
.dataTables_wrapper .dataTables_processing > div:last-child {
    display: none !important;
}

/* DataTables 레이아웃 조정 */
.dataTables_wrapper .dataTables_length {
    float: left;
}

.dataTables_wrapper .dataTables_filter {
    float: right;
}

.dataTables_wrapper .dataTables_info {
    float: left;
}

.dataTables_wrapper .dataTables_paginate {
    float: right;
}

/* Clear float */
.dataTables_wrapper:after {
    content: "";
    display: table;
    clear: both;
}

/* ===== 드래그 모드 (수입유형 순서 변경) ===== */
.drag-handle {
    cursor: grab;
    color: var(--secondary-color, #999);
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle svg {
    width: 18px;
    height: 18px;
}

.drag-mode-active {
    border: 2px solid var(--primary-color, #7c8ff0);
    border-radius: 8px;
}

.drag-mode-active table tr:hover {
    background-color: var(--hover-color, #f0f7ff);
}

.sortable-ghost {
    opacity: 0.4;
    background-color: var(--hover-color, #e8f0fe) !important;
}

.sortable-chosen {
    background-color: var(--hover-color, #f0f7ff) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   상단 네비 - 사용자 드롭다운
   ============================================================ */
.user-menu {
    position: relative;
    margin-left: 12px;
}

.user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 6px;
    color: #dfe3f0;
    cursor: pointer;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    transition: background-color 0.15s ease;
}

.user-menu-toggle:hover {
    background-color: rgba(255,255,255,.08);
}

.user-menu-caret {

    opacity: 0.7;
    transition: transform 0.15s ease;
}

.user-menu.open .user-menu-caret {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background-color: var(--white-color, #fff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    list-style: none;
    margin: 0;
    padding: 4px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 1100;
}

.user-menu.open .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-dropdown li {
    list-style: none;
}

.user-menu-dropdown a {
    display: block;
    padding: 8px 14px;
    color: var(--text-primary, #1a1f36);
    text-decoration: none;
}

.user-menu-dropdown a:hover {
    background-color: var(--hover-color, #f0f7ff);
}

/* ============================================================
   로그인 페이지
   ============================================================ */
.login-body {
    overflow: auto;
    background-color: var(--light-color, #f5f5f5);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background-color: var(--white-color, #fff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 12px;
    padding: 36px 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.login-title {
    margin: 0 0 6px 0;
    font-weight: 700;
    text-align: center;
    color: var(--dark-color, #343a40);
}
.login-title .cl-antioch { font-size: 26px; color: var(--dark-color, #1a1f36); }
.login-title .cl-church  { font-size: 26px; color: var(--text-secondary, #5a6478); font-weight: 400; }
.login-title .cl-ledger  { font-size: 26px; color: var(--dark-color, #1a1f36); }
[data-theme="dark"] .login-title .cl-antioch { color: #e8eaf0; }
[data-theme="dark"] .login-title .cl-church  { color: #8898bb; }
[data-theme="dark"] .login-title .cl-ledger  { color: #e8eaf0; }

.login-subtitle {
    margin: 0 0 24px 0;
    text-align: center;
    color: var(--secondary-color, #6c757d);

}

.login-error {
    background-color: #fff5f5;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 16px;

}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-label {

    font-weight: 500;
    color: var(--dark-color, #343a40);
}

.login-field input[type="text"],
.login-field input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 6px;

    font-family: inherit;
    background-color: var(--white-color, #fff);
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-field input:focus {
    outline: none;
    border-color: var(--primary-color, #556ee6);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

.login-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    color: var(--secondary-color, #6c757d);
    cursor: pointer;
}

.login-submit {
    margin-top: 6px;
    padding: 12px;
    background-color: var(--primary-color, #556ee6);
    color: #fff;
    border: none;
    border-radius: 6px;

    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease;
}

.login-submit:hover {
    filter: brightness(1.05);
}

.login-help {
    margin: 18px 0 0 0;
    text-align: center;
    color: var(--secondary-color, #6c757d);
    font-size: 0.9em;
}

/* ============================================================
   내 정보 페이지
   ============================================================ */
.profile-card {
    max-width: 560px;
    background-color: var(--white-color, #fff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    padding: 24px;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-row {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.profile-label {
    flex: 0 0 120px;
    color: var(--secondary-color, #6c757d);

}

.profile-value {
    color: var(--dark-color, #343a40);
    font-weight: 500;
}

.profile-divider {
    margin: 24px 0;
    border: none;
    border-top: 1px solid var(--border-color, #dee2e6);
}

.profile-section-title {
    margin: 0 0 16px 0;

    font-weight: 600;
}

.profile-alert {
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 14px;

}

.profile-alert-error {
    background-color: #fff5f5;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.profile-alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 360px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-field-label {

    font-weight: 500;
}

.profile-field input[type="password"] {
    padding: 10px 12px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 6px;

    font-family: inherit;
    background-color: var(--white-color, #fff);
    color: inherit;
}

.profile-field input:focus {
    outline: none;
    border-color: var(--primary-color, #556ee6);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

.profile-submit {
    margin-top: 6px;
    padding: 10px 18px;
    background-color: var(--primary-color, #556ee6);
    color: #fff;
    border: none;
    border-radius: 6px;

    font-weight: 600;
    cursor: pointer;
    align-self: flex-start;
}

.profile-submit:hover {
    filter: brightness(1.05);
}

/* 다크모드 보정 */
[data-theme="dark"] .login-card,
[data-theme="dark"] .profile-card,
[data-theme="dark"] .user-menu-dropdown {
    background-color: #192238;
    border-color: #2e3d58;
    color: #d0d7ea;
}

[data-theme="dark"] .login-body {
    background-color: #141e32;
}

[data-theme="dark"] .login-title,
[data-theme="dark"] .profile-section-title,
[data-theme="dark"] .profile-value,
[data-theme="dark"] .login-label,
[data-theme="dark"] .profile-field-label {
    color: #d0d7ea;
}

[data-theme="dark"] .login-field input,
[data-theme="dark"] .profile-field input {
    background-color: #141e32;
    border-color: #2e3d58;
    color: #d0d7ea;
}

[data-theme="dark"] .user-menu-dropdown a:hover,
[data-theme="dark"] .user-menu-toggle:hover {
    background-color: #2e3d58;
}

[data-theme="dark"] .login-error,
[data-theme="dark"] .profile-alert-error {
    background-color: #3f1d1d;
    border-color: #7f1d1d;
    color: #fecaca;
}

[data-theme="dark"] .profile-alert-success {
    background-color: #14352a;
    border-color: #166534;
    color: #bbf7d0;
}

/* ============================================================
   사용자 관리 페이지
   ============================================================ */
.user-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 16px 0;
}

.user-search {
    flex: 1 1 240px;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 6px;

    font-family: inherit;
    background-color: var(--white-color, #fff);
    color: inherit;
}

.user-filter {
    padding: 8px 12px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 6px;

    font-family: inherit;
    background-color: var(--white-color, #fff);
    color: inherit;
    cursor: pointer;
}

.user-table-wrapper {
    background-color: var(--white-color, #fff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    overflow: auto;
}

.user-table {
    width: 100%;
    border-collapse: collapse;

}

.user-table thead {
    background-color: var(--light-color, #f8f9fa);
}

.user-table th,
.user-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #dee2e6);
    border-right: 1px solid var(--border-color, #dee2e6);
    white-space: nowrap;
}

.user-table th:last-child,
.user-table td:last-child {
    border-right: none;
}

/* 컬럼 너비: 아이디/사용자명/권한 넓게, 액션 좁게 */
#userTable th:nth-child(1),
#userTable td:nth-child(1) { width: 16%; }   /* 아이디 */
#userTable th:nth-child(2),
#userTable td:nth-child(2) { width: 14%; }   /* 사용자명 */
#userTable th:nth-child(3),
#userTable td:nth-child(3) { width: 10%; }   /* 권한 */
#userTable th:nth-child(4),
#userTable td:nth-child(4) { width: 6%; text-align: center; }  /* 활성 */
#userTable th:nth-child(5),
#userTable td:nth-child(5) { width: 6%; text-align: center; }  /* 잠금 */
#userTable th:nth-child(6),
#userTable td:nth-child(6) { width: 18%; }   /* 마지막 로그인 */
#userTable th:nth-child(7),
#userTable td:nth-child(7) { width: 14%; }   /* 가입일 */
#userTable th:nth-child(8),
#userTable td:nth-child(8) { width: 100px; } /* 액션 */

/* 세입예결산 목록 (7컬럼) — 제목·기간 동일 너비 */
#budgetTable th:nth-child(1), #budgetTable td:nth-child(1) { width: 4%; }
#budgetTable th:nth-child(2), #budgetTable td:nth-child(2) { width: 28%; }
#budgetTable th:nth-child(3), #budgetTable td:nth-child(3) { width: 28%; white-space: nowrap; }
#budgetTable th:nth-child(4), #budgetTable td:nth-child(4) { width: 8%; text-align: center; }
#budgetTable th:nth-child(5), #budgetTable td:nth-child(5) { width: 12%; }
#budgetTable th:nth-child(6), #budgetTable td:nth-child(6) { width: 10%; }
#budgetTable th:nth-child(7), #budgetTable td:nth-child(7) { width: 10%; text-align: center; }

.user-table th {
    font-weight: 600;

    color: var(--secondary-color, #6c757d);
}

.user-table tbody tr:last-child td {
    border-bottom: none;
}

.user-empty {
    text-align: center;
    color: var(--secondary-color, #6c757d);
    padding: 30px !important;
}

.user-active { color: var(--success-color, #28a745); font-weight: 700; }
.user-inactive { color: var(--secondary-color, #6c757d); }

.user-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 10px;

    font-weight: 600;
    margin-left: 4px;
    vertical-align: middle;
}

.user-badge-super {
    background-color: #fee2e2;
    color: #b91c1c;
}

.user-actions {
    text-align: center !important;
    vertical-align: middle;
    white-space: nowrap;
}

.user-actions-inner {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;

    transition: background-color 0.15s ease;
}

.btn-icon:hover {
    background-color: var(--hover-color, #f0f7ff);
}

.btn-icon-danger:hover {
    background-color: #fff5f5;
    border-color: #fecaca;
}

.user-pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
}

.pagination-info {
    color: var(--secondary-color, #6c757d);

    margin-right: auto;
}

.pagination-btn {
    background: var(--white-color, #fff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;

}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-current {

    color: var(--secondary-color, #6c757d);
}

/* ============================================================
   공통 모달 (사용자 관리에서 사용)
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-card {
    background-color: var(--white-color, #fff);
    border-radius: 8px;
    padding: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-card-sm {
    max-width: 400px;
}

.modal-title {
    margin: 0 0 16px 0;

    font-weight: 600;
}

.modal-desc {
    margin: 0 0 16px 0;
    color: var(--secondary-color, #6c757d);

    line-height: 1.5;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 4px;

}

.modal-field input,
.modal-field select {
    padding: 8px 10px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 6px;

    font-family: inherit;
    background-color: var(--white-color, #fff);
    color: inherit;
}

.modal-field input:focus,
.modal-field select:focus {
    outline: none;
    border-color: var(--primary-color, #556ee6);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

.modal-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    cursor: pointer;
}

.modal-error {
    background-color: #fff5f5;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 6px;
    padding: 8px 10px;

}

.modal-error[hidden] {
    display: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

/* 다크모드 */
[data-theme="dark"] .user-table-wrapper,
[data-theme="dark"] .modal-card,
[data-theme="dark"] .user-search,
[data-theme="dark"] .user-filter {
    background-color: #192238;
    border-color: #2e3d58;
    color: #d0d7ea;
}

[data-theme="dark"] .user-table thead {
    background-color: #141e32;
}

[data-theme="dark"] .user-table th,
[data-theme="dark"] .user-table td {
    border-bottom-color: #2e3d58;
    border-right-color: #2e3d58;
}

[data-theme="dark"] .modal-field input,
[data-theme="dark"] .modal-field select {
    background-color: #141e32;
    border-color: #2e3d58;
    color: #d0d7ea;
}

[data-theme="dark"] .btn-icon {
    background-color: #192238;
    border-color: #2e3d58;
}

[data-theme="dark"] .btn-icon:hover {
    background-color: #2e3d58;
}

[data-theme="dark"] .user-badge-super {
    background-color: #3f1d1d;
    color: #fecaca;
}

[data-theme="dark"] .pagination-btn {
    background-color: #192238;
    border-color: #2e3d58;
    color: #d0d7ea;
}

[data-theme="dark"] .modal-error {
    background-color: #3f1d1d;
    border-color: #7f1d1d;
    color: #fecaca;
}

/* ============================================================
   저장 이력 섹션 (Phase 4)
   ============================================================ */
.save-log-section {
    margin-top: 20px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    background-color: var(--white-color, #fff);
    overflow: hidden;
}

.save-log-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    background-color: var(--light-color, #f8f9fa);
}

.save-log-summary::-webkit-details-marker {
    display: none;
}

.save-log-title {

}

.save-log-hint {
    color: var(--secondary-color, #6c757d);

}

.save-log-body {
    padding: 0;
}

.save-log-table {
    width: 100%;
    border-collapse: collapse;

}

.save-log-table thead {
    background-color: var(--light-color, #f8f9fa);
}

.save-log-table th,
.save-log-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #dee2e6);
}

.save-log-table th {
    font-weight: 600;
    color: var(--secondary-color, #6c757d);

}

.save-log-table tbody tr:last-child td {
    border-bottom: none;
}

.save-log-empty {
    text-align: center;
    color: var(--secondary-color, #6c757d);
    padding: 16px !important;
}

[data-theme="dark"] .save-log-section,
[data-theme="dark"] .save-log-summary,
[data-theme="dark"] .save-log-table thead {
    background-color: #1f2937;
    border-color: #374151;
    color: #e5e7eb;
}

[data-theme="dark"] .save-log-table th,
[data-theme="dark"] .save-log-table td {
    border-bottom-color: #374151;
}

/* ============================================================
   통계 페이지 공통 (bank_deposit_stats, bank_deposit_type_stats,
   income_type_stats 등 stats 계열 페이지 공유 스타일)
   ============================================================ */
.stats-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 필터 바 */
.stats-filter {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    padding: 15px 18px;
    background-color: var(--bg-subtle, #f8f9fa);
    border-radius: 8px;
}
.stats-filter .filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.stats-filter label {
    font-weight: 600;
    color: var(--text-secondary, #6c757d);
    white-space: nowrap;
}
.stats-filter select {
    padding: 7px 10px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 4px;
    font-family: inherit;
}
.stats-filter .period-label {
    margin-left: auto;
    font-weight: 700;
    color: var(--primary-color, #556ee6);
    white-space: nowrap;
}

/* 카드형 섹션 */
.stats-section {
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    padding: 18px 20px;
    min-width: 0;
}
[data-theme="dark"] .stats-section {
    background: var(--bg-card, #1f2937);
}
[data-theme="dark"] .summary-table th,
[data-theme="dark"] .stats-table th {
    background: #141e32;
    color: #8898bb;
    border-bottom-color: #2e3d58;
}
[data-theme="dark"] .summary-table td,
[data-theme="dark"] .stats-table td {
    border-bottom-color: #2e3d58;
}
[data-theme="dark"] .stats-table tr.row-unclassified td {
    color: var(--color-muted);
}
[data-theme="dark"] .stats-table tr.row-total td {
    background: #1e2d48;
    color: var(--color-fg);
    border-top-color: #2e3d58;
}
[data-theme="dark"] .stats-filter {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}
[data-theme="dark"] .stats-filter label {
    color: var(--color-muted);
}
[data-theme="dark"] .stats-filter select {
    background: var(--color-surface-hover);
    border-color: var(--color-border);
    color: var(--color-fg);
}
[data-theme="dark"] .stats-filter .period-label {
    color: #6b9fe4;
}
.stats-section-title {
    font-weight: 700;
    color: var(--text-primary, #1f2937);
    margin: 0 0 14px;
}

/* 차트 래퍼 */
.chart-wrap {
    position: relative;
    width: 100%;
    height: 360px;
}
.chart-wrap-square {
    position: relative;
    width: 100%;
    height: 300px;
}

/* 통계 테이블 */
.stats-table-wrap { overflow-x: auto; }
.stats-table {
    width: 100%;
    border-collapse: collapse;
}
.stats-table th,
.stats-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    text-align: left;
}
.stats-table th {
    background: var(--bg-subtle, #f8f9fa);
    font-weight: 600;
    color: var(--text-secondary, #6c757d);
}
.stats-table td.num,
.stats-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.stats-table tr.row-unclassified td {
    color: var(--text-secondary, #6c757d);
    font-style: italic;
}
.stats-table tr.row-total td {
    font-weight: 700;
    background: var(--bg-subtle, #f8f9fa);
    border-top: 2px solid var(--border-color, #dee2e6);
}
.stats-table th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.stats-table th.sortable:hover { background: var(--bg-hover, #eef2ff); }
.stats-table th.sortable .sort-arrow {
    display: inline-block;
    margin-left: 4px;
    opacity: 0.3;
    transition: transform 0.1s ease, opacity 0.1s ease;
}
.stats-table th.sortable.sorted-asc .sort-arrow {
    opacity: 1;
    color: var(--primary-color, #556ee6);
    transform: rotate(180deg);
}
.stats-table th.sortable.sorted-desc .sort-arrow {
    opacity: 1;
    color: var(--primary-color, #556ee6);
}
.stats-table .bar {
    display: inline-block;
    height: 8px;
    background: var(--primary-color, #556ee6);
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 6px;
}

/* 요약 테이블 (유형통계 선택 유형 요약 · 입금 월별 합계 등 공용) */
.summary-table-wrap { overflow-x: auto; }
.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.summary-table th,
.summary-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.summary-table th {
    background: var(--bg-subtle, #f8f9fa);
    font-weight: 600;
    color: var(--text-secondary, #6c757d);
}
.summary-table th:first-child,
.summary-table td:first-child { text-align: left; font-weight: 500; }

/* 2컬럼 레이아웃 */
.stats-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 900px) {
    .stats-two-col { grid-template-columns: 1fr; }
}
.charts-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 900px) {
    .charts-two-col { grid-template-columns: 1fr; }
}

/* KPI 카드 */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.summary-card {
    background: linear-gradient(135deg, var(--primary-color, #556ee6), #7c8ff0);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.summary-card.secondary { background: linear-gradient(135deg, #6b7280, #9ca3af); }
.summary-card.tertiary  { background: linear-gradient(135deg, #10b981, #34d399); }
.summary-card .label  { opacity: 0.9; margin: 0; }
.summary-card .value  { font-weight: 700; line-height: 1.1; margin: 0; }
.summary-card .sub    { opacity: 0.85; margin: 0; }
.summary-card .compare-row {
    margin: 0 0 0 auto;
    display: flex;
    flex-direction: row;
    gap: 14px;
}
.summary-card .compare-badge {
    opacity: 0.95;
    display: flex;
    gap: 6px;
    white-space: nowrap;
}
.summary-card .compare-label { opacity: 0.8; }
.summary-card .compare-up    { color: #d1fae5; }
.summary-card .compare-down  { color: #fecaca; }
.summary-card .compare-flat  { color: rgba(255,255,255,0.85); }

/* 빈 상태 */
.empty-state {
    text-align: center;
    color: var(--text-secondary, #6c757d);
    padding: 40px 20px;
    font-size: 14px;
}

/* 비밀번호 강도 힌트 */
.pw-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 10px;
}
.pw-hint {
    font-size: 12px;
    padding: 2px 9px;
    border-radius: 10px;
    background: var(--light-color, #f4f6f9);
    color: var(--text-secondary, #999);
    transition: background 0.2s, color 0.2s;
}
.pw-hint::before { content: '✗ '; }
.pw-hint.ok {
    background: #d1fae5;
    color: #059669;
}
.pw-hint.ok::before { content: '✓ '; }
[data-theme="dark"] .pw-hint { background: #1e2b44; color: #8898bb; }
[data-theme="dark"] .pw-hint.ok { background: #064e3b; color: #34d399; }

/* ============================================================
   B안 — 차분한 여백 디자인 시스템 추가 스타일
   ============================================================ */

/* Source Serif 4 — 금액/숫자 요소 */
.serif-num {
    font-family: 'Source Serif 4', serif;
    font-variant-numeric: tabular-nums;
}

/* ─── 인라인 통계 칩 (헌금대장·입금장부 목록 헤더) ─── */
.stats-chips {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    margin-top: 14px;
}
.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 15px;
    background: #f1f2f5;
    border-radius: 10px;
    font-size: 14px;
}
.stat-chip.stat-chip-primary {
    background: #eef3fb;
}
.chip-label { color: var(--text-secondary); }
.chip-value { font-weight: 700; font-family: 'Source Serif 4', serif; }
.stat-chip-primary .chip-value { color: var(--primary-color); }
.stat-chip-count { background: #eef3fb; }
.stat-chip-count .chip-value { color: var(--primary-color); font-family: 'Source Serif 4', serif; }

/* ─── 리스트 페이지 헤더 (B안) ─── */
.list-page-header {
    margin-bottom: 22px;
}
.list-page-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.list-page-title {
    font-size: 27px;
    font-weight: 700;
    margin: 0 0 0;
    letter-spacing: -.01em;
    color: var(--dark-color);
}

/* ─── 테이블 툴바 (세그먼트 + 검색 pill) ─── */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

/* 세그먼트 버튼 */
.segment-control {
    display: inline-flex;
    background: #f1f2f5;
    border-radius: 11px;
    padding: 4px;
    gap: 3px;
}
.segment-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}
.segment-btn.active {
    background: var(--white-color);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* 필 검색 */
.pill-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.pill-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    line-height: 0;
    color: var(--text-muted);
    pointer-events: none;
}
.pill-search-icon svg { width: 15px; height: 15px; }
.pill-search-wrap input.pill-search-input {
    border: 1px solid #d7dae3;
    border-radius: 999px;
    background: #f9fafb;
    padding: 11px 18px 11px 44px;
    font-size: 14px;
    width: 230px;
    max-width: 50vw;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
}
.pill-search-wrap input.pill-search-input:focus {
    border-color: var(--primary-color);
    background: var(--white-color);
    box-shadow: 0 0 0 3px rgba(58,95,160,.1);
}

/* ─── 리스트 페이지 푸터 (페이지네이션 + 건수) ─── */
.list-page-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.page-records-info {
    font-size: 13.5px;
    color: var(--text-secondary);
}
.custom-pagination {
    display: flex;
    gap: 5px;
    align-items: center;
}
.page-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 11px;
    border-radius: 9px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    background: var(--white-color);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, color 0.15s;
}
.page-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.page-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: var(--white-color);
    font-weight: 700;
    box-shadow: none;
}
.page-btn:disabled,
.page-btn.disabled {
    color: #c9cfdb;
    cursor: not-allowed;
    box-shadow: none;
}
.page-btn:disabled:hover,
.page-btn.disabled:hover {
    border-color: var(--border-color);
    color: #c9cfdb;
}

/* ─── 뱃지 (B안 pill 형태) ─── */
.badge-pill {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
}
.badge-blue   { background: #eef3fb; color: #3a5fa0; }
.badge-green  { background: #ecf4ef; color: #2f7d5b; }
.badge-amber  { background: #f7f1e6; color: #8a6418; }
.badge-gray   { background: #f1f2f5; color: #5a6478; }
.badge-red    { background: #f8eeec; color: #b0473b; }

/* ─── 사이드바 nav-icon (B안: 한자 마크) ─── */
.nav-icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aab0bf;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Source Serif 4', Batang, serif;
}
.nav-category.active .nav-icon {
    color: var(--primary-color);
}

/* ─── 테마 토글 (다크 네브바 위에서) ─── */
.theme-toggle {
    background: transparent !important;
    border: 1px solid rgba(255,255,255,.18) !important;
    color: #aeb8d6 !important;
    border-radius: 8px !important;
}
.theme-toggle:hover {
    background: rgba(255,255,255,.10) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.35) !important;
}

/* ─── 다크모드 보정 (B안 추가 컴포넌트) ─── */
[data-theme="dark"] .stat-chip { background: #192238; }
[data-theme="dark"] .stat-chip.stat-chip-primary,
[data-theme="dark"] .stat-chip-count { background: #1e3258; }
[data-theme="dark"] .segment-control { background: #192238; }
[data-theme="dark"] .segment-btn.active { background: #2e3d58; color: #93c5fd; }
[data-theme="dark"] .pill-search-wrap input.pill-search-input { background: #192238; border-color: #2e3d58; color: #d0d7ea; }
[data-theme="dark"] .page-btn { background: #192238; border-color: #2e3d58; color: #8898bb; }
[data-theme="dark"] .page-btn.active { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
[data-theme="dark"] .top-navbar { background-color: #1c2b48; }
[data-theme="dark"] .sidebar { background-color: #141e32; border-right-color: #192238; }
[data-theme="dark"] .submenu a:hover { background: #192238; color: #d0d7ea; }
[data-theme="dark"] .submenu li.active a { background: #1e3258; color: #93c5fd; }
[data-theme="dark"] .nav-category .category-header:hover { background: #192238; }
[data-theme="dark"] .content-wrapper { background: #192238; border-color: #2e3d58; }
[data-theme="dark"] .income-table thead { background: #141e32; }
.type-notice {
    margin: 8px 0 16px;
    padding: 10px 14px;
    background: #fff7e6;
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
    color: #333;
    font-size: 13.5px;
}
[data-theme="dark"] .type-notice {
    background: hsl(38, 30%, 14%);
    color: var(--color-fg);
    border-left-color: #c9840a;
}
[data-theme="dark"] .income-table th { color: #8898bb; border-bottom-color: #2e3d58; }
[data-theme="dark"] .income-table td { border-bottom-color: #2e3d58; }
[data-theme="dark"] .income-table tbody tr:hover { background-color: #2d3e5a !important; }
[data-theme="dark"] table.dataTable thead th { background: #141e32 !important; color: #8898bb !important; border-bottom-color: #2e3d58 !important; }
[data-theme="dark"] table.dataTable tbody td { border-bottom-color: #192238 !important; }
[data-theme="dark"] table.dataTable tbody tr:hover { background: #2d3e5a !important; }
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button { background: #192238 !important; border-color: #2e3d58 !important; color: #8898bb !important; }
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--primary-color) !important; border-color: var(--primary-color) !important; color: #fff !important; }