:root {
    --bg: #000000;
    --bg-secondary: #0d0d0d;
    --bg-tertiary: #080808;
    --card: #050505; /* deeper matte base */
    --card-hover: #0a0a0a; /* subtle glossy lift */
    --card-active: #0d0d0d;
    --text: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.75);
    --text-tertiary: rgba(255, 255, 255, 0.55);
    --text-muted: rgba(255, 255, 255, 0.35);
    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(255, 255, 255, 0.2);
    --accent: #ffffff;
    --accent-hover: rgba(255, 255, 255, 0.85);
    --danger: #ff6b6b;
    --shadow-sm: rgba(0, 0, 0, 0.95);
    --shadow-md: rgba(0, 0, 0, 0.85);
    --shadow-lg: rgba(0, 0, 0, 0.75);
    --gloss-sheen: rgba(255, 255, 255, 0.12);
    --gloss-sheen-hover: rgba(255, 255, 255, 0.2);
    --matte-overlay: rgba(255, 255, 255, 0.015);
}

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

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

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

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

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

@keyframes shimmer {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

@keyframes expandLine {
    to { transform: scaleX(1); }
}

/* Scroll animations disabled for maximum scroll performance */
.scroll-fade-in,
.scroll-scale-in {
    opacity: 1 !important;
    transition: none !important;
}

.scroll-fade-in.visible,
.scroll-scale-in.visible {
    opacity: 1 !important;
}

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

/* Single scroll root only — dual html+body scrolling causes sticky/janky scroll */
html {
    /* clip (not hidden) avoids forcing overflow-y:auto via the CSS overflow pairing rule */
    overflow-x: clip;
    overflow-y: scroll;
    /* instant wheel/trackpad response; smooth scroll is JS-only for nav clicks */
    scroll-behavior: auto;
    scroll-snap-type: none;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    height: auto;
    max-width: 100%;
    background: #000000;
    /* Stop rubber-band overscroll from revealing the fixed hero */
    overscroll-behavior-y: none;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.015em;
    /*
     * Body must NOT be a scroll container.
     * Do not use overflow-x: hidden here — with overflow-y: visible, CSS
     * computes overflow-y to auto and creates a second sticky scroller.
     * Horizontal clipping is handled on html instead.
     */
    overflow: visible;
    width: 100%;
    max-width: 100%;
    position: relative;
    height: auto;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    scroll-snap-type: none;
    scroll-behavior: auto;
}

/* Prevent layout shifts during scroll */
canvas {
    display: block;
    max-width: 100%;
}

/* Fixed hero section - stays in place while content scrolls over */
.hero {
    position: fixed;
    inset: 0;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    max-width: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none; /* Allow content to scroll through */
    /* No opacity transition — hard cut when past hero (perf + no phase-out) */
    transition: none;
}

/* Fully hide hero once the dashboard covers it — prevents bleed at page bottom */
.hero.hero-offscreen {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Hero copy stays fully opaque while on-screen — never scroll-fades */
.hero .header-banner-title,
.hero .header-banner-title-text,
.hero .header-banner-subtitle,
.hero .beta-tag,
.hero .hero-cta-row,
.hero .hero-scroll-hint,
.hero .hero-as-seen {
    opacity: 1 !important;
    animation: none !important;
}

/* Make interactive elements in hero clickable while allowing scroll through background */
.hero .header {
    pointer-events: auto;
}

/* Interactive hero controls only — not the full header */
.hero .floating-nav,
.hero .header-banner-title,
.hero .hero-cta-row,
.hero .hero-as-seen {
    pointer-events: auto;
}

.hero .header {
    pointer-events: none;
}

/* Three.js tesseract stage */
.hero-tesseract-wrap {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: #000;
    overflow: hidden;
}

.hero-tesseract-canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
}

/* Content scrolls over the hero — full-bleed black so hero never peeks through */
.content {
    position: relative;
    z-index: 1;
    margin-top: 100vh;
    margin-top: 100dvh;
    background: #000000;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    scroll-snap-type: none;
}

/* Hero fade effect at bottom for smooth overlap */
.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(to bottom, transparent, var(--bg));
    pointer-events: none;
    z-index: 10;
}

/* ── Precision layout system ───────────────────────────── */
:root {
    /* Wide body, tight side margins */
    --dash-max: 1440px;
    --dash-gutter: clamp(12px, 1.5vw, 24px);
    --dash-gap: clamp(16px, 2vw, 24px);
    --dash-radius: 0;
    --micro-line: rgba(255, 255, 255, 0.12);
    --micro-line-strong: rgba(255, 255, 255, 0.28);
}

@media (min-width: 1280px) {
    :root {
        --dash-max: 1360px;
        --dash-gutter: 20px;
    }
}

@media (min-width: 1440px) {
    :root {
        --dash-max: 1480px;
        --dash-gutter: 24px;
    }
}

@media (min-width: 1680px) {
    :root {
        --dash-max: 1600px;
        --dash-gutter: 28px;
    }
}

@media (min-width: 1920px) {
    :root {
        --dash-max: 1760px;
        --dash-gutter: 32px;
    }
}

/* Responsive hero */
@media (max-width: 768px) {
    .hero {
        height: 100vh;
        height: 100dvh;
    }

    .content {
        margin-top: 100vh;
        margin-top: 100dvh;
    }
    
    .header-banner-title {
        padding: 0 16px;
        max-width: min(100%, 100vw);
        width: 96vw;
        gap: 22px;
    }

    .header-banner-title-text {
        font-size: clamp(2.75rem, 14vw, 4.25rem);
        letter-spacing: 0.1em;
    }

    .hero-cta-primary,
    .hero-cta-secondary {
        padding: 12px 18px;
        font-size: 0.7rem;
    }

    .hero-scroll-hint {
        bottom: 20px;
    }
}

/* Grid background system */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: none;
    pointer-events: none;
    z-index: 0;
}

.app-container {
    position: relative;
    z-index: 1;
    max-width: var(--dash-max);
    margin: 0 auto;
    padding: clamp(28px, 4vw, 48px) var(--dash-gutter);
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
    box-sizing: border-box;
    overflow-x: clip;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--dash-gap);
    min-width: 0;
}

/* Ensure content has solid background to cover hero */
.content {
    background: var(--bg);
}

.content .app-container,
.content .instructions-panel,
.content .affordability-banner,
.content .mini-dashboard,
.content .panel {
    background: var(--bg);
    position: relative;
    /* Clip horizontal bleed from decorative layers; keep vertical open for tooltips */
    overflow-x: clip;
    overflow-y: visible;
    max-width: 100%;
    min-width: 0;
}

.content .footer {
    background: var(--bg);
    position: relative;
}

.header {
    margin: 0;
    animation: slideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    padding: 0;
    background: var(--bg);
    border-radius: 0;
    border: none;
    overflow: hidden;
    box-shadow: none;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.header-banner-media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 0;
    z-index: 0;
    background: #000;
}

/* Legacy image styles retained for fallback assets if needed */
.header-banner-image {
    display: none;
}

.header-banner-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    text-align: center;
    pointer-events: auto;
    width: min(96vw, 920px);
    max-width: 920px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    mix-blend-mode: normal !important;
    isolation: isolate;
    padding: 0;
    box-sizing: border-box;
}

@keyframes titleFloat {
    0%, 100% {
        transform: translate(-50%, -50%);
    }
    50% {
        transform: translate(-50%, -52%);
    }
}

@keyframes subtleWobble {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(-2px, 1px) scale(1.002);
    }
    50% {
        transform: translate(1px, -1px) scale(1);
    }
    75% {
        transform: translate(-1px, -2px) scale(1.001);
    }
}

.header-banner-title-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(12px, 1.8vw, 20px);
    width: 100%;
    position: relative;
    margin: 0;
}

.header-banner-title-text {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(3.75rem, 14vw, 11rem) !important;
    font-weight: 800 !important;
    letter-spacing: 0.12em !important;
    color: #fff !important;
    text-transform: uppercase;
    margin: 0;
    line-height: 0.88;
    text-shadow:
        0 0 1px rgba(255, 255, 255, 1),
        0 0 48px rgba(255, 255, 255, 0.32),
        0 4px 36px rgba(0, 0, 0, 0.85);
    opacity: 1 !important;
    text-align: center;
    -webkit-text-fill-color: #ffffff !important;
    background: none !important;
    mix-blend-mode: normal !important;
    z-index: 200;
    position: relative;
    width: 100%;
}

.header-banner-subtitle {
    margin: 0;
    padding: 0 !important; /* kill legacy .header p padding that reserved space for the accent line */
    /* Match page chrome (nav, CTAs, labels) under the Orbitron wordmark */
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: clamp(0.75rem, 1.15vw, 0.9375rem);
    font-weight: 400;
    font-style: normal;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.58);
    text-align: center;
    line-height: 1.5;
    opacity: 1;
    text-shadow: 0 1px 16px rgba(0, 0, 0, 0.55);
    max-width: 48ch;
    position: relative;
    width: auto;
}

/* No accent bar on the hero tagline (legacy .header p::before) */
.header-banner-subtitle::before {
    content: none !important;
    display: none !important;
}

/* Extra-large wordmark on desktop / PC */
@media (min-width: 1024px) {
    .header-banner-title {
        width: min(98vw, 1200px);
        max-width: 1200px;
        gap: 32px;
    }

    .header-banner-title-text {
        font-size: clamp(7rem, 11.5vw, 13rem) !important;
        letter-spacing: 0.14em !important;
        line-height: 0.86;
    }
}

@media (min-width: 1440px) {
    .header-banner-title-text {
        font-size: clamp(9rem, 12vw, 14rem) !important;
        letter-spacing: 0.16em !important;
    }
}

.beta-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--text) !important;
    text-transform: uppercase;
    background: var(--gloss-sheen);
    border: 1px solid var(--border-light);
    padding: 8px 18px;
    border-radius: 8px;
    opacity: 1;
    mix-blend-mode: normal !important;
    white-space: nowrap;
    position: relative;
    margin-bottom: 12px;
    align-self: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

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

@keyframes fadeInCountdown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 0;
    opacity: 1;
    pointer-events: auto;
}

.hero-cta-primary,
.hero-cta-secondary {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 14px 22px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.hero-cta-primary {
    background: #fff;
    color: #000;
    border-color: #fff;
}

.hero-cta-primary:hover {
    background: transparent;
    color: #fff;
    transform: translateY(-1px);
}

.hero-cta-secondary {
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.28);
}

.hero-cta-secondary:hover {
    border-color: rgba(255, 255, 255, 0.7);
    color: #fff;
    transform: translateY(-1px);
}

.hero-scroll-hint {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 210;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    opacity: 1;
}

.hero-scroll-hint-line {
    width: 1px;
    height: 48px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), transparent);
}

/* As seen on — bottom-left of hero (scroll hint stays centered) */
.hero-as-seen {
    position: absolute;
    left: clamp(16px, 3vw, 40px);
    right: auto;
    bottom: clamp(20px, 3.5vw, 40px);
    z-index: 220;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    opacity: 1;
    pointer-events: none;
    user-select: none;
}

.hero-as-seen-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1;
    white-space: nowrap;
}

.hero-as-seen-logos {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
}

.hero-as-seen-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: rgba(255, 255, 255, 0.55);
    transition: color 0.2s ease, transform 0.2s ease;
}

.hero-as-seen-logo svg {
    display: block;
    width: 22px;
    height: 22px;
}

.hero-as-seen-logo[title="X"] svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 640px) {
    .hero-as-seen {
        left: 14px;
        right: auto;
        bottom: 16px;
        gap: 10px;
    }

    .hero-as-seen-label {
        font-size: 0.55rem;
        letter-spacing: 0.22em;
    }

    .hero-as-seen-logos {
        gap: 12px;
    }

    .hero-as-seen-logo {
        width: 30px;
        height: 30px;
    }

    .hero-as-seen-logo svg {
        width: 18px;
        height: 18px;
    }

    .hero-as-seen-logo[title="X"] svg {
        width: 15px;
        height: 15px;
    }

    /* Keep clear of center scroll hint */
    .hero-scroll-hint {
        bottom: 28px;
    }
}

/* Waitlist strip — first row of dashboard, centered */
.hero-email-bar {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    box-sizing: border-box;
}

.hero-email-bar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px 16px;
    padding: 14px 16px;
    width: 100%;
    box-sizing: border-box;
}

.hero-email-bar-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.hero-email-bar-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 280px;
    max-width: 560px;
    justify-content: center;
}

.hero-email-bar-form .email-signup-input {
    flex: 1 1 120px;
    min-width: 0;
    margin: 0;
}

.hero-email-bar-form .email-signup-button {
    flex: 0 0 auto;
    min-width: 88px;
}

.hero-email-bar .email-signup-success {
    width: 100%;
    text-align: center;
    margin: 0;
}

@media (max-width: 640px) {
    .hero-email-bar-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-email-bar-label {
        text-align: center;
    }

    .hero-email-bar-form {
        max-width: none;
        flex-direction: column;
    }

    .hero-email-bar-form .email-signup-button {
        width: 100%;
    }
}

.subtitle-accent {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    color: var(--text-tertiary) !important;
    text-transform: uppercase;
    position: relative;
    padding: 0;
}

.subtitle-divider {
    display: none;
}

@keyframes fadeInSubtitle {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-email-signup {
    margin-top: 8px;
    width: 100%;
    max-width: 520px;
    opacity: 1;
    pointer-events: auto;
    position: relative;
    padding-top: 20px;
}

.header-email-signup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

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

.email-signup-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    width: 100%;
}

.email-signup-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.7rem, 1vw, 0.8rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5) !important;
    letter-spacing: 0.04em;
    text-transform: none;
    text-align: center;
    margin-bottom: 14px;
    line-height: 1.55;
    max-width: 420px;
}

.email-signup-countdown {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeInCountdown 1.6s ease-out 1.0s forwards;
}

.email-countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.email-countdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.email-countdown-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    text-shadow: 
        0 0 10px rgba(255, 255, 255, 0.8),
        0 0 20px rgba(255, 255, 255, 0.5);
}

.email-countdown-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-top: 4px;
    line-height: 1;
}

.email-signup-input-group {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: stretch;
}

.email-signup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    align-items: stretch;
}

.email-signup-input-group:first-of-type {
    margin-bottom: 0;
}

.email-signup-input {
    width: 100%;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text);
    letter-spacing: 0.03em;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 0;
    backdrop-filter: blur(8px);
    box-shadow: 
        inset 0 1px 2px rgba(0, 0, 0, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.1);
}

.email-signup-input::placeholder {
    color: var(--text-muted);
    letter-spacing: 0.03em;
    text-align: left;
}

.email-signup-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 
        0 0 0 3px rgba(255, 255, 255, 0.08),
        inset 0 1px 2px rgba(0, 0, 0, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.email-signup-input:hover:not(:focus) {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
}

.btn,
.email-signup-button {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.08) 100%);
    background-image: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    text-transform: uppercase;
    position: relative;
    backdrop-filter: blur(12px);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 0 0 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 16px 32px;
    font-size: 0.8125rem;
    letter-spacing: 0.12em;
    white-space: nowrap;
    min-height: 52px;
}

.email-signup-button:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.12) 100%);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 24px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 0 3px rgba(255, 255, 255, 0.1);
}

.email-signup-button:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.email-signup-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.email-signup-success {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary) !important;
    letter-spacing: 0.05em;
    text-align: center;
    margin-top: 8px;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.email-signup-success.show {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll Indicator - Bottom Right Corner */
.scroll-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: 200;
    opacity: 0;
    animation: fadeInScrollIndicator 2.5s cubic-bezier(0.16, 1, 0.3, 1) 2s forwards;
    pointer-events: none;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 0;
    padding: 0;
}

/* Hide on smaller screens */
@media (max-width: 1024px) {
    .scroll-indicator {
        display: none;
    }
}

.scroll-indicator-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    margin-right: 0;
    margin-bottom: 24px;
    pointer-events: none;
    overflow: visible;
}

.scroll-indicator-tooltip {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 20px 24px;
    max-width: 300px;
    position: relative;
    box-shadow: 
        0 4px 20px var(--shadow-md),
        inset 0 0 0 1px rgba(255, 255, 255, 0.03),
        0 0 0 1px rgba(255, 255, 255, 0.02);
    pointer-events: none;
    overflow: visible;
}

.scroll-indicator-tooltip-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 10px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.scroll-indicator-inline-arrow {
    color: var(--text-secondary);
    flex-shrink: 0;
}


.scroll-indicator-tooltip-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    line-height: 1.6;
    margin-top: 12px;
}

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

/* As Seen On Section - Bottom Right */
.as-seen-on {
    position: absolute;
    bottom: 24px;
    right: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
    padding: 0;
    margin-right: 24px;
    margin-bottom: 24px;
    pointer-events: auto;
}

.as-seen-on-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    opacity: 0.9;
}

.as-seen-on-logos {
    display: flex;
    align-items: center;
    gap: 24px;
}

.as-seen-on-logo {
    color: var(--text-secondary);
    opacity: 0.75;
    transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.as-seen-on-logo:hover {
    opacity: 1;
    color: var(--text);
    transform: translateY(-3px);
}

.as-seen-on-logo svg {
    width: 28px;
    height: 28px;
}

/* Hide on smaller screens */
@media (max-width: 1024px) {
    .as-seen-on {
        display: none;
    }
}

/* Responsive adjustments for scroll indicator */
@media (max-width: 768px) {
    .scroll-indicator-content {
        margin-right: 16px;
        margin-bottom: 16px;
    }
    
    .scroll-indicator-tooltip {
        max-width: 260px;
        padding: 16px 20px;
    }
    
    .scroll-indicator-tooltip-title {
        font-size: 0.6875rem;
    }
    
    .scroll-indicator-tooltip-text {
        font-size: 0.625rem;
    }
}

@media (max-width: 480px) {
    .scroll-indicator-content {
        margin-right: 12px;
        margin-bottom: 12px;
    }
    
    .scroll-indicator-tooltip {
        max-width: 220px;
        padding: 14px 18px;
    }
    
    .scroll-indicator-tooltip-title {
        font-size: 0.625rem;
        margin-bottom: 8px;
    }
    
    .scroll-indicator-tooltip-text {
        font-size: 0.5625rem;
        margin-top: 10px;
    }
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Keep vignette light so glass IBL / speculars stay visible */
    background:
        radial-gradient(ellipse 36% 32% at 50% 48%, rgba(0, 0, 0, 0.18) 0%, transparent 70%),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, transparent 30%, transparent 70%, rgba(0, 0, 0, 0.85) 100%);
    z-index: 1;
    pointer-events: none;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    background: none;
    animation: none;
    z-index: 2;
}

.header::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.02) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.015) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.01) 0%, transparent 60%);
    pointer-events: none;
    animation: pulseGlow 10s ease-in-out infinite;
    z-index: 1;
}


.header-content {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 900px;
}

.header h1 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 4.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text);
    letter-spacing: 0.05em;
    line-height: 1;
    text-transform: uppercase;
    background: linear-gradient(180deg, 
        #ffffff 0%, 
        rgba(255, 255, 255, 0.98) 25%,
        rgba(255, 255, 255, 0.95) 50%,
        rgba(255, 255, 255, 0.92) 75%,
        rgba(255, 255, 255, 0.9) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
    filter: drop-shadow(0 0 40px rgba(255, 255, 255, 0.2)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.7)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9));
    text-shadow: 0 2px 30px rgba(0, 0, 0, 0.95), 0 1px 10px rgba(0, 0, 0, 0.8);
}

.header h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%);
    transform: scaleX(0);
    animation: expandLine 1.2s ease-out 0.8s forwards;
}

.header p {
    font-size: 1.375rem;
    color: var(--text-secondary);
    font-weight: 300;
    line-height: 1.7;
    max-width: 750px;
    margin-top: 32px;
    letter-spacing: -0.01em;
    position: relative;
    padding-left: 24px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.9), 0 1px 8px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 0, 0, 0.5);
}

.header p::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%);
}


.main-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(24px, 3vw, 40px);
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
}

.main-layout > .panel {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.panel,
.chart-container,
.instructions-panel,
.summary-card {
    border: 1px solid var(--border);
    border-radius: 0;
    position: relative;
    overflow: visible;
}

.panel,
.chart-container {
    background: var(--card);
    background-image: none;
}

.u-mb-24 { margin-bottom: 24px; }
.u-mb-40 { margin-bottom: 40px; }
.u-mt-24 { margin-top: 24px; }
.u-w-100 { width: 100%; }
.u-hidden { display: none !important; }
.u-flex-gap-12 { display: flex; align-items: center; gap: 12px; }

@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .mixing-board-container {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .chart-container {
        margin-bottom: 36px;
    }
}

.panel {
    padding: 32px;
    /* Only transition hover states, not all properties for better scroll performance */
    transition: background-color 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 
        inset 0 0 0 1px rgba(255, 255, 255, 0.03),
        0 4px 20px var(--shadow-md),
        inset 0 1px 2px rgba(255, 255, 255, 0.01);
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.06) 50%,
        transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.panel.visible::before {
    opacity: 1;
    animation: shimmer 3s ease-in-out infinite;
}

/* Glow kept inside the panel so it never expands page scroll width */
.panel::after {
    content: '';
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.panel.visible::after {
    opacity: 1;
}


.panel-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.375rem;
    font-weight: 600;
    margin: 0 0 32px 0;
    color: var(--text);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.panel-title-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-secondary);
}

.panel-title-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--text);
    cursor: pointer;
}

.panel.disabled {
    opacity: 0.5;
    border-color: var(--border);
    background: var(--bg-tertiary);
}

.panel.disabled .panel-title {
    color: var(--text-secondary);
}

.panel.disabled .form-input,
.panel.disabled .form-label,
.panel.disabled select {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

.panel.disabled .panel-title-checkbox {
    opacity: 0.6;
    cursor: not-allowed;
}

.panel.disabled .panel-title-checkbox input[type="checkbox"] {
    cursor: not-allowed;
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: none; /* Horizontal fader is the primary control */
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.form-input {
    touch-action: pan-y pan-x pinch-zoom; /* Allow scrolling while preventing unwanted zoom */
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-appearance: none;
    appearance: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--card);
    box-shadow: 
        0 0 0 3px rgba(255, 255, 255, 0.08),
        inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

select.form-input {
    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='%2398999d' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

.input-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.affordability-banner {
    background: var(--card);
    color: var(--text);
    padding: 0;
    margin-bottom: 48px;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: 0;
    position: relative;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 
        0 12px 40px var(--shadow-md), 
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.affordability-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    background: none;
    animation: none;
}

.affordability-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
    pointer-events: none;
    opacity: 1;
    animation: pulseGlow 10s ease-in-out infinite;
}

.affordability-banner.negative::before {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.15) 50%,
        transparent 100%);
}

/* Header Section */
.affordability-header {
    position: relative;
    z-index: 1;
    padding: 48px 48px 32px 48px;
    border-bottom: 1px solid var(--border);
}

.affordability-title-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.affordability-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
    letter-spacing: 0.05em;
    line-height: 1.3;
    text-transform: uppercase;
}

.affordability-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin: 0;
}

/* Shared type scale for live / calculated user numbers */
:root {
    --metric-label-size: 0.6875rem;
    /* Primary: affordability metrics, summary cards, key results */
    --metric-value-size: clamp(1.85rem, 3.6vw, 2.85rem);
    --metric-subtext-size: 0.75rem;
    --metric-label-tracking: 0.14em;
    --metric-subtext-tracking: 0.1em;
    /* Secondary: budget faders, loan estimates, inputs */
    --num-display-size: clamp(1.75rem, 3vw, 2.5rem);
    /* Tertiary: table cells, compact numeric UI */
    --num-compact-size: clamp(1rem, 1.6vw, 1.2rem);
}

/* Core Metrics Section - Health Score, Savings Rate & 5-Year Projection */
.affordability-core-metrics {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    justify-items: center;
    gap: 0;
    padding: clamp(24px, 3vw, 40px) clamp(12px, 2vw, 32px);
    border-bottom: 1px solid var(--border);
    background: #000000;
    width: 100%;
    box-sizing: border-box;
}

.core-metric {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: clamp(18px, 2.5vw, 28px) clamp(10px, 1.5vw, 20px);
    position: relative;
    cursor: help;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
}

.core-metric-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--metric-label-size);
    color: var(--text-tertiary);
    margin-bottom: 12px;
    letter-spacing: var(--metric-label-tracking);
    font-weight: 400;
    text-transform: uppercase;
    line-height: 1.35;
}

.core-metric-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--metric-value-size);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    letter-spacing: 0.03em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.core-metric-status {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--metric-subtext-size);
    color: var(--text-secondary);
    letter-spacing: var(--metric-subtext-tracking);
    text-transform: uppercase;
    font-weight: 400;
    line-height: 1.35;
}

.core-metric-status.positive {
    color: var(--text);
}

.core-metric-status.warning {
    color: var(--text-secondary);
}

.core-metric-status.negative {
    color: var(--text-tertiary);
}

.core-metric-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: 4px;
    min-width: 240px;
    max-width: 320px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
}

.core-metric:hover .core-metric-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-12px);
    pointer-events: auto;
}

.core-metric-tooltip-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.7rem;
}

.core-metric-tooltip-text {
    color: var(--text-secondary);
    font-size: 0.6875rem;
    line-height: 1.5;
}

/* Metrics Grid within Affordability Banner */
.affordability-metrics {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    justify-items: center;
    gap: 0;
    padding: clamp(28px, 3vw, 40px) clamp(12px, 2vw, 24px);
    border-top: 1px solid var(--border);
    background: #000000;
    width: 100%;
    box-sizing: border-box;
}

.affordability-metrics .mini-metric {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: clamp(20px, 2.5vw, 28px) clamp(8px, 1.5vw, 16px);
    position: relative;
    cursor: help;
    transition: background-color 0.2s ease;
    border: none;
    border-right: 1px solid var(--border);
    border-bottom: none;
    box-sizing: border-box;
}

.affordability-metrics .mini-metric:last-child {
    border-right: none;
}


.affordability-metrics .mini-metric-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--metric-label-size);
    color: var(--text-tertiary);
    margin-bottom: 12px;
    letter-spacing: var(--metric-label-tracking);
    font-weight: 400;
    text-transform: uppercase;
    line-height: 1.35;
}

.affordability-metrics .mini-metric-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--metric-value-size);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    letter-spacing: 0.03em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.affordability-metrics .mini-metric-trend {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--metric-subtext-size);
    color: var(--text-secondary);
    letter-spacing: var(--metric-subtext-tracking);
    text-transform: uppercase;
    text-align: center;
    font-weight: 400;
    line-height: 1.35;
}


.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 48px;
    justify-items: stretch;
}

@media (max-width: 1024px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
}

/* In-panel loan payment estimate */
.payment-estimate {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.payment-estimate-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.payment-estimate-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--num-display-size);
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.summary-card {
    background: var(--card-hover);
    background-image: none;
    padding: 36px 28px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 12px 40px var(--shadow-md),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    position: relative;
}

.summary-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: none;
    pointer-events: none;
    opacity: 0;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.08) 50%,
        transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.summary-card.visible::before {
    opacity: 1;
}

.summary-card:nth-child(1) { animation-delay: 0.1s; animation-fill-mode: both; }
.summary-card:nth-child(2) { animation-delay: 0.15s; animation-fill-mode: both; }
.summary-card:nth-child(3) { animation-delay: 0.2s; animation-fill-mode: both; }
.summary-card:nth-child(4) { animation-delay: 0.25s; animation-fill-mode: both; }

.summary-card::before {
    opacity: 1;
}

.summary-card-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    text-transform: uppercase;
    text-align: center;
    width: 100%;
    line-height: 1.4;
}

.summary-card-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--metric-value-size);
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.03em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    text-align: center;
    width: 100%;
}

.summary-card-value.positive {
    color: var(--text);
}

.summary-card-value.negative {
    color: var(--text);
    opacity: 0.7;
}

.mixing-board-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 20px;
    background: transparent;
    border-radius: 0;
    position: relative;
    border: none;
    min-height: 120px;
    overflow: visible;
    box-shadow: none;
}

.budget-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    transition: all 0.3s ease;
    height: 240px;
    position: relative;
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.8);
    gap: 12px;
    touch-action: pan-y pan-x; /* Allow scrolling at all times */
    overflow: visible; /* Prevent any scroll containers */
}


.budget-item-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: center;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-weight: 500;
}

.budget-item-input {
    touch-action: pan-y pan-x pinch-zoom; /* Allow scrolling while preventing unwanted zoom */
    width: 100%;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.8);
    background: var(--card);
    color: var(--text);
    border-radius: 2px;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', monospace;
}

.budget-item-input:focus {
    outline: none;
    border-color: rgba(0, 0, 0, 1);
    background: var(--card-hover);
}

.budget-item-input:hover {
    border-color: rgba(0, 0, 0, 0.9);
}

.budget-toggle-btn {
    margin: 0;
    margin-bottom: 8px;
    width: auto;
    min-width: 32px;
    z-index: 10;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.budget-toggle-btn.enabled {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--text);
}

.budget-toggle-btn.enabled:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
}

.budget-toggle-btn.disabled {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-tertiary);
}

.budget-toggle-btn.disabled:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
}

.budget-item.disabled {
    opacity: 0.6;
}

.budget-item-top {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
}

.budget-item-name {
    text-align: center;
}

.budget-item-delete {
    width: 52px;
    height: 28px;
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 20, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        inset 0 1px 3px rgba(0,0,0,0.9),
        0 2px 8px rgba(0,0,0,0.4),
        0 1px 2px rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    font-family: 'JetBrains Mono', monospace;
    flex-shrink: 0;
    overflow: hidden;
}

.budget-item-delete:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow:
        inset 0 1px 3px rgba(0,0,0,0.9),
        0 4px 16px rgba(0,0,0,0.6),
        0 2px 4px rgba(255, 255, 255, 0.04);
    transform: translateY(-1px);
    color: var(--text);
}

.budget-item-delete:active {
    transform: translateY(0);
}

.budget-item-delete:focus-visible {
    outline: none;
    box-shadow:
        inset 0 1px 3px rgba(0,0,0,0.9),
        0 2px 8px rgba(0,0,0,0.4),
        0 1px 2px rgba(255, 255, 255, 0.02),
        0 0 0 3px rgba(255, 255, 255, 0.1);
}

.budget-item-toggle-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

@media (max-width: 480px) {
    .budget-item-delete {
        width: 46px;
        height: 24px;
        border-radius: 12px;
        font-size: 12px;
    }
}

.budget-item-amount-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    gap: 6px;
}

.income-label {
    font-size: 0.625rem;
    color: var(--text-tertiary);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: center;
    margin-top: 4px;
}

.budget-item-amount-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 220px;
}

.budget-amount-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.8);
    border-radius: 6px;
    transition: all 0.3s ease;
    touch-action: pan-y pan-x; /* Allow scrolling */
    overflow: visible; /* Prevent scroll containers */
}

.budget-amount-input-wrapper:hover:not(.is-disabled) {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(0, 0, 0, 0.9);
}

.budget-amount-input-wrapper:focus-within {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(0, 0, 0, 1);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
    touch-action: pan-y pan-x; /* Ensure scrolling works when focused */
}

.budget-amount-input-wrapper.is-disabled {
    opacity: 0.4;
}

.budget-amount-input {
    touch-action: pan-y pan-x pinch-zoom; /* Allow scrolling while preventing unwanted zoom */
    font-size: var(--num-display-size);
    font-weight: 700;
    padding: 12px 16px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    text-align: center;
    width: 100%;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
    line-height: 1.15;
    -moz-appearance: textfield;
    appearance: textfield;
}

.budget-amount-input::-webkit-inner-spin-button,
.budget-amount-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.budget-amount-input:focus {
    outline: none;
}

.budget-amount-input.is-disabled {
    cursor: not-allowed;
}

/* Spinner controls */
.budget-spinner-controls {
    display: flex;
    flex-direction: row;
    gap: 12px;
    justify-content: center;
    flex-shrink: 0;
}

.budget-spinner-btn {
    width: 28px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    padding: 0;
    margin: 0;
    border-radius: 4px;
}

.budget-spinner-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 0, 0, 0.9);
}

.budget-spinner-btn:active:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(0.98);
}

.budget-spinner-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.budget-spinner-btn svg {
    width: 14px;
    height: 14px;
    stroke: rgba(255, 255, 255, 0.7);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.budget-spinner-btn:hover:not(:disabled) svg {
    stroke: rgba(255, 255, 255, 0.9);
}

.budget-item-slider-row {
    display: none;
}

@media (max-width: 480px) {
    .budget-item-amount-row {
        max-width: 180px;
        gap: 8px;
    }

    .budget-amount-input-wrapper {
        width: 100%;
    }

    .budget-amount-input {
        font-size: var(--num-display-size);
        padding: 10px 12px;
    }

    .budget-spinner-btn {
        width: 20px;
        height: 18px;
    }

    .budget-spinner-btn svg {
        width: 10px;
        height: 10px;
    }
}

/* Sliding toggle switch - monochrome black/white */
.toggle-switch {
    width: 52px;
    height: 28px;
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 20, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        inset 0 1px 3px rgba(0,0,0,0.9),
        0 2px 8px rgba(0,0,0,0.4),
        0 1px 2px rgba(255, 255, 255, 0.02);
    flex-shrink: 0;
    overflow: hidden;
}


.toggle-switch::after {
    content: '•';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: rgba(0, 0, 0, 0.4);
    font-weight: 400;
    transition: all 0.3s ease;
    z-index: 1;
}

.toggle-switch:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow:
        inset 0 1px 3px rgba(0,0,0,0.9),
        0 4px 16px rgba(0,0,0,0.6),
        0 2px 4px rgba(255, 255, 255, 0.04);
    transform: translateY(-1px);
}

.toggle-switch:focus-visible {
    outline: none;
    box-shadow:
        inset 0 1px 3px rgba(0,0,0,0.9),
        0 2px 8px rgba(0,0,0,0.4),
        0 1px 2px rgba(255, 255, 255, 0.02),
        0 0 0 3px rgba(255, 255, 255, 0.1);
}

.toggle-switch.enabled {
    background: linear-gradient(135deg, rgba(160, 160, 160, 0.95) 0%, rgba(140, 140, 140, 0.9) 100%);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow:
        inset 0 1px 3px rgba(0,0,0,0.08),
        0 2px 8px rgba(0,0,0,0.2),
        0 1px 2px rgba(255, 255, 255, 0.1);
}


.toggle-switch.enabled::after {
    color: var(--text-secondary);
}

.budget-item.income-item .toggle-switch.enabled::after {
    color: var(--text);
}

.toggle-switch.enabled:hover {
    background: linear-gradient(135deg, rgba(180, 180, 180, 0.95) 0%, rgba(160, 160, 160, 0.9) 100%);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow:
        inset 0 1px 3px rgba(0,0,0,0.05),
        0 4px 16px rgba(0,0,0,0.3),
        0 2px 4px rgba(255, 255, 255, 0.15);
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, rgba(240, 240, 240, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow:
        0 2px 6px rgba(0,0,0,0.3),
        0 1px 2px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.toggle-switch:hover .toggle-thumb {
    box-shadow:
        0 3px 8px rgba(0,0,0,0.4),
        0 2px 4px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.toggle-switch.enabled .toggle-thumb {
    left: 27px;
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.95) 0%, rgba(0, 0, 0, 0.9) 100%);
    border-color: rgba(0, 0, 0, 0.6);
    box-shadow:
        0 2px 6px rgba(0,0,0,0.2),
        0 1px 2px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(0, 0, 0, 0.3);
}

.toggle-switch.enabled:hover .toggle-thumb {
    box-shadow:
        0 3px 8px rgba(0,0,0,0.3),
        0 2px 4px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(0, 0, 0, 0.4);
}

@media (max-width: 480px) {
    .toggle-switch {
        width: 46px;
        height: 24px;
        border-radius: 12px;
    }
    .toggle-thumb {
        width: 18px;
        height: 18px;
        top: 3px;
        left: 3px;
    }
    .toggle-switch::after {
        font-size: 12px;
    }
    .toggle-switch::after { right: 5px; }
    .toggle-switch.enabled .toggle-thumb { left: 23px; }
}

.budget-slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    flex: 1;
    justify-content: center;
    position: relative;
    cursor: ew-resize;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    touch-action: pan-y pan-x; /* Prefer vertical page scroll; horizontal still works for faders */
    margin: 8px 0;
}

.budget-name-input {
    font-size: 0.75rem;
    padding: 6px 8px;
    text-align: center;
    font-weight: 600;
}

.budget-name-input--readonly {
    cursor: default;
}

.budget-toggle-compact {
    font-size: 0.7rem;
    padding: 4px 8px;
}

.budget-slider-container.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

.budget-amount-display.is-disabled {
    opacity: 0.4;
    cursor: default;
}

/* Consolidate budget-slider-container mobile overrides */
@media (max-width: 768px) {
}

@media (max-width: 480px) {
    .budget-slider-container {
        padding: 4px 0;
    }
}

.fader-track {
    width: 120px;
    height: 20px;
    background: #000000;
    border: 2px solid var(--border);
    border-radius: 0;
    position: relative;
    margin: 0 auto;
    cursor: ew-resize;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
}

.fader-level {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 0;
    transition: width 0.1s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.fader-handle {
    position: absolute;
    top: -2px;
    left: -8px;
    width: 16px;
    height: calc(100% + 4px);
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--border);
    border-radius: 0;
    cursor: ew-resize;
    transition: all 0.1s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    touch-action: pan-y pan-x; /* Prefer vertical page scroll; horizontal still works for faders */
    z-index: 10;
}

.fader-handle:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

/* Consolidated 768px media query */
@media (max-width: 768px) {
    /* Fader handle adjustments */
    .fader-handle,
    .fader-handle.income-fader-handle {
        width: 14px;
        height: calc(100% + 6px);
        top: -3px;
        left: -7px;
        border-width: 1.5px;
    }

    /* App container and header adjustments */
    .app-container {
        padding: 24px 16px;
    }

    .header {
        padding: 0;
        margin-bottom: 32px;
        border-radius: 0;
        min-height: 420px;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        max-width: 100%;
    }

    .header-banner-title-wrapper {
        flex-wrap: wrap;
        gap: 12px;
    }

    .header-banner-title-text {
        font-size: clamp(3rem, 15vw, 5rem) !important;
        font-weight: 900 !important;
        letter-spacing: 0.1em !important;
        opacity: 1 !important;
    }

    .beta-tag {
        font-size: 0.6875rem;
        font-weight: 700;
        padding: 6px 12px;
        margin-top: -20px;
        letter-spacing: 0.15em;
        border-width: 1.5px;
    }

    .header-banner-subtitle {
        font-size: 0.6875rem;
        letter-spacing: 0.14em;
        padding: 0 !important;
    }

    .subtitle-accent {
        font-size: 0.6875rem;
        padding: 0 10px;
    }

    .header-banner-title {
        max-width: 100%;
        padding: 0 16px;
    }

    .header-email-signup {
        margin-top: 32px;
        max-width: 100%;
        padding: 24px 16px 0;
    }

    .header-email-signup::before {
        width: 60px;
    }

    .email-signup-input-group {
        flex-direction: column;
    }
    .email-signup-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .email-signup-button {
        width: 100%;
    }

    .email-signup-text {
        font-size: 0.6875rem;
    }

    /* AI Analysis panel */
    .ai-analysis-panel {
        margin-top: 32px;
        margin-bottom: 32px;
    }

    .ai-analysis-title {
        font-size: 1.25rem;
    }

    .ai-analysis-actions {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }

    .ai-rerun-button {
        width: 100%;
    }

    .ai-grade-display {
        flex-direction: column;
        gap: 16px;
    }

    .ai-grade-letter {
        font-size: 3rem;
    }

    .ai-grade-meter {
        max-width: 100%;
    }

    .ai-insights {
        grid-template-columns: 1fr;
    }

    .ai-insight-item {
        padding: 16px;
    }

    /* Footer */
    .footer {
        padding: 48px 32px;
        margin-top: 64px;
        border-radius: 0;
    }

    .footer-brand {
        font-size: 1.5rem;
    }

    .footer-tagline {
        font-size: 0.6875rem;
        letter-spacing: 0.15em;
    }

    .footer-dev-tag {
        font-size: 0.625rem;
        margin-top: 24px;
    }
}

@media (max-width: 480px) {
    .fader-handle {
        height: 18px;
        top: -9px;
        left: -2px;
        right: -2px;
        min-height: 36px;
        border-width: 1px;
    }

    .fader-handle.income-fader-handle {
        height: 18px;
        top: -9px;
        left: -2px;
        right: -2px;
        min-height: 36px;
        border-width: 1px;
    }

    .header-banner-title-text {
        font-size: clamp(2.75rem, 16vw, 4rem) !important;
        font-weight: 900 !important;
        letter-spacing: 0.08em !important;
        opacity: 1 !important;
    }

    .header {
        min-height: 300px;
    }
}

.budget-slider {
    width: 100%;
    max-width: 260px;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(90deg, #050505 0%, #000000 100%);
    outline: none;
    transition: all 0.3s ease;
    margin: 0 auto;
    display: none; /* Horizontal fader is the primary control */
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y pan-x; /* Prefer vertical page scroll; horizontal still works for faders */
}

.budget-amount-display {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--text);
    font-size: var(--num-display-size);
    text-align: center;
    min-width: 88px;
    padding: 6px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    cursor: text;
    user-select: none;
    transition: all 0.2s ease;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
    line-height: 1.15;
}

.budget-amount-display:hover {
    background: var(--bg-secondary);
    border-color: var(--border-light);
}

.budget-amount-display.editing {
    background: var(--card);
    border-color: rgba(255, 255, 255, 0.4);
}


.fader-track.income-fader-track {
    border-radius: 4px;
}


.fader-handle.income-fader-handle {
    border-radius: 3px;
}

.budget-item.income-item .budget-amount-display.editing {
    border-color: rgba(255, 255, 255, 0.4);
}

.budget-slider.income-slider {
    width: 100%;
    max-width: 260px;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(90deg, #050505 0%, #000000 100%);
    outline: none;
    transition: all 0.3s ease;
    margin: 0 auto;
    display: block;
}

.budget-amount-display.income-amount-display {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--text);
    font-size: var(--num-display-size);
    text-align: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    cursor: text;
    user-select: none;
    transition: all 0.2s ease;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    line-height: 1.2;
}


.budget-amount-display.income-amount-display.editing {
    background: var(--card);
    border-color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 768px) {
    .app-container {
        padding: 24px 16px;
    }
    
    .income-budget-content {
        overflow: visible;
    }
    
    .mixing-board-container {
        overflow: visible;
    }

    .chart-container {
        padding: 20px 16px;
    }

    table {
        font-size: 0.8rem;
    }

    th, td {
        padding: 12px 8px;
        font-size: 0.75rem;
    }

    .header {
        padding: 0;
        margin-bottom: 32px;
        border-radius: 0;
        min-height: 420px;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        max-width: 100%;
    }

    .header-banner-title-wrapper {
        flex-wrap: wrap;
        gap: 12px;
    }

    .header-banner-title-text {
        font-size: clamp(3rem, 15vw, 5rem) !important;
        font-weight: 900 !important;
        letter-spacing: 0.1em !important;
        opacity: 1 !important;
    }

    .beta-tag {
        font-size: 0.6875rem;
        font-weight: 700;
        padding: 6px 12px;
        margin-top: -20px;
        letter-spacing: 0.15em;
        border-width: 1.5px;
    }

    .header-banner-subtitle {
        font-size: 0.6875rem;
        letter-spacing: 0.14em;
        padding: 0 !important;
    }

    .subtitle-accent {
        font-size: 0.6875rem;
        padding: 0 10px;
    }

    .header-banner-title {
        max-width: 100%;
        padding: 0 16px;
    }

    .header-email-signup {
        margin-top: 32px;
        max-width: 100%;
        padding: 24px 16px 0;
    }

    .header-email-signup::before {
        width: 60px;
    }

    .email-signup-input-group {
        flex-direction: column;
    }
    .email-signup-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .email-signup-button {
        width: 100%;
        grid-column: 1;
    }

    .email-signup-input {
        padding: 14px 18px;
        font-size: 0.8125rem;
    }

    .email-signup-button {
        padding: 14px 24px;
        min-height: 48px;
    }

    .email-signup-text {
        font-size: 0.6875rem;
    }

    .email-signup-countdown {
        gap: 8px;
        margin-bottom: 12px;
    }

    .email-countdown-item {
        min-width: 40px;
        padding: 6px 10px;
    }

    .email-countdown-number {
        font-size: 1rem;
    }

    .email-countdown-label {
        font-size: 0.45rem;
    }

    .header h1 {
        font-size: 2.75rem;
        margin-bottom: 20px;
    }

    .header h1::after {
        bottom: -6px;
        height: 1.5px;
    }

    .header p {
        font-size: 1.125rem;
        margin-top: 24px;
        padding-left: 20px;
    }

    .header p::before {
        width: 1.5px;
    }


    .affordability-banner {
        padding: 0;
    }

    .affordability-header {
        padding: 32px 24px 24px 24px;
        text-align: center;
    }

    .affordability-title {
        font-size: 1.25rem;
    }

    .affordability-subtitle {
        font-size: 0.75rem;
    }

    .affordability-core-metrics {
        padding: 0;
        border-bottom: none;
        /* children flow into banner 2-col grid via display:contents below */
    }

    .core-metric {
        padding: 20px 14px;
        width: 100%;
        border-bottom: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }

    .core-metric-value,
    .health-score-metric .core-metric-value,
    .savings-rate-metric .core-metric-value {
        font-size: var(--metric-value-size);
    }

    .core-metric-label {
        font-size: var(--metric-label-size);
        margin-bottom: 12px;
    }

    .core-metric-status {
        font-size: var(--metric-subtext-size);
    }

    .affordability-content {
        flex-direction: column;
        text-align: center;
        gap: 20px;
        padding-bottom: 32px;
        border-bottom: 1px solid var(--border);
    }

    .affordability-text {
        width: 100%;
    }

    .affordability-amount {
        min-width: auto;
        text-align: center;
        margin-top: 0;
        width: 100%;
    }

    .affordability-metrics {
        padding: 0;
        border-top: none;
    }

    .affordability-metrics .mini-metric {
        padding: 20px 14px;
        border-right: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
    }

    .affordability-metrics .mini-metric-value {
        font-size: var(--metric-value-size);
    }

    .affordability-metrics .mini-metric-label {
        font-size: var(--metric-label-size);
    }

    .affordability-metrics .mini-metric-trend {
        font-size: var(--metric-subtext-size);
    }


    .mixing-board-container {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
        padding: 12px;
    }

    .budget-item {
        height: 220px;
        padding: 6px 8px;
    }

    .budget-item-input {
        padding: 4px 6px;
        font-size: 0.7rem;
        margin-bottom: 0;
        order: 1;
        width: 100%;
    }

    .budget-toggle-btn {
        margin-bottom: 6px;
        padding: 3px 8px;
        font-size: 0.6rem;
        order: 2;
        width: auto;
        align-self: center;
    }

    .budget-amount-display {
        order: 3;
        margin-top: 0;
        margin-bottom: 8px;
        font-size: var(--num-display-size);
        padding: 6px 8px;
        min-width: 72px;
    }


    .budget-item-label {
        font-size: 0.75rem;
        min-height: 28px;
        text-align: center;
    }

    .fader-track,
    .fader-track.income-fader-track {
        height: 18px;
        width: 160px;
        border-width: 1.5px;
    }


    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 32px;
    }

    .summary-card {
        padding: 28px 20px;
        max-width: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .summary-card-label {
        font-size: 0.75rem;
        margin-bottom: 14px;
        text-align: center;
        width: 100%;
    }

    .summary-card-value {
        font-size: var(--metric-value-size);
        text-align: center;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .budget-item {
        height: 200px;
        padding: 4px 6px;
    }

    .budget-item-input {
        padding: 3px 5px;
        font-size: 0.65rem;
    }

    .budget-toggle-btn {
        margin-bottom: 4px;
        padding: 2px 6px;
        font-size: 0.55rem;
    }

    .budget-amount-display {
        font-size: var(--num-display-size);
        padding: 7px 10px;
        min-width: 64px;
        margin-bottom: 6px;
    }

    .budget-item-label {
        font-size: 0.65rem;
        min-height: 24px;
    }

    .budget-slider-container {
        padding: 4px 0;
        /* Redesigned sliders for mobile usability */
    }

    .fader-track,
    .fader-track.income-fader-track {
        width: 160px;
        height: 28px;
        border-width: 2px;
        border-radius: 2px;
        background: linear-gradient(90deg, #0a0a0a 0%, #000000 100%);
        box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 6px rgba(255, 255, 255, 0.1);
    }

    .fader-handle,
    .fader-handle.income-fader-handle {
        width: 24px; /* Increased for better touch target */
        height: calc(100% + 6px);
        min-height: 44px; /* Ensure minimum touch target */
        border-radius: 2px;
        background: rgba(255, 255, 255, 0.95);
        border: 2px solid rgba(255, 255, 255, 0.8);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
        /* Better touch feedback */
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
        transition: all 0.1s ease;
    }

    .fader-level,
    .fader-level.income-fader-level {
        background: linear-gradient(90deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
        border-radius: 1px 0 0 1px;
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4), 0 0 4px rgba(255, 255, 255, 0.2);
    }

    .header-banner-countdown {
        gap: 8px;
        margin-top: 16px;
        margin-bottom: 6px;
    }

    .countdown-item {
        min-width: 45px;
        padding: 5px 6px;
    }

    .countdown-number {
        font-size: 1.25rem;
    }

    .countdown-label {
        font-size: 0.45rem;
        margin-top: 2px;
    }

    .mixing-board-container {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
        padding: 10px;
        overflow: visible;
    }
    
    .income-budget-content {
        overflow: visible;
    }
    
    .panel {
        overflow: visible;
    }
}

.budget-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.budget-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    border-color: var(--border-light);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 1);
}

.budget-slider::-moz-range-thumb {
    width: 32px;
    height: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.budget-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    border-color: var(--border-light);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 1);
}

.budget-slider::-webkit-slider-runnable-track {
    height: 8px;
    background: linear-gradient(90deg, #050505 0%, #000000 100%);
    border: 1px solid var(--border);
    border-radius: 0;
}

.budget-slider::-moz-range-track {
    height: 8px;
    background: linear-gradient(90deg, #050505 0%, #000000 100%);
    border: 1px solid var(--border);
    border-radius: 0;
}

.budget-slider.income-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.budget-slider.income-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    border-color: var(--border-light);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 1);
}

.budget-slider.income-slider::-moz-range-thumb {
    width: 32px;
    height: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.budget-slider.income-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    border-color: var(--border-light);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 1);
}

.budget-slider.income-slider::-webkit-slider-runnable-track {
    height: 8px;
    background: #000000;
    border: 1px solid var(--border);
    border-radius: 0;
}

.budget-slider.income-slider::-moz-range-track {
    height: 8px;
    background: #000000;
    border: 1px solid var(--border);
    border-radius: 0;
}


.btn {
    padding: 10px 20px;
    font-size: 0.75rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    letter-spacing: 0.08em;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    min-height: 44px;
    min-width: 44px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.15) 50%,
        transparent 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.btn:hover,
.email-signup-button:hover {
    background: var(--card-hover);
    background-image: none;
    border-color: var(--border-focus);
    transform: translateY(-1px);
    box-shadow: 
        0 6px 20px var(--shadow-md),
        inset 0 0 0 1px rgba(255, 255, 255, 0.06),
        inset 0 1px 2px rgba(255, 255, 255, 0.02);
}

.btn:hover::before {
    opacity: 1;
}

.btn:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px var(--shadow-sm),
        inset 0 1px 2px rgba(255, 255, 255, 0.01);
}

.btn-danger {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text);
    padding: 8px 16px;
    font-size: 0.75rem;
    border-radius: 0;
    min-height: 44px;
    min-width: 44px;
}

.btn-danger:hover {
    background: var(--bg-secondary);
    border-color: var(--border-light);
}

.chart-container {
    padding: clamp(32px, 3vw, 40px);
    margin-bottom: 48px;
    box-shadow: 
        0 8px 32px var(--shadow-md), 
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: clip;
}

/*
 * IMPORTANT: never set overflow-x: auto on chart-container itself.
 * CSS computes overflow-y: visible → auto when the other axis is not visible,
 * which creates a nested vertical scroller that "sticks" page scroll.
 */
.table-scroll {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    box-sizing: border-box;
    /* Keep wide tables inside this scroller instead of expanding the page */
    display: block;
}

.chart-container table {
    width: 100%;
    max-width: none;
}

.chart-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: none;
    pointer-events: none;
    opacity: 0;
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.08) 50%,
        transparent 100%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.chart-container.visible::before {
    opacity: 1;
    animation: shimmer 3.5s ease-in-out infinite;
}


.chart-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.375rem;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: var(--text);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    line-height: 1.3;
}

.chart-description {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    line-height: 1.6;
    margin: 0 0 32px 0;
    position: relative;
    z-index: 1;
    padding-bottom: 0;
    max-width: 62ch;
}

.chart-wrapper {
    position: relative;
    height: 400px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.chart-wrapper canvas {
    display: block;
    max-width: 100% !important;
}

table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    background: var(--bg);
    border: 1px solid var(--border);
    table-layout: auto;
}

thead {
    background: linear-gradient(180deg, #0a0a0a 0%, #000000 100%);
    border-bottom: 1px solid var(--border);
}

th {
    padding: 16px;
    text-align: left;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
    font-size: var(--num-compact-size);
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

td strong {
    font-size: 1.05em;
    font-weight: 700;
}

tr:hover {
    background: linear-gradient(90deg, #0a0a0a 0%, #050505 100%);
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--bg-secondary);
    color: var(--text);
    border-radius: 0;
}

.badge-success {
    border-color: var(--border-light);
}

.badge-danger {
    border-color: var(--border);
    opacity: 0.6;
}

.section-divider {
    height: 1px;
    background: var(--border);
    margin: 30px 0;
}

.treemap-container {
    width: 100%;
    max-width: 100%;
    height: 600px;
    margin-top: 20px;
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 8px;
    box-sizing: border-box;
    overflow: hidden; /* clip D3 cells so they never expand the page */
    min-width: 0;
}

.treemap-svg {
    width: 100%;
    height: 100%;
    display: block;
    max-width: 100%;
    overflow: hidden;
}

.treemap-rect {
    stroke: var(--border);
    stroke-width: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.treemap-rect:hover {
    opacity: 0.9;
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 2px;
    filter: brightness(1.1);
}

.treemap-text tspan {
    fill: var(--text);
}

.treemap-text {
    pointer-events: none;
    font-family: 'JetBrains Mono', monospace;
    fill: var(--text);
}

.treemap-label {
    font-size: 12px;
    font-weight: 600;
    dominant-baseline: hanging;
    text-anchor: start;
    letter-spacing: 0.05em;
    line-height: 1.4;
}

.treemap-label tspan {
    dominant-baseline: hanging;
}

.treemap-amount {
    font-size: 16px;
    font-weight: 700;
    dominant-baseline: hanging;
    text-anchor: start;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.treemap-percentage {
    font-size: 10px;
    font-weight: 500;
    opacity: 0.75;
    dominant-baseline: hanging;
    text-anchor: start;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.3;
}

.treemap-tooltip {
    position: absolute;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 16px 20px;
    pointer-events: none;
    font-size: 0.875rem;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.treemap-tooltip.show {
    opacity: 1;
}

.treemap-tooltip-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.treemap-tooltip-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin: 4px 0;
}

.treemap-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.treemap-legend-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.8125rem;
    max-width: 100%;
    min-width: 0;
    line-height: 1.35;
    word-break: break-word;
}

.treemap-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

/* Budget Pie / Donut Chart */
.budget-pie-container {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 0;
    margin-top: 20px;
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: clamp(16px, 2.5vw, 28px);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
}

.budget-pie-chart-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: clamp(20px, 3vw, 40px);
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Square stage — forces 1:1 aspect so Chart.js never squishes the donut */
.budget-pie-chart-stage {
    flex: 0 0 auto;
    width: min(280px, 100%);
    max-width: 280px;
    aspect-ratio: 1 / 1;
    position: relative;
    margin: 0 auto;
}

.budget-pie-canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    position: absolute;
    inset: 0;
}

.budget-pie-legend {
    flex: 1 1 220px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: 10px;
    align-items: stretch;
    align-content: center;
    justify-items: stretch;
    min-width: 0;
    max-width: 100%;
}

.budget-pie-legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.budget-pie-legend-item:hover {
    background: var(--card);
    border-color: var(--border-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.budget-pie-legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.budget-pie-legend-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.budget-pie-legend-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.08em;
}

.budget-pie-legend-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.budget-pie-legend-amount {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.budget-pie-legend-percentage {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: var(--border-light);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Stack donut above legend on tablet/phone; stage stays square */
@media (max-width: 1024px) {
    .budget-pie-container {
        height: auto;
        min-height: 0;
        padding: 16px;
    }

    .budget-pie-chart-wrapper {
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        gap: 20px;
        min-height: 0;
    }

    .budget-pie-chart-stage {
        width: min(240px, 72vw);
        max-width: 240px;
    }

    .budget-pie-legend {
        display: grid;
        width: 100%;
        grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
        gap: 8px;
    }

    .budget-pie-legend-item {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .budget-pie-chart-stage {
        width: min(200px, 70vw);
        max-width: 200px;
    }
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: help;
    transition: all 0.2s ease;
}

.tooltip-trigger:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
    border-color: var(--border-light);
    color: var(--text);
}

.tooltip-content {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.8125rem;
    color: var(--text);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
    margin-bottom: 8px;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--bg-secondary);
}

.tooltip:hover .tooltip-content {
    opacity: 1;
    pointer-events: auto;
}

/* Instructions Panel */
.instructions-panel {
    background: var(--bg);
    padding: 24px;
    margin-bottom: 40px;
    box-shadow: 
        inset 0 0 0 1px rgba(255, 255, 255, 0.02),
        0 4px 16px rgba(0, 0, 0, 0.8);
}

.instructions-panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.01) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    opacity: 0.3;
}

.instructions-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.06) 50%,
        transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.instructions-panel.visible::before {
    opacity: 1;
}

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

.instructions-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.instructions-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 6px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.instructions-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
    color: var(--text);
}

.instructions-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-height: 0;
    overflow: hidden;
    overflow-y: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.instructions-content.expanded {
    max-height: 1000px;
    overflow: visible;
    overflow-y: visible;
    opacity: 1;
}

.income-budget-content {
    max-height: none;
    overflow: visible;
    overflow-y: visible;
    transition: opacity 0.3s ease;
    opacity: 1;
}

.income-budget-content:not(.expanded) {
    max-height: 0;
    overflow: hidden;
    overflow-y: hidden;
    opacity: 0;
}

.financial-planning-container {
    transition: opacity 0.3s ease;
    opacity: 1;
}

.financial-planning-container:not(.expanded) {
    max-height: 0;
    overflow: hidden;
    overflow-y: hidden;
    opacity: 0;
}

.financial-planning-header {
    margin-bottom: 24px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.financial-planning-title-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.financial-planning-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.375rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.instruction-item {
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0;
    position: relative;
}

.instruction-item-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.instruction-item-title::before {
    content: '→';
    color: var(--text-secondary);
    font-weight: 400;
}

.instruction-item-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Legend/Key */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0;
    margin-bottom: 24px;
    box-shadow: 
        inset 0 0 0 1px rgba(255, 255, 255, 0.02),
        0 2px 8px rgba(0, 0, 0, 0.6);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 0;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.legend-color.income {
    background: rgba(255, 255, 255, 0.9);
}

.legend-color.budget {
    background: rgba(255, 255, 255, 0.7);
}

/* Form Helper Text */
.form-helper {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 6px;
    line-height: 1.4;
}

/* AI Analysis Section */
.ai-analysis-panel {
    margin-top: 48px;
    margin-bottom: 48px;
    opacity: 0.85;
    position: relative;
}


.ai-analysis-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.ai-analysis-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.ai-analysis-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ai-analysis-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text) !important;
    text-transform: uppercase;
    margin: 0;
}

.coming-soon-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.7) !important;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 14px;
    border-radius: 0;
    white-space: nowrap;
}

.ai-rerun-button {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: #ffffff !important;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px 16px;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.ai-rerun-button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
}

.ai-rerun-button:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.2);
}

.ai-rerun-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ai-rerun-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    position: relative;
}

.ai-rerun-button.disabled:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    transform: none;
}

.ai-rerun-button.disabled::after {
    content: ' (Add API key)';
    font-size: 0.6em;
    opacity: 0.7;
    letter-spacing: 0.1em;
}

/* Pollinations / Pollen key panel */
.pollinations-key-panel {
    margin-bottom: 28px;
    padding: 20px 22px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.pollinations-key-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 12px;
}

.pollinations-key-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text);
}

.pollinations-key-link {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.pollinations-key-link:hover {
    color: var(--text);
    border-bottom-color: rgba(255, 255, 255, 0.4);
}

.pollinations-key-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
}

.pollinations-key-input {
    flex: 1 1 220px;
    min-width: 0;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 0.8125rem !important;
    letter-spacing: 0.04em;
}

.pollinations-key-toggle,
.pollinations-key-save {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 10px 16px;
    white-space: nowrap;
}

.pollinations-key-status {
    margin-top: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.pollinations-key-status.is-ready {
    color: rgba(160, 220, 160, 0.9);
}

.pollinations-key-status.is-error {
    color: rgba(255, 140, 140, 0.95);
}

.ai-analysis-note a {
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ai-analysis-note a:hover {
    color: var(--text);
}

@media (max-width: 560px) {
    .pollinations-key-row {
        flex-direction: column;
    }

    .pollinations-key-toggle,
    .pollinations-key-save {
        width: 100%;
    }
}

.signup-notice {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 24px;
    animation: fadeIn 0.4s ease-out;
}

.signup-notice-icon {
    font-size: 1.5rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-top: 2px;
}

.signup-notice-content {
    flex: 1;
}

.signup-notice-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: #ffffff;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.signup-notice-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Loading feedback is the terminal console + bar — not a button spinner */

.ai-analysis-preview {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.ai-grade-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 0;
}

.ai-grade-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    text-transform: uppercase;
    text-align: center;
}

.ai-grade-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.ai-grade-mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 112px;
}

.ai-grade-letter {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(3.5rem, 8vw, 5rem);
    font-weight: 700;
    color: var(--text) !important;
    line-height: 1;
    min-width: 100px;
    text-align: center;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

/* Hollow grade frame — shown before any analysis has run */
.ai-grade-idle {
    display: none;
    position: relative;
    width: clamp(4.25rem, 9vw, 5.5rem);
    height: clamp(4.25rem, 9vw, 5.5rem);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-grade-section.is-pending .ai-grade-idle {
    display: grid;
    place-items: center;
}

.ai-grade-section.is-pending .ai-grade-letter {
    display: none;
}

.ai-grade-idle-ring {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    border: 1px solid rgba(201, 168, 108, 0.28);
    background:
        linear-gradient(165deg, rgba(201, 168, 108, 0.06), transparent 55%),
        rgba(0, 0, 0, 0.25);
    box-shadow:
        inset 0 1px 0 rgba(232, 213, 163, 0.08),
        0 0 24px rgba(201, 168, 108, 0.06);
}

.ai-grade-idle-ring::before {
    content: '';
    position: absolute;
    inset: 7px;
    border-radius: 9px;
    border: 1px dashed rgba(201, 168, 108, 0.18);
}

.ai-grade-idle-diamond {
    position: relative;
    z-index: 1;
    width: 10px;
    height: 10px;
    border: 1px solid rgba(232, 213, 163, 0.55);
    transform: rotate(45deg);
    background: rgba(201, 168, 108, 0.12);
    box-shadow: 0 0 12px rgba(201, 168, 108, 0.2);
}

.ai-grade-status {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(244, 239, 230, 0.42);
    text-align: center;
    line-height: 1.3;
    max-width: 14ch;
}

/* During run: keep grade quiet — progress lives in the terminal console */
.ai-grade-section.is-calculating .ai-grade-status {
    color: rgba(232, 213, 163, 0.75);
}

/* ── Terminal console (always on stage) + loading bar ───── */
.ai-run-console {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 12px;
    padding: 10px 12px 12px;
    border: 1px solid rgba(201, 168, 108, 0.18);
    background:
        linear-gradient(180deg, rgba(12, 10, 8, 0.95), rgba(5, 4, 3, 0.98));
    border-radius: 2px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    box-shadow: inset 0 1px 0 rgba(232, 213, 163, 0.05);
    min-height: 7.5rem;
}

.ai-run-console.is-idle {
    border-color: rgba(201, 168, 108, 0.12);
}

.ai-run-console.is-active {
    border-color: rgba(201, 168, 108, 0.28);
}

.ai-run-console-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(201, 168, 108, 0.12);
}

.ai-run-console-title {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(232, 213, 163, 0.7);
}

.ai-run-console-pct {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--gold-soft, #e8d5a3);
    font-variant-numeric: tabular-nums;
    min-width: 3em;
    text-align: right;
}

.ai-run-console-log {
    max-height: 7.5rem;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0;
    scrollbar-width: thin;
}

.ai-run-console-line {
    font-size: 0.7rem;
    line-height: 1.45;
    letter-spacing: 0.02em;
    color: rgba(244, 239, 230, 0.58);
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-run-console-line.is-meta {
    color: rgba(244, 239, 230, 0.38);
    font-size: 0.64rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ai-run-console-line.is-ok {
    color: rgba(232, 213, 163, 0.9);
}

.ai-run-console-line.is-warn {
    color: rgba(224, 160, 120, 0.9);
}

.ai-run-bar {
    height: 3px;
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(201, 168, 108, 0.12);
    border-radius: 99px;
    overflow: hidden;
}

.ai-run-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #a8894f, #e8d5a3 55%, #c9a86c);
    box-shadow: 0 0 10px rgba(201, 168, 108, 0.35);
    transition: width 0.12s linear;
}

.ai-rerun-button.is-running {
    opacity: 0.55;
    cursor: wait;
    pointer-events: none;
}

.ai-grade-meter {
    flex: 1;
    max-width: 300px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    border-radius: 0;
    overflow: hidden;
    position: relative;
}

.ai-grade-bar {
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.6) 100%);
    transition: width 0.5s ease;
    width: 0%;
}

.ai-grade-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text) !important;
    letter-spacing: 0.05em;
    min-width: 80px;
    text-align: center;
}

.ai-grade-section.is-pending .ai-grade-score {
    color: rgba(244, 239, 230, 0.4) !important;
}

.ai-insights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.ai-insight-item {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 0;
    transition: all 0.2s ease;
}

.ai-insight-item:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--border-light);
}

.ai-insight-icon {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text) !important;
    line-height: 1;
    min-width: 24px;
    text-align: center;
}

.ai-insight-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.ai-insight-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text) !important;
    text-transform: uppercase;
}

.ai-insight-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.ai-analysis-footer {
    margin-top: 8px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.ai-analysis-note {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
    text-align: center;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .ai-analysis-panel {
        margin-top: 32px;
        margin-bottom: 32px;
    }

    .ai-analysis-title {
        font-size: 1.25rem;
    }

    .ai-analysis-actions {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }

    .ai-rerun-button {
        width: 100%;
    }

    .ai-grade-display {
        flex-direction: column;
        gap: 16px;
    }

    .ai-grade-letter {
        font-size: 3rem;
    }

    .ai-grade-meter {
        max-width: 100%;
    }

    .ai-insights {
        grid-template-columns: 1fr;
    }

    .ai-insight-item {
        padding: 16px;
    }
}

/* Footer */
.footer {
    margin-top: 96px;
    margin-bottom: 0;
    padding: 64px 48px 48px 48px;
    background: var(--bg);
    border-radius: 0;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    text-align: center;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.08) 20%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.08) 80%,
        transparent 100%);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.footer.visible::before {
    opacity: 1;
    animation: shimmer 4s ease-in-out infinite;
}

.footer::after {
    content: '';
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    background: 
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 60%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
    animation: pulseGlow 12s ease-in-out infinite;
}

.footer.visible::after {
    opacity: 1;
}

.footer-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-brand {
    font-family: 'Exo 2', sans-serif;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: #ffffff !important;
    text-transform: uppercase;
    margin: 0;
    line-height: 1.2;
    text-shadow: none !important;
    position: relative;
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: none !important;
    filter: none !important;
    -webkit-text-fill-color: #ffffff !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
    mix-blend-mode: normal !important;
    z-index: 1;
}

.footer.visible .footer-brand {
    opacity: 1 !important;
    transform: translateY(0) !important;
}


.footer-tagline {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    color: #ffffff !important;
    text-transform: uppercase;
    margin-top: 12px;
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: none !important;
    text-shadow: none !important;
    filter: none !important;
    -webkit-text-fill-color: #ffffff !important;
    background: none !important;
    mix-blend-mode: normal !important;
    position: relative;
    z-index: 1;
}

.footer.visible .footer-tagline {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.footer-dev-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--text-muted) !important;
    margin-top: 0;
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: none !important;
    position: relative;
    z-index: 1;
}

.footer.visible .footer-dev-tag {
    opacity: 1 !important;
    transform: translateY(0) !important;
}


.footer-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.8s, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.8s;
}

.footer.visible .footer-links {
    opacity: 1;
    transform: translateY(0);
}

.footer-link {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--text-muted) !important;
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* App Stores Section */
.app-stores-section {
    padding: 80px 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
    position: relative;
}

.app-stores-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: center;
}

.app-stores-title {
    font-family: 'Exo 2', sans-serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.app-stores-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    font-weight: 400;
}

.app-stores-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.app-store-link {
    display: inline-block;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.app-store-link:hover {
    opacity: 1;
    transform: translateY(-4px);
}

.app-store-logo {
    height: 60px;
    width: auto;
    filter: grayscale(100%);
    transition: all 0.3s ease;
}

.app-store-link:hover .app-store-logo {
    filter: grayscale(0%);
}

.app-stores-coming-soon {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.app-stores-stars {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.app-stores-stars .star {
    font-size: clamp(2rem, 4vw, 2.5rem);
    color: var(--text);
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.3));
    animation: starGlow 2s ease-in-out infinite;
}

.app-stores-stars .star:nth-child(1) {
    animation-delay: 0s;
}

.app-stores-stars .star:nth-child(2) {
    animation-delay: 0.2s;
}

.app-stores-stars .star:nth-child(3) {
    animation-delay: 0.4s;
}

.app-stores-stars .star:nth-child(4) {
    animation-delay: 0.6s;
}

.app-stores-stars .star:nth-child(5) {
    animation-delay: 0.8s;
}

@keyframes starGlow {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

@media (max-width: 768px) {
    .app-stores-section {
        padding: 60px 0;
    }

    .app-stores-logos {
        gap: 1.5rem;
    }

    .app-store-logo {
        height: 50px;
    }
}

@media (max-width: 480px) {
    .app-stores-logos {
        flex-direction: column;
        gap: 1rem;
    }

    .app-store-logo {
        height: 45px;
    }
}

.footer-social {
    position: absolute;
    bottom: 48px;
    right: 48px;
    display: flex;
    gap: 16px;
    align-items: center;
    z-index: 10;
    pointer-events: auto;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: rgba(255, 255, 255, 0.5) !important;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 11;
    pointer-events: auto;
    cursor: pointer;
}

.social-link:hover {
    color: rgba(255, 255, 255, 0.9) !important;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.social-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    display: block;
    pointer-events: none;
}

.social-icon path {
    pointer-events: none;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--card);
    margin: 5% auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 0;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-family: 'Exo 2', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-body h3 {
    font-family: 'Exo 2', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 24px;
    margin-bottom: 12px;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 16px;
}


@media (max-width: 768px) {
    .footer {
        padding: 48px 32px;
        margin-top: 64px;
        border-radius: 0;
    }

    .footer-brand {
        font-size: 1.5rem;
    }

    .footer-tagline {
        font-size: 0.6875rem;
        letter-spacing: 0.15em;
    }

    .footer-dev-tag {
        font-size: 0.625rem;
        margin-top: 0;
    }


    .footer {
        text-align: center;
        padding: 48px 24px 48px 24px;
    }

    .footer-social {
        position: static;
        flex-wrap: wrap;
        gap: 12px;
        justify-content: center;
        margin-top: 16px;
        margin-bottom: 0;
        z-index: 10;
        pointer-events: auto;
    }

    .footer-link {
        font-size: 0.625rem;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-body {
        padding: 20px;
    }
}

/* Scenarios Section */
.scenarios-section {
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--card);
    padding: 24px;
}

.section-header {
    text-align: center;
    margin-bottom: 16px;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 4px 0;
    letter-spacing: 0.05em;
}

.section-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.scenario-controls {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.scenario-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: 0;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.scenario-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.scenario-input::placeholder {
    color: var(--text-tertiary);
}

.scenario-save-btn {
    grid-column: auto !important;
    height: 40px !important;
    padding: 0 16px !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.btn-primary.btn-success {
    background: linear-gradient(135deg, #a3e8b3, #7dba8a) !important;
    border-color: rgba(125, 232, 163, 0.4) !important;
    color: #0c1a10 !important;
}


.scenario-list {
    /* Prefer growing with content — nested scroll here feels sticky while paging */
    max-height: none;
    overflow: visible;
}

.scenario-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--card);
    margin-bottom: 8px;
    transition: all 0.2s ease;
}


.scenario-info {
    flex: 1;
}

.scenario-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    letter-spacing: 0.05em;
}

.scenario-date {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
}

.scenario-actions {
    display: flex;
    gap: 8px;
}

.scenario-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-light);
    border-radius: 0;
    background: var(--card);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scenario-btn:hover {
    border-color: var(--border-focus);
    background: var(--card-hover);
}

.load-btn:hover {
    color: var(--accent);
}

.delete-btn:hover {
    color: var(--danger);
}

.no-scenarios {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    padding: 24px;
    letter-spacing: 0.05em;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card);
    border: 1px solid var(--border-focus);
    border-radius: 0;
    padding: 12px 20px;
    color: var(--text);
    font-size: 0.875rem;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.05em;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* Mini Dashboard - Stealth Black & White Theme */
.mini-dashboard {
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--card);
    padding: 0;
    position: relative;
    overflow: hidden;
}

.mini-dashboard::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.1) 20%,
        rgba(255, 255, 255, 0.1) 80%,
        transparent 100%);
}

.mini-dashboard-header {
    text-align: center;
    padding: 32px 32px 24px 32px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.mini-dashboard-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.08) 20%,
        rgba(255, 255, 255, 0.08) 80%,
        transparent 100%);
}

.mini-dashboard-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 8px 0;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.mini-dashboard-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.mini-dashboard-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    margin: 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.mini-metric {
    background: var(--card);
    border: none;
    border-right: 1px solid rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(0, 0, 0, 0.8);
    border-radius: 0;
    padding: 24px 20px;
    text-align: center;
    position: relative;
    transition: background-color 0.2s ease;
    cursor: help;
}

.mini-metric:nth-child(2n) {
    border-right: none;
}

.mini-metric:nth-child(n+3) {
    border-bottom: none;
}

.mini-metric::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.05) 50%,
        transparent 100%);
}


.mini-metric-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--metric-label-size);
    color: var(--text-tertiary);
    margin-bottom: 12px;
    letter-spacing: var(--metric-label-tracking);
    font-weight: 400;
    text-transform: uppercase;
}

.mini-metric-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--metric-value-size);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: 0.03em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.mini-metric-trend {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--metric-subtext-size);
    color: var(--text-muted);
    letter-spacing: var(--metric-subtext-tracking);
    text-transform: uppercase;
}

.mini-metric-trend.positive {
    color: var(--text-secondary);
}

.mini-metric-trend.warning {
    color: var(--text-tertiary);
}

.mini-metric-trend.negative {
    color: var(--text-muted);
}

/* Mini Metric Tooltips */
.mini-metric-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 12px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    color: var(--text);
    white-space: normal;
    width: 220px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.9);
    letter-spacing: 0.05em;
    line-height: 1.5;
    text-align: left;
    text-transform: none;
}

.mini-metric-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border);
}

.mini-metric-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--bg-secondary);
    margin-top: -1px;
    z-index: 1;
}

.mini-metric:hover .mini-metric-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

.mini-metric-tooltip-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
}

.mini-metric-tooltip-text {
    color: var(--text-secondary);
    font-size: 0.6875rem;
    line-height: 1.4;
}

.mini-dashboard-chart {
    width: 100%;
    height: 140px;
    background: var(--card);
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.mini-dashboard-chart::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.05) 50%,
        transparent 100%);
}

.mini-dashboard-chart canvas {
    max-width: 100%;
    max-height: 100%;
}

@media (max-width: 768px) {
    .mini-dashboard-header {
        padding: 24px 20px 20px 20px;
    }

    .mini-dashboard-content {
        grid-template-columns: repeat(2, 1fr);
    }

    .mini-metric {
        padding: 20px 16px;
    }

    .mini-metric-value {
        font-size: 1.5rem;
    }

    .mini-dashboard-chart {
        height: 120px;
        padding: 16px;
    }

    .scenario-controls {
        flex-direction: column;
    }

    .scenario-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .scenario-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Floating Navigation Bar */
.floating-nav {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    opacity: 1;
    will-change: auto;
    transition: background 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}


.floating-nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    position: relative;
    padding: 4px 0;
}

.floating-nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-nav-link:hover {
    color: var(--text);
}

.floating-nav-link:hover::after {
    width: 100%;
}

.floating-nav-link:active {
    color: var(--accent);
}


@media (max-width: 768px) {
    .floating-nav {
        top: 16px;
        padding: 10px 16px;
        gap: 16px;
        font-size: 12px;
        max-width: calc(100vw - 32px);
        flex-wrap: nowrap;
    }

    .floating-nav-link {
        font-size: 11px;
        white-space: nowrap;
        letter-spacing: 0.3px;
    }
}

@media (max-width: 480px) {
    .floating-nav {
        gap: 10px;
        padding: 8px 12px;
    }

    .floating-nav-link {
        font-size: 10px;
        letter-spacing: 0.2px;
    }
}


/* ============================================
   MOBILE RESPONSIVENESS FIXES (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Container padding adjustments */
    .app-container {
        padding: 24px 16px;
    }

    /* Panel padding reduction */
    .panel {
        padding: 20px 16px;
    }

    /* Chart container padding */
    .chart-container {
        padding: 20px 16px;
        margin-bottom: 32px;
    }

    /* Table overflow fixes — scroll the inner wrapper, not the section */
    .table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-scroll table {
        width: 100%;
        min-width: 520px; /* scroll inside .table-scroll only */
    }

    .panel,
    .chart-container,
    .instructions-panel,
    .affordability-banner,
    .ai-analysis-panel,
    .financial-planning-container,
    .main-layout {
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    table {
        width: 100%;
    }

    th, td {
        white-space: nowrap;
        padding: 12px 8px;
        font-size: 0.7rem;
    }

    th {
        font-size: 0.65rem;
        padding: 10px 8px;
    }

    /* Scenario buttons - ensure minimum tap target */
    .scenario-btn {
        padding: 10px 14px;
        min-height: 44px;
        min-width: 44px;
        font-size: 0.8rem;
    }

    .scenario-controls {
        flex-direction: column;
    }

    .scenario-save-btn {
        width: 100%;
        min-height: 44px;
    }

    /* Budget pie chart width fix */
    .budget-pie-chart-wrapper {
        max-width: 100% !important;
        width: 100% !important;
    }

    .budget-pie-container {
        padding: 0 8px;
    }

    /* Fader track width adjustment */
    .fader-track,
    .fader-track.income-fader-track {
        max-width: 100%;
        width: auto;
        min-width: 120px;
    }

    /* Social links positioning fix */
    .footer-social {
        position: static;
        margin-top: 24px;
        justify-content: center;
        width: 100%;
    }

    /* Modal content adjustments */
    .modal-content {
        width: 95%;
        margin: 10% auto;
        max-width: none;
    }

    .modal-header,
    .modal-body {
        padding: 16px;
    }

    /* Instructions panel padding */
    .instructions-panel {
        padding: 20px 16px;
    }

    /* Chart wrapper height adjustment */
    .chart-wrapper {
        height: min(300px, 55vw);
        min-height: 220px;
    }

    .chart-title {
        font-size: 1.125rem;
        word-wrap: break-word;
    }

    .chart-description {
        font-size: 0.75rem;
        margin-bottom: 20px;
        max-width: 100%;
    }

    .budget-pie-chart-stage {
        width: min(240px, 68vw);
        max-width: 240px;
    }

    .treemap-legend-item {
        font-size: 0.7rem;
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }

    /* Budget amount display adjustments */
    .budget-amount-display {
        min-width: 72px;
        font-size: var(--num-display-size);
        padding: 8px 12px;
    }

    /* Budget item amount row */
    .budget-item-amount-row {
        max-width: 100%;
        gap: 8px;
    }

    /* Budget item input wrapper */
    .budget-amount-input-wrapper {
        width: 100%;
    }

    /* Budget spinner buttons - ensure tap target */
    .budget-spinner-btn {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
    }

    /* Scenarios section padding */
    .scenarios-section {
        padding: 20px 16px;
    }

    /* Scenario item adjustments */
    .scenario-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .scenario-actions {
        width: 100%;
        justify-content: stretch;
    }

    .scenario-btn {
        flex: 1;
    }

    /* App stores container padding */
    .app-stores-container {
        padding: 0 16px;
    }

    /* Footer adjustments */
    .footer {
        padding: 32px 16px;
    }

    /* Mini dashboard padding */
    .mini-dashboard {
        padding: 16px;
    }

    /* Treemap container height */
    .treemap-container {
        height: min(360px, 85vw);
        min-height: 260px;
    }

    /* Section header adjustments */
    .section-header {
        margin-bottom: 20px;
    }

    /* Budget item grid adjustments */
    .mixing-board-container {
        gap: 12px;
        padding: 12px;
    }

    /* Budget item delete button - ensure tap target */
    .budget-item-delete {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
    }
}

/* ============================================
   SMALL MOBILE FIXES (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    /* Further reduce padding */
    .app-container {
        padding: 16px 12px;
    }

    .panel {
        padding: 16px 12px;
    }

    .chart-container {
        padding: 16px 12px;
    }

    /* Table cell padding further reduction */
    th, td {
        padding: 8px 6px;
        font-size: 0.65rem;
    }

    th {
        font-size: 0.6rem;
        padding: 8px 6px;
    }

    /* Chart wrapper smaller height */
    .chart-wrapper {
        height: 240px;
        min-height: 200px;
    }

    /* Treemap container smaller */
    .treemap-container {
        height: min(280px, 70vw);
        min-height: 220px;
    }

    .budget-pie-chart-stage {
        width: min(200px, 70vw);
        max-width: 200px;
    }

    .treemap-legend-item {
        flex: 1 1 100%;
        font-size: 0.65rem;
    }

    /* Budget amount display — stay large on small phones */
    .budget-amount-display {
        font-size: var(--num-display-size);
        padding: 6px 10px;
        min-width: 64px;
    }

    /* Fader track even smaller */
    .fader-track,
    .fader-track.income-fader-track {
        min-width: 100px;
        width: 100%;
        max-width: 140px;
    }

    /* Modal adjustments */
    .modal-content {
        width: 98%;
        margin: 5% auto;
    }

    .modal-header,
    .modal-body {
        padding: 12px;
    }

    /* Button text sizing */
    .btn {
        font-size: 0.875rem;
        padding: 12px 16px;
    }

    /* Scenario input and buttons */
    .scenario-input {
        font-size: 0.875rem;
        padding: 12px;
    }

    /* Budget pie legend adjustments */
    .budget-pie-legend {
        font-size: 0.7rem;
    }

    .budget-pie-legend-item {
        padding: 6px 8px;
    }

    /* Instructions panel */
    .instructions-panel {
        padding: 16px 12px;
    }

    /* Scenarios section */
    .scenarios-section {
        padding: 16px 12px;
    }

    /* Footer */
    .footer {
        padding: 24px 12px;
    }

    /* App stores logos */
    .app-stores-logos {
        gap: 1rem;
    }

    .app-store-logo {
        height: 40px;
    }
}

/* Budget Controls Row */
.budget-controls-row {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.budget-control-btn {
    flex: 1;
}

/* ============================================
   DASHBOARD PRECISION / SYMMETRY OVERRIDES
   ============================================ */
.app-container > * {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.app-container .u-mb-40,
.app-container .u-mb-24,
.app-container .u-mb-20 {
    margin-bottom: 0 !important;
}

.summary-grid {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
}

.mixing-board-container {
    width: 100%;
    box-sizing: border-box;
    justify-items: stretch;
}

.budget-item {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.chart-container {
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
}

.financial-planning-header,
.financial-planning-container {
    width: 100%;
    box-sizing: border-box;
}

.financial-planning-container {
    display: flex;
    flex-direction: column;
    gap: var(--dash-gap, 20px);
}

.financial-planning-container > .panel {
    margin-bottom: 0 !important;
}

.affordability-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    box-sizing: border-box;
}

.affordability-metrics .mini-metric {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.affordability-header {
    text-align: center;
}

.affordability-title-section {
    align-items: center;
    text-align: center;
}

/* Show form labels on purchase inputs */
#carPanel .form-label,
#housePanel .form-label,
.scenarios-section .form-label {
    display: block !important;
}

.core-metric-tooltip,
.mini-metric-tooltip {
    max-width: min(240px, 80vw);
    white-space: normal;
    pointer-events: none;
    z-index: 50;
}

/* Tablet / mid: all 6 metrics as one continuous 2×3 grid */
@media (min-width: 561px) and (max-width: 1024px) {
    .affordability-banner {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1px;
        background: var(--border);
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .affordability-banner > .affordability-header {
        grid-column: 1 / -1;
        background: #000;
    }

    /* Flatten wrappers so 6 metric cards fill the 2-col banner grid */
    .affordability-core-metrics,
    .affordability-metrics {
        display: contents !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
    }

    .affordability-banner .core-metric,
    .affordability-banner .mini-metric {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        padding: 22px 16px;
        border: none !important;
        background: #000;
    }

    .core-metric-value,
    .health-score-metric .core-metric-value,
    .savings-rate-metric .core-metric-value,
    .affordability-metrics .mini-metric-value {
        font-size: var(--metric-value-size) !important;
    }

    .core-metric-label,
    .affordability-metrics .mini-metric-label {
        font-size: var(--metric-label-size) !important;
        margin-bottom: 12px;
    }

    .core-metric-status,
    .affordability-metrics .mini-metric-trend {
        font-size: var(--metric-subtext-size) !important;
    }
}

@media (max-width: 900px) {
    .summary-grid {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 560px) {
    .summary-grid {
        grid-template-columns: 1fr !important;
    }

    .mixing-board-container {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    /* Phone: single column for metrics */
    .affordability-banner {
        display: block;
        gap: 0;
        background: transparent;
    }

    .affordability-core-metrics {
        display: grid !important;
        grid-template-columns: 1fr !important;
        padding: 0 !important;
        border-bottom: none !important;
    }

    .affordability-metrics {
        display: grid !important;
        grid-template-columns: 1fr !important;
        padding: 0 !important;
        border-top: 1px solid var(--border) !important;
    }

    .core-metric,
    .affordability-metrics .mini-metric {
        border: none !important;
        border-bottom: 1px solid var(--border) !important;
        padding: 20px 16px;
        background: #000;
    }

    .core-metric-value,
    .health-score-metric .core-metric-value,
    .savings-rate-metric .core-metric-value,
    .affordability-metrics .mini-metric-value {
        font-size: var(--metric-value-size) !important;
    }
}

/* ============================================
   MICROGRAPHICS + DASHBOARD STYLING
   Corner ticks, status chips, geometric markers
   ============================================ */

/* Soft page field — hairline frame around dashboard column on PC */
@media (min-width: 1024px) {
    .content {
        background-image:
            linear-gradient(to right, transparent 0, transparent calc(50% - var(--dash-max) / 2 - 1px), rgba(255,255,255,0.04) calc(50% - var(--dash-max) / 2 - 1px), rgba(255,255,255,0.04) calc(50% - var(--dash-max) / 2), transparent calc(50% - var(--dash-max) / 2)),
            linear-gradient(to left, transparent 0, transparent calc(50% - var(--dash-max) / 2 - 1px), rgba(255,255,255,0.04) calc(50% - var(--dash-max) / 2 - 1px), rgba(255,255,255,0.04) calc(50% - var(--dash-max) / 2), transparent calc(50% - var(--dash-max) / 2));
        background-repeat: no-repeat;
    }
}

/* Panel corner ticks (micro geometry) */
.panel,
.chart-container,
.instructions-panel,
.affordability-banner,
.ai-analysis-panel,
.hero-email-bar {
    position: relative;
}

.panel::before,
.chart-container::before,
.instructions-panel::before,
.ai-analysis-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--micro-line-strong) 12%, var(--micro-line) 50%, var(--micro-line-strong) 88%, transparent 100%);
    opacity: 1;
    pointer-events: none;
    z-index: 2;
}

/* Four L-corner marks */
.panel > .panel-title,
.chart-container > .chart-title,
.instructions-panel > .instructions-header,
.ai-analysis-panel > .ai-analysis-header {
    position: relative;
}

.mg-corners {
    pointer-events: none;
}

/* Corner ticks via box shadows on key cards */
.panel,
.chart-container,
.affordability-banner,
.instructions-panel,
.ai-analysis-panel {
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.04),
        0 8px 28px rgba(0, 0, 0, 0.45);
}

.panel::after,
.chart-container::after {
    content: '';
    position: absolute;
    inset: 8px;
    width: auto !important;
    height: auto !important;
    max-width: none;
    border: 1px solid transparent;
    border-image: none;
    pointer-events: none;
    opacity: 0.9;
    background:
        linear-gradient(var(--micro-line-strong), var(--micro-line-strong)) top left / 10px 1px no-repeat,
        linear-gradient(var(--micro-line-strong), var(--micro-line-strong)) top left / 1px 10px no-repeat,
        linear-gradient(var(--micro-line-strong), var(--micro-line-strong)) top right / 10px 1px no-repeat,
        linear-gradient(var(--micro-line-strong), var(--micro-line-strong)) top right / 1px 10px no-repeat,
        linear-gradient(var(--micro-line-strong), var(--micro-line-strong)) bottom left / 10px 1px no-repeat,
        linear-gradient(var(--micro-line-strong), var(--micro-line-strong)) bottom left / 1px 10px no-repeat,
        linear-gradient(var(--micro-line-strong), var(--micro-line-strong)) bottom right / 10px 1px no-repeat,
        linear-gradient(var(--micro-line-strong), var(--micro-line-strong)) bottom right / 1px 10px no-repeat;
    z-index: 1;
}

/* Panel titles with geometric index tick */
.panel-title {
    gap: 12px;
}

.panel-title > span:first-child,
.panel-title > span:not(.u-flex-gap-12) {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.panel-title > span:first-child::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    transform: rotate(45deg);
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

/* Core metric micrographics */
.core-metric {
    gap: 4px;
}

.core-metric-label::before {
    content: '';
    display: block;
    width: 16px;
    height: 1px;
    margin: 0 auto 10px;
    background: var(--micro-line-strong);
}

.core-metric-value {
    position: relative;
}

.core-metric-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    margin-top: 4px;
}

.core-metric-status::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.core-metric-status.positive::before {
    background: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.45);
}

.core-metric-status.warning::before {
    background: rgba(255, 255, 255, 0.55);
}

.core-metric-status.negative::before {
    background: rgba(255, 120, 120, 0.9);
    box-shadow: 0 0 8px rgba(255, 80, 80, 0.35);
}

/* Mini metrics — trend as chip */
.mini-metric {
    position: relative;
}

.mini-metric-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mini-metric-label::before {
    content: '';
    width: 4px;
    height: 4px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transform: rotate(45deg);
}

.mini-metric-trend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.015);
    font-size: 0.6875rem !important;
}

.mini-metric-trend.positive {
    border-color: rgba(255, 255, 255, 0.22);
}

.mini-metric-trend.negative {
    border-color: rgba(255, 120, 120, 0.35);
    color: rgba(255, 160, 160, 0.95) !important;
}

/* Affordability header — status glyph */
.affordability-header {
    position: relative;
}

.affordability-header::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(280px, 60%);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--micro-line), transparent);
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

.affordability-title-section {
    position: relative;
    z-index: 1;
    gap: 12px;
}

.affordability-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.affordability-title::before {
    content: '';
    width: 7px;
    height: 7px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    transform: rotate(45deg);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

.affordability-banner.negative .affordability-title::before {
    border-color: rgba(255, 120, 120, 0.9);
    box-shadow: 0 0 12px rgba(255, 80, 80, 0.25);
}

/* Legend chips — geometric */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    justify-content: center;
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.015);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 6px;
    border: 1px solid transparent;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 0;
    position: relative;
}

.legend-color.income {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.legend-color.budget {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: inset 3px 3px 0 0 rgba(255, 255, 255, 0.2);
}

/* Chart titles */
.chart-title {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.chart-title::before {
    content: '';
    width: 6px;
    height: 6px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transform: rotate(45deg);
    flex-shrink: 0;
}

.chart-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--micro-line-strong), transparent 90%);
    min-width: 24px;
}

.chart-description {
    border-left: 1px solid var(--micro-line);
    padding-left: 14px;
    margin-left: 2px;
}

/* Payment estimate bar */
.payment-estimate {
    position: relative;
    overflow: hidden;
}

.payment-estimate::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(255,255,255,0.1));
}

.payment-estimate-value {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
    font-size: var(--num-display-size);
}

/* Summary cards micro mark */
.summary-card {
    position: relative;
    overflow: hidden;
}

.summary-card-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.summary-card-label::before {
    content: '';
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.35);
}

/* Status badges in table */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.1em;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 10px;
}

.badge::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
}

.badge-success::before {
    background: #fff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

.badge-danger::before {
    background: rgba(255, 120, 120, 0.95);
    box-shadow: 0 0 6px rgba(255, 80, 80, 0.4);
}

/* Buttons — thin geometric edge */
.btn {
    position: relative;
    letter-spacing: 0.08em;
}

.btn-secondary {
    border-color: rgba(255, 255, 255, 0.18);
}

.btn-secondary:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

/* Toggle switch — sharper monochrome */
.toggle-switch {
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toggle-switch.enabled {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.45);
}

/* Budget item diamond accent on income */
.budget-item.income-item {
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.1),
        0 6px 20px rgba(0, 0, 0, 0.4);
}

.budget-item.income-item .budget-item-name {
    letter-spacing: 0.06em;
}

/* Financial planning section header */
.financial-planning-title {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.financial-planning-title::before {
    content: '';
    width: 8px;
    height: 8px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    transform: rotate(45deg);
}

.financial-planning-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

/* Email bar micro style */
.hero-email-bar-label::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 8px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transform: rotate(45deg);
    vertical-align: middle;
}

/* Instructions */
.instructions-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.instructions-title > span::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 8px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    transform: rotate(45deg);
    vertical-align: 1px;
}

/* AI panel badge */
.coming-soon-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.coming-soon-badge::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
    animation: mgPulse 2.4s ease-in-out infinite;
}

@keyframes mgPulse {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
}

/* Pollinations key panel tick */
.pollinations-key-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pollinations-key-title::before {
    content: '';
    width: 6px;
    height: 6px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transform: rotate(45deg);
}

/* Table header hairline */
table thead th {
    position: relative;
    letter-spacing: 0.08em;
}

table tbody tr {
    transition: background 0.15s ease;
}

table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

/* Yearly savings coloring contrast */
table td.positive,
table strong.positive {
    color: rgba(255, 255, 255, 0.95);
}

table td.negative,
table strong.negative {
    color: rgba(255, 150, 150, 0.95);
}

/* Desktop-only: more side air on floating nav */
@media (min-width: 1280px) {
    .floating-nav {
        top: 28px;
    }

    .app-container {
        padding-top: clamp(36px, 4vw, 56px);
        /* Bottom matches rail rhythm into app-launch band */
        padding-bottom: clamp(40px, 5vw, 64px);
    }
}

/* ============================================
   APP LAUNCH + FOOTER
   Nested in .app-container → same width as panels.
   Centered compositions, equal side air.
   ============================================ */

/* —— App launch panel —— */
.app-launch-section {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background: transparent;
    border: none;
    position: relative;
    z-index: 1;
}

.app-launch-section::before {
    display: none;
}

/* Panel frame matches dashboard cards */
.app-launch-inner {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: clamp(28px, 3.5vw, 48px) clamp(24px, 3vw, 40px);
    box-sizing: border-box;
    display: grid;
    /* Fixed content tracks — centered as a unit (not stretched right) */
    grid-template-columns: minmax(0, 520px) auto;
    grid-template-areas:
        "copy visual"
        "stores stores";
    align-items: center;
    justify-content: center;
    justify-items: center;
    column-gap: clamp(32px, 4vw, 56px);
    row-gap: clamp(24px, 3vw, 32px);
    border: 1px solid var(--border);
    background:
        radial-gradient(ellipse 50% 70% at 50% 50%, rgba(255, 255, 255, 0.03) 0%, transparent 60%),
        rgba(255, 255, 255, 0.015);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
    z-index: 1;
}

.app-launch-copy {
    grid-area: copy;
}

.app-launch-visual {
    grid-area: visual;
}

.app-launch-stores {
    grid-area: stores;
    justify-self: stretch;
}

/* Top hairline like other panels */
.app-launch-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--micro-line-strong) 12%, var(--micro-line) 50%, var(--micro-line-strong) 88%, transparent 100%);
    pointer-events: none;
}

.app-launch-copy {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    max-width: 520px;
    width: 100%;
    justify-self: stretch;
}

.app-launch-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
}

.app-launch-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.55);
    animation: mgPulse 2.4s ease-in-out infinite;
}

.app-launch-title {
    margin: 0;
    font-family: 'Orbitron', 'Exo 2', sans-serif;
    font-size: clamp(1.5rem, 2.8vw, 2.25rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.15;
}

.app-launch-lede {
    margin: 0;
    max-width: 48ch;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: clamp(0.9rem, 1.2vw, 1rem);
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.62);
}

.app-launch-points {
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-launch-points li {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.72);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.45;
}

.app-launch-points li::before {
    content: '';
    width: 7px;
    height: 7px;
    margin-top: 0.35em;
    border: 1px solid rgba(255, 255, 255, 0.55);
    transform: rotate(45deg);
    flex-shrink: 0;
}

.app-launch-release {
    margin: 4px 0 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: 'JetBrains Mono', monospace;
}

.app-launch-release strong {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fff;
}

.app-launch-release span {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    letter-spacing: 0.04em;
}

.app-launch-signup {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
    width: 100%;
    max-width: 520px;
}

.app-launch-signup-form {
    display: grid;
    grid-template-columns: 1fr 1.2fr auto;
    gap: 8px;
    width: 100%;
    align-items: stretch;
}

.app-launch-signup-form .email-signup-input {
    margin: 0;
    min-width: 0;
    width: 100%;
}

.app-launch-signup-form .email-signup-button {
    white-space: nowrap;
    min-width: 0;
    padding-left: 16px;
    padding-right: 16px;
}

.app-launch-signup .email-signup-success {
    margin: 0;
    text-align: left;
}

.app-launch-stores {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding-top: clamp(16px, 2vw, 22px);
    border-top: 1px solid var(--border);
    box-sizing: border-box;
}

.app-launch-stores-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.app-launch-stores-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px 14px;
}

.footer-store-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    width: 148px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
    opacity: 0.95;
    transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    line-height: 0;
    box-sizing: border-box;
}

.footer-store-link:hover {
    opacity: 1;
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.06);
}

.footer-store-logo {
    display: block;
    height: 100%;
    width: 100%;
    max-width: none;
    object-fit: contain;
    object-position: center;
    border-radius: 0;
    filter: grayscale(0.1) brightness(1.05);
    padding: 6px 10px;
    box-sizing: border-box;
}

.app-launch-visual {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
    justify-self: center;
}

.app-launch-phone {
    width: 200px;
    aspect-ratio: 9 / 19;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 28px;
    background: #050505;
    box-shadow:
        0 20px 48px rgba(0, 0, 0, 0.65),
        inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    padding: 12px;
    position: relative;
    box-sizing: border-box;
}

.app-launch-phone-notch {
    width: 36%;
    height: 8px;
    margin: 4px auto 14px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.08);
}

.app-launch-phone-screen {
    height: calc(100% - 26px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background:
        radial-gradient(ellipse 80% 40% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 55%),
        #000;
    box-sizing: border-box;
}

.app-launch-phone-brand {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
}

.app-launch-phone-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.app-launch-phone-metric span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
}

.app-launch-phone-metric strong {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.04em;
}

.app-launch-phone-bar {
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.06));
    margin-top: auto;
}

.app-launch-phone-bar.short {
    width: 62%;
    margin-top: 0;
    opacity: 0.6;
}

/* —— Site footer panel —— */
.site-footer {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background: transparent;
    border: none;
    position: relative;
    z-index: 1;
}

.site-footer-inner {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.015);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.footer-app-strip {
    display: none;
}

.footer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) repeat(3, minmax(0, 1fr));
    gap: clamp(20px, 2.5vw, 32px);
    padding: clamp(24px, 3vw, 36px);
    width: 100%;
    box-sizing: border-box;
    border-bottom: 1px solid var(--border);
    margin: 0;
}

.footer-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.footer-brand {
    font-family: 'Orbitron', 'Exo 2', sans-serif;
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.2;
}

.footer-pitch {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text-tertiary);
    max-width: 32ch;
}

.footer-col-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-col-title::before {
    content: '';
    width: 5px;
    height: 5px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transform: rotate(45deg);
    flex-shrink: 0;
}

.footer-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-nav a {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s ease;
    width: fit-content;
}

.footer-nav a:hover {
    color: #fff;
}

.footer-social-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-social-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    padding: 4px 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.footer-social-btn:hover {
    color: #fff;
    border: none;
    background: transparent;
}

.footer-social-btn svg {
    flex-shrink: 0;
    opacity: 0.85;
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 20px;
    padding: 14px clamp(20px, 3vw, 36px);
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

.footer-copy,
.footer-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    line-height: 1.5;
}

.footer-copy a {
    color: var(--text-tertiary);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.footer-copy a:hover {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 900px) {
    .app-launch-inner {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "visual"
            "copy"
            "stores";
        gap: 28px;
        text-align: left;
        justify-items: center;
    }

    .app-launch-copy {
        max-width: 100%;
        width: 100%;
        justify-self: stretch;
    }

    .app-launch-visual {
        justify-self: center;
    }

    .app-launch-phone {
        width: min(180px, 48vw);
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .footer-col-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .app-launch-inner {
        padding: 22px 16px;
    }

    .app-launch-signup {
        max-width: none;
    }

    .app-launch-signup-form {
        grid-template-columns: 1fr;
    }

    .app-launch-signup-form .email-signup-button {
        width: 100%;
    }

    .app-launch-stores {
        justify-content: center;
    }

    .footer-store-logo {
        height: 36px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 20px 16px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        padding: 12px 16px;
    }
}
