.receipt-actions-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.25rem;
    white-space: nowrap;
}

.customer-details-dialog {
    container-type: inline-size;
}

.customer-details-dialog .mud-dialog-title > div {
    width: 100%;
}

.customer-details-dialog .klant-crud-compact {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.customer-summary-heading {
    gap: 0.75rem;
    flex-wrap: wrap;
}

.customer-summary-identity,
.customer-summary-identity > div,
.customer-summary-fields > div,
.customer-summary-fields > div > div {
    min-width: 0;
    overflow-wrap: anywhere;
}

.customer-summary-identity > :first-child {
    flex-shrink: 0;
}

.customer-section-selectors {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.25rem;
    border-bottom: 1px solid var(--gray-200, #e5e7eb);
}

.customer-section-selectors button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.5rem;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--gray-600, #4b5563);
    font: inherit;
    cursor: pointer;
}

.customer-section-selectors button:hover {
    background: var(--gray-50, #f9fafb);
}

.customer-section-selectors button[aria-pressed="true"] {
    border-bottom-color: var(--primary-600, #2638bb);
    color: var(--primary-700, #182773);
    font-weight: 600;
}

.customer-section-selectors button:focus-visible {
    outline: 2px solid var(--primary-600, #2638bb);
    outline-offset: -2px;
}

.customer-section-selectors .mud-icon-root {
    flex-shrink: 0;
}

.customer-details-dialog section[hidden] {
    display: none;
}

.customer-history-region {
    container-type: inline-size;
    min-width: 0;
}

.customer-history-table {
    width: 100%;
    table-layout: fixed;
}

.customer-history-table tbody td {
    vertical-align: middle;
    padding: 0.75rem;
    overflow-wrap: anywhere;
}

.customer-history-table .status-badge {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.history-field-label {
    display: none;
}

.history-processing-details {
    display: grid;
    gap: 0.375rem;
    margin: 0;
}

.history-processing-details > div {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.125rem 0.375rem;
    min-width: 0;
}

.history-processing-details dt {
    color: var(--gray-600, #4b5563);
    font-size: 0.75rem;
    font-weight: 500;
}

.history-processing-details dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

/* Reflow against the available dialog space, including a narrow desktop panel. */
@container (max-width: 1050px) {
    .customer-history-table,
    .customer-history-table tbody {
        display: block;
    }

    .customer-history-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .customer-history-table tbody {
        display: grid;
        gap: 0.75rem;
    }

    .customer-history-table tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
        padding: 1rem;
        border: 1px solid var(--gray-200, #e5e7eb);
        border-radius: 0.5rem;
        background: white;
    }

    .customer-history-table tbody td {
        display: block;
        min-width: 0;
        padding: 0;
        border: 0;
        white-space: normal;
    }

    .customer-history-table .history-reference-cell,
    .customer-history-table .receipt-actions-cell {
        grid-column: 1 / -1;
    }

    .customer-history-table .receipt-actions-cell {
        padding-top: 0.75rem;
        border-top: 1px solid var(--gray-200, #e5e7eb);
        text-align: right;
    }

    .history-field-label {
        display: block;
        margin-bottom: 0.25rem;
        color: var(--gray-600, #4b5563);
        font-size: 0.75rem;
        font-weight: 500;
        line-height: 1.25;
    }

    .receipt-actions-cell .history-field-label {
        display: none;
    }
}

@container (max-width: 600px) {
    .customer-history-table .history-processing-cell {
        grid-column: 1 / -1;
    }

    .customer-section-selectors {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .customer-summary-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .customer-readiness-heading {
        flex-wrap: wrap;
    }
}

@container (min-width: 650px) and (max-width: 1050px) {
    .customer-history-table tbody tr {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .customer-history-table .history-reference-cell {
        grid-column: 1 / 4;
    }

    .customer-history-table .receipt-actions-cell {
        grid-column: 4;
        grid-row: 1;
        align-self: center;
        padding-top: 0;
        border: 0;
    }

    .customer-history-table tbody td:nth-child(6),
    .customer-history-table tbody td:nth-child(7) {
        grid-column: span 2;
    }
}

@media (max-width: 600px) {
    .mud-dialog.customer-details-dialog {
        width: calc(100% - 24px);
        max-width: calc(100% - 24px);
        margin: 12px;
    }

    .customer-details-dialog .mud-dialog-title {
        padding: 1rem;
    }

    .customer-details-dialog .mud-dialog-title > div {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .customer-details-dialog .mud-dialog-title > div > :first-child {
        flex: 1 1 100% !important;
    }

    .customer-details-dialog .mud-dialog-title > div > :last-child {
        margin-left: auto;
    }
}

.receipt-picker {
    color: var(--gray-900, #111827);
    font-size: 0.875rem;
    line-height: 1.5;
}

.receipt-picker-context {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    margin-bottom: 1.5rem;
    color: var(--gray-600, #4b5563);
}

.receipt-picker-context strong {
    color: var(--gray-900, #111827);
    overflow-wrap: anywhere;
}

.receipt-picker-provider + .receipt-picker-provider {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-200, #e5e7eb);
}

.receipt-picker-provider h3 {
    margin: 0 0 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

.receipt-picker .official-receipt {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.receipt-picker .official-receipt > p {
    flex-basis: 100%;
    margin: 0.25rem 0;
    overflow-wrap: break-word;
}

.receipt-picker .btn {
    min-height: 2.5rem;
    white-space: normal;
    word-break: normal;
}

.receipt-picker-local {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200, #e5e7eb);
}

.receipt-picker-local summary {
    cursor: pointer;
    color: var(--gray-600, #4b5563);
    font-weight: 500;
    padding: 0.25rem 0;
}

.receipt-picker-local-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

@media (max-width: 480px) {
    .transaction-receipts-dialog .mud-dialog-content {
        padding: 1rem;
    }

    .receipt-picker .official-receipt > .btn,
    .receipt-picker-local-actions > .btn {
        width: 100%;
    }
}
.transaction-log-download {
    min-width: 0;
}

.transaction-log-download button {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    max-width: 100%;
    white-space: normal;
    text-align: left;
}

.transaction-log-download button i {
    flex-shrink: 0;
}

.transaction-diagnostic-footer:has(.transaction-log-download) {
    margin-top: .75rem;
}
