/* MusicNumbers.io - Mobile-First Design System */

/* ============================================
   FONT STACK ALTERNATIVES FOR SUBTITLES
   ============================================
   
   CURRENT: Inter variable font with weight 500-600 for subtitles
   
   OPTION A - Optimize Inter (Currently Implemented):
   - font-weight: 500 (Medium) for subtitle/description text
   - letter-spacing: 0.01em for improved readability
   - Consider font-variation-settings: 'wght' 520 for fine control
   
   OPTION B - Alternative Font Stacks (Harmonize with Inter):
   
   1. Plus Jakarta Sans - Slightly friendlier, excellent for subtitles
      font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
      CDN: https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700
   
   2. DM Sans - Geometric, clean, pairs beautifully with Inter
      font-family: 'DM Sans', 'Inter', system-ui, sans-serif;
      CDN: https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700
   
   3. Outfit - Modern, slightly wider characters, great readability
      font-family: 'Outfit', 'Inter', system-ui, sans-serif;
      CDN: https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700
   
   4. Manrope - Excellent readability, slightly rounder, friendly
      font-family: 'Manrope', 'Inter', system-ui, sans-serif;
      CDN: https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700
   
   5. Space Grotesk - More distinctive, good contrast to Inter
      font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
      CDN: https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700
   
   IMPLEMENTATION TIPS:
   - Test on actual mobile devices at arm's length distance
   - Ensure minimum 14px for subtitle text on mobile
   - Use font-weight 500-600 for optimal readability
   - Test contrast ratios with chosen weights
   - Consider using different fonts for headings vs subtitles
   ============================================ */

/* ============================================
   MOBILE-FIRST CSS VARIABLES
   ============================================ */
:root {
    /* Colors - More vibrant gradient palette */
    --primary: #667EEA;
    --primary-dark: #5A67D8;
    --primary-light: #7F9CF5;
    --accent: #ED64A6;
    --accent-light: #F687B3;
    --gradient-start: #667EEA;
    --gradient-mid: #764BA2;
    --gradient-end: #F093FB;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    
    /* Text Colors */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-tertiary: #64748B;
    --text-inverse: #FFFFFF;
    
    /* Backgrounds */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8FAFC;
    --bg-tertiary: #F1F5F9;
    --bg-accent: linear-gradient(135deg, #667EEA 0%, #764BA2 50%, #F093FB 100%);
    --bg-accent-alt: linear-gradient(135deg, #667EEA 0%, #ED64A6 100%);
    --bg-gradient-subtle: linear-gradient(180deg, rgba(102, 126, 234, 0.05) 0%, rgba(237, 100, 166, 0.05) 100%);
    
    /* Borders */
    --border: #CBD5E1;
    --border-light: #E2E8F0;
    --border-focus: var(--primary);
    
    /* Mobile-First Sizing */
    --nav-height: 56px;
    --menu-width: 280px;
    --bottom-nav-height: 72px;
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Touch Targets (minimum 44px) */
    --touch-target: 48px;
    --touch-target-small: 44px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
}

/* ============================================
   SHARED PAGE COMPONENTS & LAYOUTS
   Consolidated from per-page styles for coherence
   ============================================ */

/* Home hero */
.hero-home {
    background:
        linear-gradient(135deg, rgba(102, 126, 234, 0.9) 0%, rgba(118, 75, 162, 0.9) 50%, rgba(240, 147, 251, 0.9) 100%),
        radial-gradient(at 20% 80%, #667EEA 0%, transparent 50%),
        radial-gradient(at 80% 20%, #ED64A6 0%, transparent 50%),
        radial-gradient(at 40% 40%, #764BA2 0%, transparent 50%),
        #667EEA;
    color: white;
    padding: var(--spacing-2xl) var(--spacing-md) var(--spacing-xl);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-home::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 20s infinite linear;
}

.hero-home::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(237, 100, 166, 0.2) 0%, transparent 60%);
    animation: shimmer 30s infinite linear reverse;
}

@keyframes shimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hero-home-badge { display: inline-block; background: rgba(255, 255, 255, 0.2); padding: 6px 12px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; margin-bottom: var(--spacing-md); position: relative; z-index: 1; }
.hero-home-title { font-size: 36px; font-weight: 800; margin-bottom: var(--spacing-sm); letter-spacing: -0.02em; position: relative; z-index: 1; }
.hero-home-subtitle { font-size: 18px; opacity: 0.95; line-height: 1.4; margin-bottom: var(--spacing-xl); position: relative; z-index: 1; font-weight: 500; letter-spacing: 0.01em; }

/* Home cards and features */
.calculator-grid { display: flex; flex-direction: column; gap: var(--spacing-md); padding: var(--spacing-lg) var(--spacing-md); }
.calculator-card { background: var(--bg-primary); border-radius: var(--radius-lg); padding: var(--spacing-lg); box-shadow: var(--shadow-md); text-decoration: none; color: var(--text-primary); transition: transform 0.2s, box-shadow 0.2s; }
.calculator-card:active { transform: scale(0.98); }
.calculator-card-icon { font-size: 32px; margin-bottom: var(--spacing-md); }
.calculator-card-title { font-size: 20px; font-weight: 700; margin-bottom: var(--spacing-sm); }
.calculator-card-description { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: var(--spacing-md); font-weight: 500; letter-spacing: 0.01em; }
.calculator-card-action { display: flex; align-items: center; gap: var(--spacing-xs); font-size: 14px; font-weight: 600; color: var(--primary); }

.features-section { padding: var(--spacing-xl) var(--spacing-md); background: var(--bg-secondary); }
.features-title { font-size: 24px; font-weight: 700; text-align: center; margin-bottom: var(--spacing-xl); }
.features-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--spacing-lg); }
.feature-item { text-align: center; }
.feature-icon { font-size: 32px; margin-bottom: var(--spacing-sm); }
.feature-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.feature-desc { font-size: 12px; color: var(--text-secondary); }

.coming-soon { background: var(--primary); color: white; padding: var(--spacing-lg); margin: var(--spacing-lg) var(--spacing-md); border-radius: var(--radius-lg); text-align: center; }
.coming-soon-title { font-size: 18px; font-weight: 700; margin-bottom: var(--spacing-sm); }
.coming-soon-desc { font-size: 14px; opacity: 0.95; }

@media (min-width: 768px) {
    .hero-home-title { font-size: 48px; }
    .calculator-grid { max-width: 768px; margin: 0 auto; }
    .features-grid { grid-template-columns: repeat(3, 1fr); max-width: 768px; margin: 0 auto; }
}

/* Spotify page components */
.quick-presets { display: flex; gap: 8px; overflow-x: auto; padding: 16px 0; -webkit-overflow-scrolling: touch; }
.preset-pill { flex-shrink: 0; padding: 8px 16px; background: var(--bg-secondary); border: 2px solid var(--border); border-radius: var(--radius-full); font-size: 14px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.preset-pill.active { background: var(--primary); color: white; border-color: var(--primary); }
.share-section { display: flex; gap: 12px; margin-top: 24px; }
.share-btn { flex: 1; padding: 12px; background: var(--bg-secondary); border: none; border-radius: var(--radius-md); font-size: 20px; display: flex; align-items: center; justify-content: center; }

/* Split page components */
.collaborator-card { background: var(--bg-secondary); border-radius: var(--radius-lg); padding: var(--spacing-md); margin-bottom: var(--spacing-md); position: relative; }
.collaborator-header { display: flex; align-items: center; gap: var(--spacing-sm); margin-bottom: var(--spacing-md); }
.collaborator-avatar { width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.collaborator-info { flex: 1; }
.collaborator-name { font-weight: 600; font-size: 16px; }
.collaborator-role { font-size: 12px; color: var(--text-tertiary); }
.collaborator-delete { position: absolute; top: 12px; right: 12px; width: 24px; height: 24px; background: var(--bg-primary); border-radius: var(--radius-full); border: none; color: var(--text-tertiary); font-size: 16px; display: flex; align-items: center; justify-content: center; }

.split-slider { width: 100%; height: 48px; -webkit-appearance: none; appearance: none; background: transparent; margin: var(--spacing-md) 0; }
.split-slider::-webkit-slider-track { width: 100%; height: 8px; background: var(--border); border-radius: var(--radius-full); }
.split-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 32px; height: 32px; background: var(--primary); border-radius: var(--radius-full); cursor: pointer; margin-top: -12px; box-shadow: var(--shadow-md); }

.split-display { display: flex; justify-content: space-between; align-items: center; }
.split-percentage { font-size: 24px; font-weight: 700; color: var(--primary); }
.split-amount { font-size: 18px; font-weight: 600; }

.add-collaborator-btn { width: 100%; padding: var(--spacing-lg); background: var(--bg-secondary); border: 2px dashed var(--border); border-radius: var(--radius-lg); font-size: 16px; font-weight: 600; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; gap: var(--spacing-sm); margin-bottom: var(--spacing-lg); }

.role-pills { display: flex; gap: var(--spacing-sm); flex-wrap: wrap; margin-bottom: var(--spacing-md); }
.role-pill { padding: 8px 16px; background: var(--bg-primary); border: 2px solid var(--border); border-radius: var(--radius-full); font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.role-pill.active { background: var(--primary); color: white; border-color: var(--primary); }

.pie-chart { width: 200px; height: 200px; margin: 0 auto var(--spacing-lg); }
.auto-split-toggle { display: flex; align-items: center; justify-content: space-between; padding: var(--spacing-md); background: var(--bg-tertiary); border-radius: var(--radius-md); margin-bottom: var(--spacing-lg); }
.toggle-switch { width: 48px; height: 28px; background: var(--border); border-radius: var(--radius-full); position: relative; transition: background 0.3s; }
.toggle-switch.active { background: var(--primary); }
.toggle-switch::after { content: ''; position: absolute; width: 24px; height: 24px; background: white; border-radius: var(--radius-full); top: 2px; left: 2px; transition: transform 0.3s; }
.toggle-switch.active::after { transform: translateX(20px); }

/* Recoupment page components */
.progress-ring { width: 200px; height: 200px; margin: 0 auto var(--spacing-lg); position: relative; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring-circle { fill: none; stroke: var(--border); stroke-width: 12; }
.progress-ring-progress { fill: none; stroke: var(--primary); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 0.5s; }
.progress-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.progress-percentage { font-size: 36px; font-weight: 800; color: var(--primary); }
.progress-label { font-size: 14px; color: var(--text-secondary); }

.deal-type-selector { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--spacing-sm); margin-bottom: var(--spacing-lg); }
.deal-type-card { padding: var(--spacing-md); background: var(--bg-secondary); border: 2px solid var(--border); border-radius: var(--radius-md); text-align: center; transition: all 0.2s; }
.deal-type-card.active { background: var(--primary); color: white; border-color: var(--primary); }
.deal-type-icon { font-size: 24px; margin-bottom: 4px; }
.deal-type-label { font-size: 14px; font-weight: 600; }

.timeline-container { padding: var(--spacing-lg) 0; position: relative; }
.timeline-line { position: absolute; left: 24px; top: 40px; bottom: 20px; width: 2px; background: var(--border); }
.timeline-item { display: flex; gap: var(--spacing-md); margin-bottom: var(--spacing-lg); position: relative; }
.timeline-dot { width: 16px; height: 16px; border-radius: var(--radius-full); background: var(--bg-primary); border: 3px solid var(--border); margin-top: 4px; z-index: 1; }
.timeline-dot.active { background: var(--primary); border-color: var(--primary); }
.timeline-content { flex: 1; }
.timeline-date { font-size: 12px; color: var(--text-tertiary); margin-bottom: 4px; }
.timeline-title { font-weight: 600; margin-bottom: 4px; }
.timeline-amount { font-size: 18px; font-weight: 700; color: var(--primary); }

.expense-item { display: flex; justify-content: space-between; align-items: center; padding: var(--spacing-md); background: var(--bg-secondary); border-radius: var(--radius-md); margin-bottom: var(--spacing-sm); }
.expense-label { font-size: 14px; color: var(--text-secondary); }
.expense-amount { font-weight: 600; color: var(--error); }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--spacing-md); margin-bottom: var(--spacing-lg); }
.stat-card { padding: var(--spacing-md); background: var(--bg-secondary); border-radius: var(--radius-md); text-align: center; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-tertiary); }

/* Content pages (Privacy, Terms, Data Sources) */
.content-page { padding: var(--spacing-lg) var(--spacing-md); max-width: 768px; margin: 0 auto; }
.content-title { font-size: 28px; font-weight: 800; margin-bottom: var(--spacing-sm); }
.content-subtitle { font-size: 16px; color: var(--text-secondary); margin-bottom: var(--spacing-xl); }
.content-section { margin-bottom: var(--spacing-xl); }
.content-section h2 { font-size: 20px; font-weight: 700; margin-bottom: var(--spacing-md); }
.content-section p { font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin-bottom: var(--spacing-md); }
.content-section ul { padding-left: 20px; margin-bottom: var(--spacing-md); }
.content-section li { font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin-bottom: var(--spacing-sm); }

.source-card { background: var(--bg-secondary); border-radius: var(--radius-lg); padding: var(--spacing-lg); margin-bottom: var(--spacing-md); }
.source-card h3 { font-size: 18px; font-weight: 700; margin-bottom: var(--spacing-sm); }
.source-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }
.update-badge { display: inline-block; background: var(--primary); color: white; padding: 4px 12px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; margin-bottom: var(--spacing-md); }
.legal-notice { background: var(--bg-secondary); padding: var(--spacing-lg); border-radius: var(--radius-lg); margin-bottom: var(--spacing-xl); }

/* Self-hosted Inter Variable font */
@font-face {
    font-family: 'Inter';
    src: url('/fonts/Inter-Variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ============================================
   RESET & BASE (MOBILE-FIRST)
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    /* Prevent iOS zoom on input focus */
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    /* Smooth scrolling on iOS */
    -webkit-font-smoothing: antialiased;
    -webkit-overflow-scrolling: touch;
    /* Account for bottom nav on mobile */
    padding-bottom: var(--bottom-nav-height);
}

/* ============================================
   MOBILE NAVIGATION (BOTTOM NAV)
   ============================================ */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-decoration: none;
    color: var(--text-tertiary);
    transition: color 0.2s;
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
    width: 24px;
    height: 24px;
    display: block;
}

.mobile-nav-icon svg {
    width: 24px;
    height: 24px;
}

.mobile-nav-label {
    font-size: 11px;
    font-weight: 600;
}

/* Top Bar for Mobile */
.top-bar {
    position: sticky;
    top: 0;
    height: var(--nav-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-md);
    z-index: 999;
}

.top-bar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.top-bar-action {
    width: var(--touch-target);
    height: var(--touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 20px;
}

/* ============================================
   MOBILE-FIRST HERO
   ============================================ */
.hero-mobile {
    padding: var(--spacing-lg) var(--spacing-md);
    background: var(--bg-secondary);
}

.hero-mobile-title {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.02em;
}

.hero-mobile-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: var(--spacing-lg);
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ============================================
   MOBILE CALCULATOR (IN HERO)
   ============================================ */
.calculator-mobile {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    margin: var(--spacing-md);
    box-shadow: var(--shadow-lg);
}

.calculator-mobile-header {
    margin-bottom: var(--spacing-lg);
}

.calculator-mobile-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.calculator-mobile-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============================================
   MOBILE-OPTIMIZED FORMS
   ============================================ */
.form-mobile {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.form-group-mobile {
    display: flex;
    flex-direction: column;
}

.form-label-mobile {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.form-input-mobile {
    height: var(--touch-target);
    padding: 0 var(--spacing-md);
    font-size: 16px; /* Prevents zoom on iOS */
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    transition: all 0.2s;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
}

.form-input-mobile:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(94, 58, 238, 0.1);
}

/* Large Number Input for Primary Values */
.form-input-hero {
    height: 64px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    border: 3px solid var(--primary);
    background: var(--bg-secondary);
}

/* Helper Text */
.form-helper-mobile {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: var(--spacing-xs);
}

/* ============================================
   MOBILE BUTTONS
   ============================================ */
.btn-mobile {
    min-height: var(--touch-target);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    width: 100%;
}

.btn-mobile-primary {
    background: var(--bg-accent);
    color: var(--text-inverse);
}

.btn-mobile-primary:active {
    transform: scale(0.98);
}

.btn-mobile-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--spacing-lg));
    right: var(--spacing-lg);
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--bg-accent);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-xl);
    font-size: 24px;
    z-index: 900;
}

/* ============================================
   MOBILE CARDS
   ============================================ */
.card-mobile {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-sm);
}

.card-mobile-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

/* ============================================
   MOBILE RESULTS DISPLAY
   ============================================ */
.results-mobile {
    background: var(--bg-accent);
    color: var(--text-inverse);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin: var(--spacing-md) 0;
    text-align: center;
}

.results-mobile-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: var(--spacing-xs);
}

.results-mobile-value {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: var(--spacing-sm);
}

.results-mobile-detail {
    font-size: 14px;
    opacity: 0.8;
}

/* ============================================
   MOBILE SEGMENTED CONTROL
   ============================================ */
.segmented-control {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: var(--spacing-lg);
}

.segmented-control-item {
    flex: 1;
    padding: var(--spacing-sm);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.segmented-control-item.active {
    background: var(--bg-primary);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   MOBILE LIST
   ============================================ */
.list-mobile {
    display: flex;
    flex-direction: column;
}

.list-mobile-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
    min-height: var(--touch-target);
}

.list-mobile-item:active {
    background: var(--bg-secondary);
}

/* ============================================
   MOBILE MODAL/SHEET
   ============================================ */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--spacing-lg);
    padding-bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom));
    box-shadow: var(--shadow-xl);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1001;
}

.bottom-sheet.active {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-full);
    margin: 0 auto var(--spacing-lg);
}

/* ============================================
   TABLET ADJUSTMENTS (768px+)
   ============================================ */
@media (min-width: 768px) {
    :root { --nav-height: 64px; }
    /* Keep layout simple on tablet: top-bar only, no top transform */
    body { padding-bottom: 0; }
    .mobile-nav { display: none; }
    .container-tablet { max-width: 768px; margin: 0 auto; padding: 0 var(--spacing-xl); }
    .hero-mobile-title { font-size: 36px; }
    .calculator-mobile { max-width: 600px; margin: var(--spacing-xl) auto; }
    .form-input-hero { height: 72px; font-size: 32px; }
    .results-mobile-value { font-size: 48px; }
    .grid-tablet { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--spacing-lg); }
}

/* ============================================
   DESKTOP ADJUSTMENTS (1024px+)
   ============================================ */
@media (min-width: 1024px) {
    .container-desktop {
        max-width: 1024px;
        margin: 0 auto;
    }
    
    /* Show top-bar on desktop */
    .top-bar {
        display: flex;
    }
    
    /* Further refine nav for desktop */
    .mobile-nav {
        display: none;
        gap: 48px;
    }
    
    .mobile-nav-item {
        padding: 0 20px;
    }
}

/* ============================================
   ACCESSIBILITY & INTERACTIONS
   ============================================ */
/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0F172A;
        --bg-secondary: #1E293B;
        --bg-tertiary: #334155;
        --text-primary: #F8FAFC;
        --text-secondary: #94A3B8;
        --text-tertiary: #64748B;
        --border: #475569;
        --border-light: #334155;
    }
    
    /* Fix input fields in dark mode */
    .form-input-mobile,
    .form-input-hero,
    input[type="number"],
    input[type="text"],
    input[type="email"],
    select,
    textarea {
        background: var(--bg-secondary);
        color: var(--text-primary);
        border-color: var(--border);
    }
    
    .form-input-mobile:focus,
    .form-input-hero:focus,
    input[type="number"]:focus,
    input[type="text"]:focus {
        border-color: var(--primary);
        background: var(--bg-tertiary);
    }
    
    /* Fix expense items in dark mode */
    .expense-item {
        background: var(--bg-secondary);
        color: var(--text-primary);
    }
    
    /* Fix cards and other components */
    .card-mobile,
    .stat-card,
    .deal-type-card {
        background: var(--bg-secondary);
        border-color: var(--border);
    }
    
    .deal-type-card.active {
        background: var(--primary);
        color: white;
    }
}