/* --- 1. RESET & CORE TYPOGRAPHY (Linear Style) --- */
:root {
    --bg-root: #080808;       /* Deepest black/gray */
    --bg-surface: #121214;    /* Slightly lighter for cards */
    --bg-sidebar: #161618;    /* Distinct sidebar */
    --border-subtle: #27272a; /* Very subtle borders */
    --border-active: #3f3f46; 
    --text-primary: #eeeeee;  /* Almost white */
    --text-secondary: #a1a1aa; /* Muted gray */
    --accent-primary: #5E6AD2; /* Linear Purple/Blue */
    --accent-hover: #747fdb;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    background-color: var(--bg-root);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px; /* Linear uses compact, readable text */
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* --- 2. SIDEBAR --- */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    border-right: 1px solid var(--border-subtle);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
}

/* Logo styling within header */
.sidebar-header img {
    margin-bottom: 8px;
    border-radius: 6px; /* Soft corners */
}

.sidebar-header p {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sidebar-menu {
    padding: 16px 12px;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: var(--text-secondary);
    border-radius: 6px;
    margin-bottom: 2px;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.15s ease;
}

.menu-item:hover {
    background: #27272a;
    color: var(--text-primary);
}

.menu-item.active {
    background: #27272a;
    color: var(--text-primary);
    /* Linear active state indicator */
    box-shadow: inset 2px 0 0 var(--accent-primary); 
}

.menu-item span {
    margin-right: 12px;
    opacity: 0.7;
}

/* --- 3. MAIN CONTENT AREA --- */
.main-content {
    margin-left: 240px;
    padding: 32px 40px;
    min-height: 100vh;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.top-bar h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

/* Logout Button - Minimalist */
.logout-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* --- 4. STATS GRID (Head-Up Display) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-surface);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    /* Linear doesn't use drop shadows, it uses borders */
}

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-card p.stat-value {
    font-size: 28px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Subtle styling for specific cards if needed, but keeping it monochrome is more "Linear" */
.stat-card.purple p.stat-value { color: #d8b4fe; }
.stat-card.blue p.stat-value { color: #93c5fd; }
.stat-card.green p.stat-value { color: #86efac; }
.stat-card.orange p.stat-value { color: #fdba74; }

/* --- 5. BUTTONS (Action Bar) --- */
.quick-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

/* --- 6. CHARTS --- */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.chart-card {
    background: var(--bg-surface);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    min-height: 320px;
}

.chart-card h3 {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- 7. TABLES (The Core "Linear" Look) --- */
.content-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.card {
    background: var(--bg-surface);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    overflow: hidden; /* Contains the table */
}

.card h2 {
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    margin: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    background: rgba(255, 255, 255, 0.02);
}

th {
    text-align: left;
    padding: 12px 20px;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border-subtle);
}

td {
    padding: 12px 20px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
}

/* Table Hover Effect - Critical for Linear feel */
tr.hover:bg-gray-800:hover td {
    background-color: rgba(255, 255, 255, 0.03);
}

tr:last-child td { border-bottom: none; }

/* Dim text helper */
.text-dim { color: var(--text-secondary); font-size: 0.85em; }
.text-white { color: var(--text-primary); }

/* --- 8. BADGES (Status Indicators) --- */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.info { 
    background: rgba(94, 106, 210, 0.15); 
    color: #8b95f2; 
    border: 1px solid rgba(94, 106, 210, 0.2);
}
.success { 
    background: rgba(74, 222, 128, 0.1); 
    color: #4ade80; 
    border: 1px solid rgba(74, 222, 128, 0.2);
}
.warning { 
    background: rgba(250, 204, 21, 0.1); 
    color: #facc15; 
    border: 1px solid rgba(250, 204, 21, 0.2);
}
.danger { 
    background: rgba(248, 113, 113, 0.1); 
    color: #f87171; 
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.center-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .main-content { margin-left: 0; padding: 20px; }
    .charts-grid { grid-template-columns: 1fr; }
}