/* 품질관리 5개 화면 공용 스타일.
   모든 선택자를 .quality-page 로 한정해 다른 화면의 클래스와 충돌하지 않게 한다.
   (mes-screen.css 는 한정자가 없어 .crud / .search-input / .search-btn 충돌이 반복됐다.) */

.quality-page { height: 100%; display: grid; gap: 3px; }

.quality-page .panel { background: #fff; border: 1px solid #858585; position: relative; overflow: hidden; }
.quality-page .panel-head {
    height: 42px; background: var(--mes-panel-head); color: #fff;
    display: flex; align-items: center; gap: 8px; padding: 0 8px; font-size: 18px; font-weight: 700;
}
.quality-page .panel-head .icon { color: var(--mes-orange); }
.quality-page .chart-title { margin-left: 4px; font-size: 14px; font-weight: 700; color: #FFE082; white-space: nowrap; }
.quality-page .chart-legend,
.quality-page .sort-guide { margin-left: auto; margin-right: 8px; font-size: 12px; color: #DCE4E9; white-space: nowrap; }

/* ===== 조회조건 ===== */
.quality-page .search-fields {
    position: absolute; left: 0; right: 0; top: 42px; height: 64px;
    display: flex; align-items: center; gap: 10px; padding: 0 12px;
}
.quality-page .search-fields label { font-size: 15.5px; white-space: nowrap; }
.quality-page .search-fields input,
.quality-page .search-fields select {
    height: 31px; padding: 2px 7px;
    border: 1px solid #D4D4D4; background: #fff; outline: none; font-size: 15px; box-shadow: none;
}
.quality-page .search-fields .date { width: 150px; }
.quality-page .search-fields .normal { width: 160px; }
.quality-page .search-fields .eq { width: 180px; }
.quality-page .search-fields .search-btn {
    margin-left: auto; width: 100px; height: 38px; border: 0;
    background: var(--mes-new); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}

/* ===== 요약 4칸 (05-03 ~ 05-05) ===== */
.quality-page .summary-wrap { height: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 3px; }
.quality-page .sum { border: 1px solid #9A9A9A; background: #fff; display: grid; grid-template-columns: 1.08fr .92fr; min-width: 0; }
.quality-page .sum .label { display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; background: #F4F4F4; }
.quality-page .sum .value {
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1;
}
.quality-page .sum.total .value { color: #222; }
.quality-page .sum.ng .value { color: #C94949; }
.quality-page .sum.rate .value { color: #1E88E5; }
.quality-page .sum.today .value { color: #E58C00; }

/* ===== 본문 배치 ===== */
.quality-page .work { display: grid; grid-template-columns: 34% 66%; gap: 3px; min-height: 0; }
.quality-page .right { display: grid; grid-template-rows: 43% 57%; gap: 3px; min-height: 0; }

/* ===== 표 ===== */
.quality-page .grid-wrap { position: absolute; left: 0; right: 0; top: 42px; bottom: 0; overflow: auto; scrollbar-gutter: stable; }
.quality-page .tbl { border-collapse: collapse; table-layout: fixed; width: 100%; font-size: 14.5px; }
.quality-page .tbl th {
    position: sticky; top: 0; z-index: 2; height: 42px; background: var(--mes-grid-head); color: #fff;
    border-right: 1px solid #547083; border-bottom: 1px solid #ddd;
    padding: 0 6px; font-weight: 700; white-space: nowrap; text-align: left;
}
.quality-page .tbl th.sortable { cursor: pointer; user-select: none; }
.quality-page .tbl th.sortable:hover { background: #31576D; }
.quality-page .tbl th .sort-icon { margin-left: 5px; color: #B7C6D0; font-size: 11px; }
.quality-page .tbl th.active .sort-icon { color: #fff; font-size: 12px; font-weight: 800; }
.quality-page .tbl td {
    height: 38px; border-right: 1px solid #D1D1D1; border-bottom: 1px solid #DEDEDE;
    padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.quality-page .tbl tbody tr { cursor: pointer; }
.quality-page .tbl tbody tr:hover td { background: #E8F4F2; }
.quality-page .tbl tbody tr.selected td { background: var(--mes-grid-selected); }
.quality-page .tbl tbody tr.no-row td { color: #777; background: #F3F3F3; cursor: default; }
.quality-page .center { text-align: center; }
.quality-page .number { text-align: right; }
.quality-page .danger { color: #C94949; }
.quality-page .yield { color: #1E88E5; font-weight: 800; }

/* ===== 차트 ===== */
.quality-page .chart-box {
    position: absolute; left: 18px; right: 18px; top: 58px; bottom: 22px;
    border-left: 1px solid #777; border-bottom: 1px solid #777; padding: 12px 12px 0 14px;
}
.quality-page .bars { height: 100%; display: flex; align-items: flex-end; justify-content: space-around; gap: 12px; }
.quality-page .bar-col { flex: 1; max-width: 120px; height: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; }
.quality-page .bar { width: 48px; min-height: 3px; background: #C94949; position: relative; }
.quality-page .bar.blue { background: #1E88E5; }
.quality-page .bar-value { position: absolute; top: -21px; left: -30px; right: -30px; text-align: center; font-size: 12px; font-weight: 800; color: #222; white-space: nowrap; }
.quality-page .bar-label {
    position: absolute; bottom: -21px; left: -18px; right: -18px; text-align: center;
    font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ===== 상세 요약줄 ===== */
.quality-page .summary-line {
    position: absolute; left: 12px; right: 12px; top: 49px; height: 34px;
    background: #F3F3F3; border: 1px solid #C7C7C7;
    display: flex; align-items: center; gap: 24px; padding: 0 12px; font-size: 13.5px;
}
.quality-page .summary-line b { font-size: 16px; }
.quality-page .detail-wrap { position: absolute; left: 0; right: 0; top: 86px; bottom: 0; overflow: auto; }

/* ===== 심각도 배지 ===== */
.quality-page .badge {
    display: inline-flex; align-items: center; justify-content: center;
    height: 25px; min-width: 62px; padding: 0 7px; font-size: 13px; font-weight: 700;
}
.quality-page .badge.high { background: #FCE1DF; color: #B73832; }
.quality-page .badge.mid { background: #FFF0C9; color: #A36A00; }
.quality-page .badge.low { background: #E4F2EA; color: #277A50; }
.quality-page .badge.ng { background: #FCE1DF; color: #B73832; }
/* 불량코드에 중요도(T_CD_REJ.SEVERITY_CD)가 지정되지 않은 경우 */
.quality-page .badge.none { background: #EEF1F4; color: #6B7280; }
