/**
 * Dashboard Styles
 * Dashboard Implementation Plan - Phase 0+
 *
 * Reference: docs/DASHBOARD_IMPLEMENTATION_PLAN.md
 */

/* ========================================
   Dashboard Container Wrapper
   (Positioned same as gantt-container - uses flex layout)
   CRITICAL: This is a sibling to gantt-container in the body
======================================== */

.dashboard-container-wrapper {
    display: none; /* Hidden by default, shown by DashboardManager.show() */
    flex-direction: column;
    flex: 1; /* Take remaining vertical space with proper flex */
    border: 1px solid #ccc;
    overflow: visible; /* Let page scroll naturally - no internal scrollbar */
    min-height: 0; /* Allow flex children to shrink properly */
    margin-left: 0; /* Default: no sidebar */
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f5f5f5;
}

/* Push content right when sidebar is pinned open */
.dashboard-container-wrapper.sidebar-open {
    margin-left: 250px;
}

/* ========================================
   Dashboard Container (inner)
======================================== */

.dashboard-container {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 8px;
    background: #f5f5f5;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dashboard-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.dashboard-refresh-btn {
    padding: 8px 16px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.dashboard-refresh-btn:hover {
    background: #1976D2;
}

/* ========================================
   Dashboard Tabs (Option 2: Underline Style)
======================================== */

.dashboard-tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    background: white;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 16px;
    border-radius: 0;
    margin-top: 0;
}

.dashboard-tab {
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: transparent;
    color: #666;
    position: relative;
    white-space: nowrap;
}

.dashboard-tab:hover {
    color: #333;
    background: #f5f5f5;
}

.dashboard-tab.active {
    color: #1976d2;
}

.dashboard-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: #1976d2;
    border-radius: 3px 3px 0 0;
}

/* Tab Content Container */
.dashboard-tab-content {
    flex: 1;
    min-height: 0;
}

/* Tab Panes - Only show active */
.dashboard-tab-pane {
    display: none;
}

.dashboard-tab-pane.active {
    display: block;
}

/* ========================================
   Settings Panel
======================================== */

.dashboard-settings-panel {
    background: white;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 0;
    border: 2px solid #1976d2;
    border-bottom: none;
}

.settings-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid transparent;
    transition: background 0.2s;
    background: #e3f2fd;
}

.settings-toggle:hover {
    background: #bbdefb;
}

.settings-toggle:not(.collapsed) {
    border-bottom-color: #1976d2;
}

.settings-toggle-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-toggle-icon {
    font-size: 12px;
    color: #666;
    width: 16px;
}

.settings-toggle-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.settings-toggle-summary {
    color: #666;
    font-size: 13px;
}

.settings-toggle-hint {
    color: #999;
    font-size: 12px;
}

.settings-content {
    padding: 16px;
}

.settings-content.hidden {
    display: none;
}

.settings-section {
    margin-bottom: 16px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.settings-section-title {
    font-weight: 500;
    color: #333;
    font-size: 13px;
}

.settings-section-help {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.settings-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 16px 0;
}

/* WBS Chips */
.wbs-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.wbs-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.wbs-chip input {
    display: none;
}

.wbs-chip.included {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.wbs-chip.excluded {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.wbs-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wbs-chip-label {
    font-weight: 500;
}

.wbs-chip-status {
    font-size: 10px;
    text-transform: uppercase;
    opacity: 0.8;
}

.wbs-chips-actions {
    display: flex;
    gap: 8px;
}

/* TCO Picker */
.tco-picker {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.tco-selection {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tco-label {
    font-weight: 500;
    color: #666;
    font-size: 13px;
}

.tco-value {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.tco-value.not-selected {
    color: #999;
    font-style: italic;
}

.tco-actions {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn-small {
    padding: 4px 12px;
    font-size: 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.btn-primary {
    padding: 8px 16px;
    font-size: 13px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #1976D2;
}

.btn-secondary {
    padding: 8px 16px;
    font-size: 13px;
    background: white;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

/* ========================================
   Summary Cards
======================================== */

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.dashboard-card-title {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dashboard-card-value {
    font-size: 32px;
    font-weight: 600;
    color: #333;
}

.dashboard-card-value.percentage::after {
    content: '%';
    font-size: 20px;
    color: #666;
    margin-left: 2px;
}

.dashboard-card-subtitle {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* ========================================
   Dashboard Grid Layout (Now used within tabs)
======================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-main-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Tab pane section spacing */
.dashboard-tab-pane .dashboard-section {
    margin-bottom: 20px;
}

.dashboard-tab-pane .dashboard-section:last-child {
    margin-bottom: 0;
}

.dashboard-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Full-width sections (legacy - kept for compatibility) */
.dashboard-full-width {
    width: 100%;
    margin-bottom: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.dashboard-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

/* Collapsible section header styling */
.dashboard-section-header.collapsible {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.dashboard-section-header.collapsible:hover {
    background: #f0f0f0;
}

.dashboard-section-title {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

/* Accordion toggle icon */
.section-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    font-size: 10px;
    color: #666;
    transition: transform 0.2s ease;
}

.dashboard-section.collapsed .section-toggle-icon {
    transform: rotate(-90deg);
}

/* Section title wrapper for icon + text */
.section-title-wrapper {
    display: flex;
    align-items: center;
}

/* Section header actions (buttons on right side) */
.section-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========================================
   Elevation View Toggle (Phase 5 - Compact Matrix)
   Building vs Matrix view switcher
======================================== */
.elevation-view-toggle {
    display: flex;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.elevation-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.elevation-view-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.elevation-view-btn:hover {
    color: #334155;
    background: rgba(255, 255, 255, 0.5);
}

.elevation-view-btn.active {
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.dashboard-section-content {
    padding: 20px;
}

/* Collapsible section content (only for sections with collapsible headers) */
.dashboard-section:has(.collapsible) .dashboard-section-content {
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
    overflow: hidden;
    max-height: 2000px; /* Large enough for expanded content */
}

/* Collapsed section content */
.dashboard-section.collapsed .dashboard-section-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    border-bottom: none;
    overflow: hidden;
}

/* Remove bottom border when collapsed */
.dashboard-section.collapsed .dashboard-section-header {
    border-bottom: none;
}

/* ========================================
   Milestones Section
======================================== */

.milestones-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.milestone-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #2196F3;
}

.milestone-icon {
    font-size: 16px;
}

.milestone-info {
    flex: 1;
}

.milestone-name {
    font-weight: 500;
    color: #333;
    font-size: 13px;
    margin-bottom: 4px;
}

.milestone-date {
    font-size: 12px;
    color: #666;
}

.milestone-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.milestone-status.on-track {
    background: #e8f5e9;
    color: #2e7d32;
}

.milestone-status.at-risk {
    background: #fff3e0;
    color: #ef6c00;
}

.milestone-status.delayed {
    background: #ffebee;
    color: #c62828;
}

.milestone-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border: 2px dashed #ddd;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: #666;
    font-size: 13px;
    transition: all 0.2s;
}

.milestone-add-btn:hover {
    border-color: #2196F3;
    color: #2196F3;
    background: #f8f9fa;
}

/* Milestone remove button */
.milestone-remove-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
    line-height: 1;
}

.milestone-remove-btn:hover {
    color: #d32f2f;
    background: #ffebee;
}

/* Milestone drag handle */
.milestone-drag-handle {
    cursor: grab;
    color: #bbb;
    font-size: 14px;
    padding: 4px;
    user-select: none;
}

.milestone-drag-handle:hover {
    color: #666;
}

.milestone-item.dragging {
    opacity: 0.5;
    border: 2px dashed #2196F3;
    background: #e3f2fd;
}

.milestone-item.drag-over {
    border-top: 3px solid #2196F3;
}

/* Milestone edit label button */
.milestone-edit-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.15s;
    opacity: 0;
}

.milestone-item:hover .milestone-edit-btn {
    opacity: 1;
}

.milestone-edit-btn:hover {
    color: #2196F3;
    background: #e3f2fd;
}

/* Milestone custom label indicator */
.milestone-original-name {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
    font-style: italic;
}

/* Milestone days remaining */
.milestone-days-remaining {
    font-size: 11px;
    font-weight: 500;
    margin-left: 8px;
}

.milestone-days-remaining.positive {
    color: #2e7d32;
}

.milestone-days-remaining.warning {
    color: #ef6c00;
}

.milestone-days-remaining.negative {
    color: #c62828;
}

/* Milestone actions container */
.milestone-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Empty milestones state */
.milestones-empty {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.milestones-empty-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Ensure milestones section content has appropriate height */
#dashboard-milestones {
    min-height: 60px;
    padding: 16px 20px;
}

/* Minimal milestone list - fits all items */
.milestones-list-minimal {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: fit-content;
}

/* Minimal milestone item - compact single row */
.milestone-item-minimal {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.milestone-item-minimal:last-child {
    border-bottom: none;
}

.milestone-icon-minimal {
    color: #2196F3;
    font-size: 12px;
    flex-shrink: 0;
}

.milestone-name-minimal {
    width: 400px;
    flex-shrink: 0;
    font-size: 13px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.milestone-date-minimal {
    font-size: 12px;
    color: #666;
    flex-shrink: 0;
}

/* Milestone Settings Items - Compact single row (in Dashboard Settings panel) */
.milestone-settings-item-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    margin-bottom: 4px;
}

.milestone-settings-item-compact:last-child {
    margin-bottom: 0;
}

.milestone-icon-compact {
    color: #2196F3;
    font-size: 10px;
    flex-shrink: 0;
}

.milestone-name-compact {
    flex: 1;
    font-size: 12px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.milestone-date-compact {
    font-size: 11px;
    color: #888;
    flex-shrink: 0;
}

.milestone-remove-compact {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 3px;
    flex-shrink: 0;
}

.milestone-remove-compact:hover {
    color: #d32f2f;
    background: #ffebee;
}

/* Legacy milestone settings (kept for compatibility) */
.milestone-settings-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.milestone-settings-icon {
    color: #2196F3;
    font-size: 14px;
}

.milestone-settings-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.milestone-settings-name {
    font-weight: 500;
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.milestone-settings-date {
    font-size: 11px;
    color: #888;
}

.milestone-settings-actions {
    display: flex;
    gap: 4px;
}

.btn-icon {
    background: none;
    border: none;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.15s;
}

.btn-icon:hover {
    background: #e0e0e0;
}

.milestone-edit-label-btn:hover {
    background: #e3f2fd;
}

.milestone-remove-settings-btn {
    color: #999;
    font-size: 16px;
}

.milestone-remove-settings-btn:hover {
    color: #d32f2f;
    background: #ffebee;
}

/* ========================================
   Critical Path Alerts
======================================== */

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
}

.alert-item.critical {
    background: #ffebee;
    border-left: 3px solid #f44336;
}

.alert-item.warning {
    background: #fff3e0;
    border-left: 3px solid #ff9800;
}

.alert-item.material {
    background: #e3f2fd;
    border-left: 3px solid #2196F3;
}

.alert-icon {
    font-size: 16px;
}

.alert-info {
    flex: 1;
}

.alert-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.alert-detail {
    font-size: 12px;
    color: #666;
}

.alert-float {
    font-size: 12px;
    font-weight: 500;
    color: #f44336;
}

/* ========================================
   Upcoming Work Section
======================================== */

.upcoming-work-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trade-group {
    background: #f8f9fa;
    border-radius: 6px;
    overflow: hidden;
}

.trade-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
}

.trade-group-name {
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.trade-group-count {
    font-size: 12px;
    color: #666;
}

.trade-activities {
    padding: 8px 16px;
}

.trade-activity {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.trade-activity:last-child {
    border-bottom: none;
}

.activity-name {
    color: #333;
}

.activity-start {
    color: #666;
    font-size: 12px;
}

/* ========================================
   Elevation Progress Container (Phase 3)
======================================== */

.dashboard-elevation-container {
    min-height: 300px;
}

/* Phase 3: View Mode Toggle for Elevation Progress */
.elevation-progress-view-mode {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.view-mode-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}

.view-mode-option input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.view-mode-option span {
    user-select: none;
}

.view-mode-option:hover {
    color: #1976D2;
}

.view-mode-option input[type="radio"]:checked + span {
    color: #1976D2;
    font-weight: 500;
}

/* Selected task name display */
.selected-task-name {
    font-size: 12px;
    color: #666;
    font-style: italic;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-task-name:not(:empty)::before {
    content: '→ ';
    color: #999;
}

/* Select task button disabled state */
#select-task-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Elevation Progress embedded in Dashboard - Override some base styles */
#dashboard-elevation-container {
    padding: 1px;
}

#dashboard-elevation-container .progress-matrix-header {
    /* Hide the standalone header in dashboard context */
    display: none !important;
}

#dashboard-elevation-container .progress-matrix-filter {
    /* Hide the filter panel in dashboard - controlled by Dashboard Settings instead */
    display: none !important;
}

#dashboard-elevation-container .progress-matrix-table-container {
    /* Limit height in dashboard context */
    max-height: 400px;
    overflow: auto;
}

/* Phase 4 Visual Redesign: Visual container in dashboard */
/* CHANGED: Auto-height to fit all content without scrolling (2026-01-06) */
#dashboard-elevation-container .progress-matrix-visual-container {
    /* Let container grow to fit all floors */
    height: auto;
    min-height: auto;
    max-height: none;
}

#dashboard-elevation-container .elevation-matrix {
    height: auto;
    background: transparent; /* Remove sky gradient in dashboard context */
}

/* Phase 5 (Compact Matrix): Matrix container in dashboard - use full height */
#dashboard-elevation-container .progress-matrix-matrix-container {
    height: calc(100vh - 280px); /* Full viewport minus header/tabs/section-header */
    min-height: 400px;
    max-height: none;
}

#dashboard-elevation-container .matrix-view {
    height: 100%;
}

#dashboard-elevation-container .matrix-body {
    flex: 1;
    overflow: auto;
}

#dashboard-matrix-container .elevation-matrix-scroll {
    /* No scrolling - show all floors */
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 10px 0;
}

/* ========================================
   Trade Filter Section in Dashboard Settings
======================================== */

.trade-filter-section {
    margin-top: 0;
}

.trade-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #e0e0e0;
    color: #666;
    border: 1px solid transparent;
}

.trade-chip:hover {
    background: #d0d0d0;
}

.trade-chip.active {
    background: #1976D2;
    color: white;
}

.trade-chip.active:hover {
    background: #1565C0;
}

.trade-chip input[type="checkbox"] {
    display: none;
}

/* View mode in trade filter */
.trade-view-mode .view-mode-option:hover {
    color: #1976D2;
}

.trade-view-mode input[type="radio"]:checked + span {
    color: #1976D2;
    font-weight: 500;
}

.selected-task-display:not(:empty) {
    margin-left: 8px;
    padding: 4px 8px;
    background: #e3f2fd;
    border-radius: 4px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   Upcoming Work Section (Phase 4)
======================================== */

.upcoming-work-container {
    padding: 0;
}

.upcoming-work-summary {
    display: flex;
    gap: 24px;
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.upcoming-summary-stat {
    font-size: 13px;
    color: #666;
}

.upcoming-summary-stat strong {
    color: #333;
}

.upcoming-trade-groups {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.upcoming-trade-group {
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.upcoming-trade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.upcoming-trade-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.upcoming-trade-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.upcoming-trade-count {
    font-size: 12px;
    color: #888;
}

.upcoming-trade-timing {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.upcoming-days {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.upcoming-date {
    font-size: 11px;
    color: #888;
}

/* Urgency levels */
.upcoming-trade-timing.urgent .upcoming-days {
    color: #d32f2f;
}

.upcoming-trade-timing.soon .upcoming-days {
    color: #f57c00;
}

.upcoming-trade-timing.normal .upcoming-days {
    color: #388e3c;
}

.upcoming-task-list {
    padding: 8px 16px 12px;
}

.upcoming-task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 4px;
    background: #fff;
    border-radius: 4px;
    border-left: 3px solid #ddd;
}

.upcoming-task-item.urgent {
    border-left-color: #d32f2f;
}

.upcoming-task-item.soon {
    border-left-color: #f57c00;
}

.upcoming-task-item.normal {
    border-left-color: #388e3c;
}

.upcoming-task-name {
    font-size: 13px;
    color: #333;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 12px;
}

.upcoming-task-date {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.upcoming-task-more {
    font-size: 12px;
    color: #888;
    font-style: italic;
    padding: 4px 12px;
}

/* Empty state for Upcoming Work */
.upcoming-work-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #666;
    text-align: center;
    min-height: 120px;
    background: #f8f9fa;
    border-radius: 8px;
}

.upcoming-empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.upcoming-empty-text {
    font-size: 14px;
    line-height: 1.5;
}

.upcoming-empty-text small {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #999;
}

/* ========================================
   Upcoming Work - Compact Collapsible Design
======================================== */

.upcoming-trade-group-compact {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #fff;
    overflow: hidden;
}

.upcoming-trade-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    background: #f8f9fa;
    transition: background-color 0.15s ease;
}

.upcoming-trade-row:hover {
    background: #f0f0f0;
}

.toggle-icon {
    font-size: 10px;
    color: #666;
    transition: transform 0.2s ease;
    width: 12px;
}

.toggle-icon.expanded {
    transform: rotate(90deg);
}

.upcoming-trade-name-compact {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    min-width: 120px;
}

.upcoming-trade-count-compact {
    font-size: 12px;
    color: #888;
    background: #e8e8e8;
    padding: 2px 8px;
    border-radius: 10px;
}

.upcoming-trade-timing-compact {
    font-weight: 500;
    font-size: 12px;
    color: #555;
    margin-left: auto;
}

.upcoming-trade-date-compact {
    font-size: 11px;
    color: #888;
    min-width: 80px;
    text-align: right;
}

/* Task list container (vertical layout) */
.upcoming-task-list-collapsible {
    display: flex;
    flex-direction: column;
    padding: 8px 14px 12px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    max-height: 500px;
    overflow-y: auto;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
}

.upcoming-task-list-collapsible.collapsed {
    max-height: 0;
    padding: 0 14px;
    overflow: hidden;
    opacity: 0;
    border-top: none;
}

/* Individual task row item */
.upcoming-task-row-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-left: 3px solid #ccc;
    background: #fafafa;
    margin-bottom: 4px;
    border-radius: 2px;
}

.upcoming-task-row-item:last-child {
    margin-bottom: 0;
}

.upcoming-task-row-item:hover {
    background: #f0f0f0;
}

/* Task info container (name + trade path) */
.upcoming-task-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    margin-right: 12px;
}

.upcoming-task-name-item {
    font-size: 13px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upcoming-task-trade-path {
    font-size: 11px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

.upcoming-task-date-item {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    align-self: flex-start;
}

/* Filtered indicator */
.upcoming-filtered {
    color: #888;
    font-style: italic;
}

/* ========================================
   Upcoming Work - WBS Groups (Minimal Headers)
======================================== */

/* Container for all WBS groups */
.upcoming-wbs-groups {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Individual WBS group container */
.upcoming-wbs-group {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

/* Compact WBS group header - clickable for expand/collapse */
.upcoming-wbs-header {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background: #f8f9fa;
    cursor: pointer;
    user-select: none;
    gap: 8px;
}

.upcoming-wbs-header:hover {
    background: #f0f0f0;
}

/* Toggle icon */
.upcoming-wbs-toggle {
    font-size: 10px;
    color: #666;
    transition: transform 0.2s ease;
    width: 12px;
}

.upcoming-wbs-group:not(.expanded) .upcoming-wbs-toggle {
    transform: rotate(-90deg);
}

.upcoming-wbs-name {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    flex: 1;
}

.upcoming-wbs-count {
    font-size: 11px;
    color: #666;
    background: #e0e0e0;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* Task list within WBS group - expandable */
.upcoming-wbs-tasks {
    padding: 6px 12px 8px;
    border-top: 1px solid #e8e8e8;
    width: fit-content;
}

/* Collapsed state - hide tasks */
.upcoming-wbs-group:not(.expanded) .upcoming-wbs-tasks {
    display: none;
}

/* Summary in header - right aligned next to Export button */
.upcoming-header-summary {
    font-size: 12px;
    color: #666;
    margin-right: 12px;
}

/* Compact section header for Upcoming Work */
.upcoming-work-header {
    padding: 10px 16px;
}

.upcoming-work-header .dashboard-section-title {
    font-size: 14px;
}

/* ========================================
   Upcoming Work - 5-Column Task Row Layout
   Columns: [Trade Level 1] [Trade Level 2] [Trade Level 3] [Task Name] [Date]
   Trade column widths calculated dynamically based on longest content
======================================== */

/* Task row with 5 columns */
.upcoming-task-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
    gap: 12px;
}

.upcoming-task-row:last-child {
    border-bottom: none;
}

.upcoming-task-row:hover {
    background: #f8f9fa;
}

/* Trade columns - width set via inline style based on longest content */
/* Same font type, size and color as task name column */
.upcoming-col-trade1,
.upcoming-col-trade2,
.upcoming-col-trade3 {
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Column 4: Task Name (fixed width column for table alignment) */
.upcoming-col-taskname {
    width: 350px;
    flex-shrink: 0;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Column 5: Date (fixed width) */
.upcoming-col-date {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
    text-align: right;
    color: #666;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Urgency colors for date column */
.upcoming-col-date.urgent {
    color: #d32f2f;
    font-weight: 500;
}

.upcoming-col-date.soon {
    color: #f57c00;
    font-weight: 500;
}

.upcoming-col-date.normal {
    color: #388e3c;
}

/* Legacy urgency colors (for backwards compatibility) */
.upcoming-task-date.urgent {
    color: #d32f2f;
    font-weight: 500;
}

.upcoming-task-date.soon {
    color: #f57c00;
    font-weight: 500;
}

.upcoming-task-date.normal {
    color: #388e3c;
}

/* ========================================
   Loading & Empty States
======================================== */

.dashboard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

.dashboard-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.dashboard-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
    text-align: center;
}

.dashboard-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.dashboard-empty-text {
    font-size: 14px;
}

/* ========================================
   Responsive Design
======================================== */

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-full-width {
        margin-bottom: 16px;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        padding: 8px;
    }

    .dashboard-cards {
        grid-template-columns: 1fr 1fr;
    }

    .wbs-chips-container {
        max-height: 150px;
        overflow-y: auto;
    }

    .tco-picker {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

/* ========================================
   Elevation Progress Filter (Standalone Component)
   Created: 2026-01-06
   Completely separate from Progress Matrix filter
======================================== */

.elevation-filter-panel {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 16px;
}

.elevation-filter-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
}

.elevation-filter-toggle:hover {
    background: #f0f0f0;
}

.elevation-filter-toggle-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.elevation-filter-toggle-icon {
    font-size: 10px;
    color: #666;
    transition: transform 0.2s ease;
}

.elevation-filter-toggle.collapsed .elevation-filter-toggle-icon {
    transform: rotate(0deg);
}

.elevation-filter-toggle:not(.collapsed) .elevation-filter-toggle-icon {
    transform: rotate(90deg);
}

.elevation-filter-toggle-label {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.elevation-filter-toggle-summary {
    font-size: 12px;
    color: #888;
    margin-left: 8px;
}

.elevation-filter-toggle-hint {
    font-size: 11px;
    color: #999;
}

.elevation-filter-content {
    padding: 16px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

.elevation-filter-content.hidden {
    display: none;
}

.elevation-filter-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

/* ============================================
   Saved Filters Section (right-aligned)
   ============================================ */
.elevation-saved-filters-section {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;  /* Push to right side */
}

.elevation-saved-label {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

#elevation-saved-filters-select {
    min-width: 120px;
    max-width: 180px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

#elevation-saved-filters-select:hover {
    border-color: #1890ff;
}

#elevation-saved-filters-select:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.elevation-save-btn {
    padding: 4px 10px !important;
    font-size: 11px !important;
    background: #1890ff !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
}

.elevation-save-btn:hover {
    background: #40a9ff !important;
}

.elevation-delete-btn {
    padding: 4px 8px !important;
    font-size: 11px !important;
    background: #f5f5f5 !important;
    color: #999 !important;
    border: 1px solid #d9d9d9 !important;
    border-radius: 4px !important;
    cursor: pointer !important;
}

.elevation-delete-btn:hover:not(:disabled) {
    background: #fff1f0 !important;
    color: #ff4d4f !important;
    border-color: #ff4d4f !important;
}

.elevation-delete-btn:disabled {
    cursor: not-allowed !important;
    opacity: 0.5 !important;
}

.elevation-filter-label {
    font-weight: 600;
    color: #333;
    font-size: 13px;
    white-space: nowrap;
}

.elevation-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Root-level filter chips (like Progress Matrix) */
.elevation-filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #d9d9d9;
    background: white;
    user-select: none;
}

.elevation-filter-chip:hover {
    border-color: #1890ff;
}

.elevation-filter-chip.active {
    background: #1890ff;
    color: white;
    border-color: #1890ff;
}

.elevation-filter-chip input[type="checkbox"] {
    display: none;
}

.elevation-toolbar-divider {
    width: 1px;
    height: 24px;
    background: #ddd;
    margin: 0 4px;
}

.elevation-filter-actions {
    display: flex;
    gap: 8px;
}

.elevation-filter-actions button {
    padding: 4px 10px;
    font-size: 11px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    color: #555;
}

.elevation-filter-actions button:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.elevation-no-roots-message {
    color: #888;
    font-size: 13px;
    padding: 20px;
    text-align: center;
    font-style: italic;
}

/* Multi-column flexbox layout for filter boxes (like Progress Matrix) */
.elevation-wbs-tree-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

/* Fixed-width filter boxes */
.elevation-wbs-group {
    min-width: 200px;
    max-width: 280px;
    flex: 0 0 auto;
}

/* Filter box header */
.elevation-wbs-group-header {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.elevation-wbs-group-header:hover {
    background: #f0f0f0;
}

/* Light green highlight when group has selected items */
.elevation-wbs-group-header.has-selection {
    background: #f6ffed;
    border-color: #b7eb8f;
}

.elevation-wbs-group-header.has-selection:hover {
    background: #d9f7be;
}

.elevation-wbs-group-header.collapsed {
    border-radius: 4px;
}

.elevation-wbs-group-chevron {
    margin-right: 8px;
    font-size: 10px;
    color: #666;
    transition: transform 0.2s;
}

.elevation-wbs-group-header.collapsed .elevation-wbs-group-chevron {
    transform: rotate(-90deg);
}

.elevation-wbs-group-name {
    font-weight: 600;
    color: #333;
    font-size: 13px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.elevation-wbs-group-checkbox {
    margin-left: 8px;
    cursor: pointer;
}

/* Selection count badge - green color scheme like Progress Matrix */
.elevation-selected-count {
    background: #52c41a;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    white-space: nowrap;
}

.elevation-selected-count.partial {
    background: #95de64;
}

.elevation-selected-count.none {
    background: #d9d9d9;
    color: #999;
}

/* Items container (inside filter box) */
.elevation-wbs-items {
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 4px 4px;
    background: #fafafa;
    max-height: 150px;
    overflow-y: auto;
}

.elevation-wbs-items.hidden {
    display: none;
}

/* Individual item row */
.elevation-wbs-item {
    display: flex;
    align-items: center;
    padding: 6px 10px 6px 24px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.elevation-wbs-item:last-child {
    border-bottom: none;
}

.elevation-wbs-item:hover {
    background: #e6f7ff;
}

/* Selected items - no special highlighting, just standard look */
.elevation-wbs-item.checked {
    background: transparent;
}

.elevation-wbs-item.checked .elevation-wbs-item-name {
    color: #333;
    font-weight: 400;
}

.elevation-wbs-item input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.elevation-wbs-item-name {
    font-size: 12px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Embedded mode (inside Dashboard Settings) */
.elevation-filter-embedded {
    padding: 0;
}

.elevation-filter-embedded .elevation-filter-header {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.elevation-filter-embedded .elevation-wbs-tree-container {
    max-height: 265px;  /* Same as Progress Matrix */
}
