:root {
    --bg: #0f0f0f;
    --bg-2: #1a1a1a;
    --bg-3: #242424;
    --border: #2e2e2e;
    --text: #e8e8e8;
    --text-muted: #777;
    --accent: #c8a96e;
    --accent-dim: rgba(200, 169, 110, 0.15);
    --radius: 6px;
    --font: 'Inter', system-ui, sans-serif;
}

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

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
}

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 52px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand-name { font-size: 18px; font-weight: 600; color: var(--text); letter-spacing: -0.5px; }
.brand-claim { font-size: 11px; color: var(--accent); font-style: italic; letter-spacing: 0.5px; }

.nav-links { display: flex; gap: 4px; }
.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
    font-size: 13px;
}
.nav-links a:hover { color: var(--text); background: var(--bg-3); }
.nav-links a.active { color: var(--text); background: var(--bg-3); }

/* Chat-Layout */
.chat-layout {
    display: grid;
    grid-template-columns: 220px 1fr 280px;
    height: calc(100vh - 52px);
}

.sidebar {
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.btn-icon {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 24px; height: 24px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: color 0.15s, border-color 0.15s;
}
.btn-icon:hover { color: var(--text); border-color: var(--text-muted); }

.chat-history { list-style: none; overflow-y: auto; flex: 1; padding: 8px; }
.chat-history li {
    padding: 8px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s;
}
.chat-history li:hover { background: var(--bg-3); color: var(--text); }

/* Chat-Main */
.chat-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.source-selector {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.source-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.source-chip:has(input:checked) { border-color: var(--accent); color: var(--accent); }
.source-chip input { display: none; }

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message { max-width: 720px; }
.message.user { align-self: flex-end; }
.message.user .bubble {
    background: var(--bg-3);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text);
}
.message.assistant .bubble {
    color: var(--text);
    line-height: 1.7;
}
.message.assistant .bubble p { margin-bottom: 10px; }
.message.assistant .bubble p:last-child { margin-bottom: 0; }

.input-area {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    align-items: flex-end;
}

textarea#question-input {
    flex: 1;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    padding: 10px 14px;
    resize: none;
    max-height: 160px;
    overflow-y: auto;
    transition: border-color 0.15s;
    line-height: 1.5;
}
textarea#question-input:focus { outline: none; border-color: var(--accent); }

.btn-primary {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius);
    padding: 10px 18px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* Quellen-Panel */
.sources-panel {
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sources-panel-header {
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

#sources-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.source-item {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}

.source-item-title { font-size: 12px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.source-item-score {
    font-size: 11px;
    color: var(--accent);
    margin-bottom: 6px;
}
.source-item-content {
    font-size: 11px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.source-item a { color: var(--accent); text-decoration: none; font-size: 11px; }
.source-item a:hover { text-decoration: underline; }

/* Admin */
.admin-layout {
    display: grid;
    grid-template-columns: 180px 1fr;
    min-height: calc(100vh - 52px);
}

.admin-nav {
    border-right: 1px solid var(--border);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 7px 10px;
    border-radius: var(--radius);
    font-size: 13px;
    transition: color 0.15s, background 0.15s;
}
.admin-nav a:hover, .admin-nav a.active { color: var(--text); background: var(--bg-3); }

.admin-content { padding: 32px; }
.admin-content h1 { font-size: 20px; font-weight: 600; margin-bottom: 24px; }
.admin-content h2 { font-size: 14px; font-weight: 500; margin: 28px 0 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 8px; }

.stat-card {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
}
.stat-value { font-size: 28px; font-weight: 600; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.data-table tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}
.badge-ok { background: rgba(80, 180, 80, 0.15); color: #6dbf6d; }
.badge-running { background: var(--accent-dim); color: var(--accent); }
.badge-error { background: rgba(220, 80, 80, 0.15); color: #dc6060; }

.btn-sm {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    cursor: pointer;
    font-family: var(--font);
    transition: color 0.15s, border-color 0.15s;
}
.btn-sm:hover { color: var(--text); border-color: var(--text-muted); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Cursor-Blinken während Streaming */
.cursor::after { content: '▋'; animation: blink 1s step-end infinite; color: var(--accent); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
