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

:root {
    --primary: #1B2A3D;
    --primary-dark: #0F1A28;
    --primary-light: #2C3E54;
    --accent: #C5A55A;
    --accent-light: #D4BA7A;
    --accent-bg: #F5F0E3;
    --bg: #F7F7F5;
    --bg-warm: #F0EFEB;
    --text: #1B2A3D;
    --text-secondary: #6B7280;
    --card-bg: #FFFFFF;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --success: #2D7D46;
    --fail: #C0392B;
    --warning: #D4880F;
    --border: #E5E5E0;
    --radius: 6px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 2rem 2rem 3rem; }
.container-wide { max-width: 1300px; margin: 0 auto; padding: 2rem 2rem 3rem; }

h1, h2, h3, h4 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.25;
}

/* ===== NAV ===== */
nav {
    background: var(--primary);
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: nowrap;
}

nav .logo {
    font-family: 'Playfair Display', serif;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.logo-mark { color: var(--accent); margin-right: 0.15rem; }

.nav-links {
    display: flex;
    gap: 0;
    align-items: center;
    flex-wrap: nowrap;
    flex-shrink: 0;
}
.nav-links > a,
.nav-links > .nav-dropdown > .nav-dropdown-trigger {
    color: rgba(255,255,255,0.75);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 1rem;
    height: 56px;
    display: flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}
.nav-links > a:hover,
.nav-links > .nav-dropdown > .nav-dropdown-trigger:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.nav-dropdown { position: relative; }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 56px;
    right: 0;
    background: var(--primary);
    border: 1px solid rgba(255,255,255,0.1);
    border-top: 2px solid var(--accent);
    min-width: 160px;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
    display: block;
    padding: 0.6rem 1.2rem;
    color: rgba(255,255,255,0.8);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.nav-dropdown-menu a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-dropdown-menu a:last-child { border-bottom: none; }

.nav-signout {
    opacity: 0.7;
    font-size: 0.75rem !important;
    margin-left: 0.25rem;
}

.section-total-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(197,165,90,0.12);
    border: 1px solid rgba(197,165,90,0.3);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    margin-left: 0.5rem;
    vertical-align: middle;
    letter-spacing: 0.02em;
}

/* ===== HERO ===== */
.hero-banner {
    background: var(--primary);
    padding: 3rem 2rem 2.5rem;
    text-align: center;
    color: #fff;
    border-bottom: 3px solid var(--accent);
}

.hero-banner h1 {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 0.35rem;
}

.hero-banner p {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 500;
}

.hero {
    background: var(--primary);
    padding: 3rem 2rem 2.5rem;
    text-align: center;
    color: #fff;
    border-bottom: 3px solid var(--accent);
}
.hero h1 { font-size: 2rem; color: #fff; margin-bottom: 0.35rem; }
.hero p { color: rgba(255,255,255,0.6); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 500; }

.hero-meta {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.hero-meta span {
    background: rgba(255,255,255,0.12);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--card-shadow);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.card-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.returns-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 1rem 0 1.5rem;
    overflow: hidden;
}

/* ===== DEAL CARDS (index) ===== */
.deal-card {
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}
.deal-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--accent);
}

.deal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
    overflow: hidden;
}
.deal-card-header h3 {
    font-size: 1.1rem;
    line-height: 1.3;
    min-width: 0;
    word-wrap: break-word;
}

.deal-card-address {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.deal-card-metrics {
    display: flex;
    gap: 1.25rem;
    align-items: flex-end;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.deal-card-metrics .metric { text-align: center; }
.deal-card-metrics .metric .value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary);
    line-height: 1.2;
}
.deal-card-metrics .metric .label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.model-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}
.model-badge.managed { background: var(--accent-bg); color: var(--accent); }
.model-badge.traditional { background: #E8EDF2; color: var(--primary); }

/* ===== METRIC CARDS (deal detail) ===== */
.metric-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
    min-width: 0;
}
.metric-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
    border-radius: var(--radius) var(--radius) 0 0;
}

.metric-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.metric-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: break-word;
}

.metric-badge { margin-top: 0.4rem; }

.pass-badge {
    color: var(--success);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.fail-badge {
    color: var(--fail);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== SECTION HEADER ===== */
.section-header {
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}
.section-header h2 { font-size: 1.3rem; }

/* ===== DATA TABLE ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.data-table thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--primary);
    white-space: nowrap;
}
.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--primary);
}
.data-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:nth-child(even) { background: #FAFAF8; }
.data-table .number { text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; }
.data-table .negative { color: var(--fail); }
.total-row { background: var(--bg-warm) !important; font-weight: 700; }

.table-wrapper { overflow-x: auto; margin: 0 -0.5rem; padding: 0 0.5rem; }

.key-figures-table { max-width: 480px; }
.key-figures-table th { background: var(--primary); color: #fff; border-bottom: 2px solid var(--accent); }
.key-figures-table td { font-weight: 500; }
.key-figures-table .number { font-weight: 700; }

/* ===== INVESTMENT GATES ===== */
.gates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.gate-card {
    background: var(--card-bg);
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-left: 4px solid var(--border);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    position: relative;
}
.gate-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    transform: translateY(-1px);
}
.gate-card.pass { border-left-color: var(--success); }
.gate-card.fail { border-left-color: var(--fail); }
.gate-card.info { border-left-color: var(--accent); cursor: default; }

.gate-icon {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}
.gate-card.pass .gate-icon { color: var(--success); }
.gate-card.fail .gate-icon { color: var(--fail); }

.gate-name {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}
.gate-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary);
}
.gate-threshold {
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
.gate-hint {
    font-size: 0.6rem;
    color: var(--accent);
    margin-top: 0.4rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.gate-card:hover .gate-hint { opacity: 1; }
.gate-card.expanded .gate-hint { display: none; }
.gate-explanation {
    display: none;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    line-height: 1.55;
    color: var(--text-secondary);
}
.gate-card.expanded .gate-explanation {
    display: block;
}

/* ===== TOGGLE ===== */
.toggle-center { display: flex; justify-content: center; margin-bottom: 1.5rem; }
.toggle-bar {
    display: inline-flex;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.toggle-option {
    padding: 0.6rem 1.25rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    border: none;
    background: none;
    transition: all 0.15s;
    font-family: inherit;
}
.toggle-option:hover { color: var(--primary); background: var(--bg); }
.toggle-option.active { background: var(--primary); color: #fff; }

/* ===== FORMS ===== */
.form-row, .form-row-3 { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.form-row { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; }
.form-group label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.88rem;
    background: #fff;
    color: var(--text);
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(197,165,90,0.15);
}

.form-section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
    color: var(--primary);
}

.form-section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.input-with-suffix { position: relative; display: flex; align-items: center; }
.input-with-suffix input { padding-right: 3.5rem; }
.input-with-suffix .suffix {
    position: absolute;
    right: 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    pointer-events: none;
}

.unit-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.unit-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    transition: all 0.15s;
}
.unit-btn.active { background: var(--primary); color: #fff; }

.checkbox-container {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    flex-direction: row !important;
}
.checkbox-container input[type="checkbox"] { width: auto; }
.checkbox-label { font-size: 0.85rem; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text); }

/* ===== BUTTONS ===== */
.btn-primary {
    background: var(--primary);
    color: #fff;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    font-family: inherit;
}
.btn-primary:hover { background: var(--primary-light); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
    background: var(--card-bg);
    color: var(--primary);
    padding: 0.6rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    font-family: inherit;
}
.btn-secondary:hover { border-color: var(--primary); background: var(--bg); }

.btn-ghost {
    background: none;
    color: var(--text-secondary);
    padding: 0.6rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    font-family: inherit;
}
.btn-ghost:hover { color: var(--primary); border-color: var(--border); }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.72rem; }
.btn-icon {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}
.btn-icon:hover { color: var(--fail); }

.btn-group { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.btn { cursor: pointer; font-family: inherit; }

/* ===== COLLAPSIBLE ===== */
.collapsible {
    border: 1px solid var(--border);
    background: var(--card-bg);
    margin-bottom: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}
.collapsible-header {
    padding: 1rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}
.collapsible-header h3 { font-size: 1rem; }
.collapsible-header:hover { background: var(--bg); }
.collapsible-body { display: none; }
.collapsible-body.open { display: block; }
.collapsible-body-inner {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
}

.chevron { transition: transform 0.2s; display: flex; }
.chevron.rotated { transform: rotate(180deg); }

/* ===== CHARTS ===== */
.chart-container { height: 380px; padding: 0.5rem; position: relative; }

/* ===== GANTT ===== */
.gantt-timeline { position: relative; padding: 0.5rem 0; }
.gantt-row { position: relative; height: 36px; margin-bottom: 4px; }
.gantt-bar {
    position: absolute;
    height: 100%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    cursor: default;
    min-width: 4px;
}
.gantt-bar.design { background: #6B7280; }
.gantt-bar.tender { background: #9CA3AF; }
.gantt-bar.strip_out { background: var(--fail); }
.gantt-bar.cat_a { background: var(--primary); }
.gantt-bar.cat_b { background: var(--primary-light); }
.gantt-bar.ffe { background: var(--accent); color: var(--primary); }
.gantt-bar.snagging { background: #D4880F; }
.gantt-bar.pre_opening { background: var(--success); }
.gantt-bar.acquisition { background: var(--accent); color: var(--primary); }
.gantt-bar.construction { background: var(--primary); }
.gantt-bar.fitout { background: var(--accent); color: var(--primary); }
.gantt-bar.completion { background: #D4880F; }
.gantt-bar.ramp_up { background: repeating-linear-gradient(135deg, var(--accent), var(--accent) 4px, rgba(197,165,90,0.5) 4px, rgba(197,165,90,0.5) 8px); color: var(--primary); }

.gantt-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.gantt-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.72rem;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.gantt-bar:hover .gantt-tooltip { display: block; }

.gantt-markers {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.gantt-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.gantt-legend-item { display: flex; align-items: center; gap: 0.35rem; font-size: 0.7rem; color: var(--text-secondary); }
.gantt-legend-swatch { width: 16px; height: 10px; border-radius: 2px; }

.gantt-phase-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.5rem; vertical-align: middle; }
.gantt-phase-dot.acquisition { background: var(--accent); }
.gantt-phase-dot.pre_construction { background: #6B7280; }
.gantt-phase-dot.construction { background: var(--primary); }
.gantt-phase-dot.fitout { background: var(--accent); }
.gantt-phase-dot.completion { background: #D4880F; }
.gantt-phase-dot.pre_opening { background: var(--success); }
.gantt-phase-dot.ramp_up { background: repeating-linear-gradient(135deg, var(--accent), var(--accent) 3px, rgba(197,165,90,0.4) 3px, rgba(197,165,90,0.4) 6px); }
.gantt-milestones { display: flex; gap: 2rem; margin-bottom: 1rem; font-size: 0.82rem; color: var(--text-secondary); }
.gantt-milestone { background: var(--bg); padding: 0.35rem 0.75rem; border-radius: 4px; border: 1px solid var(--border); }

.downside-scenario-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.75rem; }
.downside-scenario-card {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; transition: all 0.2s;
    background: var(--card-bg);
}
.downside-scenario-card:hover { border-color: var(--primary); background: var(--bg); }
.downside-scenario-card:has(input:checked) { border-color: var(--primary); background: rgba(27,42,61,0.04); box-shadow: 0 0 0 1px var(--primary); }
.downside-scenario-card input[type="checkbox"] { margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }
.scenario-content { flex: 1; min-width: 0; }
.scenario-label { font-weight: 600; font-size: 0.85rem; color: var(--text-primary); margin-bottom: 0.2rem; }
.scenario-desc { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.3; }

.downside-applied-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin-top: 0.5rem; }
.downside-tag { display: inline-block; padding: 0.2rem 0.6rem; background: rgba(27,42,61,0.06); border: 1px solid var(--border); border-radius: 12px; font-size: 0.7rem; color: var(--text-secondary); font-weight: 500; }

.monthly-cf-table { font-size: 0.8rem; }
.monthly-cf-table thead th { position: sticky; top: 0; z-index: 2; }
.monthly-cf-table td, .monthly-cf-table th { padding: 0.35rem 0.6rem; white-space: nowrap; }
.monthly-cf-table .phase-dev { background: rgba(27,42,61,0.03); }
.monthly-cf-table .phase-ramp { background: rgba(197,165,90,0.06); }
.monthly-cf-table .phase-ops { }
.phase-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 10px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em; }
.phase-badge-development { background: var(--primary); color: #fff; }
.phase-badge-ramp_up { background: var(--accent); color: var(--primary); }
.phase-badge-operations { background: rgba(27,42,61,0.08); color: var(--primary); }
.phase-badge-exit { background: #D4880F; color: #fff; }

/* ===== UPLOAD ===== */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(197,165,90,0.04);
}
.upload-icon { color: var(--text-secondary); margin-bottom: 0.75rem; }
.upload-text { font-size: 0.9rem; color: var(--text-secondary); }
.upload-text strong { color: var(--primary); }

/* ===== AI RESEARCH ===== */
.ai-research-panel {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.research-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ===== SPINNER ===== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner-lg {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(27,42,61,0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 1rem;
    color: #fff;
    font-size: 0.9rem;
}
.loading-overlay.active { display: flex; }

/* ===== EMAIL MODAL ===== */
.email-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(27,42,61,0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.email-modal.active { display: flex; }

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.modal-header h3 { font-size: 1.15rem; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    line-height: 1;
}

/* ===== ALERTS ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
}
.alert-success { background: #EBF5EE; color: var(--success); border: 1px solid #C6E6CE; }
.alert-error { background: #FDECEC; color: var(--fail); border: 1px solid #F5C6C6; }
.alert-warning { background: #FFF8EB; color: var(--warning); border: 1px solid #FAEAC8; }

/* ===== QUALITY CHECKS ===== */
.quality-checks { display: flex; flex-direction: column; gap: 0.5rem; }
.quality-check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    font-size: 0.85rem;
}
.severity {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    white-space: nowrap;
}
.severity.warning { background: #FFF8EB; color: var(--warning); }
.severity.error { background: #FDECEC; color: var(--fail); }
.severity.info { background: #EBF0FF; color: #3366CC; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    background: var(--bg);
    color: var(--text-secondary);
}
.badge-pass { background: #EBF5EE; color: var(--success); }
.badge-fail { background: #FDECEC; color: var(--fail); }
.badge-warn { background: #FFF8EB; color: var(--warning); }
.badge-info { background: #EBF0FF; color: #3366CC; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}
.empty-state h2 {
    margin-bottom: 0.5rem;
    color: var(--primary);
}
.empty-state p { margin-bottom: 1.5rem; font-size: 0.9rem; }

/* ===== MARKET INTEL ===== */
.market-intel-layout { display: flex; flex-direction: column; gap: 1.5rem; }

.section-row {
    display: flex;
    gap: 1.5rem;
}
.section-row > .card { flex: 1; }

.upload-card, .search-card { flex: 1; }
.search-form .form-row-3 { margin-bottom: 0; }

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.card-header-row h2 { font-size: 1.15rem; }

.upload-status {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--bg);
}
.upload-success { background: #EBF5EE; color: var(--success); }
.upload-error { background: #FDECEC; color: var(--fail); }

/* ===== CHAT ===== */
.ai-chat-card h2 { font-size: 1.15rem; margin-bottom: 1rem; }

.chat-container { display: flex; flex-direction: column; }
.chat-messages {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    min-height: 200px;
}

.chat-msg { margin-bottom: 1rem; }
.chat-msg-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.25rem;
}
.chat-user .chat-msg-label { color: var(--accent); }
.chat-assistant .chat-msg-label { color: var(--primary); }
.chat-msg-content {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text);
}

.chat-placeholder {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 1rem 0;
}
.chat-placeholder ul { margin-top: 0.5rem; padding-left: 1.25rem; }
.chat-placeholder li { margin-bottom: 0.25rem; }

.chat-input-form {
    display: flex;
    gap: 0.5rem;
}
.chat-input-form input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.88rem;
}
.chat-input-form input:focus { outline: none; border-color: var(--accent); }

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* ===== UTILITIES ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .card-grid-4 { grid-template-columns: 1fr 1fr; }
    .returns-grid { grid-template-columns: 1fr 1fr; }
    .form-row-3 { grid-template-columns: 1fr 1fr; }
    .section-row { flex-direction: column; }
    .gates-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
    .container { padding: 0 1rem 2rem; }
    .hero-banner, .hero { padding: 2rem 1rem 1.75rem; }
    .hero-banner h1, .hero h1 { font-size: 1.5rem; }
    .card { padding: 1.25rem; }
    .card-grid-4 { grid-template-columns: 1fr; }
    .returns-grid { grid-template-columns: 1fr 1fr; }
    .card-grid { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .gates-grid { grid-template-columns: 1fr; }
    nav { padding: 0 1rem; }
    .nav-links a { padding: 0 0.5rem; font-size: 0.7rem; }
    .btn-group { flex-direction: column; }
    .deal-card-metrics { flex-wrap: wrap; }
    .metric-value { font-size: 1.1rem; }
    .metric-card { padding: 0.9rem; }
    .section-header h2 { font-size: 1.1rem; }
}

@media (max-width: 400px) {
    .returns-grid { grid-template-columns: 1fr; }
    .metric-value { font-size: 1rem; }
}

.criteria-targets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0.75rem;
}
.criteria-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}
.criteria-section-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}
.criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem 1.5rem;
}
.criteria-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.35rem 0.5rem;
    font-size: 0.78rem;
    gap: 0.25rem 0.75rem;
    background: var(--bg-offset, #f8f8f6);
    border-radius: 6px;
}
.criteria-label {
    color: var(--text-secondary);
    font-weight: 400;
    flex-shrink: 1;
    min-width: 0;
}
.criteria-val {
    font-weight: 600;
    text-align: right;
    white-space: normal;
    word-break: break-word;
    flex-shrink: 1;
    min-width: 0;
}
.criteria-val.pass { color: var(--success); }
.criteria-val.fail { color: var(--fail); }
.criteria-val.neutral { color: var(--text); }
.criteria-profiles-table {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    font-size: 0.78rem;
}
.criteria-profiles-header,
.criteria-profiles-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1fr;
    gap: 0.25rem;
    padding: 0.25rem 0;
    min-width: 0;
    font-size: 0.72rem;
}
.criteria-profiles-header {
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.15rem;
    font-size: 0.72rem;
}
.criteria-profiles-row {
    color: var(--text);
    font-weight: 500;
}
.criteria-profile-name {
    color: var(--text-secondary);
    font-weight: 400;
}
.criteria-profiles-header > span,
.criteria-profiles-row > span {
    min-width: 0;
    overflow-wrap: break-word;
}
@media (max-width: 600px) {
    .criteria-targets { grid-template-columns: 1fr; }
    .criteria-grid { grid-template-columns: 1fr; }
    .criteria-profiles-header,
    .criteria-profiles-row {
        grid-template-columns: 1.5fr 1fr 1fr 1fr;
        font-size: 0.68rem;
        gap: 0.15rem;
    }
}
