/* ==========================================
   DASHBOARD MOCKUP DESIGN SYSTEM
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --dash-bg: #f4f6f9;
    --dash-surface: #ffffff;
    --dash-border: #e8ecf1;
    --dash-text: #1a2332;
    --dash-text-muted: #64748b;
    --dash-primary: #2563eb;
    --dash-primary-hover: #1d4ed8;
    --dash-rail-bg: #1e293b;
    --dash-rail-width: 56px;
    --dash-filter-width: 260px;
    --dash-radius: 10px;
    --dash-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --color-planned: #3b82f6;
    --color-forecast: #a855f7;
    --color-invoiced: #f97316;
    --color-paid: #22c55e;
    --color-at-risk: #ef4444;
    --color-future: #94a3b8;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--dash-bg);
    color: var(--dash-text);
    margin: 0;
}

.gantt-segment:hover {
    filter: brightness(1.08);
    z-index: 10;
}

/* 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: 500;
    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: #fff;
}

/* Timeline hover card */
.timeline-hover-card {
    position: fixed;
    z-index: 10000;
    width: min(380px, calc(100vw - 24px));
    max-width: 380px;
    background: #fff;
    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: 600;
    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: 600;
    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: 600;
    color: var(--dash-primary);
}

.hover-section {
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
}

.hover-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.hover-section-title {
    font-size: 0.68rem;
    font-weight: 600;
    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: 600;
    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;
    min-height: 100vh;
}

/* App body */
.app-body {
    flex: 1;
    display: flex;
    min-width: 0;
    min-height: 100vh;
}

/* 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;
}

.filter-panel.collapsed {
    width: 0;
    border: none;
}

.filter-panel-body {
    flex: 1;
    overflow-y: auto;
    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: #fafbfc;
}

.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: #fff;
    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;
    background: #f1f5f9;
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
}

.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: white;
    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: white;
    margin-bottom: var(--spacing-sm);
}

.status-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.status-checkboxes .checkbox {
    font-size: var(--font-size-sm);
    color: var(--dash-text);
}

.filter-btn {
    padding: 6px 10px;
    border: 1px solid var(--dash-border);
    border-radius: 6px;
    background: white;
    font-size: var(--font-size-xs);
    cursor: pointer;
    margin-right: 4px;
    margin-bottom: 4px;
}

.filter-btn.active {
    background: var(--dash-primary);
    color: white;
    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: white;
    border: 1px solid var(--dash-border);
}
    padding: var(--spacing-md);
    border-top: 1px solid var(--dash-border);
}

.btn-apply-filters {
    width: 100%;
    padding: 10px;
    background: var(--dash-primary);
    color: white;
    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;
    overflow: hidden;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-sm);
    background: var(--dash-surface);
    border-bottom: 1px solid var(--dash-border);
    flex-shrink: 0;
}

.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;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-md);
    background: white;
    cursor: pointer;
    font-size: var(--font-size-base);
    color: var(--dash-text-muted);
}

.btn-icon:hover {
    background: #f8fafc;
}

/* KPI row */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--dash-bg);
}

.kpi-card-mock {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--dash-shadow);
    cursor: help;
}

.kpi-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.kpi-card-name {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--dash-text-muted);
}

.kpi-card-period {
    font-size: 0.65rem;
    color: var(--dash-text-muted);
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
}

.kpi-card-value {
    font-size: 1.35rem;
    font-weight: var(--font-weight-bold);
    color: var(--dash-text);
    line-height: 1.2;
}

.kpi-card-trend {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    margin-top: 6px;
}

.kpi-card-trend.positive { color: #16a34a; }
.kpi-card-trend.negative { color: #dc2626; }
.kpi-card-trend.neutral { color: var(--dash-text-muted); }

/* Filter chips */
.filter-chips-section {
    background: #e8f2ff;
    border-bottom: 1px solid #bfdbfe;
    padding: 4px var(--spacing-md);
}

.filter-chips-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    flex-wrap: nowrap;
    min-height: 0;
}

.filter-chips-main {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.filter-chips-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    flex-shrink: 0;
    margin-left: auto;
}

.filter-chips-controls .view-segmented {
    flex-direction: row;
    padding: 2px;
}

.filter-chips-controls .view-segmented .view-btn {
    padding: 4px 12px;
    font-size: var(--font-size-xs);
    white-space: nowrap;
}

.filter-chips-controls[hidden] {
    display: none !important;
}

.filter-chips-controls-label {
    font-size: var(--font-size-xs);
    color: var(--dash-text-muted);
    font-weight: var(--font-weight-medium);
    flex-shrink: 0;
}

/* Dashboard content */
.dashboard-scroll {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-xs) var(--spacing-sm) var(--spacing-sm);
}

.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;
}

.density-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.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: #f1f5f9;
    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: white;
    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: white;
    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: #fafbfc;
    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: #eff6ff;
    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: #dc2626;
    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: #dc2626;
    color: white;
    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: #dc2626;
    font-size: 0.55rem;
    line-height: 1;
}

/* Row density */
.gantt-grid.density-comfortable .gantt-row { min-height: 48px; }
.gantt-grid.density-comfortable .gantt-track { height: 36px; }
.gantt-grid.density-comfortable .gantt-deal-bar { height: 28px; }

.gantt-grid.density-compact .gantt-row { min-height: 28px; }
.gantt-grid.density-compact .gantt-track { height: 22px; }
.gantt-grid.density-compact .gantt-deal-bar { height: 16px; }
.gantt-grid.density-compact .gantt-deal-info { display: none; }
.gantt-grid.density-compact .gantt-deal-cell { padding: 4px 8px; }
.gantt-grid.density-compact .deal-avatar { width: 22px; height: 22px; font-size: 0.6rem; }
.gantt-grid.density-compact .gantt-deal-name { font-size: 0.72rem; }

.gantt-row {
    display: flex;
    width: 100%;
    border-bottom: 1px solid #f1f5f9;
    min-height: 48px;
    align-items: stretch;
}

.gantt-row-grouped .gantt-deal-cell {
    padding-left: 28px;
}

.gantt-group-row {
    background: #f8fafc;
    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, #f1f5f9 0, #f1f5f9 1px, transparent 1px, transparent 25%);
}

.gantt-row:hover {
    background: #fafbfc;
}

.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: white;
    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: 600;
    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: 600;
    color: var(--dash-primary);
}

.gantt-deal-values {
    display: flex;
    gap: 8px;
    margin-top: 3px;
    font-size: 0.68rem;
}

.gantt-contract-val {
    font-weight: 600;
    color: var(--dash-text);
}

.gantt-forecast-val {
    color: var(--color-forecast);
    font-weight: 600;
}

.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: 500;
}

.gantt-progress-pct {
    color: var(--dash-primary);
    font-weight: 600;
}

.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 #f1f5f9;
}

.gantt-deal-bar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    background: #e2e8f0;
    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: #dc2626;
    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: 700;
    color: white;
    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: 500; }

.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, #94a3b8, #94a3b8 2px, #cbd5e1 2px, #cbd5e1 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: 500;
}

.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: #f8fafc;
}

.summary-row-clickable.is-selected {
    background: #eff6ff;
}

.summary-row-clickable.is-selected td:first-child {
    font-weight: var(--font-weight-bold);
    color: var(--dash-primary);
}

/* 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: #f1f5f9;
    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: white;
    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: #fafbfc;
}

.summary-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--dash-text);
}

.summary-table tr.total-row {
    font-weight: var(--font-weight-bold);
    background: #f8fafc;
}

.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: #e2e8f0;
    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: white;
    font-weight: var(--font-weight-semibold);
}

@media (max-width: 1400px) {
    .kpi-row {
        grid-template-columns: repeat(3, 1fr);
    }
    .dashboard-bottom {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .filter-panel { display: none; }
    .kpi-row { grid-template-columns: repeat(2, 1fr); }
}
