/* Pearl Brand Identity - Official Core Color Palette */
:root {
    /* Official Pearl Core Color Palette - WCAG AA Verified */
    --pearl-midnight: #0B1F30;    /* primary dark text & headers - Contrast ratio: 13.28:1 on pearl-ivory */
    --pearl-ivory: #F9F7F4;       /* primary light background */
    --champagne-accent: #D7B97F;  /* primary buttons/accents - Contrast ratio: 4.52:1 on pearl-midnight */
    --sage-mist: #C8D5CA;         /* secondary accents/surfaces */
    --slate-stone: #4E5A60;       /* secondary text & borders - Contrast ratio: 8.77:1 on pearl-ivory */
    --pearl-green: #2aa83d;
}


/* Accessibility - Visually Hidden Elements */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Minimal CSS Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'DM Sans', sans-serif;
    line-height: 1.6;
    color: var(--pearl-midnight);
    background: linear-gradient(135deg, var(--pearl-ivory) 0%, #f5f3f0 100%);
    min-height: 100vh;
    padding-top: 64px; /* Account for fixed header */
}

/* Focus Management for Accessibility */
*:focus {
    outline: 2px solid var(--champagne-accent);
    outline-offset: 2px;
}

/* Enhanced focus styles for interactive elements */
button:focus,
a:focus,
[tabindex]:focus {
    outline: 2px solid var(--champagne-accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(215, 185, 127, 0.3);
}

/* Canvas focus styles for keyboard navigation */
canvas:focus {
    outline: 3px solid var(--champagne-accent);
    outline-offset: 3px;
}

h3 {
    margin-bottom: 10px;
}

.text-sm {
    font-size: 0.9rem;
}

.text-xs {
    font-size: 0.85rem;
}

.perf-green {
    font-weight: 700;
    color: var(--pearl-green);
}

/* Remove focus outline when using mouse but keep for keyboard */
.js-focus-visible *:focus:not(.focus-visible) {
    outline: none;
}

/* Skip to main content link for screen readers */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--pearl-midnight);
    color: var(--pearl-ivory);
    padding: 8px;
    text-decoration: none;
    z-index: 1001;
    border-radius: 4px;
}

.skip-to-main:focus {
    top: 6px;
}

/* Header Component */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background: rgba(11, 31, 48, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(11, 31, 48, 0.12);
    border-bottom: 1px solid rgba(215, 185, 127, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.back {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pearl-ivory);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) translateX(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.logo {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--pearl-ivory);
    font-size: 1.75rem;
}

/* Base styles for mobile-first approach */
html {
    font-size: 16px;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

a {
    text-decoration: none;
    color: inherit;
}

ul,
ol {
    list-style: none;
}

/* Home Screen Styles - Task 3 */
.home-content {
    padding: 32px 20px 40px;
    max-width: 428px;
    margin: 0 auto;
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

/* Card Base Styles */
.account-card,
.savings-card {
    background: linear-gradient(135deg, #ffffff 0%, var(--sage-mist) 100%);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(11, 31, 48, 0.08),
                0 4px 16px rgba(11, 31, 48, 0.04);
    border: 1px solid rgba(215, 185, 127, 0.1);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.account-card::before,
.savings-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--champagne-accent), transparent);
    opacity: 0.6;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--pearl-midnight);
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: 0.01em;
}

/* Account Card Specific Styles */
.account-card .balance {
    background: transparent;
    border-radius: 16px;
    padding: 24px 20px;
    margin-bottom: 20px;
    box-shadow: 0 6px 20px rgba(11, 31, 48, 0.06);
    border: 1px solid rgba(215, 185, 127, 0.15);
}

.account-card .ai-summary {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(215, 185, 127, 0.1);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    text-align: center;
    filter: drop-shadow(0 2px 4px rgba(215, 185, 127, 0.4)) 
            drop-shadow(0 0 8px rgba(215, 185, 127, 0.3));
    text-shadow: 1px 1px 2px rgba(11, 31, 48, 0.2);
    animation: sparkle 3.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

@keyframes sparkle {
    0% {
        opacity: 0.8;
        transform: scale(1);
        filter: drop-shadow(0 2px 4px rgba(215, 185, 127, 0.3)) 
                drop-shadow(0 0 6px rgba(215, 185, 127, 0.2));
    }
    15% {
        opacity: 0.85;
        transform: scale(1.01);
        filter: drop-shadow(0 2px 5px rgba(215, 185, 127, 0.35)) 
                drop-shadow(0 0 8px rgba(215, 185, 127, 0.25));
    }
    30% {
        opacity: 0.95;
        transform: scale(1.03);
        filter: drop-shadow(0 2px 5px rgba(215, 185, 127, 0.4)) 
                drop-shadow(0 0 10px rgba(215, 185, 127, 0.3))
                drop-shadow(0 0 15px rgba(215, 185, 127, 0.15));
    }
    50% {
        opacity: 1;
        transform: scale(1.04);
        filter: drop-shadow(0 2px 6px rgba(215, 185, 127, 0.5)) 
                drop-shadow(0 0 12px rgba(215, 185, 127, 0.4))
                drop-shadow(0 0 18px rgba(215, 185, 127, 0.2));
    }
    70% {
        opacity: 0.95;
        transform: scale(1.02);
        filter: drop-shadow(0 2px 5px rgba(215, 185, 127, 0.4)) 
                drop-shadow(0 0 10px rgba(215, 185, 127, 0.3));
    }
    85% {
        opacity: 0.85;
        transform: scale(1.01);
        filter: drop-shadow(0 2px 4px rgba(215, 185, 127, 0.35)) 
                drop-shadow(0 0 8px rgba(215, 185, 127, 0.25));
    }
    100% {
        opacity: 0.8;
        transform: scale(1);
        filter: drop-shadow(0 2px 4px rgba(215, 185, 127, 0.3)) 
                drop-shadow(0 0 6px rgba(215, 185, 127, 0.2));
    }
}

.account-card .ai-summary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(11, 31, 48, 0.08);
}

.account-card .ai-summary p {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--pearl-midnight);
    margin: 0;
}

.account-card .ai-summary strong {
    color: var(--pearl-midnight);
    font-weight: 700;
}

.account-card .nav-button-container {
    margin-top: 8px;
}

.balance {
    background: linear-gradient(135deg, #ffffff 0%, var(--sage-mist) 100%);
    border-radius: 20px;
    padding: 32px 24px 28px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: 0 12px 40px rgba(11, 31, 48, 0.08),
                0 4px 16px rgba(11, 31, 48, 0.04);
    border: 1px solid rgba(215, 185, 127, 0.1);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.balance::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--champagne-accent), transparent);
    opacity: 0.6;
}

.balance:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 50px rgba(11, 31, 48, 0.12),
                0 8px 24px rgba(11, 31, 48, 0.08);
}

.account-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--slate-stone);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.balance-amt {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--pearl-midnight);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}

/* Savings Plan Card Styles */
.savings-card {
    animation-delay: 0.2s;
}

.savings-input-section {
    margin-bottom: 24px;
}

.savings-label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--pearl-midnight);
    margin-bottom: 12px;
    letter-spacing: 0.01em;
}

.savings-input-container {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(215, 185, 127, 0.2);
    border-radius: 12px;
    padding: 0 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 8px;
}

.savings-input-container:focus-within {
    border-color: var(--champagne-accent);
    box-shadow: 0 0 0 3px rgba(215, 185, 127, 0.2);
    background: rgba(255, 255, 255, 0.95);
}

.currency-symbol {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--slate-stone);
    margin-right: 4px;
}

.savings-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--pearl-midnight);
    padding: 16px 0;
    outline: none;
    width: 100%;
}

.savings-input::placeholder {
    color: var(--slate-stone);
    opacity: 0.6;
}

.savings-description {
    font-size: 0.875rem;
    color: var(--slate-stone);
    opacity: 0.8;
    text-align: center;
}

.savings-chart-section {
    margin-bottom: 24px;
}

.chart-container {
    position: relative;
    height: 200px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(215, 185, 127, 0.1);
}

#savingsChart {
    max-height: 100%;
}

.projected-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(215, 185, 127, 0.1);
}

.projected-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--slate-stone);
    margin-bottom: 4px;
}

.projected-amount {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--pearl-midnight);
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

.breakdown {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid rgba(215, 185, 127, 0.2);
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.breakdown-label {
    font-size: 0.8125rem;
    color: var(--slate-stone);
    opacity: 0.8;
    margin-right: 4px;
}

.breakdown-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--pearl-midnight);
}

.savings-actions {
    text-align: center;
}

.update-savings-btn {
    background: linear-gradient(135deg, var(--pearl-midnight) 0%, #0a1b2a 100%);
    color: var(--pearl-ivory);
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.5;
    transform: scale(0.95);
    width: 100%;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.update-savings-btn:not(:disabled) {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 8px 24px rgba(11, 31, 48, 0.3);
}

.update-savings-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.update-savings-btn:not(:disabled):hover::before {
    left: 100%;
}

.update-savings-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(11, 31, 48, 0.35),
                0 6px 16px rgba(11, 31, 48, 0.2);
    background: linear-gradient(135deg, #0e2538 0%, var(--pearl-midnight) 100%);
}

.update-savings-btn:not(:disabled):active {
    transform: translateY(0) scale(0.98);
}

.update-savings-btn:disabled {
    cursor: not-allowed;
    background: var(--slate-stone);
    color: var(--sage-mist);
}

/* Animation for button state change */
.update-savings-btn.changed {
    animation: buttonHighlight 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes buttonHighlight {
    0% {
        transform: scale(0.95);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Navigation Button - Task 4 */
.nav-button-container {
    margin-top: 32px;
    text-align: center;
}

.view-performance-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--pearl-midnight) 0%, #0a1b2a 100%);
    color: var(--pearl-ivory);
    padding: 16px 32px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 1.0625rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(11, 31, 48, 0.25),
                0 4px 12px rgba(11, 31, 48, 0.15);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.view-performance-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-performance-btn:hover::before {
    left: 100%;
}

.view-performance-btn:hover {
    background: linear-gradient(135deg, #0e2538 0%, var(--pearl-midnight) 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(11, 31, 48, 0.35),
                0 6px 16px rgba(11, 31, 48, 0.2);
}

.view-performance-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(11, 31, 48, 0.3),
                0 4px 12px rgba(11, 31, 48, 0.15);
}

/* Account Details Screen - Task 5 */
.account-content {
    padding: 32px 20px 40px;
    max-width: 428px;
    margin: 0 auto;
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-section {
    height: 65vh;
    text-align: center;
    min-height: 380px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #ffffff 0%, rgba(249, 247, 244, 0.8) 100%);
    border-radius: 20px;
    padding: 24px 20px 32px;
    box-shadow: 0 12px 40px rgba(11, 31, 48, 0.08),
                0 4px 16px rgba(11, 31, 48, 0.04);
    border: 1px solid rgba(215, 185, 127, 0.1);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--champagne-accent) 50%, transparent 100%);
    opacity: 0.4;
}

.chart-section:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 48px rgba(11, 31, 48, 0.12),
                0 8px 24px rgba(11, 31, 48, 0.06);
}

.chart-section .section-heading {
    margin-bottom: 20px;
    margin-top: 0;
}

#perfChart {
    width: 100% !important;
    height: calc(100% - 60px) !important;
    margin-bottom: 4px;
}

.period-tabs {
    display: flex;
    background: rgba(200, 213, 202, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 6px;
    margin-bottom: 40px;
    gap: 4px;
    border: 1px solid rgba(215, 185, 127, 0.15);
    box-shadow: 0 4px 16px rgba(11, 31, 48, 0.04);
}

.tab-btn {
    flex: 1;
    padding: 14px 12px;
    border: none;
    background: transparent;
    color: var(--slate-stone);
    font-weight: 500;
    font-size: 0.9375rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    letter-spacing: 0.01em;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--champagne-accent) 0%, #c5a572 100%);
    color: var(--pearl-midnight);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(215, 185, 127, 0.3);
    transform: translateY(-1px);
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.6);
    color: var(--pearl-midnight);
    transform: translateY(-0.5px);
}

.allocation-section {
    text-align: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(200, 213, 202, 0.4) 100%);
    border-radius: 20px;
    padding: 32px 24px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(215, 185, 127, 0.1);
    box-shadow: 0 8px 32px rgba(11, 31, 48, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.allocation-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--champagne-accent) 50%, transparent 100%);
    opacity: 0.3;
}

.allocation-section:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 40px rgba(11, 31, 48, 0.08);
}

.section-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--pearl-midnight);
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, var(--pearl-midnight) 0%, var(--slate-stone) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.allocation-chart-container {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

#allocChart {
    max-width: 240px;
    max-height: 240px;
}

.allocation-labels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.label-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.9375rem;
    padding: 12px 12px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(215, 185, 127, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    min-width: 0;
    min-height: 54px;
}

.label-item:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(11, 31, 48, 0.08);
}

.color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

.ticker-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    justify-content: center;
    min-width: 0;
}

.ticker {
    font-weight: 600;
    color: var(--pearl-midnight);
    text-align: left;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.ticker-subtitle {
    font-size: 0.72rem;
    color: var(--slate-stone);
    font-weight: 400;
    line-height: 1.3;
    opacity: 0.8;
    text-align: left;
}

.percentage {
    color: var(--slate-stone);
    font-weight: 600;
    margin-left: auto;
    margin-top: 2px;
    line-height: 1.2;
    flex-shrink: 0;
    font-size: 0.8125rem;
    white-space: nowrap;
}

/* Responsive design for small screens */
@media (max-width: 390px) {
    body {
        padding-top: 60px;
    }
    
    header {
        height: 60px;
    }
    
    .home-content,
    .account-content {
        padding: 24px 16px 32px;
        gap: 20px;
    }
    
    .balance-amt {
        font-size: 2rem;
    }
    
    .balance,
    .chart-section,
    .allocation-section {
        padding: 24px 20px;
        border-radius: 16px;
    }
    
    .view-performance-btn {
        padding: 14px 24px;
        font-size: 0.9375rem;
    }
    
    .chart-section {
        height: 320px;
        min-height: 320px;
        padding: 20px 16px 28px;
    }
    
    .chart-section .section-heading {
        font-size: 1.25rem;
        margin-bottom: 16px;
        text-align: center;
    }
    
    .period-tabs {
        gap: 8px;
        padding: 0 4px;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 0.8125rem;
    }
    
    .allocation-section {
        padding: 20px 16px;
    }
    
    .section-heading {
        font-size: 1.125rem;
        margin-bottom: 16px;
        text-align: center;
    }
    
    .allocation-labels {
        gap: 8px;
        max-width: 420px;
    }
    
    .label-item {
        padding: 10px 12px;
        font-size: 0.8125rem;
        gap: 8px;
        min-height: 50px;
    }

    .ticker-subtitle {
        font-size: 0.7rem;
        line-height: 1.25;
    }
    
    .percentage {
        font-size: 0.75rem;
    }

    .color-dot {
        width: 8px;
        height: 8px;
        margin-top: 1px;
    }
    
    .back {
        left: 12px;
        padding: 4px 8px;
        font-size: 0.875rem;
        height: 28px;
        border-radius: 6px;
    }
    
    /* Card responsive styles */
    .account-card,
    .savings-card {
        padding: 20px;
        border-radius: 16px;
        gap: 16px;
    }
    
    .card-title {
        font-size: 1rem;
        margin-bottom: 16px;
    }
    
    .account-card .balance {
        padding: 20px 16px;
        margin-bottom: 16px;
    }
    
    .account-card .ai-summary {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .account-card .ai-summary p {
        font-size: 0.875rem;
    }
    
    .ai-icon {
        font-size: 1.25rem;
        margin-bottom: 10px;
    }
    
    /* Savings plan responsive styles */
    .savings-input-section {
        margin-bottom: 20px;
    }
    
    .savings-label {
        font-size: 0.875rem;
        margin-bottom: 10px;
    }
    
    .savings-input-container {
        padding: 0 14px;
    }
    
    .savings-input {
        font-size: 1rem;
        padding: 14px 0;
    }
    
    .currency-symbol {
        font-size: 1rem;
    }
    
    .savings-description {
        font-size: 0.8125rem;
    }
    
    .chart-container {
        height: 180px;
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .projected-total {
        padding: 12px;
    }
    
    .projected-label {
        font-size: 0.8125rem;
    }
    
    .projected-amount {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    
    .breakdown-label {
        font-size: 0.75rem;
    }
    
    .breakdown-value {
        font-size: 0.8125rem;
    }
    
    .update-savings-btn {
        padding: 14px 24px;
        font-size: 0.9375rem;
    }
}

/* Extra small screens (iPhone SE, small Android phones) */
@media (max-width: 360px) {
    .allocation-labels {
        max-width: 100%;
        gap: 6px;
        grid-template-columns: 1fr 1fr;
    }
    
    .label-item {
        padding: 8px 8px;
        gap: 6px;
        min-height: 48px;
        border-radius: 8px;
        font-size: 0.75rem;
    }
    
    .ticker-info {
        min-width: 0;
        overflow: hidden;
        flex: 1;
    }
    
    .ticker {
        font-size: 0.75rem;
        line-height: 1.1;
        font-weight: 700;
        letter-spacing: 0.01em;
    }
    
    .ticker-subtitle {
        font-size: 0.62rem;
        line-height: 1.2;
        opacity: 0.9;
    }
    
    .percentage {
        font-size: 0.7rem;
        min-width: 26px;
        font-weight: 700;
        flex-shrink: 0;
    }
    
    .color-dot {
        width: 6px;
        height: 6px;
        margin-top: 3px;
        flex-shrink: 0;
    }
}

/* Ultra small screens (very narrow phones in portrait) */
@media (max-width: 320px) {
    .allocation-labels {
        grid-template-columns: 1fr;
        gap: 2px;
    }
    
    .label-item {
        padding: 8px 6px;
        min-height: 44px;
    }
    
    .ticker-subtitle {
        font-size: 0.6rem;
        line-height: 1.15;
    }
    
    .percentage {
        min-width: 30px;
    }
}

/* Modern scroll behavior and styling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(200, 213, 202, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--champagne-accent) 0%, #c5a572 100%);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #c5a572 0%, var(--champagne-accent) 100%);
}

/* Subtle motion preference respect */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .ai-icon {
        animation: none !important;
        transform: none !important;
    }
}

/* Dark mode considerations */
@media (prefers-color-scheme: dark) {
    :root {
        /* Adjust for dark mode if needed in future */
        --pearl-ivory-dark: #1a1a1a;
        --pearl-midnight-dark: #f0f0f0;
    }
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
    .balance:hover,
    .ai-summary:hover,
    .view-performance-btn:hover,
    .chart-section:hover,
    .allocation-section:hover,
    .label-item:hover,
    .tab-btn:hover:not(.active) {
        transform: none;
    }
    
    /* Slightly larger touch targets for mobile */
    .tab-btn {
        min-height: 44px;
    }
    
    .view-performance-btn {
        min-height: 48px;
    }
    
    .back {
        min-height: 36px;
        min-width: 36px;
    }
} 