@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --gold-primary: #ff9900;
    --gold-light: #ffaa33;
    --gold-dark: #cc7700;
    --bg-primary: #0A0A0A;
    --bg-secondary: #121212;
    --bg-tertiary: #1A1A1A;
    --bg-elevated: #242424;
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0A0;
    --text-tertiary: #666666;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.15);
    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --warning: #F59E0B;
}

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

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.logo {
    padding: 32px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--bg-primary);
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    flex: 1;
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(212, 175, 55, 0.12);
    color: var(--gold-primary);
}

.nav-icon {
    font-size: 20px;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--bg-primary);
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 32px;
    max-width: calc(100vw - 260px);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

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

.header-right {
    display: flex;
    gap: 16px;
    align-items: center;
}

.period-selector {
    display: flex;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.period-btn {
    padding: 8px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.period-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.period-btn.active {
    background: var(--gold-primary);
    color: var(--bg-primary);
}

.export-btn {
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--gold-primary);
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.kpi-card:hover {
    border-color: var(--border-medium);
    transform: translateY(-2px);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-primary), var(--gold-light));
}

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

.kpi-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.kpi-badge.positive {
    background: var(--success-bg);
    color: var(--success);
}

.kpi-badge.negative {
    background: var(--danger-bg);
    color: var(--danger);
}

.kpi-value {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary), var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.kpi-subtext {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.kpi-sparkline {
    height: 40px;
    opacity: 0.6;
}

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
}

.chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 24px;
    height: 400px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.chart-card.large {
    grid-column: span 1;
}

.chart-card canvas {
    flex: 1;
    max-height: 300px;
}

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

.chart-title {
    font-size: 18px;
    font-weight: 700;
}

.chart-legend {
    display: flex;
    gap: 24px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.primary {
    background: var(--gold-primary);
}

.legend-dot.secondary {
    background: var(--gold-light);
}

.breakdown-stats {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.breakdown-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.breakdown-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Tables */
.tables-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    position: relative;
    z-index: 2;
}

.table-card,
.summary-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 24px;
    position: relative;
    z-index: 2;
}

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

.table-title,
.summary-title {
    font-size: 18px;
    font-weight: 700;
}

.table-action {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-action:hover {
    color: var(--gold-primary);
    border-color: var(--gold-primary);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-subtle);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table tbody td {
    padding: 16px;
    font-size: 14px;
}

.merchant-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.merchant-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--bg-primary);
}

.mid-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
}

.change {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.change.positive {
    background: var(--success-bg);
    color: var(--success);
}

.change.negative {
    background: var(--danger-bg);
    color: var(--danger);
}

/* Summary Card */
.summary-title {
    margin-bottom: 24px;
}

.summary-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.summary-section:last-of-type {
    border-bottom: none;
}

.summary-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.summary-row.total {
    padding-top: 16px;
    margin-top: 8px;
    border-top: 2px solid var(--gold-primary);
}

.summary-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.summary-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

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

.summary-value.negative {
    color: var(--danger);
}

.summary-row.total .summary-label {
    font-weight: 700;
    color: var(--text-primary);
}

.summary-row.total .summary-value {
    font-size: 20px;
    color: var(--gold-primary);
}

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

.metric-item {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.metric-label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.metric-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-value.good {
    color: var(--success);
}

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

.download-report-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
    border: none;
    color: var(--bg-primary);
    font-weight: 700;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    margin-top: 24px;
}

.download-report-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.3);
}

/* Responsive */
@media (max-width: 1400px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-row,
    .tables-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-260px);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .header-right {
        width: 100%;
        flex-direction: column;
    }
    
    .period-selector,
    .export-btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .kpi-value {
        font-size: 28px;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table thead {
        display: none;
    }
    
    .data-table tbody tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid var(--border-subtle);
        border-radius: 8px;
        padding: 12px;
    }
    
    .data-table tbody td {
        display: block;
        padding: 8px 0;
        border: none;
    }
    
    .data-table tbody td:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-tertiary);
        display: block;
        margin-bottom: 4px;
    }
}

/* Focus states for accessibility */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--gold-primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .sidebar,
    .export-btn,
    .period-selector,
    .nav-item,
    button {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* Additional styles for multi-page functionality */
.dynamic-page-content {
    animation: fadeIn 0.3s ease;
}

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

.page-header {
    margin-bottom: 32px;
}

.filters-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.filter-select, .search-input {
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 14px;
    min-width: 180px;
}

.search-input {
    flex: 1;
    min-width: 250px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.success {
    background: var(--success-bg);
    color: var(--success);
}

.status-badge.pending {
    background: rgba(244, 208, 63, 0.1);
    color: var(--gold-light);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.action-link {
    color: var(--gold-primary);
    text-decoration: none;
    font-weight: 600;
}

.action-link:hover {
    text-decoration: underline;
}

.analytics-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 0;
}

.analytics-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.analytics-bar {
    height: 32px;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.analytics-label {
    min-width: 120px;
    color: var(--text-secondary);
    font-size: 14px;
}

.analytics-value {
    font-weight: 700;
    color: var(--gold-primary);
}

.metrics-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 0;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.metric-name {
    color: var(--text-secondary);
    font-size: 14px;
}

.metric-stat {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 16px;
}

.trend-indicator {
    font-size: 20px;
}

.trend-indicator.up {
    color: var(--success);
}

.trend-indicator.down {
    color: var(--danger);
}

.report-generator {
    margin-bottom: 32px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 0;
}

.settings-toggles {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.setting-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.setting-desc {
    font-size: 13px;
    color: var(--text-tertiary);
}

.toggle-switch {
    width: 48px;
    height: 24px;
    background: var(--bg-elevated);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: var(--text-tertiary);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
}

.toggle-switch.active {
    background: var(--gold-primary);
}

.toggle-switch.active::after {
    left: 27px;
    background: var(--bg-primary);
}

@media (max-width: 768px) {
    .filters-bar {
        flex-direction: column;
    }
    
    .filter-select, .search-input {
        width: 100%;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* Valuation page styles */
.valuation-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.valuation-row.total {
    border-top: 2px solid var(--gold-primary);
    border-bottom: none;
    margin-top: 16px;
    padding-top: 24px;
}

.valuation-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.valuation-row.total .valuation-label {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
}

.valuation-amount {
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.valuation-row.total .valuation-amount {
    font-size: 24px;
    color: var(--gold-primary);
}

/* Smooth transitions for period updates */
.kpi-value,
.kpi-badge,
.kpi-subtext,
.page-subtitle {
    transition: all 0.3s ease;
}

.kpi-value {
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* User profile link */
.user-profile-link {
    text-decoration: none;
    display: block;
    transition: opacity 0.2s ease;
}

.user-profile-link:hover {
    opacity: 0.8;
}

.user-profile-link .user-profile {
    cursor: pointer;
}

/* Looker Studio Embed Styles */
.looker-embed-container {
    width: 100%;
    min-height: 1400px;
    background: #1A1A1A;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-subtle);
}

.looker-embed-container iframe {
    width: 100%;
    min-height: 1400px;
    border: none;
    border-radius: 8px;
    display: block;
}

.info-card {
    animation: fadeIn 0.3s ease;
}

@media (max-width: 768px) {
    .looker-embed-container {
        padding: 8px;
    }
    
    .looker-embed-container iframe {
        min-height: 1000px;
    }
}

/* ===== ADDITIONAL FIXES AND FEATURES ===== */

/* Logo Image */
.logo-image {
    width: 180px;
    height: auto;
    display: block;
}

.logo-link {
    display: block;
    cursor: pointer;
    transition: opacity 0.2s;
}

.logo-link:hover {
    opacity: 0.8;
}

/* Sticky Table Headers */
.sticky-header {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Section Spacing */
.section {
    padding: 40px 0;
    min-height: 100vh;
}

.section:first-child {
    padding-top: 0;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Neutral Badge */
.kpi-badge.neutral {
    background: rgba(160, 160, 160, 0.1);
    color: #A0A0A0;
}

/* Valuation Container */
.valuation-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.valuation-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 24px;
}

.valuation-card.primary {
    background: linear-gradient(135deg, rgba(255, 153, 0, 0.1), rgba(255, 153, 0, 0.05));
    border-color: var(--gold-primary);
    text-align: center;
    padding: 40px;
}

.valuation-title {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 16px;
    font-weight: 500;
}

.valuation-amount {
    font-size: 56px;
    font-weight: 700;
    color: var(--gold-primary);
    margin-bottom: 12px;
}

.valuation-note {
    color: var(--text-tertiary);
    font-size: 14px;
}

.valuation-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.valuation-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 12px;
}

.valuation-details h3,
.valuation-breakdown h3 {
    color: var(--text-primary);
    font-size: 20px;
    margin-bottom: 20px;
}

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

.method-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 20px;
}

.method-card h4 {
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 12px;
}

.method-card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.valuation-table {
    width: 100%;
    border-collapse: collapse;
}

.valuation-table th,
.valuation-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.valuation-table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
}

.valuation-table td {
    color: var(--text-primary);
    font-size: 14px;
}

/* Analytics Container */
.analytics-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

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

.insight-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.insight-card.positive {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.insight-card.warning {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

.insight-card.info {
    border-color: var(--gold-primary);
    background: rgba(255, 153, 0, 0.05);
}

.insight-icon {
    font-size: 32px;
}

.insight-card h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.insight-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.analytics-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 24px;
}

.analytics-section h3 {
    color: var(--text-primary);
    font-size: 20px;
    margin-bottom: 20px;
}

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

.recommendation-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rec-icon {
    font-size: 28px;
}

.recommendation-card h4 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.recommendation-card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .valuation-amount {
        font-size: 40px;
    }
    
    .valuation-value {
        font-size: 24px;
    }
    
    .methodology-grid,
    .recommendations-grid,
    .insights-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== CHART AND TABLE SCROLL LIMITS ===== */

/* Fixed height charts with proper constraints */
.chart-card canvas {
    max-height: 350px !important;
}

.chart-card.large canvas {
    max-height: 400px !important;
}

.chart-card-full {
    max-height: 500px;
}

.chart-card-full canvas {
    max-height: 450px !important;
}

/* Table container with fixed height and scroll */
.table-container {
    position: relative;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
}

.table-container.scrollable {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: auto;
}

/* Ensure table headers stick within scrollable container */
.table-container .sticky-header {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.table-container .sticky-header th {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
}

/* Custom scrollbar for table containers */
.table-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #ff9900;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #ffaa33;
}

/* Dashboard table - smaller height */
#dashboard .table-container {
    max-height: 500px;
}

/* Master table - larger height */
#master-table .table-container {
    max-height: 700px;
}

/* Ensure data tables fit properly */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

/* Chart responsiveness within limits */
@media (max-width: 1024px) {
    .table-container,
    .table-container.scrollable {
        max-height: 500px;
    }
    
    .chart-card canvas {
        max-height: 300px !important;
    }
    
    .chart-card-full canvas {
        max-height: 350px !important;
    }
}

@media (max-width: 768px) {
    .table-container,
    .table-container.scrollable {
        max-height: 400px;
    }
    
    .chart-card canvas {
        max-height: 250px !important;
    }
}

/* ===== DEFINITIONS SECTION ===== */
.definitions-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.definition-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 32px;
}

.definition-card h3 {
    color: var(--text-primary);
    font-size: 24px;
    margin-bottom: 24px;
    border-bottom: 2px solid #ff9900;
    padding-bottom: 12px;
}

.definition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.definition-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 20px;
}

.definition-item h4 {
    color: #ff9900;
    font-size: 18px;
    margin-bottom: 12px;
    font-weight: 600;
}

.definition-item p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.definition-item p strong {
    color: var(--text-primary);
}

.definition-item ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

.definition-item ul li {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 4px;
}

@media (max-width: 768px) {
    .definition-grid {
        grid-template-columns: 1fr;
    }
    
    .definition-card {
        padding: 20px;
    }
}
