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

:root {
    --bg-primary: #faf7f5;
    --bg-card: #ffffff;
    --bg-dark: #f2eeeb;
    --bg-dark-secondary: #f7f3f0;
    --text-primary: #2d2a27;
    --text-secondary: #6b6460;
    --text-muted: #9c9490;
    --accent: #e8734a;
    --accent-light: #f09070;
    --accent-dark: #c95a32;
    --accent-glow: rgba(232, 115, 74, 0.2);
    --option-a: #5a8fa8;
    --option-a-light: rgba(90, 143, 168, 0.15);
    --option-a-bg: rgba(90, 143, 168, 0.06);
    --option-b: #c07a3e;
    --option-b-light: rgba(192, 122, 62, 0.15);
    --option-b-bg: rgba(192, 122, 62, 0.06);
    --border: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.06);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(circle at 1px 1px, rgba(0,0,0,0.03) 1px, transparent 0),
        radial-gradient(ellipse at 20% 0%, rgba(232, 115, 74, 0.06) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 100%, rgba(232, 115, 74, 0.04) 0%, transparent 50%);
    background-size: 24px 24px, 200% 200%, 200% 200%;
    background-attachment: fixed;
    animation: ambientBg 20s ease-in-out infinite;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

@keyframes ambientBg {
    0%, 100% { background-position: 0 0, 0% 0%, 100% 100%; }
    50% { background-position: 0 0, 100% 100%, 0% 0%; }
}

/* ---- HEADER ---- */
.site-header {
    background: linear-gradient(160deg, #e8734a 0%, #d4603a 30%, #e07848 60%, #c95a32 100%);
    background-size: 200% 200%;
    animation: headerShimmer 8s ease-in-out infinite;
    padding: 3rem 2rem 4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: none;
}

@keyframes headerShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.site-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
    border-radius: 50%;
}

.site-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 200, 150, 0.1) 0%, transparent 60%);
    border-radius: 50%;
}

.header-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
}

.site-header h1 {
    font-family: 'DM Sans', sans-serif;
    font-size: 2.1rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.site-header p {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    font-weight: 400;
}

.badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ---- LAYOUT ---- */
.app-layout {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .app-layout {
        grid-template-columns: 1fr;
        padding: 1rem 0.75rem 2.5rem;
        gap: 1.25rem;
    }
}

/* ---- CARDS ---- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    animation: cardEntrance 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.inputs-pane .card:nth-child(1) { animation-delay: 0s; }
.inputs-pane .card:nth-child(2) { animation-delay: 0.1s; }
.results-pane .card { animation-delay: 0.2s; }

@keyframes cardEntrance {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(232, 115, 74, 0.2);
    transform: translateY(-2px);
}

.card-header {
    padding: 1.5rem 1.75rem 0;
}

.card-body {
    padding: 1.25rem 1.75rem 1.75rem;
}

.card-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ---- FORM INPUTS ---- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    letter-spacing: 0.01em;
}

.help-text {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    line-height: 1.4;
}

input[type="number"], input[type="text"], select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-dark-secondary);
    transition: var(--transition);
    appearance: none;
    outline: none;
}

input:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 12px rgba(232, 115, 74, 0.08);
    transform: scale(1.01);
}

input:not(:focus):not(:placeholder-shown),
select:not(:focus) {
    transform: scale(1);
}

input.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.7rem center;
    background-repeat: no-repeat;
    background-size: 1.25em;
    padding-right: 2.2rem;
    cursor: pointer;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ---- OPTION BOXES ---- */
.option-box {
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1.5px solid;
    position: relative;
}

.option-box:last-child {
    margin-bottom: 0;
}

.option-a {
    background: rgba(90, 143, 168, 0.05);
    border-color: rgba(90, 143, 168, 0.2);
}

.option-b {
    background: rgba(192, 122, 62, 0.05);
    border-color: rgba(192, 122, 62, 0.2);
}

.option-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option-a .option-label { color: var(--option-a); }
.option-b .option-label { color: var(--option-b); }

.option-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.option-a .option-dot { background: var(--option-a); }
.option-b .option-dot { background: var(--option-b); }

/* ---- BUTTON ---- */
.btn-calculate {
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg, #e8734a 0%, #c95a32 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(232, 115, 74, 0.2);
}

.btn-calculate:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(232, 115, 74, 0.35);
}

.btn-calculate:active:not(:disabled) {
    transform: translateY(0);
}

.btn-calculate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    animation: none;
}

.btn-calculate:not(:disabled) {
    animation: btnPulse 3s ease-in-out infinite;
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(232, 115, 74, 0.2); }
    50% { box-shadow: 0 4px 20px rgba(232, 115, 74, 0.35); }
}

/* ---- RESULTS PANEL ---- */
.results-pane {
    position: sticky;
    top: 2rem;
}

.results-pane > .card {
    background: rgba(255, 255, 255, 0.75);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.5);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.results-pane > .card:hover {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.6);
}



.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h3 {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.empty-state p {
    font-size: 0.8rem;
}

/* ---- COMPARISON TABLE ---- */
.comparison-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.comparison-table .col-muted {
    opacity: 0.5;
    font-size: 0.78rem;
}

/* Payment summary — prevent overflow on mobile */
.payment-summary-main {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ---- DECISION CARD (Layer 1) ---- */
.decision-box {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.decision-box h3 {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.decision-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.decision-option {
    background: rgba(232, 115, 74, 0.04);
    border: 1px solid rgba(232, 115, 74, 0.15);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.decision-option strong {
    color: var(--text-primary);
}

.decision-option-payment {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    font-weight: 500;
}

.decision-payment {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent-dark);
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border-light);
}

.decision-why {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.decision-why strong {
    color: var(--text-secondary);
}

/* ---- DETAIL TOGGLE ---- */
.detail-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.7rem;
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--accent);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.detail-toggle:hover {
    background: rgba(232, 115, 74, 0.06);
    border-color: rgba(232, 115, 74, 0.25);
}

.toggle-arrow {
    font-size: 0.65rem;
    transition: transform 0.2s;
}

.detail-content {
    margin-top: 1rem;
}

/* ---- PAYMENT SUMMARY BANNER ---- */
.payment-summary {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 0.85rem 1.1rem;
    margin-top: 1rem;
    text-align: center;
}

.payment-summary-main {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.payment-summary-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ---- BREAK-EVEN GAUGE ---- */
.breakeven-gauge {
    margin: 1rem 0 0.5rem;
    position: relative;
}

.gauge-bar {
    height: 8px;
    background: linear-gradient(90deg, #22c55e 0%, #eab308 50%, #ef4444 100%);
    border-radius: 4px;
    position: relative;
}

.gauge-marker {
    position: absolute;
    top: -6px;
    width: 3px;
    height: 20px;
    background: #fff;
    border: 2px solid rgba(0,0,0,0.6);
    border-radius: 2px;
    transform: translateX(-50%);
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.62rem;
    color: rgba(255,255,255,0.75);
    margin-top: 0.35rem;
}

.comparison-table th {
    padding: 0.75rem 0.8rem;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 2px solid rgba(232, 115, 74, 0.15);
    background: rgba(232, 115, 74, 0.04);
}

.comparison-table td {
    padding: 0.9rem 0.8rem;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

.comparison-table tbody tr {
    transition: var(--transition);
}

.comparison-table tbody tr:hover {
    background: rgba(232, 115, 74, 0.04);
}

.comparison-table tbody tr:last-child td {
    border-bottom: none;
}

.better-choice {
    background: rgba(34, 197, 94, 0.06) !important;
}

.better-choice:hover {
    background: rgba(34, 197, 94, 0.1) !important;
}

.better-choice td {
    color: #16a34a !important;
}

.better-choice td:first-child {
    border-left: 3px solid #16a34a;
    animation: winnerPulse 2s ease-in-out infinite;
}

@keyframes winnerPulse {
    0%, 100% { border-left-color: #16a34a; }
    50% { border-left-color: #4ade80; }
}

/* ---- BREAK-EVEN COMPACT (detail section callout) ---- */
.breakeven-compact {
    background: rgba(232, 115, 74, 0.04);
    border: 1px solid rgba(232, 115, 74, 0.12);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.breakeven-compact-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.breakeven-compact-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.breakeven-compact-value {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent-dark);
}

/* ---- RISK SCENARIOS ---- */
.risk-section {
    margin-top: 0.5rem;
}

.risk-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.scenario-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.55rem 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    line-height: 1.4;
}

.scenario-item:last-child {
    border-bottom: none;
}

.scenario-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    margin-top: 1px;
}

.scenario-save {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.scenario-lose {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

.scenario-neutral {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-muted);
}

.scenario-breakeven {
    background: rgba(232, 115, 74, 0.04);
    border-radius: 6px;
    margin: 0 -0.5rem;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}

.scenario-be-tag {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--accent-dark);
    background: rgba(232, 115, 74, 0.12);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.35rem;
    vertical-align: middle;
}

/* ---- MESSAGE BOX ---- */
#messageBox {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.9rem 1.25rem;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    max-width: 320px;
    font-size: 0.82rem;
    background: #fffbeb;
    border: 1px solid #fbbf24;
    color: #92400e;
    animation: slideIn 0.3s ease-out;
}

#messageBox.error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}

#messageBox.success {
    background: #f0fdf4;
    border-color: #86efac;
    color: #16a34a;
}

.close-btn {
    float: right;
    cursor: pointer;
    font-weight: bold;
    margin-left: 0.75rem;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.close-btn:hover { opacity: 1; }

@keyframes slideIn {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- LOADING SPINNER ---- */
.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.6s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- FOOTER ---- */
.site-footer {
    text-align: center;
    padding: 2rem 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    max-width: 1240px;
    margin: 0 auto;
}

.site-footer a {
    color: var(--accent);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* ---- RESULT ANIMATIONS ---- */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- DIVIDER ---- */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.08), transparent);
    margin: 1.25rem 0;
}

/* ---- INFO HINT ---- */
.info-hint {
    background: rgba(232, 115, 74, 0.04);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 1rem;
    border: 1px solid rgba(232, 115, 74, 0.1);
}

.info-hint strong {
    color: var(--accent);
}

/* ---- BANK SELECTOR ---- */
.bank-selector {
    background: rgba(232, 115, 74, 0.03);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(232, 115, 74, 0.1);
}

.bank-selector-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent-dark);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.bank-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e8734a;
    display: inline-block;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.rate-source-note {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: center;
}

.rate-source-note a {
    color: var(--accent);
    text-decoration: none;
}

.rate-source-note a:hover {
    text-decoration: underline;
}

.auto-filled {
    border-color: var(--accent) !important;
    background: rgba(232, 115, 74, 0.08) !important;
}

.product-explainer {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    line-height: 1.45;
    padding: 0.4rem 0.6rem;
    background: rgba(232, 115, 74, 0.04);
    border-radius: 6px;
    display: none;
}

.product-explainer strong {
    color: var(--text-secondary);
}

/* ---- SEGMENTED TOGGLE ---- */
.rate-mode-toggle {
    display: flex;
    background: var(--bg-dark);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    padding: 3px;
    margin-bottom: 1.25rem;
    gap: 3px;
}

.rate-mode-btn {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border: none;
    border-radius: 999px;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.rate-mode-btn:hover:not(.active) {
    color: var(--text-secondary);
    background: rgba(232, 115, 74, 0.06);
}

.rate-mode-btn.active {
    background: linear-gradient(135deg, #e8734a 0%, #c95a32 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(232, 115, 74, 0.3);
}

.rate-mode-icon {
    font-size: 0.85rem;
}

.manual-hint {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

/* ---- SCROLLABLE TABLE WRAPPER (prevents layout shift) ---- */
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
}

/* ---- MOBILE OPTIMISATION ---- */
@media (max-width: 900px) {
    /* Header */
    .site-header {
        padding: 2rem 1rem 3rem;
    }

    .site-header h1 {
        font-size: 1.35rem;
    }

    .site-header p {
        font-size: 0.82rem;
    }

    .badge {
        font-size: 0.65rem;
        padding: 0.25rem 0.6rem;
    }

    /* Cards */
    .card-header {
        padding: 1.15rem 1.25rem 0;
    }

    .card-body {
        padding: 1rem 1.25rem 1.25rem;
    }

    .card-title {
        font-size: 1rem;
    }

    /* Inputs — larger touch targets */
    input[type="number"], input[type="text"], select {
        padding: 0.75rem 0.85rem;
        font-size: 1rem; /* 16px prevents iOS zoom */
        border-radius: 8px;
    }

    label {
        font-size: 0.78rem;
    }

    /* Segmented toggle — easier to tap */
    .rate-mode-toggle {
        margin-bottom: 1rem;
    }

    .rate-mode-btn {
        padding: 0.6rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Bank selector */
    .bank-selector {
        padding: 0.85rem 1rem;
        margin-bottom: 1rem;
    }

    .bank-selector-label {
        font-size: 0.78rem;
    }

    .bank-row {
        gap: 0.6rem;
        grid-template-columns: 1fr; /* Stack vertically on mobile */
    }

    /* Prevent select text truncation on mobile */
    .bank-selector select {
        font-size: 0.85rem;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
    }

    .rate-source-note {
        font-size: 0.65rem;
    }

    /* Option boxes */
    .option-box {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }

    .option-label {
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
    }

    .input-row {
        gap: 0.75rem;
    }

    /* Button */
    .btn-calculate {
        padding: 0.85rem 1.25rem;
        font-size: 0.88rem;
        border-radius: 8px;
        /* Prevent double-tap zoom */
        touch-action: manipulation;
        /* Disable pulse animation on mobile — causes visual jank */
        animation: none !important;
    }

    .btn-calculate:hover:not(:disabled) {
        transform: none;
        box-shadow: 0 2px 8px rgba(232, 115, 74, 0.2);
    }

    /* Disable card hover lift on mobile — causes layout shifts on tap */
    .card:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }

    /* Disable input scale on focus — causes zoom-like jank on mobile */
    input:focus, select:focus {
        transform: none;
    }

    /* Results — prevent overflow */
    .results-pane {
        position: static;
    }

    #resultsCard {
        overflow: hidden;
    }

    /* Comparison table — compact on mobile */
    .comparison-table {
        font-size: 0.75rem;
    }

    .comparison-table th {
        padding: 0.55rem 0.4rem;
        font-size: 0.58rem;
        letter-spacing: 0.05em;
    }

    .comparison-table td {
        padding: 0.65rem 0.4rem;
        font-size: 0.78rem;
    }

    /* Break-even box */
    .breakeven-box {
        padding: 1rem;
        margin-top: 1rem;
    }

    .breakeven-box h3 {
        font-size: 0.9rem;
    }

    .magic-number {
        font-size: 1.7rem;
    }

    .breakeven-box p {
        font-size: 0.78rem;
    }

    /* Risk scenarios */
    .risk-section {
        margin-top: 1rem;
    }

    .risk-title {
        font-size: 0.82rem;
    }

    .scenario-item {
        font-size: 0.78rem;
        padding: 0.5rem 0;
        gap: 0.5rem;
    }

    .scenario-icon {
        width: 20px;
        height: 20px;
        font-size: 0.6rem;
    }

    /* Info hints */
    .info-hint {
        font-size: 0.73rem;
        padding: 0.6rem 0.75rem;
    }

    /* Empty state */
    .empty-state {
        padding: 2.5rem 1.25rem;
    }

    .empty-state-icon {
        font-size: 2rem;
    }

    .empty-state h3 {
        font-size: 0.9rem;
    }

    .empty-state p {
        font-size: 0.75rem;
    }

    /* Footer */
    .site-footer {
        padding: 1.5rem 1rem;
        font-size: 0.7rem;
    }

    /* Message box */
    #messageBox {
        top: 0.5rem;
        right: 0.5rem;
        left: 0.5rem;
        max-width: none;
        font-size: 0.78rem;
    }

    /* Product explainer */
    .product-explainer {
        font-size: 0.65rem;
    }
}

/* Extra-small screens (iPhone SE etc.) */
@media (max-width: 380px) {
    .app-layout {
        padding: 0.75rem 0.5rem 2rem;
    }

    .card-header {
        padding: 1rem 1rem 0;
    }

    .card-body {
        padding: 0.85rem 1rem 1rem;
    }

    .rate-mode-btn {
        font-size: 0.7rem;
        padding: 0.55rem 0.25rem;
    }

    .comparison-table {
        font-size: 0.7rem;
    }

    .comparison-table th {
        font-size: 0.55rem;
        padding: 0.5rem 0.3rem;
    }

    .comparison-table td {
        padding: 0.55rem 0.3rem;
        font-size: 0.72rem;
    }
}

/* ---- NEWS FEED ---- */
.news-section {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

.news-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    animation: cardEntrance 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.3s;
}

.news-card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(232, 115, 74, 0.2);
}

.news-header {
    padding: 1.25rem 1.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.news-header-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.news-count-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(232, 115, 74, 0.12);
    color: var(--accent-dark);
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
}

.news-list {
    padding: 1rem 1.75rem 1.25rem;
}

.news-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    align-items: flex-start;
}

.news-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.news-item:first-child {
    padding-top: 0;
}

.news-item:hover {
    background: rgba(232, 115, 74, 0.03);
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    border-radius: 8px;
}

.news-item-content {
    flex: 1;
    min-width: 0;
}

.news-item-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.3rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.news-source-pill {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    background: rgba(232, 115, 74, 0.08);
    color: var(--accent-dark);
    white-space: nowrap;
}

.news-skeleton {
    padding: 0.75rem 0;
}

.news-skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, var(--bg-dark) 25%, var(--bg-dark-secondary) 50%, var(--bg-dark) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.news-skeleton-line:nth-child(1) { width: 85%; }
.news-skeleton-line:nth-child(2) { width: 40%; height: 10px; }

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.news-footer-note {
    padding: 0 1.75rem 1rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 900px) {
    .news-section {
        padding: 0 0.75rem 1.5rem;
    }

    .news-header {
        padding: 1rem 1.25rem 0;
    }

    .news-list {
        padding: 0.75rem 1.25rem 1rem;
    }

    .news-item-title {
        font-size: 0.78rem;
    }

    .news-footer-note {
        padding: 0 1.25rem 0.75rem;
    }
}
/* ---- FAQ SECTION ---- */

/* ---- SHARE BUTTON ---- */
.share-btn {
    display: none;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-dark-secondary);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    gap: 0.3rem;
    align-items: center;
}

.share-btn:hover {
    background: rgba(232, 115, 74, 0.08);
    border-color: var(--accent);
    color: var(--accent);
}

.share-btn.visible {
    display: inline-flex;
}

.results-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ---- EQUITY TOGGLE ---- */
.equity-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.equity-toggle input[type="checkbox"] {
    width: auto;
    accent-color: var(--accent);
    cursor: pointer;
}

.equity-toggle label {
    margin-bottom: 0;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
}

.equity-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: -0.3rem;
    margin-bottom: 0.5rem;
}

/* ---- HISTORICAL RATE CONTEXT ---- */
.rate-context {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    padding: 0.45rem 0.65rem;
    background: rgba(34, 197, 94, 0.06);
    border-radius: 6px;
    display: none;
    text-align: center;
    line-height: 1.4;
}

.rate-context-muted {
    color: var(--text-muted);
    font-size: 0.65rem;
}

/* ---- BROKER CTA ---- */
.broker-cta {
    background: rgba(232, 115, 74, 0.04);
    border: 1px solid rgba(232, 115, 74, 0.12);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.broker-cta a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.broker-cta a:hover {
    text-decoration: underline;
}

/* ---- RATE ALERTS ---- */
.alerts-section {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

.alerts-card {
    background: linear-gradient(135deg, rgba(232, 115, 74, 0.06) 0%, rgba(232, 115, 74, 0.02) 100%);
    border: 1px solid rgba(232, 115, 74, 0.12);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    text-align: center;
}

.alerts-card h3 {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.alerts-card p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.alerts-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 420px;
    margin: 0 auto;
}

.alerts-bank-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.alerts-bank-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}

.bank-check {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.bank-check:hover {
    border-color: var(--accent);
    background: rgba(232, 115, 74, 0.04);
}

.bank-check:has(input:checked) {
    border-color: var(--accent);
    background: rgba(232, 115, 74, 0.08);
    color: var(--text-primary);
}

.bank-check input[type="checkbox"] {
    accent-color: var(--accent);
    margin: 0;
}

.alerts-email-row {
    display: flex;
    gap: 0.5rem;
}

.alerts-message {
    font-size: 0.82rem;
    margin-top: 0.25rem;
}

.alerts-form input[type="email"] {
    flex: 1;
    padding: 0.6rem 0.9rem;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    outline: none;
    background: #fff;
}

.alerts-form input[type="email"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.alerts-form button {
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, #e8734a 0%, #c95a32 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.alerts-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 115, 74, 0.3);
}

@media (max-width: 900px) {
    .alerts-section {
        padding: 0 0.75rem 1.5rem;
    }

    .alerts-card {
        padding: 1.25rem;
    }

    .alerts-form {
        flex-direction: column;
    }
}
.faq-section {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

.faq-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    animation: cardEntrance 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.4s;
}

.faq-header {
    padding: 1.25rem 1.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.faq-header-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.faq-list {
    padding: 0.75rem 1.75rem 1.25rem;
}

.faq-item {
    border-bottom: 1px solid var(--border-light);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-item summary {
    padding: 0.85rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.1rem;
    font-weight: 300;
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-answer {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 0 0 1rem;
}

@media (max-width: 900px) {
    .faq-section {
        padding: 0 0.75rem 1.5rem;
    }

    .faq-header {
        padding: 1rem 1.25rem 0;
    }

    .faq-list {
        padding: 0.5rem 1.25rem 1rem;
    }

    .faq-item summary {
        font-size: 0.82rem;
    }

    .faq-answer {
        font-size: 0.78rem;
    }
}
