/**
 * Continental Dashboard Styles — Full Redesign
 * Design System: 8px spacing scale, clean sans-serif, minimal decoration
 */

/* ========================================
   DESIGN TOKENS
   ======================================== */

:root {
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 40px;
    --space-6: 48px;

    --font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    --font-size-xs: 10px;
    --font-size-sm: 12px;
    --font-size-base: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 20px;
    --font-size-2xl: 26px;
    --font-size-3xl: 34px;

    --color-bg-viewport: #f8f9fb;
    --color-bg-surface: #ffffff;
    --color-bg-panel: #f3f4f6;
    --color-bg-hover: #f9fafb;
    --color-bg-subtle: #f0f1f3;

    --color-text-primary: #111827;
    --color-text-secondary: #6b7280;
    --color-text-muted: #9ca3af;

    --color-accent: #2563eb;
    --color-accent-light: #dbeafe;
    --color-accent-hover: #1d4ed8;

    --color-green: #059669;
    --color-green-light: #d1fae5;
    --color-amber: #d97706;
    --color-amber-light: #fef3c7;
    --color-red: #dc2626;
    --color-red-light: #fee2e2;
    --color-purple: #7c3aed;
    --color-purple-light: #ede9fe;
    --color-teal: #0d9488;
    --color-teal-light: #ccfbf1;

    --color-border: #e5e7eb;
    --color-divider: #e5e7eb;

    --color-gray-1: #d1d5db;
    --color-gray-2: #9ca3af;
    --color-gray-3: #6b7280;
    --color-gray-dark: #1f2937;

    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px -2px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px -4px rgba(0,0,0,0.1);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --icon-rail-width: 72px;
    --primary-nav-width: 250px;
}

/* ========================================
   RESET & BASE
   ======================================== */

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

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--color-text-primary);
    background-color: var(--color-bg-viewport);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ========================================
   APP SHELL LAYOUT
   ======================================== */

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   ICON RAIL
   ======================================== */

.icon-rail {
    width: var(--icon-rail-width);
    background: var(--color-bg-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-2) 6px;
    gap: 4px;
    flex-shrink: 0;
}

.icon-rail-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px 6px;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    gap: 3px;
    text-decoration: none;
}

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

.icon-rail-item.active {
    background: var(--color-accent);
    color: #fff;
}

.icon-rail-label {
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    line-height: 1.1;
    white-space: nowrap;
}

.icon-rail-item.active .icon-rail-label { color: #fff; font-weight: 600; }
.icon-rail-item:hover .icon-rail-label { color: var(--color-text-primary); }

/* ========================================
   PRIMARY NAVIGATION
   ======================================== */

.primary-nav {
    width: var(--primary-nav-width);
    background: var(--color-bg-panel);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.nav-header {
    padding: var(--space-3) var(--space-2);
    border-bottom: 1px solid var(--color-divider);
}

.nav-brand h2 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
    letter-spacing: -0.01em;
}

.segmented-control {
    display: flex;
    background: var(--color-bg-surface);
    border-radius: var(--radius-full);
    padding: 3px;
    gap: 2px;
}

.segment {
    flex: 1;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.segment.active {
    background: var(--color-gray-dark);
    color: #fff;
}

.segment:hover:not(.active) { color: var(--color-text-primary); }

.nav-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-1) var(--space-1);
}

.nav-group { margin-bottom: var(--space-1); }

.nav-group-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    padding: 6px 12px;
    margin-bottom: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 13px;
}

.nav-item:hover { background: var(--color-bg-hover); color: var(--color-text-primary); }
.nav-item.active { background: var(--color-bg-surface); color: var(--color-text-primary); font-weight: 500; }
.nav-item svg { flex-shrink: 0; }
.nav-link { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; width: 100%; min-width: 0; }
.nav-item span:not(.nav-badge) { flex: 1; min-width: 0; }
.nav-badge { font-size: 10px; font-weight: 600; color: #64748b; background: #e2e8f0; padding: 2px 8px; border-radius: 10px; line-height: 1.3; flex-shrink: 0; margin-left: auto; white-space: nowrap; }

.nav-divider {
    height: 1px;
    background: var(--color-divider);
    margin: 6px 8px;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    background: var(--color-bg-viewport);
}

.content-canvas {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* ========================================
   PAGE BANNER (Hero Image with Crossfade)
   ======================================== */

.page-banner {
    position: relative;
    height: var(--banner-height, auto);
    min-height: 160px;
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 0;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    width: 100vw;
}
.main-content > .page-banner,
.main-content > div > .page-banner {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}
.page-banner-slides {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.page-banner-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.8s ease-in-out;
    will-change: opacity;
}
.page-banner-slide.active {
    opacity: 1;
}
.page-banner-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
}
.page-banner-content {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 28px 32px 16px;
}
.page-banner-text {
    flex: 1;
    min-width: 0;
}
.page-banner-title {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0 0 6px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.page-banner-subtitle {
    font-size: 13.5px;
    color: rgba(255,255,255,0.85);
    line-height: 1.5;
    margin: 0;
    max-width: 680px;
}
.page-banner-meta {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.page-banner-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-banner-bottom {
    position: relative;
    z-index: 3;
    padding: 12px 32px 18px;
}
.page-banner-stats {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
}
.page-banner-stat {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 20px;
    border-left: 3px solid rgba(255,255,255,0.25);
}
.page-banner-stat:first-child {
    padding-left: 0;
}
.page-banner-stat-val {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    margin-right: 8px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.page-banner-stat-lbl {
    font-size: 10px;
    color: rgba(255,255,255,0.75);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .page-banner { height: auto !important; min-height: 140px; }
    .page-banner-content { padding: 20px 18px 10px; flex-direction: column; align-items: flex-start; }
    .page-banner-title { font-size: 18px; }
    .page-banner-subtitle { font-size: 12px; }
    .page-banner-bottom { padding: 8px 18px 14px; }
    .page-banner-stat { padding: 0 12px; }
    .page-banner-stat-val { font-size: 16px; }
}

/* ========================================
   PAGE HEADER
   ======================================== */

.page-header {
    margin-bottom: 0;
    padding: 16px 0;
}

.page-header h1 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.page-header-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.scope-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.scope-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-green);
    flex-shrink: 0;
}

.scope-indicator strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

.org-badge {
    font-size: 12px;
    background: var(--color-bg-subtle);
    color: var(--color-text-secondary);
    padding: 3px 12px;
    border-radius: var(--radius-full);
    font-weight: 500;
}


/* ========================================
   STATUS DISTRIBUTION (Original Design)
   ======================================== */

.status-card {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 0;
    transition: box-shadow 0.15s ease;
}

.status-card:hover { box-shadow: var(--shadow-md); }

.card-header {
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
}

.header-rule {
    height: 1px;
    background: var(--color-divider);
    margin-top: 10px;
}

.status-blocks {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    margin-bottom: 16px;
}

.status-block {
    padding: 14px 16px;
    border-left: 3px solid transparent;
    border-right: 1px solid var(--color-divider);
}

.status-block:last-child { border-right: none; }

.status-blocks:not(.overview-blocks) .status-block:nth-child(1) { border-left-color: var(--color-amber); }
.status-blocks:not(.overview-blocks) .status-block:nth-child(2) { border-left-color: #059669; }
.status-blocks:not(.overview-blocks) .status-block:nth-child(3) { border-left-color: #7c3aed; }
.status-blocks:not(.overview-blocks) .status-block:nth-child(4) { border-left-color: #0891b2; }
.status-blocks:not(.overview-blocks) .status-block:nth-child(5) { border-left-color: #cbd5e1; }

.overview-blocks {
    grid-template-columns: repeat(5, 1fr);
}

.overview-blocks .status-block:nth-child(1) { border-left-color: #2563eb; }
.overview-blocks .status-block:nth-child(2) { border-left-color: #059669; }
.overview-blocks .status-block:nth-child(3) { border-left-color: #7c3aed; }
.overview-blocks .status-block:nth-child(4) { border-left-color: #0d9488; }
.overview-blocks .status-block:nth-child(5) { border-left-color: #e11d48; }

.overview-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--color-divider);
}

.overview-tag {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: var(--color-bg-subtle);
    color: var(--color-text-secondary);
}

.status-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.1;
}

.status-label {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.stacked-bar {
    display: flex;
    height: 10px;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.bar-segment {
    height: 100%;
    transition: width 0.6s ease;
}

.segment-accent { background: #d97706; }
.segment-green  { background: #059669; }
.segment-purple { background: #7c3aed; }
.segment-teal   { background: #0891b2; }
.segment-slate  { background: #cbd5e1; }

/* ========================================
   REFERENCE PLANS BARS
   ======================================== */

.ref-plan-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ref-plan-row {
    display: grid;
    grid-template-columns: 120px 1fr 40px;
    align-items: center;
    gap: 10px;
}

.ref-plan-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ref-plan-track {
    height: 8px;
    background: var(--color-bg-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.ref-plan-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
    min-width: 4px;
}

.ref-plan-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-primary);
    text-align: right;
}

/* ========================================
   STAGE DISTRIBUTION
   ======================================== */

.stage-dist-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stage-dist-row {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;
    gap: 8px;
}

.stage-dist-code {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: var(--color-gray-dark);
    border-radius: var(--radius-sm);
    text-align: center;
    padding: 2px 4px;
    line-height: 1.3;
}

.stage-dist-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.stage-dist-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stage-dist-track {
    height: 6px;
    background: var(--color-bg-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.stage-dist-fill {
    height: 100%;
    background: linear-gradient(90deg, #059669, #34d399);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
    min-width: 3px;
}

.stage-dist-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-primary);
    text-align: right;
}

.empty-state {
    padding: 24px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
}

/* ========================================
   DASHBOARD GRID (Two-column sections)
   ======================================== */

.dash-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 0;
}

.dash-grid-3-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 0;
}

.dash-card {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: box-shadow 0.15s ease;
}

.dash-card:hover { box-shadow: var(--shadow-md); }

.dash-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dash-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
}

.dash-card-subtitle {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* ========================================
   SECTOR BARS (Horizontal)
   ======================================== */

.sector-bars { display: flex; flex-direction: column; gap: 10px; }

.sector-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sector-bar-label {
    width: 90px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sector-bar-track {
    flex: 1;
    height: 22px;
    background: var(--color-bg-subtle);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.sector-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 2px;
}

.sector-bar-count {
    width: 48px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    text-align: right;
    flex-shrink: 0;
}

/* Sector colors */
.bar-transport { background: #2563eb; }
.bar-ict { background: #7c3aed; }
.bar-energy { background: #d97706; }
.bar-tourism { background: #059669; }
.bar-water { background: #0891b2; }
.bar-other { background: #9ca3af; }

/* ========================================
   SUBSECTOR LIST
   ======================================== */

.subsector-list { display: flex; flex-direction: column; gap: 6px; }

.subsector-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-viewport);
    font-size: 12px;
}

.subsector-name {
    color: var(--color-text-secondary);
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.subsector-sector {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 500;
    margin-right: 8px;
    flex-shrink: 0;
}

.subsector-count {
    font-weight: 700;
    color: var(--color-text-primary);
    flex-shrink: 0;
}

/* ========================================
   PIPELINE / STATUS BLOCKS
   ======================================== */

.pipeline-blocks {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.pipeline-block {
    flex: 1;
    text-align: center;
    padding: 14px 8px;
    border-radius: var(--radius-sm);
    position: relative;
}

.pipeline-block-count {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.1;
}

.pipeline-block-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

.pipeline-block.draft { background: #fef3c7; }
.pipeline-block.review { background: #dbeafe; }
.pipeline-block.active { background: #d1fae5; }
.pipeline-block.published { background: #ede9fe; }
.pipeline-block.rejected { background: #fee2e2; }

.pipeline-bar {
    display: flex;
    height: 8px;
    border-radius: var(--radius-full);
    overflow: hidden;
    gap: 2px;
}

.pipeline-bar-seg {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.seg-draft { background: var(--color-amber); }
.seg-review { background: var(--color-accent); }
.seg-active { background: var(--color-green); }
.seg-published { background: var(--color-purple); }
.seg-rejected { background: var(--color-red); }

/* ========================================
   CHART CONTAINERS
   ======================================== */

.chart-container {
    position: relative;
    height: 220px;
}

.chart-container-lg {
    position: relative;
    height: 280px;
}

/* ========================================
   INVESTMENT OVERVIEW
   ======================================== */

.invest-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.invest-item {
    text-align: center;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-viewport);
}

.invest-item-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.invest-item-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
}

.invest-item-sub {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.funding-bar-container { margin-top: 12px; }

.funding-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.funding-bar {
    height: 10px;
    background: var(--color-bg-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.funding-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--color-green);
    transition: width 0.6s ease;
}

/* ========================================
   TOP STAKEHOLDERS
   ======================================== */

.stakeholder-list { display: flex; flex-direction: column; gap: 6px; }

.stakeholder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-viewport);
}

.stakeholder-rank {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.stakeholder-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stakeholder-type {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 500;
    flex-shrink: 0;
}

.stakeholder-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-primary);
    flex-shrink: 0;
}

.type-rec { background: #dbeafe; color: #1e40af; }
.type-bank { background: #fef3c7; color: #92400e; }
.type-gov { background: #d1fae5; color: #065f46; }
.type-soe { background: #ede9fe; color: #5b21b6; }
.type-other { background: var(--color-bg-subtle); color: var(--color-text-secondary); }

/* ========================================
   RECENT PROJECTS TABLE
   ======================================== */

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

.recent-table th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.recent-table td {
    font-size: 13px;
    padding: 10px;
    border-bottom: 1px solid var(--color-bg-subtle);
    color: var(--color-text-secondary);
    vertical-align: middle;
}

.recent-table tr:last-child td { border-bottom: none; }

.recent-table tr:hover td { background: var(--color-bg-viewport); }

.project-name-cell {
    font-weight: 500;
    color: var(--color-text-primary);
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-name-cell a {
    color: var(--color-text-primary);
    text-decoration: none;
}

.project-name-cell a:hover {
    color: var(--color-accent);
}

.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-draft { background: #fef3c7; color: #92400e; }
.badge-review { background: #dbeafe; color: #1e40af; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-published { background: #ede9fe; color: #5b21b6; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-pida { background: #fef3c7; color: #92400e; }

/* ========================================
   QUICK ACTIONS
   ======================================== */

.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-bg-surface);
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.quick-action-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: var(--color-accent-light);
}

.quick-action-btn svg { flex-shrink: 0; }

/* ========================================
   VIEW ALL LINK
   ======================================== */

.view-all-link {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.view-all-link:hover { text-decoration: underline; }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1199px) {
    .overview-blocks { grid-template-columns: repeat(3, 1fr); }
    .dash-grid-2,
    .dash-grid-3-1 { grid-template-columns: 1fr; }
    .invest-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 767px) {
    .app-shell { flex-direction: column; }

    .icon-rail {
        width: 100%;
        flex-direction: row;
        justify-content: space-around;
        padding: 6px;
        order: 3;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 1000;
        border-top: 1px solid var(--color-border);
        border-right: none;
        background: var(--color-bg-surface);
    }

    .primary-nav {
        width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .primary-nav.open { max-height: 80vh; }

    .main-content {
        padding: var(--space-2);
        padding-bottom: 80px;
    }

    .status-blocks { grid-template-columns: repeat(2, 1fr); }
    .overview-blocks { grid-template-columns: repeat(2, 1fr); }
    .status-block { border-right: none; }
    .pipeline-blocks { flex-wrap: wrap; }
    .pipeline-block { min-width: calc(50% - 4px); }
    .invest-grid { grid-template-columns: 1fr; }
    .ref-plan-row { grid-template-columns: 80px 1fr 36px; }

    .recent-table { font-size: 12px; }
    .recent-table th,
    .recent-table td { padding: 6px 8px; }
}

@media (min-width: 1400px) {
    .content-canvas { max-width: 1600px; }
}

/* ========================================
   INTERACTION & UTILITIES
   ======================================== */

button:focus, select:focus { outline: 2px solid var(--color-accent); outline-offset: 2px; }
button:active { transform: scale(0.98); }
.loading { opacity: 0.6; pointer-events: none; }

.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }

.nav-content::-webkit-scrollbar,
.main-content::-webkit-scrollbar { width: 6px; }

.nav-content::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track { background: transparent; }

.nav-content::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb { background: var(--color-gray-1); border-radius: var(--radius-full); }

.nav-content::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover { background: var(--color-gray-2); }

/* ========================================
   EXPLORER EXPERIENCE
   ======================================== */

/* ── Header: Greeting + Mode Toggle ── */
.ex-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.ex-greeting-text {
    font-size: 22px;
    font-weight: 300;
    color: #0f172a;
    line-height: 1.3;
}
.ex-greeting-time { color: #64748b; }
.ex-greeting-name { font-weight: 700; color: #0f172a; }
.ex-greeting-sub {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
    font-weight: 500;
}
.ex-mode-area {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.ex-mode-toggle {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
    border: 1px solid #e2e8f0;
}
.ex-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    white-space: nowrap;
}
.ex-mode-btn:hover {
    color: #334155;
    background: rgba(255,255,255,0.6);
}
.ex-mode-btn.active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
}
.ex-mode-btn.active[data-mode="investor"] { color: #059669; }
.ex-mode-btn.active[data-mode="researcher"] { color: #2563eb; }
.ex-ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.ex-ai-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

/* ── Mode Banner ── */
.ex-mode-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    margin-bottom: 18px;
}
.ex-mode-banner-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ex-mode-banner-body { flex: 1; min-width: 0; }
.ex-mode-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.ex-mode-desc {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
}

/* ── Stats Row ── */
.ex-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}
.ex-stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
    transition: all 0.15s;
}
.ex-stat-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.ex-stat-card.ex-stat-highlight {
    border-color: var(--accent, #2563eb);
    background: linear-gradient(180deg, #fff 60%, color-mix(in srgb, var(--accent, #2563eb) 6%, #fff));
}
.ex-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 2px;
}
.ex-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Section Titles ── */
.ex-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}
.ex-section-title svg { opacity: 0.5; flex-shrink: 0; }

/* ── Tools Grid ── */
.ex-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}
.ex-tool-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    text-decoration: none;
    color: #334155;
    transition: all 0.2s;
}
.ex-tool-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.ex-tool-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ex-tool-info { min-width: 0; }
.ex-tool-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1px;
}
.ex-tool-desc {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

/* ── Sector Investment Cards ── */
.ex-sector-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}
.ex-sector-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: #334155;
    transition: all 0.2s;
    border-top: 3px solid var(--sector-color, #94a3b8);
}
.ex-sector-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border-color: #cbd5e1;
}
.ex-sector-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}
.ex-sector-meta {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    margin-bottom: 10px;
}
.ex-sector-financials {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ex-sector-fin-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}
.ex-sector-fin-row span { color: #64748b; }
.ex-sector-fin-row strong { font-weight: 700; color: #0f172a; }

/* ── Region Bars ── */
.ex-region-bars {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}
.ex-region-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f8fafc;
}
.ex-region-row:last-child { border-bottom: none; }
.ex-region-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    width: 130px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ex-region-bar-wrap {
    flex: 1;
    height: 10px;
    background: #f1f5f9;
    border-radius: 5px;
    overflow: hidden;
}
.ex-region-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}
.ex-region-stat {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    width: 60px;
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
}
.ex-region-stat small,
.ex-region-gap small {
    font-weight: 500;
    color: #94a3b8;
    font-size: 10px;
}
.ex-region-gap {
    font-size: 12px;
    font-weight: 700;
    color: #dc2626;
    width: 80px;
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .ex-header { flex-direction: column; gap: 12px; }
    .ex-greeting-text { font-size: 18px; }
    .ex-mode-area { width: 100%; justify-content: space-between; }
    .ex-stats-row { grid-template-columns: repeat(2, 1fr); }
    .ex-tools-grid { grid-template-columns: 1fr; }
    .ex-sector-cards { grid-template-columns: 1fr; }
    .ex-region-name { width: 90px; font-size: 12px; }
    .ex-region-gap { width: 65px; font-size: 11px; }
}

/* ========================================
   EXPLORER AI CHAT
   ======================================== */

/* AI Chat Widget */
.ai-chat-widget {
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    max-height: 480px;
}
.ai-chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fafc, #eff6ff);
    border-bottom: 1px solid #e2e8f0;
}
.ai-chat-icon {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 340px;
    min-height: 120px;
}
.ai-msg {
    display: flex;
    gap: 8px;
    max-width: 90%;
}
.ai-msg-bot { align-self: flex-start; }
.ai-msg-user { align-self: flex-end; flex-direction: row-reverse; }
.ai-msg-avatar {
    width: 26px; height: 26px;
    background: #eff6ff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: #2563eb;
}
.ai-msg-body {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.55;
    color: #1e293b;
}
.ai-msg-body p { margin: 0 0 6px; }
.ai-msg-body p:last-child { margin-bottom: 0; }
.ai-msg-body ul { margin: 4px 0 6px 16px; padding: 0; }
.ai-msg-body li { margin-bottom: 4px; }
.ai-msg-user .ai-msg-body {
    background: #2563eb;
    color: #fff;
    border-color: #1d4ed8;
}

/* AI Suggestion Chips */
.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.ai-suggestion-chip {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.ai-suggestion-chip:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    transform: translateY(-1px);
}

/* AI Navigation Links (in chat responses) */
.ai-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
    font-size: 12.5px;
    padding: 2px 0;
    border-bottom: 1px dashed #93c5fd;
    transition: all 0.15s;
}
.ai-nav-link:hover {
    color: #1d4ed8;
    border-bottom-color: #2563eb;
}

/* AI Chat Input */
.ai-chat-input-wrap {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    background: #fafbfc;
}
.ai-chat-input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    color: #1e293b;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}
.ai-chat-input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.ai-chat-input::placeholder { color: #94a3b8; }
.ai-chat-send {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.ai-chat-send:hover { background: linear-gradient(135deg, #1d4ed8, #1e40af); transform: scale(1.05); }
.ai-chat-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Typing indicator */
.ai-typing {
    display: flex; gap: 4px; padding: 4px 0;
}
.ai-typing span {
    width: 7px; height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: aiTyping 1.4s infinite ease-in-out both;
}
.ai-typing span:nth-child(1) { animation-delay: 0s; }
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiTyping {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}
