:root {
    --bg: #0f1220;
    --surface: #171b2e;
    --surface-2: #1f2439;
    --border: #2b3153;
    --text: #e8eaf5;
    --text-muted: #9aa1c4;
    --primary: #6d5efc;
    --primary-hover: #8375ff;
    --success: #33c481;
    --error: #ff6b6b;
    --warn: #f5b942;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--primary-hover); }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.container-narrow { max-width: 640px; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar .brand {
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
}

.topbar nav {
    display: flex;
    gap: 18px;
    align-items: center;
}

.topbar nav a {
    color: var(--text-muted);
    text-decoration: none;
}

.topbar nav a:hover { color: var(--text); }

.page-header { margin-bottom: 20px; }
.page-header h1 { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }

.back-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9em;
}

.muted { color: var(--text-muted); }

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

.card h2 { margin-top: 0; font-size: 1.1em; }
.card hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 900px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

label {
    display: block;
    margin-bottom: 14px;
    font-size: 0.9em;
    color: var(--text-muted);
}

input[type=text], input[type=password], textarea, select {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95em;
}

textarea { resize: vertical; }

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95em;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9em;
}

.alert-error { background: rgba(255,107,107,0.15); color: var(--error); border: 1px solid rgba(255,107,107,0.3); }
.alert-success { background: rgba(51,196,129,0.15); color: var(--success); border: 1px solid rgba(51,196,129,0.3); }
.alert-info { background: rgba(109,94,252,0.15); color: var(--primary-hover); border: 1px solid rgba(109,94,252,0.3); }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.6em;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    vertical-align: middle;
}

.status-beratung { background: rgba(245,185,66,0.2); color: var(--warn); }
.status-umsetzung { background: rgba(109,94,252,0.2); color: var(--primary-hover); }
.status-fertig { background: rgba(51,196,129,0.2); color: var(--success); }

.project-list { list-style: none; padding: 0; margin: 0; }
.project-list li { border-bottom: 1px solid var(--border); }
.project-list li:last-child { border-bottom: none; }
.project-list a {
    display: block;
    padding: 12px 4px;
    text-decoration: none;
    color: var(--text);
}
.project-list-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.deliverable-list { list-style: none; padding: 0; margin: 0; }
.deliverable-list li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.deliverable-list li:last-child { border-bottom: none; }
.deliverable-list .dl { margin-left: auto; text-decoration: none; }

.chat-card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.chat-card-header h2 { margin: 0; }
.btn-small { padding: 6px 12px; font-size: 0.85em; }

.chat-card { display: flex; flex-direction: column; min-height: 600px; }
.chat-log {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 4px 16px;
    max-height: 560px;
}

.chat-msg {
    padding: 10px 14px;
    border-radius: 10px;
    max-width: 85%;
}

.chat-msg-user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
}

.chat-msg-agent {
    align-self: flex-start;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.chat-msg-sender { font-size: 0.75em; opacity: 0.8; margin-bottom: 4px; font-weight: 600; }

.chat-msg-content p { margin: 0 0 10px; }
.chat-msg-content p:last-child { margin-bottom: 0; }
.chat-msg-content ul, .chat-msg-content ol { margin: 0 0 10px; padding-left: 22px; }
.chat-msg-content li { margin-bottom: 4px; }
.chat-msg-content h4, .chat-msg-content h5, .chat-msg-content h6 { margin: 14px 0 6px; }
.chat-msg-content h4:first-child, .chat-msg-content h5:first-child, .chat-msg-content h6:first-child { margin-top: 0; }
.chat-msg-content code { background: rgba(255,255,255,0.12); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.chat-msg-user .chat-msg-content code { background: rgba(0,0,0,0.15); }
.chat-msg-content strong { font-weight: 700; }
.chat-msg-content a { color: inherit; text-decoration: underline; }

.chat-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 360px;
}

.auth-card h1 { font-size: 1.3em; margin-bottom: 4px; }

code {
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: 4px;
}
