/* ============================================
   SimuImmo - Investissement Immobilier
   Premium Design System v2.0
   ============================================ */

/* Font Import - Distinctive typography choices */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600&family=Source+Sans+3:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ============================================
   CSS Custom Properties - Design Tokens
   ============================================ */
:root {
    /* Typography */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;
    
    /* Font Sizes - Fluid Typography Scale */
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;
    --text-3xl: 2.25rem;
    
    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    
    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 400ms;
}

/* Dark Theme (Default) - Deep Navy & Emerald Accent */
:root,
[data-theme="dark"] {
    /* Background Colors - Deep Navy */
    --color-bg-base: #0c1117;
    --color-bg-subtle: #131a23;
    --color-bg-muted: #1a2433;
    --color-bg-elevated: #1f2937;
    --color-bg-input: #0f151d;
    
    /* Border Colors */
    --color-border-subtle: rgba(255, 255, 255, 0.06);
    --color-border-default: rgba(255, 255, 255, 0.1);
    --color-border-emphasis: rgba(255, 255, 255, 0.15);
    
    /* Text Colors */
    --color-text-primary: #f1f5f9;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;
    --color-text-inverse: #0c1117;
    
    /* Accent Colors - Emerald & Amber */
    --color-accent: #10b981;
    --color-accent-hover: #34d399;
    --color-accent-subtle: rgba(16, 185, 129, 0.12);
    --color-accent-muted: rgba(16, 185, 129, 0.08);
    
    --color-secondary: #f59e0b;
    --color-secondary-subtle: rgba(245, 158, 11, 0.12);
    
    /* Semantic Colors */
    --color-success: #22c55e;
    --color-success-subtle: rgba(34, 197, 94, 0.12);
    --color-warning: #eab308;
    --color-warning-subtle: rgba(234, 179, 8, 0.12);
    --color-danger: #ef4444;
    --color-danger-subtle: rgba(239, 68, 68, 0.12);
    --color-info: #3b82f6;
    --color-info-subtle: rgba(59, 130, 246, 0.12);
    
    /* Gradients */
    --gradient-accent: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-secondary: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-surface: linear-gradient(180deg, var(--color-bg-muted) 0%, var(--color-bg-subtle) 100%);
    --gradient-glow: radial-gradient(ellipse at 30% 0%, rgba(16, 185, 129, 0.15) 0%, transparent 50%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 24px rgba(16, 185, 129, 0.2);
    
    /* Chart Colors */
    --chart-grid: rgba(255, 255, 255, 0.06);
    --chart-text: #64748b;
    --chart-positive: #22c55e;
    --chart-negative: #ef4444;
    --chart-neutral: #94a3b8;
}

/* Light Theme - Warm Stone & Emerald */
[data-theme="light"] {
    /* Background Colors */
    --color-bg-base: #fafaf9;
    --color-bg-subtle: #ffffff;
    --color-bg-muted: #f5f5f4;
    --color-bg-elevated: #ffffff;
    --color-bg-input: #ffffff;
    
    /* Border Colors */
    --color-border-subtle: rgba(0, 0, 0, 0.05);
    --color-border-default: rgba(0, 0, 0, 0.1);
    --color-border-emphasis: rgba(0, 0, 0, 0.15);
    
    /* Text Colors */
    --color-text-primary: #1c1917;
    --color-text-secondary: #57534e;
    --color-text-muted: #a8a29e;
    --color-text-inverse: #fafaf9;
    
    /* Accent Colors */
    --color-accent: #059669;
    --color-accent-hover: #047857;
    --color-accent-subtle: rgba(5, 150, 105, 0.1);
    --color-accent-muted: rgba(5, 150, 105, 0.05);
    
    --color-secondary: #d97706;
    --color-secondary-subtle: rgba(217, 119, 6, 0.1);
    
    /* Semantic Colors */
    --color-success: #16a34a;
    --color-success-subtle: rgba(22, 163, 74, 0.1);
    --color-warning: #ca8a04;
    --color-warning-subtle: rgba(202, 138, 4, 0.1);
    --color-danger: #dc2626;
    --color-danger-subtle: rgba(220, 38, 38, 0.1);
    --color-info: #2563eb;
    --color-info-subtle: rgba(37, 99, 235, 0.1);
    
    /* Gradients */
    --gradient-accent: linear-gradient(135deg, #059669 0%, #047857 100%);
    --gradient-secondary: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    --gradient-surface: linear-gradient(180deg, #ffffff 0%, #fafaf9 100%);
    --gradient-glow: radial-gradient(ellipse at 30% 0%, rgba(5, 150, 105, 0.08) 0%, transparent 50%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 24px rgba(5, 150, 105, 0.15);
    
    /* Chart Colors */
    --chart-grid: rgba(0, 0, 0, 0.06);
    --chart-text: #78716c;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 400;
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-bg-base);
    background-image: var(--gradient-glow);
    background-attachment: fixed;
    min-height: 100vh;
}

/* ============================================
   App Container & Layout
   ============================================ */
.app-container {
    max-width: 1680px;
    margin: 0 auto;
    padding: var(--space-4);
}

@media (min-width: 768px) {
    .app-container {
        padding: var(--space-6);
    }
}

/* ============================================
   Header Component
   ============================================ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
    margin-bottom: var(--space-6);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(12px);
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    background: var(--gradient-accent);
    border-radius: var(--radius-md);
    color: var(--color-text-inverse);
}

.logo-text {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: var(--space-1);
    padding: var(--space-1);
    background: var(--color-bg-muted);
    border-radius: var(--radius-lg);
}

.nav-tab {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    padding: var(--space-2) var(--space-5);
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.nav-tab:hover {
    color: var(--color-text-secondary);
    background: var(--color-bg-elevated);
}

.nav-tab.active {
    color: var(--color-text-inverse);
    background: var(--gradient-accent);
    box-shadow: var(--shadow-sm);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    background: var(--color-bg-muted);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.action-btn:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-elevated);
    border-color: var(--color-border-default);
}

.action-btn.saved {
    color: var(--color-success);
    background: var(--color-success-subtle);
    border-color: transparent;
}

.action-btn span {
    font-size: 1rem;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-bg-muted);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.theme-toggle:hover {
    background: var(--color-bg-elevated);
    border-color: var(--color-accent);
}

.theme-icon {
    font-size: 1.125rem;
    transition: transform var(--duration-base) var(--ease-out);
}

.theme-icon.light { display: none; }
.theme-icon.dark { display: block; }

[data-theme="light"] .theme-icon.light { display: block; }
[data-theme="light"] .theme-icon.dark { display: none; }

/* ============================================
   Property Bar Component
   ============================================ */
.property-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-6);
    padding: var(--space-6) var(--space-8);
    margin-bottom: var(--space-6);
    background: var(--color-accent-muted);
    border: 1px solid var(--color-accent-subtle);
    border-radius: var(--radius-xl);
}

.property-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.property-title {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 500;
    color: var(--color-text-primary);
}

.editable-title,
.surface-input {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    background: transparent;
    border: none;
    border-bottom: 1px dashed var(--color-border-default);
    padding: 0;
    outline: none;
    transition: border-color var(--duration-fast) var(--ease-out);
}

.editable-title {
    min-width: 200px;
    max-width: 300px;
}

.surface-input {
    width: 60px;
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    color: var(--color-accent);
    text-align: right;
}

.editable-title:focus,
.surface-input:focus {
    border-color: var(--color-accent);
}

.property-location {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-base);
    color: var(--color-text-secondary);
}

.location-input,
.postal-input {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: transparent;
    border: none;
    border-bottom: 1px dashed transparent;
    padding: 0;
    outline: none;
}

.location-input { width: 100px; }
.postal-input { width: 50px; }

.location-input:focus,
.postal-input:focus {
    border-color: var(--color-border-default);
}

/* Key Metrics */
.key-metrics {
    display: flex;
    gap: var(--space-8);
}

.metric {
    text-align: right;
}

.metric-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-1);
}

.metric-value {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-weight: 500;
    color: var(--color-text-primary);
}

.metric.highlight .metric-value {
    color: var(--color-accent);
}

.metric-value.positive { color: var(--color-success); }
.metric-value.negative { color: var(--color-danger); }

/* ============================================
   Main Content Layout
   ============================================ */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
}

@media (min-width: 1200px) {
    .main-content {
        grid-template-columns: minmax(400px, 1fr) minmax(500px, 1.3fr);
    }
}

.input-column,
.results-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

/* ============================================
   Card Component
   ============================================ */
.card {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--duration-base) var(--ease-out);
}

.card:hover {
    border-color: var(--color-border-default);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    background: var(--gradient-surface);
    border-bottom: 1px solid var(--color-border-subtle);
}

.card-header h2 {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 500;
    color: var(--color-text-primary);
}

.card-content {
    padding: var(--space-6);
}

/* Badge Components */
.total-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    background: var(--color-bg-muted);
    border-radius: var(--radius-md);
}

.total-badge span {
    font-weight: 500;
    color: var(--color-accent);
}

.regime-badge {
    padding: var(--space-1) var(--space-3);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-inverse);
    background: var(--gradient-secondary);
    border-radius: var(--radius-sm);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Duration Selector */
.duration-selector {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.duration-selector label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--color-text-muted);
}

.duration-selector select {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    padding: var(--space-1) var(--space-2);
    padding-right: 24px;
}

/* ============================================
   Form Controls
   ============================================ */
.input-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

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

.input-group.full-width {
    grid-column: span 2;
}

.input-group label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
}

/* Input with Unit */
.input-with-unit {
    display: flex;
    align-items: stretch;
    background: var(--color-bg-input);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--duration-fast) var(--ease-out);
}

.input-with-unit:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

.input-with-unit input {
    flex: 1;
    min-width: 0;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-mono);
    font-size: var(--text-base);
    color: var(--color-text-primary);
    background: transparent;
    border: none;
    outline: none;
}

.input-with-unit .unit {
    display: flex;
    align-items: center;
    padding: 0 var(--space-3);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    background: var(--color-bg-muted);
    white-space: nowrap;
}

/* Select */
select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    padding-right: 36px;
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--color-text-primary);
    background: var(--color-bg-input);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all var(--duration-fast) var(--ease-out);
}

select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

select option {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-accent);
    cursor: pointer;
}

/* Subsection Title */
.subsection-title {
    margin-top: var(--space-6);
    margin-bottom: var(--space-4);
    padding-top: var(--space-5);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border-subtle);
}

.subsection-title:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* Calculated Value Display */
.calculated-value {
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-mono);
    font-size: var(--text-base);
    color: var(--color-secondary);
    background: var(--color-bg-muted);
    border-radius: var(--radius-md);
}

/* Loan Summary */
.loan-summary {
    display: flex;
    gap: var(--space-8);
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border-subtle);
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.summary-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.summary-value {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-weight: 500;
    color: var(--color-accent);
}

/* ============================================
   Depreciation Items (Works Section)
   ============================================ */
.depreciation-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border-subtle);
}

.depreciation-item:last-of-type {
    border-bottom: none;
}

.depreciation-item > label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
}

.depreciation-inputs {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.depreciation-text {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    white-space: nowrap;
}

.input-with-unit.compact {
    width: auto;
    min-width: 90px;
}

.input-with-unit.compact input {
    width: 60px;
    padding: var(--space-2) var(--space-2);
    font-size: var(--text-sm);
}

.input-with-unit.compact .unit {
    padding: 0 var(--space-2);
    font-size: var(--text-xs);
}

.works-amount { width: 70px !important; }
.works-years { width: 40px !important; text-align: center; }

.works-total-bar {
    margin-top: var(--space-5);
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    background: var(--color-bg-muted);
    border-radius: var(--radius-lg);
    text-align: center;
}

.works-total-bar strong {
    margin-left: var(--space-2);
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--color-accent);
}

/* ============================================
   Summary Cards
   ============================================ */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

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

.summary-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    transition: all var(--duration-base) var(--ease-out);
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.summary-card.highlight-card {
    background: var(--color-accent-subtle);
    border-color: var(--color-accent-subtle);
}

.summary-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
    background: var(--color-bg-muted);
    border-radius: var(--radius-md);
}

.rent-icon { color: var(--color-success); }
.charges-icon { color: var(--color-danger); }
.cashflow-icon { 
    color: var(--color-accent); 
    background: var(--color-accent-subtle);
}

.summary-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.summary-title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.summary-amount {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 500;
    color: var(--color-text-primary);
}

.highlight-card .summary-amount {
    color: var(--color-accent);
}

/* ============================================
   Charts Section
   ============================================ */
.charts-section .card-content {
    padding: var(--space-5);
}

.chart-container {
    position: relative;
    height: 260px;
    width: 100%;
}

.chart-container.large {
    height: 340px;
}

/* ============================================
   Forecast Table
   ============================================ */
.table-section {
    overflow: visible;
}

.table-wrapper {
    overflow-x: auto;
    margin: 0 calc(-1 * var(--space-6));
    padding: 0 var(--space-6);
}

.forecast-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--text-sm);
}

.forecast-table thead th {
    position: sticky;
    top: 0;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: right;
    color: var(--color-text-muted);
    background: var(--color-bg-muted);
    border-bottom: 2px solid var(--color-border-default);
    white-space: nowrap;
}

.forecast-table thead th:first-child {
    text-align: center;
    border-radius: var(--radius-md) 0 0 0;
}

.forecast-table thead th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}

.forecast-table tbody td {
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-mono);
    text-align: right;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-subtle);
    transition: background var(--duration-fast) var(--ease-out);
}

.forecast-table tbody tr:hover td {
    background: var(--color-bg-muted);
}

.forecast-table tbody td:first-child {
    text-align: center;
    font-weight: 600;
    color: var(--color-secondary);
}

.forecast-table tbody td.positive { color: var(--color-success); }
.forecast-table tbody td.negative { color: var(--color-danger); }
.forecast-table tbody td.highlight {
    font-weight: 500;
    color: var(--color-accent);
}

/* Show More Button */
.show-more-btn {
    display: block;
    width: 100%;
    margin-top: var(--space-5);
    padding: var(--space-3);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-accent);
    background: transparent;
    border: 1px dashed var(--color-border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.show-more-btn:hover {
    background: var(--color-accent-subtle);
    border-color: var(--color-accent);
}

/* ============================================
   Tooltips
   ============================================ */
.has-tooltip {
    position: relative;
    cursor: help;
}

.has-tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    padding: var(--space-3) var(--space-4);
    min-width: 200px;
    max-width: 300px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: 1.5;
    color: var(--color-text-secondary);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    white-space: pre-line;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--duration-fast), visibility var(--duration-fast);
}

.has-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: -4px;
    border: 6px solid transparent;
    border-bottom-color: var(--color-border-default);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-fast), visibility var(--duration-fast);
}

.has-tooltip:hover::before,
.has-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Tooltip positioning for edge cells */
.forecast-table tbody td:nth-child(-n+3).has-tooltip::before {
    left: 0;
    transform: translateX(0);
}

.forecast-table tbody td:nth-child(-n+3).has-tooltip::after {
    left: 20px;
    transform: translateX(0);
}

.forecast-table tbody td:nth-last-child(-n+3).has-tooltip::before {
    left: auto;
    right: 0;
    transform: translateX(0);
}

.forecast-table tbody td:nth-last-child(-n+3).has-tooltip::after {
    left: auto;
    right: 20px;
    transform: translateX(0);
}

/* ============================================
   Calculation Tooltip (Floating)
   ============================================ */
.calc-tooltip {
    position: fixed;
    z-index: 9999;
    width: 320px;
    padding: var(--space-4);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-fast), visibility var(--duration-fast);
}

.calc-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.calc-tooltip-title {
    display: block;
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border-subtle);
}

.calc-tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-4);
    padding: 2px 0;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: 1.8;
}

.calc-tooltip-row span:first-child {
    color: var(--color-text-muted);
    flex-shrink: 0;
    max-width: 200px;
}

.calc-tooltip-row span:last-child {
    color: var(--color-text-secondary);
    font-weight: 500;
    white-space: nowrap;
    text-align: right;
}

.calc-tooltip-sep {
    height: 1px;
    background: var(--color-border-subtle);
    margin: var(--space-2) 0;
}

.calc-tooltip-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-4);
    padding-top: var(--space-1);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-primary);
}

.calc-tooltip-total span:last-child {
    color: var(--color-accent);
    white-space: nowrap;
}

/* Hover cursor for tooltip-enabled zones */
[data-calc-tooltip] {
    cursor: help;
}

/* ============================================
   Utilities
   ============================================ */

/* Remove number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

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

/* Value update animation */
@keyframes valueUpdate {
    0% { color: var(--color-secondary); }
    100% { color: inherit; }
}

.value-updated {
    animation: valueUpdate 0.5s var(--ease-out);
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s var(--ease-out) backwards;
}

.input-column .card:nth-child(1) { animation-delay: 0ms; }
.input-column .card:nth-child(2) { animation-delay: 60ms; }
.input-column .card:nth-child(3) { animation-delay: 120ms; }
.input-column .card:nth-child(4) { animation-delay: 180ms; }
.input-column .card:nth-child(5) { animation-delay: 240ms; }
.input-column .card:nth-child(6) { animation-delay: 300ms; }

.results-column .summary-cards { animation: fadeIn 0.5s var(--ease-out) backwards; animation-delay: 100ms; }
.results-column .card:nth-child(2) { animation-delay: 150ms; }
.results-column .card:nth-child(3) { animation-delay: 200ms; }
.results-column .card:nth-child(4) { animation-delay: 250ms; }
.results-column .card:nth-child(5) { animation-delay: 300ms; }

/* ============================================
   Custom Scrollbar
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border-emphasis);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1200px) {
    .property-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .key-metrics {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: var(--space-4);
        padding: var(--space-4);
    }
    
    .nav-tabs {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .input-grid {
        grid-template-columns: 1fr;
    }
    
    .input-group.full-width {
        grid-column: span 1;
    }
    
    .key-metrics {
        flex-direction: column;
        gap: var(--space-4);
    }
    
    .metric {
        text-align: left;
    }
    
    .loan-summary {
        flex-direction: column;
        gap: var(--space-4);
    }
    
    .depreciation-inputs {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }
    
    .input-with-unit.compact {
        width: 100%;
    }
    
    .input-with-unit.compact input {
        width: 100%;
    }
}

