/* 모바일 전용 – 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;
    }
    /* 위 글자 키움(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;
}
.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;
}