/* 모바일 전용 – PC 검색 영역에 간섭하지 않도록 미디어 쿼리로 격리 */
@media (max-width: 767px) {
    input[type="text"], input[type="search"], textarea {
        font-size: 20px;
    }
    .large-font {
        font-size: 20px !important;
    }

    /* 모바일 페이지 공통 터치 최적화 (min 44px = Apple HIG 터치 타겟) */
    .form-select,
    .form-control,
    input[type="search"],
    input[type="date"] {
        min-height: 44px;
        font-size: 1.05rem;
    }
    .search-clear-btn {
        min-height: 44px;
        font-size: 1rem;
    }
    #filterUL .nav-link {
        font-size: 1.05rem;
        padding: 0.5rem 0.75rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    .flatpickr-input-container .form-control {
        min-height: 44px;
    }
    /* 검색 줄의 날짜 칸 — 맨 위 규칙(input[type="text"] 20px)을 받으면 날짜(2026-11-07)·기간(2026-10-07 ~ 2026-11-07)이 칸(160·260px)보다
       길어 끝이 잘렸다. 16px 이면 들어가고(기간도 실제 날짜는 전부) iOS 가 확대하지도 않는다. 검색 줄([id$="SearchId"])만 —
       모달 폼의 칸은 아래 규칙이 한 크기로 맞춘다. 치과 화면에는 이 칸이 없다 */
    [id$="SearchId"] .flatpickr-input-container .datetimepicker {
        font-size: 16px;
    }
    /* 모달 폼의 칸은 한 글자 크기(1.05rem) — 맨 위 규칙(input[type="text"] 20px)이 .form-control(1.05rem)보다 구체적이라 글 칸·날짜 칸만 20px 이고
       바로 옆 고르기·주문사항(textarea)은 16.8px 이었다(w505 신규접수 등, 2026-11-07 D115). 떠 있는 라벨 고르기(48px)에는 20px 가 들어가지 않으므로
       작은 쪽으로 맞춘다. 글자를 일부러 키운 칸(.large-font, !important)은 그대로다 */
    .modal input[type="text"].form-control {
        font-size: 1.05rem;
    }
    /* 검색 줄의 날짜 칸(떠 있는 라벨 · custom-height) — user.css 의 .custom-height(PC 에서 옆 단추 묶음과 맞춘 38px, !important)가
       위의 터치 높이(44px)를 눌러, 폰에서 이 칸만 38px 이었다(기간 칸·고르기·검색칸은 44px). 둘 다 !important 라 더 구체적인 이 규칙이 이겨 44px 로 되돌린다.
       떠 있는 라벨이 없는 칸(f640·f650 필터 — 그 화면이 모든 칸을 38px 로 맞춘다)은 건드리지 않는다 */
    [id$="SearchId"] .flatpickr-input-container .form-floating > .custom-height {
        height: 44px !important;
        min-height: 44px !important;
    }
    /* 검색 줄의 오른쪽 끝을 한 줄로 — 고르기·검색칸은 줄 끝(카드 안쪽)까지 차는데, 날짜 칸은 인라인 너비(160·260·140px)에서,
       빠른 선택 단추 묶음은 글자 너비에서 끝나 오른쪽 끝이 들쭉날쭉했다(f502: 고르기 347, 단추 291, 날짜 197).
       인라인 너비를 준 날짜 칸만 줄 너비로 펴고, 빠른 선택 단추는 같은 몫으로 나눠 줄 끝까지 채운다.
       치과·기공소 화면의 날짜 칸은 이미 줄 너비(w-100)라 해당 없다. 높이(단추 38 / 칸 44)는 그대로 둔다 */
    :is([id$="SearchId"], [id$="SearchId2"], .eds-search-params) .flatpickr-input-container[style*="width"] {
        width: 100% !important;
    }
    :is([id$="SearchId"], [id$="SearchId2"], .eds-search-params) .btn-group[aria-label$="빠른 선택"] {
        display: flex;
        width: 100%;
    }
    :is([id$="SearchId"], [id$="SearchId2"], .eds-search-params) .btn-group[aria-label$="빠른 선택"] > .btn {
        flex: 1 1 0;
        min-width: 0;
        justify-content: center;   /* user.css 가 이 단추를 inline-flex 로 그린다 — 넓어진 단추 안에서 글자를 가운데로 */
    }
    /* 인라인 너비(130·150px)를 준 고르기 상자가 한 줄에 나란히 있으면(f155 구역 그룹·구분) 그 줄을 나눠 채운다 */
    :is([id$="SearchId"], [id$="SearchId2"], .eds-search-params) .d-flex > .search-box[style*="width"]:has(> select) {
        flex: 1 1 0 !important;
        width: auto !important;
        min-width: 0;
    }
    /* 위 글자 키움(1.05rem) 때문에 떠 있는 라벨 select(높이 48px 고정)의 글자 아래가 잘렸다 —
       안쪽 위·아래 여백을 줄여 한 줄(줄높이 21px)이 들어가게 한다. 라벨 자리는 그대로 */
    .form-floating > .form-select {
        padding-top: 1.3rem;
        padding-bottom: .2rem;
    }
}

/* W525 Responsive Card Layout for Mobile */
@media (max-width: 767px) {
    .w525-table-container {
        border: none !important;
        background: transparent !important;
    }
    
    .w525-table thead {
        display: none;
    }
    
    .w525-checkbox {
        display: none !important;
    }
    
    .w525-number {
        display: none !important;
    }
    
    .w525-table tbody {
        display: block;
    }
    
    .w525-card {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--phoenix-border-color);
        border-radius: 0.5rem;
        background: var(--phoenix-body-bg) !important;
        padding: 1rem;
        --phoenix-table-striped-bg: transparent !important;
    }
    
    .w525-card td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none !important;
        background-color: transparent !important;
    }
    
    .w525-card td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        font-size: 0.875rem;
        min-width: 80px;
    }
    
    .w525-checkbox {
        justify-content: flex-end !important;
    }
    
    .w525-checkbox:before {
        content: none !important;
    }
    
    .w525-name {
        font-weight: 600;
        font-size: 1.1rem !important;
        color: var(--phoenix-body-color) !important;
    }
}

/* W520 성능 최적화 - INP 개선 */
#tableStats tbody tr {
    contain: layout style;
}

#tableStats tbody td {
    contain: layout;
}

#tableStats tbody td table {
    contain: strict;
    content-visibility: auto;
}

/* W520 정렬 수정 - 중첩 테이블 padding 제거 */
#tableStats thead th table,
#tableStats tbody td table {
    padding: 0 !important;
    margin: 0 !important;
}

#tableStats thead th table th,
#tableStats thead th table td,
#tableStats tbody td table th,
#tableStats tbody td table td {
    padding: 0 !important;
    width: 39px !important;
    text-align: center !important;
}

#tableStats tbody td table td span {
    display: block;
    width: 100%;
    text-align: center !important;
}

/* W520 table-sm 패딩 id 우선순위 보강 */
#tableStats.table-sm > :not(caption) > * > *,
#tableStats thead th table.table-sm > :not(caption) > * > * {
    padding: 0.25rem !important;
}

/* W520 table-sm 본문 패딩 제거 (데이터 정렬) */
#tableStats.table-sm > tbody > tr > th,
#tableStats.table-sm > tbody > tr > td {
    padding: 0.25rem !important;
}

#tableStats tbody td table.table-sm > tbody > tr > th,
#tableStats tbody td table.table-sm > tbody > tr > td {
    padding: 0.25rem !important;
}

/* W520: user.css 첫/마지막 셀 패딩 덮어쓰기 (정렬 통일) */
#tableStats > tbody > tr > td:first-child {
    padding-left: 0.25rem !important;
}

#tableStats > tbody > tr > td:last-child,
#tableStats thead > tr > th:last-child {
    padding-right: 0.25rem !important;
}

/* ── Segment Button (shadcn ToggleGroup 스타일) ── */
/* ── 갱신 버튼 (m410/m420) ── */
.btn-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--phoenix-border-color);
    background: var(--phoenix-body-bg);
    color: var(--phoenix-tertiary-color);
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    flex-shrink: 0;
}
.btn-refresh:hover {
    background: var(--phoenix-secondary-bg-subtle);
    color: var(--phoenix-body-color);
}
.btn-refresh:active {
    transform: scale(0.92);
}

.seg-group {
    flex: 1;
    display: flex;
    border: 1px solid var(--phoenix-border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--phoenix-body-bg);
}
.seg-btn {
    flex: 1;
    padding: 0.5rem 0.5rem;
    min-height: 44px;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--phoenix-tertiary-color);
    transition: all 0.15s ease;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
}
.seg-btn-active {
    background: var(--phoenix-primary);
    color: #fff;
    font-weight: 600;
}
.seg-btn + .seg-btn {
    border-left: 1px solid var(--phoenix-border-color);
}

/* ── Move Type Tabs (m410/m420 수거·배송 탭) ── */
.pm-tab-filter {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--phoenix-border-color);
    margin-bottom: 0.5rem;
}
.pm-tab-btn {
    flex: 1;
    min-height: 42px;
    padding: 0.5rem 0.5rem;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    background: transparent;
    color: var(--phoenix-tertiary-color);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    white-space: nowrap;
}
.pm-tab-btn:hover {
    background: var(--phoenix-secondary-bg-subtle);
}
.pm-tab-btn:active {
    transform: scale(0.97);
}
.pm-tab-btn.active {
    color: var(--phoenix-body-color);
    border-bottom-color: var(--phoenix-primary);
}
.pm-tab-btn.pickup-tab.active {
    color: #d93025;
    border-bottom-color: #d93025;
    background: rgba(217, 48, 37, 0.05);
}
.pm-tab-btn.delivery-tab.active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
    background: rgba(26, 115, 232, 0.05);
}
.pm-tab-count {
    font-weight: 400;
    opacity: 0.8;
}

/* ── PouchMove Card List (m520/m530 공유) ── */
.pm-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
}
/* 무한 스크롤 트리거(1px)는 다 쓴 뒤에도 페이지 사이에 남는다 — 그 자리만 카드 간격이 두 배(간격+1px+간격)였다.
   트리거 높이와 간격 하나만큼 당겨 페이지 경계도 다른 카드 사이와 같은 간격으로 */
.pm-card-list > .scroll-trigger {
    margin-top: calc(-0.5rem - 1px);
}
.pm-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    transition: all 0.15s ease;
}
.pm-card:active {
    transform: scale(0.98);
}
/* 배송 카드 - 파랑 계열 (확실한 구분) */
.pm-card.delivery-card {
    background: #e8f0fe;
    border: 2px solid #4285f4;
    border-left: 5px solid #1a73e8;
}
/* 수거 카드 - 빨강 계열 (확실한 구분) */
.pm-card.pickup-card {
    background: #fce8e6;
    border: 2px solid #ea4335;
    border-left: 5px solid #d93025;
}
/* 다크모드 */
@media (prefers-color-scheme: dark) {
    .pm-card.delivery-card {
        background: rgba(66, 133, 244, 0.15);
        border-color: #4285f4;
    }
    .pm-card.pickup-card {
        background: rgba(234, 67, 53, 0.15);
        border-color: #ea4335;
    }
}
.pm-card-badge {
    flex-shrink: 0;
    font-size: 0.875rem;
    font-weight: 800;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    min-width: 3rem;
    text-align: center;
}
.pm-card-badge.delivery {
    background: #1a73e8;
    color: #fff;
}
.pm-card-badge.pickup {
    background: #d93025;
    color: #fff;
}
.pm-card-body {
    flex: 1;
    min-width: 0;
}
.pm-card-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--phoenix-emphasis-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pm-card-sub {
    font-size: 0.875rem;
    color: var(--phoenix-secondary-color);
    margin-top: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pm-card-meta {
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--phoenix-tertiary-color);
    text-align: right;
}
.pm-empty {
    text-align: center;
    padding: 2rem;
    color: var(--phoenix-tertiary-color);
    font-size: 0.875rem;
}

/* ── M510 Course Card List (구역별물류조회) ── */
.m510-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
}
.m510-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--phoenix-border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--phoenix-body-bg);
    cursor: pointer;
    transition: all 0.15s ease;
}
.m510-card:active {
    transform: scale(0.98);
}
.m510-card-badge {
    flex-shrink: 0;
    font-size: 0.875rem;
    font-weight: 800;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    min-width: 3rem;
    text-align: center;
}
.m510-card-badge.driver {
    background: #1a73e8;
    color: #fff;
}
.m510-card-badge.senior {
    background: #e8710a;
    color: #fff;
}
.m510-card-body {
    flex: 1;
    min-width: 0;
}
.m510-card-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--phoenix-emphasis-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.m510-card-emp {
    font-size: 0.875rem;
    color: var(--phoenix-secondary-color);
    margin-top: 0.125rem;
}
.m510-card-counts {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.125rem;
    font-size: 0.875rem;
    font-weight: 600;
}