/* ── Generic mobile/touch polish ─────────────────────────────── */
@media (max-width: 1023.98px) {
    .col-md-9,
    .col-md-3 {
        margin-bottom: 2rem;
    }

    #search-orders {
        width: 100%;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .card-header > div:first-child,
    .card-header > div:last-child {
        width: 100%;
    }

    .card-header .form-group {
        width: 100%;
        margin-top: 10px;
    }

    .date-filter {
        margin-bottom: 0.25rem;
        font-size: 0.75rem;
    }

    .date-filter .bi {
        margin-right: 0.25rem;
    }

    .btn-group {
        flex-wrap: wrap;
    }

    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    .card {
        margin-bottom: 1rem;
        border-radius: 1rem;
    }

    .card-header {
        padding: 0.75rem;
        font-size: 0.95rem;
    }

    .form-control {
        font-size: 16px;
        padding: 0.75rem;
        border-radius: 0.85rem;
        touch-action: manipulation;
    }

    #search-orders-mobile,
    #search-warehouse-mobile {
        min-height: 46px;
        border: 1.5px solid #e2e8f0;
        background: #fff;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
    }

    #orderModal #customer-phone,
    #orderModal #customer-name,
    #orderModal #customer-address {
        font-size: 16px;
        padding: 0.65rem 0.8rem;
        min-height: 48px;
        border-radius: 10px;
        border: 1.5px solid #e2e8f0;
        transition: all 0.3s ease;
    }

    #orderModal #customer-phone:focus,
    #orderModal #customer-name:focus,
    #orderModal #customer-address:focus {
        border-color: #7c3aed;
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
        transform: none;
    }

    .btn {
        min-height: 44px;
        font-size: 16px;
        border-radius: 0.5rem;
        touch-action: manipulation;
    }

    .btn-sm {
        min-height: 36px;
        font-size: 14px;
        padding: 0.5rem 0.75rem;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    .table {
        font-size: 0.8rem;
    }

    .table td,
    .table th {
        padding: 0.5rem;
        white-space: nowrap;
    }

    .modal-content {
        border-radius: 0.5rem;
        margin: 10px;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    #search-orders {
        border-radius: 0.5rem;
        padding: 0.75rem 1rem;
        font-size: 16px;
    }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
    .container-fluid {
        padding-left: 20px;
        padding-right: 20px;
    }

    #orderModal #customer-phone,
    #orderModal #customer-name,
    #orderModal #customer-address {
        font-size: 18px;
        padding: 0.65rem 0.8rem;
        min-height: 52px;
    }

    .btn {
        font-size: 16px;
        padding: 0.75rem 1.5rem;
    }

    .card-view-item {
        padding: 20px;
    }

    .card-view-item .order-details-table td {
        padding: 0.5rem;
        font-size: 1rem;
    }
}

@media (hover: none) and (pointer: coarse) {
    .btn,
    .form-control,
    .table td a {
        touch-action: manipulation;
    }

    .btn:hover {
        transform: none;
    }

    .customer-autofill-success {
        border-width: 3px !important;
    }

    .customer-autofill-not-found {
        border-width: 3px !important;
    }

    .btn:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

@media (max-width: 1023.98px) and (orientation: landscape) {
    .modal-dialog {
        max-height: 80vh;
        overflow-y: auto;
    }

    .card-header {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn,
    .form-control {
        border-width: 1px;
    }
}

@media (max-width: 576px) {
    header .container-fluid .row {
        flex-direction: column;
    }

    header h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem !important;
    }

    header .d-flex {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    header .btn {
        width: 100% !important;
        justify-content: center;
        min-height: 38px;
    }

    header .d-none.d-sm-inline {
        display: inline !important;
    }

    .hdr-search-wrap {
        display: none;
    }

    .stat-bar {
        padding: 0 0.5rem;
        min-height: 80px;
    }

    .stat-bar-item {
        padding: 8px 10px;
        flex-shrink: 0;
    }

    .stat-bar-value {
        font-size: 1.05rem;
    }

    .stat-bar-icon {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }

    .stat-bar-label {
        display: none;
    }

    .stat-sparkline-wrap {
        min-width: 50px;
    }
}

@media (min-width: 577px) and (max-width: 767px) {
    header .d-flex {
        flex-direction: row !important;
        justify-content: center;
    }

    header .btn {
        flex: 1;
        max-width: 150px;
    }
}
