/* FHSA Home Purchase Planner — all classes namespaced fh- */
.fh-calc {
    font-family: inherit;
    color: inherit;
    max-width: 860px;
    margin: 0 auto;
    line-height: 1.5;
}

/* The hidden attribute must always win over the display rules below
   (author display:grid/flex otherwise overrides the UA [hidden] style,
   leaving partner-only sections visibly stuck at $0). */
.fh-calc [hidden] { display: none !important; }

.fh-calc .fh-title {
    font-size: 1.6em;
    margin: 0 0 0.25em;
}

.fh-calc .fh-sub {
    color: #6b7280;
    margin: 0 0 1.25em;
}

.fh-calc .fh-h {
    font-size: 1.15em;
    margin: 1.75em 0 0.6em;
}

.fh-calc .fh-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1em 1.5em;
    margin-bottom: 1em;
}

@media (max-width: 640px) {
    .fh-calc .fh-controls {
        grid-template-columns: 1fr;
    }
}

.fh-calc .fh-field {
    min-width: 0;
}

.fh-calc .fh-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4em;
}

.fh-calc .fh-out {
    font-weight: 700;
}

.fh-calc .fh-input {
    font: inherit;
    padding: 0.5em 0.6em;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    width: 100%;
    max-width: 220px;
    box-sizing: border-box;
    background: #fff;
    color: #111827;
}

.fh-calc .fh-money-row {
    display: flex;
    align-items: center;
    gap: 0.4em;
}

.fh-calc .fh-dollar {
    font-weight: 700;
    font-size: 1.1em;
}

.fh-calc .fh-hint {
    font-size: 0.85em;
    color: #6b7280;
    margin: 0.4em 0 0;
}
.fh-calc .fh-check { display: flex; align-items: center; gap: 0.5em; font-weight: 600; cursor: pointer; }
.fh-calc .fh-check input { width: 1.1em; height: 1.1em; accent-color: #2563eb; }
.fh-calc .fh-warn { font-size: 0.85em; color: #b45309; background: #fef3c7; border: 1px solid #fcd34d; border-radius: 6px; padding: 0.4em 0.6em; margin: 0.4em 0 0; }
.fh-calc select.fh-input { max-width: 220px; }
.fh-calc .fh-cap-note { font-size: 0.9em; color: #1e40af; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 0.6em 0.9em; margin: 0.9em 0 0; }
.fh-calc .fh-persons { display: grid; grid-template-columns: 1fr 1fr; gap: 1em 1.5em; margin: 0 0 1em; }
@media (max-width: 640px) { .fh-calc .fh-persons { grid-template-columns: 1fr; } }
.fh-calc .fh-person-card { border: 1px solid #e2e8f0; border-radius: 10px; padding: 0.9em 1.1em; background: #fff; }
.fh-calc .fh-person-name { font-weight: 700; font-size: 1.05em; }
.fh-calc .fh-person-value { font-size: 1.6em; font-weight: 700; color: #1d4ed8; }
.fh-calc .fh-person-meta { color: #475569; font-size: 0.9em; margin-top: 0.2em; }
.fh-calc .fh-person-note { font-size: 0.85em; color: #1e40af; margin: 0.5em 0 0; }

.fh-calc .fh-slider-row {
    display: flex;
    align-items: center;
    gap: 0.75em;
}

.fh-calc .fh-slider {
    flex: 1;
    min-width: 0;
    accent-color: #2563eb;
}

.fh-calc .fh-num {
    max-width: 90px;
    flex: 0 0 auto;
}

.fh-calc .fh-result {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.1em 1.25em;
    margin: 1.25em 0;
    text-align: center;
}

.fh-calc .fh-result-label {
    font-size: 0.95em;
    color: #475569;
}

.fh-calc .fh-big {
    font-size: 2.2em;
    font-weight: 700;
    color: #1d4ed8;
    line-height: 1.2;
}

.fh-calc .fh-per {
    font-size: 0.45em;
    font-weight: 400;
    color: #475569;
}

.fh-calc .fh-result-meta {
    color: #475569;
    margin-top: 0.4em;
}

.fh-calc .fh-cover {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1em 1.5em;
    margin: 1em 0;
}

@media (max-width: 640px) {
    .fh-calc .fh-cover {
        grid-template-columns: 1fr;
    }
}

.fh-calc .fh-cover-box {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.9em 1.1em;
    background: #fff;
}

.fh-calc .fh-cover-box .fh-cover-title {
    font-weight: 700;
    margin-bottom: 0.25em;
}

.fh-calc .fh-cover-box .fh-cover-amt {
    color: #475569;
    font-size: 0.95em;
}

.fh-calc .fh-diff {
    font-weight: 700;
    margin-top: 0.25em;
}

.fh-calc .fh-diff.fh-good {
    color: #15803d;
}

.fh-calc .fh-diff.fh-bad {
    color: #b91c1c;
}

.fh-calc .fh-table-wrap {
    overflow-x: auto;
    margin-bottom: 0.5em;
}

.fh-calc .fh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.fh-calc .fh-table th,
.fh-calc .fh-table td {
    padding: 0.5em 0.75em;
    text-align: right;
    border-bottom: 1px solid #e5e7eb;
}

.fh-calc .fh-table th:first-child,
.fh-calc .fh-table td:first-child {
    text-align: left;
}

.fh-calc .fh-table thead th {
    background: #f8fafc;
    font-weight: 700;
    border-bottom: 2px solid #e5e7eb;
}

.fh-calc .fh-chart {
    width: 100%;
    display: block;
    margin: 0.75em 0 0;
    max-height: 480px; /* backstop: never run off-screen */
}
@media (max-width: 640px) {
    .fh-calc .fh-chart { max-height: 320px; }
}}

.fh-calc .fh-note {
    font-size: 0.9em;
    color: #475569;
}

.fh-calc .fh-notes-list {
    font-size: 0.9em;
    color: #475569;
    margin: 0.5em 0;
    padding-left: 1.4em;
}

.fh-calc .fh-notes-list li {
    margin-bottom: 0.35em;
}

.fh-calc .fh-credit {
    margin-top: 2em;
    font-size: 0.9em;
    color: #6b7280;
}

.fh-calc .fh-disclaimer {
    font-size: 0.8em;
    color: #9ca3af;
}

.fh-calc .fh-actions {
    margin: 1.5em 0 0.5em;
}

.fh-calc .fh-btn {
    font: inherit;
    font-weight: 600;
    padding: 0.65em 1.25em;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
}

.fh-calc .fh-btn:hover {
    background: #1d4ed8;
}

.fh-calc .fh-lead {
    margin-top: 1.5em;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.1em 1.25em;
    background: #fbfdff;
}

.fh-calc .fh-lead .fh-h {
    margin-top: 0;
}

.fh-calc .fh-lead-sub {
    color: #6b7280;
    margin: 0 0 1em;
}

.fh-calc .fh-lead-form .fh-field {
    margin-bottom: 0.9em;
}

.fh-calc .fh-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.fh-calc .fh-consent {
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
    margin: 0.5em 0 1em;
    font-size: 0.95em;
}

.fh-calc .fh-consent input {
    margin-top: 0.25em;
}

.fh-calc .fh-lead-msg {
    margin: 0.8em 0 0;
    font-weight: 600;
}

.fh-calc .fh-lead-msg.fh-ok {
    color: #15803d;
}

.fh-calc .fh-lead-msg.fh-err {
    color: #b91c1c;
}

/* v1.0.3 additions */
.fh-calc .fh-num-wide { max-width: 140px; flex: 0 0 auto; }
.fh-calc .fh-per-mo { color: #6b7280; font-size: 0.9em; white-space: nowrap; }
.fh-calc .fh-person-sub { font-size: 0.8em; color: #6b7280; margin-top: 0.1em; }

/* Segmented frequency control */
.fh-calc .fh-seg { display: inline-flex; border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; }
.fh-calc .fh-seg-btn { font: inherit; font-weight: 600; padding: 0.5em 1.1em; border: none; background: #fff; color: #475569; cursor: pointer; }
.fh-calc .fh-seg-btn + .fh-seg-btn { border-left: 1px solid #cbd5e1; }
.fh-calc .fh-seg-btn.fh-active { background: #2563eb; color: #fff; }

/* FHSA room panels */
.fh-calc .fh-rooms { display: grid; grid-template-columns: 1fr 1fr; gap: 1em 1.5em; margin: 0 0 1em; }
@media (max-width: 640px) { .fh-calc .fh-rooms { grid-template-columns: 1fr; } }
.fh-calc .fh-room { border: 1px solid #e2e8f0; border-radius: 10px; padding: 0.9em 1.1em; background: #fff; }
.fh-calc .fh-room-title { font-weight: 700; margin-bottom: 0.5em; }
.fh-calc .fh-room-row { display: flex; justify-content: space-between; gap: 1em; padding: 0.3em 0; border-bottom: 1px solid #f1f5f9; font-size: 0.95em; }
.fh-calc .fh-room-row span { color: #475569; }
.fh-calc .fh-room-row.fh-room-max { background: #eff6ff; margin: 0 -1.1em; padding: 0.45em 1.1em; border-bottom: none; }
.fh-calc .fh-room-row.fh-room-max strong { color: #1d4ed8; }
.fh-calc .fh-room-cta { font-size: 0.95em; margin: 0.7em 0 0; color: #1e40af; }
.fh-calc .fh-sched { font-size: 0.9em; }
.fh-calc .fh-sched-note { color: #6b7280; font-size: 0.85em; }

/* Coverage: prominent % + stacked bar */
.fh-calc .fh-coverpct { font-size: 1.4em; font-weight: 700; color: #1d4ed8; margin: 0.4em 0 0.6em; }
.fh-calc .fh-coverpct span { font-size: 1.3em; }
.fh-calc .fh-bar-wrap { margin: 0.5em 0 0.25em; }
.fh-calc .fh-bar-scale { position: relative; height: 26px; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 6px; overflow: hidden; }
.fh-calc .fh-bar-seg { position: absolute; top: 0; bottom: 0; left: 0; width: 0; }
.fh-calc .fh-seg-fhsa { background: #2563eb; }
.fh-calc .fh-seg-tfsa { background: #14b8a6; }
.fh-calc .fh-seg-nr { background: #f59e0b; }
.fh-calc .fh-seg-gift { background: #a78bfa; }
.fh-calc .fh-bar-marker { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #111827; opacity: 0.7; }
.fh-calc .fh-bar-ticks { position: relative; height: 1.2em; font-size: 0.75em; color: #6b7280; margin-top: 2px; }
.fh-calc .fh-bar-ticks span { position: absolute; transform: translateX(-50%); }
.fh-calc .fh-bar-ticks span:first-child { transform: none; }
.fh-calc .fh-bar-ticks span:last-child { transform: translateX(-100%); }
.fh-calc .fh-bar-legend { display: flex; flex-wrap: wrap; gap: 0.4em 1.2em; font-size: 0.9em; color: #475569; margin: 0.5em 0 1em; }
.fh-calc .fh-sw { display: inline-block; width: 0.85em; height: 0.85em; border-radius: 3px; margin-right: 0.35em; vertical-align: baseline; }

/* Share section */
.fh-calc .fh-share { display: flex; align-items: center; gap: 1em; flex-wrap: wrap; margin: 1em 0; padding: 1em 1.25em; border: 1px solid #e2e8f0; border-radius: 10px; background: #fbfdff; }
.fh-calc .fh-btn-secondary { background: #0ea5e9; }
.fh-calc .fh-btn-secondary:hover { background: #0284c7; }
.fh-calc .fh-qr { width: 132px; height: 132px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; }
.fh-calc .fh-share-msg { font-weight: 600; color: #15803d; margin: 0; flex-basis: 100%; }
.fh-calc .fh-share-url { flex: 1 1 100%; font-size: 0.8em; }

/* Closing costs box */
.fh-calc .fh-cc { border: 1px solid #e2e8f0; border-radius: 10px; padding: 0.9em 1.1em; background: #fff; margin: 0 0 1em; }
.fh-calc .fh-cc-row { display: flex; justify-content: space-between; gap: 1em; padding: 0.35em 0; border-bottom: 1px solid #f1f5f9; }
.fh-calc .fh-cc-row.fh-cc-total { border-bottom: none; font-size: 1.05em; margin-top: 0.3em; }
.fh-calc .fh-cc-row.fh-cc-total strong { color: #1d4ed8; }

/* Share-link names */
.fh-calc .fh-share-name-field { flex: 1 1 200px; }
.fh-calc .fh-opt { color: #6b7280; font-weight: 400; font-size: 0.9em; }

/* "Showing numbers for ..." chip (hidden attribute handled by the global rule) */
.fh-calc .fh-name-chip { display: inline-block; background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; border-radius: 999px; padding: 0.25em 0.9em; font-size: 0.85em; font-weight: 600; margin: 0.5em 0; }

/* "Created ... · Last updated ..." line for share-link sessions */
.fh-calc .fh-ts-line { color: #6b7280; font-size: 0.8em; margin: 0.3em 0 0; }

/* Copyright footer */
.fh-calc .fh-copyright { border-top: 1px solid #e5e7eb; margin: 2em 0 0; padding-top: 1em; text-align: center; color: #9ca3af; font-size: 0.8em; }
