/* Page-local layout, using the shared Dyutam theme. */
.rtp-page {
    padding: 40px 0 48px;
    color: var(--text);
    font-family: var(--font-sans);
}
.rtp-page *, .rtp-page *::before, .rtp-page *::after { box-sizing: border-box; }
.rtp-page h1, .rtp-page h2, .rtp-page h3, .rtp-page p { margin: 0; }
.rtp-page [hidden] { display: none !important; }
.rtp-page .rtp-eyebrow {
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.rtp-header { margin-bottom: 28px; }
.rtp-header h1 {
    margin-bottom: 12px;
    font-family: var(--headline);
    font-weight: var(--headline-weight);
    line-height: 1.08;
}
.rtp-header > p:last-child {
    max-width: var(--tools-measure);
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1.6;
}
.rtp-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 24px;
    align-items: start;
}
.rtp-form, .rtp-results {
    min-width: 0;
    padding: 28px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    background: var(--surface);
}
.rtp-panel-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
}
.rtp-panel-heading h2 {
    font-family: var(--font-sans);
    font-weight: var(--tools-ui-heading-weight);
    font-size: var(--tools-ui-title-size);
    line-height: 1.3;
}
.rtp-panel-heading > span { color: var(--text-muted); font-size: 12px; text-align: right; }
.rtp-form fieldset { min-width: 0; padding: 0; margin: 0 0 22px; border: 0; }
.rtp-form legend {
    padding: 0;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.rtp-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rtp-field { min-width: 0; }
.rtp-field label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 600; line-height: 1.4; }
.rtp-field label span { color: var(--text-muted); font-weight: 400; }
.rtp-field input, .rtp-field select {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 10px 12px;
    font-size: 16px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}
.rtp-field input:hover, .rtp-field select:hover { border-color: var(--text-dim); }
.rtp-field input[aria-invalid="true"] { border-color: var(--down-text); }
.rtp-page :is(input, select, button, summary, a):focus-visible,
.rtp-page #rtp-results-title:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.rtp-page small { display: block; margin-top: 7px; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.rtp-submit {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: var(--accent-ink);
    font: 600 15px/1.4 var(--font-sans);
    cursor: pointer;
}
.rtp-submit:hover { filter: brightness(.92); }
.rtp-submit span { font-size: 20px; }
.rtp-page .rtp-auto-note { margin-top: 10px; color: var(--text-muted); font-size: 12px; text-align: center; }
.rtp-page .rtp-error { margin-bottom: 14px; color: var(--down-text); font-size: 14px; line-height: 1.5; }
.rtp-primary-result { padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.rtp-result-label { color: var(--text-muted); font-size: 14px; }
.rtp-loss-value {
    margin: 8px 0 10px;
    color: var(--down-text);
    font-family: var(--font-mono);
    font-size: clamp(32px, 3.5vw, 48px);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -.06em;
    overflow-wrap: anywhere;
}
#rtp-summary { color: var(--text-muted); font-size: 14px; line-height: 1.55; }
.rtp-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 24px 0; }
.rtp-metrics dt { min-height: 34px; color: var(--text-muted); font-size: 12px; line-height: 1.4; }
.rtp-metrics dt span { display: block; }
.rtp-metrics dd, .rtp-metrics .result-value {
    margin: 8px 0 0;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: clamp(16px, 1.7vw, 23px);
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: -.05em;
    overflow-wrap: anywhere;
    white-space: normal;
}
.rtp-edge-note { display: flex; gap: 18px; align-items: center; padding: 16px 18px; border-radius: 6px; background: var(--surface-3); }
.rtp-edge-value { color: var(--text); font: 500 26px/1.2 var(--font-mono); letter-spacing: -.06em; }
.rtp-edge-note p { color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.rtp-edge-note strong { color: var(--text); font-weight: 600; }
.rtp-page .rtp-model-note { margin: 16px 0 20px; color: var(--text-muted); font-size: 12px; line-height: 1.55; }
.rtp-page summary {
    position: relative;
    padding: 16px 28px 16px 0;
    list-style: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}
.rtp-page summary::-webkit-details-marker { display: none; }
.rtp-page summary::after { position: absolute; right: 2px; top: 14px; content: '+'; color: var(--text-muted); font-size: 20px; font-weight: 400; }
.rtp-page details[open] > summary::after { content: '\2212'; }
.rtp-estimates { border-top: 1px solid var(--border); }
.rtp-estimates > summary { color: var(--accent-text); padding-bottom: 0; }
.rtp-estimates[open] > summary { padding-bottom: 16px; }
.rtp-estimate-content h3 { margin: 20px 0 10px; }
.rtp-estimate-note { color: var(--text-muted); font-size: 12px; line-height: 1.55; }
.rtp-range-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.rtp-range-label { color: var(--text-muted); }
.rtp-range-value { text-align: right; font-variant-numeric: tabular-nums; }
.rtp-outcomes-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.rtp-outcome-label { color: var(--text-muted); font-size: 12px; line-height: 1.4; }
.rtp-outcome-value { display: block; margin: 6px 0; font: 500 21px/1.4 var(--font-mono); }
.rtp-outcome-note { color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.rtp-guide { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 64px; margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border-strong); }
.rtp-guide h2 { margin-bottom: 14px; font-family: var(--headline); font-size: var(--tools-h2-size); font-weight: var(--headline-weight); line-height: var(--section-title-leading); letter-spacing: var(--section-title-tracking); }
.rtp-guide p { max-width: var(--tools-measure); color: var(--text-muted); font-size: 14px; line-height: 1.65; }
.rtp-example-table { width: 100%; margin-top: 20px; border-collapse: collapse; }
.rtp-example-table th, .rtp-example-table td { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; font-variant-numeric: tabular-nums; text-align: left; }
.rtp-example-table thead th { color: var(--text-muted); font-size: 12px; font-weight: 400; }
.rtp-example-table tr > :last-child { padding-left: 20px; text-align: right; }
.rtp-questions { border-top: 1px solid var(--border-strong); }
.rtp-questions details { border-bottom: 1px solid var(--border-strong); }
.rtp-questions details p { padding: 0 24px 16px 0; }
.rtp-page .rtp-limit-note { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 13px; line-height: 1.6; }
.rtp-limit-note strong { color: var(--text); }

@media (max-width: 1050px) {
    .rtp-panel-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
    .rtp-panel-heading > span { text-align: left; }
    .rtp-form, .rtp-results { padding: 22px; }
    .rtp-fields { gap: 12px; }
    .rtp-guide { gap: 32px; }
}
@media (max-width: 900px) {
    .rtp-page { padding: 26px 0 32px; }
    .rtp-header { margin-bottom: 22px; }
    .rtp-header > p:last-child { font-size: 15px; }
    .rtp-workspace, .rtp-guide { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .rtp-panel-heading { margin-bottom: 22px; }
    .rtp-form, .rtp-results { padding: 20px; }
    .rtp-loss-value { font-size: 40px; }
    .rtp-metrics { gap: 12px; }
    .rtp-metrics dd, .rtp-metrics .result-value { font-size: 18px; }
    .rtp-guide { margin-top: 32px; padding-top: 26px; }
    #rtp-results-title { scroll-margin-top: 100px; }
}
@media (max-width: 380px) {
    .rtp-fields { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .rtp-metrics { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .rtp-metrics > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
    .rtp-metrics dd { margin-top: 0; text-align: right; }
    .rtp-outcomes-grid { grid-template-columns: minmax(0, 1fr); }
}
