/* ============================================================
   MortgageToolkit AU — Enterprise Stylesheet
   Font: DM Sans + DM Serif Display
   Palette: Deep navy / emerald / warm white
   ============================================================ */

:root {
    --navy: #0A2540;
    --navy-mid: #163559;
    --navy-light: #1e4a7a;
    --emerald: #00C896;
    --emerald-dark: #00A07A;
    --emerald-pale: #E6FBF5;
    --amber: #F5A623;
    --amber-pale: #FFF8E7;
    --red: #E24B4A;
    --red-pale: #FEF0F0;
    --blue: #2563EB;
    --blue-pale: #EFF6FF;

    --bg: #F6F8FA;
    --bg-card: #FFFFFF;
    --bg-input: #FFFFFF;
    --border: #E2E8F0;
    --border-focus: #00C896;

    --text-primary: #0A2540;
    --text-secondary: #4A5568;
    --text-muted: #8896A9;
    --text-invert: #FFFFFF;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 3px rgba(10,37,64,0.08), 0 1px 2px rgba(10,37,64,0.04);
    --shadow-md: 0 4px 12px rgba(10,37,64,0.1), 0 2px 6px rgba(10,37,64,0.06);
    --shadow-lg: 0 12px 32px rgba(10,37,64,0.12), 0 4px 12px rgba(10,37,64,0.08);

    --header-h: 64px;
    --sidebar-w: 360px;
    --font: 'DM Sans', -apple-system, sans-serif;
    --font-serif: 'DM Serif Display', Georgia, serif;
    --transition: 0.2s ease;
}

[data-theme="dark"] {
    --bg: #0D1825;
    --bg-card: #162030;
    --bg-input: #1E2D3E;
    --border: #2A3D52;
    --border-focus: #00C896;
    --text-primary: #E8F0F8;
    --text-secondary: #8CA4BB;
    --text-muted: #5A7080;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
    --navy: #1A3550;
    --navy-mid: #1F3F60;
    --emerald-pale: #0A2520;
    --amber-pale: #2A1F00;
    --blue-pale: #0A1530;
    --red-pale: #2A0A0A;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Smooth dark mode transitions for key surfaces */
.input-panel, .results-panel, .metric-tile, .bcard, .empty-state,
.timeline-section, .schedule-section, .donut-section,
.home-pillar-card, .home-stat-card, .home-card,
.fhb-inputs, .fhb-output, .bp-inputs, .bp-output,
.rw-inputs, .rw-output, .tool-input, .tool-output,
.comp-summary-section, .comp-chart-section {
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, color 0.35s ease, transform 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.35s ease, color 0.35s ease;
}

/* ---- Header ---- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: var(--navy);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 2px 20px rgba(0,0,0,0.25);
}
.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}
.logo-text {
    font-family: var(--font-serif);
    font-size: 22px;
    color: #FFFFFF;
    letter-spacing: -0.3px;
}
.logo-badge {
    background: var(--emerald);
    color: var(--navy);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}
.header-nav {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.header-nav::-webkit-scrollbar { display: none; }
.nav-tab {
    background: none;
    border: none;
    color: rgba(255,255,255,0.55);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}
.nav-tab:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.06); }
.nav-tab.active { color: #FFFFFF; background: rgba(255,255,255,0.12); }
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.btn-icon {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.btn-icon:hover { background: rgba(255,255,255,0.15); color: #fff; }
.btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.85);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
}
.btn-outline:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.4); }

/* ---- Main ---- */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Layout ---- */
.calc-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.input-panel {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: sticky;
    top: calc(var(--header-h) + 20px);
    max-height: calc(100vh - var(--header-h) - 48px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.input-panel::-webkit-scrollbar { width: 4px; }
.input-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.results-panel { flex: 1; min-width: 0; }

/* ---- Panel header ---- */
.panel-header {
    background: var(--navy);
    padding: 20px 24px 18px;
}
.panel-header h2 {
    font-family: var(--font-serif);
    font-size: 20px;
    color: #FFFFFF;
    font-weight: 400;
    margin-bottom: 2px;
}
.panel-subtitle {
    font-size: 13px;
    color: rgba(255,255,255,0.55);
}

/* ---- Form Sections ---- */
.form-section {
    padding: 18px 24px 4px;
    border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; }
.form-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding-left: 12px;
    border-left: 3px solid var(--emerald);
    position: relative;
}
.form-section-label.collapsible-trigger:hover { color: var(--text-secondary); }
.chevron {
    transition: transform var(--transition);
}
.chevron.open { transform: rotate(180deg); }
.collapsible-panel { overflow: hidden; transition: max-height 0.3s ease; max-height: 2000px; }
.collapsible-panel.collapsed { max-height: 0; }

/* ---- Form Groups ---- */
.form-group {
    margin-bottom: 16px;
}
label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.optional-label {
    font-weight: 400;
    font-style: italic;
    color: var(--text-muted);
    font-size: 12px;
}
.inline-badge {
    background: var(--emerald-pale);
    color: var(--emerald-dark);
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
    margin-left: auto;
}
.lvr-indicator {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: auto;
    background: var(--blue-pale);
    color: var(--blue);
}
.lvr-indicator.warn { background: var(--red-pale); color: var(--red); }
.lmi-notice {
    font-size: 12px;
    color: var(--red);
    background: var(--red-pale);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    margin-top: 6px;
    border: 1px solid rgba(226,75,74,0.2);
}
.input-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition);
    overflow: hidden;
}
.input-wrap:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0,200,150,0.12);
}
.input-wrap--readonly { background: var(--bg); }
.input-prefix, .input-suffix {
    padding: 0 12px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 15px;
    flex-shrink: 0;
    background: transparent;
}
input[type="number"], input[type="text"], select {
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    outline: none;
}
.input-wrap input { padding: 10px 0; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { opacity: 0.4; }
input[readonly] { color: var(--text-muted); cursor: not-allowed; }

select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238896A9' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
    transition: border-color var(--transition);
}
select:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(0,200,150,0.12); }

/* ---- Range Slider ---- */
.range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 4px;
    background: var(--border);
    outline: none;
    margin: 8px 0 4px;
    cursor: pointer;
    border: none;
    padding: 0;
}
.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--emerald);
    border: 2.5px solid #FFFFFF;
    box-shadow: 0 2px 6px rgba(0,200,150,0.4);
    cursor: pointer;
    transition: transform var(--transition);
}
.range-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--emerald);
    border: 2.5px solid #fff;
    cursor: pointer;
}
.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---- Frequency Buttons ---- */
.freq-buttons {
    display: flex;
    gap: 6px;
}
.freq-btn {
    flex: 1;
    padding: 8px 4px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.freq-btn:hover { border-color: var(--emerald); color: var(--emerald-dark); }
.freq-btn.active {
    background: var(--emerald-pale);
    border-color: var(--emerald);
    color: var(--emerald-dark);
    font-weight: 700;
}

/* ---- Toggle Group ---- */
.toggle-group {
    display: flex;
    gap: 8px;
}
.toggle-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    flex-direction: row;
    margin-bottom: 0;
}
.toggle-option input { width: 14px; height: 14px; flex-shrink: 0; cursor: pointer; accent-color: var(--emerald); }
.toggle-option:has(input:checked) { background: var(--emerald-pale); border-color: var(--emerald); color: var(--emerald-dark); }

/* ---- Rate Context ---- */
.rate-context {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}
.rate-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}
.rate-tag.below { background: var(--emerald-pale); color: var(--emerald-dark); }
.rate-tag.above { background: var(--amber-pale); color: #A05E00; }
.rba-live-badge {
    background: var(--blue-pale);
    color: var(--blue);
    cursor: default;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}
.link-btn {
    background: none;
    border: none;
    color: var(--blue);
    font-family: var(--font);
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}
.field-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

/* ---- Calculate Button ---- */
.calc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 48px);
    margin: 16px 24px 20px;
    padding: 14px 20px;
    background: var(--navy);
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.2px;
    transition: all var(--transition);
    box-shadow: 0 4px 16px rgba(10,37,64,0.25);
}
.calc-btn:hover { background: var(--navy-mid); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(10,37,64,0.3); }
.calc-btn:active { transform: translateY(0); }

/* ---- Button row (Calculate + Reset) ---- */
.calc-btn-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    padding: 12px 24px 16px;
    border-top: 1px solid var(--border);
    z-index: 5;
    box-shadow: 0 -4px 12px rgba(10,37,64,0.06);
}
.calc-btn-row .calc-btn { flex: 1; margin: 0; width: auto; }

.calc-reset-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    flex-shrink: 0;
}
.calc-reset-btn:hover {
    background: var(--red-pale);
    border-color: var(--red);
    color: var(--red);
}
.calc-reset-btn svg { transition: transform 0.5s ease; }
.calc-reset-btn:hover svg { transform: rotate(-180deg); }

/* ---- Disclaimer bubble ---- */
.calc-disclaimer-bubble {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--amber-pale);
    border: 1px solid rgba(245,166,35,0.3);
    border-left: 3px solid var(--amber);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-top: 8px;
}
.calc-disclaimer-bubble svg { color: var(--amber); flex-shrink: 0; margin-top: 1px; }
.calc-disclaimer-bubble p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}
.calc-disclaimer-bubble strong { color: var(--text-primary); font-weight: 700; }
[data-theme="dark"] .calc-disclaimer-bubble { border-color: rgba(245,166,35,0.2); border-left-color: var(--amber); }
[data-theme="dark"] .calc-disclaimer-bubble svg { color: var(--amber); }

/* ============================================================
   HOME TAB
   ============================================================ */
.home-layout {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Hero */
.home-hero {
    background: var(--navy);
    border-radius: var(--radius-xl);
    overflow: hidden;
    padding: 56px 60px;
    position: relative;
}
.home-hero::before {
    content: '';
    position: absolute;
    top: -120px; right: -80px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(0,200,150,0.10) 0%, transparent 70%);
    pointer-events: none;
}
.home-hero::after {
    content: '';
    position: absolute;
    bottom: -100px; left: 30%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(56,132,244,0.06) 0%, transparent 70%);
    pointer-events: none;
}
.home-hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}
.home-hero-inner { max-width: 520px; }
.home-hero-eyebrow {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--emerald);
    margin-bottom: 16px;
}
.home-hero-headline {
    font-family: var(--font-serif);
    font-size: 40px;
    color: #fff;
    letter-spacing: -0.8px;
    line-height: 1.15;
    margin: 0 0 16px;
}
.home-hero-desc {
    font-size: 17px;
    color: rgba(255,255,255,0.7);
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 460px;
}
.home-cta-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}
.home-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--emerald);
    color: var(--navy);
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 24px;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 16px rgba(0,200,150,0.35);
}
.home-cta-btn:hover {
    background: #00e0a8;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,200,150,0.45);
}
.home-cta-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-md);
    padding: 13px 22px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    transition: all var(--transition);
}
.home-cta-ghost:hover {
    border-color: rgba(255,255,255,0.45);
    color: #fff;
    transform: translateY(-1px);
}
.home-social-proof {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}
.home-social-proof svg {
    color: var(--emerald);
    flex-shrink: 0;
    opacity: 0.7;
}

/* Hero mockup visual */
.home-hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}
.home-hero-mockup {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    width: 100%;
    max-width: 380px;
    overflow: hidden;
    backdrop-filter: blur(8px);
    animation: mockupFloat 6s ease-in-out infinite;
}
@keyframes mockupFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.mockup-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mockup-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
}
.mockup-dot:first-child { background: rgba(255,99,99,0.5); }
.mockup-dot:nth-child(2) { background: rgba(255,199,0,0.5); }
.mockup-dot:nth-child(3) { background: rgba(0,200,150,0.5); }
.mockup-title {
    margin-left: auto;
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
}
.mockup-body { padding: 20px; }
.mockup-kpi {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.mockup-kpi-label {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}
.mockup-kpi-value {
    font-family: var(--font-serif);
    font-size: 20px;
    color: var(--emerald);
    letter-spacing: -0.5px;
}
.mockup-kpi-red { color: rgba(255,120,120,0.8); }
.mockup-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 120px;
    margin-top: 20px;
    padding-top: 8px;
}
.mockup-bar {
    flex: 1;
    height: var(--h);
    background: linear-gradient(to top, rgba(0,200,150,0.15), rgba(0,200,150,0.35));
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
    animation: barGrow 1.2s ease-out both;
}
.mockup-bar:nth-child(1) { animation-delay: 0.1s; }
.mockup-bar:nth-child(2) { animation-delay: 0.2s; }
.mockup-bar:nth-child(3) { animation-delay: 0.3s; }
.mockup-bar:nth-child(4) { animation-delay: 0.4s; }
.mockup-bar:nth-child(5) { animation-delay: 0.5s; }
@keyframes barGrow {
    from { height: 0; opacity: 0; }
    to { height: var(--h); opacity: 1; }
}
.mockup-bar--accent {
    background: linear-gradient(to top, rgba(0,200,150,0.4), var(--emerald));
}
.mockup-bar span {
    position: absolute;
    bottom: -20px;
    font-size: 9px;
    color: rgba(255,255,255,0.3);
    white-space: nowrap;
}
.mockup-caption {
    text-align: center;
    font-size: 10px;
    color: rgba(255,255,255,0.25);
    margin-top: 28px;
}

/* Trust pillar cards */
.home-pillars-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.home-pillar-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.2s ease;
}
.home-pillar-card:hover {
    border-color: var(--navy);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.pillar-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}
.pillar-icon--emerald { background: var(--emerald-pale); color: var(--emerald-dark); }
.pillar-icon--blue    { background: var(--blue-pale);    color: var(--blue); }
.pillar-icon--amber   { background: var(--amber-pale);   color: #854F0B; }
[data-theme="dark"] .pillar-icon--amber { color: var(--amber); }
.home-pillar-card strong {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.home-pillar-card span {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Stats bar */
.home-stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.home-stat-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}
.home-stat-num {
    font-family: var(--font-serif);
    font-size: 32px;
    color: var(--emerald);
    line-height: 1;
    letter-spacing: -0.5px;
}
.home-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Section title */
.home-section-title {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: -0.3px;
}

/* Feature cards */
.home-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.home-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    gap: 16px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
}
.home-card:hover {
    border-color: var(--navy);
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    transform: translateY(-4px);
}
.home-card:hover .home-card-icon {
    transform: scale(1.08);
}
.home-card--highlight { border-color: rgba(0,200,150,0.35); }
.home-card--highlight:hover { border-color: var(--emerald); }

.home-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.home-card-icon--navy   { background: rgba(10,37,64,0.08);  color: var(--navy); }
.home-card-icon--emerald{ background: var(--emerald-pale);   color: var(--emerald-dark); }
.home-card-icon--blue   { background: var(--blue-pale);      color: var(--blue); }
.home-card-icon--amber  { background: var(--amber-pale);     color: #854F0B; }
.home-card-icon--red    { background: var(--red-pale);       color: var(--red); }
[data-theme="dark"] .home-card-icon--navy    { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.8); }
[data-theme="dark"] .home-card-icon--amber   { color: var(--amber); }

.home-card-body { flex: 1; min-width: 0; }
.home-card-body h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px;
}
.home-card-body p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 10px;
}
.home-card-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 20px;
    background: rgba(10,37,64,0.07);
    color: var(--text-muted);
}
.home-card-tag--emerald { background: var(--emerald-pale); color: var(--emerald-dark); }
.home-card-tag--blue    { background: var(--blue-pale);    color: var(--blue); }
.home-card-tag--amber   { background: var(--amber-pale);   color: #854F0B; }
.home-card-tag--red     { background: var(--red-pale);     color: var(--red); }
[data-theme="dark"] .home-card-tag--amber { color: var(--amber); }

/* Disclaimer */
.home-disclaimer {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--amber);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.home-disclaimer-inner {
    display: flex;
    gap: 20px;
    padding: 24px 28px;
}
.home-disclaimer-icon {
    width: 36px;
    height: 36px;
    background: var(--amber-pale);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #854F0B;
    margin-top: 2px;
}
[data-theme="dark"] .home-disclaimer-icon { background: rgba(245,166,35,0.15); color: var(--amber); }
.home-disclaimer-content h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px;
}
.home-disclaimer-content p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 10px;
}
.home-disclaimer-content p:last-child { margin-bottom: 0; }
.home-disclaimer-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.home-disclaimer-list li {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    padding-left: 16px;
    position: relative;
}
.home-disclaimer-list li::before {
    content: '·';
    position: absolute;
    left: 4px;
    color: var(--amber);
    font-weight: 700;
}
.home-disclaimer-footer {
    font-size: 11px !important;
    color: var(--text-muted) !important;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 12px !important;
}

/* Logo as button */
.logo {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.logo:hover .logo-text { color: var(--emerald); }
.logo:hover { opacity: 0.9; }

@media (max-width: 900px) {
    .home-hero { padding: 36px 28px; }
    .home-hero-grid { grid-template-columns: 1fr; gap: 32px; }
    .home-hero-visual { display: none; }
    .home-hero-headline { font-size: 30px; }
    .home-pillars-grid { grid-template-columns: 1fr; }
    .home-stats-bar { grid-template-columns: repeat(2, 1fr); }
    .home-cards { grid-template-columns: 1fr; }
    .home-disclaimer-inner { flex-direction: column; gap: 12px; }
}

/* ---- Empty State ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 40px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    animation: emptyFadeIn 0.6s ease both;
}
@keyframes emptyFadeIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.empty-illustration { margin-bottom: 24px; opacity: 0.7; }
.empty-state h3 { font-family: var(--font-serif); font-size: 22px; font-weight: 400; margin-bottom: 10px; color: var(--text-primary); }
.empty-state p { font-size: 14px; color: var(--text-secondary); max-width: 360px; line-height: 1.7; }

/* ---- Results ---- */
.results.hidden { display: none; }

/* ---- Metrics Strip ---- */
.metrics-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

/* ---- Equity hint under loan amount ---- */
.equity-hint {
    font-size: 12px;
    color: var(--emerald-dark);
    margin-top: 5px;
    font-weight: 600;
}

/* ---- Bcard tab link ---- */
.bcard-tab-link {
    color: var(--blue);
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    margin-left: 3px;
    opacity: 0.7;
    transition: opacity var(--transition);
}
.bcard-tab-link:hover { opacity: 1; }

.metric-tile {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    animation: tileSlideIn 0.4s ease both;
}
.metric-tile:nth-child(1) { animation-delay: 0s; }
.metric-tile:nth-child(2) { animation-delay: 0.08s; }
.metric-tile:nth-child(3) { animation-delay: 0.16s; }
.metric-tile:nth-child(4) { animation-delay: 0.24s; }
@keyframes tileSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.metric-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.metric-primary {
    border-color: var(--emerald);
    background: linear-gradient(135deg, #E6FBF5 0%, #FFFFFF 100%);
}
.metric-primary .metric-value {
    font-size: 30px;
}
[data-theme="dark"] .metric-primary { background: linear-gradient(135deg, #0A2520 0%, #162030 100%); }
.metric-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.metric-value {
    font-family: var(--font-serif);
    font-size: 26px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
}
.metric-primary .metric-value { color: var(--emerald-dark); }
.saving-value { color: #00A07A !important; }
.metric-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---- Chart + Breakdown ---- */
.chart-breakdown-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    align-items: flex-start;
    animation: sectionFadeIn 0.5s ease 0.1s both;
}
.donut-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
#breakdownChart { max-width: 200px; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-label { flex: 1; font-size: 12px; color: var(--text-secondary); }
.legend-val { margin-left: auto; font-weight: 700; color: var(--text-primary); font-size: 13px; }

.breakdown-cards {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

/* My Loan tab — 3 equal cards top row, valuation full-width below */
.ml-breakdown-cards {
    grid-template-columns: repeat(3, 1fr);
}
.ml-breakdown-cards #ml_valuationCard {
    grid-column: 1 / -1;
}
.ml-breakdown-cards #ml_valuationCard .bcard-row {
    padding: 5px 0;
}

/* Valuation card: 2-column row layout when full-width */
.ml-valuation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 32px;
}
.ml-valuation-grid .bcard-row {
    border-top: 1px solid var(--border);
}
.ml-valuation-grid .bcard-row:nth-child(1),
.ml-valuation-grid .bcard-row:nth-child(2) {
    border-top: none;
}
.bcard {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    animation: tileSlideIn 0.4s ease both;
}
.bcard:nth-child(1) { animation-delay: 0.05s; }
.bcard:nth-child(2) { animation-delay: 0.1s; }
.bcard:nth-child(3) { animation-delay: 0.15s; }
.bcard:nth-child(4) { animation-delay: 0.2s; }
.bcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.bcard-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.bcard-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-blue { background: #2563EB; }
.dot-teal { background: #0D9488; }
.dot-green { background: var(--emerald); }
.dot-amber { background: var(--amber); }
.bcard h3 { font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.bcard-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}
.bcard-row:first-of-type { border-top: none; }
.bcard-row span { flex: 1; min-width: 0; }
.bcard-row strong { font-weight: 700; color: var(--text-primary); font-size: 14px; text-align: right; white-space: nowrap; padding-left: 12px; }
.highlight-row strong { color: var(--emerald-dark) !important; }

/* ---- Timeline Chart ---- */
/* ---- Schedule ---- */
.timeline-section, .schedule-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    animation: sectionFadeIn 0.5s ease both;
}
@keyframes sectionFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.section-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    padding-left: 12px;
    border-left: 3px solid var(--emerald);
}
.chart-toggles { display: flex; gap: 4px; background: var(--bg); border-radius: 24px; padding: 3px; border: 1px solid var(--border); }
.chart-toggle {
    padding: 6px 14px;
    background: transparent;
    border: none;
    border-radius: 20px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.chart-toggle:hover { color: var(--text-primary); background: rgba(0,0,0,0.03); }
.chart-toggle.active { background: var(--navy); color: #fff; box-shadow: 0 2px 8px rgba(10,37,64,0.2); }
.chart-toggle[data-mode="all"].active {
    background: linear-gradient(135deg, var(--navy) 0%, #1e4a7a 100%);
    position: relative;
}
.chart-toggle[data-mode="all"].active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 4px;
    right: 4px;
    height: 2px;
    background: linear-gradient(90deg, #0A2540, #00C896, #F5A623);
    border-radius: 1px;
}

/* ── View toggle (Yearly / Monthly) ── */
.sched-view-toggle {
    display: flex;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2px;
    gap: 2px;
}
.sched-view-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 18px;
    cursor: pointer;
    transition: all var(--transition);
}
.sched-view-btn.active { background: var(--navy); color: #fff; box-shadow: 0 2px 8px rgba(10,37,64,0.2); }
[data-theme="dark"] .sched-view-btn.active { background: var(--emerald); color: var(--navy); box-shadow: 0 2px 8px rgba(0,200,150,0.25); }

/* ── Running summary strip ── */
.sched-summary-strip {
    display: flex;
    gap: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
}
.sched-summary-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px;
    border-right: 1px solid var(--border);
    min-width: 0;
}
.sched-summary-item:last-child { border-right: none; }
.sched-summary-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 3px;
    white-space: nowrap;
}
.sched-summary-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}
.sched-summary-val.sched-interest { color: var(--red); }
.sched-summary-val.sched-principal { color: #2563EB; }
.sched-summary-val.sched-equity { color: var(--emerald-dark); }

/* ── Table ── */
.schedule-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.control-btn {
    padding: 6px 14px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all var(--transition);
}
.control-btn:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.table-container {
    overflow-x: auto;
    max-height: 520px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.table-container::-webkit-scrollbar { width: 6px; height: 6px; }
.table-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: auto; }
thead {
    position: sticky;
    top: 0;
    background: var(--navy);
    z-index: 5;
    box-shadow: 0 2px 8px rgba(10,37,64,0.15);
}
th {
    padding: 11px 12px;
    text-align: right;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.75);
    white-space: nowrap;
}
th.col-period { text-align: left; min-width: 110px; }
th.col-payment, th.col-principal, th.col-interest, th.col-balance, th.col-equity { min-width: 90px; }
th.col-int-pct { min-width: 70px; }
th.col-lvr { min-width: 60px; }

td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
}
td.col-p { color: #2563EB; font-weight: 600; }
td.col-i { color: var(--red); }
td.col-eq { color: var(--emerald-dark); font-weight: 600; }
td.col-lvr-cell { color: var(--text-muted); }
td.col-intpct { text-align: right; }

/* ── Period cell ── */
.mo-date { display: block; font-weight: 600; color: var(--text-primary); font-size: 13px; }
.mo-num  { display: block; font-size: 10px; color: var(--text-muted); margin-top: 1px; }

/* ── Interest % bar ── */
.intpct-bar-wrap {
    display: inline-block;
    width: 36px;
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 4px;
    overflow: hidden;
}
.intpct-bar {
    display: block;
    height: 100%;
    background: linear-gradient(to right, var(--red), #F5A623);
    border-radius: 3px;
    transition: width 0.3s;
}
.intpct-val { font-size: 12px; color: var(--text-muted); }

/* ── Year rows ── */
tbody tr.year-row { cursor: pointer; user-select: none; }
tbody tr.year-row td {
    padding: 12px 14px;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    border-bottom: none;
}
tbody tr.year-odd  { background: var(--navy); }
tbody tr.year-even { background: var(--navy-mid); }
tbody tr.year-row:hover { filter: brightness(1.15); }
tbody tr.io-year { border-left: 3px solid #2563EB; }

.year-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}
.year-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
}
.year-date-range {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.65;
    white-space: nowrap;
}
.io-badge {
    font-size: 10px;
    font-weight: 700;
    background: rgba(37,99,235,0.3);
    color: #93C5FD;
    padding: 1px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}
.fy-badge {
    font-size: 10px;
    font-weight: 700;
    background: rgba(245,166,35,0.25);
    color: #FCD34D;
    padding: 1px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}
.year-summary-center {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}
.year-summary-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    white-space: nowrap;
}
.ys-item { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.ys-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; opacity: 0.6; }
.ys-val { font-size: 12px; font-weight: 700; }
.ys-principal { color: #93C5FD; }
.ys-interest   { color: #FCA5A5; }
.ys-sep { opacity: 0.4; font-size: 11px; }
.toggle-icon { font-size: 11px; transition: transform 0.2s; display: inline-block; width: 14px; flex-shrink: 0; }

/* ── Month rows ── */
tbody tr.month-row, tbody tr.month-row-flat {
    transition: background var(--transition);
}
tbody tr.month-row:nth-child(odd), tbody tr.month-row-flat:nth-child(odd) { background: var(--bg-card); }
tbody tr.month-row:nth-child(even), tbody tr.month-row-flat:nth-child(even) { background: var(--bg); }
tbody tr.month-row:hover, tbody tr.month-row-flat:hover { background: var(--emerald-pale); }
tbody tr.io-row { border-left: 3px solid rgba(37,99,235,0.35); }
tbody tr.fy-row { border-bottom: 2px solid rgba(245,166,35,0.4); }

/* ── Milestone rows ── */
tbody tr.milestone-row td {
    padding: 6px 14px;
    background: transparent;
    border-bottom: none;
}
.milestone-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
}
.milestone-lmi  { background: #EFF6FF; color: #1d4ed8; border: 1px solid #BFDBFE; }
.milestone-70   { background: #F0FDF4; color: #15803d; border: 1px solid #BBF7D0; }
.milestone-60   { background: #ECFDF5; color: #065f46; border: 1px solid #A7F3D0; }
.milestone-50   { background: var(--emerald-pale); color: var(--emerald-dark); border: 1px solid rgba(0,200,150,0.25); }
.milestone-75eq { background: #FFF7ED; color: #c2410c; border: 1px solid #FED7AA; }
[data-theme="dark"] .milestone-lmi  { background: rgba(37,99,235,0.1);  color: #93C5FD; border-color: rgba(37,99,235,0.3);  }
[data-theme="dark"] .milestone-70   { background: rgba(21,128,61,0.1);  color: #86EFAC; border-color: rgba(21,128,61,0.3);  }
[data-theme="dark"] .milestone-60   { background: rgba(6,95,70,0.1);    color: #6EE7B7; border-color: rgba(6,95,70,0.3);    }
[data-theme="dark"] .milestone-50   { background: rgba(0,200,150,0.1);  color: var(--emerald); border-color: rgba(0,200,150,0.25); }
[data-theme="dark"] .milestone-75eq { background: rgba(194,65,12,0.1);  color: #FDBA74; border-color: rgba(194,65,12,0.3);  }

/* ── FY separator ── */
tbody tr.fy-separator-row td {
    padding: 4px 14px;
    background: rgba(245,166,35,0.06);
    border-top: 1px dashed rgba(245,166,35,0.4);
    border-bottom: none;
}
.fy-separator-label {
    font-size: 11px;
    font-weight: 700;
    color: #B45309;
    letter-spacing: 0.2px;
}
[data-theme="dark"] .fy-separator-label { color: var(--amber); }

/* ── Schedule legend ── */
.sched-legend {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.sched-leg-item {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.sched-leg-milestone { color: #1d4ed8; }
.sched-leg-io        { color: #2563EB; border-left: 3px solid rgba(37,99,235,0.4); padding-left: 5px; }
.sched-leg-fy        { color: #B45309; }
[data-theme="dark"] .sched-leg-milestone { color: #93C5FD; }
[data-theme="dark"] .sched-leg-fy        { color: var(--amber); }

/* ---- Comparison Tab ---- */
.comparison-layout { max-width: 1200px; margin: 0 auto; }
.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.comparison-header h2 { font-family: var(--font-serif); font-size: 28px; font-weight: 400; margin-bottom: 4px; }
.comparison-header p { color: var(--text-secondary); font-size: 14px; }

/* ── Loan cards grid ── */
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
    align-items: start;
}
.loan-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--card-accent, var(--border));
    transition: box-shadow var(--transition);
}
.loan-card:hover { box-shadow: var(--shadow-md); }
.best-value { border-color: var(--emerald) !important; }

.loan-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.loan-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.loan-card-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.loan-name-input {
    border: none;
    background: transparent;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    font-family: var(--font);
    padding: 2px 4px;
    border-radius: 4px;
    width: 120px;
    transition: background var(--transition);
}
.loan-name-input:focus {
    outline: none;
    background: var(--bg);
    border: 1px solid var(--border);
}
.loan-card-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--transition);
}
.loan-card-remove:hover { color: var(--red); background: rgba(226,75,74,0.08); }

/* ── Multi-badge system ── */
.comp-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.comp-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}
.comp-badge--interest  { background: var(--emerald-pale); color: var(--emerald-dark); border: 1px solid rgba(0,200,150,0.25); }
.comp-badge--repay     { background: #EFF6FF; color: #1d4ed8; border: 1px solid #BFDBFE; }
.comp-badge--truecost  { background: #FFF7ED; color: #c2410c; border: 1px solid #FED7AA; }
[data-theme="dark"] .comp-badge--repay { background: rgba(37,99,235,0.1); color: #93C5FD; border-color: rgba(37,99,235,0.3); }
[data-theme="dark"] .comp-badge--truecost { background: rgba(194,65,12,0.1); color: #FDBA74; border-color: rgba(194,65,12,0.3); }

/* ── 2-column input grid inside card ── */
.comp-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.comp-input-grid .form-group { margin-bottom: 0; }
.comp-input-grid label { font-size: 11px; margin-bottom: 4px; }
.comp-input-grid input, .comp-input-grid select {
    padding: 8px 10px;
    font-size: 13px;
}

/* ── Results section inside card ── */
.comp-results { display: flex; flex-direction: column; gap: 0; }
.loan-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}
.loan-result-row:last-of-type { border-bottom: none; }
.loan-result-row strong { font-weight: 700; color: var(--text-primary); }
.loan-result-freq { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-left: 2px; }
.loan-result-primary strong { font-size: 16px; color: var(--navy); }
[data-theme="dark"] .loan-result-primary strong { color: var(--emerald); }
.comp-val-interest { color: var(--red) !important; }
.loan-result-total strong { color: var(--text-primary); font-size: 15px; }
.loan-result-delta {
    font-size: 11px;
    color: var(--red);
    padding: 4px 8px;
    background: rgba(226,75,74,0.07);
    border-radius: var(--radius-sm);
    margin-top: 6px;
    font-weight: 600;
    text-align: right;
}

/* ── Chart sections ── */
.comp-chart-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

/* ── Summary table ── */
.comp-summary-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
}
.comp-summary-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.comp-table-wrap { overflow-x: auto; }
.comp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.comp-table th {
    padding: 10px 14px;
    text-align: right;
    font-weight: 700;
    font-size: 13px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.comp-table th:first-child { text-align: left; }
.comp-table td {
    padding: 9px 14px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    white-space: nowrap;
}
.comp-table td.comp-row-label {
    text-align: left;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.comp-table tr.comp-row-highlight td { background: var(--bg); font-weight: 700; color: var(--text-primary); }
.comp-table td.comp-best-cell {
    color: var(--emerald-dark) !important;
    font-weight: 700;
}
.comp-table tr:last-child td { border-bottom: none; }

/* ---- Comparison disclaimer ---- */
.comp-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--blue-pale);
    border: 1px solid rgba(37,99,235,0.15);
    border-left: 3px solid var(--blue);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-top: 4px;
}
.comp-disclaimer svg { color: var(--blue); flex-shrink: 0; margin-top: 2px; }
.comp-disclaimer p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}
.comp-disclaimer strong { color: var(--text-primary); font-weight: 700; }
[data-theme="dark"] .comp-disclaimer { background: rgba(37,99,235,0.08); border-left-color: #93C5FD; }
[data-theme="dark"] .comp-disclaimer svg { color: #93C5FD; }

@media (max-width: 768px) {
    .comparison-grid { grid-template-columns: 1fr; }
    .comp-input-grid { grid-template-columns: 1fr; }
}

/* ---- Stamp Duty + Borrowing Power ---- */
.tool-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    max-width: 1100px;
    margin: 0 auto;
}
.tool-input {
    width: 380px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow-md);
}
.tool-input h2 { font-family: var(--font-serif); font-size: 24px; font-weight: 400; margin-bottom: 6px; }
.tool-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.5; }
.tool-output { flex: 1; }

.sd-result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 16px;
}
.sd-result-card.hidden { display: none; }
.sd-main-amount { margin-bottom: 20px; }
.sd-amount {
    font-family: var(--font-serif);
    font-size: 42px;
    color: var(--text-primary);
    letter-spacing: -1px;
    line-height: 1.1;
    margin-top: 4px;
}
.sd-rows { border-top: 1px solid var(--border); }
.sd-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}
.sd-row strong { color: var(--text-primary); font-weight: 700; }
.sd-disclaimer {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 16px;
    line-height: 1.6;
}
.sd-disclaimer a { color: var(--blue); }
.sd-all-states {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}
.sd-all-states h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.sd-comp-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.sd-comp-state { width: 40px; font-weight: 700; color: var(--text-secondary); }
.sd-comp-bar-wrap { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.sd-comp-bar { height: 100%; background: var(--navy); border-radius: 4px; transition: width 0.6s ease; }
.sd-comp-amount { width: 90px; text-align: right; font-weight: 600; color: var(--text-primary); }

/* ============================================================
   FIRST HOME BUYER HUB
   ============================================================ */
.fhb-layout {
    display: flex;
    gap: 24px;
    max-width: 1300px;
    margin: 0 auto;
    align-items: flex-start;
}
.fhb-inputs {
    width: 360px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 80px;
}
.fhb-output { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* Hero */
.fhb-hero {
    background: var(--navy);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    display: flex;
    align-items: center;
    gap: 24px;
    box-shadow: var(--shadow-lg);
    flex-wrap: wrap;
}
.fhb-hero-left { flex: 1; min-width: 200px; }
.fhb-hero-left .metric-label { color: rgba(255,255,255,0.55); font-size: 11px; letter-spacing: 0.5px; }
.fhb-hero-amount {
    font-family: var(--font-serif);
    font-size: 52px;
    color: var(--emerald);
    letter-spacing: -2px;
    line-height: 1.1;
    margin: 4px 0 4px;
}
.fhb-hero-sub { font-size: 12px; color: rgba(255,255,255,0.5); }
.fhb-hero-right { display: flex; flex-wrap: wrap; gap: 10px; }

/* Hero badges */
.fhb-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    min-width: 90px;
    text-align: center;
}
.fhb-badge-val { font-size: 15px; font-weight: 700; }
.fhb-badge-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; opacity: 0.75; }
.fhb-badge--grant  { background: rgba(0,200,150,0.2);   color: var(--emerald); }
.fhb-badge--duty   { background: rgba(37,99,235,0.2);   color: #93C5FD; }
.fhb-badge--fhg    { background: rgba(245,166,35,0.2);  color: #FCD34D; }
.fhb-badge--fhss   { background: rgba(168,85,247,0.2);  color: #D8B4FE; }
.fhb-badge--htb    { background: rgba(226,75,74,0.15);  color: #FCA5A5; }

/* Scheme cards */
.fhb-schemes { display: flex; flex-direction: column; gap: 12px; }
.fhb-scheme-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.fhb-scheme-card:hover { box-shadow: var(--shadow-md); }
.fhb-eligible   { border-left: 4px solid var(--emerald); }
.fhb-ineligible { border-left: 4px solid var(--border); opacity: 0.8; }

.fhb-scheme-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    background: transparent;
}
.fhb-scheme-icon { font-size: 22px; flex-shrink: 0; }
.fhb-scheme-title-wrap { flex: 1; min-width: 0; }
.fhb-scheme-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin: 0 0 2px; }
.fhb-scheme-status { font-size: 11px; font-weight: 700; }
.status-eligible  { color: var(--emerald-dark); }
.status-ineligible { color: var(--text-muted); }
.fhb-scheme-toggle {
    background: none; border: none; cursor: pointer; color: var(--text-muted);
    padding: 4px; border-radius: 4px; display: flex; align-items: center;
    transition: all var(--transition);
}
.fhb-scheme-toggle:hover { background: var(--bg); color: var(--text-primary); }
.fhb-scheme-toggle svg { transition: transform 0.2s ease; }

.fhb-scheme-body { padding: 0 18px 18px; }
.fhb-scheme-amount {
    font-family: var(--font-serif);
    font-size: 28px;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}
.fhb-scheme-amount.eligible   { color: var(--emerald-dark); }
.fhb-scheme-amount.ineligible { color: var(--text-muted); font-size: 18px; font-family: var(--font); }
.fhb-scheme-amount.partial    { color: var(--amber); }
[data-theme="dark"] .fhb-scheme-amount.eligible { color: var(--emerald); }

.fhb-scheme-note {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.fhb-scheme-rows { border-top: 1px solid var(--border); }
.fhb-scheme-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}
.fhb-scheme-row:last-child { border-bottom: none; }
.fhb-scheme-row strong { font-weight: 700; color: var(--text-primary); }
.fhb-scheme-row.saving-row strong { color: var(--emerald-dark); }
[data-theme="dark"] .fhb-scheme-row.saving-row strong { color: var(--emerald); }
.fhb-scheme-fine {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    display: block;
    margin-top: 10px;
}
.fhb-scheme-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--blue);
    text-decoration: none;
    border-bottom: 1px dashed rgba(37,99,235,0.35);
    padding-bottom: 1px;
    transition: color var(--transition), border-color var(--transition);
}
.fhb-scheme-link:hover {
    color: #1d4ed8;
    border-bottom-style: solid;
}
.fhb-eligible .fhb-scheme-link {
    color: var(--emerald-dark);
    border-bottom-color: rgba(0,160,122,0.35);
}
.fhb-eligible .fhb-scheme-link:hover {
    color: #00876a;
    border-bottom-style: solid;
}
[data-theme="dark"] .fhb-scheme-link { color: #93C5FD; border-bottom-color: rgba(147,197,253,0.35); }
[data-theme="dark"] .fhb-eligible .fhb-scheme-link { color: var(--emerald); border-bottom-color: rgba(0,200,150,0.35); }

/* Deposit summary */
.fhb-deposit-summary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
}
.fhb-deposit-header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.fhb-deposit-bar-wrap { margin-bottom: 14px; }
.fhb-deposit-bar {
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    position: relative;
    overflow: visible;
}
.fhb-deposit-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease;
    min-width: 4px;
}
.fhb-deposit-strong   { background: var(--emerald); }
.fhb-deposit-moderate { background: #2563EB; }
.fhb-deposit-minimum  { background: var(--amber); }
.fhb-deposit-low      { background: var(--red); }
.fhb-deposit-marker {
    position: absolute;
    top: -18px;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
}
.fhb-deposit-marker::after {
    content: '';
    display: block;
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 2px auto 0;
}
.fhb-deposit-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.fhb-deposit-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    color: var(--text-secondary);
}
.fhb-deposit-stat strong { font-weight: 700; color: var(--text-primary); font-size: 14px; }
.fhb-deposit-total strong { color: var(--navy); font-size: 16px; }
[data-theme="dark"] .fhb-deposit-total strong { color: var(--emerald); }
.fhb-deposit-message {
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    line-height: 1.4;
}
.fhb-deposit-msg-strong   { background: var(--emerald-pale); color: var(--emerald-dark); }
.fhb-deposit-msg-moderate { background: var(--blue-pale);    color: var(--blue); }
.fhb-deposit-msg-minimum  { background: var(--amber-pale);   color: #854F0B; }
.fhb-deposit-msg-low      { background: var(--red-pale);     color: var(--red); }
[data-theme="dark"] .fhb-deposit-msg-minimum { color: var(--amber); }

/* Eligibility checklist */
.fhb-checklist-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
}
.fhb-checklist-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
}
.fhb-checklist { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0; }
.fhb-check-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.fhb-check-item:last-child { border-bottom: none; }
.fhb-check-icon { font-size: 13px; font-weight: 700; flex-shrink: 0; margin-top: 1px; width: 16px; }
.fhb-check-pass .fhb-check-icon { color: var(--emerald-dark); }
.fhb-check-fail .fhb-check-icon { color: var(--red); }
.fhb-check-unknown .fhb-check-icon { color: var(--text-muted); }
[data-theme="dark"] .fhb-check-pass .fhb-check-icon { color: var(--emerald); }

.fhb-disclaimer { font-size: 11px; color: var(--text-muted); line-height: 1.5; }

/* ── State change notice ── */
.fhb-state-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--emerald-dark);
    background: var(--emerald-pale);
    border: 1px solid rgba(0,200,150,0.25);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    margin-top: 8px;
    line-height: 1.4;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.35s ease, padding 0.3s ease;
}
.fhb-state-notice.visible {
    opacity: 1;
    max-height: 80px;
    padding: 8px 10px;
}
.fhb-state-notice svg { flex-shrink: 0; margin-top: 1px; }
[data-theme="dark"] .fhb-state-notice { color: var(--emerald); }

/* ── Button row ── */
.fhb-btn-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    padding: 12px 24px 16px;
    border-top: 1px solid var(--border);
    z-index: 5;
    box-shadow: 0 -4px 12px rgba(10,37,64,0.06);
}
.fhb-btn-row .calc-btn { flex: 1; margin: 0; width: auto; }

/* ── Reset button ── */
.fhb-reset-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    flex-shrink: 0;
}
.fhb-reset-btn:hover {
    background: var(--red-pale);
    border-color: var(--red);
    color: var(--red);
}
.fhb-reset-btn svg { transition: transform 0.4s ease; }
.fhb-reset-btn:hover svg { transform: rotate(-180deg); }

@media (max-width: 1100px) {
    .fhb-layout { flex-direction: column; }
    .fhb-inputs { width: 100%; position: static; }
}
@media (max-width: 640px) {
    .fhb-hero { flex-direction: column; }
    .fhb-hero-amount { font-size: 38px; }
    .fhb-deposit-stats { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   BORROWING POWER — ENTERPRISE
   ============================================================ */
.bp-layout {
    display: flex;
    gap: 24px;
    max-width: 1300px;
    margin: 0 auto;
    align-items: flex-start;
}
.bp-inputs {
    width: 360px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 80px;
}
.bp-output { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.bp-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }

/* HEM hint */
.bp-hem-hint {
    font-size: 12px;
    font-weight: 600;
    margin-top: 5px;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    line-height: 1.4;
}
.bp-hem-warn { background: rgba(245,166,35,0.1); color: #854F0B; border: 1px solid rgba(245,166,35,0.2); }
.bp-hem-ok   { background: var(--emerald-pale); color: var(--emerald-dark); border: 1px solid rgba(0,200,150,0.2); }
[data-theme="dark"] .bp-hem-warn { color: var(--amber); }

/* bp-result */
.bp-result.hidden { display: none; }

/* Hero row */
.bp-hero {
    background: var(--navy);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    box-shadow: var(--shadow-lg);
}
.bp-hero-item { flex: 1; min-width: 200px; }
.bp-hero-item .metric-label { color: rgba(255,255,255,0.55); font-size: 11px; letter-spacing: 0.5px; }
.bp-hero-divider {
    width: 1px;
    height: 60px;
    background: rgba(255,255,255,0.15);
    margin: 0 28px;
    flex-shrink: 0;
}
.bp-amount {
    font-family: var(--font-serif);
    font-size: 44px;
    color: #fff;
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin: 4px 0 2px;
}
.bp-amount--secondary { font-size: 36px; color: var(--emerald); }
.bp-sub { font-size: 12px; color: rgba(255,255,255,0.5); }
.bp-gauge-wrap { margin-left: auto; position: relative; }
.bp-gauge-label {
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    margin-top: -24px;
    color: var(--emerald);
}

/* Section grid — 2×2 cards */
.bp-section-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.bp-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.bp-card-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.bp-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}
.bp-row:last-child { border-bottom: none; }
.bp-row strong { font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.bp-row small  { font-size: 11px; color: var(--text-muted); display: block; margin-top: 1px; }
.bp-row-total  { border-top: 2px solid var(--border) !important; margin-top: 4px; }
.bp-row-total strong { font-size: 14px; color: var(--navy); }
[data-theme="dark"] .bp-row-total strong { color: var(--emerald); }
.bp-val-ok      { color: var(--emerald-dark) !important; }
.bp-val-warn    { color: var(--red) !important; }
.bp-val-caution { color: #B45309 !important; }
.bp-hem-tag {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    background: rgba(245,166,35,0.15);
    color: #854F0B;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
}

/* Rate sensitivity */
.bp-sensitivity {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
}
.bp-sensitivity .section-header { margin-bottom: 14px; }
.bp-sensitivity .section-header h3 { font-size: 14px; }
.bp-sensitivity-table-wrap { overflow-x: auto; }
.bp-sensitivity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.bp-sensitivity-table th {
    padding: 9px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}
.bp-sensitivity-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}
.bp-sensitivity-table tr.bp-sens-active td {
    background: var(--emerald-pale);
    font-weight: 700;
    color: var(--text-primary);
}
.bp-sensitivity-table tr.bp-sens-active td:first-child::after {
    content: ' ← current';
    font-size: 10px;
    font-weight: 400;
    color: var(--emerald-dark);
    margin-left: 4px;
}
.bp-sensitivity-table tr:last-child td { border-bottom: none; }

/* Tips */
.bp-tips {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--blue);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.bp-tips-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--blue);
    margin-bottom: 12px;
}
[data-theme="dark"] .bp-tips-header { color: #93C5FD; }
.bp-tip {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.bp-tip:last-child { border-bottom: none; }
.bp-tip-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.bp-disclaimer { font-size: 11px; color: var(--text-muted); line-height: 1.5; margin-top: 4px; }

@media (max-width: 1100px) {
    .bp-layout { flex-direction: column; }
    .bp-inputs { width: 100%; position: static; }
    .bp-section-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .bp-hero { flex-direction: column; gap: 16px; }
    .bp-hero-divider { display: none; }
    .bp-two-col { grid-template-columns: 1fr; }
    .bp-amount { font-size: 34px; }
}

/* ---- Toggle Label (original checkbox style) ---- */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 0;
    font-weight: 600;
}
.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--emerald);
    flex-shrink: 0;
}
.toggle-text {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    user-select: none;
}

/* ---- Input Validation ---- */
.input-error {
    border-color: var(--red) !important;
    box-shadow: 0 0 0 3px rgba(226,75,74,0.12) !important;
}
.input-wrap:has(input.input-error) {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(226,75,74,0.12);
}
.field-error {
    display: block;
    font-size: 11px;
    color: var(--red);
    margin-top: 5px;
    font-weight: 600;
    padding-left: 2px;
}

/* ---- LMI value ---- */
.lmi-value { color: var(--red) !important; }

/* ---- Extra Repayments savings strip ---- */
.extra-savings-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.esaving-pill {
    background: var(--emerald-pale);
    color: var(--emerald-dark);
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(0,200,150,0.2);
}
.esaving-pill strong { font-weight: 700; }

/* ---- Mobile table — responsive card rows ---- */
@media (max-width: 640px) {
    .table-container { border: none; border-radius: 0; box-shadow: none; }
    #scheduleTable { display: block; }
    #scheduleTable thead { display: none; }
    #scheduleTable tbody { display: block; }
    #scheduleTable tbody tr.year-row { display: block; padding: 10px 14px; }
    #scheduleTable tbody tr.year-row td { display: block; padding: 0; border: none; }
    .year-summary-right { display: none; }
    .year-summary-center { justify-content: flex-start; }
    #scheduleTable tbody tr.month-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 16px;
        padding: 12px 14px;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        margin-bottom: 6px;
        background: var(--bg-card);
    }
    #scheduleTable tbody tr.month-row:first-child { margin-top: 6px; }
    #scheduleTable tbody tr.month-row td {
        display: flex;
        flex-direction: column;
        text-align: left;
        padding: 0;
        border: none;
        font-size: 13px;
        color: var(--text-primary);
    }
    #scheduleTable tbody tr.month-row td::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.6px;
        color: var(--text-muted);
        margin-bottom: 2px;
    }
    #scheduleTable tbody tr.month-row td:first-child {
        grid-column: 1 / -1;
        font-size: 13px;
        font-weight: 700;
        color: var(--navy);
        border-bottom: 1px solid var(--border);
        padding-bottom: 6px;
        margin-bottom: 2px;
    }
    [data-theme="dark"] #scheduleTable tbody tr.month-row td:first-child { color: var(--emerald); }
    .sched-summary-strip { flex-wrap: wrap; }
    .sched-summary-item { min-width: calc(33.33% - 1px); }
}

/* ---- Hidden ---- */
.hidden { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 1100px) {
    .calc-layout { flex-direction: column; }
    .input-panel { width: 100%; position: static; max-height: none; }
    .chart-breakdown-row { flex-direction: column; }
    .tool-layout { flex-direction: column; }
    .tool-input { width: 100%; }
}
@media (max-width: 768px) {
    :root { --header-h: 56px; }
    .main-content { padding: 12px; }
    .header-nav { display: none; }
    .metrics-strip { grid-template-columns: 1fr 1fr; }
    .year-summary-right { display: none; }
    h1, .panel-header h2 { font-size: 18px; }
    .metric-value { font-size: 20px; }
    .ml-breakdown-cards { grid-template-columns: 1fr 1fr; }
    .ml-valuation-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .metrics-strip { grid-template-columns: 1fr; }
    .breakdown-cards { grid-template-columns: 1fr; }
    .ml-breakdown-cards { grid-template-columns: 1fr; }
    .ml-valuation-grid { grid-template-columns: 1fr; }
    .freq-buttons { flex-direction: column; }
}

/* ---- Cash flow frequency toggle ---- */
.inv-freq-toggle {
    display: flex;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2px;
    gap: 2px;
}
.inv-freq-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 18px;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.inv-freq-btn.active {
    background: var(--navy);
    color: #fff;
}
[data-theme="dark"] .inv-freq-btn.active { background: var(--emerald); color: var(--navy); }

/* ---- Year selector ---- */
.inv-year-select {
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 8px 3px 10px;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238896A9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 22px;
}
.inv-year-select:hover,
.inv-year-select:focus { border-color: var(--emerald); }

/* ---- Equity KPI pills ---- */
.inv-equity-kpis {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.inv-equity-pill {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    white-space: nowrap;
}
.inv-equity-pill--green {
    background: var(--emerald-pale);
    color: var(--emerald-dark);
    border-color: rgba(0,200,150,0.2);
}
.inv-equity-pill--blue {
    background: var(--blue-pale);
    color: var(--blue);
    border-color: rgba(37,99,235,0.2);
}

/* ---- Expense grid with inflation overrides ---- */
.inv-expense-grid {
    border-top: 1px solid var(--border);
    padding-top: 8px;
}
.inv-expense-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.inv-expense-row:last-child { border-bottom: none; }
.inv-expense-inputs { min-width: 0; }
.inv-expense-inputs label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.inv-expense-inflation {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 80px;
    align-items: flex-end;
}
.inv-expense-inflation label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 0;
    white-space: nowrap;
}
.inv-expense-inflation label svg { opacity: 0.6; }
.input-wrap--sm {
    width: 80px;
    flex-shrink: 0;
}
.input-wrap--sm input { font-size: 13px; padding: 6px 0; }

/* ---- Inflation rate tags in cash flow rows ---- */
.inv-infl-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    background: var(--amber-pale);
    color: #854F0B;
    border: 1px solid rgba(245,166,35,0.25);
    margin-left: 4px;
    vertical-align: middle;
}
.inv-infl-tag--green {
    background: var(--emerald-pale);
    color: var(--emerald-dark);
    border-color: rgba(0,200,150,0.2);
}
[data-theme="dark"] .inv-infl-tag { color: var(--amber); }

/* ---- Loan type tags ---- */
.inv-loan-type-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
    margin-left: 4px;
    vertical-align: middle;
}
.inv-loan-type-tag--io  { background: var(--blue-pale); color: var(--blue); border: 1px solid rgba(37,99,235,0.2); }
.inv-loan-type-tag--pi  { background: var(--emerald-pale); color: var(--emerald-dark); border: 1px solid rgba(0,200,150,0.2); }

/* ---- IO switchover note ---- */
.inv-io-switch-note {
    font-size: 12px;
    color: var(--blue);
    background: var(--blue-pale);
    border: 1px solid rgba(37,99,235,0.15);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-top: 8px;
    line-height: 1.5;
}
[data-theme="dark"] .inv-io-switch-note { color: #93C5FD; background: rgba(37,99,235,0.1); }

/* ---- Purchase year context ---- */
.inv-year-month-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}
.inv-month-select {
    width: 72px !important;
    padding: 10px 6px !important;
    font-size: 13px !important;
    text-align: center;
}
/* Keep old class for any residual references */
.inv-purchase-year-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.inv-purchase-context {
    margin: -6px 0 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.inv-ctx-line {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    line-height: 1.4;
}
.inv-ctx-ok   { background: var(--emerald-pale); color: var(--emerald-dark); border: 1px solid rgba(0,200,150,0.2); }
.inv-ctx-warn { background: var(--amber-pale);   color: #854F0B;             border: 1px solid rgba(245,166,35,0.3); }
[data-theme="dark"] .inv-ctx-warn { color: var(--amber); }

.dep-partial-flag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--amber-pale);
    color: #854F0B;
    margin-left: 5px;
    vertical-align: middle;
}
[data-theme="dark"] .dep-partial-flag { color: var(--amber); }

.inv-dep-stat-age {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 3px;
}

@media (max-width: 400px) {
    .inv-purchase-year-row { grid-template-columns: 1fr; }
}

/* ============================================================
   UPFRONT COSTS CALCULATOR
   ============================================================ */

/* ---- Layout overrides for wider tool layout ---- */
.tool-layout--wide { max-width: 1400px; }
.tool-input--wide  { width: 460px; }
.tool-output--wide { flex: 1; min-width: 0; }

/* ── Advisory panel ── */
.uc-advisory {
    background: var(--blue-pale);
    border: 1px solid rgba(37,99,235,0.2);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
    animation: fadeInUp 0.25s ease;
}
.uc-advisory.hidden { display: none; }
.uc-advisory-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--blue);
    padding: 13px 16px;
    width: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: var(--font);
    transition: background var(--transition);
}
.uc-advisory-header:hover { background: rgba(37,99,235,0.05); }
.uc-advisory-header span:nth-child(2) { flex: 1; }
[data-theme="dark"] .uc-advisory-header { color: #93C5FD; }
[data-theme="dark"] .uc-advisory { background: rgba(37,99,235,0.08); border-color: rgba(37,99,235,0.25); }
[data-theme="dark"] .uc-advisory-header:hover { background: rgba(37,99,235,0.12); }

.uc-advisory-count {
    font-size: 10px;
    font-weight: 700;
    background: rgba(37,99,235,0.15);
    color: var(--blue);
    padding: 2px 7px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}
[data-theme="dark"] .uc-advisory-count { color: #93C5FD; background: rgba(37,99,235,0.25); }

.uc-advisory-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.uc-advisory-header[aria-expanded="true"] .uc-advisory-chevron {
    transform: rotate(180deg);
}

.uc-advisory-list {
    list-style: none;
    padding: 0 16px 14px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid rgba(37,99,235,0.12);
    padding-top: 12px;
}
.uc-advisory-list.hidden { display: none; }
.uc-advisory-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.uc-advisory-icon {
    font-size: 14px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    margin-top: 1px;
}
.uc-advisory-item strong {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1px;
}
.uc-advisory-item p { margin: 0; }

/* ── Disabled field state ── */
.uc-field-disabled {
    opacity: 0.45;
    pointer-events: none;
}
.uc-field-disabled label { color: var(--text-muted); }
.input-wrap--disabled {
    background: var(--bg) !important;
    border-color: var(--border) !important;
    box-shadow: none !important;
}
.input-wrap--disabled input { color: var(--text-muted); }

/* ── Investor-only fields slide in ── */
.uc-investor-only {
    animation: fadeInUp 0.2s ease;
}

/* ── Buyer type toggle layout override ---- */

/* ── State links in All States comparison ── */
.sd-state-link {
    color: var(--blue);
    text-decoration: none;
    font-weight: 700;
    font-size: inherit;
    border-bottom: 1px dashed rgba(37,99,235,0.35);
    transition: color var(--transition), border-color var(--transition);
}
.sd-state-link:hover {
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
    border-bottom-style: solid;
}
[data-theme="dark"] .sd-state-link { color: #93C5FD; border-bottom-color: rgba(147,197,253,0.35); }
[data-theme="dark"] .sd-state-link:hover { color: #bfdbfe; border-bottom-color: #bfdbfe; }

/* ── FHB transfer duty link in results row ── */
.uc-row-link {
    color: var(--emerald-dark);
    text-decoration: none;
    font-weight: inherit;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border-bottom: 1px dashed rgba(0,160,122,0.4);
    transition: color var(--transition), border-color var(--transition);
}
.uc-row-link:hover {
    color: #00876a;
    border-bottom-color: #00876a;
    border-bottom-style: solid;
}
[data-theme="dark"] .uc-row-link { color: var(--emerald); border-bottom-color: rgba(0,200,150,0.4); }
[data-theme="dark"] .uc-row-link:hover { color: #34d399; border-bottom-color: #34d399; }

/* ── Two-column field grid ── */
.uc-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
}

/* ── LMI notice ── */
.uc-lmi-notice {
    font-size: 12px;
    color: var(--red);
    background: var(--red-pale);
    border: 1px solid rgba(226,75,74,0.2);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-top: 8px;
    line-height: 1.5;
}

/* ── Hero card ── */
.uc-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--navy);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 16px;
    gap: 20px;
    box-shadow: var(--shadow-lg);
}
.uc-hero.hidden { display: none; }
.uc-hero-left .metric-label { color: rgba(255,255,255,0.6); }
.uc-total {
    font-family: var(--font-serif);
    font-size: 48px;
    color: #FFFFFF;
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin: 6px 0 4px;
}
.uc-total-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    line-height: 1.5;
}
.uc-pct-label {
    color: var(--emerald);
    font-weight: 700;
}
.uc-hero-right { flex-shrink: 0; }

/* ── Breakdown grid ── */
.uc-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.uc-breakdown.hidden { display: none; }

.uc-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}
.uc-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.uc-group-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.uc-group-header h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    flex: 1;
    margin: 0;
}
.uc-group-total {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}
.uc-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}
.uc-row:last-child { border-bottom: none; }
.uc-row span:first-child { flex: 1; }
.uc-row strong { font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.uc-note {
    display: inline-block;
    font-size: 10px;
    background: var(--emerald-pale);
    color: var(--emerald-dark);
    border-radius: 4px;
    padding: 0 5px;
    margin-left: 3px;
    font-weight: 600;
    vertical-align: middle;
}

/* ── Stacked bar ── */
.uc-bar-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.uc-bar-section.hidden { display: none; }
.uc-bar-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.uc-stacked-bar {
    display: flex;
    height: 28px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    gap: 1px;
    margin-bottom: 12px;
}
.uc-bar-seg {
    transition: width 0.6s ease;
    cursor: default;
    min-width: 2px;
}
.uc-bar-seg:hover { filter: brightness(1.15); }
.uc-bar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}
.uc-leg-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-secondary);
}
.uc-leg-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.uc-leg-amt {
    font-weight: 700;
    color: var(--text-primary);
    margin-left: 2px;
}
.uc-leg-pct {
    color: var(--text-muted);
    font-size: 11px;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
    .tool-input--wide  { width: 100%; }
    .uc-breakdown      { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .uc-two-col        { grid-template-columns: 1fr; }
    .uc-breakdown      { grid-template-columns: 1fr; }
    .uc-total          { font-size: 36px; }
    .uc-hero           { flex-direction: column; }
    .uc-hero-right     { align-self: center; }
}

/* ============================================================
   RATE WATCH
   ============================================================ */
.rw-layout {
    display: flex;
    gap: 24px;
    max-width: 1300px;
    margin: 0 auto;
    align-items: flex-start;
}
.rw-inputs {
    width: 320px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 80px;
}
.rw-output { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.rw-kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 0; }
.rw-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; box-shadow: var(--shadow-sm); }
.rw-card--full { width: 100%; }
.rw-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rw-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.rw-card-header h3 { font-size: 14px; font-weight: 700; color: var(--text-primary); margin: 0 0 2px; }
.rw-card-sub { font-size: 12px; color: var(--text-muted); margin: 0; }
.rw-scenario-toggles { display: flex; gap: 4px; flex-shrink: 0; }
.rw-toggle-btn { padding: 5px 11px; background: transparent; border: 1px solid var(--border); border-radius: 20px; font-family: var(--font); font-size: 11px; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.rw-toggle-btn.active { background: var(--navy); border-color: var(--navy); color: #fff; }
[data-theme="dark"] .rw-toggle-btn.active { background: var(--emerald); color: var(--navy); border-color: var(--emerald); }
.rw-scenario-table-wrap { overflow-x: auto; margin-top: 14px; }
.rw-scenario-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rw-scenario-table th { padding: 8px 12px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
.rw-scenario-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); white-space: nowrap; }
.rw-scenario-table tr.rw-current-row td { background: var(--emerald-pale); font-weight: 600; color: var(--text-primary); }
.rw-scenario-table tr:last-child td { border-bottom: none; }
.rw-current-badge { display: inline-block; font-size: 10px; font-weight: 700; background: var(--navy); color: #fff; padding: 2px 7px; border-radius: 20px; }
[data-theme="dark"] .rw-current-badge { background: var(--emerald); color: var(--navy); }
.rw-val-up   { color: var(--red); font-weight: 700; }
.rw-val-down { color: var(--emerald-dark); font-weight: 700; }
.rw-val-amber { color: #B45309; font-weight: 700; }
[data-theme="dark"] .rw-val-down { color: var(--emerald); }
.rw-fv-verdict { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-md); margin: 14px 0 10px; font-size: 13px; font-weight: 600; }
.rw-fv-fixed-wins { background: var(--blue-pale); color: var(--blue); border: 1px solid rgba(37,99,235,0.2); }
.rw-fv-var-wins   { background: var(--emerald-pale); color: var(--emerald-dark); border: 1px solid rgba(0,200,150,0.2); }
[data-theme="dark"] .rw-fv-fixed-wins { color: #93C5FD; }
[data-theme="dark"] .rw-fv-var-wins   { color: var(--emerald); }
.rw-fv-icon { font-size: 18px; }
.rw-fv-breakdown { border-top: 1px solid var(--border); margin-top: 8px; }
.rw-fv-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); }
.rw-fv-row:last-child { border-bottom: none; }
.rw-fv-row strong { font-weight: 700; color: var(--text-primary); }
.rw-fv-row--total strong { font-size: 14px; }
.rw-fv-breaks { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.rw-fv-breaks-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); margin-bottom: 8px; }
.rw-fv-be-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.rw-fv-be-row:last-child { border-bottom: none; }
.rw-fv-be-note { color: var(--text-muted); font-size: 11px; }
.rw-stress-grid { border-top: 1px solid var(--border); margin-top: 12px; }
.rw-stress-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); }
.rw-stress-row:last-child { border-bottom: none; }
.rw-stress-row strong { font-weight: 700; }
.rw-no-data { font-size: 12px; color: var(--text-muted); padding: 16px 0; text-align: center; }
.rw-be-note { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.rw-be-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rw-be-table th { padding: 7px 8px; text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
.rw-be-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.rw-be-table tr.rw-be-win td { background: var(--emerald-pale); }
[data-theme="dark"] .rw-be-table tr.rw-be-win td { background: rgba(0,200,150,0.08); }
.rw-be-table tr:last-child td { border-bottom: none; }
.rw-be-footer { font-size: 11px; color: var(--text-muted); margin-top: 8px; }
.rw-disclaimer { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
@media (max-width: 1100px) { .rw-layout { flex-direction: column; } .rw-inputs { width: 100%; position: static; } .rw-two-col { grid-template-columns: 1fr; } }

/* ============================================================
   INVESTOR TOOLS
   ============================================================ */

/* ---- Layout ---- */
.investor-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.investor-inputs {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: sticky;
    top: calc(var(--header-h) + 20px);
    max-height: calc(100vh - var(--header-h) - 48px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.investor-inputs::-webkit-scrollbar { width: 4px; }
.investor-inputs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.investor-results { flex: 1; min-width: 0; }

/* ---- Metric strip override for investor ---- */
.inv-metrics { margin-bottom: 20px; }

/* ---- Two-column row ---- */
.inv-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.inv-two-col > .inv-card {
    display: flex;
    flex-direction: column;
}
.inv-two-col > .inv-card > .inv-total-row {
    margin-top: auto;
}

/* ---- KPI hint ---- */
.inv-kpi-hint {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    padding: 2px 0 0;
    opacity: 0.7;
}
.inv-kpi-hint .inv-year-select {
    display: inline-flex;
    font-size: 11px;
    padding: 2px 18px 2px 6px;
    min-width: 0;
    width: auto;
    max-width: 120px;
}
.inv-metrics {
    grid-template-columns: repeat(5, 1fr);
}
@media (max-width: 1100px) {
    .inv-metrics { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .inv-metrics { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Cards ---- */
.inv-card {
    background: var(--bg-card);
    border: 1px solid var(--border);

    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.inv-card:hover { box-shadow: var(--shadow-md); }
.inv-card--full {
    margin-bottom: 16px;
}
.inv-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
    flex-wrap: wrap;
}
.inv-card-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* ---- Gearing / rate badges ---- */
.inv-gearing-badge, .inv-rate-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.inv-gearing-badge.negative { background: var(--red-pale); color: var(--red); border: 1px solid rgba(226,75,74,0.2); }
.inv-gearing-badge.positive { background: var(--emerald-pale); color: var(--emerald-dark); border: 1px solid rgba(0,200,150,0.2); }
.inv-gearing-badge.neutral  { background: var(--amber-pale); color: #A05E00; border: 1px solid rgba(245,166,35,0.3); }
.inv-rate-badge { background: var(--blue-pale); color: var(--blue); border: 1px solid rgba(37,99,235,0.2); }

/* ---- Row items ---- */
.inv-rows { border-top: 1px solid var(--border); }
.inv-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    gap: 8px;
}
.inv-row:last-child { border-bottom: none; }
.inv-row span:first-child { flex: 1; }
.inv-row strong {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    text-align: right;
    white-space: nowrap;
}
.inv-row.income strong { color: var(--emerald-dark); }
.inv-row.expense strong { color: var(--red); }
.inv-row.deduction strong { color: #2563EB; }
.inv-row.saving strong { color: var(--emerald-dark); }
.inv-row.indent { padding-left: 14px; font-size: 12px; color: var(--text-muted); }
.inv-row.indent strong { font-size: 12px; color: var(--text-muted); }

.inv-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 4px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    border-top: 2px solid var(--border);
    margin-top: 4px;
}
.inv-total-row .total-label { color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
.inv-total-row .total-positive { color: var(--emerald-dark); font-size: 16px; font-family: var(--font-serif); }
.inv-total-row .total-negative { color: var(--red); font-size: 16px; font-family: var(--font-serif); }
.inv-total-row .total-neutral  { color: var(--text-primary); font-size: 16px; font-family: var(--font-serif); }

.inv-after-tax {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--emerald-pale);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0,200,150,0.2);
    font-size: 13px;
    color: var(--emerald-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.inv-after-tax strong { font-weight: 700; font-size: 14px; }
[data-theme="dark"] .inv-after-tax { background: rgba(0,200,150,0.1); }

/* ---- Depreciation ---- */
.inv-dep-tabs {
    display: flex;
    gap: 4px;
}
.inv-dep-tab {
    padding: 4px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.inv-dep-tab.active { background: var(--navy); border-color: var(--navy); color: #fff; }
[data-theme="dark"] .inv-dep-tab.active { background: var(--emerald); border-color: var(--emerald); color: var(--navy); }

.inv-dep-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px;
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.inv-dep-stat { display: flex; flex-direction: column; gap: 3px; }
.inv-dep-stat-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-muted); }
.inv-dep-stat-value { font-size: 16px; font-family: var(--font-serif); color: var(--text-primary); }
.inv-dep-stat-value.blue  { color: #2563EB; }
.inv-dep-stat-value.amber { color: #B45309; }
[data-theme="dark"] .inv-dep-stat-value.amber { color: var(--amber); }

.inv-dep-chart-wrap { margin-bottom: 16px; }

.inv-dep-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 340px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.inv-dep-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 560px;
}
.inv-dep-table thead {
    position: sticky;
    top: 0;
    background: var(--navy);
    z-index: 5;
}
.inv-dep-table th {
    padding: 10px 14px;
    text-align: right;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.75);
    white-space: nowrap;
}
.inv-dep-table th:first-child { text-align: left; }
.inv-dep-table td {
    padding: 9px 14px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
}
.inv-dep-table td:first-child { text-align: left; font-weight: 600; color: var(--text-primary); }
.inv-dep-table tbody tr:nth-child(odd) { background: var(--bg-card); }
.inv-dep-table tbody tr:nth-child(even) { background: var(--bg); }
.inv-dep-table tbody tr:hover { background: var(--emerald-pale); }
.inv-dep-table .div43-val { color: #2563EB; font-weight: 600; }
.inv-dep-table .div40-val { color: #B45309; font-weight: 600; }
[data-theme="dark"] .inv-dep-table .div40-val { color: var(--amber); }
.inv-dep-table .tax-saving { color: var(--emerald-dark); font-weight: 700; }

.inv-disclaimer {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 14px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border);
}

/* ── Acquisition Costs — Input Panel ─────────────────────────── */
.inv-acq-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
}
.inv-acq-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    margin-top: 10px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}
.inv-acq-total strong {
    font-size: 15px;
    color: var(--text);
    font-weight: 600;
}
.inv-lmi-badge {
    background: #FEF3C7 !important;
    color: #92400E !important;
}

/* ── Acquisition Costs — Results Card ────────────────────────── */
.inv-acq-card {
    border: 1px solid var(--border);
    border-left: 4px solid #2563EB;
}
.inv-acq-state-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: #EFF6FF;
    color: #1E40AF;
}
[data-theme="dark"] .inv-acq-state-badge {
    background: rgba(37,99,235,0.15);
    color: #93C5FD;
}
.inv-acq-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 14px;
}
.inv-acq-section {
    margin-bottom: 12px;
}
.inv-acq-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.inv-acq-rows {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.inv-acq-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.inv-acq-row strong {
    font-weight: 500;
    color: var(--text);
}
.inv-acq-row .inv-acq-note {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 4px;
}
.inv-acq-total-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    margin-top: 8px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
}
.inv-acq-total-bar strong {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

/* ROI side */
.inv-acq-roi {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.inv-acq-roi-hero {
    text-align: center;
    padding: 18px 14px;
    background: linear-gradient(135deg, #0A2540 0%, #1a3a5c 100%);
    border-radius: var(--radius);
    color: #fff;
}
[data-theme="dark"] .inv-acq-roi-hero {
    background: linear-gradient(135deg, #1a3a5c 0%, #0A2540 100%);
}
.inv-acq-roi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
    margin-bottom: 6px;
}
.inv-acq-roi-amount {
    font-family: 'DM Serif Display', serif;
    font-size: 28px;
    font-weight: 400;
    line-height: 1.1;
}
.inv-acq-roi-sub {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 6px;
}
.inv-acq-roi-metrics {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.inv-acq-roi-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}
.inv-acq-roi-metric-label {
    color: var(--text-secondary);
}
.inv-acq-roi-metric-value {
    font-weight: 600;
    color: var(--text);
}
.inv-acq-roi-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}
.inv-acq-roi-metric--highlight {
    padding: 8px 12px;
    background: rgba(0,200,150,0.08);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0,200,150,0.2);
}
.inv-acq-roi-metric--highlight .inv-acq-roi-metric-value {
    color: var(--emerald-dark);
    font-size: 18px;
    font-weight: 700;
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
    .investor-layout { flex-direction: column; }
    .investor-inputs { width: 100%; position: static; max-height: none; }
    .inv-two-col { grid-template-columns: 1fr; }
    .inv-acq-grid { grid-template-columns: 1fr; }
    .inv-acq-two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .inv-dep-summary { grid-template-columns: 1fr 1fr; }
}

/* ---- Print ---- */
@media print {
    .site-header, .input-panel, .schedule-controls, .header-actions { display: none; }
    .calc-layout { display: block; }
    .results-panel { width: 100%; }
    body { background: white; }
}

/* ---- Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.results:not(.hidden) { animation: fadeInUp 0.3s ease; }
.metric-tile { animation: fadeInUp 0.3s ease backwards; }
.metric-tile:nth-child(2) { animation-delay: 0.05s; }
.metric-tile:nth-child(3) { animation-delay: 0.1s; }
.metric-tile:nth-child(4) { animation-delay: 0.15s; }

/* ============================================================
   MY LOAN TRACKER
   ============================================================ */

/* Rate change input rows */
.ml-rate-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.ml-rate-row select,
.ml-rate-row input[type="number"] {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 8px;
    font-size: 13px;
    background: var(--bg-input);
}
.ml-rate-row select { width: 70px; }
.ml-rate-row .ml-rate-year { width: 72px; }
.ml-rate-row .ml-rate-val { width: 80px; }
.ml-rate-row label { font-size: 11px; margin-bottom: 3px; }
.ml-rate-field { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ml-rate-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    flex-shrink: 0;
    align-self: center;
}
.ml-rate-remove:hover { color: var(--red); background: var(--red-pale); }

/* Rate timeline in results */
.ml-rate-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 20px;
}
.ml-rate-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border);
}
.ml-tl-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    position: relative;
    font-size: 13px;
}
.ml-tl-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2.5px solid var(--emerald);
    background: var(--bg-card);
    position: absolute;
    left: -19px;
    flex-shrink: 0;
    z-index: 1;
}
.ml-tl-dot--past { border-color: var(--blue); }
.ml-tl-dot--now { border-color: var(--emerald); background: var(--emerald); }
.ml-tl-date { font-weight: 700; color: var(--text-primary); min-width: 80px; }
.ml-tl-rate { font-weight: 600; color: var(--text-secondary); }
.ml-tl-repay { margin-left: auto; font-weight: 700; color: var(--text-primary); }
.ml-tl-change {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}
.ml-tl-change--up { background: var(--red-pale); color: var(--red); }
.ml-tl-change--down { background: var(--emerald-pale); color: var(--emerald-dark); }
.ml-tl-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--emerald-pale);
    color: var(--emerald-dark);
}
.ml-tl-tag--past {
    background: var(--blue-pale);
    color: var(--blue);
}

/* Past row highlight in schedule */
.ml-past-row { background: rgba(37, 99, 235, 0.03); }
[data-theme="dark"] .ml-past-row { background: rgba(37, 99, 235, 0.06); }
.ml-today-row { background: rgba(0, 200, 150, 0.06); font-weight: 600; }
.ml-today-marker {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--emerald);
    color: #fff;
}
.ml-rate-change-marker {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--amber-pale);
    color: #854F0B;
}


/* ── Property Lookup Modal ── */
.ml-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 37, 64, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.ml-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
    animation: fadeInUp 0.25s ease;
}
.ml-modal--wide {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}
.ml-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.ml-modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.ml-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.ml-modal-close:hover { color: var(--red); background: var(--red-pale); }
.ml-modal-body { padding: 20px 24px 24px; }
.ml-modal-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 16px;
}
.ml-lookup-buttons {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}
.ml-lookup-buttons-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 14px;
    margin-bottom: 2px;
}
.ml-lookup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.ml-lookup-btn:hover { border-color: var(--emerald); color: var(--emerald-dark); background: var(--emerald-pale); }
.ml-lookup-btn--domain:hover { border-color: #6B21A8; color: #6B21A8; background: #F5F0FF; }
.ml-lookup-btn--rea:hover { border-color: #E4002B; color: #E4002B; background: #FFF0F3; }
[data-theme="dark"] .ml-lookup-btn--domain:hover { background: rgba(107,33,168,0.1); }
[data-theme="dark"] .ml-lookup-btn--rea:hover { background: rgba(228,0,43,0.1); }

/* Paste hint */
.ml-paste-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 10px 0 0;
    padding: 10px 14px;
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: var(--radius-md);
    font-size: 12px;
    line-height: 1.5;
    color: #92400E;
}
[data-theme="dark"] .ml-paste-hint {
    background: rgba(251,191,36,0.08);
    border-color: rgba(251,191,36,0.2);
    color: #FCD34D;
}
.ml-paste-hint svg { flex-shrink: 0; margin-top: 1px; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
.ml-lookup-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ml-lookup-divider::before,
.ml-lookup-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Valuation override row inside bcard ── */
.ml-val-override {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.ml-val-override label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    margin-bottom: 0;
}
.ml-val-override .input-wrap { flex: 1; }
.ml-val-override input { font-size: 13px; padding: 6px 0; }


/* ── Address Autocomplete ── */
.ml-autocomplete-wrap { position: relative; }
.ml-ac-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-md);
    display: none;
    max-height: 240px;
    overflow-y: auto;
}
.ml-ac-dropdown.active { display: block; }
.ml-ac-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
}
.ml-ac-item:last-child { border-bottom: none; }
.ml-ac-item:hover { background: var(--emerald-pale); }
.ml-ac-item svg { flex-shrink: 0; margin-top: 2px; color: var(--text-muted); }
.ml-ac-item-main { font-weight: 600; }
.ml-ac-item-sub { font-size: 12px; color: var(--text-muted); }
.ml-ac-empty {
    padding: 14px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}
/* Hide Google's default PAC container since we use custom dropdown */
.pac-container { z-index: 1100 !important; }

/* ── Address clear button ── */
.ml-addr-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    margin-right: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    flex-shrink: 0;
}
.ml-addr-clear:hover { color: var(--red); background: var(--red-pale); }

/* ── Recent searches ── */
.ml-recent-searches {
    margin: 10px 0 4px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.ml-recent-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.ml-recent-clear {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.ml-recent-clear:hover { color: var(--red); }
.ml-recent-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ml-recent-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: left;
    width: 100%;
    transition: background var(--transition);
}
.ml-recent-item:hover { background: var(--emerald-pale); }
.ml-recent-item svg { flex-shrink: 0; color: var(--text-muted); }
.ml-recent-addr { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-recent-source {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    background: var(--border);
    color: var(--text-muted);
    margin-left: 4px;
}

/* ── Value source chips ── */
.ml-value-source {
    margin-top: 14px;
}
.ml-value-source label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}
.ml-source-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.ml-source-chip {
    padding: 5px 12px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.ml-source-chip:hover { border-color: var(--emerald); color: var(--emerald-dark); }
.ml-source-chip.active {
    border-color: var(--emerald);
    background: var(--emerald-pale);
    color: var(--emerald-dark);
    font-weight: 600;
}

/* ── Confidence indicator ── */
.ml-confidence {
    margin: 12px 0 4px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.ml-confidence-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.ml-confidence-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease, background 0.4s ease;
    width: 0;
}
.ml-confidence-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}
.ml-confidence-diff {
    font-weight: 700;
}
.ml-confidence-text {
    color: var(--text-muted);
}

/* ── Suburb median ── */
.ml-suburb-median {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
    padding: 10px 14px;
    background: linear-gradient(135deg, #EFF6FF 0%, #F0FDF4 100%);
    border-radius: var(--radius-md);
    border: 1px solid #D1E7DD;
}
[data-theme="dark"] .ml-suburb-median {
    background: linear-gradient(135deg, rgba(37,99,235,0.08) 0%, rgba(0,200,150,0.08) 100%);
    border-color: var(--border);
}
.ml-suburb-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 50%;
    border: 1px solid #D1E7DD;
    flex-shrink: 0;
    color: var(--emerald-dark);
}
[data-theme="dark"] .ml-suburb-icon { background: var(--bg-card); border-color: var(--border); }
.ml-suburb-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: capitalize;
}
.ml-suburb-value {
    font-size: 12px;
    color: var(--text-muted);
}
.ml-suburb-value strong {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
}

/* ── Offset Account ── */
.inv-offset-group {
    padding: 0 0 4px;
}
.inv-offset-group .form-group { margin-bottom: 10px; }
.inv-offset-preview {
    margin-top: 4px;
}
.inv-offset-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 8px 12px;
    background: var(--emerald-pale);
    border-radius: var(--radius-sm);
}
.inv-offset-stats small {
    color: var(--text-muted);
    font-size: 11px;
}
.inv-offset-note {
    border-left-color: var(--emerald) !important;
}

/* ── Rate Changes ── */
.inv-rate-changes {
    padding: 0 0 4px;
}

/* ── Rate change chart layout ── */
.inv-rc-chart-card {
    display: flex;
    flex-direction: column;
}
.inv-rc-chart-wrap {
    position: relative;
    width: 100%;
}
.inv-rc-chart-wrap canvas {
    width: 100% !important;
}
.inv-rc-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px 4px;
    font-size: 11px;
}
.inv-rc-sum-item {
    white-space: nowrap;
}
.inv-rc-sum-item.neg { color: var(--red, #ef4444); }
.inv-rc-sum-item.pos { color: var(--emerald-dark); }
.inv-rc-sum-item strong { font-weight: 700; }
.inv-rc-sum-divider {
    color: var(--border);
    font-size: 13px;
}
/* ── Form Reset Button ── */
.panel-header {
    position: relative;
}
.form-reset-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 14px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.6);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.form-reset-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-color: rgba(255,255,255,0.4);
}
.form-reset-btn svg { flex-shrink: 0; }

/* Stamp Duty tab uses a different header — style the button for light bg */
.tool-input .form-reset-btn {
    position: static;
    border-color: var(--border);
    background: var(--bg);
    color: var(--text-muted);
    flex-shrink: 0;
}
.tool-input .form-reset-btn:hover {
    background: var(--emerald-pale);
    color: var(--emerald-dark);
    border-color: var(--emerald);
}
