/* Valuation Explorer (sandbox). Ported from the frozen DCF explorer prototype onto the THY site tokens (styles.css).
   Every selector is .vs- or #valuation-sandbox scoped, plus the one results-page entry card (.qf-r-explore). */

.vs[hidden],
.vs [hidden] {
    display: none !important;
}

.qf-r-explore {
    grid-column: 1 / -1;
    margin-top: 16px;
}

.qf-r-explore-h {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 1.3rem;
    color: var(--heading-color);
    margin: 0 0 6px;
}

.qf-r-explore p {
    margin: 0 0 10px;
    color: var(--text-secondary);
}

.qf-r-explore-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    text-decoration: none;
    margin: 4px 0 8px;
}

.vs {
    --vs-ink: var(--primary-color);
    --vs-sub: var(--thy-gray-500);
    --vs-line: var(--border-color);
    --vs-gold: var(--thy-magenta-600);
    --vs-soft: var(--thy-plum-50);
    --vs-green: var(--success-color);
    --vs-red: var(--error-color);
    background: var(--background-color);
    color: var(--vs-ink);
    padding: 24px 0 64px;
    font: 300 15px/1.55 var(--font-body);
    scroll-margin-top: 108px;
}

.vs * {
    box-sizing: border-box;
}

.vs-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
    min-width: 0;
}

.vs button,
.vs input,
.vs select,
.vs textarea {
    font: inherit;
}

.vs button {
    cursor: pointer;
}

.vs :focus-visible {
    outline: 3px solid var(--thy-magenta-600);
    outline-offset: 3px;
}

.vs-title:focus,
.vs h3:focus {
    outline: none;
}

.vs-title:focus-visible,
.vs h3:focus-visible {
    outline: 3px solid var(--vs-gold);
    outline-offset: 4px;
}

.vs-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    color: var(--secondary-color);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: var(--thy-plum-300);
    text-underline-offset: 3px;
}

.vs-title {
    font-family: var(--font-heading);
    font-weight: 300;
    color: var(--heading-color);
    font-size: clamp(1.75rem, 5vw, 2.3rem);
    line-height: 1.15;
    margin: 4px 0 4px;
}

.vs h3 {
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 400;
    color: var(--heading-color);
    margin: 0;
}

.vs p {
    margin: 0;
}

.vs-sub {
    color: var(--vs-sub);
    margin-bottom: 16px !important;
}

.vs-synthetic,
.vs-flag {
    background: #fdf3e1;
    color: #7a4a00;
    border: 1px solid var(--thy-amber-500);
    border-left-width: 4px;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    margin-bottom: 12px !important;
}

.vs-card {
    background: #fff;
    border: 1px solid var(--vs-line);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 18px;
    margin-bottom: 16px;
}

.vs-orig-range {
    font-family: var(--font-heading);
    color: var(--heading-color);
    font-size: 27px;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
    margin: 6px 0 4px !important;
    overflow-wrap: anywhere;
}

.vs-mini {
    font-size: 12px;
    color: var(--vs-sub);
    margin-top: 4px !important;
}

.vs-fine {
    font-size: 11px;
    color: var(--vs-sub);
    margin-top: 6px !important;
}

.vs-details {
    border-top: 1px solid var(--vs-line);
    margin-top: 16px;
    padding-top: 6px;
}

.vs-details > summary {
    cursor: pointer;
    min-height: 44px;
    display: list-item;
    list-style-position: inside;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 600;
}

#vs-inputs {
    background: #fff;
    border: 1px solid var(--vs-line);
    border-radius: var(--border-radius);
    padding: 4px 18px 14px;
    margin: 0 0 16px;
}

.vs-rows {
    margin-top: 4px;
}

.vs-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 14px;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--vs-soft);
}

.vs-row b {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.vs-row.total {
    border-top: 1px solid var(--vs-line);
    font-weight: 600;
}

.vs-row-note {
    flex-basis: 100%;
    color: var(--vs-sub);
    font-size: 12px;
}

.vs-basis {
    display: inline-block;
    font-size: 11px;
    line-height: 1.4;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--vs-soft);
    color: var(--vs-sub);
    border: 1px solid var(--vs-line);
}

.vs-basis--band_proxy,
.vs-basis--illustrative_default {
    border-style: dashed;
}

.vs-work {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    background: #fff;
    border: 1px solid var(--vs-line);
    border-radius: var(--border-radius);
    overflow: clip;
}

.vs-controls,
.vs-result {
    padding: 18px;
    min-width: 0;
}

.vs-controls {
    border-bottom: 1px solid var(--vs-line);
}

.vs-result {
    background: var(--thy-plum-50);
}

.vs-explain {
    margin: 6px 0 16px !important;
    color: var(--vs-sub);
    font-size: 13px;
}

.vs-tabs {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid var(--vs-line);
    margin-bottom: 20px;
}

.vs-tab {
    border: 0;
    border-bottom: 3px solid transparent;
    background: none;
    padding: 10px 0;
    min-height: 44px;
    color: var(--vs-sub);
    font-size: 14px;
}

.vs-tab[aria-selected="true"] {
    color: var(--vs-ink);
    border-bottom-color: var(--vs-gold);
    font-weight: 600;
}

.vs-control {
    margin-bottom: 20px;
}

.vs-label {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: baseline;
    font-weight: 550;
    font-size: 14px;
}

.vs-money,
.vs-pct {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    max-width: 260px;
}

.vs-number,
#vs-revenue-entry,
.vs-select {
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--vs-ink);
    font-variant-numeric: tabular-nums;
}

.vs-select {
    margin-top: 8px;
    max-width: none;
}

.vs-number[aria-invalid="true"],
#vs-revenue-entry[aria-invalid="true"] {
    border-color: var(--vs-red);
    box-shadow: 0 0 0 1px var(--vs-red);
}

.vs-slider {
    width: 100%;
    margin: 10px 0 0;
    padding: 0;
    height: 24px;
    accent-color: var(--thy-magenta-600);
    cursor: pointer;
}

.vs-help,
.vs-basis-line {
    margin-top: 5px !important;
    font-size: 12px;
    color: var(--vs-sub);
}

.vs-error {
    font-size: 12px;
    color: var(--error-color);
    margin-top: 4px !important;
}

.vs-error:empty {
    display: none;
}

.vs-note {
    font-size: 12px;
    color: var(--vs-sub);
    padding: 10px 12px;
    background: var(--vs-soft);
    border-radius: 6px;
    margin-bottom: 12px !important;
}

.vs-result-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.vs-reset {
    border: 0;
    background: transparent;
    color: var(--vs-sub);
    font-size: 13px;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 8px 0;
    min-height: 44px;
}

.vs-value {
    display: block;
    font-family: var(--font-heading);
    color: var(--heading-color);
    font-size: 36px;
    line-height: 1.2;
    font-weight: 300;
    margin: 10px 0 5px;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.vs-delta {
    font-size: 13px;
    min-height: 22px;
}

.vs-delta[data-direction="up"] {
    color: var(--vs-green);
}

.vs-delta[data-direction="down"] {
    color: var(--vs-red);
}

.vs-sensitivity {
    margin-top: 14px;
    font-size: 12px;
    color: var(--vs-sub);
}

.vs-sensitivity strong {
    display: block;
    font-size: 15px;
    color: var(--vs-ink);
    font-weight: 600;
}

.vs-error-box {
    font-size: 12px;
    padding: 12px;
    margin-top: 12px;
    color: var(--error-color);
    background: #fdecef;
    border: 1px solid #f3c4d2;
    border-radius: 6px;
}

.vs-divider {
    border-top: 1px solid var(--vs-line);
    margin: 20px 0;
}

.vs-chart {
    height: 112px;
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.vs-column {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

.vs-bar-area {
    width: 100%;
    height: 85px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.vs-bar {
    width: 100%;
    background: var(--thy-plum-600);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
}

.vs-bar--neg {
    background: var(--vs-red);
}

.vs-chart-val,
.vs-chart-label {
    font-size: 11px;
    color: var(--vs-sub);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.vs-statline {
    margin-top: 12px;
    font-size: 12px;
    color: var(--vs-sub);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 5px 12px;
}

.vs-statline b {
    color: var(--vs-ink);
    font-weight: 600;
}

.vs-riskband {
    display: flex;
    height: 7px;
    overflow: hidden;
    border-radius: 3px;
    margin: 12px 0;
}

.vs-riskband span {
    border-right: 2px solid #fff;
}

.vs-mobile-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    position: sticky;
    /* Clears the sticky site .header (z-index 100) rather than sliding under or over it. */
    top: 104px;
    z-index: 20;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: var(--thy-plum-gradient);
    color: #fff;
    font-size: 12px;
    border-bottom: 2px solid var(--thy-magenta-300);
    border-radius: 8px;
}

.vs-mobile-summary b {
    font-size: 20px;
    font-variant-numeric: tabular-nums;
}

.vs-foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 20px 18px;
    margin-top: 16px;
    background: var(--thy-plum-gradient);
    color: #fff;
    border-radius: var(--border-radius);
}

.vs-foot h3 {
    font-size: 21px;
    color: #fff;
}

.vs-foot p {
    color: var(--text-on-dark-muted);
    margin-top: 6px !important;
    font-size: 13px;
    max-width: 60ch;
}

.vs-foot .vs-fine {
    color: var(--text-on-dark-muted);
    font-size: 12px;
}

.vs-foot .vs-back {
    color: #fff;
    justify-content: center;
}

.vs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--vs-gold);
    border: 0;
    color: #fff;
    border-radius: 6px;
    padding: 11px 18px;
    min-height: 44px;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-align: center;
    text-decoration: none;
    transition: background-color var(--dur-base) var(--ease-standard), border-color var(--dur-base) var(--ease-standard);
}

.vs .vs-btn {
    font-size: 12px;
    font-weight: 500;
}

.vs-btn:hover {
    background: var(--thy-magenta-700);
    color: #fff;
}

.vs-secondary {
    background: none;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.vs-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.vs-outline {
    background: #fff;
    color: var(--heading-color);
    border: 1px solid var(--thy-plum-300);
}

.vs-outline:hover {
    background: var(--surface-tint);
    color: var(--heading-color);
}

.vs-export {
    background: #fff;
    border: 1px solid var(--vs-line);
    border-radius: var(--border-radius);
    padding: 18px;
    margin-top: 16px;
}

.vs-export p {
    color: var(--vs-sub);
    font-size: 13px;
    margin-top: 6px !important;
}

#vs-prompt {
    width: 100%;
    min-height: 210px;
    resize: vertical;
    padding: 12px;
    margin: 14px 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    color: var(--vs-ink);
    background: var(--vs-soft);
    font-family: var(--font-body);
    font-size: 12px;
}

.vs-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#vs-copy-status {
    color: var(--vs-green);
}

.vs-disclaimer {
    font-size: 11px;
    line-height: 1.6;
    color: var(--vs-sub);
    padding: 16px 0;
}

.vs-missing p {
    margin-bottom: 14px !important;
}

.vs-revenue-missing .vs-btn {
    margin-top: 12px;
}

.vs-mini,
.vs-fine,
.vs-help,
.vs-note,
.vs-disclaimer,
.vs-chart-val,
.vs-chart-label {
    font-weight: 400;
}

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

@media (min-width: 768px) {
    .vs-work {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .vs-controls {
        border-bottom: 0;
        border-right: 1px solid var(--vs-line);
        padding: 24px;
    }

    .vs-result {
        padding: 24px;
    }

    .vs-mobile-summary {
        display: none;
    }

    .vs-foot {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        padding: 24px;
    }

    .vs-actions {
        flex-direction: column;
    }

    .vs-value {
        font-size: 38px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vs *,
    .vs *::before,
    .vs *::after {
        transition: none !important;
        animation: none !important;
    }
}
