/* ==========================================
   EXECUTIVE DASHBOARD — CEO VIEW
   Modern, professional design for leadership
   ========================================== */

:root {
    --dash-bg: var(--surface-background);
    --dash-surface: var(--surface-elevated);
    --dash-border: var(--border-default);
    --dash-text: var(--text-primary);
    --dash-text-muted: var(--text-secondary);
    --dash-primary: var(--brand-primary);
    --dash-primary-hover: var(--brand-primary-hover);
    --dash-rail-bg: var(--surface-sidebar);
    --dash-rail-width: var(--sidebar-rail);
    --dash-filter-width: var(--filter-panel-width);
    --dash-radius: var(--radius-lg);
    --dash-shadow: var(--shadow-sm);
    --color-planned: var(--status-planned);
    --color-forecast: var(--status-forecast);
    --color-invoiced: var(--status-invoiced);
    --color-paid: var(--status-paid);
    --color-at-risk: var(--status-at-risk);
    --color-future: var(--text-muted);
    
    /* CEO Dashboard specific tokens */
    --ceo-success: #10b981;
    --ceo-warning: #f59e0b;
    --ceo-danger: #ef4444;
    --ceo-info: #3b82f6;
}

body {
    font-family: var(--font-family);
    background: var(--dash-bg);
    color: var(--dash-text);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.gantt-segment:hover {
    filter: brightness(1.08);
    z-index: 10;
}

/* ==========================================
   CEO DASHBOARD LAYOUT
   ========================================== */

.exec-dashboard {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--space-4);
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.crm-page-header {
    margin-bottom: var(--space-4);
}

.crm-page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.crm-page-header h1::before {
    content: '';
    width: 6px;
    height: 32px;
    background: var(--brand-primary);
    border-radius: 3px;
}

/* Alert/Warning Banner */
.revenue-setup-warnings {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-left: 4px solid var(--ceo-warning);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.revenue-setup-warnings h3 {
    color: #92400e;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 var(--space-2) 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.revenue-setup-warnings h3::before {
    content: '⚠️';
    font-size: 1.1rem;
}

.revenue-setup-warning-list {
    margin: 0;
    padding-left: var(--space-5);
    color: #78350f;
    font-size: 0.875rem;
}

.revenue-setup-warning-list li {
    margin-bottom: var(--space-1);
    font-weight: 500;
}

.revenue-setup-warning-list li strong {
    color: #451a03;
    font-weight: 600;
}

/* Executive Summary Cards - Hero Section */
.exec-summary-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.exec-summary-card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.exec-summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--card-accent, var(--brand-primary));
    opacity: 0.8;
}

.exec-summary-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
    border-color: var(--brand-primary);
}

.exec-summary-card.card-target::before { background: var(--text-muted); }
.exec-summary-card.card-achieved::before { background: var(--ceo-success); }
.exec-summary-card.card-completed::before { background: var(--ceo-success); }
.exec-summary-card.card-on-track::before { background: var(--ceo-info); }
.exec-summary-card.card-behind::before { background: var(--ceo-danger); }
.exec-summary-card.card-safe::before { background: var(--ceo-success); }

.exec-summary-num {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: var(--space-1);
    letter-spacing: -0.02em;
}

.exec-summary-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* KPI Strip - Enhanced Cards */
.exec-kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.exec-kpi {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    position: relative;
    overflow: hidden;
}

.exec-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.1);
    border-color: var(--color-neutral-400);
}

.exec-kpi.enhanced-kpi {
    border-top: 3px solid var(--brand-primary);
}

.exec-kpi-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.3;
}

.exec-kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.exec-kpi-goal {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: var(--space-1);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-subtle);
}

.kpi-goal-row {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.kpi-goal-row.attainment-green { color: var(--ceo-success); font-weight: 600; }
.kpi-goal-row.attainment-amber { color: var(--ceo-warning); font-weight: 600; }
.kpi-goal-row.attainment-red { color: var(--ceo-danger); font-weight: 600; }

.kpi-bar-track {
    width: 100%;
    height: 6px;
    background: var(--border-default);
    border-radius: 3px;
    overflow: hidden;
    margin-top: var(--space-1);
}

.kpi-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-bar-fill.attainment-green { background: var(--ceo-success); }
.kpi-bar-fill.attainment-amber { background: var(--ceo-warning); }
.kpi-bar-fill.attainment-red { background: var(--ceo-danger); }

/* Charts Section */
.dashboard-charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.exec-chart-card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.exec-chart-card:hover {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}

.exec-chart-card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-3) 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.chart-subtitle {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: var(--space-1);
}

/* ==========================================
   ROLE-BASED DASHBOARD WIDGET GRID
   ========================================== */

.role-dashboard > .crm-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.role-dashboard .dashboard-subtitle {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

.dashboard-loading {
    text-align: center;
    padding: var(--space-8);
    color: var(--text-muted);
    font-size: 1rem;
}

.dashboard-error {
    background: #fef2f2;
    border: 1px solid var(--ceo-danger);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    color: #991b1b;
    font-weight: 500;
    text-align: center;
}

/* Widget Grid Layout */
.role-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-3);
    padding: 0 0 var(--space-4) 0;
}

.role-dashboard > .crm-page-header {
    grid-column: 1 / -1;
}

.dashboard-widget {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.dashboard-widget:hover {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
    border-color: var(--color-neutral-400);
}

/* Widget Header */
.widget-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4) 0 var(--space-4);
    margin-bottom: var(--space-2);
}

.widget-icon {
    font-size: 1.3rem;
    line-height: 1;
    flex-shrink: 0;
}

.widget-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
    line-height: 1.3;
}

/* Widget Body */
.widget-body {
    padding: var(--space-2) var(--space-4) var(--space-4) var(--space-4);
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* KPI Widget */
.kpi-widget .kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-1);
}

.kpi-widget .kpi-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Chart Widget */
.chart-widget .widget-body {
    min-height: 180px;
}

/* List Widget */
.list-widget .widget-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.list-widget .widget-list li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.list-widget .widget-list li:last-child {
    border-bottom: none;
}

.list-widget .list-item-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-widget .list-item-metric {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.list-widget .list-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Ranked List */
.widget-list.ranked li {
    padding-left: var(--space-1);
}

.rank-number {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.rank-1 .rank-number { background: #fbbf24; color: #1a2332; }
.rank-2 .rank-number { background: #94a3b8; color: #1a2332; }
.rank-3 .rank-number { background: #d97706; color: #fff; }

/* Status Badges */
.deal-status-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.deal-status-badge.status-won {
    background: #dcfce7;
    color: #166534;
}

.deal-status-badge.status-lost {
    background: #fef2f2;
    color: #991b1b;
}

.deal-status-badge.status-open {
    background: #eff6ff;
    color: #1e40af;
}

/* Goal Percentage Badges */
.goal-pct-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}

.goal-pct-badge.pct-completed,
.goal-pct-badge.rank-complete {
    background: #dcfce7;
    color: #166534;
}

.goal-pct-badge.pct-on-track,
.goal-pct-badge.rank-ontrack {
    background: #fef3c7;
    color: #92400e;
}

.goal-pct-badge.pct-behind,
.goal-pct-badge.rank-behind {
    background: #fef2f2;
    color: #991b1b;
}

/* Progress Widget */
.progress-widget .widget-body {
    gap: var(--space-2);
}

.progress-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--border-default);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.progress-complete { background: var(--ceo-success); }
.progress-fill.progress-on-track { background: var(--ceo-info); }
.progress-fill.progress-behind { background: var(--ceo-danger); }

/* Summary Widget */
.summary-widget .widget-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    background: var(--surface-hover);
}

.summary-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Empty State */
.widget-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: var(--space-4) 0;
    margin: 0;
}

/* Chart: Dual Bar Chart */
.dual-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 160px;
    padding-top: var(--space-2);
}

.dual-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.dual-bar-pair {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    justify-content: center;
}

.dual-bar {
    width: 8px;
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height 0.4s ease;
}

.dual-bar-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
}

/* Chart: Won vs Lost */
.won-lost-chart {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-2) 0;
}

.pie-chart {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #fef2f2;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.pie-segment {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    clip: rect(0, 100px, 100px, 50px);
}

.pie-segment.won {
    background: #22c55e;
    transform-origin: center;
}

.pie-segment.lost {
    background: #ef4444;
    transform-origin: center;
}

.won-legend {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-color.won { background: #22c55e; }
.legend-color.lost { background: #ef4444; }

/* Chart: Growth/Monthly Bar */
.growth-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 160px;
    padding-top: var(--space-2);
}

.growth-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.growth-bar {
    width: 100%;
    max-width: 24px;
    border-radius: 3px 3px 0 0;
    background: var(--brand-primary);
    min-height: 2px;
    transition: height 0.4s ease;
}

.growth-bar-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
}

/* Responsive */
@media (max-width: 1024px) {
    .role-dashboard {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .role-dashboard {
        grid-template-columns: 1fr;
        gap: var(--space-2);
    }
}

@media (max-width: 480px) {
    .dual-bar-chart,
    .growth-chart {
        height: 120px;
    }
    .summary-widget .widget-body {
        grid-template-columns: 1fr;
    }
}

/* Bottom Panels */
.dashboard-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.panel-card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel-card:hover {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}

.panel-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-3) 0;
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--border-default);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.panel-card h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--brand-primary);
    border-radius: 2px;
}

/* Upcoming Widget */
.upcoming-widget {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    margin-top: var(--space-4);
}

.upcoming-widget-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-3) 0;
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--border-default);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.upcoming-widget-title::before {
    content: '📅';
    font-size: 1.1rem;
}

/* Enhanced Tables */
.goal-risk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.goal-risk-table thead {
    background: var(--surface-input);
    border-bottom: 2px solid var(--border-default);
}

.goal-risk-table th {
    text-align: left;
    padding: var(--space-3) var(--space-3);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.goal-risk-table td {
    padding: var(--space-3) var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.goal-risk-table tbody tr {
    transition: background 0.15s ease;
}

.goal-risk-table tbody tr:hover {
    background: var(--surface-hover);
}

.goal-risk-table tbody tr:last-child td {
    border-bottom: none;
}

.empty-cell {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: var(--space-4) !important;
}

/* Status Badges */
.goal-pct-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    gap: 4px;
}

.pct-completed {
    background: #d1fae5;
    color: #065f46;
}

.pct-on-track {
    background: #dbeafe;
    color: #1e40af;
}

.pct-behind {
    background: #fee2e2;
    color: #991b1b;
}

/* Enhanced Bar Chart */
.dual-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 240px;
    padding: var(--space-3) var(--space-2) var(--space-2);
    position: relative;
}

.dual-bar-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.dual-bar-col:hover {
    transform: translateY(-4px);
}

.dual-bar-pair {
    width: 100%;
    display: flex;
    gap: 3px;
    align-items: flex-end;
    justify-content: center;
    height: 100%;
}

.dual-bar {
    width: 60%;
    border-radius: 4px 4px 0 0;
    transition: all 0.3s ease;
    position: relative;
}

.dual-bar:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dual-bar-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
}

.dual-chart-legend {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.swatch-target { background: var(--color-planned); }
.swatch-achieved { background: var(--ceo-success); }

.goal-line-legend {
    padding-left: var(--space-2);
    border-left: 2px solid var(--border-default);
    color: var(--text-muted);
    font-weight: 600;
}

/* Pipeline Coverage Ring */
.pipeline-coverage-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) 0;
}

.coverage-ring-wrap {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coverage-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.coverage-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.pipeline-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.pipeline-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    background: var(--surface-input);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.pd-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.pd-value {
    color: var(--text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.pd-value.text-green { color: var(--ceo-success); }
.pd-value.text-amber { color: var(--ceo-warning); }

.coverage-insight {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
    background: var(--surface-input);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--brand-primary);
}

/* Year / quarter filter toggles */
.year-filter-row,
.quarter-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.year-btn,
.quarter-btn {
    flex: 1 1 calc(25% - 6px);
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--dash-border);
    border-radius: 6px;
    background: var(--dash-surface);
    color: var(--dash-text-muted);
    font-size: 0.72rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.15s ease;
}

.year-btn:hover,
.quarter-btn:hover {
    border-color: var(--dash-primary);
    color: var(--dash-primary);
}

.year-btn.active,
.quarter-btn.active {
    background: var(--dash-primary);
    border-color: var(--dash-primary);
    color: var(--text-on-brand);
}

/* Timeline hover card */
.timeline-hover-card {
    position: fixed;
    z-index: 10000;
    width: min(380px, calc(100vw - 24px));
    max-width: 380px;
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    padding: 12px 14px;
    font-size: 0.75rem;
    line-height: 1.4;
    pointer-events: none;
    overflow: hidden;
}

.hover-header {
    border-bottom: 1px solid var(--dash-border);
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.hover-deal-name {
    font-weight: var(--font-weight-semibold);
    font-size: 0.85rem;
    color: var(--dash-text);
    margin-bottom: 4px;
}

.hover-deal-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hover-stage-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: var(--font-weight-semibold);
    background: #dcfce7;
    color: #166534;
}

.hover-stage-qualification { background: #e0e7ff; color: #3730a3; }
.hover-stage-proposal { background: #fef3c7; color: #92400e; }
.hover-stage-negotiation { background: #ffedd5; color: #9a3412; }
.hover-stage-closed { background: #dcfce7; color: #166534; }
.hover-stage-closedLost { background: #fee2e2; color: #991b1b; }

.hover-meta-dot,
.hover-probability {
    font-size: 0.68rem;
    color: var(--dash-text-muted);
}

.hover-probability {
    font-weight: var(--font-weight-semibold);
    color: var(--dash-primary);
}

.hover-section {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-default);
}

.hover-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.hover-section-title {
    font-size: 0.68rem;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--dash-text-muted);
    margin-bottom: 4px;
}

.hover-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 2px 0;
}

.hover-row strong {
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text);
}

.hover-row-primary strong {
    color: var(--dash-primary);
}

.hover-date-range {
    font-size: 0.72rem;
    color: var(--dash-text);
    margin-bottom: 4px;
}

.hover-progress-bar {
    font-family: monospace;
    font-size: 0.65rem;
    letter-spacing: 1px;
    color: var(--dash-primary);
    margin: 4px 0 2px;
    overflow: hidden;
    white-space: nowrap;
}

.hover-progress-label {
    font-size: 0.68rem;
    color: var(--dash-text-muted);
}

.hover-row-highlight strong {
    font-size: 0.85rem;
    color: var(--dash-text);
}

.hover-row-achievement strong {
    color: var(--dash-primary);
}

.hover-muted {
    font-size: 0.68rem;
    color: var(--dash-text-muted);
    margin-top: 4px;
}


.app-container {
    display: none;
}

.app-shell {
    display: flex;
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* App body */
.app-body {
    flex: 1;
    display: flex;
    min-width: 0;
    min-height: 0;
    height: 100%;
}

/* Filter panel */
.filter-panel {
    width: var(--dash-filter-width);
    background: var(--dash-surface);
    border-right: 1px solid var(--dash-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.2s ease, border 0.2s ease;
}

.filter-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem var(--spacing-md);
    border-bottom: 1px solid var(--dash-border);
    flex-shrink: 0;
}

.filter-panel-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text);
}

.filter-panel-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--dash-border);
    border-radius: 6px;
    background: var(--dash-surface);
    cursor: pointer;
    color: var(--dash-text-muted);
}

.filter-panel-toggle:hover {
    background: var(--color-neutral-50);
}

.filter-panel.collapsed {
    display: none;
}

.filter-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.filter-block label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--spacing-xs);
}

.filter-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xs);
}

.filter-block-header label {
    margin-bottom: 0;
}

.link-btn {
    background: none;
    border: none;
    color: var(--dash-primary);
    font-size: var(--font-size-xs);
    cursor: pointer;
    font-weight: var(--font-weight-medium);
}

.link-btn:hover {
    text-decoration: underline;
}

.filter-sub-label {
    display: block;
    font-size: 0.65rem;
    font-weight: var(--font-weight-medium);
    color: var(--dash-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 8px 0 4px;
}

.filter-month-select {
    margin-bottom: 8px;
}

.date-range-display {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-md);
    background: var(--surface-input);
}

.date-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.date-field-label {
    font-size: 0.62rem;
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.date-range-display input[type="date"] {
    width: 100%;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--dash-border);
    border-radius: 6px;
    background: var(--dash-surface);
    font-size: 0.75rem;
    font-family: inherit;
    color: var(--dash-text);
    box-sizing: border-box;
}

.date-range-display input[type="date"]:focus {
    outline: none;
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.date-range-sep {
    color: var(--dash-text-muted);
    font-size: var(--font-size-sm);
    padding-bottom: 8px;
    line-height: 1;
}

.view-segmented {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: var(--surface-input);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
}

.view-segmented.view-toggle {
    flex-direction: row;
}

.view-segmented .view-btn {
    flex: 1;
    padding: 6px 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--dash-text-muted);
    cursor: pointer;
    text-align: center;
}

.view-segmented .view-btn.active {
    background: var(--dash-surface);
    color: var(--dash-primary);
    box-shadow: var(--shadow-xs);
}

.filter-panel .form-input,
.filter-panel select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    background: var(--dash-surface);
    margin-bottom: var(--spacing-sm);
}

.multi-select {
    position: relative;
    margin-bottom: var(--spacing-sm);
}

.multi-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-md);
    background: var(--dash-surface);
    font-size: var(--font-size-sm);
    color: var(--dash-text);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.multi-select-trigger:hover {
    border-color: var(--dash-primary);
}

.multi-select-trigger.open {
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.multi-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-select-chevron {
    flex-shrink: 0;
    color: var(--dash-text-muted);
    transition: transform 0.2s;
}

.multi-select-trigger.open .multi-select-chevron {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    max-height: 200px;
    overflow-y: auto;
}

.multi-select-dropdown.open {
    display: block;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: var(--font-size-sm);
    color: var(--dash-text);
    cursor: pointer;
    transition: background 0.1s;
}

.multi-select-option:hover {
    background: var(--color-neutral-50);
}

.multi-select-option input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}

.select-all-option {
    border-bottom: 1px solid var(--dash-border);
    font-weight: var(--font-weight-semibold);
}

.multi-select-options {
    max-height: 150px;
    overflow-y: auto;
}

.status-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.status-checkboxes .checkbox {
    font-size: var(--font-size-sm);
    color: var(--dash-text);
}

.dimension-toggle {
    display: flex;
    gap: 6px;
    margin-bottom: var(--spacing-sm);
}

.dimension-toggle .filter-btn {
    flex: 1;
    text-align: center;
    margin: 0;
}

.period-preset {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: var(--spacing-sm);
}

.period-type-row {
    display: flex;
    gap: 4px;
}

.period-type-btn {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid var(--dash-border);
    border-radius: 4px;
    background: var(--dash-surface);
    color: var(--dash-text-muted);
    font-size: 0.7rem;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.period-type-btn:hover {
    border-color: var(--dash-primary);
    color: var(--dash-text);
}

.period-type-btn.active {
    background: var(--dash-primary);
    color: var(--text-on-brand);
    border-color: var(--dash-primary);
}

.period-offset-row {
    display: flex;
    gap: 4px;
}

.offset-btn {
    flex: 1;
    padding: 5px 6px;
    border: 1px solid var(--dash-border);
    border-radius: 4px;
    background: var(--dash-surface);
    color: var(--dash-text);
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    transition: background 0.12s, border-color 0.12s;
}

.offset-btn:hover {
    border-color: var(--dash-primary);
}

.offset-btn.active {
    background: var(--dash-primary);
    color: var(--text-on-brand);
    border-color: var(--dash-primary);
}

.period-custom {
    margin-top: 4px;
}

.scope-toggle {
    display: flex;
    gap: 6px;
}

.scope-toggle .filter-btn {
    flex: 1;
    text-align: center;
    margin: 0;
}

.filter-btn {
    padding: 6px 10px;
    border: 1px solid var(--dash-border);
    border-radius: 6px;
    background: var(--dash-surface);
    font-size: var(--font-size-xs);
    cursor: pointer;
    margin-right: 4px;
    margin-bottom: 4px;
}

.filter-btn.active {
    background: var(--dash-primary);
    color: var(--text-on-brand);
    border-color: var(--dash-primary);
}

.page-header-actions .btn-primary {
    background: var(--dash-primary);
    border-color: var(--dash-primary);
    font-size: var(--font-size-sm);
    padding: 8px 16px;
}

.page-header-actions .btn-secondary {
    font-size: var(--font-size-sm);
    padding: 8px 14px;
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
}

.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.icon-svg {
    flex-shrink: 0;
    color: var(--dash-text-muted);
}

.icon-chevron {
    color: var(--dash-text-muted);
}

.toolbar-period-btn .icon-svg:first-child {
    color: var(--dash-text-muted);
}
.filter-panel-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--dash-border);
}

.btn-apply-filters {
    width: 100%;
    padding: 10px;
    background: var(--dash-primary);
    color: var(--text-on-brand);
    border: none;
    border-radius: var(--radius-md);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.btn-apply-filters:hover {
    background: var(--dash-primary-hover);
}

/* Main panel */
.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.page-header {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: var(--dash-surface);
    border-bottom: 1px solid var(--dash-border);
    flex-shrink: 0;
}

/* Deal pipeline header */
.deal-pipeline-header {
    background: var(--surface-elevated);
    border-bottom: 1px solid var(--border-default);
}

.deal-header-main {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    min-height: var(--space-7);
}

.deal-header-title {
    margin: 0;
    font-size: var(--font-title);
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.view-dropdown {
    position: relative;
    flex-shrink: 0;
}

.view-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 var(--space-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--surface-input);
    color: var(--text-primary);
    font-size: var(--font-label);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    min-height: var(--control-height);
    white-space: nowrap;
    transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

.view-dropdown-trigger:hover {
    background: var(--surface-hover);
    border-color: var(--color-neutral-400);
}

.view-dropdown-chevron {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.view-dropdown-trigger[aria-expanded="true"] .view-dropdown-chevron {
    transform: rotate(180deg);
}

.view-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 100;
    min-width: 140px;
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}

.view-dropdown-menu.open {
    display: block;
}

.view-dropdown-option {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-label);
    cursor: pointer;
    text-align: left;
    transition: background var(--transition-fast);
}

.view-dropdown-option:hover {
    background: var(--color-neutral-50);
}

.view-dropdown-option.active {
    color: var(--brand-primary);
    font-weight: var(--font-weight-semibold);
}

.deal-meta-new-btn {
    white-space: nowrap;
    margin-left: auto;
}

.deal-header-search {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex: 1 1 160px;
    max-width: 420px;
    min-width: 120px;
    padding: 0 var(--space-2);
    height: var(--control-height);
    background: var(--surface-input);
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.deal-header-search:focus-within {
    background: var(--surface-elevated);
    border-color: var(--color-neutral-300);
    box-shadow: var(--shadow-focus);
}

.deal-header-search-icon {
    flex-shrink: 0;
    color: var(--text-muted);
}

.deal-header-search-input {
    flex: 1;
    min-width: 0;
    width: auto;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: var(--font-label);
    color: var(--text-primary);
    outline: none;
    min-height: auto;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
}

.deal-header-search-input:focus {
    border: none !important;
    box-shadow: none !important;
}

.deal-header-search-input::placeholder {
    color: var(--text-muted);
}

.deal-header-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.deal-header-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: auto;
    height: var(--control-height);
    padding: 0 var(--space-1);
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.icon-btn-label {
    font-size: var(--font-caption);
    color: var(--text-tertiary);
}

.deal-header-icon-btn:hover {
    color: var(--text-primary);
    background: var(--surface-input);
}

.deal-header-icon-btn:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.deal-header-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--control-height);
    height: var(--control-height);
    margin-left: 4px;
    padding: 0;
    border: 2px solid var(--surface-elevated);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-navy-light) 0%, var(--brand-primary) 50%, var(--brand-accent) 100%);
    box-shadow: 0 0 0 1px var(--border-default);
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
}

.deal-header-avatar-initials {
    font-size: var(--font-caption);
    font-weight: var(--font-weight-semibold);
    color: var(--text-on-brand);
    line-height: 1;
    user-select: none;
}

.deal-header-avatar.has-photo {
    background: var(--border-default);
}

.deal-header-avatar.has-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.deal-header-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 6px var(--space-3) var(--space-1);
    border-top: 1px solid var(--border-subtle);
}

.deal-header-meta-left {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-wrap: wrap;
}

.deal-meta-new-btn {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-height);
    padding: 0 var(--space-2);
    border: none;
    border-radius: var(--radius-md);
    background: var(--brand-primary);
    color: var(--text-on-brand);
    font-size: var(--font-label);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.deal-meta-new-btn:hover {
    background: var(--brand-primary-hover);
}

.deal-meta-new-btn:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-xs);
}

.page-header-text h1 {
    font-size: 1.35rem;
    font-weight: var(--font-weight-bold);
    margin: 0 0 4px;
    color: var(--dash-text);
}

.page-subtitle {
    font-size: var(--font-size-sm);
    color: var(--dash-text-muted);
    margin: 0;
}

.page-header-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    flex-shrink: 0;
}

.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding: var(--spacing-xs) var(--spacing-md) var(--spacing-sm);
    border-top: 1px solid var(--border-default);
    flex-wrap: wrap;
}

.page-toolbar-left,
.page-toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.page-toolbar-right {
    margin-left: auto;
    flex-direction: row;
    flex-wrap: nowrap;
}

.toolbar-static-label,
.filter-section-label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    user-select: none;
    pointer-events: none;
}

.toolbar-period-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--dash-border);
    border-radius: 8px;
    background: var(--dash-surface);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--dash-text);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.toolbar-period-btn:hover {
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.toolbar-period-btn:focus-visible,
.toolbar-text-btn:focus-visible,
.view-btn:focus-visible,
.kpi-card:focus-visible,
.kpi-card-hero:focus-visible,
.filter-chip-remove:focus-visible {
    outline: 2px solid var(--dash-primary);
    outline-offset: 2px;
}

.toolbar-text-btn {
    background: none;
    border: none;
    color: var(--dash-primary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
}

.toolbar-text-btn:hover {
    text-decoration: underline;
    background: var(--brand-primary-subtle);
}

.page-active-filters {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    padding: 6px var(--spacing-md) 8px;
    background: var(--surface-input);
    border-top: 1px solid var(--border-default);
    min-height: 36px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.filter-chips-empty {
    font-size: var(--font-size-xs);
    color: var(--dash-text-muted);
    font-style: italic;
}

.filter-chips-empty[hidden] {
    display: none;
}

.filter-section-label.is-muted {
    color: var(--text-muted);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--brand-primary-subtle);
    color: var(--brand-primary);
    border: 1px solid var(--brand-primary);
    border-radius: 999px;
    padding: 3px 4px 3px 10px;
    font-size: 0.72rem;
    font-weight: var(--font-weight-medium);
    cursor: default;
}

.filter-chip-label {
    pointer-events: none;
}

.filter-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--brand-primary-subtle);
    border: 1px solid var(--brand-primary);
    border-radius: 50%;
    color: var(--brand-primary-hover);
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0;
    transition: background 0.12s;
}

.filter-chip-remove:hover {
    background: var(--surface-hover);
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-md);
    background: var(--dash-surface);
    cursor: pointer;
    font-size: var(--font-size-base);
    color: var(--dash-text-muted);
}

.btn-icon:hover {
    background: var(--surface-hover);
}

/* KPI funnel */
:root {
    --kpi-card-min-h: 5rem;
}

.kpi-funnel-section {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-xs);
    background: var(--dash-bg);
}

.kpi-funnel-bar {
    display: flex;
    height: 4px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
    background: var(--border-default);
}

.kpi-funnel-seg {
    height: 100%;
    min-width: 2px;
    transition: flex-grow 0.3s ease;
}

.kpi-funnel-planned { background: var(--text-muted); }
.kpi-funnel-forecast { background: var(--brand-primary); }
.kpi-funnel-actual { background: var(--status-success); }
.kpi-funnel-risk { background: var(--status-warning); }

.kpi-funnel-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--spacing-sm);
    align-items: stretch;
    padding-bottom: 4px;
}

.kpi-funnel-grid > .kpi-group {
    min-width: 0;
}

.kpi-group-pipeline {
    grid-column: span 2;
}

.kpi-group-outcome {
    grid-column: span 1;
}

.kpi-card-outcome {
    cursor: help;
}

.kpi-achievement-simple {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.kpi-achievement-simple .kpi-card-value {
    margin-bottom: 0;
}

.kpi-outcome-divider {
    border: none;
    border-top: 1px solid var(--dash-border);
    margin: 10px 0 8px;
}

.kpi-outcome-risk {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

.kpi-outcome-risk-label {
    color: var(--dash-text-muted);
    font-weight: var(--font-weight-semibold);
    flex-shrink: 0;
}

.kpi-outcome-risk-value {
    font-weight: var(--font-weight-bold);
    font-variant-numeric: tabular-nums;
    color: var(--status-warning);
}

.kpi-outcome-risk .kpi-card-trend {
    font-size: 0.65rem;
    flex-shrink: 0;
}

.kpi-outcome-risk-spark {
    margin-left: auto;
    width: 56px;
    height: 14px;
    flex-shrink: 0;
}

.kpi-funnel-grid.grid-12 {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--spacing-sm);
}

.kpi-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.kpi-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.kpi-group-bar {
    width: 28px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.kpi-group-title {
    font-size: 0.65rem;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.kpi-group-target .kpi-group-bar { background: var(--text-muted); }
.kpi-group-pipeline .kpi-group-bar { background: var(--brand-primary); }
.kpi-group-closed .kpi-group-bar { background: var(--status-success); }
.kpi-group-watch .kpi-group-bar { background: var(--status-warning); }
.kpi-group-outcome .kpi-group-bar { background: var(--status-forecast); }

.kpi-group-cards {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: var(--spacing-sm);
    flex: 1;
    min-width: 0;
    align-items: flex-start;
}

.kpi-group-cards > .kpi-card {
    flex: 1;
    min-width: 0;
}

.kpi-card {
    display: flex;
    flex-direction: column;
    text-align: left;
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    padding: 12px 14px;
    box-shadow: var(--dash-shadow);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    width: 100%;
    min-height: var(--kpi-card-min-h);
    box-sizing: border-box;
}

.kpi-card:hover {
    border-color: var(--color-neutral-400);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.kpi-card.is-active {
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.kpi-card:active {
    transform: translateY(1px);
}

.kpi-card-target { border-top: 3px solid var(--text-muted); }
.kpi-card-pipeline { border-top: 3px solid var(--brand-primary); }
.kpi-card-closed { border-top: 3px solid var(--status-success); }
.kpi-card-watch { border-top: 3px solid var(--status-warning); }

.kpi-card-hero {
    border-top: 3px solid var(--status-forecast);
    cursor: help;
    padding: 12px 14px;
    box-sizing: border-box;
}

.kpi-card-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.kpi-card-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--dash-text-muted);
    flex-shrink: 0;
}

.kpi-card-icon svg {
    display: block;
}

.kpi-info-dot {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

.kpi-card-value {
    font-size: clamp(1rem, 1.8vw, 1.5rem);
    font-weight: var(--font-weight-bold);
    color: var(--dash-text);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    word-break: break-all;
}

.kpi-card-full {
    font-size: 0.7rem;
    color: var(--dash-text-muted);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}

.kpi-card-trend {
    font-size: 0.7rem;
    font-weight: var(--font-weight-semibold);
    margin-top: 6px;
}

.kpi-card-trend.positive { color: var(--status-success); }
.kpi-card-trend.negative { color: var(--status-danger); }
.kpi-card-trend.neutral { color: var(--dash-text-muted); }

.kpi-sparkline {
    display: none;
}

.kpi-card-name {
    font-size: 0.72rem;
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text-muted);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-achievement-body {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kpi-ring-wrap {
    position: relative;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
}

.kpi-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.kpi-ring-bg {
    fill: none;
    stroke: var(--brand-accent-subtle);
    stroke-width: 3;
}

.kpi-ring-fill {
    fill: none;
    stroke: var(--status-forecast);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 100 100;
    stroke-dashoffset: calc(100 - var(--ring-pct, 0));
    transition: stroke-dashoffset 0.4s ease, stroke 0.3s;
}

.kpi-ring-wrap.ring-red .kpi-ring-fill { stroke: var(--status-danger); }
.kpi-ring-wrap.ring-amber .kpi-ring-fill { stroke: var(--status-warning); }
.kpi-ring-wrap.ring-green .kpi-ring-fill { stroke: var(--status-success); }

.kpi-ring-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: var(--font-weight-bold);
    color: var(--dash-text);
}

.kpi-achievement-meta {
    flex: 1;
    min-width: 0;
}

.kpi-achievement-target {
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text);
    line-height: 1.4;
    word-break: break-word;
}

.kpi-achievement-pace {
    font-size: 0.68rem;
    font-weight: var(--font-weight-semibold);
    margin-top: 4px;
}

.kpi-achievement-pace.positive { color: var(--status-success); }
.kpi-achievement-pace.negative { color: var(--status-danger); }
.kpi-achievement-pace.neutral { color: var(--dash-text-muted); }

.insights-banner {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin: 0 var(--spacing-md) var(--spacing-sm);
    padding: 10px 14px;
    background: var(--brand-primary-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--dash-radius);
}

.insights-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.insights-text {
    flex: 1;
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    line-height: 1.4;
}

.btn-sm {
    padding: 6px 12px;
    font-size: var(--font-size-xs);
    flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
    .kpi-ring-fill,
    .kpi-funnel-seg,
    .kpi-card {
        transition: none;
    }
}

/* Legacy filter chips section — removed from layout */
.filter-chips-section {
    display: none;
}

/* Legacy kpi row */
.kpi-row {
    display: none;
}

.kpi-card-mock {
    display: none;
}

/* Dashboard content */
.dashboard-scroll {
    padding: var(--spacing-xs) var(--spacing-sm) var(--spacing-sm);
}

/* Deal pipeline — sticky toolbar only; KPI + views scroll together */
#route-deals .app-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

#route-deals .app-body {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 100%;
    overflow: hidden;
}

#route-deals .filter-panel:not(.collapsed) {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    align-self: stretch;
}

#route-deals .filter-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

#route-deals .main-panel {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#route-deals .deal-pipeline-header {
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--surface-elevated);
    box-shadow: 0 1px 0 var(--border-default);
}

#route-deals .dashboard-scroll {
    overflow: visible;
    min-height: unset;
}

.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

/* Timeline card */
.timeline-card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    box-shadow: var(--dash-shadow);
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
}

.timeline-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--dash-border);
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.timeline-toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.zoom-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.zoom-group-label {
    font-size: var(--font-size-sm);
    color: var(--dash-text-muted);
    font-weight: var(--font-weight-medium);
}

.zoom-segmented {
    display: flex;
    background: var(--surface-input);
    border-radius: var(--radius-md);
    padding: 2px;
}

.zoom-segmented .zoom-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 5px;
    background: transparent;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--dash-text-muted);
    cursor: pointer;
}

.zoom-segmented .zoom-btn.active {
    background: var(--dash-surface);
    color: var(--dash-primary);
    box-shadow: var(--shadow-xs);
}

.timeline-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.timeline-nav-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-sm);
    background: var(--dash-surface);
    cursor: pointer;
    font-size: var(--font-size-sm);
}

.timeline-range-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text);
    min-width: 140px;
    text-align: center;
}

/* Gantt timeline grid */
.gantt-scroll {
    overflow-x: auto;
    overflow-y: visible;
}

.gantt-grid {
    min-width: 100%;
}

.gantt-header {
    display: flex;
    width: 100%;
    border-bottom: 1px solid var(--dash-border);
    background: var(--surface-input);
    position: sticky;
    top: 0;
    z-index: 5;
}

.gantt-corner {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
    border-right: 1px solid var(--dash-border);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.gantt-time-axis {
    flex: 1;
    min-width: 0;
}

.gantt-grid {
    width: 100%;
}

.gantt-quarters {
    display: flex;
    width: 100%;
}

.gantt-quarter-col {
    flex: 1 1 0;
    min-width: 0;
    border-right: 1px solid var(--dash-border);
    text-align: center;
}

.gantt-quarter-label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    color: var(--dash-text);
    padding: 8px 4px 2px;
}

.gantt-quarter-total {
    font-size: 0.72rem;
    font-weight: var(--font-weight-bold);
    color: var(--dash-primary);
    padding: 0 4px 2px;
}

.gantt-quarter-col.is-highlighted {
    background: var(--brand-primary-subtle);
    box-shadow: inset 0 -3px 0 var(--dash-primary);
}

.gantt-quarter-sublabel {
    font-size: 0.65rem;
    color: var(--dash-text-muted);
    padding-bottom: 8px;
}

.gantt-body {
    position: relative;
    width: 100%;
}

.gantt-past-region {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.03);
    pointer-events: none;
    z-index: 1;
}

.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--status-danger);
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.35);
    z-index: 6;
    pointer-events: none;
}

.gantt-today-badge {
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--status-danger);
    color: var(--text-on-brand);
    font-size: 0.58rem;
    font-weight: var(--font-weight-bold);
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.06em;
}

.gantt-today-arrow {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--status-danger);
    font-size: 0.55rem;
    line-height: 1;
}

.gantt-row {
    display: flex;
    width: 100%;
    border-bottom: 1px solid var(--border-default);
    min-height: 48px;
    align-items: stretch;
}

.gantt-row-grouped .gantt-deal-cell {
    padding-left: 28px;
}

.gantt-group-row {
    background: var(--surface-input);
    min-height: 32px !important;
}

.gantt-group-cell {
    flex-direction: column;
    align-items: flex-start !important;
    justify-content: center;
    gap: 2px;
}

.gantt-group-label {
    font-size: 0.78rem;
    font-weight: var(--font-weight-bold);
    color: var(--dash-text);
}

.gantt-group-meta {
    font-size: 0.68rem;
    color: var(--dash-text-muted);
}

.gantt-group-track {
    height: 32px !important;
    flex: 1;
    min-width: 0;
    background: repeating-linear-gradient(90deg, var(--border-default) 0, var(--border-default) 1px, transparent 1px, transparent 25%);
}

.gantt-row:hover {
    background: var(--surface-hover);
}

.gantt-deal-cell {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: 8px var(--spacing-md);
    border-right: 1px solid var(--dash-border);
}

.deal-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    color: var(--text-on-brand);
    flex-shrink: 0;
}

.deal-avatar.c0 { background: #6366f1; }
.deal-avatar.c1 { background: #8b5cf6; }
.deal-avatar.c2 { background: #ec4899; }
.deal-avatar.c3 { background: #14b8a6; }

.gantt-deal-info {
    flex: 1;
    min-width: 0;
}

.gantt-deal-name {
    font-size: 0.8rem;
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.gantt-deal-stage-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.gantt-stage-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: var(--font-weight-semibold);
    background: #e0e7ff;
    color: #3730a3;
}

.gantt-stage-badge.stage-qualification { background: #fff3e0; color: #e65100; }
.gantt-stage-badge.stage-proposal { background: #e3f2fd; color: #1565c0; }
.gantt-stage-badge.stage-negotiation { background: #fce4ec; color: #c62828; }
.gantt-stage-badge.stage-closed { background: #e8f5e9; color: #2e7d32; }
.gantt-stage-badge.stage-closedLost { background: #f5f5f5; color: #616161; }

.gantt-probability {
    font-size: 0.62rem;
    font-weight: var(--font-weight-semibold);
    color: var(--dash-primary);
}

.gantt-deal-values {
    display: flex;
    gap: 8px;
    margin-top: 3px;
    font-size: 0.68rem;
}

.gantt-contract-val {
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text);
}

.gantt-forecast-val {
    color: var(--color-forecast);
    font-weight: var(--font-weight-semibold);
}

.gantt-deal-meta-row {
    display: flex;
    gap: 8px;
    margin-top: 2px;
    font-size: 0.62rem;
    color: var(--dash-text-muted);
}

.gantt-monthly-val {
    font-weight: var(--font-weight-medium);
}

.gantt-progress-pct {
    color: var(--dash-primary);
    font-weight: var(--font-weight-semibold);
}

.gantt-track {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 36px;
    align-self: center;
}

.gantt-track-grid {
    position: absolute;
    inset: 0;
    display: flex;
    pointer-events: none;
}

.gantt-grid-cell {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    border-right: 1px solid var(--border-default);
}

.gantt-deal-bar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--border-default);
    z-index: 2;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}

.gantt-deal-bar.mode-forecast {
    box-shadow: inset 0 0 0 2px var(--color-forecast);
}

.gantt-bar-past-shade {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.06);
    pointer-events: none;
    z-index: 3;
}

.gantt-bar-today-split {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: var(--status-danger);
    z-index: 5;
    pointer-events: none;
    box-shadow: 0 0 4px rgba(220, 38, 38, 0.5);
}

.gantt-bar-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.62rem;
    font-weight: var(--font-weight-bold);
    color: var(--text-on-brand);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    pointer-events: none;
    z-index: 4;
    white-space: nowrap;
}

.gantt-bar-label-contract { opacity: 0.95; }
.gantt-bar-label-monthly { opacity: 0.8; font-weight: var(--font-weight-medium); }

.gantt-bar-mini-progress {
    position: absolute;
    bottom: 1px;
    left: 4px;
    right: 4px;
    font-family: monospace;
    font-size: 0.45rem;
    letter-spacing: 0.5px;
    line-height: 1;
    z-index: 4;
    pointer-events: none;
    opacity: 0.7;
}

.gantt-bar-mini-progress .progress-filled { color: rgba(255,255,255,0.9); }
.gantt-bar-mini-progress .progress-empty { color: rgba(255,255,255,0.35); }

.gantt-segment {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 0;
    cursor: pointer;
    z-index: 2;
    transition: filter 0.12s ease;
}

.gantt-segment:first-child { border-radius: 6px 0 0 6px; }
.gantt-segment:last-child { border-radius: 0 6px 6px 0; }

.gantt-segment:hover {
    filter: brightness(1.12);
    z-index: 10;
}

.gantt-segment.planned { background: var(--color-planned); }
.gantt-segment.invoiced { background: var(--color-invoiced); }
.gantt-segment.paid { background: var(--color-paid); }
.gantt-segment.cancelled,
.gantt-segment.at-risk { background: var(--color-at-risk); }

.gantt-segment.is-past {
    opacity: 1;
}

.gantt-segment.is-future {
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 4px,
        rgba(255, 255, 255, 0.2) 4px,
        rgba(255, 255, 255, 0.2) 8px
    );
    opacity: 0.75;
}

.gantt-segment.is-future.planned { background-color: #60a5fa; }
.gantt-segment.is-future.invoiced { background-color: #fb923c; }
.gantt-segment.is-future.paid { background-color: #4ade80; }

.gantt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--dash-border);
    font-size: var(--font-size-xs);
    color: var(--dash-text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.legend-dot.planned { background: var(--color-planned); }
.legend-dot.forecast { background: var(--color-forecast); }
.legend-dot.invoiced { background: var(--color-invoiced); }
.legend-dot.paid { background: var(--color-paid); }
.legend-dot.at-risk { background: var(--color-at-risk); }
.legend-dot.future {
    background: repeating-linear-gradient(-45deg, var(--text-muted), var(--text-muted) 2px, var(--text-secondary) 2px, var(--text-secondary) 4px);
}

/* Revenue distribution chart */
.distribution-panel {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
}

.revenue-dist-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 160px;
    padding: 0 4px;
}

.revenue-dist-chart.chart-type-pie,
.revenue-dist-chart.chart-type-line {
    align-items: center;
    height: auto;
    min-height: 180px;
}

.chart-empty {
    width: 100%;
    text-align: center;
    color: var(--dash-text-muted);
    font-size: var(--font-size-sm);
    padding: var(--spacing-xl);
}

.dist-pie-wrap {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    width: 100%;
    padding: var(--spacing-sm) 0;
}

.dist-pie {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.dist-pie-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
    flex: 1;
    font-size: 0.68rem;
}

.dist-pie-legend li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dist-pie-legend strong {
    margin-left: auto;
    font-weight: var(--font-weight-semibold);
}

.dist-pie-swatch {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.dist-line-wrap {
    width: 100%;
    padding: var(--spacing-xs) 0;
}

.dist-line-svg {
    width: 100%;
    height: 140px;
    display: block;
}

.dist-line-planned {
    stroke: var(--color-planned, #6366f1);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.dist-line-actual {
    stroke: var(--color-paid, #22c55e);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
    stroke-dasharray: 4 3;
}

.dist-line-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 0.62rem;
    color: var(--dash-text-muted);
}

.dist-chart-type-hint {
    opacity: 0.85;
}

.dist-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    min-width: 0;
}

.dist-bar-stack {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
}

.dist-bar {
    width: 40%;
    border-radius: 3px 3px 0 0;
    min-height: 2px;
}

.dist-bar-planned { background: var(--color-planned); }
.dist-bar-actual { background: var(--color-paid); }

.dist-bar-label {
    font-size: 0.62rem;
    color: var(--dash-text-muted);
    margin-top: 4px;
    font-weight: var(--font-weight-medium);
}

.distribution-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
    font-size: 0.72rem;
    color: var(--dash-text-muted);
}

.dist-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dist-insight {
    font-size: 0.72rem;
    color: var(--dash-text-muted);
}

.dist-insight strong {
    color: var(--dash-text);
}

.summary-row-clickable {
    cursor: pointer;
    transition: background 0.12s ease;
}

.summary-row-clickable:hover {
    background: var(--surface-hover);
}

.summary-row-clickable.is-selected {
    background: var(--brand-primary-subtle);
}

.summary-row-clickable.is-selected td:first-child {
    font-weight: var(--font-weight-bold);
    color: var(--dash-primary);
}

/* Revenue Over Time chart */
.revenue-over-time-card {
    margin-bottom: var(--spacing-sm);
}

.revenue-over-time-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm);
    border-bottom: 1px solid var(--border-default);
    flex-wrap: wrap;
}

.revenue-over-time-header-left {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.revenue-over-time-title {
    margin: 0;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    color: var(--dash-text);
}

.revenue-over-time-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.rot-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: none;
    background: none;
    font-size: 0.72rem;
    color: var(--dash-text-muted);
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.rot-legend-item.is-off {
    opacity: 0.4;
}

.rot-legend-line {
    display: inline-block;
    width: 18px;
    height: 0;
    border-top: 2px solid var(--series-color, #64748b);
    border-top-style: solid;
    position: relative;
}

.rot-legend-item[data-series="planned"] .rot-legend-line {
    border-top-style: dashed;
}

.rot-legend-line::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--dash-surface);
    border: 2px solid var(--series-color, #64748b);
}

.revenue-over-time-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-shrink: 0;
}

.rot-select {
    padding: 6px 28px 6px 12px;
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-md);
    background: var(--dash-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2364748b' stroke-width='1.2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--dash-text);
    cursor: pointer;
    appearance: none;
}

.rot-cumulative-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.rot-cumulative-toggle .rot-toggle-label.kpi-has-tooltip {
    cursor: help;
    border-bottom: 1px dotted var(--text-muted);
}

.rot-cumulative-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.rot-toggle-track {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--text-muted);
    border-radius: 999px;
    transition: background 0.2s ease;
}

.rot-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--dash-surface);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
}

.rot-cumulative-toggle input:checked + .rot-toggle-track {
    background: var(--dash-primary);
}

.rot-cumulative-toggle input:checked + .rot-toggle-track .rot-toggle-thumb {
    transform: translateX(16px);
}

.rot-toggle-label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--dash-text-muted);
}

.revenue-over-time-chart-wrap {
    position: relative;
    padding: var(--spacing-sm) 80px var(--spacing-md) var(--spacing-md);
}

.revenue-over-time-chart {
    width: 100%;
    min-height: 280px;
}

.rot-end-labels {
    position: absolute;
    top: 0;
    right: 12px;
    bottom: 0;
    width: 68px;
    pointer-events: none;
}

.rot-end-pill {
    position: absolute;
    right: 0;
    transform: translateY(-50%);
    min-width: 64px;
    height: 22px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    border-radius: 11px;
    border: 1px solid var(--pill-color);
    background: var(--pill-bg);
    color: var(--pill-color);
    white-space: nowrap;
    box-sizing: border-box;
    font-family: inherit;
    letter-spacing: 0;
}

.rot-svg {
    width: 100%;
    height: auto;
    display: block;
}

.rot-grid-line {
    stroke: var(--border-default);
    stroke-width: 1;
    stroke-dasharray: 4 4;
}

.rot-axis-line {
    stroke: var(--border-default);
    stroke-width: 1;
}

.rot-axis-label {
    font-size: 11px;
    fill: var(--text-muted);
    font-family: inherit;
}

.rot-line {
    pointer-events: none;
}

.rot-dot {
    pointer-events: none;
}

.rot-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--dash-text-muted);
    font-size: var(--font-size-sm);
}

.revenue-over-time-tooltip {
    position: absolute;
    z-index: 20;
    min-width: 160px;
    padding: 10px 12px;
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    pointer-events: none;
    font-size: 0.72rem;
}

.rot-tip-title {
    font-weight: var(--font-weight-bold);
    color: var(--dash-text);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-default);
}

.rot-tip-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    color: var(--dash-text-muted);
}

.rot-tip-row strong {
    margin-left: auto;
    color: var(--dash-text);
    font-weight: var(--font-weight-semibold);
}

.rot-tip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Bottom panels */
.dashboard-bottom {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--spacing-sm);
}

.panel-card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    box-shadow: var(--dash-shadow);
    overflow: hidden;
}

.panel-card-header {
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--dash-border);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text);
}

.panel-card-header-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.panel-card-title {
    font-weight: var(--font-weight-semibold);
}

.chart-type-segmented {
    display: flex;
    background: var(--surface-input);
    border-radius: var(--radius-md);
    padding: 2px;
    gap: 2px;
}

.chart-type-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 5px;
    background: transparent;
    font-size: 0.68rem;
    font-weight: var(--font-weight-medium);
    color: var(--dash-text-muted);
    cursor: pointer;
}

.chart-type-btn.active {
    background: var(--dash-surface);
    color: var(--dash-primary);
    box-shadow: var(--shadow-xs);
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-xs);
}

.summary-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text-muted);
    border-bottom: 1px solid var(--dash-border);
    background: var(--surface-input);
}

.summary-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-default);
    color: var(--dash-text);
}

.summary-table tr.total-row {
    font-weight: var(--font-weight-bold);
    background: var(--surface-input);
}

.summary-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.achievement-bar-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.achievement-bar {
    flex: 1;
    height: 6px;
    background: var(--border-default);
    border-radius: 3px;
    overflow: hidden;
    min-width: 40px;
}

.achievement-bar-fill {
    height: 100%;
    background: var(--color-paid);
    border-radius: 3px;
}

/* Donut chart */
.donut-panel {
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.donut-chart-wrap {
    position: relative;
    width: 160px;
    height: 160px;
    margin: var(--spacing-md) 0;
}

.donut-chart {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.donut-center-value {
    font-size: 1.1rem;
    font-weight: var(--font-weight-bold);
    color: var(--dash-text);
}

.donut-center-label {
    font-size: 0.65rem;
    color: var(--dash-text-muted);
}

.donut-legend {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.donut-legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-xs);
}

.donut-legend-left {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--dash-text-muted);
}

.donut-legend-pct {
    font-weight: var(--font-weight-semibold);
    color: var(--dash-text);
}

.view-full-report {
    margin-top: var(--spacing-md);
    font-size: var(--font-size-xs);
    color: var(--dash-primary);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
}

.view-full-report:hover {
    text-decoration: underline;
}

/* Kanban / List in dashboard */
.kanban-card-mock,
.list-panel {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    padding: var(--spacing-xs) var(--spacing-sm);
    box-shadow: var(--dash-shadow);
}

.kanban-card-mock {
    padding: var(--spacing-sm);
}

.heatmap-grid-mock {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 4px;
    padding: var(--spacing-lg);
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--text-on-brand);
    font-weight: var(--font-weight-semibold);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .dashboard-bottom {
        grid-template-columns: 1fr;
    }
    
    .exec-kpi-strip {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

@media (max-width: 1024px) {
    .exec-summary-strip {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-charts-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-bottom-row {
        grid-template-columns: 1fr;
    }
    
    .exec-kpi-strip {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .filter-panel { display: none; }
    .deal-header-main {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    .deal-header-search {
        max-width: none;
    }
    .deal-header-meta {
        padding: 0.375rem 1rem 0.5rem;
    }
    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .page-toolbar-right {
        margin-left: 0;
        justify-content: flex-end;
    }
}

@media (max-width: 768px) {
    .exec-dashboard {
        padding: var(--space-3);
    }
    
    .crm-page-header h1 {
        font-size: 1.5rem;
    }
    
    .exec-summary-strip {
        grid-template-columns: 1fr;
    }
    
    .exec-kpi-strip {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .exec-summary-num {
        font-size: 1.5rem;
    }
    
    .exec-kpi-value {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .exec-kpi-strip {
        grid-template-columns: 1fr;
    }
}

/* Loading and Error States */
.dashboard-loading {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.dashboard-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: var(--space-2);
    border: 2px solid var(--border-default);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.dashboard-error {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    color: var(--text-danger, #dc2626);
    font-size: 1.1rem;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid var(--ceo-danger);
    border-left: 4px solid var(--ceo-danger);
    border-radius: var(--radius-lg);
    margin: var(--space-4);
}

.dashboard-error::before {
    content: '❌';
    display: block;
    font-size: 2rem;
    margin-bottom: var(--space-2);
}