:root{color:#111827;--user-bg:#111827;--user-text:#fff;--bot-bg:#fff;--bot-text:#111827;--input-bg:#fff;--border:#e5e7eb;--muted:#6b7280;--source-bg:#f9fafb;--source-border:#e5e7eb;background:#f3f4f6;font-family:Inter,system-ui,Arial,sans-serif}*{box-sizing:border-box}body{margin:0}.app{flex-direction:column;max-width:780px;height:100vh;margin:0 auto;display:flex}.messages-area{flex-direction:column;flex:1;padding:24px 16px 16px;display:flex;overflow-y:auto}.welcome{text-align:center;max-width:520px;margin:auto;padding:40px 0}.welcome-icon{color:#4338ca;background:#eef2ff;border-radius:14px;justify-content:center;align-items:center;width:48px;height:48px;margin-bottom:16px;display:inline-flex}.welcome h1{margin:0 0 8px;font-size:1.75rem;font-weight:600}.welcome p{color:var(--muted);margin:0 0 28px;line-height:1.5}.topics{text-align:left;flex-direction:column;gap:16px;display:flex}.topic-group{flex-direction:column;gap:8px;display:flex}.topic-label{text-transform:uppercase;letter-spacing:.06em;color:var(--muted);align-items:center;gap:5px;font-size:.7rem;font-weight:600;display:flex}.tags{flex-wrap:wrap;gap:8px;display:flex}.tag{cursor:pointer;border:1px solid #0000;border-radius:20px;padding:6px 14px;font-size:.85rem;transition:background .15s,border-color .15s,transform .1s}.tag:hover{transform:translateY(-1px)}.tag-frequent{color:#4338ca;background:#eef2ff;border-color:#c7d2fe}.tag-frequent:hover{background:#e0e7ff}.tag-recent{color:#065f46;background:#ecfdf5;border-color:#a7f3d0}.tag-recent:hover{background:#d1fae5}.messages{flex-direction:column;gap:20px;display:flex}.bubble-row{align-items:flex-start;gap:10px;max-width:85%;display:flex}.bubble-row.user{flex-direction:row-reverse;align-self:flex-end}.bubble-row.assistant,.bubble-row.error{align-self:flex-start}.avatar{border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:34px;height:34px;margin-top:2px;display:flex}.bubble-row.user .avatar{background:var(--user-bg);color:var(--user-text)}.bubble-row.assistant .avatar{color:#4338ca;background:#eef2ff}.bubble-row.error .avatar{color:#dc2626;background:#fef2f2}.bubble-content{flex-direction:column;gap:8px;min-width:0;display:flex}.bubble{word-break:break-word;border-radius:18px;padding:12px 16px;line-height:1.6}.bubble p{white-space:pre-wrap;margin:0}.bubble.user{background:var(--user-bg);color:var(--user-text);border-bottom-right-radius:6px}.bubble.assistant{background:var(--bot-bg);color:var(--bot-text);border-bottom-left-radius:6px;box-shadow:0 1px 4px #0000000f}.bubble.error{color:#991b1b;background:#fef2f2;border:1px solid #fecaca;border-bottom-left-radius:6px}.typing-dots{gap:5px;padding:4px 0;display:flex}.typing-dots span{background:#9ca3af;border-radius:50%;width:7px;height:7px;animation:1.2s infinite bounce}.typing-dots span:nth-child(2){animation-delay:.15s}.typing-dots span:nth-child(3){animation-delay:.3s}@keyframes bounce{0%,60%,to{transform:translateY(0)}30%{transform:translateY(-6px)}}.source-cards{flex-wrap:wrap;gap:8px;display:flex}.source-card{background:var(--source-bg);border:1px solid var(--source-border);border-radius:12px;align-items:center;gap:10px;min-width:180px;padding:10px 14px;transition:box-shadow .15s;display:flex}.source-card:hover{box-shadow:0 2px 8px #00000014}.source-card-icon{color:#4338ca;background:#eef2ff;border-radius:8px;flex-shrink:0;justify-content:center;align-items:center;width:32px;height:32px;display:flex}.source-card-info{flex-direction:column;gap:1px;min-width:0;display:flex}.source-card-title{color:#111827;white-space:nowrap;text-overflow:ellipsis;font-size:.82rem;font-weight:600;overflow:hidden}.source-card-meta{color:var(--muted);font-size:.72rem}.input-bar{background:linear-gradient(#0000,#f3f4f6 30%);flex-shrink:0;padding:12px 16px 20px}.input-bar-inner{background:var(--input-bg);border:1px solid var(--border);border-radius:16px;align-items:center;gap:8px;padding:6px 6px 6px 16px;display:flex;box-shadow:0 4px 20px #0000000f}.input-bar-inner textarea{resize:none;color:inherit;background:0 0;border:none;outline:none;flex:1;padding:8px 0;font-family:inherit;font-size:.95rem;line-height:1.5}.input-bar-inner textarea::placeholder{color:#9ca3af}.send-btn{color:#fff;cursor:pointer;background:#111827;border:none;border-radius:12px;flex-shrink:0;justify-content:center;align-items:center;width:40px;height:40px;transition:background .15s,opacity .15s;display:flex}.send-btn:hover:not(:disabled){background:#1f2937}.send-btn:disabled{opacity:.35;cursor:not-allowed}.spinner{border:2px solid #ffffff4d;border-top-color:#fff;border-radius:50%;width:18px;height:18px;animation:.6s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}@media (prefers-color-scheme:dark){:root{color:#e5e7eb;--user-bg:#4338ca;--user-text:#fff;--bot-bg:#1f2937;--bot-text:#e5e7eb;--input-bg:#1f2937;--border:#374151;--muted:#9ca3af;--source-bg:#1a1d27;--source-border:#2d3140;background:#0f1117}.welcome-icon,.bubble-row.assistant .avatar{color:#a5b4fc;background:#6366f126}.bubble.assistant{box-shadow:0 1px 4px #0003}.bubble.error{color:#fca5a5;background:#1c1111;border-color:#7f1d1d}.bubble-row.error .avatar{color:#fca5a5;background:#dc262626}.tag-frequent{color:#a5b4fc;background:#6366f126;border-color:#6366f14d}.tag-frequent:hover{background:#6366f140}.tag-recent{color:#6ee7b7;background:#10b98126;border-color:#10b9814d}.tag-recent:hover{background:#10b98140}.source-card-icon{color:#a5b4fc;background:#6366f126}.source-card-title{color:#e5e7eb}.input-bar{background:linear-gradient(#0000,#0f1117 30%)}.input-bar-inner{box-shadow:0 4px 20px #0000004d}.send-btn{background:#4338ca}.send-btn:hover:not(:disabled){background:#4f46e5}}@media (width<=600px){.bubble-row{max-width:92%}.welcome h1{font-size:1.4rem}.source-card{min-width:150px}}
