/* --- EXTRACTED SITE STYLES --- */
:root {
    --ifoa-navy: #003a5d;
    --ifoa-gold: #c3a344;
    --ifoa-grey: #4a4a4a;
    --ifoa-light-blue: #eef4f8;
    --ifoa-green: #2e7d32;
    --ifoa-red: #d32f2f;
}

body:not(.calc-body) { font-family: 'Arial', sans-serif; color: var(--ifoa-grey); background-color: #f9f9f9; height: auto; overflow: visible; display: block; }
body:not(.calc-body) h1, body:not(.calc-body) h2, body:not(.calc-body) h3, body:not(.calc-body) h4 { color: var(--ifoa-navy); }

body:not(.calc-body) .text-gold { color: var(--ifoa-gold); }
body:not(.calc-body) .bg-navy { background-color: var(--ifoa-navy); }
body:not(.calc-body) .bg-gold { background-color: var(--ifoa-gold); }
body:not(.calc-body) .border-gold { border-color: var(--ifoa-gold); }
body:not(.calc-body) .text-navy { color: var(--ifoa-navy); }

body:not(.calc-body) .btn-primary { background-color: var(--ifoa-navy); color: white; transition: background-color 0.3s; border-radius: 9999px; box-shadow: none; }
body:not(.calc-body) .btn-primary:hover { background-color: #00223b; transform: none; }
body:not(.calc-body) .btn-secondary { background-color: var(--ifoa-gold); color: var(--ifoa-navy); transition: background-color 0.3s; border-radius: 9999px; }
body:not(.calc-body) .btn-secondary:hover { background-color: #ccb279; }

.btn-outline { background-color: white; color: var(--ifoa-navy); border: 2px solid var(--ifoa-navy); transition: all 0.3s; border-radius: 9999px; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 12px 24px; }
.btn-outline:hover { background-color: #f3f4f6; }

body.dark-mode .btn-outline { background-color: transparent; color: #90caf9 !important; border-color: #90caf9 !important; }
body.dark-mode .btn-outline:hover { background-color: rgba(144, 202, 249, 0.1); }

.persona-card { transition: transform 0.2s, box-shadow 0.2s; }
.persona-card:hover { transform: translateY(-5px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }

.header-stripe { height: 4px; background-color: var(--ifoa-gold); width: 100%; }
#mobile-menu { display: none; }
#mobile-menu.open { display: block; }
html { scroll-padding-top: 80px; }
.stat-card { border-left: 4px solid var(--ifoa-navy); }
.stat-card-warning { border-left: 4px solid #ef4444; }


/* --- CSS RESET & VARIABLES --- */
*, *::before, *::after { box-sizing: border-box; }
:root { 
    --ifoa-blue: #003a5d; 
    --ifoa-gold: #bfa15d; 
    --bg: #f4f7f9; 
    --success: #2e7d32;
    --danger: #c62828;
    --card-shadow: 0 8px 24px rgba(0,0,0,0.08);
    --card-radius: 14px;
    --font-main: 'Segoe UI', system-ui, sans-serif;
}

body.calc-body { font-family: var(--font-main); background: var(--bg); margin: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; color: #333; }

/* --- HEADER --- */
.header-actions { display: flex; align-items: center; gap: 20px; }
.compare-toggle { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; font-weight: bold; cursor: pointer; color: white;}
.compare-toggle input[type="checkbox"] { appearance: none; width: 44px; height: 24px; background: rgba(255,255,255,0.3); border-radius: 12px; position: relative; cursor: pointer; outline: none; transition: background 0.3s; }
.compare-toggle input[type="checkbox"]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: white; border-radius: 50%; transition: transform 0.3s; }
.compare-toggle input[type="checkbox"]:checked { background: var(--ifoa-gold); }
.compare-toggle input[type="checkbox"]:checked::after { transform: translateX(20px); }

/* Compare is unavailable until every required input has been filled in */
.compare-toggle.is-disabled, .mobile-menu-item.is-disabled { opacity: 0.45; cursor: not-allowed; }
.compare-toggle.is-disabled label, .mobile-menu-item.is-disabled label { cursor: not-allowed; }
.compare-toggle input[type="checkbox"]:disabled { cursor: not-allowed; }

.settings-btn { background: transparent; border: none; color: white; padding: 8px 12px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 6px; font-weight: 400; font-size: 0.95rem; font-family: inherit; }
.settings-btn:hover { color: var(--ifoa-gold); background: transparent; }

.wrapper { display: flex; flex-direction: row; flex-grow: 1; overflow: hidden; width: 100%; position: relative; }

/* --- SIDEBAR --- */
.sidebar { width: 380px; min-width: 320px; overflow: hidden; padding: 0; background: white; border-right: 1px solid #ddd; box-shadow: 2px 0 10px rgba(0,0,0,0.03); flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar-scroll-area { padding: 25px; overflow-y: auto; overflow-x: hidden; flex-grow: 1; }
.compare-actions-footer { padding: 20px 25px; background: white; border-top: 1px solid #e0e6ed; box-shadow: 0 -4px 15px rgba(0,0,0,0.05); flex-shrink: 0; z-index: 10; }

body .btn-primary.btn-make-base { background-color: var(--ifoa-navy) !important; color: white !important; width: 100%; margin: 0 0 12px 0; transition: all 0.2s; min-height: 44px; padding: 12px 24px !important; }
body .btn-primary.btn-make-base:hover:not(:disabled) { background-color: #00223b !important; }
body .btn-primary.btn-make-base:disabled { background-color: #ccc !important; color: #666 !important; cursor: not-allowed !important; opacity: 0.7; }

.link-reset { display: block; text-align: center; color: var(--ifoa-blue); text-decoration: underline; font-size: 0.95rem; cursor: pointer; font-weight: bold; padding: 4px 0; transition: opacity 0.2s; }
.link-reset:hover { color: var(--ifoa-navy); }
.disclaimer-link { color: var(--ifoa-blue); text-decoration: underline; cursor: pointer; font-weight: 500; font-size: 0.875rem; transition: color 0.2s; }
.disclaimer-link:hover { color: var(--ifoa-navy) !important; }
.close-btn { min-height: 44px; min-width: 44px; padding: 8px; display: flex; align-items: center; justify-content: center; background-color: transparent; border: none; cursor: pointer; transition: color 0.2s; color: currentColor; }
.close-btn:hover { color: var(--ifoa-gold); opacity: 0.8; }
.link-start-over { margin-top: 0; font-size: 0.875rem; color: #666; text-decoration: none; display: block; text-align: center; transition: color 0.2s; }
.link-start-over:hover { color: var(--danger); text-decoration: underline; }

.sidebar-header { 
    margin-bottom: 20px; 
    display: flex; 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 12px; 
    border-bottom: 2px solid #eee; 
    padding-bottom: 15px;
}
.sidebar-header h2 { margin: 0; font-size: 1.2rem; color: var(--ifoa-blue); }

.input-wrapper.is-modified { background: #eaf2f8; border-color: var(--ifoa-blue); }
.toggle-container.is-modified { box-shadow: 0 0 0 2px var(--ifoa-blue); }

/* --- INPUTS & ADORNMENTS --- */
.input-row-single { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 12px; width: 100%; }
.input-row-single label { font-size: 0.9rem; font-weight: 500; color: #444; width: 100%; display: flex; justify-content: space-between; align-items: center;}
.input-row-single > label + .toggle-container { margin-top: 10px; }
.input-wrapper { display: flex; align-items: center; width: 100%; border: 1px solid #ccc; border-radius: 6px; background: white; transition: border-color 0.3s, box-shadow 0.3s; padding: 0 10px; }
.input-wrapper:focus-within { border-color: var(--ifoa-blue); box-shadow: 0 0 0 3px rgba(0, 58, 93, 0.1); }
.input-wrapper input, .input-wrapper select { border: none; padding: 10px 0; outline: none; background: transparent; flex: 1; font-size: 0.95rem; font-family: var(--font-main); text-align: left; min-width: 0; }
.prefix { color: #555; font-weight: bold; margin-right: 6px; user-select: none; font-size: 0.95rem;}
.suffix { color: #555; font-weight: bold; margin-left: 6px; user-select: none; font-size: 0.9rem; white-space: nowrap;}
.wrapper-readonly { background: #f0f4f8; border-color: #e0e6ed; }
input.readonly-calc { color: #555; cursor: not-allowed; font-weight: bold; }

/* Accordions */
details { margin-bottom: 15px; border: 1px solid #eee; border-radius: 8px; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.02);}
summary { background: #f8f9fa; padding: 15px; font-weight: bold; color: var(--ifoa-blue); cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; border-radius: 8px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '▼'; font-size: 0.9em; color: #888; }
details[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 1px solid #eee; }
details[open] summary::after { content: '▲'; }
.accordion-content { padding: 20px 15px; }

.sub-group-title { font-size: 0.875rem; text-transform: uppercase; color: #666; font-weight: bold; margin: 20px 0 12px 0; border-bottom: 1px solid #eee; padding-bottom: 6px; }
.sub-group-title:first-child { margin-top: 0; }

/* Segmented Toggles */
.toggle-container { display: flex; background: #e0e6ed; border-radius: 20px; padding: 3px; position: relative; width: 100%; }

.toggle-container input[type="radio"] { 
    position: absolute; 
    opacity: 0; 
    width: 0; 
    height: 0; 
}
.toggle-container input[type="radio"]:focus-visible + label {
    outline: 2px solid var(--ifoa-blue);
    outline-offset: 2px;
    z-index: 1;
}

.toggle-container label { flex: 1; display: flex; justify-content: center; align-items: center; text-align: center; padding: 10px 8px; cursor: pointer; font-size: 0.9em; border-radius: 18px; margin: 0; transition: all 0.3s ease; color: #4a4a4a; font-weight: bold; line-height: 1.4; word-wrap: break-word; }

.toggle-container label:hover {
    background-color: rgba(0, 58, 93, 0.06);
    color: var(--ifoa-blue);
}
.toggle-container input[type="radio"]:checked + label { background-color: var(--ifoa-gold); color: var(--ifoa-blue); box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
.toggle-container input[type="radio"]:checked + label:hover { background-color: var(--ifoa-gold); color: var(--ifoa-blue); }

/* Buttons */
a:focus-visible, button:focus-visible, input[type="button"]:focus-visible, input[type="submit"]:focus-visible { outline: 2px solid var(--ifoa-navy); outline-offset: 3px; }

.btn-primary { background: var(--ifoa-gold); color: var(--ifoa-blue); border: none; padding: 12px 24px; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 1.05rem; transition: all 0.2s; box-shadow: 0 4px 10px rgba(191, 161, 93, 0.3); display: inline-block; text-align: center; min-height: 44px; min-width: 44px; display: flex; align-items: center; justify-content: center; }
.btn-primary:hover:not(:disabled) { background: #ccb279; transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; box-shadow: none; opacity: 0.6; }
.btn-full { width: 100%; display: block; margin-top: 20px; padding: 15px; font-size: 1.1rem; min-height: 44px; }
.btn-secondary { background: #e0e6ed; color: var(--ifoa-blue); border: none; padding: 12px 24px; border-radius: 8px; cursor: pointer; font-weight: bold; transition: all 0.2s; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
.btn-secondary:hover { background: #cfd8e3; }
.start-again-link { display: block; text-align: center; margin-top: 15px; color: #666; font-size: 0.9rem; text-decoration: underline; cursor: pointer; transition: color 0.2s; }
.start-again-link:hover { color: var(--danger); }

/* New Unfilled Undo Button */
.btn-undo {
    background: transparent;
    border: 1px solid var(--ifoa-red);
    color: var(--ifoa-red);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
    min-height: 44px;
    min-width: 44px;
}
.btn-undo:hover {
    background: #ffebee;
}

/* Helper Text */
.helper-text { max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease; font-size: 0.875rem; color: #666; line-height: 1.4; width: 100%; }
.input-row-single:focus-within .helper-text { max-height: 100px; opacity: 1; margin-top: 4px; }

/* Required Field Validation */
.input-wrapper.has-error, .toggle-container.has-error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12); }
.field-error-text { display: none; font-size: 0.875rem; color: var(--danger); line-height: 1.4; margin-top: 4px; width: 100%; }
.field-error-text.visible { display: block; }
body.dark-mode .field-error-text { color: #ef9a9a; }
body.dark-mode .input-wrapper.has-error, body.dark-mode .toggle-container.has-error { border-color: #ef9a9a !important; box-shadow: 0 0 0 3px rgba(239, 154, 154, 0.15); }

.is-hidden { display: none !important; }
.partner-toggle-wrapper { display: flex; }

/* --- MAIN CONTENT --- */
.main-content { flex-grow: 1; padding: 30px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; overflow-x: hidden; background: #f4f7f9; transition: opacity 0.3s ease, filter 0.3s ease; }
.main-content.stale { opacity: 0.5; filter: grayscale(30%); pointer-events: none; }

/* --- HERO CARDS --- */
.result-hero-card { display: flex; align-items: center; padding: 40px 30px; border-radius: 12px; border: 1px solid #ccc; margin-bottom: 5px; gap: 30px; font-family: inherit; box-shadow: var(--card-shadow); }
.hero-icon-wrapper { display: flex; justify-content: center; align-items: center; width: 90px; height: 90px; border-radius: 50%; flex-shrink: 0; }
.hero-text-content { display: flex; flex-direction: column; gap: 10px; }
.hero-title { margin: 0; font-size: 1.8rem; font-weight: 700; }
.hero-description { margin: 0; font-size: 1.1rem; line-height: 1.5; color: #4B5563; }
.hero-highlight { font-weight: 700; }

.theme-buy { background-color: #F0F6FC; border-color: #C5D9ED; }
.theme-buy .hero-icon-wrapper { background-color: #DDEAF8; color: #003366; }
.theme-buy .hero-title, .theme-buy .hero-highlight { color: #003366; }
.theme-rent { background-color: #FDF8ED; border-color: #EEDCA8; }
.theme-rent .hero-icon-wrapper { background-color: #FAEDCC; color: #996B00; }
.theme-rent .hero-title, .theme-rent .hero-highlight { color: #996B00; }
.theme-error { background-color: #FEF2F2; border-color: #FCA5A5; }
.theme-error .hero-icon-wrapper { background-color: #FEE2E2; color: #B91C1C; }
.theme-error .hero-title, .theme-error .hero-highlight { color: #B91C1C; }

.timing-hero-card { display: flex; align-items: center; padding: 25px 30px; border-radius: 12px; border: 1px solid #e0e6ed; gap: 20px; background-color: white; box-shadow: var(--card-shadow); }
.timing-icon-wrapper { display: flex; justify-content: center; align-items: center; width: 64px; height: 64px; background-color: #eaf2f8; border-radius: 50%; color: var(--ifoa-blue); flex-shrink: 0; }
.timing-text-content { display: flex; flex-direction: column; gap: 6px; }
.timing-title { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--ifoa-blue); }
.timing-description { margin: 0; font-size: 1.05rem; color: #4B5563; line-height: 1.5; }

.timing-hero-card-warning { background-color: #FEF2F2; border-color: #FCA5A5; }
.timing-icon-warning { background-color: #FEE2E2; color: #B91C1C; }
.timing-hero-card-warning .timing-title { color: #B91C1C; }

/* Mobile Dropdown Overrides */
.mobile-tabs-container { display: none; }
.custom-select { padding: 10px 15px; font-size: 0.95rem; border-radius: 8px; border: 1px solid #ccc; font-weight: bold; color: var(--ifoa-blue); background-color: white; cursor: pointer; }

/* Tabs */
.tabs { display: flex; justify-content: flex-start; background: transparent; padding: 0; border-radius: 0; margin-bottom: 20px; border-bottom: 2px solid #e0e6ed; }
.tab-btn { padding: 10px 20px; text-align: center; font-size: 0.95rem; font-weight: normal; background: transparent; color: #666; text-transform: uppercase; border: none; border-bottom: 4px solid transparent; border-radius: 0; cursor: pointer; transition: all 0.3s ease; margin-bottom: -2px; }
.tab-btn:hover { color: var(--ifoa-blue); }
.tab-btn.active { background: transparent; color: var(--ifoa-blue); font-weight: bold; border-bottom-color: var(--ifoa-gold); box-shadow: none; }

/* Sub-tabs (Personal Details, Pensions, Rates & Rules) mimic main tabs */
.tab-navigation { 
    display: flex; 
    background: transparent; 
    padding: 0; 
    margin-bottom: 20px; 
    border-bottom: 2px solid #e0e6ed; 
    width: 100%; 
}
.tab-navigation input[type="radio"] { 
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.tab-navigation label { 
    flex: 1; 
    text-align: center; 
    padding: 10px 0; 
    font-size: 0.95rem; 
    font-weight: normal; 
    background: transparent; 
    color: #666; 
    text-transform: uppercase; 
    border-bottom: 4px solid transparent; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    margin-bottom: -2px; 
}
.tab-navigation label:hover { color: var(--ifoa-blue); }
.tab-navigation input[type="radio"]:checked + label, .tab-navigation label.active { 
    color: var(--ifoa-blue); 
    font-weight: bold; 
    border-bottom-color: var(--ifoa-gold); 
}
.tab-navigation input[type="radio"]:focus-visible + label {
    outline: 2px solid var(--ifoa-blue);
    outline-offset: -2px;
    z-index: 2;
}

.view-section { display: none; animation: fadeIn 0.3s ease-in-out; }
.view-section.active { display: block; flex-grow: 1; display: flex; flex-direction: column; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.insights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.insight-card { background: white; padding: 25px; border-radius: var(--card-radius); box-shadow: var(--card-shadow); display: flex; flex-direction: column; }
.insight-card h3 { margin: 0 0 20px 0; color: var(--ifoa-blue); font-size: 1.1rem; border-bottom: 2px solid #eee; padding-bottom: 10px; }

.bar-row { margin-bottom: 15px; width: 100%; }
.bar-label { display: flex; justify-content: space-between; font-weight: bold; color: #555; margin-bottom: 5px; font-size: 0.95rem; width: 100%; }
.bar-val { color: var(--ifoa-blue); font-size: 1.1rem; }
.bar-track { width: 100%; background: #eee; height: 18px; border-radius: 9px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 9px; transition: width 0.8s ease; }
.buy-fill { background: var(--ifoa-blue); }
.rent-fill { background: var(--ifoa-gold); }

.benefit-box { margin-top: auto; padding: 15px; background: #e8f5e9; color: var(--success); border-radius: 8px; text-align: center; font-weight: bold; font-size: 1.1rem; border: 1px solid #c8e6c9; }
.benefit-box.negative { background: #ffebee; color: var(--danger); border-color: #ffcdd2; }
.benefit-box.neutral { background: #f0f4f8; color: var(--ifoa-blue); border-color: #e0e6ed; }
.benefit-statement { margin-top: auto; padding: 15px; color: var(--text-primary); text-align: center; font-size: 1rem; line-height: 1.6; border-radius: 8px; }

/* Changes List Item layout */
.changes-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.changes-list li {
    margin-bottom: 16px;
}
.changes-list li:last-child {
    margin-bottom: 0;
}
.change-list-item-inner {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 16px;
    gap: 20px;
}
.change-list-text {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 0 1 auto;
}
.change-list-vals {
    display: flex;
    align-items: center;
    gap: 8px;
}
.change-list-text del { color: #666; font-size: 0.95rem; text-decoration: line-through;}
.change-list-text .arrow { color: #aaa; margin: 0 4px; }


/* Property Breakdown Formatting */
.prop-insight-card { padding: 25px; }
.prop-breakdown-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; align-items: stretch; }
.prop-panel { display: flex; flex-direction: column; border-radius: 10px; border: 1px solid #e0e6ed; padding: 20px; background: #fbfcfd; border-top: 4px solid; overflow: hidden; }
.prop-panel-cost { border-top-color: var(--ifoa-blue); }
.prop-panel-funding { border-top-color: var(--ifoa-gold); }
.prop-panel-label { display: flex; align-items: center; gap: 10px; font-weight: bold; color: var(--ifoa-blue); font-size: 1.02rem; margin-bottom: 16px; }
.prop-panel-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: #eaf2f8; color: var(--ifoa-blue); flex-shrink: 0; }
.prop-panel-funding .prop-panel-icon { background: #fbf3e2; color: #8a733e; }
.cost-bar, .funding-bar { display: flex; height: 18px; border-radius: 9px; overflow: hidden; width: 100%; background: #eee; box-sizing: border-box; }
.cost-price { background: var(--ifoa-blue); transition: width 0.8s ease; }
.cost-sdlt { background: #6a94b3; transition: width 0.8s ease; }
.cost-fees { background: var(--ifoa-gold); transition: width 0.8s ease; border-radius: 0 9px 9px 0; }
.fund-mortgage { background: var(--ifoa-blue); transition: width 0.8s ease; }
.fund-cash { background: var(--ifoa-gold); transition: width 0.8s ease; border-radius: 0 9px 9px 0; }
.fund-mortgage { background: var(--ifoa-blue); transition: width 0.8s ease; }
.fund-cash { background: var(--ifoa-gold); transition: width 0.8s ease; }

/* Enforced Right-Alignment for legend items */
.funding-legend { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; font-size: 0.92rem; font-weight: normal; color: #555; text-align: left; }
.legend-item-row { display: flex; justify-content: space-between; align-items: center; width: 100%; border-bottom: 1px solid #e2e8f0; padding-bottom: 6px; margin-bottom: 8px; font-size: 0.95rem; color: #555; }
.legend-item-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.legend-label-group { display: flex; align-items: center; gap: 10px; }
.legend-color { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.price-color { background: var(--ifoa-blue); }
.sdlt-color { background: #6a94b3; }
.fees-color { background: var(--ifoa-gold); }
.mort-color { background: var(--ifoa-blue); }
.cash-color { background: var(--ifoa-gold); }
.legend-value { font-weight: bold; color: var(--ifoa-blue); }

.prop-panel-divider { border-top: 1px solid #dde3ea; margin: 16px 0 14px 0; }
.prop-total-box { margin-top: auto; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: bold; color: var(--ifoa-blue); font-size: 1.1rem; }
.prop-total-box em { font-weight: normal; font-style: normal; font-size: 0.875rem; color: #666; margin-left: 4px; }

.prop-empty-state { display: none; text-align: center; padding: 40px 30px; background: #f9f9f9; border-radius: 10px; border: 2px dashed #ddd; color: #555; margin-top: 10px; line-height: 1.5; }
.prop-empty-icon { color: #b91c1c; margin-bottom: 12px; }
.prop-empty-title { font-weight: bold; font-size: 1.1rem; color: #b91c1c; margin-bottom: 8px; }
.prop-empty-desc { font-style: italic; color: #666; max-width: 480px; margin: 0 auto; }

/* Per-column "nothing to show" panel, used so compare mode keeps both columns */
.prop-panel-empty { align-items: center; justify-content: center; text-align: center; border-top-color: #d9a3a3; background: #fdf7f7; }
.prop-panel-empty .prop-empty-icon { margin-bottom: 10px; }

/* Affordability layout switch for the Property details tab.
   Single scenario: one full-width message. Compare mode: keep the two columns
   so the original and new scenarios can still be read side by side. */
.prop-breakdown-wrapper { display: grid; gap: 25px; grid-template-columns: 1fr; }

/* Single scenario: cost and funding sit side by side when the pane is wide
   enough, and fall back to stacking when it isn't. Compare mode keeps them
   stacked so each row can show its original/new columns. */
#results-pane:not(.compare-mode-active) .prop-breakdown-wrapper { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: stretch; }
#results-pane:not(.compare-mode-active) .prop-breakdown-wrapper > .prop-compare-section { display: flex; flex-direction: column; min-width: 0; }
#results-pane:not(.compare-mode-active) .prop-compare-section > .compare-grid { flex: 1 1 auto; }
#results-pane:not(.compare-mode-active) .prop-compare-section .revised-col { display: flex; flex-direction: column; }
#results-pane:not(.compare-mode-active) .prop-compare-section .revised-col > div:not(.col-title) { flex: 1 1 auto; display: flex; flex-direction: column; }
#results-pane:not(.compare-mode-active) .prop-compare-section .revised-col > div:not(.col-title) > * { flex: 1 1 auto; }
#prop-card.is-unaffordable #prop-breakdown-content { display: none; }
#prop-card.is-unaffordable #prop-breakdown-empty { display: block; }
.compare-mode-active #prop-card.is-unaffordable #prop-breakdown-content { display: grid; }
.compare-mode-active #prop-card #prop-breakdown-empty { display: none; }

/* Wealth difference has nothing to compare when a purchase never happens */
.wealth-empty-card { align-items: center; justify-content: center; text-align: center; }
.wealth-empty-icon { color: #b91c1c; margin-bottom: 12px; }
.wealth-empty-title { font-weight: bold; font-size: 1.1rem; color: #b91c1c; margin-bottom: 8px; }
.wealth-empty-desc { font-style: italic; color: #666; max-width: 480px; margin: 0 auto; line-height: 1.5; }

/* --- PROJECTIONS VIEW LAYOUT --- */
#view-projections {
    display: none;
    flex-direction: column;
    flex-grow: 1;
    height: 100%;
    min-height: 0;
}
#view-projections.active {
    display: flex;
}

.projections-controls-row {
    display: flex;
    align-items: center;
    padding-bottom: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 15px;
    flex-shrink: 0;
}

.data-view-controls {
    margin-left: auto;
}

#proj-main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
}

/* --- CHART & TABLE VIEWS (Vertical Fill Update) --- */
.chart-container { background: white; padding: 20px; border-radius: var(--card-radius); box-shadow: var(--card-shadow); width: 100%; flex-grow: 1; height: 100% !important; display: flex; flex-direction: column; min-height: 0; }
.custom-legend { display: flex; justify-content: center; gap: 20px; font-weight: bold; color: #000; margin-bottom: 15px; flex-wrap: wrap; font-size: 0.9rem; background: #f8f9fa; padding: 12px; border-radius: 8px; flex-shrink: 0;}
.legend-box { display: flex; align-items: center; gap: 8px; color: #000; }
.line { display: inline-block; width: 30px; height: 3px; }
.line-buy { background: var(--ifoa-blue); }
body.dark-mode .line-buy { background: #90caf9; }
.line-rent, .line-base-rent { background: var(--ifoa-gold); position: relative; }
/* Circle marker so the renting line reads as strongly as the buying line */
.line-rent::after, .line-base-rent::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--ifoa-gold);
    border: 1.5px solid #fff;
    box-sizing: border-box;
}
.line-base-buy { background: var(--ifoa-blue); }
.emoji-note { color: #000; font-weight: bold; }
.canvas-wrapper { flex-grow: 1; position: relative; width: 100%; min-height: 0; height: 100%; }

.table-container { background: white; padding: 0; border-radius: var(--card-radius); box-shadow: var(--card-shadow); width: 100%; flex-grow: 1; height: 100% !important; max-height: none !important; border: 1px solid #eee; display: flex; flex-direction: column; min-height: 0;}
#wealth-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; text-align: right; }
#wealth-table th { position: sticky; top: 0; background: #f8f9fa; z-index: 2; padding: 15px 20px; color: var(--ifoa-blue); border-bottom: 2px solid #ccc; text-align: right;}
#wealth-table th:first-child, #wealth-table td:first-child { text-align: center; font-weight: bold; }
#wealth-table th.event-col-desktop { text-align: center; }
#wealth-table td { padding: 12px 20px; border-bottom: 1px solid #eee; }
.row-purchase { background-color: rgba(0, 58, 93, 0.08); font-weight: bold; color: var(--ifoa-blue);}
.row-retire { background-color: rgba(191, 161, 93, 0.15); font-weight: bold; color: #8a733e;}

/* Hide legend in table view only (not in chart) */
.table-legend-header { display: none !important; }

/* Projections table event column */
.event-col-desktop { display: table-cell !important; }
.event-mobile { display: none; }
.event-mobile svg { width: 14px; height: 14px; fill: currentColor; }
.event-text { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px; }
.event-text svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }
.event-text div { font-size: 0.875rem; text-align: center; line-height: 1.3; white-space: nowrap; }
.age-cell { display: flex; flex-direction: column; align-items: center; }

@media (max-width: 767px) {
    .event-col-desktop { display: none !important; }
    .event-mobile { display: flex !important; flex-direction: column; align-items: center; gap: 4px; margin-top: 6px; font-size: 0.875rem; }
}

/* --- MODALS --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 38, 64, 0.8); backdrop-filter: blur(8px); z-index: 1000; display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.close-modal { width: 44px; height: 44px; border-radius: 50%; background: transparent; border: none; font-size: 1.5rem; color: #999; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; margin: -10px -10px -10px 0; }
.close-modal:hover { background: #eee; color: var(--danger); }
.modal-card { background: white; width: 680px; max-width: 95%; max-height: 90vh; border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); display: flex; flex-direction: column; overflow: hidden; transform: translateY(20px); transition: transform 0.3s ease;}
.modal-overlay.active .modal-card { transform: translateY(0); }
.modal-card.large { width: 850px; } 
.modal-header { background: #f8f9fa; padding: 20px 30px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; color: var(--ifoa-blue); font-size: 1.4rem; }
.modal-body { padding: 30px; overflow-y: auto; overflow-x: hidden; flex-grow: 1; scroll-behavior: smooth;}
.modal-footer { padding: 20px 30px; border-top: 1px solid #eee; background: #f8f9fa; display: flex; justify-content: space-between; align-items: center; }

/* --- ACCESSIBILITY MODAL --- */
.a11y-row { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid #eee; }
.a11y-row.last-toggle { border-bottom: none; }
.a11y-row-label { font-size: 1rem; color: var(--ifoa-blue); cursor: pointer; }
.a11y-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; cursor: pointer; }
.a11y-switch input { opacity: 0; width: 0; height: 0; }
.a11y-slider { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 24px; cursor: pointer; transition: background 0.3s; }
.a11y-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: transform 0.3s; }
.a11y-switch input:checked + .a11y-slider { background: var(--ifoa-gold); }
.a11y-switch input:checked + .a11y-slider::before { transform: translateX(20px); }
.a11y-switch input:focus-visible + .a11y-slider { outline: 2px solid var(--ifoa-gold); outline-offset: 2px; }
body.dark-mode .a11y-row { border-bottom-color: #333; }
body.dark-mode .a11y-slider { background: #444; }

/* --- WIZARD SPECIFICS --- */
.wizard-step { display: none; animation: fadeIn 0.3s; }
.wizard-step.active { display: block; }
.wizard-progress { display: flex; gap: 8px; justify-content: center; margin-bottom: 25px; }
.progress-dot { width: 12px; height: 12px; border-radius: 50%; background: #ddd; transition: all 0.3s; }
.progress-dot.active { background: var(--ifoa-gold); transform: scale(1.2); }
.wizard-title { text-align: center; color: var(--ifoa-blue); margin-bottom: 30px; }
.big-mode-selector { display: flex; gap: 20px; justify-content: center; margin-bottom: 30px; }
.mode-card { flex: 1; text-align: center; padding: 30px 20px; border: 2px solid #eee; border-radius: 12px; cursor: pointer; transition: all 0.2s; background: white; }
.mode-card:hover { border-color: var(--ifoa-gold); background: #fdfbf7;}
.mode-card.active { border-color: var(--ifoa-gold); background: rgba(191, 161, 93, 0.1); box-shadow: 0 4px 12px rgba(191, 161, 93, 0.2); }
.mode-icon { font-size: 3rem; margin-bottom: 10px; }
.mode-title { font-weight: bold; font-size: 1.2rem; color: var(--ifoa-blue); }

/* Toast notifications */
.toast-container { position: fixed; right: 24px; bottom: 24px; z-index: 3000; display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 20px; min-width: 280px; max-width: 420px; background: #2b2b2b; color: #fff; padding: 14px 16px 14px 20px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.25); opacity: 0; transform: translateY(12px); transition: opacity 0.25s ease, transform 0.25s ease; }
.toast.toast-visible { opacity: 1; transform: translateY(0); }
.toast.toast-hiding { opacity: 0; transform: translateY(12px); }
.toast-message { flex: 1; font-size: 0.95rem; }

/* --- Accessibility Classes & Font Sizing --- */
.dyslexia-font, .dyslexia-font * { font-family: 'Comic Sans MS', 'Comic Sans', 'OpenDyslexic', sans-serif !important; letter-spacing: 0.05em !important; word-spacing: 0.1em !important; }
.reduce-motion, .reduce-motion * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
html.text-large { font-size: 150% !important; }
html.text-xlarge { font-size: 200% !important; }

/* =========================================================================
   HEADER & RESPONSIVE HEADER
   ========================================================================= */
body.calc-body .mobile-header { background: var(--ifoa-blue); color: white; padding: 10px 20px; border-bottom: 4px solid var(--ifoa-gold); display: flex; justify-content: space-between; align-items: center; flex-wrap: nowrap; gap: 10px; }
.logo-link { display: flex; align-items: center; text-decoration: none; color: white; transition: opacity 0.2s; gap: 12px; }
.logo-link:hover { opacity: 0.8; }
.logo-link img { height: 48px; width: auto; flex-shrink: 0;}
.logo-text { display: flex; flex-direction: column; justify-content: center; }
.logo-text span { font-weight: bold; font-size: 0.875rem; line-height: 1.1; letter-spacing: 0.05em; text-transform: uppercase; }
.mobile-text { display: none; }
body.calc-body .header-actions { display: flex; align-items: center; gap: 10px; }

.desktop-only { display: flex; }
.mobile-only { display: none; }
.burger-btn { background: transparent; border: none; padding: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.hamburger-icon { width: 28px; height: 28px; stroke: #ffffff; }

.calc-mobile-menu-panel { display: none; background: #00223b; padding: 0 20px; border-bottom: 4px solid var(--ifoa-gold); }
.calc-mobile-menu-panel.open { display: block; }
.mobile-menu-item { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 15px 0; color: white; font-weight: 500; background: transparent; border: none; font-size: 1rem; text-align: left; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.1); font-family: inherit; margin: 0; }
.mobile-menu-item:last-child { border-bottom: none; }

/* =========================================================================
   DARK MODE IMPLEMENTATION
   ========================================================================= */
body.dark-mode { --bg: #121212; --ifoa-navy: #90caf9; --ifoa-blue: #90caf9; --ifoa-gold: #c3a344; --ifoa-grey: #e0e0e0; --ifoa-light-blue: #1e293b; color: #e0e0e0; background-color: var(--bg); }

/* Dark mode high-contrast focus rings */
body.dark-mode :focus-visible {
    outline: 2px solid #90caf9 !important;
    outline-offset: 2px;
}

body.dark-mode .sidebar, body.dark-mode .main-content, body.dark-mode .modal-card, body.dark-mode .insight-card, body.dark-mode .settings-card, body.dark-mode details, body.dark-mode summary, body.dark-mode .input-wrapper, body.dark-mode .param-box { background: #1e1e1e !important; border-color: #333 !important; color: #e0e0e0 !important; }
body.dark-mode .insight-card { border: 1px solid #333 !important; }

/* Dark Mode Compare Changes List */
body.dark-mode .change-list-item-inner { border-bottom-color: #333 !important; }
body.dark-mode .changes-list li { background: transparent !important; }
body.dark-mode .changes-list li strong { color: #90caf9 !important; }
body.dark-mode .change-list-text del { color: #aaa !important; }
body.dark-mode .change-list-text .arrow { color: #888 !important; }
body.dark-mode .btn-undo { border-color: #ef9a9a; color: #ef9a9a; }
body.dark-mode .btn-undo:hover { background: rgba(239, 154, 154, 0.1); }

/* Prefix and Suffix Contrast Fix */
body.dark-mode .prefix, body.dark-mode .suffix { color: #e0e0e0 !important; }

body.dark-mode h1, body.dark-mode h2, body.dark-mode h3, body.dark-mode h4, body.dark-mode .input-row-single label, body.dark-mode .bar-label, body.dark-mode .timing-title, body.dark-mode .hero-title, body.dark-mode .prop-line, body.dark-mode .a11y-row-label { color: #e0e0e0 !important; }

body.dark-mode input, body.dark-mode select { color: #fff !important; }
body.dark-mode .wrapper-readonly { background: #2a2a2a !important; }
body.dark-mode .bar-track, body.dark-mode .funding-bar { background: #333 !important; }

body.dark-mode .benefit-box { background: #1b3320 !important; color: #81c784 !important; border-color: #2e7d32 !important; }
body.dark-mode .benefit-box.negative { background: #4a1919 !important; color: #e57373 !important; border-color: #c62828 !important; }
body.dark-mode .benefit-statement { color: #e0e0e0 !important; }

body.dark-mode .toggle-container { background: #333 !important; }
body.dark-mode .toggle-container label { color: #bbb !important; } 
body.dark-mode .toggle-container input[type="radio"]:checked + label { background-color: var(--ifoa-gold) !important; color: #121212 !important; }
body.dark-mode .toggle-container label:hover { background-color: rgba(255,255,255,0.1); color: #fff; }
body.dark-mode .toggle-container input[type="radio"]:checked + label:hover { background-color: var(--ifoa-gold) !important; color: #121212 !important; }
body.dark-mode .toggle-container input[type="radio"]:focus-visible + label {
    outline: 2px solid #90caf9 !important;
    outline-offset: 2px;
    z-index: 1;
}

body.dark-mode .results-disclaimer, body.dark-mode .no-changes-msg { background: #1e1e1e !important; border-color: #333 !important; }
body.dark-mode .results-disclaimer p, body.dark-mode .no-changes-msg p { color: #e0e0e0 !important; }
body.dark-mode .results-disclaimer a, body.dark-mode .no-changes-msg a { color: #90caf9 !important; }

/* Dark mode table legend header */
body.dark-mode .table-legend-header { background: #1e1e1e !important; border-bottom-color: #333 !important; }
body.dark-mode .table-legend-header span { color: #90caf9 !important; }
body.dark-mode #wealth-table th { background: #1e1e1e !important; border-bottom-color: #555 !important; }
body.dark-mode #wealth-table td { border-bottom-color: #444 !important; }
body.dark-mode .row-purchase { background-color: rgba(144, 202, 249, 0.1) !important; color: #90caf9 !important; }
body.dark-mode .row-retire { background-color: rgba(195, 163, 68, 0.1) !important; color: #c3a344 !important; }

/* Accessible button texts in dark mode */
body.dark-mode .btn-primary { background: var(--ifoa-gold) !important; color: #121212 !important; }
body.dark-mode .btn-primary:hover:not(:disabled) { background: #e6c253 !important; }
body.dark-mode .btn-secondary { background: #333 !important; color: var(--ifoa-gold) !important; }
body.dark-mode .btn-secondary:hover { background: #444 !important; }

body.dark-mode .theme-buy { background-color: #1a2a3a !important; border-color: #2a4a6a !important; }
body.dark-mode .theme-buy .hero-icon-wrapper { background-color: #2a4a6a !important; color: #90caf9 !important; }

/* Dark mode background colors for light-themed sections */
body.dark-mode { background-color: #121212 !important; }
body.dark-mode .bg-white:not(.bg-navy), body.dark-mode section.bg-white:not(.bg-navy) { background-color: #1e1e1e !important; }
body.dark-mode .bg-gray-50, body.dark-mode section.bg-gray-50 { background-color: #2a2a2a !important; }
body.dark-mode main { background-color: #121212 !important; }

/* Preserve header and dark sections in dark mode - reset navy color variable */
body.dark-mode header { --ifoa-navy: #003a5d; background-color: #003a5d !important; color: white; }
body.dark-mode .bg-navy { --ifoa-navy: #003a5d; background-color: #003a5d !important; }
body.dark-mode section.bg-navy { --ifoa-navy: #003a5d; background-color: #003a5d !important; color: white; }

/* Dark mode text colors for sufficient contrast */
body.dark-mode .bg-white:not(.bg-navy) p,
body.dark-mode .bg-white:not(.bg-navy) span:not(.badge-outcome-blue):not(.badge-outcome-red),
body.dark-mode .bg-white:not(.bg-navy) li,
body.dark-mode .bg-gray-50 p,
body.dark-mode .bg-gray-50 span:not(.badge-outcome-blue):not(.badge-outcome-red),
body.dark-mode .bg-gray-50 li { color: #e0e0e0 !important; }

body.dark-mode .text-gray-600, body.dark-mode .text-gray-700 { color: #d0d0d0 !important; }
body.dark-mode .text-gray-400, body.dark-mode .text-gray-500 { color: #a0a0a0 !important; }
body.dark-mode .text-slate-600, body.dark-mode .text-slate-700 { color: #d0d0d0 !important; }
body.dark-mode .theme-buy .hero-title, body.dark-mode .theme-buy .hero-highlight { color: #90caf9 !important; }
body.dark-mode .theme-buy .hero-description { color: #e0f2fe !important; }
body.dark-mode .theme-rent { background-color: #332a1a !important; border-color: #55442a !important; }
body.dark-mode .theme-rent .hero-icon-wrapper { background-color: #55442a !important; color: #ffd54f !important; }
body.dark-mode .theme-rent .hero-title, body.dark-mode .theme-rent .hero-highlight { color: #ffd54f !important; }
body.dark-mode .theme-rent .hero-description { color: #fef08a !important; }

body.dark-mode .tab-navigation { border-bottom-color: #444; }
body.dark-mode .tab-navigation label { color: #888; }
body.dark-mode .tab-navigation label:hover { color: #fff; }
body.dark-mode .tab-navigation input[type="radio"]:checked + label, body.dark-mode .tab-navigation label.active { color: var(--ifoa-gold); }

body.dark-mode .tabs { border-bottom-color: #444; }
body.dark-mode .tab-btn { color: #888; }
body.dark-mode .tab-btn:hover { color: #fff; }
body.dark-mode .tab-btn.active { color: var(--ifoa-gold); }

body.dark-mode .timing-hero-card, body.dark-mode .chart-container, body.dark-mode .table-container, body.dark-mode .mode-card, body.dark-mode .custom-select, body.dark-mode .mobile-tabs-container select, body.dark-mode .prop-panel { background: #1e1e1e !important; border-color: #333 !important; color: #e0e0e0 !important; }

body.dark-mode .custom-legend, body.dark-mode #wealth-table th, body.dark-mode .modal-header, body.dark-mode .modal-footer, body.dark-mode .table-legend-header { background: #262626 !important; color: #e0e0e0 !important; border-color: #333 !important; }

body.dark-mode .bar-val, body.dark-mode .mode-title, body.dark-mode .wizard-title, body.dark-mode .modal-header h2, body.dark-mode .sidebar-header h2, body.dark-mode .insight-card h3, body.dark-mode .settings-card h3, body.dark-mode .param-box h4, body.dark-mode .prop-line.total, body.dark-mode .prop-total-box, body.dark-mode .prop-panel-label, body.dark-mode .row-purchase { color: #90caf9 !important; }

body.dark-mode .helper-text { color: #e0e0e0 !important; }
body.dark-mode .legend-item-row { border-bottom-color: #333 !important; color: #e0e0e0 !important; }
body.dark-mode .legend-value { color: #90caf9 !important; }
body.dark-mode .param-box li { color: #e0e0e0 !important; }

body.dark-mode .timing-icon-wrapper, body.dark-mode .prop-panel-icon { background-color: #2a4a6a !important; color: #90caf9 !important; }
body.dark-mode .prop-panel-funding .prop-panel-icon { background-color: #453a1e !important; color: #c3a344 !important; }

body.dark-mode .row-purchase { background-color: rgba(144, 202, 249, 0.25) !important; color: #ffffff !important; }
body.dark-mode .row-retire { background-color: rgba(255, 213, 79, 0.25) !important; color: #fffde7 !important; }

body.dark-mode .mode-card:hover { border-color: var(--ifoa-gold) !important; background: #2a2416 !important; }
body.dark-mode .mode-card.active { border-color: var(--ifoa-gold) !important; background: rgba(255, 213, 79, 0.12) !important; }

body.dark-mode .theme-error { background-color: #3a1a1a !important; border-color: #6a2a2a !important; }
body.dark-mode .theme-error .hero-icon-wrapper { background-color: #5a2424 !important; color: #ef9a9a !important; }
body.dark-mode .theme-error .hero-title, body.dark-mode .theme-error .hero-highlight { color: #ef9a9a !important; }
body.dark-mode .timing-hero-card.timing-hero-card-warning { background-color: #3a1a1a !important; border-color: #6a2a2a !important; }
body.dark-mode .timing-icon-wrapper.timing-icon-warning { background-color: #5a2424 !important; color: #ef9a9a !important; }
body.dark-mode .timing-hero-card-warning .timing-title { color: #ef9a9a !important; }

body.dark-mode .prop-empty-state { background: #1e1e1e !important; border-color: #333 !important; color: #e0e0e0 !important; }
body.dark-mode .prop-empty-title { color: #ef9a9a !important; }
body.dark-mode .prop-empty-icon { color: #ef9a9a !important; }
body.dark-mode .prop-empty-desc { color: #e0e0e0 !important; }
body.dark-mode .prop-panel-empty { background: #241a1a !important; border-color: #4a2c2c !important; }
body.dark-mode .wealth-empty-title, body.dark-mode .wealth-empty-icon { color: #ef9a9a !important; }
body.dark-mode .wealth-empty-desc { color: #cbd5e1 !important; }
body.dark-mode .close-modal:hover { background: #333; color: #ef9a9a; }
body.dark-mode .cost-sdlt { background: #3d5a72 !important; }
body.dark-mode .cost-fees { background: #c3a344 !important; }
body.dark-mode .sdlt-color { background: #3d5a72 !important; }
body.dark-mode .fees-color { background: #c3a344 !important; }

/* Legend icons styling */
.legend-icon { fill: #003a5d; }
.legend-icons { color: #000; }

/* Dark mode legend */
body.dark-mode .legend-icon { fill: #90caf9; }
body.dark-mode .legend-icons { color: #e0e0e0; }

/* Sticky Footer Force Dark Mode */
body.dark-mode .compare-actions-footer { background: #1e1e1e !important; border-top-color: #333 !important; }
body.dark-mode .link-reset { color: #90caf9 !important; }
body.dark-mode .disclaimer-link { color: #90caf9 !important; }

/* Dark mode contrast fix for descriptions */
body.dark-mode .timing-description {
    color: #cbd5e1 !important;
}

body.dark-mode #projections-compare-controls span {
    color: #90caf9 !important;
}

body.dark-mode .modal-body { background: #1e1e1e !important; color: #e0e0e0 !important; }
body.dark-mode .modal-body p { color: #e0e0e0 !important; }

.a11y-row-label { font-size: 0.95rem; font-weight: 500; color: #333; }
body.dark-mode .a11y-row-label { color: #e0e0e0 !important; }

/* Sidebar and form labels dark mode */
body.dark-mode .sidebar-header label { color: #e0e0e0 !important; }
body.dark-mode .input-row-single > label { color: #e0e0e0 !important; }

/* Accessibility popup spacing adjustment */
.input-row-single.a11y-size-row { margin-top: 30px !important; }

/* Scenario page dark mode fixes */
body.dark-mode .bg-red-50, body.dark-mode .bg-blue-50 { background: #1e1e1e !important; border-color: #333 !important; }
body.dark-mode .bg-red-50 h4, body.dark-mode .bg-blue-50 h4 { color: #90caf9 !important; }
body.dark-mode .bg-red-50 h3, body.dark-mode .bg-blue-50 h3 { color: #90caf9 !important; }
body.dark-mode .bg-red-50 p, body.dark-mode .bg-blue-50 p { color: #e0e0e0 !important; }
body.dark-mode .bg-red-50 > div > p, body.dark-mode .bg-blue-50 > div > p { color: #e0e0e0 !important; }
body.dark-mode .bg-red-50 * , body.dark-mode .bg-blue-50 * { color: #e0e0e0 !important; }
body.dark-mode .bg-red-50 h2, body.dark-mode .bg-blue-50 h2 { color: #90caf9 !important; }

/* Quote box styling in dark mode */
body.dark-mode blockquote { color: #e0e0e0 !important; border-left-color: var(--ifoa-gold) !important; }
body.dark-mode .italic { color: #cbd5e1 !important; }

/* Scenario section titles in dark mode */
body.dark-mode .bg-navy h4, body.dark-mode .bg-gold h4 { color: #e0e0e0 !important; }

/* Error message text in dark mode */
body.dark-mode .theme-error .hero-description, body.dark-mode .theme-error p { color: #e0e0e0 !important; }

/* Scenario page cards dark mode */
body.dark-mode .bg-gray-50 { background: #1e1e1e !important; }
body.dark-mode .bg-gray-50 p, body.dark-mode .bg-gray-50 h2, body.dark-mode .bg-gray-50 h3, body.dark-mode .bg-gray-50 h4 { color: #e0e0e0 !important; }
body.dark-mode .stat-card, body.dark-mode .stat-card-warning { background: #1e1e1e !important; }
body.dark-mode .stat-card p, body.dark-mode .stat-card-warning p { color: #e0e0e0 !important; }

/* Bottom scenario card dark mode */
body.dark-mode section.bg-blue-50 h2, body.dark-mode section.bg-white h2 { color: #90caf9 !important; }
body.dark-mode section.bg-white p { color: #e0e0e0 !important; }
body.dark-mode section { color: #e0e0e0 !important; }

/* Index.html persona cards dark mode */
body.dark-mode .persona-card { background: #1e1e1e !important; border-color: #333 !important; }
body.dark-mode .persona-card h3 { color: #90caf9 !important; }
body.dark-mode .persona-card p { color: #e0e0e0 !important; }
body.dark-mode .persona-card .text-gray-700 { color: #e0e0e0 !important; }
body.dark-mode .persona-card .bg-gray-50 { background: #2a2a2a !important; }
body.dark-mode .persona-card .bg-gray-50 strong { color: #90caf9 !important; }
body.dark-mode .persona-card .text-navy { color: #90caf9 !important; }

/* Purchase age overlay in dark mode */
body.dark-mode .bg-white\/90 { background-color: rgba(30, 30, 30, 0.95) !important; }
body.dark-mode .bg-white\/90 .text-navy { color: #90caf9 !important; }
body.dark-mode .text-\[10px\].font-bold.text-gray-700 { color: #d0d0d0 !important; }

/* Gold/Yellow header text in dark mode */
body.dark-mode .bg-gold h4 { color: #003a5d !important; }
body.dark-mode .bg-gold .text-white { color: #003a5d !important; }

/* Badge text color fix for dark mode */
body.dark-mode .bg-blue-100.text-blue-800 { color: #003a5d !important; background-color: #90caf9 !important; }

/* Custom badge styles for light and dark modes */
.badge-outcome-blue {
  display: inline-block;
  background-color: #e3f2fd;
  color: #0d47a1;
  font-size: 0.875rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-weight: bold;
}

body.dark-mode .badge-outcome-blue {
  background-color: #90caf9;
  color: #003a5d !important;
}

/* Override the span color rule for badges in dark mode */
body.dark-mode .bg-white .badge-outcome-blue,
body.dark-mode .bg-gray-50 .badge-outcome-blue {
  color: #003a5d !important;
}

.badge-outcome-red {
  display: inline-block;
  background-color: #ffebee;
  color: #b71c1c;
  font-size: 0.875rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-weight: bold;
}

body.dark-mode .badge-outcome-red {
  background-color: #ffb3ba;
  color: #8b0000 !important;
}

/* Override the span color rule for badges in dark mode */
body.dark-mode .bg-white .badge-outcome-red,
body.dark-mode .bg-gray-50 .badge-outcome-red {
  color: #8b0000 !important;
}


/* =========================================================================
   COMPARE MODE & GRID SYSTEMS
   ========================================================================= */
.insights-grid { display: grid !important; grid-template-columns: 1fr !important; gap: 20px !important; }
.compare-mode-active .insights-grid { grid-template-columns: 1fr 1fr !important; }
#view-changes .insights-grid { grid-template-columns: 1fr !important; }

.compare-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.compare-grid .col-title { display: none; font-size: 1.15rem; font-weight: bold; margin-bottom: 12px; }
.compare-grid .baseline-col .col-title { color: var(--ifoa-blue); }
.compare-grid .revised-col .col-title { color: var(--ifoa-blue); border-left: 4px solid var(--ifoa-gold); padding-left: 8px; }
.compare-grid .baseline-col { display: none; }
.compare-mode-active .compare-grid { grid-template-columns: 1fr 1fr; }
.compare-mode-active .compare-grid .col-title, .compare-mode-active .compare-grid .baseline-col { display: block; }

.timing-hero-card, .result-hero-card, .insight-card { width: 100%; box-sizing: border-box; height: 100%; }

/* Desktop compare mode: cards sitting side by side in a row match each other's
   height, so a longer message on one side doesn't leave a ragged edge.
   Scoped to compare mode — a single scenario has only one column to size. */
@media (min-width: 951px) {
    .compare-mode-active .compare-grid { align-items: stretch; }
    .compare-mode-active .compare-grid > .compare-col { display: flex; flex-direction: column; min-width: 0; align-items: flex-start; }
    .compare-mode-active .compare-grid > .compare-col > .col-title { flex: 0 0 auto; line-height: 1.2; }
    .compare-mode-active .compare-grid > .compare-col > div:not(.col-title) { flex: 1 1 auto; display: flex; flex-direction: column; width: 100%; }
    .compare-mode-active .compare-grid > .compare-col > div:not(.col-title) > * { flex: 1 1 auto; width: 100%; }
    .compare-mode-active #hero-card-container, .compare-mode-active #timing-card-container { display: flex; flex-direction: column; flex: 1 1 auto; }
    .compare-mode-active #hero-card-container > *, .compare-mode-active #timing-card-container > * { flex: 1 1 auto; }
}
.baseline-placeholder { padding: 30px 20px; text-align: center; background: #f9f9f9; border-radius: 12px; border: 2px dashed #ddd; color: #666; font-style: italic; line-height: 1.5; height: 100%; display: flex; align-items: center; justify-content: center; }
/* Stands in for the chart/table while required inputs are missing */
.proj-blocked-msg { flex-grow: 1; height: auto; min-height: 220px; box-sizing: border-box; }

body.dark-mode .compare-grid .baseline-col .col-title { color: #90caf9; }
body.dark-mode .compare-grid .revised-col .col-title { color: var(--ifoa-gold); }
body.dark-mode .baseline-placeholder { background: #1e1e1e; border-color: #333; color: #aaa; }
body.dark-mode .new-val { color: #90caf9; }
body.dark-mode .legend-box { color: #e0e0e0; }
body.dark-mode .emoji-note { color: #e0e0e0 !important; }

/* Modal layout to allow flex-wrapping on large text sizes */
.settings-layout { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.settings-col { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 20px; }

/* =========================================================================
   MEDIA QUERIES (RESPONSIVE BEHAVIOR & MOBILE BURGER MENU VISIBILITY)
   ========================================================================= */
@media (max-width: 950px) {
    body.calc-body { height: auto; overflow-x: hidden; overflow-y: auto; } 
    .wrapper { flex-direction: column; height: auto; overflow: visible; } 
    .sidebar { width: 100%; min-width: 100%; border-right: none; border-bottom: 1px solid #ddd; height: auto; padding: 0; overflow: visible; }
    .main-content { width: 100%; height: auto; padding: 15px; overflow: visible; }
    .chart-container, .table-container { height: 500px; }
    .insights-grid { grid-template-columns: 1fr !important; }
    .settings-layout { flex-direction: column; align-items: stretch; }
    .settings-col { width: 100%; }
    .result-hero-card { flex-direction: column; text-align: center; padding: 30px 20px; gap: 20px; }
    .timing-hero-card { flex-direction: column; text-align: center; padding: 30px 20px; }
    .sidebar-scroll-area { padding: 15px; }
    .compare-actions-footer { padding: 15px; }
    
    .compare-mode-active .compare-grid { grid-template-columns: 1fr; gap: 40px; }
    .compare-mode-active .insights-grid { grid-template-columns: 1fr !important; }
    
    /* Ensure the mobile burger trigger shows up correctly below 950px */
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }
    .tabs { display: none !important; }
    
    .mobile-tabs-container { display: block; width: 100%; margin-bottom: 15px; }
    .mobile-tabs-container select { width: 100%; }
}

/* =========================================================================
   POP-UPS & "HOW IT WORKS" CARDS
   Moved from the <style> block in rent_buy_calculator.html (RVB-1).
   ========================================================================= */
:where(.calc-body) .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
:where(.calc-body) .modal-overlay:not(.active) {
    display: none;
}
:where(.calc-body) .modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    overflow-y: auto;
}
:where(.calc-body) .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e6ed;
}
:where(.calc-body) .modal-body {
    padding: 20px;
}
:where(.calc-body) .modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e6ed;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
:where(.calc-body) .how-it-works-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: #f0f1f3;
    border-radius: 8px;
    border-left: 4px solid var(--ifoa-gold, #ffc107);
    transition: box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
:where(.calc-body) .how-it-works-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
:where(.calc-body) .how-it-works-icon {
    font-size: 32px;
    min-width: 40px;
    text-align: center;
    line-height: 1;
}
body.dark-mode .how-it-works-card {
    background: #2a2a2a;
    border-left-color: #ffc107;
    box-shadow: none;
}
body.dark-mode .how-it-works-card:hover {
    box-shadow: none;
}
body.dark-mode .how-it-works-card h3 {
    color: #e0e0e0 !important;
}
body.dark-mode .how-it-works-card p {
    color: #d0d0d0 !important;
}

/* =========================================================================
   STYLES MOVED OUT OF INLINE ATTRIBUTES (RVB-1)
   ========================================================================= */

/* State helpers toggled from JavaScript */
.is-invisible { visibility: hidden; }
.is-off { display: none !important; }
.is-inactive { opacity: 0.5; pointer-events: none; }

/* Header, navigation & menus */
.close-btn.close-calc-btn, .close-btn.close-btn-light { color: white; }
.close-btn.close-btn-gap { margin-left: 8px !important; } /* beats the nav's space-x utility */
.burger-btn, #mobile-menu-btn, .tap-target { min-height: 44px; min-width: 44px; }
.mobile-menu-item label { margin: 0; cursor: pointer; }
.nav-link { font-size: 0.95rem; }

/* Home & scenario pages: dark-mode section backgrounds */
body.dark-mode:not(.calc-body) .bg-white:not(.bg-navy) { background-color: #1e1e1e; }
body.dark-mode:not(.calc-body) .bg-gray-50 { background-color: #2a2a2a; }

/* Sidebar */
.side-mode-label { display: block; margin-bottom: 8px; font-weight: 500; }
.sub-group-title.sub-group-spaced { margin-top: 20px; }
.toggle-container.toggle-auto { width: auto; }
.toggle-container.toggle-pad-md label { padding: 10px 15px; }
.input-wrapper.input-wrapper-wide-suffix { padding-right: 55px; }

/* Results: outcome, timing, wealth and property breakdown */
h3.section-heading-first { margin-top: 0; }
h3.section-heading-spaced { margin-top: 40px; }
.timing-slot { display: flex; }
.bar-fill, .cost-price, .cost-sdlt, .cost-fees, .fund-mortgage, .fund-cash { width: var(--bar-w, 0%); }
.benefit-val { margin: 16px 0 0 0; line-height: 1.5; }
.compare-delta { font-size: 0.9rem; margin-top: 4px; font-weight: normal; }
.theme-buy.theme-tie .hero-icon-wrapper { background-color: #e0e6ed; color: #555; }
.theme-buy.theme-tie .hero-title { color: #333; }
.results-disclaimer { background: #f9f9f9; border-top: 1px solid #e0e6ed; padding: 20px; text-align: center; font-size: 0.9rem; color: #555; margin-top: 30px; }
.results-disclaimer p { margin: 0; }

/* Projections */
.proj-compare-controls { display: flex; align-items: center; gap: 15px; }
.proj-compare-label { font-weight: bold; color: var(--ifoa-blue); }
.data-view-controls { display: flex; align-items: center; gap: 15px; }
.legend-icons { display: inline-flex; align-items: center; gap: 16px; font-weight: bold; }
.legend-icon, .table-legend-icons svg { flex-shrink: 0; }
.table-legend-header { padding: 12px 15px; background: #f8f9fa; border-bottom: 2px solid #ccc; text-align: center; font-weight: bold; flex-shrink: 0; color: var(--ifoa-blue); }
.table-legend-icons { display: inline-flex; align-items: center; gap: 16px; color: var(--ifoa-blue); }
.table-scroll { flex-grow: 1; overflow-y: auto; }
#wealth-table td.event-col-desktop { text-align: center; }
.event-icon { display: inline; margin-left: 6px; vertical-align: middle; }

/* Chart tooltip (built in main.js; position comes from --tip-x / --tip-y) */
#chartTooltip { position: fixed; left: var(--tip-x, 0); top: var(--tip-y, 0); pointer-events: none; z-index: 1000; }
.chart-tip { background-color: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 12px 16px; font-family: inherit; font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.chart-tip-title { font-weight: bold; margin-bottom: 8px; color: #000; }
.chart-tip-event { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 8px; background: rgba(0, 58, 93, 0.05); border-radius: 4px; color: #003a5d; }
.chart-tip-event.chart-tip-event-retire { background: rgba(191, 161, 93, 0.1); color: #8a733e; }
.chart-tip-icon { flex-shrink: 0; }
.chart-tip-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; color: #333; }
.chart-tip-line { vertical-align: middle; }
body.dark-mode .chart-tip { background-color: #1a1a1a; border-color: #444; box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
body.dark-mode .chart-tip-title { color: #fff; }
body.dark-mode .chart-tip-event { background: rgba(144, 202, 249, 0.1); color: #90caf9; }
body.dark-mode .chart-tip-event.chart-tip-event-retire { background: rgba(255, 213, 79, 0.1); color: #ffd54f; }
body.dark-mode .chart-tip-row { color: #e0e0e0; }

/* "Your changes" view */
.changes-header { display: flex; align-items: center; gap: 10px; border-bottom: 2px solid #e0e6ed; padding-bottom: 12px; margin-bottom: 20px; }
.changes-header-icon { width: 28px; height: 28px; color: var(--ifoa-gold); }
.changes-header h3 { margin: 0; color: var(--ifoa-blue); font-size: 1.3rem; border: none; padding: 0; }
.no-changes-msg { text-align: center; padding: 30px 20px; background: #f9f9f9; border-radius: 8px; border: 2px dashed #ddd; color: #666; font-style: italic; }
.changes-list li.row-collapsing-start { height: var(--row-h); overflow: hidden; box-sizing: border-box; }
.changes-list li.row-collapsing { transition: height 0.3s ease, margin 0.3s ease, padding 0.3s ease, opacity 0.3s ease; }
.changes-list li.row-collapsed { height: 0; margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; border-width: 0; opacity: 0; }

/* Modals: accessibility, settings, wizards and information pop-ups */
.a11y-switch { margin: 0; }
.input-row-single.a11y-size-row { margin-bottom: 20px; }
.modal-footer.modal-footer-end { justify-content: flex-end; }
.modal-footer.modal-footer-between { display: flex; justify-content: space-between; align-items: center; }
.modal-footer.modal-footer-gap { gap: 10px; }
.modal-footer.modal-footer-split { display: flex; gap: 12px; padding: 20px; }
#settings-tabs { margin: 20px 30px 0 30px; width: auto; flex-shrink: 0; }
.modal-body.settings-body { padding-top: 20px; border-top: none; }
h3.readonly-params-heading { margin-bottom: 15px; display: flex; align-items: center; justify-content: space-between; }
.readonly-params-title { font-size: 1.1rem; color: var(--ifoa-blue); }
.params-desc { margin-bottom: 25px; }
.param-list { margin-top: 15px; }
.param-row { display: flex; justify-content: space-between; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid #e2e8f0; }
.param-row.param-row-last { border-bottom: none; }
.param-note { margin-top: 12px; font-size: 0.875rem; color: var(--ifoa-blue); font-style: italic; }
.modal-card.wizard-card { width: 750px; }
#wizard-progress-container, #partner-wizard-progress-container { padding: 15px 30px 0 30px; }
#wiz-next:disabled, #partner-next-btn:disabled { opacity: 0.5; }
.partner-note { padding: 15px; background: #f0f4f8; border-left: 4px solid var(--ifoa-blue); margin-top: 20px; border-radius: 4px; font-size: 0.95rem; color: #555; }
.wizard-lead { font-size: 0.95rem; color: #555; margin-bottom: 20px; }
.helper-text.helper-text-note { font-size: 0.875rem; color: #666; margin-top: 10px; }
.modal-content.modal-content-sm { max-width: 500px; }
.modal-content.modal-content-md { max-width: 600px; }
.modal-content.modal-content-lg { max-width: 800px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-content .modal-header h2 { margin: 0; }
.modal-body.modal-body-text { padding: 20px; line-height: 1.6; font-size: 0.95rem; }
.modal-body.modal-body-text-dark { color: #333; }
.modal-body.modal-body-scroll { padding: 20px; overflow-y: auto; flex: 1; }
.plain-list { margin: 0; padding-left: 20px; }
.plain-list li:not(:last-child) { margin-bottom: 15px; }
.btn-block { width: 100%; }
.btn-flex { flex: 1; margin-top: 0; }
.btn-primary.btn-gold { background-color: var(--ifoa-gold); }
.how-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.how-grid h3 { margin: 0 0 8px 0; color: #003a5d; }
.how-grid p { margin: 0; color: #555; line-height: 1.5; }

/* =========================================================================
   ACCESSIBILITY (RVB-2): WCAG 2.2 AA plus a 44px minimum target
   ========================================================================= */

/* Visually hidden, still read by screen readers */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* --- Visible keyboard focus --- */
body.calc-body :focus-visible { outline: 2px solid var(--ifoa-blue); outline-offset: 2px; }
body.calc-body .input-wrapper:focus-within { outline: 2px solid var(--ifoa-blue); outline-offset: 1px; }
body.calc-body .input-wrapper input:focus-visible, body.calc-body .input-wrapper select:focus-visible { outline: none; }
body.calc-body .mobile-header :focus-visible, body.calc-body .calc-mobile-menu-panel :focus-visible { outline-color: #fff; }
body.calc-body .a11y-switch input:focus-visible + .a11y-slider, body:not(.calc-body) .a11y-switch input:focus-visible + .a11y-slider { outline-color: var(--ifoa-blue, #003a5d); }
[role="dialog"]:focus { outline: none; }
body:not(.calc-body) :focus-visible { outline: 2px solid var(--ifoa-navy); outline-offset: 2px; }
body:not(.calc-body) header :focus-visible, body:not(.calc-body) .bg-navy :focus-visible { outline-color: #fff; }

/* --- Reduced motion: follow the system setting as well as the in-app toggle --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* --- 44px targets --- */
.input-wrapper input, .input-wrapper select, .custom-select { min-height: 44px; }
.btn-primary, .btn-secondary, .settings-btn, .tab-btn, .toggle-container label, .toast-undo-btn { min-height: 44px; }
.tab-navigation label { min-height: 44px; display: flex; align-items: center; justify-content: center; }
.close-modal { flex-shrink: 0; }
body:not(.calc-body) header nav a, body:not(.calc-body) header nav button { display: inline-flex; align-items: center; min-height: 44px; }
body:not(.calc-body) header button.nav-link { min-height: 44px; }
#mobile-menu a, #mobile-menu button { display: flex; align-items: center; min-height: 44px; }

/* Small visible controls keep their size and get an invisible 44px-high hit area */
.btn-undo, .link-start-over, #discard-whatif-btn, .a11y-row-label, .compare-toggle label, .mobile-menu-item label, .back-link { position: relative; }
.btn-undo::after, .link-start-over::after, #discard-whatif-btn::after, .a11y-row-label::after, .a11y-switch::after, .compare-toggle label::after, .mobile-menu-item label::after, .back-link::after,
.compare-toggle input[type="checkbox"]::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }

/* --- Minimum text size --- */
.btn-secondary { font-size: 0.95rem; }

/* =========================================================================
   RESULTS FOOTER (RVB-3): rates and rules line under the output tabs
   ========================================================================= */
.results-disclaimer p + p { margin-top: 8px; }
.link-button { background: none; border: none; padding: 0; font-family: inherit; }
.link-button:hover { text-decoration-thickness: 2px; }
