.export-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

/* Inhalt am Content, nicht fest 85vh — bei vielen Scheinen scrollen. */
.faktura-export.e-dialog:not(.faktura-export--embedded) {
    max-height: min(85vh, 900px);
}

.faktura-export.e-dialog:not(.faktura-export--embedded) .e-dlg-header-content {
    padding: 0.5rem 0.75rem;
}

.faktura-export.e-dialog:not(.faktura-export--embedded) .e-dlg-content {
    flex: 0 1 auto;
    max-height: min(65vh, 640px);
    overflow-y: auto;
    padding: 0.35rem 0.55rem 0.45rem;
}

.faktura-export.e-dialog:not(.faktura-export--embedded) .e-footer-content {
    border-top: 1px solid var(--l-border-light);
    padding: 0.45rem 0.75rem;
}

.faktura-export.e-dialog:not(.faktura-export--embedded) .dialog-shell-footer {
    padding: 0;
}

.export-dialog-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--l-text);
}

.export-dialog-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.export-header-icon-btn {
    background: transparent;
    border: none;
    color: var(--l-text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--l-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    transition: color var(--l-transition-fast), background-color var(--l-transition-fast);
}

.export-header-icon-btn:hover:not(:disabled) {
    color: var(--l-text);
    background: var(--l-bg-surface);
}

.export-header-icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.export-dialog-text {
    margin-bottom: 12px;
    color: var(--l-text-secondary);
}

.faktura-export .export-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 16px;
    color: var(--l-text-secondary);
}

.faktura-export .export-dialog-body--loading {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.faktura-export .export-dialog-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 0;
    background: transparent;
}

.faktura-export .faktura-export__list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
}

.faktura-export .faktura-export-card {
    border: 1px solid var(--l-border-light);
    border-radius: var(--l-radius-md);
    padding: 0;
    background: var(--l-bg-elevated);
    /* E1-Panel auf E0-Canvas — kein Schatten (Style-Guide Rezept B / Dialog-Blatt) */
    box-shadow: none;
    overflow: hidden;
}

.faktura-export--multi .faktura-export__list {
    gap: var(--l-space-xs);
}

.faktura-export .faktura-export-card--collapsed {
    padding: 0;
}

.faktura-export .faktura-export-card--continued {
    border-top-left-radius: var(--l-radius-sm);
    border-top-right-radius: var(--l-radius-sm);
}

.faktura-export .faktura-export-card--continued .faktura-export-card__header {
    padding-top: var(--l-space-sm);
}

.faktura-export .appointment-groups {
    display: flex;
    flex-direction: column;
    gap: var(--l-space-md);
    padding: var(--l-space-sm) var(--l-space-md) var(--l-space-md);
    background: transparent;
}

.faktura-export .appointment-group {
    border-radius: var(--l-radius-sm);
    padding: 0;
    background: transparent;
}

.faktura-export .appointment-group.billed {
    opacity: 0.85;
}

.faktura-export .group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--l-space-sm);
    margin-bottom: var(--l-space-xs);
    padding-bottom: 0;
    border-bottom: none;
}

.faktura-export .group-header-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: var(--l-text-xs);
    letter-spacing: 0.01em;
    text-transform: none;
    color: var(--l-text-secondary);
}

.faktura-export .group-header-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 6px;
    border-radius: var(--l-radius-full);
    background: var(--l-bg-surface);
    border: 1px solid var(--l-border-light);
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--l-text-secondary);
    text-transform: none;
    letter-spacing: normal;
}

.faktura-export .group-actions {
    display: flex;
    align-items: center;
    gap: var(--l-space-sm);
    flex-shrink: 0;
    font-size: var(--l-text-xs);
}

.faktura-export .group-actions__selection {
    display: flex;
    align-items: center;
    gap: var(--l-space-sm);
    padding-right: var(--l-space-sm);
    border-right: 1px solid var(--l-border-light);
}

.faktura-export .group-actions .ui-link-button,
.faktura-export .group-actions .l-link-button,
.faktura-export .group-actions a {
    font-size: var(--l-text-xs);
    font-weight: 500;
    color: var(--l-text-muted);
}

.faktura-export .group-actions .ui-link-button:hover:not(:disabled),
.faktura-export .group-actions .l-link-button:hover:not(:disabled),
.faktura-export .group-actions a:hover {
    color: var(--l-primary);
}

.faktura-export .group-actions__recalculate.l-btn {
    font-size: var(--l-text-xs);
    font-weight: 500;
    color: var(--l-text-muted);
    white-space: nowrap;
    min-height: 0;
    padding: 2px 6px;
    gap: 4px;
}

.faktura-export .group-actions__recalculate.l-btn:hover:not(:disabled) {
    color: var(--l-primary);
    background-color: transparent;
}

.faktura-export .group-actions__recalculate.l-btn svg {
    width: 12px;
    height: 12px;
}

.faktura-export .appointment-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.faktura-export .unlinked-siblings {
    padding: var(--l-space-sm);
    border-radius: var(--l-radius-md);
    background: var(--l-warning-bg);
    border: 1px solid color-mix(in srgb, var(--l-warning) 28%, var(--l-border-light));
}

.faktura-export .unlinked-siblings__title {
    color: var(--l-warning);
    font-weight: 600;
}

.faktura-export .unlinked-siblings__title svg {
    color: var(--l-warning);
}

.faktura-export .unlinked-siblings__list {
    margin-top: 2px;
}

.faktura-export .unlinked-siblings__row {
    background: var(--l-bg-elevated);
    border: 1px solid var(--l-border-light);
    border-radius: var(--l-radius-sm);
    padding: 6px 8px;
}

.faktura-export .faktura-export-card__head {
    display: block;
    min-width: 0;
}

.faktura-export .faktura-export-card__head--with-rail {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr);
    align-items: stretch;
    border-bottom: 1px solid var(--l-border-light);
}

.faktura-export .faktura-export-card__head--with-rail .faktura-export-card__header {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: var(--l-space-sm);
}

.faktura-export .faktura-export-card__head--with-rail > .l-select-rail {
    border-radius: 0;
    background: var(--l-bg-surface-alt);
    border-right-color: var(--l-border-light);
    align-items: flex-start;
    padding-top: 0.85rem;
}

.faktura-export .faktura-export-card--selected .faktura-export-card__head--with-rail > .l-select-rail {
    background: color-mix(in srgb, var(--l-primary) 12%, var(--l-bg-elevated));
    border-right-color: color-mix(in srgb, var(--l-primary) 28%, var(--l-border-light));
}

.faktura-export .faktura-export-card__header.is-collapsible:hover {
    background: var(--l-bg-hover);
}

.faktura-export--multi .faktura-export-card__header.is-collapsible:hover {
    background: var(--l-bg-hover);
}

.faktura-export .faktura-export-card__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    column-gap: var(--l-space-md);
    row-gap: 0.2rem;
    padding: var(--l-space-sm) var(--l-space-md);
    border-bottom: 1px solid var(--l-border-light);
    user-select: none;
}

.faktura-export .faktura-export-card__header.is-collapsible {
    cursor: pointer;
}

.faktura-export .faktura-export-card__header.collapsed {
    margin-bottom: 0;
    border-bottom: none;
}

.faktura-export .faktura-export-card__header:not(.collapsed) {
    margin-bottom: 0;
}

.faktura-export .faktura-export-card__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--l-text-muted);
    width: 14px;
    height: 14px;
    line-height: 0;
}

.faktura-export .faktura-export-card__info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.faktura-export .patient-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.faktura-export .patient-name-row .patient-name {
    min-width: 0;
    font-size: var(--l-text-sm);
    font-weight: 600;
    color: var(--l-text);
    line-height: 1.3;
}

.faktura-export .faktura-export-card__subtitle {
    color: var(--l-text-secondary);
    font-size: var(--l-text-xs);
    line-height: 1.35;
}

.faktura-export .faktura-export-card__issues {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1 0 100%;
    margin: 0;
    padding-left: 1.1rem;
    min-width: 0;
}

.faktura-export .faktura-export-card__issue {
    display: flex;
    align-items: flex-start;
    gap: 0.3rem;
    min-width: 0;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--l-error);
}

.faktura-export .faktura-export-card__issue.severity-warning {
    color: var(--l-warning);
}

.faktura-export .faktura-export-card__issue.severity-info {
    color: var(--l-info);
}

.faktura-export .faktura-export-card__issue-icon {
    flex-shrink: 0;
    width: 0.85rem;
    height: 0.85rem;
    margin-top: 0.1rem;
    color: inherit;
}

.faktura-export--embedded .faktura-export-card__issues {
    /* Chevron (14px) + Gap + Avatar — Align unter dem Schein-Titel */
    padding-left: calc(14px + 0.45rem + 1.625rem + 0.45rem);
}

.faktura-export--embedded .faktura-export-card__issue {
    font-size: 0.68rem;
}

.faktura-export .faktura-export-card__title--schein {
    font-size: var(--l-text-sm);
    font-weight: 600;
    color: var(--l-text);
}

.faktura-export .faktura-export-card__title-row {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.faktura-export .faktura-export-card__recipe-segment {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.faktura-export .faktura-export-card__recipe-sep {
    color: var(--l-text-secondary);
    font-weight: 500;
    user-select: none;
    padding: 0 0.1rem;
}

.faktura-export .faktura-export-card__title-row .faktura-export-card__title {
    min-width: 0;
}

.faktura-export .faktura-export-card__subtitle .faktura-export-card__title-row {
    display: flex;
}

.faktura-export .selection-summary {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    font-size: var(--l-text-xs);
    color: var(--l-text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.faktura-export .amount-review-date {
    font-size: var(--l-text-xs);
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.2;
    color: var(--l-text-muted);
    order: -1;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.faktura-export--embedded .amount-review-date {
    order: 0;
    max-width: 14rem;
    font-size: 0.7rem;
    color: var(--l-text-secondary);
}

.faktura-export--embedded .amount-review-date--short {
    display: none;
}

.faktura-export--embedded .faktura-export-selection-chip {
    order: -1;
}

.faktura-export .selection-summary--reviewed .amount-review-date {
    color: var(--l-success);
}

.faktura-export .selection-summary--export-ready .amount-review-date {
    color: var(--l-success);
}

.faktura-export .amount-review-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 2px 8px 2px 4px;
    border: 1px solid transparent;
    border-radius: var(--l-radius-full);
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: right;
    transition:
        background-color var(--l-transition-fast),
        border-color var(--l-transition-fast);
}

.faktura-export .amount-review-toggle:hover:not(:disabled) {
    background: color-mix(in srgb, var(--l-primary) 7%, transparent);
    border-color: color-mix(in srgb, var(--l-primary) 18%, transparent);
}

.faktura-export .amount-review-toggle:focus-visible {
    outline: none;
    box-shadow: var(--l-focus-ring);
}

.faktura-export .amount-review-toggle:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.faktura-export .amount-review-toggle.is-busy:disabled {
    cursor: wait;
}

.faktura-export .amount-review-body {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    justify-content: center;
}

.faktura-export .edit-patient-btn {
    background: transparent;
    border: none;
    color: var(--l-text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--l-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: color var(--l-transition-fast), background-color var(--l-transition-fast);
}

.faktura-export .edit-patient-btn:hover {
    color: var(--l-primary);
    background: var(--l-primary-soft);
}

.faktura-export .faktura-export-card__amount {
    font-weight: 600;
    font-size: 15px;
    color: var(--l-text);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    letter-spacing: -0.015em;
    transition: color var(--l-transition-fast);
}

.faktura-export .faktura-export-card__count {
    font-size: 10px;
    line-height: 1.15;
    color: var(--l-text-muted);
    font-variant-numeric: tabular-nums;
}

.faktura-export .amount-review-check {
    position: relative;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: color-mix(in srgb, var(--l-primary) 35%, var(--l-text-secondary));
}

.faktura-export .amount-review-check__ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.25px dashed color-mix(in srgb, var(--l-primary) 38%, var(--l-border));
    background: color-mix(in srgb, var(--l-bg) 40%, transparent);
    transition:
        border-color var(--l-transition-fast),
        border-style var(--l-transition-fast),
        background-color var(--l-transition-fast);
}

.faktura-export .amount-review-check > svg[blazicon] {
    position: relative;
    z-index: 1;
    width: 12px !important;
    height: 12px !important;
    opacity: 0.55;
    color: inherit;
    transition:
        color var(--l-transition-fast),
        opacity var(--l-transition-fast);
}

.faktura-export .amount-review-toggle:hover:not(:disabled) .amount-review-check {
    color: var(--l-primary);
}

.faktura-export .amount-review-toggle:hover:not(:disabled) .amount-review-check__ring {
    border-style: solid;
    border-color: var(--l-primary);
}

.faktura-export .amount-review-toggle:hover:not(:disabled) .amount-review-check > svg[blazicon] {
    opacity: 0.9;
}

/*
 * Prüf-Stufen (Icon immer Haken; Stufe über Ring + Pill):
 * ungeprüft: grau gestrichelt → prior: grün gestrichelt
 * → geprüft: heller Kreis + grüner Haken → zur Abrechnung: gefüllter Kreis + Kontrast-Haken.
 */
.faktura-export .selection-summary {
    --fv-review-pill-bg: color-mix(in srgb, var(--l-success-bg) 70%, transparent);
    --fv-review-pill-border: color-mix(in srgb, var(--l-success) 22%, transparent);
    --fv-review-pill-bg-hover: color-mix(in srgb, var(--l-success-bg) 90%, transparent);
    --fv-review-pill-border-hover: color-mix(in srgb, var(--l-success) 35%, transparent);
    --fv-review-marker: var(--l-success);
    --fv-review-marker-bg: color-mix(in srgb, var(--l-success-bg) 55%, var(--l-bg-elevated));
    --fv-review-icon: var(--l-success);
}

/* Teilweise geprüft / Änderung seit Prüfung: Ring bleibt gestrichelt, aber success-grün. */
.faktura-export .selection-summary--prior-review .amount-review-check {
    color: color-mix(in srgb, var(--l-success) 62%, var(--l-text-secondary));
}

.faktura-export .selection-summary--prior-review .amount-review-check__ring {
    border-style: dashed;
    border-color: color-mix(in srgb, var(--l-success) 52%, transparent);
    background: color-mix(in srgb, var(--l-success-bg) 45%, transparent);
}

.faktura-export .selection-summary--prior-review .amount-review-toggle:hover:not(:disabled) .amount-review-check {
    color: var(--l-success);
}

.faktura-export .selection-summary--prior-review .amount-review-toggle:hover:not(:disabled) .amount-review-check__ring {
    border-style: dashed;
    border-color: var(--l-success);
}

.faktura-export .selection-summary--prior-review .amount-review-check > svg[blazicon] {
    opacity: 0.75;
}

.faktura-export .selection-summary--export-ready {
    --fv-review-pill-bg: color-mix(in srgb, var(--l-success-bg) 90%, transparent);
    --fv-review-pill-border: color-mix(in srgb, var(--l-success) 28%, transparent);
    --fv-review-pill-bg-hover: var(--l-success-bg);
    --fv-review-pill-border-hover: color-mix(in srgb, var(--l-success) 45%, transparent);
    --fv-review-marker: var(--l-success);
    --fv-review-marker-bg: var(--l-success);
    /* Auf gefülltem Success: Theme-Kontrast (hell/dunkel), kein hartes #fff. */
    --fv-review-icon: var(--l-text-on-primary);
}

.faktura-export .selection-summary--reviewed .amount-review-toggle,
.faktura-export .selection-summary--export-ready .amount-review-toggle {
    background: var(--fv-review-pill-bg);
    border-color: var(--fv-review-pill-border);
}

.faktura-export .selection-summary--reviewed .amount-review-toggle:hover:not(:disabled),
.faktura-export .selection-summary--export-ready .amount-review-toggle:hover:not(:disabled) {
    background: var(--fv-review-pill-bg-hover);
    border-color: var(--fv-review-pill-border-hover);
}

.faktura-export .selection-summary--reviewed .faktura-export-card__amount,
.faktura-export .selection-summary--export-ready .faktura-export-card__amount {
    color: var(--l-text);
}

.faktura-export .selection-summary--reviewed .amount-review-check__ring,
.faktura-export .selection-summary--export-ready .amount-review-check__ring {
    border-style: solid;
    border-color: var(--fv-review-marker);
    background: var(--fv-review-marker-bg);
}

.faktura-export .selection-summary--reviewed .amount-review-check,
.faktura-export .selection-summary--export-ready .amount-review-check {
    color: var(--fv-review-icon);
}

.faktura-export .selection-summary--reviewed .amount-review-check > svg[blazicon],
.faktura-export .selection-summary--export-ready .amount-review-check > svg[blazicon] {
    color: var(--fv-review-icon) !important;
    opacity: 1;
}

.faktura-export .selection-summary--reviewed .amount-review-check > svg[blazicon] :is(path, line, circle, polyline, polygon),
.faktura-export .selection-summary--export-ready .amount-review-check > svg[blazicon] :is(path, line, circle, polyline, polygon) {
    stroke: var(--fv-review-icon) !important;
}

.faktura-export .selection-summary--reviewed .amount-review-check__ring {
    border-width: 1.5px;
}

.faktura-export .selection-summary--reviewed .amount-review-toggle:hover:not(:disabled) .amount-review-check__ring {
    background: color-mix(in srgb, var(--l-success-bg) 75%, var(--l-bg-elevated));
    border-color: color-mix(in srgb, var(--l-success) 85%, var(--l-success-hover));
}

.faktura-export .selection-summary--export-ready .amount-review-date {
    color: var(--l-success);
}

.faktura-export .billing-notes-banner {
    background-color: var(--l-warning-bg);
    border: 1px solid var(--l-warning);
    border-radius: var(--l-radius-md);
    padding: 8px 12px;
    margin: 8px 0;
    color: var(--l-warning);
    font-size: 13px;
    line-height: 1.4;
}

.faktura-export .missing-data-banner {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    border-radius: var(--l-radius-sm);
    padding: 5px 8px;
    margin: 0;
    font-size: 11.5px;
    line-height: 1.35;
    flex-wrap: wrap;
}

.faktura-export .missing-data-banner--card {
    border-radius: var(--l-radius-sm);
}

.faktura-export .missing-data-banner__icon {
    flex-shrink: 0;
    margin-top: 1px;
    width: 14px;
    height: 14px;
    line-height: 0;
}

.faktura-export .missing-data-banner__icon svg {
    width: 14px;
    height: 14px;
}

.faktura-export .missing-data-banner__text,
.faktura-export .missing-data-banner__content {
    min-width: 0;
    flex: 1;
}

.faktura-export .missing-data-banner__content p {
    margin: 4px 0 0;
    color: inherit;
    opacity: 0.9;
}

.faktura-export .missing-data-banner.severity-error {
    background: var(--l-error-bg);
    border: 1px solid var(--l-error);
    color: var(--l-error);
}

.faktura-export .missing-data-banner.severity-warning {
    background: var(--l-warning-bg);
    border: 1px solid var(--l-warning);
    color: var(--l-warning);
}

.faktura-export .missing-data-banner.severity-info {
    background: var(--l-info-bg);
    border: 1px solid var(--l-info);
    color: var(--l-info);
}

.faktura-export .billing-inline-hint {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
    font-size: 11px;
    line-height: 1.3;
    max-width: 100%;
}

.faktura-export .billing-inline-hint svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.faktura-export .billing-inline-hint__text {
    white-space: normal;
}
