/*
 * RMA Plugin — Theme-Consistent Overrides
 * Plugin: wp-marketplace-product-rma
 *
 * Overrides the plugin's default styles to match the parent theme's
 * modern design tokens. Also neutralises the parent theme's
 * .mp-rma-floated-right background/margin that clashes with the layout.
 *
 * ── NamVendors brand palette (single source of truth: nv-brand.css) ──
 *   Brand Blue   #101f31  primary text · dark fills · active borders · focus
 *   Brand Yellow #efa524  accent / CTA (handled in nv-brand.css)
 *   Dark Grey    #666c7a  muted / secondary text (labels, table headers, meta)
 *   Light Grey   #d3d6dc  borders · hairlines · dividers
 *   Sale Red     #d92e2e  required asterisk · destructive (cancel) actions
 *   Surfaces             rgba(16,31,49,.04/.03) — faint brand-Blue tint instead
 *                        of neutral greys, so subtle backgrounds stay on-brand.
 *   Focus ring   rgba(16,31,49,.10)
 * Earlier off-palette Tailwind greys, hairline borders and a non-brand red
 * were remapped to the tokens above; list/detail tables use a white card with
 * a brand-tinted header.
 */

/* ─── Floated-right button reset ──────────────────────────────────── */
.wkfashion-content-area .entry-content .wkrma-flex .mp-rma-floated-right {
    margin-bottom: 0 !important;
    background-color: #101f31 !important;
}

/* ─── Action bar layout ───────────────────────────────────────────── */
.wkrma-flex {
    margin-bottom: 20px;
}

.wkrma-flex .wkmp-search.wkmp-searc-box,
.wkrma-flex .wkmp-search-button .wkrma-bulk-action,
#wkrma-apply-bulk,
.mp-rma-filter-rma-status,
#wkrma-res-apply-bulk {
    width: max-content !important;
}

/* ─── RMA Table ───────────────────────────────────────────────────── */
.mp-rma-table-wrap {
    margin-top: 20px;
}

/* Card-style table — Reason list (/my-account/rma-reason/) + seller
 * Manage-RMA list. Both render `.mp-rma-table.table.table-bordered.table-hover`.
 * The plugin's invoice.css paints #ddd cell borders via
 * `.table-bordered>thead>tr>th` (0,1,3); `.mp-rma-table.table-bordered …`
 * (0,2,x) out-specifies it, so the header/cell rules below win on specificity
 * alone — no !important. (Verified: no theme/WC rule targets .mp-rma-table.) */
.mp-rma-table {
    width: 100%;
    margin: 0;
    background-color: #ffffff;
    border: 1px solid #d3d6dc;
    border-radius: 8px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

/* Header row — faint brand-Blue tint surface, Blue uppercase labels */
.mp-rma-table.table-bordered thead th,
.mp-rma-table.table-bordered thead td {
    padding: 12px 16px;
    color: #101f31;
    font-size: 12px;
    font-weight: 600;
}

/* Body cells — Blue text, hairline Light-Grey row dividers, no vertical rules */
.mp-rma-table.table-bordered tbody td {
    padding: 14px 16px;
    font-size: 14px;
    color: #101f31;
    background-color: transparent;
    border: 0;
    border-bottom: 1px solid #d3d6dc;
    vertical-align: middle;
    text-align: center;
}

.mp-rma-table tbody tr:last-child td {
    border-bottom: 0;
}

/* table-hover — subtle brand tint on row hover */
.mp-rma-table.table-hover tbody tr:hover td {
    background-color: rgba(16, 31, 49, 0.03);
}

/* In-cell links (Reason text, Order ID…) -> brand Blue. Action <a>s carry
 * `.button` and are styled as Blue-outline buttons by nv-brand.css §11, so
 * they are excluded here via :not(.button). */
.mp-rma-table tbody td a:not(.button) {
    color: #101f31;
    text-decoration: none;
    font-weight: 500;
}

.mp-rma-table tbody td a:not(.button):hover {
    text-decoration: underline;
}

/* ─── Buttons ─────────────────────────────────────────────────────── */
.wkrma-flex .button {
    background-color: #101f31;
    padding: 10px 24px;
    color: #ffffff;
    border: 1px solid #101f31;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.44s ease-in-out;
}

.wkrma-flex .button:hover {
    opacity: 0.9;
    text-decoration: none;
}

/* ─── Add Reason Form ─────────────────────────────────────────────── */
.woocommerce-account .form-table {
    margin-bottom: 24px;
}

.woocommerce-account .form-table th.titledesc {
    padding: 20px 0;
    width: 200px;
    vertical-align: middle;
}

.woocommerce-account .form-table th label {
    font-size: 14px;
    font-weight: 600;
    color: #101f31;
}

.woocommerce-account .mp_rma_reason_field {
    width: 100%;
    max-width: 400px;
    height: 44px;
    border: 1px solid #d3d6dc;
    padding: 0 16px;
    font-size: 14px;
    transition: all 0.3s ease;
}

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .woocommerce-account .form-table tr {
        display: flex;
        flex-direction: column;
    }

    .woocommerce-account .form-table th.titledesc {
        width: 100%;
        padding-bottom: 5px;
    }
}

/* ==================================================================
 * Add RMA (customer) form
 * Scoped to .mp_request_rma — unique plugin form class, so these
 * rules never bleed into unrelated templates.
 * ================================================================== */

.mp_request_rma {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 920px;
    margin-top: 16px;
    color: #101f31;
}

/* Section heading just above the form ("New RMA Information") */
.woocommerce-MyAccount-content>.woocommerce-account>h1 {
    font-size: 16px;
    font-weight: 600;
    color: #101f31;
    padding-bottom: 10px;
    border-bottom: 1px solid #d3d6dc;
    margin: 0 0 18px;
}

/* Labels + required asterisk */
.mp_request_rma label {
    font-size: 14px;
    font-weight: 500;
    color: #101f31;
    display: inline-block;
    margin-bottom: 6px;
}

.mp_request_rma .required {
    color: #d92e2e;
    margin-right: 2px;
}

/* Flex rows — Order / Status / Resolution */
.mp_request_rma .mp-ppr-flex {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.mp_request_rma .mp-ppr-flex-width {
    flex: 0 0 200px;
    max-width: 200px;
}

.mp_request_rma .mp-ppr-flex-width label {
    margin-bottom: 0;
}

.mp_request_rma .mp-ppr-select-order {
    flex: 1 1 320px;
    min-width: 260px;
}

/* Inputs, selects, textarea — shared baseline */
.mp_request_rma input[type="text"],
.mp_request_rma select,
.mp_request_rma textarea {
    width: 100%;
    min-height: 42px;
    padding: 8px 14px;
    font-size: 14px;
    color: #101f31;
    background-color: #ffffff;
    border: 1px solid #d3d6dc;
    border-radius: 6px;
    box-shadow: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.mp_request_rma textarea {
    min-height: 110px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

.mp_request_rma input[type="text"]:focus,
.mp_request_rma select:focus,
.mp_request_rma textarea:focus {
    outline: none;
    border-color: #101f31;
    box-shadow: 0 0 0 3px rgba(16, 31, 49, 0.10);
}

/* Override the plugin's bare select.wkmp-rma-full-width (height:30px, no border) */
.mp_request_rma select.wkmp-rma-full-width {
    height: 42px;
    border: 1px solid #d3d6dc;
}

/* Loose <p> wrappers the plugin uses around labels/fields */
.mp_request_rma>p {
    margin: 0;
    display: flex;
}

.mp_request_rma>p>label {
    display: block;
}

/* ─── Items Ordered table ─────────────────────────────────────────── */
.mp_request_rma .wkmp-rma-responsive {
    border: 1px solid #d3d6dc;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    background-color: #ffffff;
    -webkit-overflow-scrolling: touch;
}

.mp_request_rma .mp_rma_items_ordered {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    background-color: transparent;
}

.mp_request_rma .mp_rma_items_ordered thead th {
    background-color: rgba(16, 31, 49, 0.04);
    color: #101f31;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    padding: 12px 16px;
    border: 0;
    border-bottom: 1px solid #d3d6dc;
}

.mp_request_rma .mp_rma_items_ordered tbody td {
    padding: 12px 16px;
    font-size: 14px;
    color: #101f31;
    border: 0;
    border-bottom: 1px solid #d3d6dc;
    vertical-align: middle;
}

.mp_request_rma .mp_rma_items_ordered tbody tr:last-child td {
    border-bottom: 0;
}

.mp_request_rma .mp_rma_items_ordered tbody tr:empty td,
.mp_request_rma .mp_rma_items_ordered tbody:empty::after {
    display: none;
}

/* Empty-state placeholder when no items are loaded yet */
.mp_request_rma .mp_rma_items_ordered tbody:empty::before {
    display: block;
    padding: 16px;
    font-size: 13px;
    color: #666c7a;
    font-style: italic;
}

/* ─── Image attach area ───────────────────────────────────────────── */
.mp_request_rma .mp-rma-form-images {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.mp_request_rma #mp-rma-img-wrapper {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mp_request_rma .mp-rma-form-images .mp-rma-image-preview {
    width: 64px;
    height: 64px;
    margin: 0;
    border: 1px dashed #d3d6dc;
    border-radius: 8px;
    background-color: rgba(16, 31, 49, 0.04);
    background-size: 28px 28px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.mp_request_rma .mp-rma-form-images .mp-rma-image-preview:hover {
    border-color: #101f31;
    background-color: #ffffff;
}

.mp_request_rma .mp-rma-image-remove {
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    padding: 0;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    color: #ffffff;
    background-color: #101f31;
    border-radius: 50%;
}

.mp_request_rma .mp-rma-form-images .mp-rma-attach-more a {
    margin-left: 4px;
    padding: 0;
    font-size: 14px;
    font-weight: 500;
    color: #101f31;
    text-decoration: none;
    cursor: pointer;
}

.mp_request_rma .mp-rma-form-images .mp-rma-attach-more a:hover {
    text-decoration: underline;
}

/* ─── Return policy content block ─────────────────────────────────── */
.mp_request_rma .mp-rma-policy-content {
    padding: 14px 16px;
    margin: 0;
    background-color: rgba(16, 31, 49, 0.04);
    border: 1px solid #d3d6dc;
    border-radius: 6px;
    font-size: 13px;
    color: #666c7a;
    line-height: 1.6;
    max-height: 180px;
    overflow-y: auto;
}

/* ─── Policy agreement row ────────────────────────────────────────── */
.mp_request_rma input[type="checkbox"][name="mp_policy_agree"] {
    width: 16px;
    height: 16px;
    margin: 0 6px 0 2px;
    vertical-align: middle;
    accent-color: #101f31;
    cursor: pointer;
}

.mp_request_rma input[type="checkbox"][name="mp_policy_agree"]+label {
    margin-bottom: 0;
    vertical-align: middle;
    cursor: pointer;
    font-weight: 400;
    color: #666c7a;
}

/* ─── Submit row (Request + Back) ─────────────────────────────────── */
.mp_request_rma .mp-rma-floated-right {
    margin: 8px 0 0;
    padding: 0;
    background-color: transparent !important;
    text-align: right;
    float: none;
}

.mp_request_rma #mp_rma_add_button,
.mp_request_rma .woocommerce-button.button {
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: #ffffff;
    background-color: #101f31;
    border: 1px solid #101f31;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.mp_request_rma #mp_rma_add_button:hover,
.mp_request_rma .woocommerce-button.button:hover {
    opacity: 0.9;
    text-decoration: none;
}

/* "Back" link — secondary/outline treatment */
.mp_request_rma>p:has(> a.woocommerce-button) {
    margin: 0;
}

.mp_request_rma a.woocommerce-button.button {
    background-color: #ffffff;
    color: #101f31;
}

.mp_request_rma a.woocommerce-button.button:hover {
    background-color: #101f31;
    color: #ffffff;
}

/* ─── Responsive — stack row labels below lg (≤1024px) ───────────── */
@media (max-width: 1024px) {
    .mp_request_rma .mp-ppr-flex {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .mp_request_rma .mp-ppr-flex-width,
    .mp_request_rma .mp-ppr-select-order {
        flex: 0 0 auto;
        max-width: 100%;
        min-width: 0;
        width: 100%;
    }
}

/* ─── Responsive — items table horizontal scroll on mobile ───────── */
@media (max-width: 768px) {
    .mp_request_rma .mp_rma_items_ordered {
        min-width: 640px;
    }

    .mp_request_rma .mp_rma_items_ordered thead th,
    .mp_request_rma .mp_rma_items_ordered tbody td {
        white-space: nowrap;
    }
}

@media (max-width: 640px) {
    .mp_request_rma .mp-rma-floated-right {
        text-align: left;
    }

    .mp_request_rma #mp_rma_add_button,
    .mp_request_rma .woocommerce-button.button {
        width: 100%;
        text-align: center;
    }
}

/* ==================================================================
 * RMA Details (view) page — tabs + detail panels + chat
 * Scoped via unique plugin IDs / classes:
 *   #mp_rma_details_tab, .wk_mp_rma_container, #rma-chat-form
 * Zero bleed into other templates.
 * ================================================================== */

/* Hide the duplicate Option/Value table that the plugin emits outside
 * .woocommerce-account on /my-account/rma-view/{id}/.
 * Kept in the DOM (z-index + visibility) so any JS querying it keeps
 * working; pushed behind, zero-sized, non-interactive — never visible
 * even when the page scrolls to the top. */
.woocommerce-MyAccount-content>table.widefat.fixed {
    position: absolute;
    top: 0;
    left: 0;
    z-index: -9999;
    visibility: hidden;
    opacity: 0;
    height: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
}

/* ─── Tab strip ───────────────────────────────────────────────────── */
#mp_rma_details_tab {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    height: auto;
    width: 100%;
    float: none;
    margin: 8px 0 20px;
    padding: 0;
    list-style: none;
    border: 0;
    border-bottom: 1px solid #d3d6dc;
}

#mp_rma_details_tab li {
    float: none;
    list-style: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    outline: none;
}

#mp_rma_details_tab li a,
#mp_rma_details_tab li a.inactive {
    position: relative;
    display: block;
    padding: 10px 18px;
    margin-bottom: -1px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    color: #666c7a;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease;
}

#mp_rma_details_tab li a:not(.inactive) {
    color: #101f31;
    font-weight: 600;
    border-bottom-color: #101f31;
}

#mp_rma_details_tab li a:hover,
#mp_rma_details_tab li a.inactive:hover {
    color: #101f31;
    background: transparent;
}

/* ─── Tab content panels ─────────────────────────────────────────── */
/* min-width: 0 stops flex/grid children from forcing the panel wider than
 * its parent; max-width: 100% caps the panel at the outer content width.
 * Together they prevent the details table from pushing the ancestor
 * .woocommerce-MyAccount-content (which has Tailwind `overflow-auto`)
 * into a horizontal scroll that would drag tabs + table + chat as one. */
.wk_mp_rma_container {
    padding: 4px 0 20px;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* ─── Details table (Option / Value key-value) ───────────────────── */
.wk_mp_rma_container>table.widefat.fixed {
    position: static;
    width: 100%;
    max-width: 720px;
    margin: 0 0 20px;
    background-color: #ffffff;
    border: 1px solid #d3d6dc;
    border-radius: 8px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    /* Enforce column widths so long values wrap inside the Value cell
     * instead of stretching the table past its container. */
    table-layout: fixed;
    z-index: 5;
}

.wk_mp_rma_container table.widefat.fixed thead td.toptable {
    padding: 12px 16px;
    background-color: rgba(16, 31, 49, 0.04);
    color: #666c7a;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 0;
    border-bottom: 1px solid #d3d6dc;
}

.wk_mp_rma_container table.widefat.fixed thead td.toptable strong {
    font-weight: 600;
}

.wk_mp_rma_container table.widefat.fixed tbody td {
    padding: 12px 16px;
    font-size: 14px;
    color: #101f31;
    background-color: #ffffff;
    border: 0;
    border-bottom: 1px solid #d3d6dc;
    vertical-align: middle;
    /* Wrap long values (order IDs, customer names, additional info) so the
     * fixed-layout table never spills past its container. */
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
}

.wk_mp_rma_container table.widefat.fixed tbody tr:last-child td {
    border-bottom: 0;
}

.wk_mp_rma_container table.widefat.fixed tbody td:first-child {
    width: 220px;
    color: #666c7a;
    font-weight: 500;
    background-color: rgba(16, 31, 49, 0.03);
}

.wk_mp_rma_container table.widefat.fixed tbody td a {
    color: #101f31;
    text-decoration: none;
    font-weight: 500;
}

.wk_mp_rma_container table.widefat.fixed tbody td a:hover {
    text-decoration: underline;
}

/* ─── Chat form ──────────────────────────────────────────────────── */
/* The chat form is a sibling of the details table inside #details_tab_wk.
 * It sits below the table in DOM order; clearing + max-width keeps it
 * from inheriting any horizontal stretch from the table above. */
#rma-chat-form {
    margin-top: 20px;
    max-width: 720px;
    width: 100%;
    min-width: 0;
    clear: both;
}

#rma-chat-form+p,
.wk_mp_rma_container>p>label[for="textarea"] {
    font-size: 14px;
    color: #666c7a;
}

.mp-rma-conversation-wrapper {
    display: block;
    max-width: 100%;
    min-width: 0;
}

/* Plugin renders each message inside a nested <table class="form-table
 * wc_status_table widefat">. Lock its layout so message bodies wrap and
 * the chat column stays the same width as the details table above it. */
.mp-rma-conversation-wrapper .wc_status_table.widefat {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    margin: 0 0 12px;
    border: 1px solid #d3d6dc;
    border-radius: 8px;
    border-collapse: separate;
    border-spacing: 0;
    background-color: #ffffff;
}

.mp-rma-conversation-wrapper .wc_status_table.widefat td {
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
    padding: 10px 14px;
    border: 0;
    vertical-align: top;
}

.mp-rma-conversation-wrapper .mp-rma-sup-comment-body {
    margin: 0 0 4px;
    font-size: 14px;
    line-height: 1.5;
    color: #101f31;
}

.mp-rma-conversation-wrapper .mp-rma-sup-comment-head {
    margin: 0;
    font-size: 12px;
    color: #666c7a;
}

.mp-rma-flex {
    display: flex;
    align-items: stretch;
    gap: 8px;
    background-color: #ffffff;
    padding: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mp-rma-flex:focus-within {
    border-color: #101f31;
    box-shadow: 0 0 0 3px rgba(16, 31, 49, 0.10);
}

.mp-rma-flex .mp-rma-message-box {
    flex: 1 1 auto;
    min-height: 44px;
    max-height: 160px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    color: #101f31;
    background-color: transparent;
    border: 0;
    outline: none;
    resize: vertical;
    box-shadow: none;
}

.mp-rma-flex input[type="submit"],
.mp-rma-flex .button.button-primary {
    flex: 0 0 auto;
    align-self: stretch;
    padding: 0 22px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    color: #ffffff !important;
    background-color: #101f31;
    border: 1px solid #101f31;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.mp-rma-flex input[type="submit"]:hover,
.mp-rma-flex .button.button-primary:hover {
    opacity: 0.9;
}

/* ─── Manage tab — mark as solved form ───────────────────────────── */
#update_manage_tab_wk form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background-color: rgba(16, 31, 49, 0.04);
    border: 1px solid #d3d6dc;
    border-radius: 8px;
    max-width: 720px;
}

#update_manage_tab_wk form input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #101f31;
    cursor: pointer;
}

#update_manage_tab_wk form label {
    margin: 0;
    font-size: 14px;
    color: #666c7a;
    cursor: pointer;
}

#update_manage_tab_wk form>p {
    width: 100%;
    margin: 0;
}

#update_manage_tab_wk form input[type="submit"].button {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    background-color: #101f31;
    border: 1px solid #101f31;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

#update_manage_tab_wk form input[type="submit"].button:hover {
    opacity: 0.9;
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    #mp_rma_details_tab {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    #mp_rma_details_tab li a,
    #mp_rma_details_tab li a.inactive {
        white-space: nowrap;
    }

    .wk_mp_rma_container table.widefat.fixed tbody td:first-child {
        width: 40%;
    }

    .mp-rma-flex {
        flex-direction: column;
    }

    .mp-rma-flex input[type="submit"],
    .mp-rma-flex .button.button-primary {
        width: 100%;
        padding: 10px 22px;
    }
}

/* ==================================================================
 * RMA Listing page (/my-account/rma/) — filter bar, Add button, table
 * Scoped via :has(#rma-select-status) — unique plugin ID, so these
 * rules only fire when the RMA list template is actually rendered.
 * ================================================================== */

/* Filter form — inline row with select + submit */
.woocommerce-MyAccount-content form.alignleft:has(#rma-select-status) {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    float: left;
    margin: 0 0 20px;
}

/* Status filter select */
#rma-select-status {
    height: 42px;
    min-width: 180px;
    padding: 8px 14px;
    font-size: 14px;
    color: #101f31;
    background-color: #ffffff;
    border: 1px solid #d3d6dc;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    margin-left: 0 !important;
}

#rma-select-status:focus {
    outline: none;
    border-color: #101f31;
    box-shadow: 0 0 0 3px rgba(16, 31, 49, 0.10);
}

/* "Select RMA Status" submit */
.woocommerce-MyAccount-content form:has(#rma-select-status) input[type="submit"].button-primary {
    height: 42px;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    color: #ffffff;
    background-color: #101f31;
    border: 1px solid #101f31;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.woocommerce-MyAccount-content form:has(#rma-select-status) input[type="submit"].button-primary:hover {
    opacity: 0.9;
}

/* "Add" button — right-aligned primary. Anchor-tag variant only, so
 * it never collides with the Add-RMA submit wrapper (which is a <p>). */
.woocommerce-MyAccount-content:has(#rma-select-status) a.woocommerce-button.button.mp-rma-floated-right {
    float: right;
    margin: 0 0 20px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: #ffffff;
    background-color: #101f31;
    border: 1px solid #101f31;
    border-radius: 6px;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.woocommerce-MyAccount-content:has(#rma-select-status) a.woocommerce-button.button.mp-rma-floated-right:hover {
    opacity: 0.9;
    color: #ffffff;
}

/* RMA orders table — clear floats + card treatment */
.woocommerce-MyAccount-content:has(#rma-select-status) table.woocommerce-MyAccount-orders {
    clear: both;
    width: 100%;
    margin-top: 10px;
    background-color: #ffffff;
    border: 1px solid #d3d6dc;
    border-radius: 8px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

.woocommerce-MyAccount-content:has(#rma-select-status) table.woocommerce-MyAccount-orders thead th {
    padding: 12px 16px;
    background-color: rgba(16, 31, 49, 0.04);
    color: #666c7a;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    border: 0;
    border-bottom: 1px solid #d3d6dc;
}

.woocommerce-MyAccount-content:has(#rma-select-status) table.woocommerce-MyAccount-orders tbody td {
    padding: 14px 16px;
    font-size: 14px;
    color: #101f31;
    background-color: #ffffff;
    border: 0;
    border-bottom: 1px solid #d3d6dc;
    vertical-align: middle;
}

.woocommerce-MyAccount-content:has(#rma-select-status) table.woocommerce-MyAccount-orders tbody tr:last-child td {
    border-bottom: 0;
}

.woocommerce-MyAccount-content:has(#rma-select-status) table.woocommerce-MyAccount-orders tbody tr:hover td {
    background-color: rgba(16, 31, 49, 0.03);
}

.woocommerce-MyAccount-content:has(#rma-select-status) table.woocommerce-MyAccount-orders td a {
    color: #101f31;
    text-decoration: none;
    font-weight: 500;
}

.woocommerce-MyAccount-content:has(#rma-select-status) table.woocommerce-MyAccount-orders td a:hover {
    text-decoration: underline;
}

/* Row action links — View / Cancel */
.woocommerce-MyAccount-content:has(#rma-select-status) .rma-action {
    color: #101f31;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.woocommerce-MyAccount-content:has(#rma-select-status) .rma-action:hover {
    text-decoration: underline;
}

.woocommerce-MyAccount-content:has(#rma-select-status) .rma-action.cancel {
    color: #d92e2e;
}

.woocommerce-MyAccount-content:has(#rma-select-status) span.rma-action {
    color: #d3d6dc;
    margin: 0 2px;
    pointer-events: none;
    text-decoration: none;
}

/* Responsive — filter + Add stack on small screens, table stays scrollable */
@media (max-width: 640px) {
    .woocommerce-MyAccount-content form.alignleft:has(#rma-select-status) {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        float: none;
        width: 100%;
        gap: 8px;
    }

    #rma-select-status,
    .woocommerce-MyAccount-content form:has(#rma-select-status) input[type="submit"].button-primary {
        width: 100%;
        min-width: 0;
    }

    .woocommerce-MyAccount-content:has(#rma-select-status) a.woocommerce-button.button.mp-rma-floated-right {
        float: none;
        width: 100%;
        text-align: center;
    }

    .woocommerce-MyAccount-content:has(#rma-select-status) table.woocommerce-MyAccount-orders {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* =====================================================================
 * Fix: RMA plugin global width leak
 * ---------------------------------------------------------------------
 * RMA style.css:508 ships a mis-scoped rule:
 *     .mp-rma-setting select, textarea, input[type="number"] { width:350px }
 * Only `select` is under `.mp-rma-setting`; `textarea` and
 * `input[type="number"]` are UNSCOPED, so every number input / textarea
 * site-wide is forced to 350px (e.g. the price-range filter `.numberVal`).
 * This file loads after the plugin CSS (same specificity -> later wins),
 * so: undo the global leak, then restore 350px ONLY where RMA intended.
 * No `!important` needed. */
textarea,
input[type="number"] {
    width: auto;
}

.mp-rma-setting textarea,
.mp-rma-setting input[type="number"] {
    width: 350px;
}