/*
 * 아이오시스템 ERP 시연용 화면 폭 보정 (저장소 무수정, nginx 가 index.html 에 끼워 넣는다)
 * 원래 화면은 머리글과 본문에 min-width: 1458px 이 걸려 있어 좁은 창에서 오른쪽이 잘린다.
 * 축소(zoom·scale)는 하지 않고, 태블릿·데스크톱 폭에서 배치가 줄어들도록 고친다.
 * 클래스 이름이 styled-components 해시라 구조(#outlet 기준)로 고른다.
 */

/* 본문: 최소 폭을 풀고, 그래도 넓은 표는 본문 안에서 가로로 스크롤 */
#outlet.outlet-container {
  min-width: 0 !important;
  overflow-x: auto;
}

/* 머리글: 회사명 | 메뉴 | 즐겨찾기·프로필 을 내용 폭에 맞춰 나눈다 */
div:has(> #outlet) > div:first-child {
  min-width: 0 !important;
  grid-template-columns: auto 1fr auto !important;
  column-gap: 20px;
}
div:has(> #outlet) > div:first-child > div:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 28vw;
}

@media (max-width: 1280px) {
  div:has(> #outlet) > div:first-child { padding: 0 16px !important; }
  div:has(> #outlet) > div:first-child > div:nth-child(2) { gap: 22px !important; }
  div:has(> #outlet) > div:first-child > div:nth-child(4) { gap: 12px !important; }
  div:has(> #outlet) > div:first-child > div:nth-child(4) > div:last-child { padding-left: 12px !important; gap: 12px !important; }
  div:has(> #outlet) > div:first-child > div:first-child { font-size: 18px !important; }
  #outlet.outlet-container { padding: 16px !important; }
}

/* 검색 조건 줄: 넘치면 다음 줄로 */
#outlet .filter_outer { height: auto !important; flex-wrap: wrap; row-gap: 8px; }
#outlet .filter_outer > div, #outlet .checkbox_group { flex-wrap: wrap; row-gap: 6px; }
#outlet .main-body-title-conatiner { flex-wrap: wrap; row-gap: 8px; }
#outlet .main-body-title { white-space: nowrap; }

/* 대시보드: 왼쪽 카드 묶음 | 일정. 좁으면 일정을 아래로 */
[data-ig-path="/home"] #outlet > div > div:first-child {
  grid-template-columns: minmax(0, 1fr) 326px !important;
}
@media (max-width: 1180px) {
  [data-ig-path="/home"] #outlet > div > div:first-child { grid-template-columns: minmax(0, 1fr) !important; }
}

/* 근로자관리: 목록(445px) 옆 상세가 좁아지면(창 1540px 미만) 목록 위·상세 아래로 쌓는다 */
@media (max-width: 1540px) {
  [data-ig-path="/labor-manage/worker-manage"] #outlet > div > div > div:nth-child(2) {
    flex-wrap: wrap; height: auto !important; overflow: visible !important; row-gap: 20px;
  }
  [data-ig-path="/labor-manage/worker-manage"] #outlet > div > div > div:nth-child(2) > div:first-child { width: 100% !important; }
  [data-ig-path="/labor-manage/worker-manage"] #outlet > div > div > div:nth-child(2) > div:first-child .table-sticky { min-height: 0 !important; max-height: 340px; }
  [data-ig-path="/labor-manage/worker-manage"] #outlet > div > div > div:nth-child(2) > div:nth-child(2) { width: 100% !important; }
}

/* 개인사진/출역: 오른쪽 출역 표 영역이 남은 폭만 쓰게 (표는 제 상자 안에서 가로 스크롤) */
[data-ig-path="/labor-manage/personal-commuting"] #outlet > div > div > div:nth-child(2) > div:nth-child(2) {
  flex: 1 1 0 !important; min-width: 0 !important; width: auto !important;
}

/* 집계조회: 현장·공종·외주·직종 선택표를 폭에 맞춰 1~2열로 */
[data-ig-path="/labor-manage/aggregate-query"] #outlet .table-box {
  grid-template-columns: repeat(auto-fit, minmax(392px, 1fr)) !important;
}
[data-ig-path="/labor-manage/personal-commuting"] #outlet > div > div > div:nth-child(2) > div:first-child {
  flex: 0 0 300px !important; width: 300px !important;
}
#outlet form > div:first-child, #outlet form label { white-space: nowrap; }
#outlet .hr-table-wrapper { overflow-x: auto; }
