/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    background: #1a1a1a;
    color: #e0e0e0;
    padding: 0;
    margin: 0;
}

/* Loading and Error States */
.loading-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: #e0e0e0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-state p {
    color: #ff6b6b;
    font-size: 14px;
}

/* Dashboard Layout */
.dashboard {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0;
}

/* Header */
.header {
    background: #2a2a2a;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3a3a3a;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.header h1 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.data-source {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.refresh-btn {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.refresh-btn:hover:not(:disabled) {
    background: #5568d3;
}

.refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.last-updated {
    font-size: 11px;
    color: #888;
}

/* Progress Bar */
.progress-bar {
    position: relative;
    height: 28px;
    background: #2a2a2a;
    border-bottom: 1px solid #3a3a3a;
    overflow: hidden;
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 600;
    color: white;
    z-index: 1;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1px;
    background: #3a3a3a;
    border-top: 1px solid #3a3a3a;
}

.kpi-card {
    background: #2a2a2a;
    padding: 16px 20px;
}

.kpi-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    color: #fff;
    margin-bottom: 4px;
}

.kpi-delta {
    font-size: 13px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    margin-bottom: 2px;
}

.kpi-baseline {
    font-size: 11px;
    color: #666;
}

.delta-positive {
    color: #51cf66;
}

.delta-negative {
    color: #ff6b6b;
}

/* Sections */
.section {
    background: #2a2a2a;
    margin-top: 1px;
    padding: 16px 20px;
}

.section h2 {
    font-size: 13px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* Segment Switcher */
.segment-switcher {
    display: flex;
    gap: 4px;
}

.segment-switcher button {
    padding: 4px 10px;
    background: #1a1a1a;
    color: #888;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.segment-switcher button:hover {
    background: #333;
}

.segment-switcher button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: #1a1a1a;
}

.data-table th {
    padding: 8px 12px;
    text-align: left;
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    border-bottom: 1px solid #3a3a3a;
}

.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #2a2a2a;
}

.data-table tbody tr:hover {
    background: #252525;
}

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

.no-data {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px !important;
}

/* Numbers in tables - monospace for alignment */
.data-table td:nth-child(3),
.data-table td:nth-child(4),
.data-table td:nth-child(5),
.data-table td:nth-child(6) {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #667eea;
    color: white;
    border-radius: 3px;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

/* Phase Progress */
.phase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.phase-card {
    background: #1a1a1a;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #3a3a3a;
}

.phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.phase-name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.phase-stats {
    font-size: 11px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    color: #888;
}

.phase-progress-bar {
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.phase-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.phase-percentage {
    font-size: 11px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    color: #888;
    text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 11px;
    }

    .data-table th,
    .data-table td {
        padding: 6px 8px;
    }
}
