:root {
    /* Accessibility Variables */
    --focus-ring: 3px solid #0078D4;
    --focus-ring-offset: 2px;

    /* KPI Colors - Phase 2 Enhanced */
    --kpi-green: #107C10;
    --kpi-green-bg: #DFF6DD;
    --kpi-green-gradient: linear-gradient(135deg, #2ECC71, #28B463);

    --kpi-yellow: #F7A200;
    --kpi-yellow-bg: #FFF4D8;
    --kpi-yellow-gradient: linear-gradient(135deg, #F39C12, #E67E22);

    --kpi-red: #D13438;
    --kpi-red-bg: #FDE7E9;
    --kpi-red-gradient: linear-gradient(135deg, #E74C3C, #C0392B);

    --kpi-blue: #0078D4;
    --kpi-blue-bg: #DFF6DD;
    --kpi-blue-gradient: linear-gradient(135deg, #3498DB, #2980B9);

    --kpi-purple: #5C2D91;
    --kpi-purple-gradient: linear-gradient(135deg, #9B59B6, #8E44AD);

    --kpi-teal: #008272;
    --kpi-teal-gradient: linear-gradient(135deg, #1ABC9C, #16A085);

    --color-profit: #107C10;
    --color-risk: #F7A200;
    --color-supply: #D13438;
    --color-cashflow: #0078D4;
    --color-danger: #D13438;
    --color-warning: #F7A200;
    --color-info: #0078D4;
    --color-success-bg: #DFF6DD;
    --color-danger-bg: #FDE7E9;
    --color-warning-bg: #FFF4D8;

    /* FluentUI Theme Variables */
    /* --neutral-layer-floating: #FFFFFF;
    --neutral-layer-2: #F7F7F7;
    --neutral-layer-3: #ECECEC;
    --neutral-stroke-divider-rest: #E1E1E1;
    --accent-fill-rest: #0078D4; */
    
    /* --neutral-card-background: var(--neutral-layer-floating); */
}

/* =========================================
   Executive Dashboard V1.1 Styles
   ========================================= */

:root {
    --primary: #0078d4;
    --bg-dark: #111111;
    --card-dark: #1b1b1b;
    --border-dark: #323130;
    --text-secondary: #a1a1a1;
    --text-primary: #f1f5f9;
}

.dashboard-container {
    font-family: 'Segoe UI', 'Inter', sans-serif;
    color: var(--text-primary);
    padding: 2rem;
    background-color: var(--bg-dark);
    min-height: 100%;
}


/* Grid System */
.d-grid { display: grid; gap: 1.5rem; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .grid-cols-4 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .grid-cols-2 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .dashboard-container { padding: 1rem; }
}

/* Typography & Utilities */
.text-2xl { font-size: 1.5rem; line-height: 2rem; margin-top: -18px;}
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-tight { letter-spacing: -0.025em; }

.text-slate-500 { color: #64748b; }
.text-slate-400 { color: #94a3b8; }
.text-slate-300 { color: #cbd5e1; }
.text-slate-200 { color: #e2e8f0; }
.text-slate-100 { color: #f1f5f9; }

.text-emerald-500 { color: #10b981; }
.bg-emerald-500 { background-color: #10b981; }
.bg-emerald-500-10 { background-color: rgba(16, 185, 129, 0.1); }
.bg-emerald-500-30 { background-color: rgba(16, 185, 129, 0.3); }

.text-amber-500 { color: #f59e0b; }
.bg-amber-500 { background-color: #f59e0b; }
.bg-amber-500-10 { background-color: rgba(245, 158, 11, 0.1); }
.bg-amber-500-30 { background-color: rgba(245, 158, 11, 0.3); }

.text-red-500 { color: #ef4444; }
.bg-red-500 { background-color: #ef4444; }
.bg-red-500-10 { background-color: rgba(239, 68, 68, 0.1); }

.text-primary { color: var(--primary); }
.bg-primary { background-color: var(--primary); }

.bg-white-5 { background-color: rgba(255, 255, 255, 0.05); }
.hover-bg-white-5:hover { background-color: rgba(255, 255, 255, 0.05); }

.rounded { border-radius: 0.25rem; }
.rounded-sm { border-radius: 0.125rem; }
.rounded-full { border-radius: 9999px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

.p-0-5 { padding: 0.125rem; }
.p-1 { padding: 0.25rem; }
.p-6 { padding: 1.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-0-5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.pb-3 { padding-bottom: 0.75rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.ml-0-5 { margin-left: 0.125rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.w-2-5 { width: 0.625rem; }
.h-2-5 { height: 0.625rem; }

.relative { position: relative; }
.absolute { position: absolute; }
.z-10 { z-index: 10; }
.overflow-hidden { overflow: hidden; }

/* Custom Scrollbar for internal overflow */
.overflow-x-auto { overflow-x: auto; }
.overflow-x-auto::-webkit-scrollbar { height: 6px; }
.overflow-x-auto::-webkit-scrollbar-thumb { background: #323130; border-radius: 3px; }

/* =========================================
   Milestone Timeline Styles
   ========================================= */

.milestone-timeline {
    position: relative;
}

/* Timeline vertical line */
.milestone-timeline::before {
    content: '';
    position: absolute;
    left: 32px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(
        to bottom,
        var(--timeline-line-start, rgba(255, 255, 255, 0.15)),
        var(--timeline-line-end, rgba(255, 255, 0.05))
    );
}

.milestone-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding-left: 1.5rem;
    padding-bottom: 1.5rem;
}

.milestone-item:last-child {
    padding-bottom: 0;
}

/* Timeline icon node */
.milestone-icon {
    position: relative;
    z-index: 1;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background-color: var(--milestone-icon-bg);
    color: var(--milestone-icon-color);
    box-shadow: 0 0 0 4px var(--milestone-icon-ring);
}

.milestone-item.milestone-completed .milestone-icon {
    --milestone-icon-bg: #10b981;
    --milestone-icon-color: #ffffff;
    --milestone-icon-ring: rgba(16, 185, 129, 0.2);
}

.milestone-item.milestone-overdue .milestone-icon {
    --milestone-icon-bg: #f59e0b;
    --milestone-icon-color: #ffffff;
    --milestone-icon-ring: rgba(245, 158, 11, 0.2);
}

/* Icon styling */
.milestone-icon ::deep svg {
    width: 10px;
    height: 10px;
    color: var(--milestone-icon-color);
}

.milestone-content {
    flex: 1;
    padding-top: 0.125rem;
}

.milestone-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--milestone-title-color);
    line-height: 1.25rem;
    margin: 0;
}

.milestone-subtitle {
    font-size: 0.75rem;
    color: var(--milestone-subtitle-color);
    margin-top: 0.25rem;
    line-height: 1rem;
}

.milestone-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 0.25rem;
    margin-top: 0.5rem;
    letter-spacing: 0.025em;
}

.milestone-badge-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.milestone-badge-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

/* Dark Mode (Default) */
:root {
    --timeline-line-start: rgba(255, 255, 255, 0.2);
    --timeline-line-end: rgba(255, 255, 255, 0.08);
    --milestone-title-color: #f1f5f9;
    --milestone-subtitle-color: #94a3b8;
}

/* Light Mode */
@media (prefers-color-scheme: light) {
    :root {
        --timeline-line-start: rgba(0, 0, 0, 0.15);
        --timeline-line-end: rgba(0, 0, 0, 0.05);
        --milestone-title-color: #1e293b;
        --milestone-subtitle-color: #64748b;
    }

    .milestone-item.milestone-completed .milestone-icon {
        --milestone-icon-ring: rgba(16, 185, 129, 0.15);
    }

    .milestone-item.milestone-overdue .milestone-icon {
        --milestone-icon-ring: rgba(245, 158, 11, 0.15);
    }
}

/* Theme-aware support for when ThemeService is active */
[data-theme="light"] {
    --timeline-line-start: rgba(0, 0, 0, 0.15);
    --timeline-line-end: rgba(0, 0, 0, 0.05);
    --milestone-title-color: #1e293b;
    --milestone-subtitle-color: #64748b;
}

[data-theme="light"] .milestone-item.milestone-completed .milestone-icon {
    --milestone-icon-ring: rgba(16, 185, 129, 0.15);
}

[data-theme="light"] .milestone-item.milestone-overdue .milestone-icon {
    --milestone-icon-ring: rgba(245, 158, 11, 0.15);
}

/* Animation for milestone items */
.milestone-item {
    animation: milestoneFadeIn 0.3s ease-out;
}

@keyframes milestoneFadeIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =========================================
   Project Timeline Widget Styles
   ========================================= */

.timeline-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    overflow: hidden;
    font-size: 0.75rem;
}

.timeline-project-list {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    background-color: rgba(0, 0, 0, 0.15);
}

.timeline-project-row {
    height: 48px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.timeline-project-name {
    font-weight: 500;
    color: var(--text-secondary, #a1a1a1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-visual-area {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 240px;
    background-color: transparent;
}

.timeline-header {
    display: flex;
    height: 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    background: var(--bg-dark, #111111);
    z-index: 10;
}

.timeline-month {
    min-width: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary, #a1a1a1);
    text-align: center;
    line-height: 1.1;
}

.timeline-grid {
    position: relative;
    min-height: 240px;
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 80px 100%;
}

.today-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    border-left: 2px dashed var(--kpi-green, #107C10);
    z-index: 20;
    pointer-events: none;
}

.today-badge {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--kpi-green, #107C10);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: 0.125rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.timeline-projects-container {
    display: flex;
    flex-direction: column;
    position: relative;
}

.timeline-project-bar-row {
    height: 48px;
    display: flex;
    align-items: center;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.timeline-project-bar {
    height: 32px;
    display: flex;
    position: absolute;
    border-radius: 0.25rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.timeline-project-bar:hover {
    transform: scaleY(1.1);
}

.timeline-progress-bar {
    background-color: var(--kpi-green, #107C10);
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
}

.timeline-remaining-bar {
    background-color: rgba(79, 107, 237, 0.7);
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.timeline-tooltip {
    position: absolute;
    top: -96px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(27, 27, 27, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.5rem;
    padding: 0.75rem;
    width: 192px;
    z-index: 30;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.timeline-project-bar:hover .timeline-tooltip {
    opacity: 1;
}

.timeline-tooltip-title {
    font-size: 0.625rem;
    color: var(--text-secondary, #a1a1a1);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.timeline-tooltip-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
}

.timeline-tooltip-label {
    color: var(--text-secondary, #a1a1a1);
}

.timeline-tooltip-value {
    color: var(--text-primary, #f1f5f9);
    font-weight: 500;
}

.timeline-tooltip-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.timeline-tooltip-progress-bar {
    height: 100%;
    background: var(--kpi-green, #107C10);
    border-radius: 9999px;
}

.timeline-tooltip-percent {
    text-align: right;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--kpi-green, #107C10);
}

.timeline-legend {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.timeline-legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.timeline-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 0.125rem;
}

.timeline-legend-text {
    font-size: 0.7rem;
    color: var(--text-secondary, #a1a1a1);
    font-weight: 500;
}

.timeline-status-icon {
    font-size: 1rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

@media (prefers-color-scheme: light) {
    .timeline-project-list {
        background-color: rgba(0, 0, 0, 0.03);
        border-right-color: rgba(0, 0, 0, 0.08);
    }

    .timeline-project-row {
        border-bottom-color: rgba(0, 0, 0, 0.05);
    }

    .timeline-header {
        background: white;
        border-bottom-color: rgba(0, 0, 0, 0.08);
    }

    .timeline-month {
        border-right-color: rgba(0, 0, 0, 0.05);
        color: #64748b;
    }

    .timeline-grid {
        background-image: linear-gradient(to right, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
    }

    .timeline-projects-container > div {
        border-bottom-color: rgba(0, 0, 0, 0.05);
    }

    .timeline-tooltip {
        background: white;
        border-color: rgba(0, 0, 0, 0.1);
    }

    .timeline-tooltip-progress {
        background: rgba(0, 0, 0, 0.1);
    }

    .timeline-legend {
        border-top-color: rgba(0, 0, 0, 0.08);
    }

    .timeline-legend-text {
        color: #64748b;
    }

    .timeline-project-name {
        color: #475569;
    }
}

.timeline-visual-area::-webkit-scrollbar {
    height: 6px;
}

.timeline-visual-area::-webkit-scrollbar-track {
    background: transparent;
}

.timeline-visual-area::-webkit-scrollbar-thumb {
    background: #323130;
    border-radius: 3px;
}

@media (prefers-color-scheme: light) {
    .timeline-visual-area::-webkit-scrollbar-thumb {
        background: #e2e8f0;
    }
}

/* =========================================
   Progress Bar Chart Styles
   ========================================= */

.progress-chart-section {
    padding: 16px 0;
}

.overall-progress-bar {
    height: 12px;
    background-color: var(--neutral-fill-secondary, #f3f3f3);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 16px;
    transition: width 0.5s ease-in-out;
    min-width: 4px;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

