* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f0f2f5; color: #1f2a44; height: 100vh; overflow: hidden; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; height: 100vh; background: #1a2332; }
.login-card { background: #fff; border-radius: 16px; padding: 40px; width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,.2); text-align: center; }
.login-logo { font-size: 48px; margin-bottom: 8px; }
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-subtitle { color: #888; margin-bottom: 24px; font-size: 14px; }
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; font-size: 13px; color: #666; margin-bottom: 4px; font-weight: 600; }
.form-group input { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; outline: none; }
.form-group input:focus { border-color: #C8A45C; box-shadow: 0 0 0 2px rgba(200,164,92,.2); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; transition: all .2s; }
.btn-primary { background: #1f2a44; color: #fff; }
.btn-primary:hover { background: #2a3a5c; }
.btn-primary:disabled { background: #aaa; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-outline { background: transparent; border: 1px solid #ddd; color: #666; }
.btn-outline:hover { border-color: #1f2a44; color: #1f2a44; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #fdecea; color: #c0392b; border: 1px solid #f5c6cb; }

/* Layout */
.app-layout { display: flex; height: 100vh; }

/* Sidebar */
.sidebar { width: 280px; min-width: 280px; background: #1a2332; color: #fff; display: flex; flex-direction: column; }
.sidebar-header { padding: 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-logo { font-size: 16px; font-weight: 700; }
.sidebar-user { font-size: 12px; color: #aaa; }
.sidebar-actions { padding: 12px 16px; }
.dialog-list { flex: 1; overflow-y: auto; }
.dialog-item { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,.05); position: relative; transition: background .15s; }
.dialog-item:hover { background: rgba(255,255,255,.08); }
.dialog-item.active { background: rgba(200,164,92,.15); border-left: 3px solid #C8A45C; }
.dialog-item-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.dialog-item-preview { font-size: 12px; color: #8899aa; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.dialog-delete { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #667; cursor: pointer; font-size: 14px; opacity: 0; transition: opacity .2s; padding: 4px; }
.dialog-item:hover .dialog-delete { opacity: 1; }
.dialog-delete:hover { color: #e74c3c; }
.dialog-empty { padding: 24px 16px; text-align: center; color: #667; font-size: 13px; }
.sidebar-spacer { flex: 1; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.1); display: flex; gap: 12px; }
.sidebar-link { color: #aaa; text-decoration: none; font-size: 13px; }
.sidebar-link:hover { color: #fff; }
.logout-link { margin-left: auto; }

/* Chat area */
.chat-area { flex: 1; display: flex; flex-direction: column; background: #fff; }
.chat-header { padding: 16px 24px; border-bottom: 1px solid #eee; }
.chat-header h2 { font-size: 16px; font-weight: 600; }
.messages { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.messages-empty { text-align: center; color: #aaa; padding: 60px 20px; }
.messages-empty p { font-size: 15px; }
.message { max-width: 80%; padding: 12px 16px; border-radius: 12px; animation: fadeIn .2s; }
.message-user { align-self: flex-end; background: #1f2a44; color: #fff; border-bottom-right-radius: 4px; }
.message-assistant { align-self: flex-start; background: #f0f2f5; color: #1f2a44; border-bottom-left-radius: 4px; }
.message-thinking .message-content { color: #888; }
.message-content { line-height: 1.5; word-break: break-word; }
.message-content p { margin: 6px 0; }
.message-content p:first-child { margin-top: 0; }
.message-content p:last-child { margin-bottom: 0; }
.message-content ul, .message-content ol { margin: 6px 0; padding-left: 20px; }
.message-content li { margin: 2px 0; }
.message-content h1, .message-content h2, .message-content h3, .message-content h4 { margin: 10px 0 6px; }
.message-content h1 { font-size: 18px; }
.message-content h2 { font-size: 16px; }
.message-content h3 { font-size: 15px; }
.message-content code { background: rgba(0,0,0,.08); padding: 2px 5px; border-radius: 4px; font-size: 13px; font-family: 'SF Mono', 'Fira Code', monospace; }
.message-content pre { background: #1a2332; color: #e0e0e0; padding: 12px 16px; border-radius: 8px; overflow-x: auto; margin: 8px 0; }
.message-content pre code { background: none; padding: 0; color: inherit; font-size: 13px; }
.message-content strong { font-weight: 700; }
.message-content em { font-style: italic; }
.message-content a { color: #3B6EA5; text-decoration: underline; }
.message-content table { border-collapse: collapse; margin: 8px 0; width: 100%; font-size: 13px; }
.message-content th, .message-content td { border: 1px solid #ddd; padding: 6px 10px; text-align: left; }
.message-content th { background: #f5f5f5; font-weight: 600; }
.message-content blockquote { border-left: 3px solid #C8A45C; margin: 8px 0; padding: 4px 12px; color: #666; }
.message-content hr { border: none; border-top: 1px solid #ddd; margin: 12px 0; }
.message-time { font-size: 11px; color: #999; margin-top: 4px; }

.chat-input { padding: 16px 24px; border-top: 1px solid #eee; display: flex; gap: 12px; align-items: flex-end; }
.chat-input textarea { flex: 1; padding: 10px 14px; border: 1px solid #ddd; border-radius: 10px; font-size: 14px; outline: none; resize: none; font-family: inherit; max-height: 200px; }
.chat-input textarea:focus { border-color: #C8A45C; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #aaa; }
.chat-empty-icon { font-size: 64px; margin-bottom: 12px; }
.chat-empty h2 { font-size: 20px; color: #666; }
.chat-empty p { font-size: 14px; }

/* Dashboards */
.dashboards-page { padding: 40px; max-width: 1000px; margin: 0 auto; }
.dashboards-page h1 { margin-bottom: 24px; }
.dashboard-card { background: #fff; border-radius: 12px; padding: 24px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); display: flex; align-items: center; gap: 16px; }
.dashboard-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.dashboard-icon { font-size: 32px; }
.dashboard-info { flex: 1; }
.dashboard-info h3 { font-size: 16px; margin-bottom: 4px; }
.dashboard-info p { color: #888; font-size: 13px; margin: 0; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #bbb; }
