/* ============================================================================
   Cuenta de cliente — Facturas de compra (tabla tipo Mis pedidos)
   ============================================================================ */

.weu-invoice-history {
    --weu-inv-cols: 6;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--weu-color-dark, #212529);
}

.weu-invoice-history__inner {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

.weu-invoice-history__header {
    display: none;
}

.weu-invoice-history__row {
    display: grid;
    gap: 0.875rem;
    grid-template-columns: 1fr;
    padding: 1rem;
    border: 1px solid var(--weu-border-color, #d1d5db);
    border-radius: var(--weu-radius-default, 8px);
    background: #fff;
}

.weu-invoice-history__cell {
    display: grid;
    gap: 0.35rem;
    grid-template-columns: minmax(96px, 34%) 1fr;
    align-items: center;
    font: inherit;
    color: inherit;
    line-height: 1.4;
    min-width: 0;
}

.weu-invoice-history__cell:before {
    content: attr(data-ps-label);
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--weu-color-black, #111);
}

.weu-invoice-history__cell--total {
    font-weight: 700;
}

.weu-invoice-history__link {
    color: inherit;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.weu-invoice-history__link:hover,
.weu-invoice-history__link:focus-visible {
    color: var(--weu-color-primary, #ea1e1c);
    text-decoration: none;
}

.weu-invoice-history__source {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.25;
    white-space: nowrap;
}

.weu-invoice-history__source--web {
    background: #eef2ff;
    color: #1e3a8a;
}

.weu-invoice-history__source--store {
    background: #ecfdf3;
    color: #166534;
}

.weu-invoice-history__cell--actions {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    width: 100%;
    grid-template-columns: 1fr;
}

.weu-invoice-history__cell--actions:before {
    display: none !important;
}

.weu-invoice-history .weu-invoice-action.weu-btn-interface,
.weu-invoice-detail-actions .weu-invoice-action.weu-btn-interface {
    width: 100%;
    justify-content: flex-start;
    min-height: 40px;
    padding: 0 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: none;
}

.weu-invoice-history .weu-invoice-action.weu-btn-interface .tbc-heroicon,
.weu-invoice-detail-actions .weu-invoice-action.weu-btn-interface .tbc-heroicon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--weu-color-primary, #ea1e1c);
}

.weu-invoice-history .weu-invoice-action.weu-btn-interface:hover .tbc-heroicon,
.weu-invoice-history .weu-invoice-action.weu-btn-interface:focus-visible .tbc-heroicon,
.weu-invoice-detail-actions .weu-invoice-action.weu-btn-interface:hover .tbc-heroicon,
.weu-invoice-detail-actions .weu-invoice-action.weu-btn-interface:focus-visible .tbc-heroicon {
    color: inherit;
}

.weu-invoice-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 1.25rem;
}

.weu-invoice-detail-actions .weu-invoice-action.weu-btn-interface {
    width: auto;
    min-width: 180px;
}

.weu-invoice-history__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin: 0 0 1rem;
    font-size: 12px;
    font-weight: 600;
    color: var(--bs-secondary-color, #6c757d);
}

.weu-invoice-history__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

@media (min-width: 992px) {
    /* Igual que Mis pedidos: una fila = una sola grid de 6 columnas (sin subgrid). */
    .weu-invoice-history__inner {
        display: block !important;
        overflow-x: auto;
        border: 1px solid var(--weu-border-color, #d1d5db);
        border-radius: var(--weu-radius-default, 8px);
        background: #fff;
        padding: 0 14px;
    }

    .weu-invoice-history__header,
    .weu-invoice-history__row {
        display: grid !important;
        grid-template-columns:
            minmax(88px, 0.7fr)
            minmax(100px, 0.85fr)
            minmax(118px, 1fr)
            minmax(140px, 1.35fr)
            minmax(84px, 0.7fr)
            minmax(168px, 1.05fr) !important;
        gap: 0 1rem !important;
        align-items: center;
        width: 100%;
        box-sizing: border-box;
    }

    .weu-invoice-history__header {
        padding-block: 0.75rem;
        border-block-end: 1px solid var(--weu-border-color, #d1d5db);
        font-weight: 700;
        color: var(--weu-color-black, #111);
        background: #f7f7f8;
        margin: 0 -14px;
        padding-inline: 14px;
        width: calc(100% + 28px);
    }

    .weu-invoice-history__header .weu-invoice-history__cell {
        display: block !important;
    }

    .weu-invoice-history__header .weu-invoice-history__cell:before {
        display: none !important;
    }

    .weu-invoice-history__row {
        padding-block: 0.8rem;
        padding-inline: 0;
        border: none !important;
        border-block-end: 1px solid var(--weu-border-color, #d1d5db) !important;
        border-radius: 0 !important;
        background: transparent !important;
    }

    .weu-invoice-history__row:nth-child(even) {
        background: #fafafa !important;
        margin-inline: -14px;
        padding-inline: 14px;
        width: calc(100% + 28px);
    }

    .weu-invoice-history__row:last-child {
        border-block-end: none !important;
    }

    .weu-invoice-history__cell {
        display: flex !important;
        gap: 0 !important;
        grid-template-columns: none !important;
        align-items: center;
        justify-self: start;
        min-width: 0;
    }

    .weu-invoice-history__cell:before {
        display: none !important;
        content: none !important;
    }

    .weu-invoice-history__cell--date {
        color: var(--bs-secondary-color, #6c757d);
        font-size: 12px;
        font-weight: 600;
    }

    .weu-invoice-history__cell--name {
        font-weight: 600;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    .weu-invoice-history__cell--actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-self: stretch !important;
        width: 100% !important;
        min-width: 168px;
        gap: 8px !important;
    }

    .weu-invoice-history .weu-invoice-action.weu-btn-interface {
        width: 100% !important;
        flex: 0 0 auto;
        white-space: nowrap;
    }
}
