/* ==========================================================================
   Shared valuation dialogs - companion to the valuation explorer.

   Existing markup contract (no Razor changes required):
     .val-dialog > .val-header + .val-body + .val-footer

   Load globally AFTER the Radzen theme and radzen-overrides.css.
   Radzen control refinements are scoped to .val-dialog. Button variants,
   validation, disabled states, floating-label positions, dialog title bars
   and popup positioning remain owned by Radzen / the existing markup.
   The unrelated styles below .ai-planning are intentionally unchanged.
   ========================================================================== */

/* ---- Shell and local theme ---- */

.val-dialog {
    --val-accent: var(--rz-primary, #116471);
    --val-ink: var(--rz-text-color, #252b38);
    --val-muted: #626b7c;
    --val-line: #e3e6ec;
    --val-paper: #fff;
    --val-soft: #fafbfc;
    --val-radius: 8px;
    --val-inset: 28px;
    --rz-input-background-color: var(--val-paper);
    --rz-input-hover-background-color: #f8fcfd;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    background: var(--val-paper);
    color: var(--val-ink);
    font-family: inherit;
    line-height: 1.5;
    box-sizing: border-box;
}

    .val-dialog *,
    .val-dialog *::before,
    .val-dialog *::after {
        box-sizing: border-box;
    }

/* ---- Header ---- */

.val-header {
    flex: 0 0 auto;
    padding: 24px var(--val-inset, 28px);
    background: var(--val-paper, #fff);
    border-bottom: 1px solid var(--val-line, #e3e6ec);
}

.val-header-title {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

    .val-header-title > :not(.val-header-icon) {
        min-width: 0;
    }

.val-header-icon {
    flex: 0 0 auto;
    font-size: 1.5rem;
    color: var(--val-accent, var(--rz-primary, #116471));
}

.val-header-title h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 650;
    letter-spacing: -0.025em;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.val-header-title p {
    margin: 6px 0 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--val-muted, #626b7c);
    overflow-wrap: anywhere;
}

/* ---- Scrollable body and quiet section surfaces ---- */

.val-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 24px var(--val-inset, 28px);
    gap: 20px;
}

.val-section {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    min-width: 0;
    gap: 22px;
    padding: 22px;
    background: var(--val-soft, #fafbfc);
    border: 1px solid var(--val-line, #e3e6ec);
    border-radius: var(--val-radius, 8px);
}

.val-section-title {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.075em;
    line-height: 1.5;
    color: var(--val-muted, #626b7c);
}

/* ---- Field layout helpers ---- */

.val-field {
    width: 100%;
    min-width: 0;
}

.val-field-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 22px;
    min-width: 0;
}

    .val-field-row > * {
        flex: 1 1 240px;
        min-width: 0;
    }

.val-field-spacer {
    visibility: hidden;
}

.val-field-with-note {
    display: flex;
    flex-direction: column;
    flex: 1 1 240px;
    min-width: 0;
    gap: 6px;
}

/* Keep the existing form-field layout, including Radzen's floating labels.
   Do not override label top/transform or input validation borders. */
.val-dialog .rz-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

    .val-dialog .rz-form-field .rz-form-field-label,
    .val-dialog .rz-form-field label {
        margin-bottom: 0.4rem;
        font-weight: 600;
        font-size: 0.85rem;
    }

.val-dialog input,
.val-dialog textarea,
.val-dialog [contenteditable="true"] {
    caret-color: var(--val-ink);
}

/* An inset ring stays visible inside scrolling sections. Do not replace
   Radzen's error, disabled, hover or selected colors. */
.val-dialog :is(input, textarea, select, button, a[href], [tabindex], [contenteditable="true"]):focus-visible {
    outline: 2px solid var(--val-accent);
    outline-offset: -2px;
}

/* Medium-sized actions without changing Primary/Secondary/Danger semantics.
   Grid actions and input spinner/dropdown buttons retain their own sizing. */
.val-dialog :is(.val-header, .val-footer, .val-attachment-actions, .val-add-user, .val-empty-state) .rz-button {
    min-height: 40px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
}

    .val-dialog :is(.val-header, .val-footer, .val-attachment-actions, .val-add-user, .val-empty-state) .rz-button .rz-button-text {
        white-space: normal;
        line-height: 1.4;
        letter-spacing: normal;
    }

/* ---- Inline notes ---- */

.val-note {
    padding: 2px 0;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.val-note-warning {
    color: #9a5707;
}

.val-note-recommended {
    color: #15703b;
}

/* ---- Attachments ---- */

.val-attachment {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    min-width: 0;
    padding: 12px 14px;
    background: var(--val-paper, #fff);
    border: 1px solid var(--val-line, #e3e6ec);
    border-radius: var(--val-radius, 8px);
}

.val-attachment-info {
    display: flex;
    align-items: center;
    flex: 1 1 180px;
    gap: 9px;
    min-width: 0;
}

    .val-attachment-info > .rz-icon {
        flex: 0 0 auto;
        color: var(--val-muted, #626b7c);
    }

.val-attachment-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.875rem;
}

.val-attachment-empty {
    font-size: 0.875rem;
    font-style: normal;
    color: var(--val-muted, #626b7c);
}

.val-attachment-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.val-hint {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--val-muted, #626b7c);
    overflow-wrap: anywhere;
}

    .val-hint .rz-icon {
        flex-shrink: 0;
        margin-top: 1px;
        font-size: 1.1rem;
        color: var(--val-muted, #626b7c);
    }

/* ---- Add-user row and embedded grid ---- */

.val-add-user {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    min-width: 0;
    margin-bottom: 4px;
}

    .val-add-user > .val-field,
    .val-add-user > .rz-form-field {
        flex: 1 1 240px;
        min-width: 0;
    }

.val-grid {
    min-width: 0;
    border-radius: var(--val-radius, 8px);
    overflow: hidden;
}

/* ---- Progress and empty states ---- */

.val-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px 16px;
    color: var(--val-muted, #626b7c);
    text-align: center;
}

.val-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 24px;
    gap: 10px;
}

.val-empty-icon {
    font-size: 2rem;
    color: var(--val-muted, #626b7c);
}

.val-empty-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.val-empty-text {
    margin: 0;
    max-width: 420px;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--val-muted, #626b7c);
}

.val-empty-example {
    margin-top: 10px;
}

/* ---- Footer: stable while the body scrolls ---- */

.val-footer {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-top: auto;
    padding: 18px var(--val-inset, 28px);
    border-top: 1px solid var(--val-line, #e3e6ec);
    background: var(--val-paper, #fff);
}

    .val-footer > * {
        min-width: 0;
        max-width: 100%;
    }

    .val-footer > .rz-stack {
        flex-wrap: wrap;
        gap: 10px;
    }

.val-footer-note {
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--val-muted, #626b7c);
    overflow-wrap: anywhere;
}

/* ---- Switch rows ---- */

.val-switch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

    .val-switch-row > .rz-switch {
        flex-shrink: 0;
    }

.val-switch-row-spread {
    justify-content: space-between;
}

/* ---- Small screens ---- */

@media (max-width: 600px) {
    .val-dialog {
        --val-inset: 18px;
    }

    .val-header {
        padding-block: 20px;
    }

    .val-header-title {
        align-items: flex-start;
        gap: 10px;
    }

        .val-header-title h2 {
            font-size: 1.25rem;
        }

    .val-body {
        padding-block: 18px;
        gap: 16px;
    }

    .val-section {
        padding: 18px 16px;
        gap: 20px;
    }

    .val-field-row > * {
        flex-basis: 100%;
    }

    .val-field-spacer {
        display: none;
    }

    .val-footer {
        padding-block: 16px;
    }

    .val-footer-note {
        flex-basis: 100%;
    }

    .val-empty-state {
        padding: 28px 12px;
    }
}

.ai-planning {
    --ap-surface: var(--rz-base-background-color, #ffffff);
    --ap-muted-surface: var(--rz-base-50, #f7f9fb);
    --ap-border: var(--rz-border-color, #dce3eb);
    --ap-text: var(--rz-text-color, #24344a);
    --ap-muted: var(--rz-text-secondary-color, #627184);
    --ap-accent: var(--rz-primary, #355f91);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-bottom: 2rem;
    color: var(--ap-text);
}

    .ai-planning .ap-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .ai-planning .ap-heading {
        margin: 0;
        font-family: inherit;
        font-size: 1.3rem;
        font-weight: 650;
        letter-spacing: -0.025em;
        line-height: 1.35;
    }

    .ai-planning .ap-subtitle {
        margin: 0.4rem 0 0;
        color: var(--ap-muted);
        font-size: 0.875rem;
        line-height: 1.55;
    }

    .ai-planning .ap-actions {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .ai-planning .ap-alerts {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

        .ai-planning .ap-alerts .rz-alert {
            margin: 0;
            border-radius: 8px;
        }

    .ai-planning .ap-panel {
        min-width: 0;
        background: var(--ap-surface);
        border: 1px solid var(--ap-border);
        border-radius: 10px;
        overflow: hidden;
    }

    .ai-planning .ap-panel-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 1.2rem 1.4rem;
        border-bottom: 1px solid var(--ap-border);
    }

    .ai-planning .ap-section-title {
        margin: 0;
        font-size: 0.95rem;
        font-weight: 600;
        letter-spacing: -0.01em;
        line-height: 1.5;
    }

    .ai-planning .ap-help {
        margin: 0.3rem 0 0;
        color: var(--ap-muted);
        font-size: 0.8125rem;
        line-height: 1.6;
    }

    .ai-planning .ap-grid-scroll {
        max-width: 100%;
        overflow-x: auto;
    }

    .ai-planning .ap-grid {
        border: 0;
        border-radius: 0;
        background: var(--ap-surface);
    }

        .ai-planning .ap-grid .rz-grid-table {
            table-layout: fixed;
        }

            .ai-planning .ap-grid .rz-grid-table thead th {
                padding: 0.85rem 1rem;
                background: var(--ap-muted-surface);
                color: var(--ap-muted);
                font-size: 0.75rem;
                font-weight: 600;
                border-bottom: 1px solid var(--ap-border);
            }

            .ai-planning .ap-grid .rz-grid-table tbody > tr > td {
                padding: 1rem;
                vertical-align: middle;
            }

    .ai-planning .ap-metric {
        display: block;
        color: var(--ap-text);
        font-size: 0.875rem;
        font-weight: 600;
        white-space: nowrap;
    }

    .ai-planning .ap-metric-detail {
        display: block;
        margin-top: 0.25rem;
        color: var(--ap-muted);
        font-size: 0.75rem;
        font-weight: 400;
        white-space: nowrap;
    }

    .ai-planning .ap-value {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        min-width: 0;
    }

        .ai-planning .ap-value .rz-chkbox {
            flex: 0 0 auto;
        }

        .ai-planning .ap-value .rz-numeric {
            flex: 1 1 auto;
            min-width: 0;
            border-radius: 6px;
            box-shadow: none;
        }

            .ai-planning .ap-value .rz-numeric input {
                text-align: right;
                font-variant-numeric: tabular-nums;
            }

        .ai-planning .ap-value.is-excluded .rz-numeric {
            background: var(--ap-muted-surface);
        }

    .ai-planning .ap-footnote {
        display: flex;
        align-items: flex-start;
        gap: 0.6rem;
        padding: 0.85rem 1.4rem;
        border-top: 1px solid var(--ap-border);
        background: var(--ap-muted-surface);
        color: var(--ap-muted);
        font-size: 0.775rem;
        line-height: 1.6;
    }

        .ai-planning .ap-footnote .rz-icon {
            margin-top: 0.1rem;
            font-size: 1rem;
            flex: 0 0 auto;
        }

    .ai-planning .ap-description {
        padding: 1.25rem 1.4rem;
        color: var(--ap-muted);
        font-size: 0.9rem;
        line-height: 1.8;
        overflow-wrap: anywhere;
        overflow-x: auto;
    }

        .ai-planning .ap-description > :first-child {
            margin-top: 0;
        }

        .ai-planning .ap-description > :last-child {
            margin-bottom: 0;
        }

        .ai-planning .ap-description h1,
        .ai-planning .ap-description h2,
        .ai-planning .ap-description h3,
        .ai-planning .ap-description h4 {
            color: var(--ap-text);
            font-size: 1rem;
            font-weight: 600;
            line-height: 1.5;
            margin: 1.4rem 0 0.5rem;
        }

        .ai-planning .ap-description p {
            margin: 0 0 0.9rem;
        }

        .ai-planning .ap-description ul,
        .ai-planning .ap-description ol {
            padding-left: 1.25rem;
        }

        .ai-planning .ap-description li + li {
            margin-top: 0.3rem;
        }

    .ai-planning .ap-comments {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
    }

        .ai-planning .ap-comments .rz-textarea {
            padding: 0.9rem 1rem;
            border-radius: 8px;
            box-shadow: none;
            font-family: inherit;
            font-size: 0.875rem;
            line-height: 1.65;
        }

    .ai-planning :is(button, input, textarea, [tabindex]):focus-visible {
        outline: 2px solid var(--ap-accent);
        outline-offset: 3px;
    }

    .ai-planning .ap-sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

@media (max-width: 640px) {
    .ai-planning .ap-header {
        flex-direction: column;
    }

    .ai-planning .ap-panel-header,
    .ai-planning .ap-description {
        padding: 1rem;
    }

    .ai-planning .ap-footnote {
        padding: 0.85rem 1rem;
    }
}

/* Integrated Radzen controls. Load as a global stylesheet, not isolated CSS. */
.ai-planning .ap-value {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    min-width: 0;
}

    /* Preserve Radzen's themed field styling; only join the adjacent edges. */
    .ai-planning .ap-value > .rz-numeric {
        flex: 1 1 0;
        min-width: 0;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
        border-top-left-radius: var(--rz-border-radius, 4px);
        border-bottom-left-radius: var(--rz-border-radius, 4px);
    }

.ai-planning .ap-apply-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--ap-border);
}

.ai-planning .ap-value > .rz-button.ap-period-toggle {
    flex: 0 0 32px;
    width: 32px;
    min-width: 32px;
    height: auto;
    min-height: 32px;
    align-self: stretch;
    margin-left: -1px;
    padding: 0;
    border-radius: 0 var(--rz-border-radius, 4px) var(--rz-border-radius, 4px) 0;
    border-color: var(--rz-border-color);
    box-shadow: none;
}

    .ai-planning .ap-value > .rz-button.ap-period-toggle .rz-button-box {
        justify-content: center;
    }

    .ai-planning .ap-value > .rz-button.ap-period-toggle .rz-button-icon-left {
        margin: 0;
    }

    .ai-planning .ap-value > .rz-button.ap-period-toggle:focus-visible {
        position: relative;
        z-index: 1;
        outline: 2px solid var(--rz-primary);
        outline-offset: 2px;
    }

/* EBITDA mode: quiet, text-only state button */
.rz-button.ebitda-mode-button {
    --mode-bg: #f8fafc;
    --mode-text: #526174;
    --mode-border: #dce3eb;
    --mode-hover-bg: #eef2f6;
    --mode-hover-border: #b8c4d2;
    min-width: 104px;
    min-height: 30px;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--mode-border) !important;
    border-radius: 6px;
    background: var(--mode-bg) !important;
    color: var(--mode-text) !important;
    box-shadow: none !important;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: normal;
    text-transform: none;
    transition: background-color 140ms ease, border-color 140ms ease;
}

    /* Manual mode: understated blue, not a solid primary button */
    .rz-button.ebitda-mode-button.is-manual {
        --mode-bg: #edf4fc;
        --mode-text: #315d89;
        --mode-border: #bed1e6;
        --mode-hover-bg: #e2edf9;
        --mode-hover-border: #93b3d5;
    }

    /* Override theme hover/pressed colors without changing the text */
    .rz-button.ebitda-mode-button:not(:disabled):not(.rz-state-disabled):hover,
    .rz-button.ebitda-mode-button:not(:disabled):not(.rz-state-disabled):active {
        background: var(--mode-hover-bg) !important;
        border-color: var(--mode-hover-border) !important;
        color: var(--mode-text) !important;
        box-shadow: none !important;
    }

    /* Keep a visible keyboard focus indicator */
    .rz-button.ebitda-mode-button:focus-visible {
        outline: 2px solid #648ab2 !important;
        outline-offset: 2px;
    }

    /* Preserve the visible mode when the plan is finalized */
    .rz-button.ebitda-mode-button:disabled,
    .rz-button.ebitda-mode-button.rz-state-disabled {
        background: var(--mode-bg) !important;
        border-color: var(--mode-border) !important;
        color: var(--mode-text) !important;
        opacity: 0.55;
        cursor: not-allowed;
        box-shadow: none !important;
    }

@media (prefers-reduced-motion: reduce) {
    .rz-button.ebitda-mode-button {
        transition: none;
    }
}

/* Compact underlined mode: no box, only the current state */
.rz-button.ebitda-mode-button {
    --mode-text: #64748b;
    --mode-line: #cbd5e1;
    min-width: 0;
    width: 84px;
    min-height: 30px;
    padding: 0.3rem 0.15rem;
    border: 0 !important;
    border-radius: 0;
    background: transparent !important;
    color: var(--mode-text) !important;
    position: relative;
}

    /* Short underline, centered independently of the label */
    .rz-button.ebitda-mode-button::after {
        content: "";
        position: absolute;
        bottom: 1px;
        left: 50%;
        width: 24px;
        height: 2px;
        border-radius: 2px;
        background: var(--mode-line);
        transform: translateX(-50%);
        transition: width 140ms ease;
    }

    .rz-button.ebitda-mode-button.is-manual {
        --mode-text: #315d89;
        --mode-line: #648ab2;
    }

    .rz-button.ebitda-mode-button:not(:disabled):not(.rz-state-disabled):hover,
    .rz-button.ebitda-mode-button:not(:disabled):not(.rz-state-disabled):active {
        background: transparent !important;
        color: var(--mode-text) !important;
        border: 0 !important;
    }

        .rz-button.ebitda-mode-button:not(:disabled):not(.rz-state-disabled):hover::after {
            width: 40px;
        }

    .rz-button.ebitda-mode-button:disabled,
    .rz-button.ebitda-mode-button.rz-state-disabled {
        background: transparent !important;
        border: 0 !important;
    }

@media (prefers-reduced-motion: reduce) {
    .rz-button.ebitda-mode-button::after {
        transition: none;
    }
}

.ebitda-mode-choices {
    display: inline-grid;
    grid-template-columns: 74px 48px;
    gap: 6px;
    width: 128px;
    align-items: stretch;
}

    /* Quiet text choices, with no theme-colored hover */
    .ebitda-mode-choices .rz-button.ebitda-mode-choice {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-width: 0;
        min-height: 30px;
        margin: 0;
        padding: 5px 0;
        border: 0 !important;
        border-radius: 0;
        background: transparent !important;
        color: #64748b !important;
        box-shadow: none !important;
        font-family: inherit;
        font-size: 11.5px;
        font-weight: 500;
        line-height: 18px;
        letter-spacing: 0;
        text-transform: none;
        white-space: nowrap;
    }

    .ebitda-mode-choices .ebitda-mode-choice .rz-button-text {
        padding: 0;
        color: inherit;
        font: inherit;
    }

    /* Underline stays within the selected label's area */
    .ebitda-mode-choices .ebitda-mode-choice::after {
        content: "";
        position: absolute;
        bottom: 0;
        left: 6px;
        right: 6px;
        height: 2px;
        border-radius: 2px;
        background: transparent;
    }

    .ebitda-mode-choices .rz-button.ebitda-mode-choice.is-selected {
        color: #315d89 !important;
    }

    .ebitda-mode-choices .ebitda-mode-choice.is-selected::after {
        background: #648ab2;
    }

    .ebitda-mode-choices .rz-button.ebitda-mode-choice:not(:disabled):not(.rz-state-disabled):hover,
    .ebitda-mode-choices .rz-button.ebitda-mode-choice:not(:disabled):not(.rz-state-disabled):active {
        background: transparent !important;
        color: #315d89 !important;
        box-shadow: none !important;
    }

    .ebitda-mode-choices .ebitda-mode-choice:focus-visible {
        outline: 2px solid #648ab2 !important;
        outline-offset: 2px;
        border-radius: 3px;
    }

    .ebitda-mode-choices .ebitda-mode-choice:disabled,
    .ebitda-mode-choices .ebitda-mode-choice.rz-state-disabled {
        opacity: 0.55;
        cursor: not-allowed;
    }

/* Both full labels, stacked to fit narrow year columns */
.ebitda-mode-choices {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    width: 84px;
}

    .ebitda-mode-choices .rz-button.ebitda-mode-choice {
        min-height: 24px;
        padding: 2px 0;
        font-size: 11.5px;
        line-height: 18px;
    }

    /* Short, centered underline beneath the selected option */
    .ebitda-mode-choices .ebitda-mode-choice::after {
        left: 50%;
        right: auto;
        width: 32px;
        transform: translateX(-50%);
    }


.ff-weighting {
    --ff-dcf: #2a8388;
    --ff-trading: #557f9d;
    --ff-transactions: #b38364;
    border-top: 1px solid var(--rz-base-300, #dfe5e5);
    padding-top: 1rem;
}

.ff-weighting-note {
    margin: 0.5rem 0 0;
    color: var(--rz-text-secondary-color, #59666a);
    font-size: 0.8rem;
    line-height: 1.5;
}

.ff-weighting-slider-row {
    overflow: visible;
    --ff-slider-color: var(--ff-dcf);
    margin-top: 1.25rem;
}

.ff-weighting-slider-1 {
    --ff-slider-color: var(--ff-trading);
}

.ff-weighting-slider-2 {
    --ff-slider-color: var(--ff-transactions);
}

.ff-weighting-slider-heading,
.ff-weighting-slider-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

    .ff-weighting-slider-heading label {
        color: var(--rz-text-color, #15383d);
        font-weight: 600;
    }

.ff-weighting-chip {
    min-width: 3.75rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid color-mix(in srgb, var(--ff-slider-color) 28%, white);
    border-radius: 0.55rem;
    background: color-mix(in srgb, var(--ff-slider-color) 12%, white);
    color: var(--rz-text-color, #15383d);
    text-align: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.ff-weighting-slider {
    width: calc(100% - 18px);
    margin: 0.55rem 9px 0.25rem;
    accent-color: var(--ff-slider-color);
}

    .ff-weighting-slider ::deep .rz-slider-range,
    .ff-weighting-slider ::deep .rz-slider-handle {
        background-color: var(--ff-slider-color);
    }

    .ff-weighting-slider ::deep .rz-slider-handle {
        border-color: #ffffff;
        box-shadow: 0 1px 7px rgba(21, 56, 61, 0.25);
    }

.ff-weighting-slider-meta {
    color: var(--rz-text-secondary-color, #59666a);
    font-size: 0.72rem;
}

/* Flat conclusion header: deliberately part of the chart, not a separate card. */
.ff-conclusion {
    width: 100%;
    margin: 0 0 1.25rem;
    padding: 0 0 1rem;
    border: 0;
    border-bottom: 1px solid var(--rz-base-300, #dce7e7);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.ff-conclusion-title {
    display: block;
    margin-bottom: 0.8rem;
    color: var(--rz-text-secondary-color, #59666a);
    font-size: 0.82rem;
    font-weight: 700;
}

.ff-conclusion-main {
    display: flex;
    align-items: flex-end;
    gap: clamp(2rem, 6vw, 5rem);
}

.ff-conclusion-value {
    min-width: 0;
}

    .ff-conclusion-value span,
    .ff-conclusion-value strong {
        display: block;
    }

    .ff-conclusion-value span {
        margin-bottom: 0.2rem;
        color: var(--rz-text-secondary-color, #59666a);
        font-size: 0.76rem;
    }

    .ff-conclusion-value strong {
        color: #15383d;
        font-size: clamp(1.65rem, 2.5vw, 2.15rem);
        font-weight: 650;
        line-height: 1;
        letter-spacing: -0.035em;
        font-variant-numeric: tabular-nums;
    }

.ff-conclusion-value-secondary strong {
    font-size: clamp(1.25rem, 2vw, 1.55rem);
    font-weight: 600;
}

.ff-conclusion-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.75rem;
    margin-top: 0.85rem;
    color: var(--rz-text-secondary-color, #59666a);
    font-size: 0.72rem;
}

    .ff-conclusion-meta strong {
        color: #15383d;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
    }

.ff-conclusion-empty {
    padding: 0.25rem 0;
}

@media (max-width: 600px) {
    .ff-conclusion-main {
        align-items: flex-start;
        flex-direction: column;
        gap: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ff-weighting-slider {
        transition: none !important;
    }
}

.ff-chart-stage {
    position: relative;
    min-height: 600px;
}

.ff-chart-paused {
    display: grid;
    place-items: center;
    min-height: 600px;
    color: var(--rz-text-secondary-color, #59666a);
    font-size: 0.82rem;
}
