.cashflow-table {
    width: 100%;
}

.table-container {
    display: flex;
    width: 100%;
}

.fixed-section {
    flex-shrink: 0;
    border-right: 2px solid #adb5bd;
    background-color: white;
    z-index: 1;
    width: fit-content; /* 고정 섹션 너비 고정 */
}

.table-header {
    border-bottom: 1px solid #eee;
}

.table-row {
    border-bottom: 1px solid #eee;
}

.table-row.no-data {
    display: flex;
    justify-content: center;
    padding: 20px;
    color: #6c757d;
}

.fixed-columns, .scrollable-columns {
    display: flex;
}

.header-cell {
    background-color: #f7f7f7;
    padding: 8px 4px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    border-right: 1px solid #dee2e6;
    white-space: nowrap;
    flex-shrink: 0;
    overflow: hidden; /* 텍스트 오버플로우 숨김 */
    text-overflow: ellipsis; /* 말줄임표 표시 */
}

/* 스크롤 섹션 헤더 셀 크기 고정 */
.scrollable-section .header-cell {
    min-width: 80px;
}

.table-cell {
    background-color: white;
    display: flex;
    align-items: center;
    padding: 8px 4px;
    min-height: 40px;
    font-size: 14px;
    border-right: 1px solid #eee;
    white-space: nowrap;
    flex-shrink: 0;
    overflow: hidden; /* 텍스트 오버플로우 숨김 */
    text-overflow: ellipsis; /* 말줄임표 표시 */
}

/* 스크롤 섹션 테이블 셀 크기 고정 */
.scrollable-section .table-cell {
    min-width: 80px;
}

/* 툴팁 스타일 (긴 텍스트 표시용) */
.table-cell[title]:hover::after {
    content: attr(title);
    position: absolute;
    top: 100%;
    left: 0;
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    max-width: 200px;
    word-wrap: break-word;
    white-space: normal;
}

/* 타입 셀 병합을 위한 스타일 수정 */
.type-cell-merged {
    font-weight: bold;
    text-align: center;
    justify-content: center;
    border-bottom: none !important;
    position: relative;
}

.type-cell-hidden {
    border-top: none !important;
    border-bottom: none !important;
    position: relative;
}


/* 그룹의 첫 번째 행에만 상단 테두리 */
.group-start .type-cell-merged {
    border-top: 1px solid #eee;
}

.group-start .table-cell:not(.type-cell-merged) {
    border-top: 1px solid #eee;
}

/* 그룹의 마지막 행에만 하단 테두리 */
.group-end .type-cell-merged,
.group-end .type-cell-hidden {
    border-bottom: 1px solid #eee !important;
}

/* 합계 행의 상단 테두리 강화 */
.summary-row {
    border-top: none;
}

.summary-row .table-cell {
    background-color: #f8f9fa;
    font-weight: bold;
}

.summary-label {
    text-align: center;
    justify-content: center;
    color: #495057;
}

.summary-amount {
    text-align: right;
    justify-content: flex-end;
    color: #4da3ff;
}

.text-right {
    text-align: right;
    justify-content: flex-end;
}

/* 스크롤바 스타일링 - 기본적으로 숨김 */
.table__scroll-x {
    flex-grow: 1;
    overflow-x: auto;
    min-width: 0;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.2s ease;
    
    /* 성능 최적화 */
    transform: translateZ(0);
    will-change: scroll-position;
    scroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
}

/* WebKit 브라우저 (Chrome, Safari, Edge) - 기본적으로 숨김 */
.table__scroll-x::-webkit-scrollbar {
    height: 8px;
    background: transparent;
}

.table__scroll-x::-webkit-scrollbar-track {
    background: var(--webkit-scrollbar-track-bg, transparent);
    transition: background 0.2s ease;
}

.table__scroll-x::-webkit-scrollbar-thumb {
    background: var(--webkit-scrollbar-thumb-bg, transparent);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.table__scroll-x::-webkit-scrollbar-thumb:hover {
    background: rgba(193, 193, 193, 0.8);
}

.table__scroll-x::-webkit-scrollbar-corner {
    background: transparent;
}

/* 스크롤바 표시 상태 */
.table__scroll-x.scrollbar-visible {
    scrollbar-color: rgba(193, 193, 193, 0.6) rgba(241, 241, 241, 0.3); /* Firefox */
}

.table__scroll-x.scrollbar-visible::-webkit-scrollbar-track {
    background: rgba(241, 241, 241, 0.3);
}

.table__scroll-x.scrollbar-visible::-webkit-scrollbar-thumb {
    background: rgba(193, 193, 193, 0.6);
}

/* 스크롤 중 상태 */
.table__scroll-x.scrolling {
    pointer-events: none; /* 스크롤 중 마우스 이벤트 차단 */
}

/* 월별 데이터 스타일 */
.summary-total-assets {
    color: #28a745;
}

.summary-available-assets {
    color: #007bff;
}

.summary-net-flow {
    font-weight: normal;
}

.summary-net-flow.positive {
    color: #28a745;
    font-weight: bold;
}

.summary-net-flow.negative {
    color: #dc3545;
    font-weight: bold;
}

.summary-runway {
    color: #6f42c1;
    font-weight: 500;
}

/* 월별 컬럼 너비 */
.monthly-summary .scrollable-section .header-cell,
.monthly-summary .scrollable-section .table-cell {
    width: 112px;
    min-width: 112px;
    max-width: 112px;
}

/* 호버 효과 */
.summary-data-row:hover .table-cell {
    background-color: #F2FAFF;
    transition: background 0.2s;
}

.summary-data-row:hover .summary-label {
    background-color: #F2FAFF;
    transition: background 0.2s;
}

  /* 반응형 처리 */
@media (max-width: 768px) {
  .fixed-section .header-cell,
  .fixed-section .table-cell {
      font-size: 12px;
      padding: 6px 2px;
  }
  
  .fixed-section .header-cell:nth-child(1),
  .fixed-section .table-cell:nth-child(1) { width: 60px; min-width: 60px; max-width: 60px; }
  
  .fixed-section .header-cell:nth-child(2),
  .fixed-section .table-cell:nth-child(2) { width: 120px; min-width: 120px; max-width: 120px; }
  
  .fixed-section .header-cell:nth-child(3),
  .fixed-section .table-cell:nth-child(3) { width: 100px; min-width: 100px; max-width: 100px; }
  
  .fixed-section .header-cell:nth-child(4),
  .fixed-section .table-cell:nth-child(4) { width: 100px; min-width: 100px; max-width: 100px; }
  
  .scrollable-section .header-cell,
  .scrollable-section .table-cell {
    width: 70px;
    min-width: 70px;
    max-width: 70px;
  }
}