/* Pretendard 웹폰트 — pretendard-local.css (@font-face) 선행 로드 */

/* 왜: 화면군이 늘어나도 색상과 기본 타이포그래피를 한 곳에서 통일하기 위한 공통 토큰입니다. */
:root {
    --color-page: #edf1f5;
    --color-page-soft: #f2f5f9;
    --color-surface: #ffffff;
    --color-surface-soft: #f7f9fc;
    --color-surface-muted: #f5f7fa;
    --color-text: #1f2937;
    --color-text-strong: #111827;
    --color-text-muted: #5b6678;
    --color-text-subtle: #738195;
    --color-border: #d7dee8;
    --color-border-strong: #c7d2de;
    --color-primary: #224f95;
    --color-primary-soft: #edf3ff;
    --color-primary-strong: #16253f;
    --color-primary-dark: #0f1b31;
    --color-sidebar-text: #dbe5f3;
    --color-sidebar-subtle: #90a2bd;
    --color-accent: #b38a4c;
    --color-accent-soft: #fff7e8;
    --color-danger: #b91c1c;
    --color-danger-soft: #fef2f2;
    --color-success: #166534;
    --color-success-soft: #f0fdf4;
    --shadow-card: 0 8px 22px rgba(15, 23, 42, 0.05);
    --shadow-panel: 0 14px 34px rgba(15, 23, 42, 0.06);
    --shadow-elevated: 0 20px 45px rgba(15, 23, 42, 0.08);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 22px;
    --space-1: 6px;
    --space-2: 10px;
    --space-3: 14px;
    --space-4: 18px;
    --space-5: 24px;
    --space-6: 32px;
}

/* 왜: 브라우저 기본 박스모델 차이로 레이아웃이 흔들리지 않게 전체 기준을 맞춥니다. */
* {
    box-sizing: border-box;
}

/*
 * Toast UI Grid — 컬럼이 많을 때 가로 스크롤이 나오지 않는 현상 완충
 * 왜: flex·grid 안에서 블록의 min-width 기본값은 auto(=자식 「최소 콘텐츠 너비」)라 그리드 루트가
 *     표 전체보다 좁아지지 않고, 브라우저는 바깥쪽에 넘침 처리만 하거나 잘림만 줄 뿐
 *     그리드 내부 .tui-grid-body-area 가 스크롤을 만들 계기를 잃습니다.
 *     호스트(.tui-grid-container)·래퍼에 min-width:0 을 두면 가로 크기가 부모(우측 작업 패널)에 먼저 고정된 뒤
 *     그 안에서 표가 넘칠 경우 토스트가 의도대로 스크롤바를 렌더링합니다.
 */
.tui-grid-container {
    min-width: 0;
}

/*
 * 호스트가 flex 안에서 무한히 넓어지며 스크롤이 「페이지 바깥」으로만 새는 현상 완충.
 * 폭 한도 안에서만 Toast 가 내부 .tui-grid-body-area 가로 스크롤을 붙입니다.
 */
.product-table-wrap .tui-grid-product,
.history-table-wrap .tui-grid-product,
.stock-ledg-page .split-pane-shell .tui-grid-host-inner.tui-grid-product,
.tui-grid-host-inner.tui-grid-product {
    max-width: 100%;
}

/*
 * 레이아웃 깊숙이 들어간 Toast 호스트까지 가로 min-width 계약 유지 + 하단 패딩(스크롤 행 안전 여백)은 카드 형 래퍼에만 줍니다.
 */
.product-table-wrap,
.bp-table-wrap,
.zone-table-wrap,
.location-table-wrap,
.sd-table-wrap,
.history-table-wrap,
.stock-ledg-main,
.stock-ledg-grid-wrap,
.stock-adj-existing-grid-host,
.split-pane-shell,
.tui-grid-host-inner {
    min-width: 0;
}

/*
 * Toast Grid 하단 가로 스크롤바(~17px)·세로 스크롤과 겹치는 영역이 카드 border / overflow:hidden 에
 * 잘리지 않게 합니다. 숫자가 너무 작으면 「가로 스크롤이 없다」고 느끼기 쉽습니다.
 */
.product-table-wrap,
.bp-table-wrap,
.zone-table-wrap,
.location-table-wrap,
.sd-table-wrap,
.history-table-wrap,
.split-pane-shell {
    padding-bottom: 14px;
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    /* 왜: 전체 화면의 한글 가독성을 일정하게 유지하기 위해 기본 서체를 프리텐다드로 통일합니다. */
    font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
    background: var(--color-page);
    color: var(--color-text);
    font-size: 13px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 왜: 링크/폼 기본 스타일은 모든 화면에서 재사용되므로 공통 레벨에서 먼저 정리합니다. */
a {
    text-decoration: none;
}

button,
input,
select,
textarea {
    font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
    font-size: 13px;
}

::placeholder {
    font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
    font-size: 13px;
    color: #94a3b8;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--color-text-strong);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* 왜: 입력 요소의 기본 상태를 통일해 각 화면 CSS는 레이아웃 차이에만 집중하게 합니다. */
input,
select,
textarea {
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    color: var(--color-text-strong);
}

button {
    font-weight: 700;
}

/* 그리드 설정 저장 토스트 — SweetAlert 기본 success 애니메이션 대신 고정 비율 체크 배지를 사용합니다. */
html body .swal2-popup.swal2-toast.wms-grid-settings-toast {
    display: flex !important;
    align-items: center !important;
    width: auto !important;
    min-width: 260px !important;
    max-width: min(360px, calc(100vw - 32px)) !important;
    padding: 10px 15px !important;
    border-radius: 12px !important;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16) !important;
}

html body .swal2-popup.swal2-toast.wms-grid-settings-toast .swal2-html-container {
    display: flex !important;
    align-items: center !important;
    gap: 9px !important;
    margin: 0 !important;
    padding: 0 !important;
}

html body .swal2-popup.swal2-toast.wms-grid-settings-toast .wms-grid-settings-toast__check {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 20px !important;
    width: 20px !important;
    height: 20px !important;
    border-radius: 999px !important;
    background: #10b981 !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
}

html body .swal2-popup.swal2-toast.wms-grid-settings-toast .wms-grid-settings-toast__text {
    color: var(--color-text-strong) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
}

html body .swal2-popup.swal2-toast.wms-grid-settings-toast .swal2-title {
    display: none !important;
}

/* SweetAlert2 성공 토스트 공통 — 기본 success 애니메이션 대신 고정 비율 체크 배지로 통일합니다. */
html body .swal2-popup.swal2-toast:has(.swal2-icon.swal2-success):not(.wms-grid-settings-toast) {
    align-items: center !important;
    padding: 10px 15px !important;
    border-radius: 12px !important;
}

html body .swal2-popup.swal2-toast:not(.wms-grid-settings-toast) .swal2-icon.swal2-success {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 20px !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    margin: 0 9px 0 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #10b981 !important;
    color: #fff !important;
    transform: none !important;
}

html body .swal2-popup.swal2-toast:not(.wms-grid-settings-toast) .swal2-icon.swal2-success::before {
    content: "✓";
    display: block !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
}

html body .swal2-popup.swal2-toast:not(.wms-grid-settings-toast) .swal2-icon.swal2-success .swal2-success-ring,
html body .swal2-popup.swal2-toast:not(.wms-grid-settings-toast) .swal2-icon.swal2-success [class^="swal2-success-line"],
html body .swal2-popup.swal2-toast:not(.wms-grid-settings-toast) .swal2-icon.swal2-success [class*=" swal2-success-line"],
html body .swal2-popup.swal2-toast:not(.wms-grid-settings-toast) .swal2-icon.swal2-success .swal2-success-circular-line-left,
html body .swal2-popup.swal2-toast:not(.wms-grid-settings-toast) .swal2-icon.swal2-success .swal2-success-circular-line-right,
html body .swal2-popup.swal2-toast:not(.wms-grid-settings-toast) .swal2-icon.swal2-success .swal2-success-fix {
    display: none !important;
}

html body .swal2-popup.swal2-toast:not(.wms-grid-settings-toast) .swal2-title {
    margin: 0 !important;
    padding: 0 !important;
    color: var(--color-text-strong) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
}

html body .swal2-popup.swal2-toast:not(.wms-grid-settings-toast) .swal2-html-container,
html body .swal2-popup.swal2-toast:not(.wms-grid-settings-toast) .swal2-toast-html-container {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 13px !important;
    line-height: 1.35 !important;
}

/* -----------------------------------------------------------------------------
 * SweetAlert2 — 기본 알람(토스트·대형 폼 모달 제외) 타이포·아이콘 크기 WMS 공통에 맞춤
 * -----------------------------------------------------------------------------
 * 라이브러리 기본은 제목·본문을 em 으로 키워 짧은 문구도 과하게 크게 보일 수 있습니다.
 * 모달(카드) 폭은 번들 기본에 맡기고, 제목 16px · 본문 13px · 버튼 13px · 아이콘은 번들 기본 대비 약 40% 축소입니다.
 * 아이콘: width/height !important 로 직접 줄이면 체크·물음표 등 내부 도형 좌표가 어긋날 수 있어
 *        SweetAlert2 가 쓰는 `--swal2-icon-zoom` 만 씁니다(기본 1 → 약 40% 줄이면 남김 60% ≈ 0.6).
 * --------------------------------------------------------------------------- */
html
    body
    .swal2-container
    .swal2-popup:not(
        :is(
            .swal2-toast,
            .product-modal-popup,
            .mass-upload-modal,
            .mass-upload-swal,
            .bp-partner-modal-popup,
            .stock-adj-product-pick-sw,
            .stock-adj-pi-download-swnarrow,
            .stock-adj-swal-alert-compact,
            .swal2-custom-popup,
            .swal-location-barcode-print,
            .swal-location-a4-pdf-preview,
            .org-wide,
            .wms-enterprise-grid-swals-popup,
            .swal-excel-upload-popup
        )
    ) {
    --swal2-icon-zoom: 0.6 !important;
}

html
    body
    .swal2-container
    .swal2-popup:not(
        :is(
            .swal2-toast,
            .product-modal-popup,
            .mass-upload-modal,
            .mass-upload-swal,
            .bp-partner-modal-popup,
            .stock-adj-product-pick-sw,
            .stock-adj-pi-download-swnarrow,
            .stock-adj-swal-alert-compact,
            .swal2-custom-popup,
            .swal-location-barcode-print,
            .swal-location-a4-pdf-preview,
            .org-wide,
            .wms-enterprise-grid-swals-popup,
            .swal-excel-upload-popup
        )
    )
    .swal2-title {
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
}

html
    body
    .swal2-container
    .swal2-popup:not(
        :is(
            .swal2-toast,
            .product-modal-popup,
            .mass-upload-modal,
            .mass-upload-swal,
            .bp-partner-modal-popup,
            .stock-adj-product-pick-sw,
            .stock-adj-pi-download-swnarrow,
            .stock-adj-swal-alert-compact,
            .swal2-custom-popup,
            .swal-location-barcode-print,
            .swal-location-a4-pdf-preview,
            .org-wide,
            .wms-enterprise-grid-swals-popup,
            .swal-excel-upload-popup
        )
    )
    .swal2-html-container,
html
    body
    .swal2-container
    .swal2-popup:not(
        :is(
            .swal2-toast,
            .product-modal-popup,
            .mass-upload-modal,
            .mass-upload-swal,
            .bp-partner-modal-popup,
            .stock-adj-product-pick-sw,
            .stock-adj-pi-download-swnarrow,
            .stock-adj-swal-alert-compact,
            .swal2-custom-popup,
            .swal-location-barcode-print,
            .swal-location-a4-pdf-preview,
            .org-wide,
            .wms-enterprise-grid-swals-popup,
            .swal-excel-upload-popup
        )
    )
    #swal2-html-container,
html
    body
    .swal2-container
    .swal2-popup:not(
        :is(
            .swal2-toast,
            .product-modal-popup,
            .mass-upload-modal,
            .mass-upload-swal,
            .bp-partner-modal-popup,
            .stock-adj-product-pick-sw,
            .stock-adj-pi-download-swnarrow,
            .stock-adj-swal-alert-compact,
            .swal2-custom-popup,
            .swal-location-barcode-print,
            .swal-location-a4-pdf-preview,
            .org-wide,
            .wms-enterprise-grid-swals-popup,
            .swal-excel-upload-popup
        )
    )
    .swal2-content {
    font-size: 13px !important;
    line-height: 1.45 !important;
}

html
    body
    .swal2-container
    .swal2-popup:not(
        :is(
            .swal2-toast,
            .product-modal-popup,
            .mass-upload-modal,
            .mass-upload-swal,
            .bp-partner-modal-popup,
            .stock-adj-product-pick-sw,
            .stock-adj-pi-download-swnarrow,
            .stock-adj-swal-alert-compact,
            .swal2-custom-popup,
            .swal-location-barcode-print,
            .swal-location-a4-pdf-preview,
            .org-wide,
            .wms-enterprise-grid-swals-popup,
            .swal-excel-upload-popup
        )
    )
    .swal2-html-container
    p,
html
    body
    .swal2-container
    .swal2-popup:not(
        :is(
            .swal2-toast,
            .product-modal-popup,
            .mass-upload-modal,
            .mass-upload-swal,
            .bp-partner-modal-popup,
            .stock-adj-product-pick-sw,
            .stock-adj-pi-download-swnarrow,
            .stock-adj-swal-alert-compact,
            .swal2-custom-popup,
            .swal-location-barcode-print,
            .swal-location-a4-pdf-preview,
            .org-wide,
            .wms-enterprise-grid-swals-popup,
            .swal-excel-upload-popup
        )
    )
    #swal2-html-container
    p {
    font-size: 13px !important;
}

html
    body
    .swal2-container
    .swal2-popup:not(
        :is(
            .swal2-toast,
            .product-modal-popup,
            .mass-upload-modal,
            .mass-upload-swal,
            .bp-partner-modal-popup,
            .stock-adj-product-pick-sw,
            .stock-adj-pi-download-swnarrow,
            .stock-adj-swal-alert-compact,
            .swal2-custom-popup,
            .swal-location-barcode-print,
            .swal-location-a4-pdf-preview,
            .org-wide,
            .wms-enterprise-grid-swals-popup,
            .swal-excel-upload-popup
        )
    )
    .swal2-styled.swal2-confirm,
html
    body
    .swal2-container
    .swal2-popup:not(
        :is(
            .swal2-toast,
            .product-modal-popup,
            .mass-upload-modal,
            .mass-upload-swal,
            .bp-partner-modal-popup,
            .stock-adj-product-pick-sw,
            .stock-adj-pi-download-swnarrow,
            .stock-adj-swal-alert-compact,
            .swal2-custom-popup,
            .swal-location-barcode-print,
            .swal-location-a4-pdf-preview,
            .org-wide,
            .wms-enterprise-grid-swals-popup,
            .swal-excel-upload-popup
        )
    )
    .swal2-styled.swal2-cancel,
html
    body
    .swal2-container
    .swal2-popup:not(
        :is(
            .swal2-toast,
            .product-modal-popup,
            .mass-upload-modal,
            .mass-upload-swal,
            .bp-partner-modal-popup,
            .stock-adj-product-pick-sw,
            .stock-adj-pi-download-swnarrow,
            .stock-adj-swal-alert-compact,
            .swal2-custom-popup,
            .swal-location-barcode-print,
            .swal-location-a4-pdf-preview,
            .org-wide,
            .wms-enterprise-grid-swals-popup,
            .swal-excel-upload-popup
        )
    )
    .swal2-styled.swal2-deny {
    font-size: 13px !important;
}

/* ---------------------------------------------------------------------------
 * 전역 작업 창고 스위처 (Phase 3)
 * 전역 작업 창고 스위처 — 사이드바 워크스페이스 카드(`sidebar-workspace-picker`)에서 사용합니다.
 * --------------------------------------------------------------------------- */
.wms-warehouse-switcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.wms-warehouse-switcher-label {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
}

.wms-warehouse-switcher-hint {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
}

.wms-warehouse-switcher.is-legacy-context .wms-warehouse-switcher-select {
    border-color: #cbd5e1;
}

.wms-warehouse-switcher-select {
    min-width: 200px;
    max-width: 320px;
    padding: 8px 12px;
    border: 1px solid #dbe2ec;
    border-radius: 8px;
    background: #fff;
    color: #1e293b;
    font-size: 13px;
    font-weight: 600;
}

.wms-warehouse-switcher--sidebar .wms-warehouse-switcher-select {
    min-width: 0;
}

.wms-admin-warehouse-bar:empty {
    display: none;
}

.wms-admin-warehouse-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 12px 24px 0;
    margin-bottom: 4px;
}
