.sa-orderview__header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.pix-holded-invoice-action-container {
    display: inline-flex;
    align-items: center;
    margin-top: 2px;
}

.pix-holded-request-invoice-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    padding: 7px 14px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    text-decoration: none !important;
    line-height: 1.4 !important;
    transition: all .2s ease !important;
    white-space: nowrap !important;
    background-color: var(--brand, #245644) !important;
    border: none;
    font-family: inherit;
    color: #fff !important;
}

.pix-holded-request-invoice-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.pix-holded-request-invoice-btn:active {
    transform: translateY(0);
}

.pix-holded-request-invoice-btn.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
}

/* Listado de pedidos: el botón (o el aviso, si ya se solicitó) vive dentro de
   .sa-orders__actionbox, que es una columna alineada a la derecha, justo encima
   del enlace «Ver detalles». */
.pix-holded-invoice-action-container--list {
    margin-top: 4px;
    justify-content: flex-end;
    /* El aviso es largo: se limita para que reparta en varias líneas en vez de
       estirar la tarjeta y comerse el espacio de las miniaturas. */
    max-width: 320px;
}

.pix-holded-invoice-action-container--list .pix-holded-invoice-notice-text {
    font-size: 13.5px;
}

.pix-holded-invoice-action-container--list .pix-holded-invoice-notice-text a {
    font-size: 14px;
}

.pix-holded-request-invoice-btn--compact {
    font-size: 12px !important;
    padding: 6px 12px !important;
}

@media (max-width: 600px) {
    .pix-holded-invoice-action-container--list {
        max-width: 100%;
    }
}

.pix-holded-invoice-notice-text {
    font-size: 15px;
    color: var(--brand, #1e3a2b);
    line-height: 1.5;
    text-align: right;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
}
.pix-holded-invoice-notice-text a{
    text-decoration:underline !important;
    font-size:16px;
    font-weight:600;
}

.pix-holded-whatsapp-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    padding: 2px 10px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    text-decoration: none !important;
    line-height: 1.4 !important;
    transition: all .2s ease !important;
    white-space: nowrap !important;
    background-color: var(--brand, #245644) !important;
    color: #fff !important;
    text-align: center;
}

.pix-holded-whatsapp-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.pix-holded-whatsapp-btn:active {
    transform: translateY(0);
}

.pix-holded-invoice-sent-notice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #1b5e20;
    background-color: #dff3e6;
    border: 1px solid rgba(27, 94, 32, 0.15);
    border-radius: 8px;
    padding: 6px 12px;
    line-height: 1.4;
    text-align: right;
}

.pix-holded-invoice-sent-icon {
    font-weight: 700;
    color: #1b5e20;
}

/* Modal Styles */
body.pix-holded-modal-open {
    overflow: hidden;
}

.pix-holded-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    /* Si el diálogo no cabe (móvil en horizontal, zoom alto), la capa hace scroll */
    overflow-y: auto;
    overscroll-behavior: contain;
}

.pix-holded-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.pix-holded-modal-dialog {
    position: relative;
    z-index: 2;
    background: #F7F4F0;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    max-width: 560px;
    width: 100%;
    /* El diálogo nunca pasa del alto de la pantalla: el cuerpo es lo que hace scroll,
       de modo que cabecera y botones quedan siempre visibles. */
    max-height: calc(100vh - 40px);
    margin: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: pixHoldedModalIn .22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pixHoldedModalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.pix-holded-modal-close {
    background-color:transparent !important;
    position: absolute;
    top: 4px !important;
    right: 4px !important;
    background: none;
    border: none;
    font-size: 26px !important;

    line-height: 1;
    color: var(--brand, #888) !important;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color .2s, background-color .2s;
}

.pix-holded-modal-close:hover {
    color: #111;
    background-color: rgba(0, 0, 0, 0.05);
}

.pix-holded-modal-header {
    padding: 22px 26px 14px;

}

.pix-holded-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--brand, #245644);
    font-family: inherit;
    line-height: 1.3;
}

.pix-holded-modal-body {
    padding: 20px 26px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
}

/* Campos de facturación a dos columnas, en el orden en que los pinta PHP:
   DNI/CIF + empresa · nombre + apellidos · dirección + apartamento · etc. */
.pix-holded-billing-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
}

.pix-holded-billing-fields .pix-holded-form-group {
    min-width: 0;
    margin-bottom: 16px;
}

/* El formulario ocupa el alto restante y deja que sea el cuerpo el que haga scroll */
.pix-holded-modal-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow: hidden;
    min-height: 0;
}

.pix-holded-billing-fields input,
.pix-holded-billing-fields select {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    color: #333;
    transition: all .2s ease;
}

.pix-holded-billing-fields input:focus,
.pix-holded-billing-fields select:focus {
    border-color: var(--brand, #245644);
    outline: none;
    box-shadow: 0 0 0 3px rgba(36, 86, 68, 0.15);
}

.pix-holded-billing-fields .required {
    color: #d9534f;
    font-weight: 700;
    text-decoration: none;
}

.pix-holded-billing-fields .optional {
    font-size: 11px;
    font-weight: 400;
    color: #777;
}

.pix-holded-input--error,
.pix-holded-billing-fields input.pix-holded-input--error,
.pix-holded-billing-fields select.pix-holded-input--error {
    border-color: #d9534f;
    box-shadow: 0 0 0 3px rgba(217, 83, 79, 0.12);
}

.pix-holded-modal-note {
    margin: 4px 0 0;
    font-size: 12px;
    color: #777;
    line-height: 1.45;
}

@media (max-width: 520px) {
    .pix-holded-billing-fields {
        grid-template-columns: minmax(0, 1fr);
    }
}

.pix-holded-modal-description {
    margin: 0 0 16px;
    font-size: 13.5px;
    color: #555;
    line-height: 1.5;
}

.pix-holded-form-group {
    margin-bottom: 16px;
}

.pix-holded-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand, #245644);
}

.pix-holded-required {
    color: #d9534f;
    font-weight: 700;
}

.pix-holded-optional {
    font-size: 11px;
    font-weight: 400;
    color: #777;
    margin-left: 2px;
}

.pix-holded-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    color: #333;
    transition: all .2s ease;
}

.pix-holded-input:focus {
    border-color: var(--brand, #245644);
    outline: none;
    box-shadow: 0 0 0 3px rgba(36, 86, 68, 0.15);
}

.pix-holded-modal-error {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    line-height: 1.4;
}

.pix-holded-modal-footer {
    flex: 0 0 auto;
    background: #F7F4F0;
    padding: 16px 26px 22px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.pix-holded-modal-cancel-btn {
    background: transparent !important;
    border: 1px solid rgba(0, 0, 0, 0.16);
    border-radius: 8px;
    padding: 8px 16px !important;
    font-size: 13px;
    font-weight: 500;
    color: #555 !important;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s ease;
}

.pix-holded-modal-cancel-btn:hover {
    background: #f0f0f0;
    color: #111;
}

.pix-holded-modal-submit-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    padding: 8px 18px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    text-decoration: none !important;
    line-height: 1.4 !important;
    transition: all .2s ease !important;
    white-space: nowrap !important;
    background-color: var(--brand, #245644) !important;
    border: none;
    font-family: inherit;
    color: #fff !important;
    margin: 0 !important;
}

.pix-holded-modal-submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.pix-holded-modal-submit-btn:active {
    transform: translateY(0);
}

.pix-holded-modal-submit-btn.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
}

@media (max-width: 640px) {
    .sa-orderview__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .sa-orderview__header-right {
        align-items: flex-start;
        width: 100%;
    }
    .pix-holded-invoice-action-container {
        width: 100%;
    }
    .pix-holded-request-invoice-btn {
        width: 100%;
        white-space: normal;
        text-align: center;
    }
    .pix-holded-invoice-notice-text {
        text-align: left;
        justify-content: flex-start;
    }
    .pix-holded-invoice-sent-notice {
        width: 100%;
        box-sizing: border-box;
        justify-content: flex-start;
        text-align: left;
    }
    .pix-holded-modal-dialog {
        width: 95%;
        border-radius: 14px;
    }
    .pix-holded-modal-header,
    .pix-holded-modal-body,
    .pix-holded-modal-footer {
        padding-left: 18px;
        padding-right: 18px;
    }
    .pix-holded-modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
    }
    .pix-holded-modal-cancel-btn,
    .pix-holded-modal-submit-btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
}
