:root {
    --bg-dark: #0f172a;
    --bg-light: #f8fafc;
    --text-main: #334155;
    --primary: #3b82f6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-light);
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--bg-dark);
    color: white;
    display: flex;
    flex-direction: column;
}

.logo {
    padding: 20px;
    font-size: 24px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.logo span { color: var(--primary); }

.sidebar nav {
    flex-grow: 1;
    padding: 20px 0;
}

.sidebar nav a {
    display: block;
    padding: 15px 20px;
    color: #cbd5e1;
    text-decoration: none;
    transition: 0.2s;
}

.sidebar nav a:hover, .sidebar nav a.active {
    background-color: rgba(255,255,255,0.05);
    border-left: 4px solid var(--primary);
    color: white;
}

.user-profile {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Main Content */
.content {
    flex-grow: 1;
    padding: 30px 40px;
    overflow-y: auto;
}

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

h1 { margin: 0; font-size: 28px; }

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

/* Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.metric-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.metric-card h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #64748b;
    text-transform: uppercase;
}
.score { font-size: 32px; font-weight: 600; }

/* Table */
table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

th, td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th { background-color: #f1f5f9; font-weight: 600; }

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

.btn-sm {
    background: white;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

/* KNOWLEDGE DRAWER */
.drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    transition: right 0.3s ease-in-out;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.drawer.open { right: 0; }

.drawer-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h2 { margin: 0; font-size: 18px; }

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #94a3b8;
}

.drawer-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.drawer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 999;
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.ai-box {
    background: linear-gradient(to right, #f3e8ff, #e0e7ff);
    border-left: 4px solid #8b5cf6;
    padding: 15px;
    border-radius: 0 8px 8px 0;
    margin-top: 20px;
    font-size: 14px;
}

/* TERMINAL LIVE */
.terminal-window {
    background: #0f172a;
    color: #10b981;
    font-family: 'Fira Code', 'Courier New', monospace;
    padding: 15px;
    border-radius: 8px;
    height: 150px;
    overflow-y: auto;
    margin-bottom: 30px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
    font-size: 13px;
    border: 1px solid #334155;
}
.terminal-line { margin-bottom: 4px; border-left: 2px solid transparent; padding-left: 8px; }
.terminal-line.new { animation: blink-green 0.5s; border-left-color: #10b981; }
@keyframes blink-green { from { background: rgba(16, 185, 129, 0.2); } to { background: transparent; } }

/* SILOS & FILTERS */
.silo-header {
    background: #f1f5f9;
    padding: 10px 20px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
}
.silo-header:hover { background: #e2e8f0; }
.silo-content { display: block; }
.silo-content.collapsed { display: none; }

.filter-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.filter-bar input {
    flex-grow: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.filter-btn {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    font-size: 13px;
}
.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
