.postex-mobile-toolbar,
.postex-mobile-menu-overlay,
.postex-mobile-menu-close {
    display: none;
}

@media (max-width: 782px) {
    html.postex-mobile-menu-open,
    html.postex-mobile-menu-open body {
        overflow: hidden;
    }

    .postex-wrapper {
        box-sizing: border-box;
        max-width: 100%;
        margin: 16px 10px 24px;
        border-radius: 16px;
    }

    .postex-head img {
        min-height: 96px;
        max-height: 110px;
        border-radius: 16px;
    }

    .postex-mobile-toolbar {
        position: sticky;
        z-index: 100;
        top: 46px;
        display: flex;
        box-sizing: border-box;
        min-height: 48px;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin: 0 0 10px;
        padding: 8px 10px;
        border: 1px solid #e9e9e9;
        border-radius: 12px;
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 3px 12px rgb(15 23 42 / 8%);
    }

    .postex-mobile-toolbar strong {
        order: 1;
        min-width: 0;
        margin-left: auto;
        overflow: hidden;
        color: #484848;
        font-size: 13px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .postex-mobile-menu-toggle {
        order: 2;
        display: inline-flex;
        min-height: 32px;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 5px 10px;
        border: 1px solid #f0b08f;
        border-radius: 8px;
        background: #fff7f2;
        color: #b83a00;
        cursor: pointer;
        font-family: inherit;
        font-size: 12px;
    }

    .postex-mobile-menu-toggle:focus-visible {
        outline: 2px solid #fe5000;
        outline-offset: 2px;
    }

    .postex-mobile-menu-icon {
        display: inline-flex;
        width: 15px;
        flex-direction: column;
        gap: 3px;
    }

    .postex-mobile-menu-icon span {
        display: block;
        width: 100%;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
    }

    .postex-body {
        display: block;
        min-width: 0;
    }

    .postex-sidebar {
        position: fixed;
        z-index: 100002;
        top: 46px;
        right: 0;
        bottom: 0;
        box-sizing: border-box;
        width: min(82vw, 280px);
        min-width: 0;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 18px;
        border-radius: 16px 0 0 16px;
        box-shadow: -12px 0 35px rgb(15 23 42 / 18%);
        transform: translateX(110%);
        transition: transform .22s ease;
    }

    .postex-sidebar.is-open {
        transform: translateX(0);
    }

    .postex-sidebar-header {
        display: flex;
        min-height: 32px;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 6px;
    }

    .postex-sidebar-header .postex-menu-title {
        margin: 0;
    }

    .postex-mobile-menu-close {
        display: inline-flex;
        width: 30px;
        height: 30px;
        align-items: center;
        justify-content: center;
        padding: 0;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        background: #f8fafc;
        color: #475569;
        cursor: pointer;
        font-family: Arial, sans-serif;
        font-size: 22px;
        line-height: 1;
    }

    .postex-mobile-menu-close:focus-visible {
        outline: 2px solid #fe5000;
        outline-offset: 2px;
    }

    .postex-mobile-menu-overlay {
        position: fixed;
        z-index: 100001;
        top: 46px;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
        margin: 0;
        padding: 0;
        border: 0;
        background: rgb(15 23 42 / 34%);
        cursor: pointer;
        opacity: 0;
        visibility: hidden;
        transition: opacity .2s ease, visibility .2s ease;
    }

    .postex-mobile-menu-overlay.is-visible {
        display: block;
        opacity: 1;
        visibility: visible;
    }

    .postex-content {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        padding: 12px;
        border-radius: 12px;
    }

    .postex-content img,
    .postex-content iframe,
    .postex-content video {
        max-width: 100%;
    }

    .general-form,
    .postex-form,
    .form-sec-content,
    .postex-meta-box-section,
    .postex-wizard,
    .postex-wizard-content {
        min-width: 0;
        max-width: 100%;
    }

    .form-sec-content {
        box-sizing: border-box;
        padding: 12px;
    }

    section .form-half,
    .general-form .form-half,
    .postex-wizard-content .form-half {
        flex-direction: column;
        gap: 12px;
    }

    section .form-half fieldset,
    .general-form fieldset,
    .postex-wizard-content .form-half fieldset,
    .label-input {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
    }

    .general-form input:not([type="checkbox"]):not([type="radio"]),
    .general-form select,
    .general-form textarea,
    .postex-form input:not([type="checkbox"]):not([type="radio"]),
    .postex-form select,
    .postex-form textarea {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .api-key-wrapper {
        flex-wrap: wrap;
        align-items: stretch;
    }

    .postex-wizard .api-key-wrapper {
        flex-direction: column;
    }

    .postex-wizard .api-key-wrapper > .current-api-key,
    .postex-wizard .api-key-wrapper > .api-key-status {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: 1 1 auto;
    }

    .postex-wizard .api-key-phone,
    .postex-wizard .api-key-phone > div,
    .postex-wizard .api-key-otp,
    .postex-wizard .api-key-otp > div {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
    }

    .api-key-wrapper #postex_api_key {
        flex-basis: 100%;
    }

    .api-key-wrapper .submit,
    .api-key-wrapper .submit #submit {
        width: 100%;
    }

    .default-values,
    .postex-excel-default-values,
    .postex-excel-upload-actions,
    .postex-excel-summary {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .postex-excel-default-values .label-input {
        min-width: 0;
    }

    .postex-excel-upload-actions #postex-excel-upload-button,
    #postex-excel-send,
    .postex-excel-report-download {
        box-sizing: border-box;
        width: 100%;
        text-align: center;
    }

    .postex-excel-intro,
    .postex-excel-upload,
    #postex-excel-workflow {
        box-sizing: border-box;
        max-width: 100%;
        padding: 12px;
    }

    .postex-bulk-card-header {
        position: relative;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 10px;
        padding-left: 52px;
    }

    .postex-bulk-card-order-meta {
        width: 100%;
        min-width: 0;
        flex-wrap: wrap;
    }

    .postex-bulk-card-header-actions {
        display: contents;
    }

    .postex-bulk-card-header-actions .response-td:not(:empty) {
        width: 100%;
        flex: 1 1 100%;
        order: 3;
    }

    .postex-bulk-card-toggle {
        position: absolute;
        top: 50%;
        left: 12px;
        margin: 0;
        transform: translateY(-50%);
    }

    .bulk-actions,
    .postex-bulk-label-actions,
    .postex-wizard-actions {
        flex-wrap: wrap;
        gap: 10px;
    }

    .bulk-actions > *,
    .postex-bulk-label-actions > *,
    .postex-wizard-actions > * {
        box-sizing: border-box;
        min-width: 0;
        flex: 1 1 140px;
    }

    .postex-bulk-label-actions #postex-bulk-label-summary {
        flex: 1 1 125px;
    }

    .postex-bulk-label-actions #postex-bulk-labels {
        flex: 1.35 1 175px;
        font-size: 12px;
        white-space: nowrap;
    }

    .parcel-product-row {
        flex-wrap: wrap;
    }

    .parcel-product-row > input,
    .parcel-product-row > .input-wrapper,
    .parcel-product-row .remove-product {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
    }

    #postexModal.active {
        box-sizing: border-box;
        overflow-y: auto;
        align-items: flex-start;
        padding: 16px;
    }

    #postexModal .modal-body {
        box-sizing: border-box;
        width: min(100%, 800px);
        max-width: 100%;
        max-height: calc(100dvh - 32px);
        overflow-y: auto;
    }

    .postex-responsive-table,
    .tracking-table,
    .postex-orders-items {
        display: block;
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .postex-responsive-table {
        position: relative;
        border: 1px solid #edf0f4;
        border-radius: 10px;
        background: #fff;
        scrollbar-width: thin;
    }

    .postex-responsive-table:focus-visible {
        outline: 2px solid #fe5000;
        outline-offset: 2px;
    }

    .postex-fast-orders-table .all-orders {
        width: 680px;
        min-width: 680px;
        table-layout: auto;
    }

    .postex-fast-orders-table .postex-see-details {
        width: auto;
        min-width: 150px;
        padding: 7px 12px;
        white-space: nowrap;
    }

    .postex-excel-orders-table .postex-excel-orders {
        width: 760px;
        min-width: 760px;
        table-layout: auto;
    }

    .postex-fast-orders-table .all-orders th,
    .postex-fast-orders-table .all-orders td,
    .postex-excel-orders-table .all-orders th,
    .postex-excel-orders-table .all-orders td {
        white-space: nowrap;
    }

    .postex-fast-orders-table,
    .postex-excel-orders-table {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .postex-fast-orders-table .all-orders,
    .postex-excel-orders-table .postex-excel-orders {
        display: block;
        width: 100%;
        min-width: 0;
        border: 0;
        background: transparent;
    }

    .postex-fast-orders-table thead,
    .postex-excel-orders-table thead {
        display: none;
    }

    .postex-fast-orders-table tbody,
    .postex-excel-orders-table tbody {
        display: grid;
        gap: 12px;
        width: 100%;
    }

    .postex-fast-orders-table tr,
    .postex-excel-orders-table tr {
        box-sizing: border-box;
        width: 100%;
        overflow: hidden;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 2px 8px rgb(15 23 42 / 5%);
    }

    .postex-fast-orders-table tr {
        display: flex;
        flex-direction: column;
    }

    .postex-fast-orders-table td {
        display: grid;
        box-sizing: border-box;
        width: 100%;
        grid-template-columns: 88px minmax(0, 1fr);
        align-items: start;
        gap: 10px;
        padding: 10px 12px;
        border: 0;
        border-bottom: 1px solid #f1f5f9;
        line-height: 1.8;
        white-space: normal;
    }

    .postex-fast-orders-table td::before,
    .postex-excel-orders-table td::before {
        content: attr(data-label);
        color: #64748b;
        font-size: 11px;
        font-weight: 600;
    }

    .postex-fast-orders-table td[data-field="reference"] {
        border-bottom-color: #e2e8f0;
        background: #f8fafc;
        font-weight: 700;
    }

    .postex-fast-orders-table td[data-field="items"] p {
        white-space: normal;
    }

    .postex-fast-orders-table td[data-field="action"] {
        display: block;
        border-bottom: 0;
    }

    .postex-fast-orders-table td[data-field="action"]::before {
        display: none;
    }

    .postex-fast-orders-table .postex-see-details {
        width: 100%;
        min-width: 0;
        min-height: 36px;
        padding: 7px 12px;
        white-space: nowrap;
    }

    .postex-excel-orders-table tr {
        position: relative;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .postex-excel-orders-table td {
        display: flex;
        box-sizing: border-box;
        min-width: 0 !important;
        flex-direction: column;
        gap: 5px;
        padding: 10px 12px;
        border: 0;
        border-bottom: 1px solid #f1f5f9;
        color: #334155;
        line-height: 1.7;
        white-space: normal;
    }

    .postex-excel-orders-table td[data-field="selection"] {
        position: absolute;
        z-index: 2;
        top: 9px;
        left: 10px;
        display: flex;
        width: 32px;
        height: 32px;
        align-items: center;
        justify-content: center;
        padding: 0;
        border: 0;
    }

    .postex-excel-orders-table td[data-field="selection"]::before {
        display: none;
    }

    .postex-excel-orders-table td[data-field="reference"] {
        order: 1;
        grid-column: 1 / -1;
        min-height: 50px;
        padding-left: 54px;
        flex-direction: row;
        align-items: center;
        border-bottom-color: #e2e8f0;
        background: #f8fafc;
        font-size: 13px;
        font-weight: 700;
    }

    .postex-excel-orders-table td[data-field="result"] {
        order: 2;
        grid-column: 1 / -1;
        margin: 10px;
        padding: 10px 12px;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        background: #f8fafc;
    }

    .postex-excel-orders-table td[data-field="result"].result-success {
        border-color: #b7e4c7;
        background: #ecfdf3;
        color: #167a3e;
    }

    .postex-excel-orders-table td[data-field="result"].result-error {
        border-color: #fecaca;
        background: #fff1f2;
        color: #b42318;
    }

    .postex-excel-orders-table td[data-field="recipient"] {
        order: 3;
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .postex-excel-orders-table td[data-field="items"] {
        order: 4;
    }

    .postex-excel-orders-table td[data-field="value"] {
        order: 5;
    }

    .postex-excel-orders-table td[data-field="weight"] {
        order: 6;
    }

    .postex-excel-orders-table .response-td .success-barcode,
    .postex-excel-orders-table .response-td .request-label span {
        margin-right: 0;
        margin-left: 0;
    }

    .postex-bulk-label-actions #postex-excel-bulk-labels {
        font-size: 12px;
        white-space: nowrap;
    }

    .tracking-table th,
    .tracking-table td,
    .postex-orders-items th,
    .postex-orders-items td {
        white-space: nowrap;
    }

    .postex-wizard-steps {
        justify-content: flex-start;
        gap: 0;
        overflow-x: auto;
        padding-bottom: 8px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .postex-wizard-steps li {
        min-width: 86px;
        flex: 0 0 86px;
        scroll-snap-align: start;
    }

    .current-api-key,
    .current-api-key > form,
    .current-api-key .current-key {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .current-api-key .current-key {
        overflow-wrap: anywhere;
    }

    .wizard-notice,
    .postex-methods {
        flex-direction: column;
    }

    .postex-fixed-rate-zone-list,
    .postex-fixed-rate-zone-fields {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 480px) {
    .postex-wrapper {
        margin-right: 6px;
        margin-left: 6px;
    }

    .postex-content {
        padding: 9px;
    }

    .form-sec-content,
    .postex-excel-intro,
    .postex-excel-upload,
    #postex-excel-workflow {
        padding: 10px;
    }

    .postex-bulk-card-fields,
    .postex-bulk-card-parcel-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .postex-bulk-card-parcel-fields .postex-bulk-card-field--address {
        grid-column: auto;
    }
}

@media (max-width: 360px) {
    .postex-bulk-label-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .postex-bulk-label-actions #postex-bulk-label-summary,
    .postex-bulk-label-actions #postex-bulk-labels {
        width: 100%;
        flex: 0 0 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .postex-sidebar,
    .postex-mobile-menu-overlay {
        transition: none;
    }
}
