/* PRISP Canada — compact shipping and payment presentation only. */
/* The original Magento methods, prices, inputs and carrier details stay intact. */
@supports selector(:has(*)) {
  body.onestepcheckout-index-index .table-checkout-shipping-method:has(#label_method_freeshipping_freeshipping) {
    display: block;
    width: 100% !important;
    max-width: 100%;
  }

  body.onestepcheckout-index-index .table-checkout-shipping-method:has(#label_method_freeshipping_freeshipping) > tbody {
    display: block;
    width: 100%;
  }

  body.onestepcheckout-index-index .table-checkout-shipping-method tbody > tr:has(> :is(#label_method_freeshipping_freeshipping, #label_method_flatrate_flatrate, #label_method_flatrate_flatrateone)) {
    display: grid !important;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 10px;
    row-gap: 4px;
    width: 100%;
    margin: 0 !important;
    padding: 12px 4px !important;
    box-sizing: border-box;
    border-bottom: 1px solid #e3e3e3;
  }

  body.onestepcheckout-index-index .table-checkout-shipping-method tbody > tr:has(> :is(#label_method_freeshipping_freeshipping, #label_method_flatrate_flatrate, #label_method_flatrate_flatrateone))::before,
  body.onestepcheckout-index-index .table-checkout-shipping-method tbody > tr:has(> :is(#label_method_freeshipping_freeshipping, #label_method_flatrate_flatrate, #label_method_flatrate_flatrateone))::after {
    display: none !important;
    content: none !important;
  }

  body.onestepcheckout-index-index .table-checkout-shipping-method tbody > tr:has(> :is(#label_method_freeshipping_freeshipping, #label_method_flatrate_flatrate, #label_method_flatrate_flatrateone)) > td {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-sizing: border-box;
    white-space: normal !important;
    text-align: left;
    font-size: 14px;
    line-height: 1.4;
  }

  body.onestepcheckout-index-index .table-checkout-shipping-method tbody > tr:has(> :is(#label_method_freeshipping_freeshipping, #label_method_flatrate_flatrate, #label_method_flatrate_flatrateone)) > td:first-child {
    grid-column: 1;
    grid-row: 1;
    text-align: center;
  }

  body.onestepcheckout-index-index .table-checkout-shipping-method tbody > tr:has(> :is(#label_method_freeshipping_freeshipping, #label_method_flatrate_flatrate, #label_method_flatrate_flatrateone)) > td.col-price {
    grid-column: 3;
    grid-row: 1;
    text-align: right;
    white-space: nowrap !important;
    font-size: 13px;
  }

  body.onestepcheckout-index-index .table-checkout-shipping-method :is(#label_method_freeshipping_freeshipping, #label_method_flatrate_flatrate, #label_method_flatrate_flatrateone) {
    grid-column: 2;
    grid-row: 1;
    overflow-wrap: break-word;
  }

  body.onestepcheckout-index-index .table-checkout-shipping-method #label_method_flatrate_flatrate::after { content: " – Boucherville, QC"; }
  body.onestepcheckout-index-index .table-checkout-shipping-method #label_method_flatrate_flatrateone::after { content: " – Delta, BC"; }

  body.onestepcheckout-index-index .table-checkout-shipping-method :is(#label_carrier_flatrate_flatrate, #label_carrier_flatrate_flatrateone) {
    grid-column: 2 / -1;
    grid-row: 2;
    font-size: 12px !important;
    color: #555;
    overflow-wrap: break-word;
  }

  /* Keep the actual pickup address visible if selected; never hide unknown methods. */
  body.onestepcheckout-index-index .table-checkout-shipping-method tr:has(input[type=radio]:not(:checked)) > :is(#label_carrier_flatrate_flatrate, #label_carrier_flatrate_flatrateone),
  body.onestepcheckout-index-index .table-checkout-shipping-method tr:has(> #label_method_freeshipping_freeshipping) > #label_carrier_freeshipping_freeshipping {
    display: none !important;
  }

  body.onestepcheckout-index-index .table-checkout-shipping-method tr:has(input[type=radio]:checked) > :is(#label_method_freeshipping_freeshipping, #label_method_flatrate_flatrate, #label_method_flatrate_flatrateone) {
    font-weight: 600;
  }

  /* Visual fallback when the payment integration does not respect Magento sort order. */
  body.onestepcheckout-index-index .payment-methods .payment-group:has(#paypal_express):has(#rootways_elavon_option) {
    display: flex !important;
    flex-direction: column;
  }

  body.onestepcheckout-index-index .payment-methods .payment-group > .payment-method:has(#rootways_elavon_option) { order: 1; }
  body.onestepcheckout-index-index .payment-methods .payment-group > .payment-method:has(#paypal_express) { order: 2; }
  body.onestepcheckout-index-index .payment-method:has(#paypal_express) .payment-method-title img.payment-icon {
    max-height: 24px !important;
    max-width: 72px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    vertical-align: middle;
  }
}
