* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; margin: 0; padding: 0; background: #0f0f12; color: #e4e4e7; min-height: 100vh; }
a { color: #a78bfa; text-decoration: none; }
a:hover { text-decoration: underline; }

header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; background: #18181b; border-bottom: 1px solid #27272a; }
header .brand { font-weight: 700; font-size: 1.25rem; }
header nav a { margin-left: 1.5rem; }

main { max-width: 720px; margin: 0 auto; padding: 2rem 1.5rem; }
h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.meta { color: #71717a; font-size: 0.875rem; }
.error { color: #f87171; margin: 1rem 0; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: #18181b; padding: 2rem; border-radius: 8px; border: 1px solid #27272a; width: 100%; max-width: 320px; }
.login-card h1 { margin-top: 0; }
.login-card form { display: flex; flex-direction: column; gap: 0.75rem; }
.login-card input { padding: 0.5rem 0.75rem; border: 1px solid #3f3f46; border-radius: 4px; background: #27272a; color: #e4e4e7; }
.login-card button { padding: 0.5rem 1rem; background: #7c3aed; color: white; border: none; border-radius: 4px; cursor: pointer; }
.login-card button:hover { background: #6d28d9; }

.inline-form { display: inline-flex; gap: 0.5rem; margin: 0.5rem 0.5rem 0 0; align-items: center; }
.inline-form input, .inline-form select { padding: 0.35rem 0.5rem; background: #27272a; border: 1px solid #3f3f46; border-radius: 4px; color: #e4e4e7; }
.inline-form button { padding: 0.35rem 0.75rem; background: #3f3f46; color: #e4e4e7; border: none; border-radius: 4px; cursor: pointer; }
.inline-form button:hover { background: #52525b; }
.inline-form button.danger { background: #7f1d1d; color: #fca5a5; }
.inline-form button.danger:hover { background: #991b1b; }

.chat-list { list-style: none; padding: 0; margin: 1.5rem 0; }
.chat-list li { padding: 0.75rem; margin-bottom: 0.5rem; background: #18181b; border-radius: 6px; border: 1px solid #27272a; display: flex; justify-content: space-between; align-items: center; }
.chat-list li.empty { color: #71717a; }
.chat-list .meta { font-size: 0.75rem; }

.breadcrumb { margin-bottom: 1rem; }

.messages { margin: 2rem 0; min-height: 200px; }
.message { padding: 1rem; margin-bottom: 1rem; border-radius: 8px; }
.message.user { background: #27272a; border-left: 4px solid #7c3aed; }
.message.assistant { background: #18181b; border-left: 4px solid #3f3f46; }
.message .role { font-size: 0.75rem; color: #71717a; display: block; margin-bottom: 0.25rem; }
.message .content { white-space: pre-wrap; word-break: break-word; }
.message .content p { margin: 0 0 0.5em; }
.message .content p:last-child { margin-bottom: 0; }
.message .content ul, .message .content ol { margin: 0.5em 0; padding-left: 1.5em; }
.message .content code { background: #27272a; padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.9em; }
.message .content pre { background: #27272a; padding: 0.75rem; border-radius: 6px; overflow-x: auto; margin: 0.5em 0; }
.message .content pre code { background: none; padding: 0; }
.message .content blockquote { border-left: 4px solid #3f3f46; margin: 0.5em 0; padding-left: 1em; color: #a1a1aa; }
.message .content h1, .message .content h2, .message .content h3 { margin: 0.75em 0 0.25em; font-size: 1em; }
.message .content a { color: #2563eb; text-decoration: underline; }
.message .content a:hover { color: #1d4ed8; }
.message .attachments { margin-top: 0.5rem; padding-left: 1.25rem; font-size: 0.875rem; }
.message .download-links { margin-top: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.message .btn-download { display: inline-block; padding: 0.4rem 0.75rem; background: #7c3aed; color: white; border-radius: 6px; font-size: 0.875rem; text-decoration: none; }
.message .btn-download:hover { background: #6d28d9; text-decoration: none; }

.message-form { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #27272a; }
.message-form textarea { width: 100%; padding: 0.75rem; background: #27272a; border: 1px solid #3f3f46; border-radius: 6px; color: #e4e4e7; resize: vertical; }
.message-form .form-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; align-items: center; }
.message-form input[type="file"] { flex: 1; }
.message-form button { padding: 0.5rem 1.5rem; background: #7c3aed; color: white; border: none; border-radius: 6px; cursor: pointer; }
.message-form button:hover { background: #6d28d9; }

.connection-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.5rem; margin: 1.5rem 0; }
.connection-form input, .connection-form select { padding: 0.5rem; background: #27272a; border: 1px solid #3f3f46; border-radius: 4px; color: #e4e4e7; }
.connection-form button { padding: 0.5rem; background: #7c3aed; color: white; border: none; border-radius: 4px; cursor: pointer; grid-column: 1 / -1; }
.connection-list { list-style: none; padding: 0; }
.connection-list li { padding: 0.75rem; margin-bottom: 0.5rem; background: #18181b; border-radius: 6px; border: 1px solid #27272a; display: flex; justify-content: space-between; align-items: center; }
.connection-list li.empty { color: #71717a; }
