/* ===== CSS Variables ===== */
:root {
    /* Accent color using Web Awesome success tokens */
    --accent-color: var(--wa-color-success-fill-loud);
    --accent-bg: var(--wa-color-success-fill-quiet);

    /* Semantic aliases using Web Awesome tokens */
    --background: var(--wa-color-surface-default);
    --background-alt: var(--wa-color-surface-alt);
    --text-main: var(--wa-color-neutral-10);
    --text-muted: var(--wa-color-text-quiet);
    --border: var(--wa-color-border-quiet);
    --link: var(--wa-color-brand-on-normal);
}

/* ===== Accessibility ===== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--wa-color-brand-fill-loud);
    color: var(--wa-color-brand-on-loud);
    padding: 8px 16px;
    z-index: 100;
    text-decoration: none;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
}

/* ===== Report Page Layout ===== */
.report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--wa-space-s) var(--wa-space-l);
}

.report-logo {
    display: flex;
    align-items: center;
    gap: var(--wa-space-xs);
    text-decoration: none;
    color: inherit;
}

.report-nav {
    display: flex;
    align-items: center;
    gap: var(--wa-space-s);
}

/* Desktop/mobile visibility helpers */
.desktop-only {
    display: flex;
}
.mobile-only {
    display: none;
}

@media (max-width: 900px) {
    .desktop-only {
        display: none !important;
    }
    .mobile-only {
        display: flex !important;
    }
}

/* Mobile navigation drawer */
.mobile-nav {
    display: flex;
    flex-direction: column;
    padding: var(--wa-space-m);
    gap: var(--wa-space-2xs);
}

.report-main {
    display: flex;
    flex-direction: column;
    gap: var(--wa-space-l);
    padding: var(--wa-space-l);
}

/* ===== Form Layout ===== */
.calculator-form,
.settings-form {
    display: flex;
    flex-direction: column;
    gap: var(--wa-space-m);
    padding: var(--wa-space-l);
}

.settings-form {
    padding: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--wa-space-s);
}

.form-group-tight {
    display: flex;
    flex-direction: column;
    gap: var(--wa-space-2xs);
}

.form-group-compact {
    display: flex;
    flex-direction: column;
    gap: var(--wa-space-xs);
}

.scenario-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--wa-space-xs);
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: var(--wa-space-2xs);
}

.slider-value {
    text-align: center;
    font-size: var(--wa-font-size-s);
}

.settings-link {
    display: flex;
    align-items: center;
    gap: var(--wa-space-xs);
    color: var(--wa-color-text-quiet);
    text-decoration: none;
    font-size: var(--wa-font-size-s);
}

.settings-link:hover {
    color: var(--wa-color-text-loud);
}

/* ===== Dialog Layout ===== */
.dialog-header {
    text-align: center;
    margin-bottom: var(--wa-space-m);
}

.dialog-body {
    display: flex;
    flex-direction: column;
    gap: var(--wa-space-m);
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--wa-space-s);
}

/* ===== Benefit Callout ===== */
.benefit-callout {
    background: var(--wa-color-surface-default);
    border: 1px solid var(--wa-color-border-quiet);
    border-radius: 8px;
    padding: var(--wa-space-m) var(--wa-space-l);
}

/* ===== Error Message ===== */
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* ===== Mobile Form ===== */
.mobile-form {
    display: flex;
    flex-direction: column;
    gap: var(--wa-space-m);
}

/* ===== Base Typography & Reset ===== */
* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
    line-height: 1.4;
    color: var(--text-main);
    background: var(--background);
    max-width: none;
    padding: 0;
    margin: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin: 1.5rem 0 1rem;
    line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
    margin: 1rem 0;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== Form Elements ===== */
input, select, button {
    font-family: inherit;
    font-size: inherit;
}

input[type="number"],
input[type="text"],
select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--background);
    color: var(--text-main);
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
}

button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--background);
    color: var(--text-main);
    cursor: pointer;
}

button:hover {
    background: var(--background-alt);
}

/* Checkbox styling */
input[type="checkbox"] {
    cursor: pointer;
}

/* ===== Mad Libs Form Styling ===== */
.madlib-form {
    font-size: 1.15rem;
    line-height: 2.2;
}

.madlib-sentence {
    margin: 1rem 0;
}

/* Inline Web Awesome components */
.madlib-form wa-input,
.madlib-form wa-select {
    vertical-align: middle;
}

.madlib-form wa-radio-group {
    --wa-spacing-medium: 0.75rem;
}

.madlib-form wa-radio {
    padding: 0.5rem;
    line-height: 1.8;
}

/* ===== Table Styling ===== */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

th, td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    background: var(--background-alt);
}

/* ===== Details/Summary ===== */
details {
    margin: 1rem 0;
}

summary {
    cursor: pointer;
    font-weight: 600;
}

/* ===== wa-page Layout Customization ===== */
wa-page {
    --wa-page-navigation-width: 420px;
}

wa-page::part(navigation) {
    background: var(--wa-color-surface-alt);
}

/* ===== Mobile Inline Form ===== */
.mobile-inline-form {
    display: none; /* Hidden on desktop */
    background: var(--wa-color-surface-alt);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.mobile-benefit-message {
    display: none; /* Hidden on desktop */
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    .mobile-inline-form {
        display: block;
    }

    .mobile-benefit-message {
        display: flex;
    }
}

.inline-form-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.scenario-pills {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.scenario-pill {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--wa-color-surface-default);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.scenario-pill:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.scenario-pill.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--wa-color-success-on-loud);
}

.mobile-cheaper-options {
    margin-bottom: 0.75rem;
}

.more-options-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--link);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.more-options-btn:hover {
    border-color: var(--link);
    background: rgba(0, 118, 209, 0.05);
}

/* ===== Input Styling Improvements ===== */
/* Improve contrast on left column inputs */
input[type="number"],
select,
.input-prefix,
.input-suffix {
    background: var(--wa-color-surface-default);
}

/* ===== Slider Styling ===== */
#delaySlider,
#timeHorizonSlider {
    width: 100%;
    margin: 10px 0;
    padding: 6px 0 0;
    height: 10px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: var(--wa-color-neutral-fill-normal);
    border-radius: 100px;
    border: none;
    outline: none;
}

#delaySlider::-webkit-slider-track,
#timeHorizonSlider::-webkit-slider-track {
    background: var(--wa-color-neutral-fill-normal);
    height: 10px;
    border-radius: 5px;
}

#delaySlider::-webkit-slider-thumb,
#timeHorizonSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    margin-top: -6px;
}

#delaySlider::-moz-range-track,
#timeHorizonSlider::-moz-range-track {
    background: var(--wa-color-neutral-fill-normal);
    height: 10px;
    border-radius: 5px;
}

#delaySlider::-moz-range-thumb,
#timeHorizonSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
}

#sliderLabels {
    display: flex;
    justify-content: space-between;
    font-size: var(--wa-font-size-xs);
    color: var(--text-muted);
    margin-bottom: 15px;
}

/* ===== Section Borders ===== */
#delayBenefitMessage {
    border: 1px solid var(--accent-color);
    box-shadow: 0 1px 3px rgba(40, 167, 69, 0.1);
    background: var(--accent-bg);
    padding: 1rem;
    border-radius: 4px;
    margin: 2rem 0;
}

#presetsSection {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0;
    margin-top: 0.5rem;
}

#presetsSection summary {
    padding: 1rem;
    line-height: 1;
    margin: 0;
    box-sizing: border-box;
}

#presetsSection > div {
    padding: 0 1rem 1rem 1rem;
}

#advancedOptions {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0;
}

#advancedOptions summary {
    padding: 1rem;
    line-height: 1;
    margin: 0;
    box-sizing: border-box;
}

#advancedOptions > div {
    padding: 0 1rem 1rem 1rem;
}

/* ===== Fine Print Link (clickable settings shortcut) ===== */
.fine-print-link {
    font-size: 0.65rem;
    color: var(--wa-color-text-quiet);
    margin-top: 0.25rem;
    cursor: pointer;
    text-decoration: underline dotted transparent;
    transition: all 0.2s ease;
}

.fine-print-link:hover {
    color: var(--wa-color-neutral-on-normal);
    text-decoration: underline dotted var(--wa-color-neutral-on-normal);
}

/* ===== Table Row Highlights ===== */
.breakeven-row {
    background-color: var(--accent-bg);
    color: var(--accent-color);
    font-weight: bold;
}

/* ===== Form Layout ===== */
fieldset {
    border: none;
    padding: 0;
    margin: 0 0 2rem 0;
}

form label {
    display: inline-block;
    margin-right: 0.5rem;
}

.input-prefix,
.input-suffix {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--background);
    overflow: hidden;
    height: 2.5rem;
}

.input-prefix .prefix,
.input-suffix .suffix {
    padding: 0.5rem;
    background: var(--background-alt);
    border-right: 1px solid var(--border);
    font-weight: normal;
    height: 100%;
    display: flex;
    align-items: center;
}

.input-suffix .suffix {
    border-right: none;
    border-left: 1px solid var(--border);
}

.input-prefix input {
    border: none;
    outline: none;
    padding: 0 0 0 0.5rem;
    width: 100px;
    background: transparent;
    margin: 0;
    color: var(--text-main);
    height: 100%;
}

.input-suffix input {
    border: none;
    outline: none;
    padding: 0 0.5rem;
    width: auto;
    background: transparent;
    box-sizing: content-box;
    text-align: right;
    margin: 0;
    color: var(--text-main);
    height: 100%;
}

.input-prefix input:focus,
.input-suffix input:focus {
    outline: none;
}

.input-prefix:focus-within,
.input-suffix:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.1);
}

/* ===== Delay Benefit Display ===== */
#delayBenefit {
    display: block;
    margin-top: 0.5rem;
    font-weight: normal;
}

/* ===== Preset Buttons ===== */
.preset-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.preset-btn {
    padding: 0.4rem 0.75rem;
    background: var(--background-alt);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: var(--accent-bg);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.preset-btn:active {
    transform: scale(0.95);
}

/* ===== Share Button (in header, styled by wa-button) ===== */

/* ===== Chart Container ===== */
#compoundChart {
    width: 100%;
    max-width: 800px;
    height: auto;
    aspect-ratio: 3 / 2;
}

/* ===== Mobile Responsive Styles ===== */
@media (max-width: 900px) {
    #compoundChart {
        width: 100%;
        max-width: 100%;
        aspect-ratio: 1 / 1;
    }
}

/* Mobile: wa-page handles drawer automatically at mobile-breakpoint */

/* ===== Onboarding Wizard ===== */
.onboarding-wizard {
    position: fixed;
    inset: 0;
    background: var(--wa-color-surface-default);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.onboarding-wizard.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.onboarding-wizard wa-progress-bar {
    --indicator-color: var(--wa-color-brand-fill-loud, var(--accent-color));
    --track-color: var(--wa-color-neutral-200, #e0e0e0);
    --track-height: 4px;
    flex-shrink: 0;
}

.wizard-steps-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.wizard-step {
    position: absolute;
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    box-sizing: border-box;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}

.wizard-step.active {
    position: relative;
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.wizard-step.exiting-left {
    transform: translateX(-100%);
    opacity: 0;
}

.wizard-step.entering-right {
    transform: translateX(100%);
    opacity: 0;
}

.wizard-back-row {
    margin-bottom: 1rem;
}

.wizard-content {
    display: flex;
    flex-direction: column;
}

.step-label {
    font-size: 0.75rem;
    color: var(--wa-color-neutral-500, #888);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.wizard-question {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--wa-color-neutral-900, #111);
    margin: 0 0 0.5rem 0;
}

.wizard-helper {
    font-size: 0.875rem;
    color: var(--wa-color-neutral-600, #666);
    margin: 0 0 1.5rem 0;
}

.wizard-input-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: baseline;
}

.wizard-price-input {
    width: 140px;
    --wa-input-font-size-medium: 1.125rem;
}

.wizard-frequency-select {
    min-width: 130px;
}

.wizard-frequency-suffix {
    color: var(--wa-color-neutral-500, #888);
    font-size: 0.875rem;
}

.wizard-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.wizard-hint {
    font-size: 0.75rem;
    color: var(--wa-color-neutral-500, #888);
}

/* Hide "or press Enter" on touch devices / mobile */
@media (max-width: 900px) {
    .wizard-hint {
        display: none;
    }
}

/* Skip button styled as text link */
.wizard-skip-btn {
    text-decoration: underline;
    color: var(--wa-color-neutral-500, #888);
}
.wizard-skip-btn:hover {
    color: var(--wa-color-neutral-700, #444);
}

/* Horizon buttons */
.wizard-horizon-buttons {
    margin-bottom: 1.5rem;
}

.wizard-custom-years {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.wizard-years-label {
    color: var(--wa-color-neutral-600, #666);
}

/* Results comparison table */
.wizard-results-content {
    max-width: 550px;
}

.wizard-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.wizard-comparison-table th {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 2px solid var(--wa-color-neutral-200, #e0e0e0);
    color: var(--wa-color-neutral-600, #666);
    font-weight: 500;
}

.wizard-comparison-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--wa-color-neutral-100, #f0f0f0);
    vertical-align: middle;
}

.wizard-comparison-table tr.best-option {
    background: var(--wa-color-success-fill-quietest, #f0fff4);
}

.wizard-comparison-table .scenario-name {
    font-weight: 600;
}

.wizard-comparison-table .scenario-desc {
    font-size: 0.75rem;
    color: var(--wa-color-neutral-500, #888);
    margin-top: 0.25rem;
}

.wizard-comparison-table .amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--wa-color-success-fill-loud, var(--accent-color));
}

.wizard-results-actions {
    gap: 0.75rem;
}

/* ===== Wizard Results Layout ===== */
.wizard-results-content {
    display: flex;
    flex-direction: column;
    gap: var(--wa-space-l);
}

.wizard-results-hero {
    text-align: center;
    padding: var(--wa-space-m) 0;
}

.wizard-results-question {
    font-size: 1.1rem;
    color: var(--wa-color-neutral-800, #333);
    margin-bottom: var(--wa-space-xs);
}

.wizard-results-amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--wa-color-success-fill-loud, var(--accent-color));
}

.wizard-results-context {
    font-size: 0.9rem;
    color: var(--wa-color-neutral-600, #666);
    margin-top: var(--wa-space-xs);
}

.wizard-results-alternatives {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.wizard-results-divider {
    display: flex;
    align-items: center;
    gap: var(--wa-space-m);
    margin: var(--wa-space-l) 0;
    color: var(--wa-color-neutral-400, #999);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.wizard-results-divider::before,
.wizard-results-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--wa-color-neutral-200, #e0e0e0);
}

.wizard-alt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--wa-space-s) 0;
    border-bottom: 1px solid var(--wa-color-neutral-100, #f0f0f0);
}

.wizard-alt-row:last-child {
    border-bottom: none;
}

.wizard-alt-name {
    font-size: 0.9rem;
    color: var(--wa-color-neutral-700, #444);
}

.wizard-alt-value {
    font-weight: 600;
    color: var(--wa-color-neutral-600, #666);
}

/* Hide main app when wizard is showing */
.app-hidden {
    display: none !important;
}

/* ===== Reduced Motion Support ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 600px) {
    #delaySlider,
    #timeHorizonSlider {
        height: 40px;
    }

    h1 {
        font-size: 1.5rem;
    }

    form label {
        display: block;
        margin-bottom: 0.25rem;
    }

    .input-prefix,
    .input-suffix {
        width: 100%;
    }

    details summary {
        font-size: 0.95rem;
    }

    #multiPurchaseResult,
    #delayBenefitMessage {
        font-size: 0.9rem;
        padding: 0.75rem;
    }

    table {
        font-size: 0.85rem;
    }

    table th,
    table td {
        padding: 0.5rem 0.25rem;
    }
}

/* =========================================
   DELAY AND SAVE - SPLIT SCREEN LAYOUT
   ========================================= */

.delay-save-app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--wa-color-surface-alt);
}

/* ===== Split Screen Layout ===== */
.split-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Colored Header */
.split-header {
    background: linear-gradient(135deg, var(--wa-color-success-fill-loud), var(--wa-color-green-40));
    color: var(--wa-color-success-on-loud);
    padding: 60px 20px 40px;
    text-align: center;
    flex-shrink: 0;
}

.split-header-content {
    max-width: 400px;
    margin: 0 auto;
}

.split-label {
    font-size: 13px;
    opacity: 0.9;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.split-result {
    font-size: 56px;
    font-weight: 700;
    letter-spacing: -2px;
    line-height: 1;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}

.split-context {
    font-size: 15px;
    opacity: 0.9;
}

/* Scrollable Main Area */
.split-main {
    flex: 1;
    background: var(--wa-color-surface-default);
    border-radius: 24px 24px 0 0;
    margin-top: -24px;
    position: relative;
    z-index: 1;
    overflow-y: auto;
}

.split-controls {
    max-width: 500px;
    margin: 0 auto;
    padding: 24px 16px 32px;
}

/* Control Cards */
.control-card {
    margin-bottom: 16px;
}

.input-row {
    display: flex;
    gap: 12px;
}

.input-row wa-input {
    flex: 1;
}

.input-row wa-select {
    min-width: 120px;
}

/* Control Sections */
.control-section {
    margin-bottom: 16px;
}

.section-label {
    font-size: var(--wa-font-size-xs);
    color: var(--wa-color-neutral-500, #888);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-left: 4px;
}

/* Pill Row */
.pill-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.delay-btn {
    flex: 1;
    min-width: 0;
}

/* Slider Section */
.slider-section {
    padding: 4px 0;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.slider-label-text {
    font-size: var(--wa-font-size-s);
    color: var(--wa-color-neutral-600, #666);
}

.slider-value-display {
    font-size: var(--wa-font-size-s);
    font-weight: 600;
    color: var(--wa-color-neutral-800, #333);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--wa-color-neutral-500, #888);
    margin-top: 8px;
}

/* Plan Card */
.plan-card {
    background: var(--wa-color-success-fill-quietest, #e8f5e9);
    border: 1px solid var(--wa-color-success-fill-quiet, #a5d6a7);
    margin-bottom: 20px;
}

.plan-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: var(--wa-font-size-s);
    color: var(--wa-color-success-fill-loud, var(--accent-color));
    margin-bottom: 12px;
}

.plan-steps {
    font-size: var(--wa-font-size-s);
    color: var(--wa-color-neutral-700, #444);
    line-height: 1.7;
}

.plan-step {
    padding: 2px 0;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

/* Footer */
.split-footer {
    text-align: center;
    padding-top: 8px;
}

.disclaimer {
    font-size: var(--wa-font-size-xs);
    color: var(--wa-color-neutral-500, #888);
}

/* ===== Mobile Responsive ===== */
@media (max-width: 600px) {
    .split-header {
        padding: 50px 16px 36px;
    }

    .split-result {
        font-size: 48px;
    }

    .split-main {
        border-radius: 20px 20px 0 0;
        margin-top: -20px;
    }

    .split-controls {
        padding: 20px 16px 24px;
    }

    .pill-row {
        gap: 6px;
    }

    .delay-btn {
        font-size: 13px;
    }
}

/* Safe area for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
    .split-header {
        padding-top: calc(60px + env(safe-area-inset-top));
    }
}

/* =========================================
   FULLSCREEN CARD - APPLE WALLET STYLE
   ========================================= */

/* Fullscreen card container */
.fullscreen-card {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    /* Fill entire background with header color for seamless 3D flip */
    background: var(--wa-color-fill-quiet);
}

/* Ensure header color extends behind the flip card during animation */
.fullscreen-card::before {
    content: '';
    position: fixed;
    inset: 0;
    /* Use same token as header - wa-dark wa-success context makes this dark green */
    background: var(--wa-color-fill-quiet);
    z-index: 0;
    pointer-events: none;
}

/* Solid color header with celebration animation on breakeven */
/* Uses wa-dark wa-success classes for dark green background via fill tokens */
/* Full viewport height so green shows during card flip animation */
.fullscreen-header {
    --rainbow-opacity: 0;
    background: var(--wa-color-fill-quiet);
    padding: 48px 24px 40px;
    color: var(--wa-color-neutral-95);
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    z-index: 1;
}

/* Rainbow mesh overlay - fades in at breakeven celebration */
.fullscreen-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--wa-color-success-fill-loud, var(--wa-color-green-50));
    opacity: var(--rainbow-opacity);
    transition: opacity 1s ease;
    pointer-events: none;
}

/* Rainbow animation when celebrating */
.fullscreen-header.breakeven-celebration::after {
    animation: meshRainbow 12s ease-in-out infinite;
}

@keyframes meshRainbow {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(45deg); }
}

/* Ensure content stays above the overlays */
.fullscreen-header > * {
    position: relative;
    z-index: 1;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .fullscreen-header::after {
        transition: opacity 0.5s ease;
    }

    .fullscreen-header.breakeven-celebration::after {
        animation: none;
    }
}

@supports (padding-top: env(safe-area-inset-top)) {
    .fullscreen-header {
        padding-top: calc(48px + env(safe-area-inset-top));
    }
}

.fullscreen-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.fullscreen-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--wa-color-neutral-95);
    text-decoration: none;
}

.fullscreen-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--wa-color-neutral-fill-quiet);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wa-color-neutral-95);
}

.fullscreen-logo-icon i {
    font-size: 18px;
}

.fullscreen-logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--wa-color-neutral-95);
}

.fullscreen-balance {
    text-align: center;
    padding-top: 8px;
}

.fullscreen-balance-label {
    font-size: var(--wa-font-size-xs);
    opacity: 0.9;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.fullscreen-balance-amount {
    font-size: 52px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -2px;
    margin-bottom: 4px;
}

.fullscreen-balance-context {
    font-size: 15px;
    opacity: 0.9;
}

/* Mini sparkline under balance amount */
.sparkline-container {
    margin-top: 16px;
    opacity: 0.7;
    transition: opacity 0.3s;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
    padding: 0 24px;
    box-sizing: border-box;
}

.sparkline-container:hover {
    opacity: 0.9;
}

#sparklineSvg {
    width: 100%;
    height: 60px;
}

#sparklineMilestoneLabel {
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Body section - flip card container */
/* Positioned below header content (header is fixed full-height for flip effect) */
.fullscreen-body {
    flex: 1;
    margin-top: 320px; /* Space for header content including sparkline */
    position: relative;
    z-index: 2;
    perspective: 1000px;
}

/* Flip card wrapper */
.body-flip-card {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.body-flip-card.flipped {
    transform: rotateY(180deg);
}

/* Front and back faces */
.body-flip-front,
.body-flip-back {
    backface-visibility: hidden;
    background: var(--wa-color-surface-default);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    min-height: 100%;
}

.body-flip-front {
    position: relative;
}

.body-flip-back {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    transform: rotateY(180deg);
    background: linear-gradient(180deg, var(--wa-color-neutral-fill-quiet, #f8f8f8) 0%, var(--wa-color-surface-default) 100%);
    padding: 24px;
}

/* Settings back panel header */
.settings-back-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.settings-back-title {
    font-size: var(--wa-font-size-l);
    font-weight: 600;
    color: var(--text);
}

/* Settings fields on back */
.settings-back-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.settings-back-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-back-field label {
    font-size: var(--wa-font-size-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Settings back footer with buttons */
.settings-back-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.fullscreen-body-content {
    flex: 0 0 auto;
    padding: 28px 24px 16px;
}

/* Settings badge */
.settings-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: var(--wa-font-size-s);
    font-family: inherit;
    cursor: pointer;
    margin-bottom: 20px;
    transition: background 0.2s, border-color 0.2s;
}

.settings-badge:hover {
    background: var(--background-alt);
    border-color: var(--text-muted);
}

.settings-badge wa-icon {
    font-size: var(--wa-font-size-s);
}

#settingsChevron {
    transition: transform 0.2s;
}

.settings-badge.expanded #settingsChevron {
    transform: rotate(180deg);
}

/* Expanded settings */
.settings-expanded {
    background: var(--background-alt);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.settings-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.settings-field {
    flex: 0 0 auto;
}

.settings-field-label {
    display: block;
    font-size: var(--wa-font-size-xs);
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Narrow settings inputs for small numbers (supports 2 decimal places like 12.50) */
.settings-input {
    width: 100px;
}

.settings-input::part(input) {
    text-align: center;
}

/* Section styling */
.fullscreen-section {
    margin-bottom: 24px;
}

.fullscreen-section-title {
    color: var(--text-muted);
    font-size: var(--wa-font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* Input row */
.fullscreen-input-row {
    display: flex;
    gap: 12px;
}

.fullscreen-input-row wa-input {
    flex: 1;
}

.fullscreen-input-row wa-input.price-input {
    flex: 0 0 auto;
    width: 110px;
}

.fullscreen-input-row wa-select {
    flex: 1;
    min-width: 120px;
}

/* Input styling - uses default Web Awesome light theme */

/* Segmented Control (iOS-style) */
.segmented-control {
    display: flex;
    gap: 0;
    background: var(--wa-color-neutral-fill-quiet, #e9ecef);
    border-radius: var(--wa-border-radius-m, 8px);
    padding: 3px;
    overflow: visible;
}

.segmented-control .segment,
.segmented-control .segment-input {
    flex: 1;
}

.segment {
    padding: 8px 12px;
    font-size: var(--wa-font-size-s, 13px);
    font-weight: 500;
    font-family: inherit;
    background: transparent;
    color: var(--wa-color-neutral-text, #666);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    border-radius: var(--wa-border-radius-s, 6px);
    white-space: nowrap;
}

.segment:hover:not(.active) {
    color: var(--wa-color-neutral-text-loud, #333);
}

.segment.active {
    background: var(--wa-color-surface, white);
    color: var(--wa-color-neutral-text-loud, #333);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Inline custom input within segmented control - looks like a button until focused */
.segmented-control .segment-input {
    padding: 8px 12px;
    border: none !important;
    background: transparent !important;
    font-size: var(--wa-font-size-s, 13px);
    font-weight: 500;
    font-family: inherit;
    text-align: center;
    color: var(--wa-color-neutral-text, #666);
    border-radius: var(--wa-border-radius-s, 6px);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.segment-input::placeholder {
    color: var(--wa-color-neutral-text, #666);
    font-weight: 500;
}

.segment-input:hover:not(:focus) {
    color: var(--wa-color-neutral-text-loud, #333);
}

.segmented-control .segment-input:focus,
.segmented-control .segment-input.active {
    outline: none;
    background: var(--wa-color-surface, white) !important;
    color: var(--wa-color-neutral-text-loud, #333);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    cursor: text;
}

/* When input has a value, keep it looking active */
.segmented-control .segment-input:not(:placeholder-shown) {
    background: var(--wa-color-surface, white) !important;
    color: var(--wa-color-neutral-text-loud, #333);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* wa-input within segmented control */
.segmented-control wa-input.segment-input {
    flex: 1;
    min-width: 0;
    --wa-input-border-width: 0;
    --wa-input-border-color: transparent;
    --wa-input-border-color-hover: transparent;
    --wa-input-border-color-focus: transparent;
    --wa-input-background-color: transparent;
    --wa-input-background-color-hover: transparent;
    --wa-input-background-color-focus: transparent;
    --wa-input-font-size-small: var(--wa-font-size-s, 13px);
    --wa-input-height-small: 34px;
    --wa-input-spacing-small: 0 8px;
    --wa-focus-ring-width: 0;
    --wa-focus-ring-color: transparent;
}

.segmented-control wa-input.segment-input::part(base) {
    border-radius: var(--wa-border-radius-s, 6px);
    min-height: 34px;
    height: 34px;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
}

.segmented-control wa-input.segment-input::part(input) {
    text-align: right;
    font-weight: 500;
    color: var(--wa-color-neutral-text, #666);
    padding: 0 2px 0 8px;
    min-width: 24px;
}

.segmented-control wa-input.segment-input::part(suffix) {
    color: var(--wa-color-neutral-text, #666);
    font-weight: 500;
    font-size: var(--wa-font-size-s, 13px);
    padding-right: 8px;
    padding-left: 0;
}

.segmented-control wa-input.segment-input:focus-within::part(base) {
    background: var(--wa-color-surface, white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.segmented-control wa-input.segment-input:focus-within::part(input),
.segmented-control wa-input.segment-input:focus-within::part(suffix) {
    color: var(--wa-color-neutral-text-loud, #333);
}

/* wa-input with value - keep active style */
.segmented-control wa-input.segment-input.has-value::part(base) {
    background: var(--wa-color-surface, white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.segmented-control wa-input.segment-input.has-value::part(input),
.segmented-control wa-input.segment-input.has-value::part(suffix) {
    color: var(--wa-color-neutral-text-loud, #333);
}

/* Hide number input spinners */
.segment-input::-webkit-outer-spin-button,
.segment-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.segment-input[type=number] {
    -moz-appearance: textfield;
}

/* Two-row segmented control */
.segmented-control.two-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.segment-row {
    display: flex;
    gap: 0;
}

.segment-row .segment,
.segment-row .segment-input {
    flex: 1;
    text-align: center;
}

/* Slider row */
.slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-row wa-slider {
    flex: 1;
}

.slider-row .slider-value {
    min-width: 36px;
    text-align: right;
    font-size: var(--wa-font-size-s);
    font-weight: 600;
    color: var(--text-main);
}

/* Timeline */
.timeline-container {
    padding-left: 4px;
    list-style: none;
    margin: 0;
}

.timeline-item {
    display: flex;
    gap: 12px;
    position: relative;
    padding-bottom: 20px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    margin-top: 4px;
    z-index: 1;
}

.timeline-dot.active {
    background: var(--wa-color-success-fill-loud);
}

.timeline-dot.final {
    background: var(--wa-color-success-fill-loud);
}

.timeline-line {
    position: absolute;
    left: 5px;
    top: 16px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item:last-child .timeline-line {
    display: none;
}

.timeline-content {
    flex: 1;
    padding-top: 0;
}

.timeline-label {
    color: var(--text-muted);
    font-size: var(--wa-font-size-xs);
    margin-bottom: 2px;
}

.timeline-action {
    color: var(--text-main);
    font-size: 15px;
}

.timeline-action.highlight {
    color: var(--wa-color-success-fill-loud);
    font-weight: 600;
}

.timeline-action-sub {
    font-size: 13px;
    color: var(--wa-color-success-on-quiet, var(--accent-color));
    margin-top: 2px;
}

.timeline-action-sub.fee {
    color: var(--wa-color-warning-on-quiet, var(--accent-color));
}

/* Fee warning */
/* Fee warning uses wa-callout variant="warning" */
#feeWarning {
    margin-top: 8px;
}

#feeWarning[hidden] {
    display: none;
}

/* Inline action buttons */
.action-buttons-inline {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 24px;
    padding-bottom: 24px;
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .action-buttons-inline {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* ===== Mobile Responsive for Fullscreen Card ===== */
@media (max-width: 600px) {
    .fullscreen-header {
        padding: 40px 20px 36px;
    }

    .fullscreen-balance-amount {
        font-size: 44px;
    }

    .fullscreen-body {
        margin-top: 300px; /* Space for header content including sparkline */
    }

    .fullscreen-body-content {
        padding: 20px 16px 16px;
    }

    .fullscreen-chips .delay-btn {
        padding: 0.5rem 0.25rem;
        font-size: 13px;
    }

    .bottom-action-bar {
        padding: 16px 16px 20px;
    }
}

/* ===== Desktop Side-by-Side Layout (Option A) ===== */
@media (min-width: 900px) {
    .fullscreen-card {
        flex-direction: row;
        min-height: 100vh;
    }

    /* Header becomes left column - reset mobile fixed positioning */
    .fullscreen-header {
        position: relative;
        height: auto;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-end;
        padding: 48px 40px;
        border-radius: 0;
    }

    .fullscreen-header-content {
        max-width: 450px;
        width: 100%;
    }

    .fullscreen-nav {
        margin-bottom: 48px;
    }

    .fullscreen-logo {
        justify-content: flex-start;
    }

    .fullscreen-balance {
        text-align: left;
    }

    .fullscreen-balance-amount {
        font-size: 64px;
    }

    .fullscreen-balance {
        position: static;
    }

    .sparkline-container {
        position: absolute;
        bottom: 48px;
        left: 40px;
        right: 40px;
        width: auto;
        margin: 0;
        transform: none;
        padding: 0;
    }

    /* Body becomes right column */
    .fullscreen-body {
        flex: 1.5;
        border-radius: 0;
        margin-top: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        padding: 40px;
    }

    .fullscreen-body-content {
        flex: 0 0 auto;
        max-width: 480px;
        width: 100%;
        padding: 0;
    }

    .action-buttons-inline {
        margin-top: 32px;
        padding-bottom: 0;
    }
}
