body.p2p-trade-wsf-active .summary form.cart {
    display: none !important;
}

/*
 * Astra may render the native Product identity through its own summary
 * structure callback after WooCommerce's standard title/excerpt callbacks
 * have been removed. Hide only those direct, outer summary children while
 * the P2P trade experience is active. The title and description rendered
 * inside .p2p-trade-wsf-shell use different component classes and remain
 * visible.
 */
body.p2p-trade-wsf-active .summary.entry-summary > h1.product_title.entry-title,
body.p2p-trade-wsf-active .summary.entry-summary > .woocommerce-product-details__short-description {
    display: none !important;
}

body.p2p-trade-modal-open {
    overflow: hidden;
}

/* Match the existing Create Listing visual language. */
.p2p-trade-wsf-shell {
    position: relative;
    width: 100%;
    margin: 24px 0 32px;
    padding: 24px;
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.055);
}

.p2p-trade-product-header {
    display: grid;
    gap: 8px;
    margin: 0;
}

.p2p-trade-product-title {
    margin: 0;
    color: #1f2937;
    font-size: clamp(22px, 2.15vw, 30px);
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.p2p-trade-product-description {
    color: #475569;
    font-size: 14px;
    line-height: 1.55;
}

.p2p-trade-product-description > :first-child {
    margin-top: 0;
}

.p2p-trade-product-description > :last-child {
    margin-bottom: 0;
}

.p2p-trade-product-header-divider {
    height: 1px;
    margin: 18px 0 0;
    background: #e5e7eb;
}

.p2p-trade-tabs__list {
    display: flex;
    gap: 6px;
    margin: 0 0 20px;
    padding: 8px 0 0;
    border-bottom: 1px solid #e5e7eb;
}

.p2p-trade-wsf-shell .p2p-trade-tabs__tab {
    position: relative;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 10px 18px !important;
    border: 0 !important;
    border-radius: 8px 8px 0 0 !important;
    background: transparent !important;
    color: #64748b !important;
    box-shadow: none !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    text-transform: none !important;
    cursor: pointer !important;
}

.p2p-trade-wsf-shell .p2p-trade-tabs__tab::after {
    position: absolute;
    right: 10px;
    bottom: -1px;
    left: 10px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: transparent;
    content: '';
}

.p2p-trade-wsf-shell .p2p-trade-tabs__tab:hover {
    color: #1d4ed8 !important;
    background: #f8fafc !important;
}

.p2p-trade-wsf-shell .p2p-trade-tabs__tab.is-active,
.p2p-trade-wsf-shell .p2p-trade-tabs__tab[aria-selected="true"] {
    color: #0f4fbf !important;
}

.p2p-trade-wsf-shell .p2p-trade-tabs__tab.is-active::after,
.p2p-trade-wsf-shell .p2p-trade-tabs__tab[aria-selected="true"]::after {
    background: #2563eb;
}

.p2p-trade-wsf-shell .p2p-trade-tabs__tab:focus-visible {
    outline: 2px solid #2563eb !important;
    outline-offset: 2px;
}

.p2p-trade-tabs__panel[hidden] {
    display: none !important;
}

.p2p-trade-listing-details__table {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
}

.p2p-trade-listing-details .woocommerce-product-attributes {
    width: 100%;
    margin: 0 !important;
    border: 0 !important;
    border-collapse: collapse;
}

.p2p-trade-listing-details .woocommerce-product-attributes tr:last-child > * {
    border-bottom: 0 !important;
}

.p2p-trade-listing-details .woocommerce-product-attributes th,
.p2p-trade-listing-details .woocommerce-product-attributes td {
    padding: 13px 16px !important;
    border-width: 0 0 1px !important;
    border-style: solid !important;
    border-color: #e2e8f0 !important;
    text-align: left !important;
    vertical-align: top !important;
}

.p2p-trade-listing-details .woocommerce-product-attributes th {
    width: 28%;
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.p2p-trade-listing-details .woocommerce-product-attributes td {
    background: #fff;
    color: #1f2937;
    font-size: 14px;
}

.p2p-trade-listing-details .woocommerce-product-attributes td p {
    margin: 0;
    padding: 0;
}

.p2p-trade-listing-details__empty {
    margin: 0;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #64748b;
}

.p2p-trade-own-product-notice {
    margin: 0 0 16px !important;
}

.p2p-trade-wsf-shell[data-trade-direction="sell"] .p2p-trade-buy-section,
.p2p-trade-wsf-shell[data-trade-direction="buy"] .p2p-trade-sell-section,
.p2p-trade-wsf-shell [hidden] {
    display: none !important;
}

.p2p-trade-custom-ui {
    display: grid;
    gap: 15px;
}

.p2p-trade-field,
.p2p-trade-modal-field,
.p2p-trade-summary-field {
    display: grid;
    gap: 6px;
}

.p2p-trade-field-label,
.p2p-trade-modal-field > span,
.p2p-trade-summary-field > span,
.p2p-trade-summary-line > span {
    margin: 0;
    color: #111827;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 700;
}

.p2p-trade-field-label strong,
.p2p-trade-modal-field > span strong,
.p2p-trade-summary-field > span strong {
    margin-left: 4px;
    color: #ef4444;
    font-size: 10px;
    font-style: normal;
}

.p2p-trade-custom-ui input[type="text"],
.p2p-trade-custom-ui input[type="number"],
.p2p-trade-custom-ui textarea {
    width: 100%;
    min-height: 40px;
    height: auto;
    padding: 9px 11px;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    background: #fff;
    color: #111827;
    box-shadow: none;
    font-size: 13px;
    line-height: 1.4;
}

.p2p-trade-custom-ui textarea {
    min-height: 118px;
    resize: vertical;
}

.p2p-trade-custom-ui input:focus,
.p2p-trade-custom-ui textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.p2p-trade-sell-availability,
.p2p-trade-buy-availability,
.p2p-trade-unit-price {
    margin: 0 0 -4px;
    color: #111827;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
}

.p2p-trade-sell-availability strong,
.p2p-trade-buy-availability strong {
    color: #65a30d;
}

.p2p-trade-unit-price strong {
    color: #1d4ed8;
}

.p2p-trade-method-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 10px;
}

.p2p-trade-method-choice {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin: 0;
    padding: 0 13px;
    box-sizing: border-box;
    border: 1px solid #d7dee9;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

.p2p-trade-method-choice:has(input:checked) {
    border-color: #2563eb;
    background: #eff6ff;
}

.p2p-trade-method-choice input {
    position: static;
    width: 15px !important;
    height: 15px !important;
    min-width: 15px !important;
    min-height: 15px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 15px;
    accent-color: #2563eb;
}

.p2p-trade-method-choice small {
    color: #64748b;
    font-size: 11px;
    font-weight: 500;
}

.p2p-trade-sell-validation-box,
.p2p-trade-buy-aggregate-error {
    padding: 13px 15px;
    border: 1px solid #fca5a5;
    border-radius: 12px;
    background: #fef2f2;
    color: #991b1b;
    box-shadow: none;
    font-size: 12px;
    line-height: 1.55;
}

.p2p-trade-sell-validation-box.is-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.p2p-trade-status-title,
.p2p-trade-error-title {
    margin-bottom: 6px;
    font-weight: 800;
}

.p2p-trade-details-toggle,
.p2p-trade-suggestion {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 13px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.p2p-trade-details-toggle {
    margin-top: 8px;
    border-color: rgba(22, 101, 52, 0.35);
    color: #166534;
}

.p2p-trade-details-panel {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(34, 197, 94, 0.25);
}

.p2p-trade-details-heading {
    margin: 8px 0 4px;
    font-weight: 800;
}

.p2p-trade-detail-line {
    display: flex;
    gap: 8px;
    margin: 3px 0;
}

.p2p-trade-detail-line small,
.p2p-trade-union-note {
    color: #64748b;
}

.p2p-trade-union-note {
    margin-top: 8px;
}

.p2p-trade-suggestions {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(248, 113, 113, 0.35);
}

.p2p-trade-suggestions-title {
    margin-bottom: 6px;
    color: #7f1d1d;
    font-size: 10px;
    font-weight: 800;
}

.p2p-trade-suggestions-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.p2p-trade-suggestion.is-primary {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.p2p-trade-summary-line,
.p2p-trade-summary-field {
    margin-top: 2px;
}

.p2p-trade-summary-line {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    background: #f8fafc;
    min-height: 70px;
    box-sizing: border-box;
}

.p2p-trade-summary-line > strong,
.p2p-trade-readonly {
    min-height: 22px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #111827;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.4;
    box-sizing: border-box;
}

.p2p-trade-character-table-wrap {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 11px;
    background: #fff;
}

.p2p-trade-character-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.p2p-trade-character-table th,
.p2p-trade-character-table td {
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: middle;
    font-size: 12px;
}

.p2p-trade-character-table tr:last-child td {
    border-bottom: 0;
}

.p2p-trade-character-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
}

.p2p-trade-empty-row td {
    text-align: center;
    color: #64748b;
}

.p2p-trade-row-actions {
    white-space: nowrap;
}

.p2p-trade-row-edit,
.p2p-trade-row-delete,
.p2p-trade-add-character,
.p2p-trade-modal-cancel,
.p2p-trade-modal-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 13px;
    border: 1px solid #2563eb;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.p2p-trade-row-edit {
    margin-right: 8px;
    border-color: #cbd5e1;
    background: #fff;
    color: #111827;
}

.p2p-trade-row-delete {
    border-color: transparent;
    background: transparent;
    color: #dc2626;
}

.p2p-trade-add-character {
    width: fit-content;
}

.p2p-trade-buy-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 2px;
}

.p2p-trade-summary-field {
    padding: 14px 16px;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    background: #f8fafc;
    min-height: 70px;
    box-sizing: border-box;
}

.p2p-trade-character-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.p2p-trade-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
}

.p2p-trade-modal-dialog {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    width: min(900px, 100%);
    max-height: calc(100vh - 4rem);
    overflow: hidden;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.p2p-trade-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 16px 20px;
    background: #2563eb;
    color: #fff;
}

.p2p-trade-modal-header h3 {
    margin: 0;
    color: inherit;
    font-size: 18px;
}

.p2p-trade-modal-close {
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.p2p-trade-modal-body {
    display: grid;
    gap: 15px;
    overflow-y: auto;
    padding: 20px;
}

.p2p-trade-modal-field > span strong {
    font-size: 10px;
    font-weight: 600;
}

.p2p-trade-modal-field > small:not(.p2p-trade-modal-error) {
    margin-top: -1px;
    color: #64748b;
    font-size: 11px;
    line-height: 1.45;
}

.p2p-trade-modal-field.has-error input,
.p2p-trade-modal-field.has-error textarea {
    border-color: #ef4444;
    background: #fffafa;
}

.p2p-trade-modal-error {
    color: #dc2626;
    font-size: 11px;
    font-weight: 600;
}

.p2p-trade-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
}

.p2p-trade-modal-cancel {
    border-color: #cbd5e1;
    background: #fff;
    color: #111827;
}


/* Keep the SELL total visually separated from the primary trade action. */
.p2p-trade-sell-ui .p2p-trade-summary-line {
    margin-bottom: 18px;
}

/* WS Form submit button: same primary action styling as Create Listing. */
.p2p-trade-wsf-shell .p2p-trade-submit input[type="submit"],
.p2p-trade-wsf-shell .p2p-trade-submit button[type="submit"],
.p2p-trade-wsf-shell form.wsf-form input[type="submit"],
.p2p-trade-wsf-shell form.wsf-form button[type="submit"] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-height: 42px !important;
    padding: 0 22px !important;
    border: 0 !important;
    border-radius: 9px !important;
    background: #facc15 !important;
    color: #111827 !important;
    box-shadow: none !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    cursor: pointer !important;
}

.p2p-trade-submit-disabled {
    cursor: not-allowed !important;
    opacity: 0.5 !important;
}

.p2p-trade-buy-table-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.p2p-trade-character-order-hint {
    margin-top: 3px;
    color: #64748b;
    font-size: 11px;
    line-height: 1.4;
}

.p2p-trade-row-id {
    min-width: 64px;
    white-space: nowrap;
}

.p2p-trade-character-row {
    cursor: grab;
    user-select: none;
}

.p2p-trade-character-row:hover td {
    background: #f8fbff;
}

.p2p-trade-character-row:active {
    cursor: grabbing;
}

.p2p-trade-character-row button,
.p2p-trade-character-row a,
.p2p-trade-character-row input,
.p2p-trade-character-row textarea,
.p2p-trade-character-row select,
.p2p-trade-character-row label {
    cursor: pointer;
    user-select: auto;
}

.p2p-trade-row-methods {
    min-width: 220px;
    color: #334155;
    line-height: 1.45;
}

.p2p-trade-character-row.ui-sortable-helper {
    background: #fff;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12);
}

.p2p-trade-character-sort-placeholder {
    height: 48px;
    background: #eff6ff;
    outline: 1px dashed #2563eb;
    outline-offset: -2px;
}

.p2p-trade-add-character {
    margin-top: 6px;
    margin-bottom: 16px;
}

.p2p-trade-buy-ui {
    margin-bottom: 22px;
}

.p2p-trade-modal-quantity-meta {
    color: #64748b;
    font-size: 11px;
    line-height: 1.4;
}

.p2p-trade-methods-empty {
    padding: 10px 12px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 12px;
}

.p2p-trade-delete-modal {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.p2p-trade-delete-dialog {
    position: relative;
    z-index: 2;
    width: min(420px, 100%);
    padding: 22px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.p2p-trade-delete-dialog h3 {
    margin: 0 0 10px;
    color: #111827;
    font-size: 17px;
}

.p2p-trade-delete-dialog p {
    margin: 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.55;
}

.p2p-trade-delete-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.p2p-trade-delete-cancel,
.p2p-trade-delete-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.p2p-trade-delete-cancel {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #111827;
}

.p2p-trade-delete-confirm {
    border: 1px solid #dc2626;
    background: #dc2626;
    color: #fff;
}

@media (max-width: 767px) {
    .p2p-trade-wsf-shell {
        margin-top: 20px;
        padding: 18px;
        border-radius: 16px;
    }

    .p2p-trade-product-header {
        gap: 6px;
    }

    .p2p-trade-product-title {
        font-size: 21px;
        line-height: 1.3;
    }

    .p2p-trade-product-description {
        font-size: 13px;
    }

    .p2p-trade-product-header-divider {
        margin: 15px 0 0;
    }

    .p2p-trade-tabs__list {
        gap: 2px;
        margin-bottom: 16px;
        padding-top: 6px;
    }

    .p2p-trade-wsf-shell .p2p-trade-tabs__tab {
        flex: 1 1 50%;
        min-width: 0;
        min-height: 46px !important;
        padding: 10px 8px !important;
        font-size: 13px !important;
    }

    .p2p-trade-listing-details .woocommerce-product-attributes,
    .p2p-trade-listing-details .woocommerce-product-attributes tbody,
    .p2p-trade-listing-details .woocommerce-product-attributes tr,
    .p2p-trade-listing-details .woocommerce-product-attributes th,
    .p2p-trade-listing-details .woocommerce-product-attributes td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .p2p-trade-listing-details .woocommerce-product-attributes tr {
        border-bottom: 1px solid #e2e8f0;
    }

    .p2p-trade-listing-details .woocommerce-product-attributes tr:last-child {
        border-bottom: 0;
    }

    .p2p-trade-listing-details .woocommerce-product-attributes th {
        padding: 11px 13px 4px !important;
        border: 0 !important;
    }

    .p2p-trade-listing-details .woocommerce-product-attributes td {
        padding: 3px 13px 11px !important;
        border: 0 !important;
    }

    .p2p-trade-method-list,
    .p2p-trade-buy-summary {
        grid-template-columns: 1fr;
    }

    .p2p-trade-character-modal {
        padding: 0.75rem;
    }

    .p2p-trade-modal-dialog {
        max-height: calc(100vh - 1.5rem);
    }

    .p2p-trade-row-actions {
        white-space: normal;
    }

    .p2p-trade-character-order-hint {
        display: none;
    }
}


/* PL-144: transaction-critical Time Limit notice, positioned by JS directly
 * above the hydrated Buy/Sell submit field. The server source stays hidden
 * after placement so WS Form re-renders cannot destroy the canonical notice. */
.p2p-trade-time-limit-notice {
    position: relative;
    margin: 0 0 12px;
    padding: 12px 14px 12px 44px;
    border: 1px solid #f5c451;
    border-left: 4px solid #e6a700;
    border-radius: 10px;
    background: #fff9e8;
    color: #202630;
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
    font-size: 13px;
    line-height: 1.5;
}

.p2p-trade-time-limit-notice::before {
    content: "!";
    position: absolute;
    top: 12px;
    left: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e6a700;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.p2p-trade-time-limit-notice__label {
    display: block;
    margin-bottom: 2px;
    color: #111827;
    font-weight: 800;
}

.p2p-trade-time-limit-notice__value {
    display: block;
    color: #4b5563;
}

.p2p-trade-time-limit-notice[hidden] {
    display: none !important;
}
