/* AIOS Command Center Dashboard — Dark Theme */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --green: #10b981;
    --yellow: #f59e0b;
    --red: #ef4444;
    --sidebar-width: 220px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
}

.sidebar-header .subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.nav-links {
    list-style: none;
    padding: 8px 0;
    flex: 1;
}

.nav-links li a {
    display: block;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.nav-links li a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-links li a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: rgba(59, 130, 246, 0.08);
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.last-updated {
    font-size: 11px;
    color: var(--text-muted);
}

/* Main Content */
.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 24px;
    max-width: 1400px;
}

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

.page-header h2 {
    font-size: 22px;
    font-weight: 600;
}

/* Date Picker */
.date-picker {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-picker input[type="date"] {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
}

.date-picker span {
    color: var(--text-muted);
    font-size: 13px;
}

.date-picker button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.date-picker button:hover {
    background: var(--accent-hover);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
}

.kpi-delta {
    font-size: 12px;
    font-weight: 500;
}

.kpi-delta.positive { color: var(--green); }
.kpi-delta.negative { color: var(--red); }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
}

/* Chart Grid */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.chart-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
}

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

.data-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table .totals-row td {
    border-top: 2px solid var(--accent);
    color: var(--text-primary);
}

.table-scroll {
    overflow-x: auto;
}

/* Stat Row */
.stat-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-val {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Mini table */
.mini-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 16px;
}

.mini-table th, .mini-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.mini-table th {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Colors */
.green { color: var(--green); }
.yellow { color: var(--yellow); }
.red { color: var(--red); }
.muted { color: var(--text-muted); }

/* Empty state */
.empty-state {
    color: var(--text-muted);
    font-style: italic;
    padding: 16px 0;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        flex-direction: row;
        overflow-x: auto;
    }

    .sidebar-header {
        display: none;
    }

    .nav-links {
        display: flex;
        padding: 0;
    }

    .nav-links li a {
        padding: 12px 14px;
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
        font-size: 13px;
    }

    .nav-links li a.active {
        border-bottom-color: var(--accent);
        border-left-color: transparent;
    }

    .sidebar-footer {
        display: none;
    }

    body {
        flex-direction: column;
    }

    .content {
        margin-left: 0;
        padding: 16px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .kpi-value {
        font-size: 20px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}
