/* QuickPay EOB summary button and bottom sheet.
   Shared by RexPay.QuickPay.Portal (Shared/PaymentFlow/BillDetails.razor) and the Support Portal EOB
   preview tools, so both render the same component with the same styles. Colours come from the
   host's --rh-* variables. The modal chrome, pay footer and inline payment panel stay in QuickPay's
   site.css because only QuickPay renders them. */

.eob-summary-button {
    width: 100%;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 12px;
    align-items: center;
    gap: 10px;
    margin: 14px 0 14px;
    padding: 12px;
    border: 1px solid #B9E2E8;
    border-radius: 16px;
    background: var(--rh-bg-tint);
    color: var(--rh-text);
    text-align: left;
    cursor: pointer;
    box-shadow: none;
}

.eob-summary-button:hover,
.eob-summary-button:focus {
    outline: none;
    border-color: var(--rh-primary);
    box-shadow: 0 0 0 3px var(--rh-primary-lighter);
}

.eob-summary-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--rh-primary);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.eob-summary-icon svg {
    width: 24px;
    height: 24px;
}

.eob-summary-icon path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.eob-summary-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.eob-summary-title {
    color: var(--rh-text);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
}

.eob-summary-headline {
    color: var(--rh-muted);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
}

.eob-summary-headline strong {
    color: var(--rh-primary-dark);
    font-weight: 800;
}

.eob-summary-chevron {
    width: 12px;
    height: 12px;
    border-right: 3px solid var(--rh-primary);
    border-top: 3px solid var(--rh-primary);
    transform: rotate(45deg);
    justify-self: end;
}

.eob-bottom-sheet {
    padding: 18px 18px 58px;
}

.eob-hero {
    background: linear-gradient(135deg, var(--rh-primary), var(--rh-primary-dark));
    border-radius: 18px;
    color: #ffffff;
    padding: 18px;
}

.eob-hero-label {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.9;
}

.eob-hero-amount {
    font-size: 42px;
    font-weight: 900;
    line-height: 1.05;
    margin-top: 8px;
}

.eob-hero-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 2px solid rgba(255, 255, 255, 0.25);
    font-size: 16px;
    line-height: 1.2;
}

.eob-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    font-size: 15px;
    font-weight: 800;
    white-space: nowrap;
}

/* Coverage statement between the hero and the split. */
.eob-coverage {
    margin-top: 14px;
    padding: 0 2px;
}

.eob-coverage p {
    margin: 0;
}

.eob-coverage-lead {
    color: var(--rh-text);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

.eob-coverage .eob-coverage-body {
    margin-top: 4px;
    color: var(--rh-muted);
    font-size: 13px;
    line-height: 1.4;
}

/* The split sits straight on the sheet, as the prototype has it: a thin bar and a two-column legend. */
.eob-split {
    margin-top: 18px;
    padding: 0 2px;
}

.eob-split h4 {
    margin: 0 0 8px;
    color: var(--rh-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.eob-split-bar {
    display: flex;
    width: 100%;
    height: 9px;
    overflow: hidden;
    border-radius: 6px;
    background: #F0F4F5;
}

.eob-split-segment {
    min-width: 0;
}

/* Fixed brand colours (docs/brand-guidelines.md), chosen by Product in story 8552 as the split that stays
   readable for colour-blind and low-vision patients: Indigo, Spearmint, Clay step dark / light / dark.
   Deliberately not var(--rh-primary) - a provider's teal sat too close to the neighbouring segments. */
.eob-split-segment-paid,
.eob-legend-dot-paid {
    background: #2B4BB5;
}

.eob-split-segment-discount,
.eob-legend-dot-discount {
    background: #00A5AD;
}

.eob-split-segment-patient,
.eob-legend-dot-patient {
    background: #B05435;
}

.eob-split-legend {
    margin-top: 10px;
}

.eob-split-legend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
    font-size: 14px;
}

.eob-split-legend-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: var(--rh-text);
    overflow-wrap: anywhere;
}

.eob-split-legend strong {
    color: var(--rh-text);
    font-weight: 800;
    white-space: nowrap;
}

.eob-split-legend .eob-you-owe {
    color: #B05435;
}

.eob-legend-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Per-plan contributions on a multi-payer claim, in their own section under the split so the
   three-way split a patient already knows stays the headline. One tinted row per plan. */
.eob-plans {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--rh-border);
}

.eob-plans-title {
    margin: 0 0 8px;
    color: var(--rh-text);
    font-size: 15px;
    font-weight: 800;
}

.eob-plan-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #F4F5F5;
    --eob-plan-ink: var(--rh-text);
}

.eob-plan-row--primary {
    background: var(--rh-bg-tint);
    --eob-plan-ink: var(--rh-primary);
}

.eob-plan-row--secondary {
    background: #EEF0F5;
    --eob-plan-ink: #1B2A4A;
}

.eob-plan-who,
.eob-plan-paid {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.eob-plan-paid {
    text-align: right;
}

.eob-plan-sequence {
    color: var(--eob-plan-ink);
    font-size: 14px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.eob-plan-name {
    color: var(--eob-plan-ink);
    font-size: 12px;
    line-height: 1.3;
    opacity: 0.8;
    overflow-wrap: anywhere;
}

.eob-plan-amount {
    color: var(--rh-text);
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.eob-plan-status {
    color: var(--rh-muted);
    font-size: 11px;
    white-space: nowrap;
}

.eob-bottom-sheet-section-title {
    margin: 22px 0 10px;
    color: var(--rh-text);
    font-size: 20px;
    font-weight: 800;
}

.eob-line-table {
    width: 100%;
    overflow-x: visible;
}

.eob-line-table-header,
.eob-line-table-row {
    display: grid;
    grid-template-columns: minmax(82px, 1.5fr) repeat(4, minmax(0, 0.75fr));
    gap: 6px;
    align-items: start;
    width: 100%;
}

.eob-line-table-header {
    padding: 10px 0 12px;
    border-bottom: 1px solid var(--rh-border);
    color: var(--rh-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
}

.eob-line-table-header span:not(:first-child),
.eob-line-table-row span:not(:first-child) {
    text-align: right;
}

.eob-line-table-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--rh-border);
    color: #314A54;
    font-size: 13px;
    line-height: 1.25;
}

.eob-line-table-header span,
.eob-line-table-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.eob-line-table-row strong {
    color: var(--rh-text);
    font-weight: 800;
}

/* Plan heading above that plan's lines. A full-width band rather than a grid row, so it never
   lines up with the money columns and cannot be misread as a service. */
.eob-line-table-group {
    display: block;
    padding: 12px 0 6px;
    color: var(--rh-primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.eob-line-table-group span {
    overflow-wrap: anywhere;
}

/* What one plan sent on to the next, between their groups. Full width like the group heading, so it
   never lines up with a money column. */
.eob-line-handoff {
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid var(--rh-border);
    color: var(--rh-muted);
    font-size: 13px;
    text-align: center;
}

.eob-line-handoff strong {
    color: var(--rh-text);
    font-weight: 800;
}

/* Multi-payer line items: one tinted block per plan, each line told in words. Tints match the
   "What each plan paid" rows so a plan reads as the same colour all the way down the sheet. */
.eob-lines-title {
    margin-top: 22px;
}

.eob-payer-lines {
    border-radius: 8px;
    background: #F4F5F5;
    --eob-plan-ink: var(--rh-text);
}

.eob-payer-lines--primary {
    background: var(--rh-bg-tint);
    --eob-plan-ink: var(--rh-primary);
}

.eob-payer-lines--secondary {
    background: #EEF0F5;
    --eob-plan-ink: #1B2A4A;
}

.eob-payer-lines-head {
    padding: 8px 14px 4px;
    color: var(--eob-plan-ink);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.eob-payer-line {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 8px 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    color: #314A54;
    font-size: 13px;
    line-height: 1.3;
}

.eob-payer-line strong {
    color: var(--rh-text);
    font-weight: 800;
}

.eob-payer-line-outcome {
    display: grid;
    gap: 2px;
    text-align: right;
}

.eob-payer-line-extra {
    color: var(--rh-muted);
    font-size: 12px;
}

/* Between two plans' blocks the handoff is a caption, not a table row. */
.eob-payer-lines-list .eob-line-handoff {
    border-bottom: none;
}

.eob-line-service {
    display: grid;
    gap: 4px;
}

.eob-line-service > span {
    color: var(--rh-muted);
    font-size: 11px;
}

/* CPT code as the line's anchor, with its description either under it (.eob-cpt-desc) or behind an
   "i" tooltip - see QuickPayEobDisplayOptions. The generic `.eob-line-table-row span:not(:first-child)`
   rule right-aligns nested spans, hence the explicit text-align on both. */
.eob-line-service {
    position: relative;
}

.eob-cpt-code {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.eob-line-table-row .eob-cpt-desc,
.eob-payer-line .eob-cpt-desc {
    color: var(--rh-muted);
    font-size: 11px;
    line-height: 1.35;
    text-align: left;
}

.eob-cpt-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 24px keeps a comfortable tap target on a phone. */
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #DCE0E3;
    color: #1B2A4A;
    font-family: Georgia, serif;
    font-size: 12px;
    font-style: italic;
    font-weight: 800;
    line-height: 1;
    cursor: help;
}

.eob-cpt-info:hover,
.eob-cpt-info:focus-visible,
.eob-cpt-info.is-open {
    outline: none;
    background: var(--rh-primary);
    color: #ffffff;
}

/* Anchored inside the service cell (the leftmost column) rather than a fixed overlay: it cannot run off
   the sheet's left edge, and on the last row it extends the scrolling body instead of being clipped. */
.eob-line-table-row .eob-cpt-tip,
.eob-payer-line .eob-cpt-tip {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 5;
    width: max-content;
    max-width: min(240px, calc(100vw - 56px));
    padding: 10px 13px;
    border-radius: 8px;
    background: #1B2A4A;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    text-align: left;
    overflow-wrap: normal;
}

.eob-line-table-row .eob-cpt-tip::after,
.eob-payer-line .eob-cpt-tip::after {
    content: "";
    position: absolute;
    top: -12px;
    left: 18px;
    border: 6px solid transparent;
    border-bottom-color: #1B2A4A;
}

.eob-cpt-info:hover + .eob-cpt-tip,
.eob-cpt-info:focus-visible + .eob-cpt-tip,
.eob-line-table-row .eob-cpt-tip.is-open,
.eob-payer-line .eob-cpt-tip.is-open {
    display: block;
}

/* A line whose balance went to the patient's other plan. Deliberately not styled like the amounts
   in the same column that they do owe - the figure is there to explain where the money went, and
   reading it as a charge is the exact confusion this is here to prevent. */
.eob-line-passed-on {
    display: grid;
    gap: 2px;
}

.eob-line-passed-on > span {
    color: var(--rh-muted);
    font-size: 11px;
    line-height: 1.3;
}

.eob-helper-banner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    margin-top: 18px;
    padding: 14px;
    border-radius: 14px;
    background: var(--rh-bg-tint);
}

.eob-helper-banner > span {
    width: 24px;
    height: 24px;
    border: 2px solid var(--rh-primary);
    border-radius: 50%;
    color: var(--rh-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
}

.eob-helper-banner p {
    margin: 0;
    color: var(--rh-text);
    font-size: 15px;
    line-height: 1.45;
}

@media (max-width: 420px) {
    .eob-summary-button {
        grid-template-columns: 38px minmax(0, 1fr) 10px;
        gap: 9px;
        padding: 10px;
        border-radius: 14px;
    }

    .eob-summary-icon {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }

    .eob-summary-title {
        font-size: 15px;
    }

    .eob-summary-headline {
        font-size: 13px;
    }

    .eob-bottom-sheet {
        padding: 16px 14px 54px;
    }

    .eob-hero {
        border-radius: 16px;
        padding: 16px;
    }

    .eob-hero-amount {
        font-size: 38px;
    }

    .eob-hero-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        font-size: 15px;
    }

    .eob-split-legend-row {
        font-size: 13px;
    }

    .eob-line-table-header {
        font-size: 9px;
    }

    .eob-line-table-row {
        font-size: 12px;
        gap: 5px;
    }

    .eob-helper-banner p {
        font-size: 14px;
    }
}
