/**
 * 소팅 작업 페이지 전용 스타일
 */

/* 통계 드로어 — 항상 고정 표시 (스와이프/접기 비활성화) */
.stats-drawer {
    margin-bottom: 24px;
}
.stats-handle {
    display: none !important;
}
.stats-drawer.collapsed {
    max-height: none !important;
}
.stats-drawer.collapsed .stats-row {
    opacity: 1 !important;
    pointer-events: auto !important;
}
@media (max-width: 768px) {
    .stats-drawer {
        margin-bottom: 16px;
    }
    .stats-drawer .stats-row {
        margin-bottom: 0;
    }
}

/* 플토 통계 카드 (운송장출력/소팅완료/출고보류) */
.playauto-stats-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.play-stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #cbd5e0;
    border-radius: 8px;
    padding: 14px 16px;
    text-align: center;
    transition: all 0.15s ease;
}
.play-stat-card.play-invoice-printed { border-left-color: #3182ce; }.play-stat-card.play-invoice-printed{ border-left-color: #FFC21A; }
.play-stat-card.play-sorting-done    { border-left-color: #38a169; }
.play-stat-card.play-hold            { border-left-color: #dd6b20; }
.play-stat-card.play-hold:hover      { background: #fffaf0; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.play-stat-label { font-size: 13px; color: #718096; font-weight: 500; }
.play-stat-value { font-size: 24px; font-weight: 700; color: #2d3748; margin: 4px 0 2px; }
.play-stat-value:empty:before, .play-stat-value:contains("-") { color: #cbd5e0; }
.play-stat-sub { font-size: 11px; color: #a0aec0; }
@media (max-width: 600px) {
    .playauto-stats-section { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .play-stat-card { padding: 10px 8px; }
    .play-stat-label { font-size: 11px; }
    .play-stat-value { font-size: 18px; }
    .play-stat-sub { display: none; }
}

/* 탭 스타일 */
.tab-container { margin-bottom: 24px; }
.tab-buttons { display: flex; gap: 0; border-bottom: 2px solid #e2e8f0; }
.tab-btn {
    flex: 1;
    padding: 16px 20px;
    background: #f7fafc;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 15px;
    font-weight: 600;
    color: #718096;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.tab-btn:hover { background: #edf2f7; color: #4a5568; }.tab-btn:hover{ background: #FFF4D1; color: #4a5568; }
.tab-btn.active {
    background: #fff;
    color: #3182ce;
    border-bottom-color: #3182ce;
}.tab-btn.active{
    background: #fff;
    color: #946200;
    border-bottom-color: #FFC21A;
}
.tab-btn .tab-icon { font-size: 18px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* 스캔 스텝 */
.scan-steps { display: grid; grid-template-columns: 1fr 40px 1fr 40px 1fr; gap: 12px; align-items: start; }
.scan-step { text-align: center; }
.step-number {
    width: 32px; height: 32px;
    background: #e2e8f0;
    color: #4a5568;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 12px;
}
.step-number.active { background: #3182ce; color: #fff; }.step-number.active{ background: #FFC21A; color:#2B1D00; }
.step-number.done { background: #38a169; color: #fff; }
.step-label { font-size: 14px; font-weight: 600; color: #2d3748; margin-bottom: 12px; }
.step-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    text-align: center;
    font-family: 'Courier New', monospace;
}
.step-input:focus { border-color: #3182ce; outline: none; }.step-input:focus{ border-color: #FFC21A; outline: none; }
.step-input:disabled { background: #f7fafc; color: #a0aec0; }
.step-info {
    margin-top: 10px;
    font-size: 13px;
    color: #718096;
    min-height: 40px;
}
.step-info.success { color: #38a169; font-weight: 600; }
.step-info.error { color: #e53e3e; }
.step-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #cbd5e0;
    padding-top: 50px;
}

/* 결과 섹션 - sorting 전용 */
.result-section {
    display: none;
    background: #f0fff4;
    border: 2px solid #38a169;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 24px;
}
.result-section.show { display: block; }
.result-section.error { background: #fff5f5; border-color: #e53e3e; }

.result-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.result-icon { font-size: 32px; }
.result-message { font-size: 18px; font-weight: 600; color: #22543d; }
.result-section.error .result-message { color: #c53030; }

/* 주문 정보 그리드 */
.order-info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.order-info-item { background: #fff; padding: 12px; border-radius: 4px; border: 1px solid #c6f6d5; }
.order-info-label { font-size: 11px; color: #718096; margin-bottom: 4px; text-transform: uppercase; font-weight: 600; }
.order-info-value { font-size: 15px; font-weight: 600; color: #2d3748; }
.order-info-item.full-width { grid-column: span 2; }

/* 아이템 리스트 */
.items-list { background: #fff; border: 1px solid #c6f6d5; border-radius: 4px; overflow: hidden; }
.items-title { padding: 12px 16px; background: #f0fff4; font-size: 13px; font-weight: 600; color: #22543d; border-bottom: 1px solid #c6f6d5; }

/* 미연결 섹션 */
.unlinked-section { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }

/* 모바일 단일 스텝 UI */
.scan-step-mobile {
    display: none;
    text-align: center;
}
.mobile-step-progress {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}
.mobile-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e2e8f0;
}
.mobile-step-dot.active { background: #3182ce; }.mobile-step-dot.active{ background: #FFC21A; ;color:#2B1D00}
.mobile-step-dot.done { background: #38a169; }
.mobile-step-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}
.mobile-step-number {
    width: 40px; height: 40px;
    background: #3182ce;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}.mobile-step-number{
    width: 40px; height: 40px;
    background: #FFC21A;
    color:#2B1D00;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}
.mobile-step-number.done { background: #38a169; }
.mobile-step-label {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
}
.mobile-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 12px;
}
.mobile-step-input {
    flex: 1;
    min-width: 0;
    padding: 14px 12px;
    font-size: 16px;
    border: 2px solid #3182ce;
    border-radius: 8px;
    text-align: center;
    font-family: 'Courier New', monospace;
    margin-bottom: 0;
}.mobile-step-input{
    flex: 1;
    min-width: 0;
    padding: 14px 12px;
    font-size: 16px;
    border: 2px solid #FFC21A;
    border-radius: 8px;
    text-align: center;
    font-family: 'Courier New', monospace;
    margin-bottom: 0;
}
.mobile-step-input:focus { outline: none; border-color: #2c5282; }.mobile-step-input:focus{ outline: none; border-color: #FFC21A; }
/* Undo 버튼 (완료 카드 내) */
.undo-btn {
    width: 50px;
    height: 50px;
    border: none;
    background: #e53e3e;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
}
.undo-btn.show {
    display: flex;
}
.undo-btn:hover {
    background: #c53030;
}
.undo-btn:active {
    transform: scale(0.95);
}
.undo-btn.completion-undo {
    margin-left: auto;
}
.mobile-step-info {
    font-size: 14px;
    color: #718096;
    min-height: 24px;
    margin-bottom: 16px;
}
.mobile-step-info.success { color: #38a169; font-weight: 600; }
.mobile-step-info.error { color: #e53e3e; }
.mobile-completed-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}
.mobile-completed-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    border-radius: 20px;
    font-size: 12px;
    color: #22543d;
}
.mobile-completed-badge .badge-icon { color: #38a169; }

/* 목록 모달 (모바일용) */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 100vh;
    height: 100dvh;  /* 모바일 브라우저 동적 툴바 반영 (미지원 시 위 100vh 사용) */
    background: rgba(0,0,0,0.5);
    z-index: 100000;  /* worker-back-bar(99999) 위 */
    align-items: flex-start;  /* 상단 정렬 (헤더 가림 방지) */
    justify-content: center;
    padding-top: 60px;  /* worker-back-bar(48px) + 12px 여유 → X 버튼 보임 */
    /* 하단: 스마트폰 네비게이션바/홈 인디케이터 안전영역만큼 더 띄움 */
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}
.modal-overlay.show { display: flex; }
/* 주문 상세 모달은 다른 모달 위에 떠야 함 (소팅완료 모달의 행 클릭 시) */
#orderDetailModal { z-index: 100010; }
.modal-content {
    background: #fff;
    width: 95%;
    max-width: 500px;
    /* 위 padding-top(60) + 아래 padding-bottom(20) + 하단 안전영역 */
    max-height: calc(100vh - 80px - env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 80px - env(safe-area-inset-bottom, 0px));
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: 16px 20px;
    background: #2d3748;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { font-size: 16px; font-weight: 600; margin: 0; }
.modal-close {
    background: none;
    border: none;
    color: #e2e8f0;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.modal-close:hover { color: #fff; }
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}
.modal-body .list-table { width: 100%; border-collapse: collapse; }
.modal-body .list-table th,
.modal-body .list-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
}
.modal-body .list-table th {
    background: #f7fafc;
    color: #4a5568;
    font-weight: 600;
    position: sticky;
    top: 0;
}
.modal-body .list-table tbody tr:hover { background: #f7fafc; }
.modal-body .empty-state {
    text-align: center;
    padding: 40px;
    color: #a0aec0;
}

/* 통합탭 step3 진입 후 수정 가능한 패널 (앵글/바구니/송장 클릭 → 교체) */
.tu-edit-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 10px;
}
.tu-edit-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.tu-edit-label {
    font-size: 11px;
    font-weight: 600;
    color: #718096;
    min-width: 55px;
    padding-top: 4px;
}
.tu-editable {
    cursor: pointer;
    transition: filter 0.15s, transform 0.05s;
}
.tu-editable:hover { filter: brightness(0.93); }
.tu-editable:active { transform: translateY(1px); }
.tu-edit-x {
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.7;
}
.tu-invoice-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    flex: 1;
    min-width: 0;
}
.tu-invoice-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    background: #ebf4ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'SF Mono','Menlo','Consolas',monospace;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
}.tu-invoice-chip{
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    background: #FFF4D1;
    color: #946200;
    border: 1px solid #FFD24D;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'SF Mono','Menlo','Consolas',monospace;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
}
.tu-invoice-chip:hover { background: #dbeafe; }.tu-invoice-chip:hover{ background: #FFF4D1; }
.tu-invoice-chip:active { transform: translateY(1px); }

/* 주문 상세 모달 — 카드 레이아웃 */
.order-detail-wrap {
    padding: 14px 16px 16px;
}
.order-detail-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 14px;
}
.order-detail-row {
    display: flex;
    gap: 10px;
    align-items: baseline;
    flex-wrap: wrap;
    min-width: 0;
}
.order-detail-label {
    font-size: 11px;
    font-weight: 600;
    color: #718096;
    min-width: 52px;
}
.order-detail-invoice {
    font-family: 'SF Mono','Menlo','Consolas',monospace;
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    word-break: break-all;
    flex: 1;
    min-width: 0;
}
.order-detail-value {
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}
.order-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.order-item-card {
    border: 1px solid #e2e8f0;
    border-left: 3px solid #4299e1;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
}.order-item-card{
    border: 1px solid #e2e8f0;
    border-left: 3px solid #FFC21A;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
}
.order-item-main {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}
.order-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a202c;
    word-break: break-word;
    flex: 1;
    min-width: 0;
    line-height: 1.35;
}
.order-item-qty {
    font-size: 14px;
    font-weight: 700;
    color: #2563eb;
    flex-shrink: 0;
    background: #ebf4ff;
    padding: 2px 8px;
    border-radius: 6px;
}.order-item-qty{
    font-size: 14px;
    font-weight: 700;
    color: #946200;
    flex-shrink: 0;
    background: #FFF4D1;
    padding: 2px 8px;
    border-radius: 6px;
}
.order-item-size {
    margin-top: 6px;
    font-size: 12px;
    color: #64748b;
    word-break: break-word;
    line-height: 1.4;
    padding: 4px 8px;
    background: #f8fafc;
    border-radius: 4px;
}
@media (max-width: 480px) {
    .order-detail-wrap { padding: 12px; }
    .order-item-card { padding: 9px 10px; }
    .order-item-name { font-size: 13px; }
    .order-item-size { font-size: 11px; }
}

/* 모달 푸터 */
.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    background: #f7fafc;
}
.btn-block {
    display: block;
    width: 100%;
}
.btn-danger {
    background: #e53e3e;
    color: #fff;
    border: none;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn-danger:hover {
    background: #c53030;
}

/* 주문 목록 해제 버튼 */
.unlink-btn {
    background: #fc8181;
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}
.unlink-btn:hover {
    background: #f56565;
}

/* 데스크탑 주문 배지 */
.desktop-order-badge {
    margin-top: 16px;
    padding: 12px 16px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

/* 앵글 그리드 (모달용) */
.slot-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
}
.slot-grid .badge-slot {
    padding: 8px 12px;
    font-size: 13px;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .stats-row { grid-template-columns: repeat(3, 1fr); }
    .scan-steps { display: none; }
    .scan-step-mobile { display: block; }
    .unlinked-section { display: none; }
    .desktop-order-badge { display: none !important; }
    .order-info-grid { grid-template-columns: 1fr; }
    .order-info-item.full-width { grid-column: span 1; }
    .modal-body .list-table th,
    .modal-body .list-table td { padding: 15px 8px; }
}

/* 통합 탭 건너뛰기 버튼 */
.tu-skip-btn {
    margin-top: 8px;
    padding: 8px 16px;
    background: #edf2f7;
    color: #4a5568;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}.tu-skip-btn{
    margin-top: 8px;
    padding: 8px 16px;
    background: #FFF4D1;
    color: #4a5568;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.tu-skip-btn:hover { background: #e2e8f0; color: #2d3748; }
.tu-skip-btn-mobile {
    width: 100%;
    padding: 12px 16px;
    background: #edf2f7;
    color: #4a5568;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
}.tu-skip-btn-mobile{
    width: 100%;
    padding: 12px 16px;
    background: #FFF4D1;
    color: #4a5568;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
}

/* 운송장출력 팝업 — 선택된 행 강조 */
.assign-row.inv-row-sel td { background: #ebf8ff; }.assign-row.inv-row-sel td{ background: #FFF4D1; }
.assign-row.inv-row-sel { font-weight: 600; }
