.woocommerce-billing-fields__field-wrapper {
    display: none !important;
}

.woocommerce-billing-fields > h3 {
    display: none !important;
}

.b2b-invoice-fields-container {
    width: 100%;
}

.b2b-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px !important;
}

.b2b-row .b2b-col {
    flex: 1 1 calc(50% - 8px);
    min-width: 200px;
}

.b2b-row .b2b-full {
    flex: 1 1 100%;
}

.b2b-row .form-row {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

.b2b-row label {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    display: block;
}

.b2b-checkout-hint {
    flex: 1 1 100%;
    margin: -6px 0 4px;
    padding: 9px 12px;
    background: #fff8e7;
    border-left: 3px solid #f0c040;
    color: #5f4a00;
    font-size: 13px;
    line-height: 1.45;
}

#shipping_company_field,
#shipping_country_field,
#shipping_address_2_field {
    display: none !important;
}

.woocommerce-shipping-fields__field-wrapper {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 16px !important;
}

#shipping_first_name_field,
#shipping_last_name_field,
#shipping_city_field,
#shipping_postcode_field,
#shipping_state_field {
    flex: 1 1 calc(50% - 8px) !important;
    min-width: 200px !important;
    width: auto !important;
    float: none !important;
    clear: none !important;
    margin: 0 0 4px 0 !important;
}

#shipping_address_1_field {
    flex: 1 1 100% !important;
    width: 100% !important;
    float: none !important;
    margin: 0 0 4px 0 !important;
}

.woocommerce-order-received .col-1.woocommerce-column--billing-address,
.woocommerce-view-order .col-1.woocommerce-column--billing-address {
    display: none !important;
}

.woocommerce-order-received .col-2.woocommerce-column--shipping-address,
.woocommerce-view-order .col-2.woocommerce-column--shipping-address {
    width: 100% !important;
    float: none !important;
}

.b2b-details-table {
    width: 100%;
    border-collapse: collapse;
}

.b2b-details-table th,
.b2b-details-table td {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
}

/* ─── VIES row layout ───────────────────────────────────────────────────── */

.b2b-vies-row {
    align-items: center;
    margin-top: -4px;
    gap: 12px;
}

/* ─── VIES button ───────────────────────────────────────────────────────── */

.b2b-vies-button.button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;

    background-color: #0e7490;
    color: #ffffff !important;
    border: 2px solid #0e7490;
    border-radius: 6px;

    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;

    transition:
        background-color 0.18s ease,
        border-color     0.18s ease,
        box-shadow       0.18s ease;
}

.b2b-vies-button.button:hover:not(:disabled) {
    background-color: #0c6882;
    border-color:     #0c6882;
    box-shadow: 0 2px 8px rgba(14, 116, 144, 0.35);
    color: #ffffff !important;
}

.b2b-vies-button.button:active:not(:disabled) {
    background-color: #0a5a72;
    border-color:     #0a5a72;
    box-shadow: none;
    transform: translateY(1px);
}

.b2b-vies-button.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading spinner — appended via ::after when .is-loading is added by JS */

.b2b-vies-button.button.is-loading {
    padding-right: 38px;
    pointer-events: none;
}

.b2b-vies-button.button.is-loading::after {
    content: '';
    position: absolute;
    right: 13px;
    top: 50%;
    width: 13px;
    height: 13px;
    margin-top: -6.5px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: b2b-vies-spin 0.65s linear infinite;
}

@keyframes b2b-vies-spin {
    to { transform: rotate(360deg); }
}

/* ─── VIES status message ───────────────────────────────────────────────── */

.b2b-vies-status {
    font-size: 13px;
    line-height: 1.4;
}

.b2b-vies-status.is-success {
    color: #167a3a;
}

.b2b-vies-status.is-error {
    color: #b00020;
}

/* ─── VIES filled highlight ─────────────────────────────────────────────── */

/*
 * Permanent subtle indicator on fields populated by VIES.
 * Removed automatically by JS when the user edits the field.
 */
.b2b-vies-filled input,
.b2b-vies-filled select {
    border-color: #2d8a4e !important;
    background-color: #d3ffd4 !important;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .b2b-row .b2b-col,
    #shipping_first_name_field,
    #shipping_last_name_field,
    #shipping_city_field,
    #shipping_postcode_field,
    #shipping_state_field {
        flex: 1 1 100% !important;
    }

    .b2b-vies-button.button {
        width: 100%;
        justify-content: center;
    }
}