/* =========================================
   Quality ERP 공통 레이아웃 보정
   Version: v0.8.3.1
   File: v0_8_3_1_layout_fix.css

   목적
   - 상단 로고/제목 영역 정렬 안정화
   - 로그인 이후 모든 업무 화면의 외곽 폭 통일
   - 시험의뢰/시험접수/시험지시/시험진행 등
     품질업무 화면이 대형 모니터에서 자연스럽게 확장되도록 보정
   - 기존 버전 CSS를 삭제하지 않고 마지막에서 안전하게 덮어쓰기
   ========================================= */

/* 전체 박스 계산 방식 통일 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* =========================================
   1. 상단 헤더
   ========================================= */

.erp-topbar {
    width: 100%;
    min-height: 52px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: #ffffff;
    border-bottom: 1px solid #d9e1ec;
}

/* 로고 + 시스템명 */
.erp-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    min-width: 300px;
}

.erp-logo {
    width: 72px;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.erp-title-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 220px;
    white-space: nowrap;
}

.erp-title {
    margin: 0;
    color: #17365d;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.15;
}

.erp-subtitle {
    margin-top: 3px;
    color: #667085;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
}

/* 상단 우측 사용자 영역 */
.erp-user-area {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    flex: 0 0 auto;
    min-width: 0;
    white-space: nowrap;
}

/* =========================================
   2. 본문 공통 외곽 폭
   ========================================= */

.erp-main {
    flex: 1;
    min-width: 0;
    padding: 20px 24px 32px;
}

/*
  화면 전체를 끝까지 사용하지 않고,
  좌우 16px씩 여백을 남기며 최대 1320px까지 사용
*/
.erp-content,
.erp-footer {
    width: calc(100% - 32px) !important;
    max-width: 1320px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* 푸터 정렬 */
.erp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* =========================================
   3. 품질업무 페이지 공통 폭
   ========================================= */

/*
  시험의뢰 / 시험접수 / 시험지시 / 시험진행 등
  각 템플릿 최상단에 class="quality-page"를 적용하면
  동일한 폭 기준으로 정렬됨
*/
.quality-page {
    width: 100%;
    max-width: none;
    margin: 0;
}

/* 품질업무 제목 카드 */
.quality-page-header {
    width: 100%;
    max-width: none;
    margin: 0 0 16px;
}

/* 품질업무 내용 카드 */
.quality-page-card {
    width: 100%;
    max-width: none;
    margin: 0 0 16px;
}

/* 품질업무 내부의 대표 카드/폼/표는 부모 폭 전체 사용 */
.quality-page .page-header,
.quality-page .head,
.quality-page .form-card,
.quality-page .form,
.quality-page .table-card,
.quality-page .detail-card,
.quality-page .box,
.quality-page .custom-container,
.quality-page .custom-card,
.quality-page .table-wrap,
.quality-page .table-container,
.quality-page .list-table-wrap {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* 표는 카드 폭 전체 사용 */
.quality-page table,
.quality-page .table-card table,
.quality-page .table-wrap table,
.quality-page .table-container table,
.quality-page .list-table-wrap table {
    width: 100% !important;
}

/* 가로 열이 많은 표는 내부 스크롤 허용 */
.quality-page .table-wrap,
.quality-page .table-container,
.quality-page .list-table-wrap {
    overflow-x: auto;
}

/* =========================================
   4. 반응형 보정
   ========================================= */

@media (max-width: 1200px) {
    .erp-topbar {
        padding: 0 14px;
        gap: 12px;
    }

    .erp-brand {
        min-width: 260px;
    }

    .erp-title-wrap {
        min-width: 180px;
    }

    .erp-content,
    .erp-footer {
        width: calc(100% - 20px) !important;
    }

    .erp-main {
        padding: 16px;
    }
}

@media (max-width: 900px) {
    .erp-topbar {
        flex-wrap: wrap;
        min-height: auto;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .erp-brand {
        min-width: 0;
    }

    .erp-user-area {
        width: 100%;
        justify-content: flex-end;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .erp-subtitle {
        display: none;
    }

    .erp-clock {
        display: none;
    }

    .erp-content,
    .erp-footer {
        width: 100% !important;
    }
}

@media (max-width: 620px) {
    .erp-main {
        padding: 12px;
    }

    .erp-logo {
        width: 62px;
    }

    .erp-title {
        font-size: 16px;
    }

    .erp-user-area {
        justify-content: flex-start;
    }

    .erp-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

body {
    outline: 8px solid red !important;
}