/* ===== 페이지/레이아웃 ===== */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* 페이지 전체 스크롤 방지 */
  }
  
  .table-main {
    padding: 16px;
    background: #f4f6fa;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden; /* 테이블만 스크롤하도록 컨테이너는 숨김 */
    min-width: 0;
    min-height: 0;
  }
  
  .title {
    margin-bottom: 4px;
    font-size: 24px;
    line-height: 1;
  }
  
  .search-box {
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    background: #fff;
    display: flex;
    gap: 24px;
  }
  
  .search-left-box {
    display: flex;
    align-items: center;
    gap: 30px;
    flex: 1;
  }
  
  .search-label {
    margin-right: 12px;
    transform: translateY(-1px);
  }
  
  .datepicker-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .input-date[type="date"] {
    border: 1px solid #e0e0e0;
    outline: none;
    background: #fff;
    border-radius: 8px;
    padding: 4px 8px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-width: 200px;
    font-family: 'Pretendard !important', sans-serif;
    font-size: 14px;
  }
  
  .input-date[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    width: 16px;
    height: 16px;
    background: url("../assets/ic_calendar_bk.svg") center no-repeat;
  }
  
  .search-date {
    display: flex;
    align-items: center;
  }
  
  .select-search {
    border-color: #e0e0e0;
    border-radius: 8px;
    padding: 4px 8px;
    outline: none;
    min-width: 200px;
    font-size: 14px;
    height: 32px;
  }
  
  .chanel-search {
    display: flex;
    align-items: center;
  }
  
  .btn-search {
    border-radius: 8px;
    width: 100px;
    background: #001D50;
    border: none;
    color: #fff;
    padding: 8px 16px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
  }
  
  .search-bottom-box {
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    background: #fff;
    flex: 1; /* 남은 공간 차지 */
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden; /* 테이블 외 스크롤 방지 */
    min-width: 0;
    min-height: 0;
  }
  
  .end-box {
    display: flex;
    justify-content: flex-end;
  }
  
  /* ===== 테이블(테이블 내부 스크롤) ===== */
  :root {
    --thead-r1: 36px;  /* 헤더 1행 높이 */
    --thead-r2: 36px;  /* 헤더 2행 높이 */
    --sbw: 0px;        /* 스크롤바 폭(JS로 세팅) */
  }
  
  .detail-search-table {
    width: 100%;
    table-layout: fixed;     /* 열 너비 고정 계산 */
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #fff;
    border-radius: 8px;
    background: #fff;
  }
  
  /* 헤더/바디가 같은 column layout을 공유 */
  .detail-search-table thead,
  .detail-search-table tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
  }

  /* .detail-search-table tbody tr {
    cursor: pointer;
  } */
  
  /* tbody만 스크롤(스크롤바는 이 영역에서만 표시/동작) */
  .detail-search-table tbody {
    display: block;
    /* max-height: 60vh; */
    height: 60vh;    
    overflow-y: auto;
    overflow-x: hidden;   /* 가로 스크롤 필요 시 auto */
    scrollbar-gutter: stable; /* 스크롤 유무에 따른 폭 변동 최소화 */
    overscroll-behavior: contain;
  }
  
  /* 헤더 오른쪽 빈 영역 보정 + 배경 유지 */
  .detail-search-table thead {
    position: relative;
    background: #f4f6fa;
    padding-right: var(--sbw); /* 스크롤바 폭만큼 패딩 */
  }
  
  .detail-search-table thead::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: var(--sbw);                                /* 스크롤바 폭 */
    height: calc(var(--thead-r1) + var(--thead-r2));  /* 헤더 두 줄 합 */
    background: #f4f6fa;
    border-top-right-radius: 8px;
    pointer-events: none;
    z-index: 1; /* th(z=2) 아래, 본문 위 */
  }
  
  /* 두 줄 헤더 sticky */
  .detail-search-table thead th {
    background: #f4f6fa;
    border-right: 1px solid #fff;
    border-bottom: 1px solid #fff;
    font-weight: 400;
    z-index: 2;
  }
  
  .detail-search-table thead tr:first-child th {
    position: sticky;
    top: 0;
    height: var(--thead-r1);
    line-height: calc(var(--thead-r1) - 16px); /* 패딩 고려 */
  }
  
  .detail-search-table thead tr:nth-child(2) th {
    position: sticky;
    top: var(--thead-r1);
    height: var(--thead-r2);
    line-height: calc(var(--thead-r2) - 16px);
  }
  
  /* 셀 공통 */
  .detail-search-table th,
  .detail-search-table td {
    padding: 8px 10px;
    /* border-right: 1px solid #eaeaea;
    border-bottom: 1px solid #eaeaea; */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    font-size: 14px;
    box-sizing: border-box;
  }

  
  .detail-search-table th:last-child,
  .detail-search-table td:last-child {
    border-right: none;
  }
  
  /* 줄무늬 */
  .detail-search-table tbody tr:nth-of-type(even) {
    background: #f4f6fa;
  }
  
  /* 둥근 모서리 */
  .detail-search-table thead tr:first-child th:first-child {
    border-top-left-radius: 8px;
  }
  .detail-search-table thead tr:first-child th:last-child {
    border-top-right-radius: 8px;
  }
  .detail-search-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
  }
  .detail-search-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
  }
  
  /* 상태 색상 */
  .detail-search-table-body .table-failed {
    color: #F43F5E;
  }
  
  /* ===== 기타 위젯 ===== */
  .count-box {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .excel-icon {
    padding: 3px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    display: flex;
    width: 32px;
    height: 32px;
    cursor: pointer;
  }
  
  .excel-icon > img {
    transform: translateX(1px);
  }
  
  .detail-widget {
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    min-height: 0;
    flex: 1;
  }
  
  @media (max-width: 1200px) {
    .detail-widget { min-width: 300px; }
  }
  @media (max-width: 768px) {
    .detail-widget { min-width: 250px; }
    .detail-widget .title-box {
      flex-direction: column;
      align-items: flex-start;
      gap: 8px;
    }
    .detail-widget .select-box { justify-content: flex-start; }
  }
  
  .detail-chart {
    min-height: 150px;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    flex: 1;
  }
  
  .detail-chart.big {
    min-height: 300px;
  }
  
  .detail-widget .title-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    flex-shrink: 0;
  }
  
  .detail-widget .text-title {
    font-weight: 600;
    font-size: 16px;
    color: #333;
  }
  
  .detail-widget .select-box {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    min-width: 0;
    flex-shrink: 0;
  }
  
  .detail-widget .each-select {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-shrink: 0;
  }
  
  .detail-widget .text-status {
    font-size: 14px;
    color: #666;
  }
  
  .detail-widget .select {
    border-color: #e0e0e0;
    border-radius: 8px;
    padding: 4px;
    outline: none;
    font-size: 14px;
    min-width: 0;
    max-width: 100%;
  }

  /* 에러 로그 툴팁 스타일 */
  /* .error-log {
    display: none;
    position: absolute;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 400px;
    font-size: 12px;
    line-height: 1.4;
    color: #333;
    word-wrap: break-word;
    white-space: pre-wrap;
  }

  .error-log.show {
    display: block;
  } */

  /* 기존 에러 로그 툴팁 스타일 */
.error-log {
    display: none;
    position: absolute;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 400px;
    font-size: 12px;
    line-height: 1.4;
    color: #333;
    word-wrap: break-word;
    white-space: pre-wrap;

    /* 토스트 레이아웃 적용 */
    align-items: flex-start;
    gap: 10px;
}

.error-log.show {
    display: flex;
}

.toast__icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: #f1f3f5;
    color: #868e96;
}

.toast__icon-svg {
    width: 16px;
    height: 16px;
}

.toast__icon .material-symbols-outlined {
    font-size: 18px;  /* 아이콘 크기 */
    line-height: 1;
  }

.toast__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 5px 0px 5px 0px;
}

.toast__title {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 4px;
    margin: 0; 
}

.toast__desc {
    font-size: 12px;
    color: #495057;
    margin: 0; 
}


/* ===== 팝업/모달 스타일 (popup.css에서 가져옴) ===== */

/* 팝업 컨테이너 스타일 */
.popup-container {
    background: #f4f6fa;
    width: 100%;      
    height: 100%;    
    max-width: none;   
    max-height: none;  
    margin: 0;
    padding: 16px;
    min-height: 100vh;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;
    gap: 10px;

    overflow: hidden;
}

.main-title {
    margin-bottom: 4px;
    font-size: 24px;
    line-height: 1;
}

.info-section,
.error-section {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-title-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    /* margin: 0 0 20px 0; */
    font-size: 16px;
    font-weight: 600;
    color: #000000;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: #f0f0f0;
    color: #333;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 20px;
}

.info-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.info-item.full-width {
    grid-column: 1 / -1; /* 전체 너비 사용 */
}

.info-label {
    font-size: 13px;
    font-weight: 500;
    color: #000000;
    margin: 0;
    flex: 0 0 65px;
}

.info-value {
    background: #f4f6fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 400;
    color: #000000;
    min-height: 20px;
    display: flex;
    align-items: center;
    flex: 1;
}

.error-content-box {
    position: relative;
    /* width: 100%;
    height: 100%; */
}

.error-content {
    /* position: absolute; */
    width: 98%;
    height: 100%;

    background: #f4f6fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    max-height: 220px;      
    min-height: 200px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-y: auto;
}

/* Webkit 브라우저 스크롤바 스타일링 */
.error-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.error-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.error-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.error-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.error-content {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666666;
    font-style: italic;
}

.error-message {
    text-align: center;
    padding: 20px;
    color: #dc3545;
}

.no-data {
    text-align: center;
    padding: 20px;
    color: #666666;
}

/* ===== 모달 전용 스타일 ===== */

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

.modal-overlay.show {
    display: flex;
}

.modal-container {
    background: #f4f6fa;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { 
        transform: translateY(-50px); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0); 
        opacity: 1; 
    }
}

/* 모달 내부 팝업 컨테이너 조정 */
.modal-container .popup-container {
    min-height: auto;
    max-height: 80vh;
    overflow: auto;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .modal-container {
        max-width: 95vw;
        max-height: 95vh;
        margin: 10px;
    }
    
    .popup-container {
        padding: 20px;
    }
    
    .info-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .main-title h1 {
        font-size: 24px;
    }
    
    .section-title {
        font-size: 16px;
    }
}
  