/* Upsert DCF Dialog — Apple-style Minimal */

.ij-dcf-dialog.mud-dialog {
    border-radius: 20px !important;
    overflow: hidden;
}

@media (min-width: 960px) {
    .ij-dcf-dialog.mud-dialog {
        width: 800px !important;
        max-width: 800px !important;
    }
}

/* Phones: keep the dialog within the viewport (the wide rate matrix scrolls
   inside its own overflow-x wrapper). Desktop width is 800px at >=960px. */
@media (max-width: 600px) {
    .ij-dcf-dialog.mud-dialog {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
    }
}

.ij-dcf-dialog .mud-dialog-content {
    padding: 24px 20px 20px !important;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ij-dcf-dialog .mud-dialog-content::-webkit-scrollbar {
    display: none;
}

/* ── Section label ── */
.ij-dcf-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--mud-palette-text-secondary);
    margin: 10px 0 5px;
    padding: 0;
}

/* ── Field groups (iOS settings style) ── */
.ij-dcf-field-group {
    background: rgba(120, 120, 128, 0.12);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0;
}

.ij-dcf-field-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 44px;
    padding: 4px 14px;
    border-bottom: 0.5px solid var(--mud-palette-divider);
}

.ij-dcf-field-row:last-child {
    border-bottom: none;
}

.ij-dcf-field-label {
    font-size: 14px;
    color: var(--mud-palette-text-primary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Editable value fields — visible input affordance (1A) ── */
/* MudBlazor puts Class on the .mud-input-control root, which its own CSS lets
   flex-grow inside the row — pin the box with flex-basis, not just width. */
.ij-dcf-input {
    width: 168px;
    max-width: 168px;
    flex: 0 0 168px;
    display: flex;
    align-items: center;
    background: rgba(120, 120, 128, 0.24);
    border: 1px solid rgba(120, 120, 128, 0.4);
    border-radius: 8px;
    padding: 4px 10px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.ij-dcf-input:focus-within {
    border-color: var(--mud-palette-primary);
    background: rgba(120, 120, 128, 0.3);
}

@media (max-width: 400px) {
    .ij-dcf-input {
        width: 150px;
        max-width: 150px;
        flex-basis: 150px;
    }
}

.ij-dcf-input .mud-input-control {
    margin: 0 !important;
    padding: 0 !important;
    min-height: unset !important;
    width: 100%;
}

.ij-dcf-input .mud-input-root {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.ij-dcf-input input,
.ij-dcf-input .mud-input-slot {
    text-align: right;
    color: var(--mud-palette-primary);
    font-size: 14px;
    padding: 0 !important;
    height: auto !important;
    min-height: unset !important;
    /* A too-long value/placeholder ellipsizes instead of clipping mid-digit
       (the 4A stacked box at 390pt cuts "e.g. 108,000,000,000" otherwise). */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Faded placeholder = visible "type here" + format hint */
.ij-dcf-input input::placeholder {
    color: var(--mud-palette-text-disabled);
    opacity: 1;
    font-weight: 400;
    /* WebKit needs it on the pseudo-element too or the placeholder clips */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Unit adornment ($) — muted, compact, left of the value */
.ij-dcf-input .mud-input-adornment {
    margin: 0 4px 0 0 !important;
    height: auto !important;
}

.ij-dcf-input .mud-input-adornment p {
    font-size: 14px;
    color: var(--mud-palette-text-secondary);
    margin: 0;
    padding: 0;
}

.ij-dcf-input .mud-input::before,
.ij-dcf-input .mud-input::after {
    display: none !important;
}

.ij-dcf-input .mud-input-helper-text {
    display: none !important;
}

/* 3B: invalid Save paints the offenders */
.ij-dcf-input--invalid {
    border-color: var(--mud-palette-error);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mud-palette-error) 14%, transparent);
}

/* ── Read-only computed row (Estimated price) — distinct from inputs ── */
.ij-dcf-field-row--readonly {
    background: rgba(120, 120, 128, 0.05);
}

.ij-dcf-field-row--readonly .ij-dcf-field-label {
    color: var(--mud-palette-text-secondary);
}

.ij-dcf-auto-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--mud-palette-text-disabled);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 5px;
    padding: 2px 6px;
    margin-right: 8px;
    flex-shrink: 0;
}

/* 3B: read-only (auto-generated) valuations — flat gray boxes, no live affordance */
.ij-dcf-dialog--readonly .ij-dcf-input {
    background: rgba(120, 120, 128, 0.05);
    border-color: transparent;
}

/* Controlled inline validation message rendered as a sibling of the input.
   Uses flex-wrap on the parent row so it drops to a new line below the input. */
.ij-dcf-field-error {
    flex-basis: 100%;
    color: var(--mud-palette-error);
    font-size: 11px;
    line-height: 1.3;
    text-align: right;
    padding: 2px 0 0;
    margin: 0;
}

/* Hide date picker calendar icon */
.ij-dcf-date-input .mud-input-adornment {
    display: none;
}

/* ── Growth pills ── */
/* 2A: the wrapper is transparent on desktop; the mobile variant styles it as one
   iOS group (56pt strip + attached find-rate action row). The old ≤480px rule
   stacked the five fields into a ~330pt column — deliberately gone. */
.ij-dcf-growth-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.ij-dcf-growth-pill {
    flex: 1 1 0;
    min-width: 0;
}

/* 4A: 2×3 grid — each year gets a ~165×40pt box in the same field language as
   the stacked value fields; "Find growth rate" is the sixth cell. Replaces the
   ~68pt-per-cell five-column strip. display:contents lifts the pills and the
   find-rate row out of their wrappers into the group's grid. */
.ij-dcf-dialog--mobile .ij-dcf-growth-group {
    background: rgba(120, 120, 128, 0.12);
    border-radius: 12px;
    margin-bottom: 14px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ij-dcf-dialog--mobile .ij-dcf-growth-row {
    display: contents;
}

.ij-dcf-dialog--mobile .ij-dcf-growth-pill {
    height: 40px;
    display: flex;
    align-items: center;
    background: var(--mud-palette-surface);
    border: 1px solid rgba(120, 120, 128, 0.4);
    border-radius: 9px;
    padding: 0 12px;
}

.ij-dcf-dialog--mobile .ij-dcf-growth-input {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
}

/* Y-label left, value + % right — one horizontal 40pt cell */
.ij-dcf-dialog--mobile .ij-dcf-growth-input .mud-input-outlined-border {
    display: none;
}

.ij-dcf-dialog--mobile .ij-dcf-growth-input .mud-input-control-input-container {
    display: flex;
    flex-direction: row-reverse; /* DOM puts the label after the input */
    align-items: center;
    gap: 6px;
}

/* Mud's shrink-label transform (scale .75, translate -6px) survives a plain
   `transform:none` — it must be !important or the Y-label floats above centre. */
.ij-dcf-dialog--mobile .ij-dcf-growth-input .mud-input-label-outlined {
    position: static;
    transform: none !important;
    pointer-events: none;
    flex: none;
    font-size: 11px !important;
    font-weight: 600;
    line-height: 1;
    padding: 0;
    margin: 0;
    color: var(--mud-palette-text-secondary) !important;
}

.ij-dcf-dialog--mobile .ij-dcf-growth-input .mud-input-root-outlined {
    padding: 0 !important;
    width: 100%;
}

/* 16px stops iOS's auto-zoom-on-focus, same as the stacked value fields */
.ij-dcf-dialog--mobile .ij-dcf-growth-input input {
    font-size: 16px;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
    width: 100%;
    min-width: 0;
    flex: 1;
}

.ij-dcf-dialog--mobile .ij-dcf-growth-input .mud-input-adornment {
    margin: 0 0 0 3px !important;
}

.ij-dcf-dialog--mobile .ij-dcf-growth-input .mud-input-adornment p {
    font-size: 12px;
    font-weight: 400;
    color: var(--mud-palette-text-secondary);
}

.ij-dcf-dialog--mobile .ij-dcf-find-rate-row {
    display: contents;
}

.ij-dcf-dialog--mobile .ij-dcf-ai-btn {
    height: 40px;
    justify-content: center;
    border-radius: 9px;
    padding: 0 4px;
    margin: 0;
    font-weight: 600;
}

/* Outlined field: slim border, rounded, compact */
.ij-dcf-growth-input .mud-input-outlined-border {
    border-color: rgba(120, 120, 128, 0.35) !important;
    border-radius: 10px !important;
}

.ij-dcf-growth-input .mud-input-control {
    margin: 0 !important;
}

.ij-dcf-growth-input .mud-input-root-outlined {
    padding: 6px 8px !important;
}

.ij-dcf-growth-input input {
    text-align: center;
    color: var(--mud-palette-primary);
    font-size: 13px;
    font-weight: 600;
    padding: 0 !important;
    height: auto !important;
}

/* Floating label: small, secondary */
.ij-dcf-growth-input .mud-input-label-outlined {
    font-size: 10px !important;
    font-weight: 500;
    color: var(--mud-palette-text-secondary) !important;
}

.ij-dcf-growth-input .mud-input-adornment p {
    font-size: 12px;
    font-weight: 600;
    color: var(--mud-palette-primary);
    margin: 0;
    padding: 0;
}

.ij-dcf-growth-input .mud-input-helper-text {
    display: none !important;
}

.ij-dcf-growth-input .mud-input::before,
.ij-dcf-growth-input .mud-input::after {
    display: none !important;
}

.ij-dcf-growth-input .mud-input-helper-text {
    display: none !important;
}

/* ── Estimated price (read-only) ── */
.ij-dcf-estimated-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--mud-palette-primary);
    text-align: right;
    width: 140px;
    flex-shrink: 0;
}

/* ── Find rate row ── */
.ij-dcf-find-rate-row {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
}

/* ── AI find growth rate button ── */
.ij-dcf-ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--mud-palette-primary) 18%, transparent),
        color-mix(in srgb, var(--mud-palette-info) 18%, transparent));
    color: var(--mud-palette-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
}

.ij-dcf-ai-btn:hover:not(:disabled) {
    opacity: 0.82;
    transform: scale(1.02);
}

.ij-dcf-ai-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.ij-dcf-ai-btn-icon {
    color: var(--mud-palette-primary);
    flex-shrink: 0;
}

/* ── Rate Matrix disclosure ── */
.ij-dcf-disclosure-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 14px;
    background: none;
    border: none;
    cursor: pointer;
    gap: 8px;
    text-align: left;
}

.ij-dcf-disclosure-tag {
    background: transparent;
    color: var(--mud-palette-text-secondary);
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 20px;
    flex-shrink: 0;
    border: 1px solid var(--mud-palette-divider);
}

.ij-dcf-disclosure-label {
    flex: 1;
    font-size: 14px;
    color: var(--mud-palette-primary);
}

.ij-dcf-chevron {
    color: var(--mud-palette-text-disabled);
    transition: transform 0.2s ease;
}

.ij-dcf-chevron-open {
    transform: rotate(90deg);
}

/* ── Rate Matrix table ── */
.ij-dcf-matrix-wrapper {
    padding: 0 12px 14px;
    overflow-x: auto;
    border-top: 0.5px solid var(--mud-palette-divider);
}

.ij-dcf-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    min-width: 300px;
}

.ij-dcf-matrix th,
.ij-dcf-matrix td {
    padding: 5px 3px;
    text-align: center;
    border-bottom: 0.5px solid var(--mud-palette-divider);
    vertical-align: middle;
}

/* Empty corner cell above the discount column */
.ij-dcf-matrix thead th:first-child {
    width: 58px;
}

.ij-dcf-matrix tbody tr:last-child td {
    border-bottom: none;
}

.ij-dcf-matrix-rate-cell {
    text-align: right;
    padding: 5px 8px 5px 0 !important;
    width: 58px;
    white-space: nowrap;
}

.ij-dcf-matrix-result {
    color: var(--mud-palette-text-primary);
}

.ij-dcf-matrix-highlight {
    background: color-mix(in srgb, var(--mud-palette-primary) 15%, transparent);
    color: var(--mud-palette-primary) !important;
    font-weight: 600;
    border-radius: 4px;
}

.ij-dcf-matrix-hint {
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
    margin: 8px 0 0;
    padding: 0;
}

.ij-dcf-matrix-input {
    width: 52px;
}

.ij-dcf-matrix-input .mud-input-control {
    margin: 0 !important;
    padding: 0 !important;
    min-height: unset !important;
}

.ij-dcf-matrix-input .mud-input-root {
    margin: 0 !important;
    padding: 0 !important;
}

.ij-dcf-matrix-input input {
    text-align: center;
    color: var(--mud-palette-text-secondary);
    font-size: 11px !important;
    font-weight: 400;
    padding: 0 !important;
    height: auto !important;
    min-height: unset !important;
}

/* Discount (row header) inputs — right-aligned to hug the data */
.ij-dcf-matrix-rate-cell .ij-dcf-matrix-input {
    width: 52px;
    display: block;
    margin-left: auto;
}

.ij-dcf-matrix-rate-cell .ij-dcf-matrix-input input {
    text-align: right;
}

.ij-dcf-matrix-input .mud-input::before,
.ij-dcf-matrix-input .mud-input::after {
    display: none !important;
}

.ij-dcf-matrix-input .mud-input-helper-text {
    display: none !important;
}

/* ── Implied Price Range card ── */
.ij-dcf-range-card {
    background: rgba(120, 120, 128, 0.12);
    border-radius: 14px;
    overflow: hidden;
    margin-top: 12px;
    margin-bottom: 12px;
}

.ij-dcf-range-body {
    padding: 14px 16px 10px;
}

.ij-dcf-range-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.ij-dcf-range-section-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--mud-palette-text-secondary);
}

.ij-dcf-range-section-label--auto {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ij-dcf-range-icon {
    color: var(--mud-palette-primary);
    font-size: 14px;
}

.ij-dcf-range-icon-label {
    color: var(--mud-palette-primary);
}

.ij-dcf-type-toggle {
    display: inline-flex;
    background: rgba(120, 120, 128, 0.18);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}

.ij-dcf-type-btn {
    border: none;
    background: none;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: var(--mud-palette-text-secondary);
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.ij-dcf-type-btn--active {
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ── Toggles wrapper (type + verdict on same line) ── */
.ij-dcf-range-toggles {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

@media (max-width: 540px) {
    .ij-dcf-range-toggles {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .ij-dcf-verdict-toggle {
        width: 100%;
    }
}

/* ── Verdict toggle ── */
.ij-dcf-verdict-toggle {
    display: flex;
    gap: 6px;
}

.ij-dcf-verdict-btn {
    flex: 1;
    border: none;
    background: rgba(120, 120, 128, 0.12);
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: var(--mud-palette-text-secondary);
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.ij-dcf-verdict-btn--green.ij-dcf-verdict-btn--active {
    background: color-mix(in srgb, var(--mud-palette-success) 18%, transparent);
    color: var(--mud-palette-success);
}

.ij-dcf-verdict-btn--neutral.ij-dcf-verdict-btn--active {
    background: color-mix(in srgb, var(--mud-palette-warning) 18%, transparent);
    color: var(--mud-palette-warning);
}

.ij-dcf-verdict-btn--red.ij-dcf-verdict-btn--active {
    background: color-mix(in srgb, var(--mud-palette-error) 18%, transparent);
    color: var(--mud-palette-error);
}

.ij-dcf-range-values {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
}

.ij-dcf-range-price {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--mud-palette-text-primary);
}

.ij-dcf-range-sep {
    font-size: 16px;
    color: var(--mud-palette-text-secondary);
}

.ij-dcf-range-meta {
    font-size: 12px;
    color: var(--mud-palette-text-secondary);
    margin: 0;
    padding: 0;
}

.ij-dcf-range-divider {
    height: 0.5px;
    background: var(--mud-palette-divider);
    margin: 0 16px;
}

.ij-dcf-range-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
}

.ij-dcf-range-footer-label {
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
    margin: 0 0 2px;
    padding: 0;
}

.ij-dcf-range-footer-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.ij-dcf-range-verdict-col {
    text-align: right;
}

.ij-dcf-verdict-green {
    font-size: 14px;
    font-weight: 600;
    color: var(--mud-palette-success);
}

.ij-dcf-verdict-red {
    font-size: 14px;
    font-weight: 600;
    color: var(--mud-palette-error);
}

.ij-dcf-range-placeholder {
    background: rgba(120, 120, 128, 0.12);
    border-radius: 14px;
    padding: 14px 16px 18px;
    margin-top: 12px;
    margin-bottom: 12px;
}

.ij-dcf-range-placeholder-text {
    display: block;
    text-align: center;
    font-size: 13px;
    color: var(--mud-palette-text-disabled);
    margin-top: 8px;
}

/* ── Analysis text ── */
.ij-dcf-analysis-body {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ij-dcf-analysis-intro {
    font-size: 13px;
    line-height: 1.55;
    color: var(--mud-palette-text-secondary);
    margin: 0;
    padding: 0;
}

.ij-dcf-analysis-verdict {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.55;
    color: var(--mud-palette-text-primary);
    margin: 0;
    padding: 0;
}

.ij-dcf-analysis-verdict--green {
    color: var(--mud-palette-success);
}

.ij-dcf-analysis-verdict--neutral {
    color: var(--mud-palette-warning);
}

.ij-dcf-analysis-verdict--red {
    color: var(--mud-palette-error);
}

.ij-dcf-analysis-placeholder {
    font-size: 13px;
    color: var(--mud-palette-text-disabled);
    margin: 10px 0 0;
    padding: 0;
    text-align: center;
}

/* ── Footer ── */
.ij-dcf-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 0.5px solid var(--mud-palette-divider);
    margin-top: 4px;
}

/* ═══════════════════════════════════════
   #801: form-dialog chrome — mirrors the thesis editor pattern
   (ij-thesis-dialog-head / ij-thesis-nav in thesis.css)
═══════════════════════════════════════ */

/* Desktop in-body head: title + × close (the dialog previously opened straight
   into "Cash Flow" with no title). */
.ij-dcf-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.ij-dcf-dialog-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.ij-dcf-dialog-close {
    border: none;
    background: transparent;
    padding: 2px;
    cursor: pointer;
    color: var(--mud-palette-text-secondary);
    display: inline-flex;
}

/* --- Mobile full-screen editor — scoped by the variant class the MAUI head
   sets (OperatingSystem.IsIOS()). 4A: the sheet is a flex column — nav
   flex:none, body flex:1 with its own scroll — so nothing can render behind
   Cancel/Save (the old sticky nav lived inside the scroll container and rows
   slid under it). Full-bleed: no radius, so rows can't peek past corners. --- */
.ij-dcf-dialog.ij-dcf-dialog--mobile.mud-dialog {
    border-radius: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
}

/* The base rule's padding is !important — this override must be too, or the
   nav floats 24px inside the sheet instead of owning the top edge. */
.ij-dcf-dialog--mobile .mud-dialog-content {
    padding: 0 !important;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Cancel · title · Save — a flex:none bar above the scroll region; the top
   position (not the footer) is what keeps it reachable with the keyboard open. */
.ij-dcf-dialog--mobile .ij-dcf-nav {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(env(safe-area-inset-top) + 8px) 16px 10px;
    background: var(--mud-palette-surface);
    border-bottom: 1px solid color-mix(in srgb, var(--mud-palette-text-primary) 10%, transparent);
}

.ij-dcf-nav-title {
    font-size: 16.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-align: center;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ij-dcf-nav-save {
    border: none;
    background: transparent;
    padding: 4px 2px;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    color: var(--mud-palette-primary);
    cursor: pointer;
}

.ij-dcf-nav-save:disabled {
    color: var(--mud-palette-text-disabled);
    cursor: default;
}

/* Read-only mode has no Save; the spacer keeps the title optically centred. */
.ij-dcf-nav-spacer {
    min-width: 44px;
}

.ij-dcf-dialog--mobile .ij-dcf-dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 18px calc(env(safe-area-inset-bottom) + 16px);
}

/* ═══════════════════════════════════════
   Round 2 — 3B: date capsule, read-only banner, alert pill
═══════════════════════════════════════ */

/* Native date input on mobile: gray capsule + calendar glyph so the row reads
   tappable; iOS opens its wheel sheet instead of the Mud month-grid popover. */
.ij-dcf-date-native {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(120, 120, 128, 0.16);
    border-radius: 8px;
    padding: 5px 11px;
    flex-shrink: 0;
}

.ij-dcf-date-native input::-webkit-calendar-picker-indicator {
    display: none; /* our own glyph is the affordance */
}

.ij-dcf-date-native input {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
    color: var(--mud-palette-text-primary);
    padding: 0;
    margin: 0;
}

.ij-dcf-date-glyph {
    color: var(--mud-palette-text-secondary);
    font-size: 16px;
    flex-shrink: 0;
}

/* Auto-generated banner — under the nav/head, with the Duplicate escape */
.ij-dcf-readonly-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
    border-bottom: 0.5px solid var(--mud-palette-divider);
    font-size: 12.5px;
    color: var(--mud-palette-text-secondary);
}

.ij-dcf-readonly-banner-icon {
    color: var(--mud-palette-primary);
    font-size: 15px;
    flex-shrink: 0;
}

.ij-dcf-readonly-banner-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ij-dcf-readonly-banner-btn {
    margin-left: auto;
    border: none;
    background: none;
    padding: 4px 0;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--mud-palette-primary);
    cursor: pointer;
    white-space: nowrap;
}

/* Desktop: the banner sits inside the padded dialog content — give it a shape */
.ij-dcf-dialog:not(.ij-dcf-dialog--mobile) .ij-dcf-readonly-banner {
    border-radius: 10px;
    border-bottom: none;
    margin-bottom: 8px;
}

/* Validation / precondition alert pill (3B) */
.ij-dcf-alert-row {
    display: flex;
    justify-content: center;
    padding: 8px 16px 0;
}

.ij-dcf-alert-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: color-mix(in srgb, var(--mud-palette-error) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--mud-palette-error) 35%, transparent);
    border-radius: 980px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--mud-palette-error);
    text-align: center;
}

/* ═══════════════════════════════════════
   Round 2 — 3A: mobile sensitivity screen (transposed rate matrix)
═══════════════════════════════════════ */

.ij-dcf-sens-body {
    display: flex;
    flex-direction: column;
}

.ij-dcf-sens-back {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

/* Growth-in-perpetuity segmented control */
.ij-dcf-sens-seg {
    display: flex;
    background: rgba(120, 120, 128, 0.16);
    border-radius: 9px;
    padding: 2px;
    gap: 2px;
}

.ij-dcf-sens-seg-btn {
    flex: 1;
    border: none;
    background: none;
    padding: 6px 0;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.ij-dcf-sens-seg-btn--active {
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}

.ij-dcf-sens-list-label {
    margin-top: 16px;
}

/* Discount rate → intrinsic value rows */
.ij-dcf-sens-list {
    background: rgba(120, 120, 128, 0.12);
    border-radius: 12px;
    overflow: hidden;
}

.ij-dcf-sens-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 5px 14px;
    border-bottom: 0.5px solid var(--mud-palette-divider);
}

.ij-dcf-sens-row:last-child {
    border-bottom: none;
}

.ij-dcf-sens-row--midpoint {
    background: color-mix(in srgb, var(--mud-palette-primary) 9%, transparent);
}

.ij-dcf-sens-row--midpoint .ij-dcf-sens-rate,
.ij-dcf-sens-row--midpoint .ij-dcf-sens-value {
    color: var(--mud-palette-primary);
    font-weight: 700;
}

.ij-dcf-sens-row--near {
    background: color-mix(in srgb, var(--mud-palette-success) 10%, transparent);
}

.ij-dcf-sens-row--near .ij-dcf-sens-value {
    color: var(--mud-palette-success);
}

.ij-dcf-sens-rate {
    width: 64px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: var(--mud-palette-text-primary);
    text-align: left;
    flex-shrink: 0;
}

/* Tap a rate to swap in the − / + stepper (44pt targets, 0.5% steps) */
.ij-dcf-sens-rate--btn {
    border: none;
    background: none;
    padding: 8px 0;
    font: inherit;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.ij-dcf-sens-rate--stepping {
    width: auto;
    min-width: 52px;
    text-align: center;
    font-weight: 700;
    color: var(--mud-palette-primary);
}

.ij-dcf-sens-step {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    color: var(--mud-palette-primary);
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.ij-dcf-sens-chip {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mud-palette-primary);
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 45%, transparent);
    border-radius: 5px;
    padding: 2px 6px;
    flex-shrink: 0;
}

.ij-dcf-sens-fill {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--mud-palette-primary) 22%, transparent),
        color-mix(in srgb, var(--mud-palette-primary) 4%, transparent)
    );
}

.ij-dcf-sens-row--near .ij-dcf-sens-fill {
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--mud-palette-success) 25%, transparent),
        color-mix(in srgb, var(--mud-palette-success) 5%, transparent)
    );
}

.ij-dcf-sens-value {
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--mud-palette-text-primary);
}

.ij-dcf-sens-hint {
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--mud-palette-text-secondary);
    margin: 8px 2px 0;
    padding: 0;
}

/* ═══════════════════════════════════════
   4A: one field language — stacked value rows, settled analysis card
═══════════════════════════════════════ */

/* Editable rows stack: 12px caption above, 40pt box spanning the group below.
   Long labels never truncate against a floating 154px box, and 11-digit values
   get 16px type. Display rows (Estimated price, Date) keep the compact
   label-left layout — editable = stacked box, computed = row. */
.ij-dcf-dialog--mobile .ij-dcf-field-row--stacked {
    padding: 10px 14px 12px;
}

.ij-dcf-dialog--mobile .ij-dcf-field-row--stacked .ij-dcf-field-label {
    flex: 1 1 100%;
    font-size: 12px;
    color: var(--mud-palette-text-secondary);
    white-space: normal;
    margin-bottom: 6px;
}

.ij-dcf-dialog--mobile .ij-dcf-field-row--stacked .ij-dcf-input {
    width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
    min-height: 40px;
    background: var(--mud-palette-surface);
    border-radius: 9px;
    padding: 0 12px;
}

/* 16px input font stops iOS's auto-zoom-on-focus (14px made the WebView zoom
   the whole sheet when a field was tapped). $ hugs the left edge; the number
   sits flush right, like the compact display rows. */
.ij-dcf-dialog--mobile .ij-dcf-field-row--stacked .ij-dcf-input input,
.ij-dcf-dialog--mobile .ij-dcf-field-row--stacked .ij-dcf-input .mud-input-slot {
    text-align: right;
    font-size: 16px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.ij-dcf-dialog--mobile .ij-dcf-field-row--stacked .ij-dcf-input .mud-input-adornment p {
    font-size: 15px;
}

/* Read-only (auto-generated) valuations keep the 3B flat-gray treatment */
.ij-dcf-dialog--readonly.ij-dcf-dialog--mobile .ij-dcf-field-row--stacked .ij-dcf-input {
    background: rgba(120, 120, 128, 0.05);
    border-color: transparent;
}

/* Section rhythm from the mock: 14px between groups, flush at the very top */
.ij-dcf-dialog--mobile .ij-dcf-section-label {
    margin: 14px 0 5px;
}

.ij-dcf-dialog--mobile .ij-dcf-dialog-body > .ij-dcf-section-label:first-child {
    margin-top: 0;
}

/* ── Settled analysis card — one control per line ──
   "Your analysis" is a section label like every other section; Method is a
   settings row with the small segmented control; the verdict is a full-width
   three-chip row; the generated text sits below its own divider. */
.ij-dcf-analysis-chip-row {
    display: flex;
    gap: 7px;
    padding: 12px 14px;
    border-bottom: 0.5px solid var(--mud-palette-divider);
}

.ij-dcf-analysis-chip-row .ij-dcf-verdict-toggle {
    flex: 1;
    gap: 7px;
}

.ij-dcf-analysis-chip-row .ij-dcf-verdict-btn {
    padding: 8px 4px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-size: 12.5px;
    background: rgba(120, 120, 128, 0.1);
}

/* Active chip: tinted + outlined + ✓ (presentational, so it needs no string;
   nbsp because a plain trailing space collapses in generated content) */
.ij-dcf-analysis-chip-row .ij-dcf-verdict-btn--active::before {
    content: "✓\00a0";
}

.ij-dcf-analysis-chip-row .ij-dcf-verdict-btn--green.ij-dcf-verdict-btn--active {
    border-color: color-mix(in srgb, var(--mud-palette-success) 40%, transparent);
    font-weight: 600;
}

.ij-dcf-analysis-chip-row .ij-dcf-verdict-btn--neutral.ij-dcf-verdict-btn--active {
    border-color: color-mix(in srgb, var(--mud-palette-warning) 40%, transparent);
    font-weight: 600;
}

.ij-dcf-analysis-chip-row .ij-dcf-verdict-btn--red.ij-dcf-verdict-btn--active {
    border-color: color-mix(in srgb, var(--mud-palette-error) 40%, transparent);
    font-weight: 600;
}

.ij-dcf-analysis-text-row {
    padding: 12px 14px;
}

.ij-dcf-analysis-text-row .ij-dcf-analysis-body {
    margin-top: 0;
}

.ij-dcf-analysis-text-row .ij-dcf-analysis-placeholder {
    margin: 0;
    text-align: left;
}

/* ── 4A polish patch (design_handoff_dcf_entry/4a-polish.css) — make the Mud
   internals fill the styled box. Symptoms fixed: value/placeholder looked
   centered, content top-aligned, placeholder ellipsized despite a mostly-empty
   box. ── */

/* The styled box centers its content vertically. Mud's control root is
   flex-COLUMN (label/helper stacking), so align-items alone centered the
   wrong axis and content pinned to the top — force row direction. */
.ij-dcf-dialog--mobile .ij-dcf-field-row--stacked .ij-dcf-input {
    display: flex;
    flex-direction: row;
    align-items: center;
}

/* Inner Mud wrappers must span the box — otherwise the adornment+input
   cluster is auto-width and floats inside it. In Mud 9.4 the Class lands ON
   .mud-input-control (so .ij-dcf-input IS the control) and the auto-width
   wrappers are the input-container and .mud-input — target those. */
.ij-dcf-dialog--mobile .ij-dcf-field-row--stacked .ij-dcf-input .mud-input-control-input-container,
.ij-dcf-dialog--mobile .ij-dcf-field-row--stacked .ij-dcf-input .mud-input {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* Input claims all width right of the $ and the number sits flush right —
   $ left, value right, like the compact display rows */
.ij-dcf-dialog--mobile .ij-dcf-field-row--stacked .ij-dcf-input .mud-input-slot,
.ij-dcf-dialog--mobile .ij-dcf-field-row--stacked .ij-dcf-input input {
    flex: 1 1 auto;
    width: 100%;
    text-align: right;
}

/* $ hugs the left edge, never grows or wraps */
.ij-dcf-dialog--mobile .ij-dcf-field-row--stacked .ij-dcf-input .mud-input-adornment {
    flex: 0 0 auto;
}

/* Focused field scrolls clear of the MAUI keyboard accessory bar
   (the ∧∨✓ pill sat on top of DW Avg Shares) */
.ij-dcf-dialog--mobile .ij-dcf-dialog-body {
    scroll-padding-bottom: 72px;
}
