/* ===== 기본 리셋 ===== */
:root {
  --primary: #1e40af; --primary-light: #3b82f6;
  --success: #16a34a; --danger: #dc2626; --warning: #d97706;
  --bg: #f1f5f9; --card: #ffffff; --border: #e2e8f0;
  --text: #1e293b; --text-muted: #64748b;
  --leisure: #0f766e; --leisure-light: #14b8a6;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: 'Malgun Gothic', -apple-system, sans-serif; font-size: 13px; }

/* ===== 헤더 ===== */
.app-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: white; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  position: sticky; top: 0; z-index: 200;
}
.app-header h1 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== 탭 네비게이션 ===== */
.tab-nav {
  display: flex; gap: 0;
  background: #0f172a;
  padding: 0 24px;
  position: sticky; top: 52px; z-index: 190;
  border-bottom: 2px solid #1e3a8a;
}
.tab-nav-btn {
  padding: 11px 24px; border: none; background: transparent; cursor: pointer;
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.55);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  transition: all 0.2s; display: flex; align-items: center; gap: 7px;
  white-space: nowrap;
}
.tab-nav-btn:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.05); }
.tab-nav-btn.active { color: #fff; border-bottom-color: #3b82f6; background: rgba(59,130,246,0.12); }
.tab-nav-btn.active.leisure-active { border-bottom-color: #14b8a6; background: rgba(20,184,166,0.12); }

/* ===== 버튼 ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.15); }
.btn-primary { background: #3b82f6; color: white; }
.btn-success { background: #16a34a; color: white; }
.btn-danger { background: #dc2626; color: white; }
.btn-warning { background: #d97706; color: white; }
.btn-secondary { background: #64748b; color: white; }
.btn-outline { background: transparent; color: white; border: 1.5px solid rgba(255,255,255,0.6); }
.btn-outline:hover { background: rgba(255,255,255,0.1); }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 4px; }

/* ===== 메인 컨텐츠 (ENT) ===== */
.main-content { padding: 16px; }

/* 통계 카드 */
.stats-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { background: white; border-radius: 8px; padding: 14px 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); border: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.stat-icon { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #fef3c7; color: #d97706; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--text); }

/* 툴바 */
.toolbar { background: white; border-radius: 8px; padding: 12px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); border: 1px solid var(--border); }
.toolbar-group { display: flex; align-items: center; gap: 8px; }
.toolbar label { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.search-input, .filter-select { height: 32px; padding: 0 10px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--text); outline: none; transition: border-color 0.15s; }
.search-input:focus, .filter-select:focus { border-color: var(--primary-light); }
.search-input { width: 200px; }
.filter-select { min-width: 120px; }

/* ENT 테이블 */
.table-container { background: white; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); border: 1px solid var(--border); overflow: hidden; }
.table-header { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.table-header h2 { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.table-wrap { overflow-x: auto; max-height: calc(100vh - 320px); overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead th { background: #1e3a8a; color: white; padding: 9px 10px; white-space: nowrap; font-weight: 600; position: sticky; top: 0; z-index: 10; text-align: center; border-right: 1px solid rgba(255,255,255,0.15); }
thead th:last-child { border-right: none; }
.sub-header th { background: #2563eb; color: #e0f2fe; font-size: 11px; font-weight: 500; padding: 6px 10px; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:hover { background: #f0f9ff !important; }
tbody tr.row-green { background: #f0fdf4; }
tbody td { padding: 8px 10px; white-space: nowrap; vertical-align: middle; border-right: 1px solid #f1f5f9; }
tbody td:last-child { border-right: none; }
td.num { text-align: right; font-family: 'Courier New', monospace; }
td.ctr { text-align: center; }
td.amount-neg { color: #dc2626; font-weight: 600; }
td.truncate { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.action-btns { display: flex; gap: 4px; justify-content: center; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--text-muted); }
.empty-state i { font-size: 48px; display: block; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 14px; }
.month-header { background: #0f766e !important; }
.extra-header { background: #4338ca !important; }

/* ===== 모달 ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 999; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: 12px; width: 900px; max-width: 100%; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: white; z-index: 10; border-radius: 12px 12px 0 0; }
.modal-header h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-close { width: 32px; height: 32px; border: none; background: #f1f5f9; border-radius: 6px; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.modal-close:hover { background: #e2e8f0; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: #f8fafc; border-radius: 0 0 12px 12px; }

/* 폼 */
.form-section { margin-bottom: 20px; }
.form-section-title { font-size: 12px; font-weight: 700; color: white; background: #1e3a8a; padding: 6px 12px; border-radius: 6px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.required { color: #dc2626; margin-left: 2px; }
.form-control { height: 34px; padding: 0 10px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--text); outline: none; transition: border-color 0.15s; background: white; width: 100%; }
.form-control:focus { border-color: var(--primary-light); background: #f0f9ff; }
.form-control.textarea { height: 72px; padding: 8px 10px; resize: vertical; }
select.form-control { cursor: pointer; }

/* 모달 탭 */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tab-btn { padding: 8px 16px; border: none; background: transparent; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; border-radius: 6px 6px 0 0; transition: all 0.15s; display: flex; align-items: center; gap: 6px; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: #eff6ff; }
.tab-btn:hover:not(.active) { background: #f8fafc; }

/* 상세 보기 테이블 */
.detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.detail-table td { padding: 7px 10px; border: 1px solid var(--border); }
.detail-table .dt-label { font-weight: 600; color: #475569; width: 180px; background: #f8fafc; }
.detail-table .dt-section { background: #1e3a8a; color: white; font-weight: 700; text-align: center; font-size: 12px; }

/* ===== 토스트 ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1e293b; color: white; padding: 12px 18px; border-radius: 8px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.2); animation: slideIn 0.3s ease; max-width: 320px; }
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.warning { background: #d97706; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== 레저 선급금 ===== */
.leisure-container { padding: 16px; }

.lz-section-wrap {
  background: white; border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07); border: 1px solid var(--border);
  margin-bottom: 14px; overflow: hidden;
}
.lz-section-header {
  padding: 10px 16px; display: flex; align-items: center; justify-content: space-between;
  background: #f0fdfa; border-bottom: 1px solid #99f6e4;
}
.lz-section-label {
  font-size: 13px; font-weight: 800; color: #0f766e;
  display: flex; align-items: center; gap: 8px;
}
.lz-section-label::before { content:''; display:inline-block; width:4px; height:16px; background:#0f766e; border-radius:2px; }

.lz-facility-header {
  padding: 10px 16px; display: flex; align-items: center; justify-content: space-between;
  background: #eff6ff; border-bottom: 1px solid #bfdbfe;
}
.lz-facility-info { display: flex; align-items: center; gap: 12px; }
.lz-facility-name { font-size: 14px; font-weight: 800; color: #1e3a8a; }
.lz-facility-meta { font-size: 11px; color: #64748b; }
.lz-facility-actions { display: flex; gap: 6px; align-items: center; }

.lz-table-wrap { overflow-x: auto; }
.lz-table { width: 100%; border-collapse: collapse; font-size: 12px; }

/* 레저 테이블 헤더 */
.lz-table thead th { padding: 8px 10px; text-align: center; white-space: nowrap; font-weight: 700; position: sticky; top: 0; z-index: 5; }
.lz-th-fix { background: #1e3a8a; color: white; min-width: 80px; }
.lz-th-fix2 { background: #1e3a8a; color: white; min-width: 100px; }
.lz-th-fix3 { background: #1e3a8a; color: white; min-width: 150px; }
.lz-th-month { background: #0f766e; color: white; min-width: 100px; }
.lz-th-total { background: #7c3aed; color: white; min-width: 110px; }

/* 레저 테이블 행 */
.lz-table tbody tr { border-bottom: 1px solid #e2e8f0; }
.lz-table tbody tr:hover td { background: rgba(20,184,166,0.04) !important; }
.lz-table tbody td { padding: 0; vertical-align: middle; border-right: 1px solid #f1f5f9; }
.lz-table tbody td:last-child { border-right: none; }

/* 구분별 행 색상 */
tr.lz-row-wolcho td { background: #f0fdf4; }
tr.lz-row-jigup td { background: #fff; }
tr.lz-row-sojin td { background: #fefce8; }
tr.lz-row-sojin-plan td { background: #fff7ed; }
tr.lz-row-dalsong td { background: #f9fafb; }
tr.lz-row-hoisu td { background: #f0f9ff; }
tr.lz-row-wolmal td { background: #f0fdf4; }
tr.lz-row-custom td { background: #fafafa; }

/* 왼쪽 고정 레이블 셀 */
.lz-label-cell {
  padding: 6px 10px; font-weight: 600; font-size: 12px;
  white-space: nowrap; color: #374151;
  border-right: 2px solid #e2e8f0 !important;
  min-width: 80px;
}
.lz-label-cell.lz-label-wolcho { color: #16a34a; }
.lz-label-cell.lz-label-sojin { color: #7c3aed; }
.lz-label-cell.lz-label-sojin-plan { color: #d97706; }
.lz-label-cell.lz-label-dalsong { color: #0369a1; }
.lz-label-cell.lz-label-hoisu { color: #0f766e; }
.lz-label-cell.lz-label-jigup { color: #dc2626; }
.lz-label-cell.lz-label-wolmal { color: #16a34a; }

/* 한도 테이블 왼쪽 레이블 */
.lz-limit-label {
  padding: 7px 12px; font-weight: 600; font-size: 12px;
  white-space: nowrap; background: #f8fafc;
  border-right: 2px solid #e2e8f0 !important;
}
.lz-limit-label.pink { background: #fdf2f8; color: #9d174d; }
.lz-limit-label.red { color: #dc2626; }
.lz-limit-label.blue { color: #1d4ed8; }

/* 인라인 편집 셀 */
.lz-cell-input {
  width: 100%; height: 32px; padding: 4px 8px;
  border: none; outline: none; background: transparent;
  font-size: 12px; font-family: 'Courier New', monospace;
  text-align: right; color: #1e293b;
}
.lz-cell-input:focus { background: #fffbeb; border-radius: 4px; }
.lz-cell-input.pct { text-align: center; font-family: inherit; }
.lz-cell-input.negative { color: #dc2626; }
.lz-cell-input.purple { color: #7c3aed; }
.lz-cell-input.total-cell { background: #f8fafc; font-weight: 700; }
.lz-cell-input:read-only { color: #374151; cursor: default; background: transparent; }

/* 총합 열 */
.lz-total-td { background: #f5f3ff !important; }
.lz-total-td .lz-cell-input { font-weight: 700; color: #5b21b6; }

/* 섹션 고정 컬럼 (시설사, 코드, T/R) */
.lz-fix-col { background: #f8fafc; text-align: center; border-right: 2px solid #e2e8f0 !important; padding: 6px 8px; font-size: 11px; color: #475569; }
.lz-fix-col.name { font-weight: 700; font-size: 13px; color: #1e3a8a; }

/* 레저 섹션 삭제 확인용 */
.lz-facility-del-btn { background: #fee2e2; color: #dc2626; border: none; border-radius: 4px; padding: 4px 10px; font-size: 11px; cursor: pointer; font-weight: 600; }
.lz-facility-del-btn:hover { background: #fecaca; }

@media (max-width: 768px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-4 { grid-template-columns: 1fr; }
  .tab-nav { overflow-x: auto; }
}

/* ============================================================
   대시보드 탭 스타일
============================================================ */
.dash-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dash-title-bar {
  font-size: 18px;
  font-weight: 700;
  color: #1e3a8a;
  padding: 14px 20px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: #64748b;
  margin-left: 6px;
}

/* CAP 편집 테이블 */
.dash-table-wrap {
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.dash-cap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.dash-cap-table th {
  background: #1e3a8a;
  color: white;
  padding: 10px 14px;
  font-weight: 600;
  white-space: nowrap;
}
.dct-th-label { text-align: left; min-width: 180px; }
.dct-th-num   { text-align: right; min-width: 120px; }

.dash-cap-table tbody tr { transition: background 0.15s; }
.dash-cap-table tbody tr:hover { background: #f0f9ff !important; }
.dct-row-lz { background: #fefce8 !important; }  /* 레저 - 노란색 */
.dct-row-lz:hover { background: #fef9c3 !important; }

.dash-cap-table td {
  padding: 9px 14px;
  border-bottom: 1px solid #e9eef5;
  vertical-align: middle;
}
.dct-label { font-weight: 600; color: #1e293b; font-size: 13px; }
.dct-num   { text-align: right; font-family: 'Courier New', monospace; font-size: 13px; color: #374151; }
.dct-num-neg { text-align: right; font-family: 'Courier New', monospace; font-size: 13px; color: #dc2626; }
.dct-num-pos { text-align: right; font-family: 'Courier New', monospace; font-size: 13px; color: #0f766e; }

/* CAP 인라인 편집 input */
.dct-cap-input {
  width: 110px;
  text-align: right;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  padding: 4px 8px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: #1e3a8a;
  font-weight: 700;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  float: right;
}
.dct-cap-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.dct-cap-input.lz-input {
  color: #b45309;
}

/* 합계 행 */
.dct-total-row td {
  background: #1e3a8a !important;
  color: white !important;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 14px;
  border: none;
}
.dct-total-row .dct-num { color: #93c5fd !important; }

/* 분리선 (총계 위) */
.dct-divider { height: 3px; background: #ef4444; border: none; }

/* 차트 */
.dash-chart-wrap {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 24px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  position: relative;
}
#dashChart { max-height: 420px; }

/* ============================================================
   월별 변동사항 섹션
============================================================ */
.chg-section-wrap {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* 헤더 바 */
.chg-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 8px;
}
.chg-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #1e3a8a;
}
.chg-unit {
  font-size: 11px;
  font-weight: 400;
  color: #64748b;
  margin-left: 4px;
}
.chg-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chg-year-label, .chg-month-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}
.chg-year-select {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  color: #1e3a8a;
  font-weight: 600;
  background: white;
  cursor: pointer;
  outline: none;
}
.chg-month-sel {
  border: 2px solid #2563eb;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
  color: #1e3a8a;
  font-weight: 700;
  background: white;
  cursor: pointer;
  outline: none;
}
.chg-year-select:focus, .chg-month-sel:focus {
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

/* 표 wrap */
.chg-table-wrap {
  overflow-x: auto;
}
.chg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

/* 헤더 */
.chg-table thead th {
  background: #1e40af;
  color: white;
  padding: 9px 12px;
  font-weight: 600;
  border-right: 1px solid rgba(255,255,255,0.15);
  white-space: nowrap;
}
.chg-th-label  { text-align: center; min-width: 130px; width: 130px; }
.chg-th-type   { text-align: center; min-width: 100px; width: 100px; }
.chg-th-amt    { text-align: right;  min-width: 90px;  width: 90px; }
.chg-th-detail { text-align: left;   min-width: 300px; }

/* 장르 그룹 행 */
.chg-row-genre td {
  background: #f0f6ff;
  font-weight: 600;
  color: #1e3a8a;
  padding: 7px 12px;
  border-bottom: 1px solid #dde8f8;
  border-top: 2px solid #bfdbfe;
  font-size: 12px;
}
.chg-row-genre .chg-td-label {
  text-align: center;
  font-size: 12px;
}
/* 뮤지컬 CAP 행 (회색 배경) */
.chg-row-cap td {
  background: #e9f0fa;
  font-weight: 700;
  color: #1e3a8a;
  padding: 7px 12px;
  border-bottom: 2px solid #bfdbfe;
  font-size: 12px;
}
.chg-row-cap .chg-td-cap-label {
  text-align: center;
  font-size: 11px;
  color: #475569;
}
/* 레저 CAP 행 */
.chg-row-lz-cap td {
  background: #fefce8;
  font-weight: 700;
  color: #92400e;
  padding: 7px 12px;
  border-bottom: 2px solid #fde68a;
  font-size: 12px;
}
/* 총합 행 */
.chg-row-total td {
  background: #1e3a8a;
  color: white;
  font-weight: 700;
  padding: 10px 12px;
  font-size: 13px;
}
.chg-row-total .chg-td-amt { color: #93c5fd; }

/* 셀 */
.chg-td-label {
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  color: #374151;
  white-space: pre-line;
  line-height: 1.5;
  padding: 7px 10px;
  border-bottom: 1px solid #e9eef5;
  border-right: 1px solid #e9eef5;
  background: #fafbfc;
  vertical-align: middle;
}
.chg-td-type {
  text-align: center;
  font-size: 12px;
  color: #374151;
  padding: 6px 8px;
  border-bottom: 1px solid #e9eef5;
  border-right: 1px solid #e9eef5;
  white-space: nowrap;
}
.chg-td-amt {
  text-align: right;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-bottom: 1px solid #e9eef5;
  border-right: 1px solid #e9eef5;
  white-space: nowrap;
}
.chg-td-amt.up   { color: #1d4ed8; }
.chg-td-amt.down { color: #dc2626; }

/* 주요내역 셀 (인라인 편집) */
.chg-td-detail {
  padding: 4px 8px;
  border-bottom: 1px solid #e9eef5;
  min-width: 280px;
}
.chg-detail-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  color: #374151;
  background: transparent;
  transition: all 0.15s;
  resize: none;
  min-height: 28px;
  line-height: 1.5;
  font-family: inherit;
}
.chg-detail-input:focus {
  border-color: #2563eb;
  background: #fffbeb;
  outline: none;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}
.chg-detail-input::placeholder { color: #94a3b8; }

/* 삼각형 아이콘 */
.chg-arrow-up   { color: #1d4ed8; font-size: 11px; margin-right: 3px; }
.chg-arrow-down { color: #dc2626; font-size: 11px; margin-right: 3px; }

/* ===== 엑셀 가져오기 모달 ===== */
.import-modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.import-modal-box {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 100%; max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex; flex-direction: column;
  animation: modalFadeIn 0.2s ease;
}
@keyframes modalFadeIn {
  from { opacity:0; transform: scale(0.95) translateY(-10px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}
.import-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #e2e8f0;
}
.import-modal-title {
  font-size: 15px; font-weight: 700; color: #1e293b;
  display: flex; align-items: center; gap: 8px;
}
.import-modal-close {
  background: none; border: none; cursor: pointer;
  color: #64748b; font-size: 16px; padding: 4px 8px;
  border-radius: 6px; transition: all 0.15s;
}
.import-modal-close:hover { background: #f1f5f9; color: #1e293b; }

/* 드래그앤드롭 영역 */
.import-drop-zone {
  margin: 18px 22px;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #f8fafc;
}
.import-drop-zone:hover,
.import-drop-zone.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
}
.import-drop-icon {
  font-size: 36px; color: #93c5fd; margin-bottom: 10px;
}
.import-drop-zone.drag-over .import-drop-icon { color: #2563eb; }
.import-drop-text {
  font-size: 14px; color: #64748b; margin-bottom: 12px;
}
.import-file-label {
  display: inline-flex; align-items: center; gap: 6px;
  background: #2563eb; color: white;
  padding: 8px 18px; border-radius: 7px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.import-file-label:hover { background: #1d4ed8; }
.import-drop-hint {
  margin-top: 10px; font-size: 11px; color: #94a3b8;
}

/* 미리보기 */
.import-preview-wrap { padding: 0 22px 10px; }
.import-preview-info {
  font-size: 12px; color: #374151; font-weight: 600;
  margin-bottom: 8px; padding: 6px 10px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 6px; color: #166534;
}
.import-preview-table-wrap {
  overflow-x: auto;
  border: 1px solid #e2e8f0; border-radius: 8px;
}
.import-preview-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.import-preview-table thead th {
  background: #f1f5f9;
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.import-preview-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #374151;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.import-preview-table tbody tr:last-child td { border-bottom: none; }

/* 동작 버튼 영역 */
.import-action-btns { padding: 0 22px 16px; }
.import-action-label {
  font-size: 12px; font-weight: 600; color: #64748b;
  margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px;
}
.import-btn-row {
  display: flex; gap: 12px;
}
.import-btn-append,
.import-btn-replace {
  flex: 1;
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 12px 16px;
  border-radius: 10px; border: 2px solid transparent;
  cursor: pointer; transition: all 0.15s; text-align: left;
}
.import-btn-append {
  background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8;
}
.import-btn-append:hover:not(:disabled) {
  background: #dbeafe; border-color: #2563eb;
}
.import-btn-replace {
  background: #fff7ed; border-color: #fed7aa; color: #c2410c;
}
.import-btn-replace:hover:not(:disabled) {
  background: #ffedd5; border-color: #f97316;
}
.import-btn-append span,
.import-btn-replace span {
  font-size: 13px; font-weight: 700;
}
.import-btn-append small,
.import-btn-replace small {
  font-size: 11px; opacity: 0.75; font-weight: 400;
}
.import-btn-append i,
.import-btn-replace i {
  font-size: 16px; margin-bottom: 2px;
}
.import-btn-append:disabled,
.import-btn-replace:disabled {
  opacity: 0.5; cursor: not-allowed;
}

/* 모달 푸터 */
.import-modal-footer {
  padding: 12px 22px 16px;
  border-top: 1px solid #e2e8f0;
  display: flex; justify-content: flex-end;
}

/* ============================================================
   선급금 잔액 트렌드 섹션
============================================================ */
.trend-section-wrap {
  margin: 20px 16px 24px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.trend-section-header {
  background: #1e3a5f;
  padding: 10px 16px;
}
.trend-title {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.trend-unit {
  font-size: 11px;
  font-weight: 400;
  color: #cbd5e1;
  margin-left: 6px;
}

/* 입력 테이블 */
.trend-table-wrap {
  overflow-x: auto;
  border-bottom: 1px solid #e5e7eb;
  padding: 0;
}
.trend-input-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 12px;
}
.trend-input-table thead tr {
  background: #1e3a5f;
}
.trend-th-label {
  color: #fff;
  font-weight: 600;
  padding: 8px 14px;
  white-space: nowrap;
  min-width: 80px;
  text-align: center;
  border-right: 1px solid #2d4f7a;
  position: sticky;
  left: 0;
  background: #1e3a5f;
  z-index: 2;
}
.trend-th-month {
  color: #e2e8f0;
  font-weight: 500;
  padding: 8px 6px;
  text-align: center;
  min-width: 72px;
  border-right: 1px solid #2d4f7a;
  white-space: nowrap;
}
.trend-input-table tbody tr {
  background: #f8fafc;
}
.trend-input-table tbody tr:hover {
  background: #f1f5f9;
}
.trend-td-label {
  padding: 6px 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  background: #f1f5f9;
  border-right: 1px solid #e5e7eb;
  white-space: nowrap;
  position: sticky;
  left: 0;
  z-index: 1;
}
.trend-td-label small {
  font-size: 10px;
  color: #6b7280;
  font-weight: 400;
}
.trend-td-input {
  padding: 4px 4px;
  text-align: center;
  border-right: 1px solid #e5e7eb;
}
.trend-input {
  width: 68px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 4px 5px;
  font-size: 12px;
  text-align: right;
  color: #1e293b;
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
}
.trend-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}
.trend-input::placeholder {
  color: #cbd5e1;
  text-align: center;
}
.trend-input:not(:placeholder-shown) {
  background: #eff6ff;
  border-color: #93c5fd;
  font-weight: 600;
  color: #1e3a5f;
}

/* 차트 영역 */
.trend-chart-wrap {
  padding: 20px 24px 24px;
  height: 340px;
  background: #fff;
}
