/*
 * rehab.css — Fusion Calculator
 * Extracted from rehab.html (batch-29c2-css-extraction-rehab)
 * Source: 7 inline <style> blocks merged in document order
 *   Block 1 (unnamed):                 original lines 15–397
 *   Block 2 (unnamed):                 original lines 401–1018
 *   Block 3 (lf-autofill-neutralizer): original lines 1021–1064
 *   Block 4 (lf-select-options-fix):   original lines 1067–1107
 *   Block 5 (lf-select-blue-menu):     original lines 1113–1150
 *   Block 6 (lf-select-closed-white):  original lines 1153–1177
 *   Block 7 (lf-autofill-lastwins):    original lines 1180–1221
 * Do not add shared/global rules here — page-specific styles only.
 */
        body {
            background: linear-gradient(to bottom right, #134160, #586C75, #134160, #586C75) no-repeat fixed;
            background-size: cover;
            padding: 20px 20px 20px;
            ;
        }


        h1 {
            font-family: 'alfarn', serif;
            text-align: center;
            color: #FDA929;
            letter-spacing: 1.5px;
            font-weight: 700;
            /* MISMA distancia arriba/abajo del título */
            margin: 40px 0;
            /* ajusta 32/40/48 a gusto */

        }

        h2 {
            font-family: 'alfarn', serif;
            text-align: center;
            color: #FDA929;
            letter-spacing: 1.5px;
            /* evita que el h2 del panel meta un margen gigante */
            margin: 0;
            font-weight: 300;
            font-size: 20px;
        }

        /* Scrollbar casi invisible (solo WebKit: Chrome/Edge/Safari) */


        /* ===== Ocultar COMPLETAMENTE el scrollbar (seguir desplazando) ===== */
        /* WebKit (Chrome / Edge / Safari) */
        html::-webkit-scrollbar,
        body::-webkit-scrollbar {
            width: 0;
            /* sin ancho */
            height: 0;
            /* sin alto (para ejes horizontales) */
            background: transparent;
            /* por si el motor pinta pista */
        }

        /* Firefox */
        html,
        body {
            scrollbar-width: none;
            /* oculta el scrollbar */
            scrollbar-color: transparent transparent;
            /* redundante: “por si acaso” */
        }

        /* Windows/IE legado (EdgeHTML) – no estorba en navegadores modernos */
        html,
        body {
            -ms-overflow-style: none;
            /* esconder barras en motores MS antiguos */
        }

        form {
            max-width: none;
            box-shadow: 0 5px 10px rgba(0, 0, 0, 1) !important;
            padding: 40px;
            border-radius: 15px;
        }

        label {
            margin-top: 10px;
            margin-bottom: 3px;
            font-weight: bold;
            color: white;
            position: relative;
            display: inline-block;
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;

        }

        select:focus {
            color: #FDA929;
        }

        option:disabled {
            color: #ccc;
        }

        input::placeholder {
            color: #ccc;
        }


        .navbar {
            display: flex;
            justify-content: space-around;
            align-items: center;
            background-color: rgba(255, 255, 255, 0.1);
            padding: 15px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
        }

        .navbar a {
            color: #fff;
            text-decoration: none;
            padding: 15px 35px;
            border-radius: 5px;
            font-family: 'alfarn-2', sans-serif;
            transition: background-color 0.3s ease, color 0.3s ease;
        }

        .navbar a:hover {
            background-color: rgba(255, 255, 255, 0.2);
        }

        .navbar a.active {
            background-color: #ff9900;
            color: #000;
        }

        .main-wrapper {
            display: flex;
            flex-direction: column;
            min-height: 95vh;
        }

        .main-content {
            flex: 1;
            padding: 0 20px 20px;
        }

        /* Inline results panel (always visible) */
        .results-panel {
            box-shadow: 0 0 10px 2px #FDA929 !important;
            background-color: #2b4a5e;
            color: white;
            margin: 0 auto 30px auto;
            padding: 10px;
            border: 2px solid #FDA929;
            width: 100%;
            max-width: 100%;
            border-radius: 15px;
            text-align: center;
        }

        .results-panel p {
            margin: 0px 0;
            font-size: 22px;
        }

        .results-panel strong {
            color: #FDA929;
            font-size: 25px;
        }

        .hint {
            opacity: 0.85;
            font-size: 16px;
            margin-top: 8px;
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
        }

        .footer {
            background-color: rgba(255, 255, 255, 0.1);
            color: white;
            text-align: center;
            padding: 5px;
            margin-top: 20px;
            border-top: 1px solid rgba(255, 255, 255, 0.2);
            box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2) !important;
        }

        .footer .disclaimer {
            width: 70%;
            font-size: 14px;
            line-height: 1.6;
            margin: 10px auto;
            letter-spacing: 0.5px;
        }

        .disclaimer-label {
            color: #FDA929;
            font-size: 20px;
            line-height: 1.6;
            margin: 5px;
            font-weight: bold;
        }

        .info-icon {
            display: inline-block;
            background-color: #ffffff;
            color: white;
            font-size: 14px;
            font-weight: bold;
            width: 13px;
            height: 13px;
            line-height: 180px;
            text-align: center;
            border-radius: 50%;
            cursor: pointer;
            position: relative;
            transition: transform 0.2s ease;
        }

        .info-icon:hover {
            transform: scale(1.1);
        }

        .info-box {
            display: none;
            position: absolute;
            background-color: #1c3341;
            color: white;
            padding: 15px;
            border-radius: 12px;
            box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2) !important;
            min-width: 500px;
            font-size: 14px;
            line-height: 1.5;
            z-index: 1000;
            top: 0;
            left: calc(100% + 10px);
            white-space: normal;
            transition: opacity 0.3s ease, transform 0.3s ease;
            pointer-events: none;
        }

        .info-box strong {
            color: #FDA929;
        }

        .info-box p {
            margin: 5px 0;
        }

        .info-icon:hover+.info-box,
        .info-icon:focus+.info-box {
            display: block;
            pointer-events: auto;
        }

        @media (max-width: 768px) {
            .navbar {
                flex-direction: column;
            }

            .navbar a {
                padding: 10px;
                width: 100%;
                text-align: center;
            }
        }


        /* =============== STACKED LAYOUT: form above results (START) ================== */
        .calc-two-col {
            width: 100%;
            max-width: 1200px;
            margin: 0 auto 10px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 16px;
        }

        /* Make the calculator a bit wider but centered */
        .calc-two-col #rehabForm {
            width: 100%;
            max-width: 900px;
            /* wider calculator container */
            margin: 0 auto;
        }

        /* Results panel sits UNDER the form and matches its width */
        .calc-two-col .results-panel {
            width: 100%;
            max-width: 900px;
            margin: 0 auto;
            position: static;
            text-align: center;
        }

        /* =============== STACKED LAYOUT: form above results (END) ==================== */

        /* ---- Form row helpers for 2-column groupings ---- */
        .form-rows {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .two-col {
            display: grid;
            grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
            /* prevents overflow */
            gap: 20px;
            /* 16–24px is a good range; 100px can force awkward widths */
        }

        /* keep children from stretching the column */
        .two-col .field {
            min-width: 0;
        }

        .two-col .field>* {
            min-width: 0;
        }

        /* ensure controls never exceed the column width */
        .two-col .field .lf-control {
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
            display: block;
        }


        /* make each column stack its label + input nicely */
        .two-col .field {
            display: flex;
            flex-direction: column;
        }

        /* keep labels consistent */
        #rehabForm label {
            margin-top: 0;
        }

        /* Responsive: collapse to one column on small screens */
        @media (max-width: 900px) {
            .two-col {
                grid-template-columns: 1fr;
            }
        }


        .results-row-3 {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 20px;
            margin-top: 15px;

        }

        .results-row-3 .result-item {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 10px;
            padding: 10px;
            text-align: center;

        }

        .results-row-3 .result-item p {
            margin: 0;
            font-size: 18px;
            font-weight: bold;

        }


        /* Titles inside results panel */
        .results-row-3 .result-item h4 {
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
            font-weight: 600;
            letter-spacing: 0.5px;
            color: #FDA929;
            margin: 0 0 6px 0;
            font-size: 16px;
        }

        /* Monetary values */
        #totalCost,
        .results-row-3 .result-item p {
            font-family: 'Inconsolata';
            font-weight: 400;
            font-size: 1.1em;
            color: #ffffff;
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;

        }

/* === unnamed block 2 === */
        /* ======================= Prevent autofill from forcing white/yellow backgrounds ===================== */
        /* ======================= Unify autofill with glass-gold ===================== */
        input:-webkit-autofill,
        input:-webkit-autofill:hover,
        input:-webkit-autofill:focus,
        select:-webkit-autofill,
        textarea:-webkit-autofill {
            /* kill the yellow fill without losing our gradient */
            -webkit-box-shadow: 0 0 0px 1000px transparent inset !important;
            background-color: transparent !important;

            /* match your controls */
            -webkit-text-fill-color: var(--ctrl-fg) !important;
            caret-color: var(--ctrl-fg) !important;

        }

        /* Ensure lf-control keeps the same glass + border when autofilled */
        input.lf-control:-webkit-autofill,
        textarea.lf-control:-webkit-autofill {
            border: 1px solid rgba(253, 169, 41, 0.45) !important;
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
                rgba(19, 65, 96, 0.35) !important;
            color: var(--ctrl-fg) !important;
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif !important;
        }

        /* Firefox */
        input.lf-control:-moz-autofill,
        textarea.lf-control:-moz-autofill {
            box-shadow: 0 0 0px 1000px transparent inset !important;
            background-color: transparent !important;
            color: var(--ctrl-fg) !important;
            border: 1px solid rgba(253, 169, 41, 0.45) !important;
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif !important;
        }


        input {
            font-size: 16px !important;
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif !important;
        }



        /* WebKit / Chromium (Chrome, Edge, etc.) */
        input.lf-control:-webkit-autofill,
        input.lf-control:-webkit-autofill:hover,
        input.lf-control:-webkit-autofill:focus,
        textarea.lf-control:-webkit-autofill,
        select.lf-control:-webkit-autofill {
            /* Repaint the field with your glass background instead of opaque white */
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 1000px rgba(19, 65, 96, 0.35) inset !important;
            /* glassy fill */
            -webkit-text-fill-color: var(--ctrl-fg, red) !important;
            caret-color: var(--ctrl-fg, red) !important;
            border: 1px solid rgba(253, 169, 41, 0.45) !important;
            /* neutralize UA repaint */
            background-clip: padding-box !important;
        }

        /* If your selects use the alt/glass theme, keep parity there too */
        .select-wrap.select--alt select:-webkit-autofill {
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 1000px rgba(19, 65, 96, 0.35) inset !important;
            -webkit-text-fill-color: red !important;
        }



        /* ========================= ICON ======================*/

        /* --- Modern inline tooltip for short help --- */
        .info-icon {
            display: inline-flex;
            justify-content: center;
            align-items: center;
            width: 14px;
            height: 14px;
            margin-left: 1px;
            border-radius: 50%;
            background: #ffffff4d;
            color: #1c3341;
            font-size: 13px;
            font-weight: 400;
            cursor: pointer;
            position: relative;
        }

        /* --- Expandable helper for long text (Rehab Level) --- */

        /* Overlay help panel (does not affect layout) */
        .help-text {
            position: absolute;
            top: calc(100% + 10px);
            /* below the label */
            /* left: calc(20% + 10px); */
            transform: translateX(20%);
            /* center under the label */
            width: 380px;
            max-width: min(90vw, 420px);
            background: #2B4A5E;
            color: #fff;
            padding: 3px 10px;
            border-radius: 10px;
            box-shadow: 0 10px 20px rgba(0, 0, 0, .35) !important;
            z-index: 9999;
            font-size: 14px;
            /* hidden by default, but still out of flow */
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transition: opacity .15s ease, visibility .15s ease;
        }

        /* Show on hover over the icon (or the label if you prefer) */
        .info-icon[data-expand]:hover+.help-text {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
        }

        /* Optional: also keep it open when hovering the panel itself */
        .info-icon[data-expand]:hover+.help-text:hover {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
        }


        /* Subtle visual feedback on the icon while active */
        .info-icon[data-expand]:hover {
            background: #ffbe4a;
            box-shadow: 0 0 0 2px rgba(253, 169, 41, 0.25) inset !important;
        }

        label[for="rehabLevel"]:hover .info-icon[data-expand]+.help-text {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
        }

        /* Anchor point for the Rehab Level overlay */
        label[for="rehabLevel"] {
            position: relative;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }


        /* 1) Make the overlay easier to reach: reduce the vertical gap a bit */
        .help-text {
            top: calc(100% + 6px);
            /* was 10px */
        }

        /* 2) Create a transparent "hover bridge" so moving from the icon to the panel
      doesn't kill the hover state before the cursor lands on the panel */
        .help-text::before {
            content: "";
            position: absolute;
            top: -12px;
            /* extends hover area upward */
            left: 0;
            right: 0;
            height: 12px;
            /* bridge height */
            background: transparent;
        }

        /* 3) Keep the panel open when the icon OR the label OR the panel itself is hovered */
        .info-icon[data-expand]:hover+.help-text,
        label[for="rehabLevel"]:hover .help-text,
        .help-text:hover {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
        }


        /* Make every short tooltip hoverable without flicker */
        .info-icon {
            position: relative;
            /* anchor for the overlay + bridge */
        }

        /* The tooltip bubble */
        .info-icon::after {
            content: attr(data-tooltip);
            position: absolute;
            bottom: 125%;
            /* place ABOVE the icon */
            left: 50%;
            transform: translateX(-50%);
            background: #1c3341;
            color: #fff;
            padding: 6px 5px;
            border-radius: 6px;
            font-size: 13px;
            white-space: normal;
            width: 240px;
            text-align: center;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25) !important;
            z-index: 9999;

            /* hidden by default, but not in layout */
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            /* off until shown */
            transition: opacity .15s ease, visibility .15s ease;
        }


        /* ===========================CATEGORIES FOR INFO BOX ================== */
        .help-text strong.category {
            color: #FDA929;
            display: block;
            /* forces line break after the label */
            margin-bottom: 2px;
            /* optional spacing */
        }


        /* ================== SELECT FIELDS STYLE =================*/
        /* ===== Alternate Theme (glass + gold) ===== */
        .select-wrap.select--alt {
            position: relative;
            display: inline-block;
            width: 100%;
        }

        .select-wrap.select--alt select {
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
            width: 100%;
            padding: 12px 48px 12px 16px;
            border-radius: 999px;
            border: 1px solid rgba(253, 169, 41, 0.45);
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
                rgba(19, 65, 96, 0.35);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
            color: #eaf2f7;
            font-size: 16px;
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif !important;
            outline: none;
            transition: box-shadow .18s ease, border-color .18s ease, background .18s ease;
            backdrop-filter: blur(3px);
        }


        /* Hover: brighter glass + border */
        .select-wrap.select--alt select:hover {
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.03)),
                rgba(19, 65, 96, 0.42);
            border-color: rgba(253, 169, 41, 0.75);
        }

        /* Focus: gold ring */
        .select-wrap.select--alt select:focus {
            border-color: #FDA929;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 0 0 3px rgba(253, 169, 41, 0.25) !important;
        }

        /* Disabled */
        .select-wrap.select--alt select:disabled {
            opacity: .6;
            cursor: not-allowed;
        }

        /* Placeholder option tint */
        .select-wrap.select--alt select option[disabled][selected] {
            color: #9fb2be;
        }

        /* Custom chevron (thin outline arrow in gold) */
        .select-wrap.select--alt::after {
            content: "";
            position: absolute;
            right: 16px;
            top: 50%;
            transform: translateY(-50%);
            width: 12px;
            height: 12px;
            opacity: .95;
            pointer-events: none;
            background: no-repeat center/12px 12px url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23FDA929' stroke-width='2' d='M7 10l5 5 5-5'/%3E%3C/svg%3E");

        }

        /* Size variants (optional) */
        .select-wrap.select--alt.select--sm select {
            padding: 9px 42px 9px 14px;
            font-size: 14px;
        }

        .select-wrap.select--alt.select--lg select {
            padding: 14px 54px 14px 18px;
            font-size: 18px;
        }

        /* Firefox high-contrast caret fix */
        @-moz-document url-prefix() {
            .select-wrap.select--alt select:-moz-focusring {
                color: transparent;
                text-shadow: 0 0 0 #eaf2f7;
            }
        }


        /* --- Uniform Franklin Gothic Style for Select Inputs --- */
        select {
            -webkit-appearance: none;
            appearance: none;
            width: 100%;
            padding: var(--ctrl-pad-y) calc(var(--ctrl-pad-x) + 22px) var(--ctrl-pad-y) var(--ctrl-pad-x);
            border-radius: var(--ctrl-radius);
            border: 1px solid var(--ctrl-border);
            background:
                linear-gradient(180deg, var(--ctrl-bg1), var(--ctrl-bg2)),
                var(--ctrl-tint);
            color: var(--ctrl-fg);
            font-size: 16px;
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif !important;
            backdrop-filter: blur(3px);
            transition: box-shadow .18s ease, border-color .18s ease, background .18s ease;
            background-image:
                url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="%23FDA929"><path d="M7 10l5 5 5-5z"/></svg>');
            background-repeat: no-repeat;
            background-position: right 12px center;
            background-size: 18px 18px;
            cursor: pointer;
        }

        select:hover {
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.03)),
                rgba(19, 65, 96, 0.42);
            border-color: var(--ctrl-border-hover);
        }

        select:focus {
            border-color: #FDA929;
            box-shadow: 0 0 0 3px var(--ctrl-ring) !important;
        }

        /*========================== MORE STYLING FOR THE IINPUTS ===========================*/

        /* ===== Unified Control Theme (glass + gold) ===== */
        :root {
            /* also used by ghost overlay */
            /* pill look */
        }

        /* Wrap (optional, handy if you need icons/add-ons) */
        .lf-control-wrap {
            position: relative;
            display: inline-block;
            width: 100%;
        }

        /* Apply this class to any input/textarea/select */
        .lf-control {
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
            width: 100%;
            padding: var(--ctrl-pad-y) var(--ctrl-pad-x);
            border-radius: var(--ctrl-radius);
            border: 1px solid rgba(253, 169, 41, 0.45);
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
                rgba(19, 65, 96, 0.35);
            color: #eaf2f7;
            font-size: 16px;
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif !important;
            outline: none;
            transition: box-shadow .18s ease, border-color .18s ease, background .18s ease;
            backdrop-filter: blur(3px);
        }


        /* Hover / Focus / Disabled */
        .lf-control:hover {
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.03)),
                rgba(19, 65, 96, 0.42);
            border-color: var(--ctrl-border-hover);
        }

        .lf-control:focus {
            border-color: #FDA929;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 0 0 3px var(--ctrl-ring) !important;
        }

        .lf-control:disabled {
            opacity: var(--ctrl-disabled);
            cursor: not-allowed;
        }

        /* Textarea tweaks (not pill by default, but can be) */
        textarea.lf-control {
            border-radius: 14px;
            /* change to var(--ctrl-radius) if you want pill */
            min-height: 110px;
            resize: vertical;
        }

        /* Placeholder tint */
        .lf-control::placeholder {
            color: #eaf2f7;
        }

        /* Firefox high-contrast caret fix */
        @-moz-document url-prefix() {
            .lf-control:-moz-focusring {
                color: transparent;
                text-shadow: 0 0 0 var(--ctrl-fg);
            }
        }

        /* ===== Select chevron (keep your wrapper) ===== */
        .select-wrap {
            position: relative;
            display: inline-block;
            width: 100%;
        }

        .select-wrap select.lf-control {
            padding-right: 48px;
        }


        /* ===== Error / Success states (optional) ===== */
        .lf-control.is-error {
            border-color: #ff6b6b;
            box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2) !important;
        }

        .lf-control.is-success {
            border-color: #31d0aa;
            box-shadow: 0 0 0 3px rgba(49, 208, 170, 0.2) !important;
        }


        /* Ghost overlay alignment with unified controls */
        .affix-ghost {
            position: relative;
            display: block;
            overflow: hidden;
        }

        .affix-ghost input.ghosted {
            color: transparent;
            caret-color: #ccc;
        }

        .ghost-value {
            position: absolute;
            left: var(--ctrl-pad-x);
            /* ← aligns with lf-control padding */
            top: 50%;
            transform: translateY(-50%);
            pointer-events: none;
            white-space: nowrap;
            font: inherit;
            color: #e6edf3;
            opacity: .95;
        }

        .ghost-value .unit {
            opacity: .55;
        }




        /* ---- Glass Golden KPI cards (from ARV) ---- */
        /* Centered uniform KPI band */
        .kpi-band {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 25px;
            flex-wrap: wrap;
            margin: 20px auto;
            width: 100%;
            max-width: 900px;
        }

        /* Equal-size KPI cards */
        .kpi-card {
            flex: 1;
            min-width: 200px;
            max-width: 200px;
            text-align: center;
            background: linear-gradient(135deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .06));
            border: 1px solid rgba(255, 255, 255, .22);
            border-radius: 16px;
            padding: 0px 10px;
            backdrop-filter: blur(8px);
            box-shadow: 0 10px 28px rgba(0, 0, 0, .30), 0 0 0 1px rgba(255, 255, 255, .06) inset !important;
            position: relative;
        }

        .kpi-card:before {
            content: "";
            position: absolute;
            inset: 0;
            border-radius: 16px;
            pointer-events: none;
            box-shadow: 0 0 0 1px rgba(253, 169, 41, .35), 0 0 22px rgba(253, 169, 41, .15) inset !important;
        }

        /* Keep the middle card (Total Custom Charges) slightly emphasized */
        /* Enlarge the middle KPI (Resale Price) */
        .kpi-card:nth-child(2) {
            min-width: 240px;
            max-width: 240px;
            padding: 6px 12px;
            transform: scale(1.1);

        }

        /* Slightly larger text inside the emphasized card */
        .kpi-card:nth-child(2) .kpi-label {
            font-size: 13px;
        }

        .kpi-card:nth-child(2) .kpi-value {
            font-size: 20px;
        }


        .kpi-card.small {
            padding: 7px 6px;
            border-radius: 12px;
        }

        .kpi-card.large {
            padding: 7px 6px;
            border-radius: 12px;
        }

        .kpi-card:before {
            content: "";
            position: absolute;
            inset: 0;
            border-radius: 16px;
            pointer-events: none;
            box-shadow: 0 0 0 1px rgba(253, 169, 41, .35), 0 0 22px rgba(253, 169, 41, .15) inset !important;
        }

        .kpi-label {
            font-family: 'alfarn', serif;
            font-size: 12px;
            letter-spacing: .5px;
            color: #FDA929;
            opacity: .95;
        }

        .kpi-value {
            margin-top: 1px;
            font-weight: 800;
            font-size: 18px;
            color: #fff;
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif !important;
            text-shadow: 0 2px 4px rgba(0, 0, 0, .35);
        }

        .kpi-sub {
            margin-top: 4px;
            font-size: .75rem;
            color: rgba(255, 255, 255, .7);
        }

        @media (max-width:1100px) {
            .kpi-band {
                grid-template-columns: 1fr 1fr
            }
        }

        @media (max-width:680px) {
            .kpi-band {
                grid-template-columns: 1fr
            }
        }



        /* Highlight main Rehab Total Cost metric */
        #totalRehabCost,
        #totalCost,
        #rehabTotal {
            text-shadow:
                0 4px 4px rgb(0, 0, 0);
            color: #fff;
            font-size: 24px !important;
            font-weight: 900;
            letter-spacing: 0.5px;
        }

/* === lf-autofill-neutralizer === */
        /* === Neutralize browser autofill/suggestion paint (no color changes) === */
        .lf-control:-webkit-autofill,
        .lf-control:-webkit-autofill:hover,
        .lf-control:-webkit-autofill:focus,
        input:-webkit-autofill,
        input:-webkit-autofill:hover,
        input:-webkit-autofill:focus,
        select:-webkit-autofill,
        textarea:-webkit-autofill {
            -webkit-text-fill-color: inherit !important;
            caret-color: inherit !important;
            background: inherit !important;
            background-color: transparent !important;
            background-image: none !important;
            -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
            box-shadow: none !important;
            transition: background-color 99999s linear 0s, color 0s !important;
        }

        /* Firefox & spec-compliant */
        .lf-control:-moz-autofill,
        input:-moz-autofill,
        select:-moz-autofill,
        textarea:-moz-autofill,
        .lf-control:autofill,
        input:autofill,
        select:autofill,
        textarea:autofill {
            color: inherit !important;
            background: inherit !important;
            background-color: transparent !important;
            background-image: none !important;
            box-shadow: none !important;
        }

        /* Keep focus ring/border behavior, but never repaint the background */
        .lf-control:focus,
        input:focus,
        select:focus,
        textarea:focus {
            background: inherit !important;
        }

/* === lf-select-options-fix === */
        /* Ensure select dropdown lists are readable across browsers */
        select,
        .select-wrap select {
            color: var(--select-fg, #0f2b36);
            -webkit-text-fill-color: var(--select-fg, #0f2b36);
        }

        /* Style the dropdown list items */
        select option,
        select optgroup,
        .select-wrap select option,
        .select-wrap select optgroup {
            color: #0f2b36 !important;
            /* dark readable text */
            background-color: #ffffff !important;
            /* white dropdown background */
        }

        /* Highlighted/hovered option (where supported) */
        select option:checked,
        select option:focus,
        select option:hover {
            color: #0b1f27 !important;
            background-color: #e6f1f7 !important;
        }

        /* Windows High Contrast / forced-colors friendly fallbacks */
        @media (forced-colors: active) {

            select option,
            .select-wrap select option {
                forced-color-adjust: none;
            }
        }

        /* Keep the field itself styled as before */
        .select-wrap.select--alt select:focus {
            -webkit-text-fill-color: inherit;
        }

/* === lf-select-blue-menu === */
        :root {
            --menu-bg: rgba(19, 65, 96, 0.90);
            /* glassy blue */
            --menu-bg-hover: rgba(19, 65, 96, 0.96);
            --menu-fg: #eaf2f7;
        }

        select option,
        select optgroup,
        .select-wrap select option,
        .select-wrap select optgroup {
            color: var(--menu-fg) !important;
            background-color: var(--menu-bg) !important;
        }

        select option:checked,
        select option:focus,
        select option:hover {
            color: var(--menu-fg) !important;
            background-color: var(--menu-bg-hover) !important;
        }

        /* Scrollbar (WebKit) */
        select::-webkit-scrollbar {
            width: 12px;
        }

        select::-webkit-scrollbar-track {
            background: rgba(19, 65, 96, 0.70);
        }

        select::-webkit-scrollbar-thumb {
            background: rgba(19, 65, 96, 0.96);
            border-radius: 8px;
            border: 2px solid rgba(19, 65, 96, 0.70);
        }

/* === lf-select-closed-white === */
        /* Keep white text in the CLOSED select after user chooses an option */
        .select-wrap select,
        select {
            color: #eaf2f7 !important;
            /* white-ish foreground */
            -webkit-text-fill-color: #eaf2f7 !important;
            /* Blink/WebKit */
        }

        /* Placeholder/first empty option looks dimmer (if you use one) */
        select:has(option[value=""]:checked) {
            color: rgba(234, 242, 247, .70) !important;
            -webkit-text-fill-color: rgba(234, 242, 247, .70) !important;
        }

        /* High-contrast/forced colors accessibility */
        @media (forced-colors: active) {

            .select-wrap select,
            select {
                forced-color-adjust: none;
            }
        }

/* === lf-autofill-lastwins === */
        /* === LAST-WINS AUTOFILL/REPAINT NEUTRALIZER (fix for tab switch) === */
        .lf-control,
        .select-wrap select.lf-control {
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
                rgba(19, 65, 96, 0.35) !important;
        }

        /* Blink/WebKit autofill + preview repaint */
        .lf-control:-webkit-autofill,
        .lf-control:-webkit-autofill:hover,
        .lf-control:-webkit-autofill:focus,
        input:-webkit-autofill,
        input:-webkit-autofill:hover,
        input:-webkit-autofill:focus,
        select:-webkit-autofill {
            -webkit-text-fill-color: #eaf2f7 !important;
            caret-color: #eaf2f7 !important;
            background-color: transparent !important;
            background-image: none !important;
            /* paint over UA yellow/gray */
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 1000px rgba(19, 65, 96, 0.35) inset !important;
            -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 1000px rgba(19, 65, 96, 0.35) inset !important;
            transition: background-color 99999s linear 0s, color 0s !important;
        }

        /* Firefox */
        input.lf-control:-moz-autofill,
        textarea.lf-control:-moz-autofill {
            box-shadow: none !important;
            background: transparent !important;
            color: #eaf2f7 !important;
        }

        /* When field regains focus after hidden tab, enforce our glass again */
        .lf-control:focus {
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.03)),
                rgba(19, 65, 96, 0.42) !important;
        }

        /* ============================================================
           2C-C — Responsive: tablet & mobile
           All rules below are additive max-width overrides.
           Desktop rules above this block are untouched.
           ============================================================ */

        /* --- 900px: results-row-3 → 2-col on tablet --- */
        @media (max-width: 900px) {

            /* 3-col result cards → 2-col on tablet */
            .results-row-3 {
                grid-template-columns: repeat(2, 1fr);
            }

            /* KPI band: constrain min-width so cards don't force overflow */
            .kpi-card {
                min-width: 140px;
                max-width: 180px;
            }

            .kpi-card:nth-child(2) {
                min-width: 160px;
                max-width: 200px;
                transform: scale(1.05);
            }
        }

        /* --- 680px: results-row-3 → 1-col on phone --- */
        @media (max-width: 680px) {

            /* 2-col → 1-col on phone portrait */
            .results-row-3 {
                grid-template-columns: 1fr;
            }

            /* KPI cards: fill width on phone */
            .kpi-band {
                gap: 12px;
            }

            .kpi-card,
            .kpi-card:nth-child(2) {
                min-width: 0;
                max-width: 100%;
                flex: 1 1 calc(50% - 12px);
                transform: none;
            }

            /* Form padding reduced on phone */
            form {
                padding: 20px 16px;
            }

            /* Info tooltip: cap width so it doesn't overflow viewport */
            .info-box {
                min-width: 0;
                width: min(320px, 90vw);
            }
        }

        /* --- 480px: final single-column pass --- */
        @media (max-width: 480px) {

            /* KPI cards fully single-column */
            .kpi-card,
            .kpi-card:nth-child(2) {
                flex: 1 1 100%;
            }

            /* h1 title smaller */
            h1 {
                font-size: 1.6rem;
                margin: 24px 0;
            }
        }
