:root { --bg:#f4f6f9; --card:#fff; --text:#1d2433; --muted:#6b7385; --accent:#1f6feb; --me:#1f6feb; --bot:#fff; --border:#dfe3ea; --err:#b42318; --warn:#9a6700; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); display: flex; flex-direction: column; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.error { color: var(--err); }
button { font: inherit; cursor: pointer; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 700; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab { border: 0; background: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); }
.tab.active { background: #e8f0fe; color: var(--accent); font-weight: 600; }
.link-btn { border: 0; background: none; color: var(--accent); padding: 4px 6px; }
.link-btn.small { font-size: 13px; }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; width: 100%; max-width: 860px; margin: 0 auto; }
.messages { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 6px; }
.empty { margin: auto; text-align: center; color: var(--muted); padding: 20px; }
.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.bot { align-self: flex-start; }
.bubble { padding: 10px 13px; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere; }
.me .bubble { background: var(--me); color: #fff; border-bottom-right-radius: 4px; }
.me .bubble a { color: #fff; }
.bot .bubble { background: var(--bot); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble ul, .bubble ol { margin: 4px 0; padding-left: 22px; }
.bubble code { background: rgba(0,0,0,.07); padding: 1px 4px; border-radius: 4px; font-size: .92em; }
.bubble .h { display: block; margin-top: 4px; }
.meta { font-size: 12px; color: var(--muted); margin: 2px 4px 8px; }
.note { align-self: flex-start; font-size: 14px; padding: 8px 12px; border-radius: 10px; margin-bottom: 8px; }
.note.thinking { color: var(--muted); background: #eef1f6; }
.note.err { color: var(--err); background: #fdecea; }
.note.warn { color: var(--warn); background: #fff6db; }
.dots::after { content: ''; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0%{content:''} 25%{content:'.'} 50%{content:'..'} 75%{content:'...'} }
.composer { display: flex; gap: 8px; padding: 10px 12px 4px; background: var(--bg); }
.composer textarea { flex: 1; resize: none; font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; min-height: 44px; max-height: 200px; }
.composer button, .login-card button { border: 0; background: var(--accent); color: #fff; border-radius: 12px; padding: 0 18px; font-weight: 600; }
.composer button:disabled { opacity: .6; }
.composer-foot { display: flex; justify-content: space-between; align-items: center; padding: 0 14px calc(8px + env(safe-area-inset-bottom)); font-size: 13px; }
.login-body { align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--card); padding: 28px 24px; border-radius: 16px; width: 100%; max-width: 360px; box-shadow: 0 6px 24px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 0; font-size: 24px; }
.login-card p { margin: 0; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.login-card input { font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); }
.login-card button { padding: 12px; margin-top: 4px; }
.docs { padding: 16px 12px 32px; overflow-y: auto; }
.doc-group { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 6px 14px; margin-bottom: 14px; }
.doc-group h2 { font-size: 17px; margin: 10px 0 6px; }
.doc-group ul { list-style: none; margin: 0; padding: 0; }
.doc-group li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.doc-info { display: flex; flex-direction: column; min-width: 0; }
.doc-title { font-weight: 500; }
.doc-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-sm { text-decoration: none; background: var(--accent); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 14px; }
.btn-sm.outline { background: none; color: var(--accent); border: 1px solid var(--accent); }
@media (max-width: 520px) {
  .brand { display: none; }
  .msg { max-width: 94%; }
  .doc-group li { flex-direction: column; align-items: flex-start; }
}

/* Anhänge */
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.attach-btn { border: 1px solid var(--border) !important; background: var(--card) !important; color: var(--text) !important; font-size: 20px; padding: 0 12px !important; }
.chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 4px 10px; border-radius: 999px; font-size: 13px; text-decoration: none; background: #e8f0fe; color: var(--accent); border: 1px solid #c9dafc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-x { border: 0; background: none; color: var(--muted); font-size: 16px; padding: 0 2px; line-height: 1; }
.files { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.files-me { flex-direction: row; flex-wrap: wrap; }
.files-me .chip { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.4); }
.file-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.file-name { flex: 1 1 100%; font-size: 14px; overflow-wrap: anywhere; }
