/* AI Chat Platform - OneZero IT */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base: #0f0f1a;
  --bg-surface: #1a1a2e;
  --bg-elevated: #1e1e2e;
  --bg-hover: #252538;
  --bg-active: #2d2d44;
  --border: #2d2d44;
  --border-light: #3d3d54;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-hover: #5558e8;
  --accent-light: rgba(99,102,241,0.15);
  --accent-border: rgba(99,102,241,0.4);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-light: rgba(239,68,68,0.1);
  --user-bubble: #2563eb;
  --ai-bubble: #1e1e2e;
  --sidebar-width: 280px;
  --header-height: 56px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --transition: 0.2s ease;
}

html, body { height: 100%; overflow: hidden; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg-base); color: var(--text-primary); font-size: 14px; line-height: 1.6; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Loading */
#loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; gap: 16px; }
.loading-logo { width: 80px; height: auto; animation: pulse 2s infinite; }
.loading-text { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.loading-spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%); padding: 20px; }
.login-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 420px; overflow: hidden; box-shadow: var(--shadow); }
.login-header { background: linear-gradient(135deg, #1a1a2e, #16213e); padding: 36px 32px; text-align: center; border-bottom: 1px solid var(--border); }
.login-header .logo-img { width: 160px; height: auto; margin-bottom: 16px; }
.login-header h1 { color: var(--text-primary); font-size: 18px; font-weight: 600; }
.login-header p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-body { padding: 32px; }
.login-error { background: var(--danger-light); border: 1px solid rgba(239,68,68,0.3); color: #f87171; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-input { width: 100%; padding: 10px 14px; background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px; transition: border-color var(--transition); }
.form-input:focus { outline: none; border-color: var(--accent); }
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { width: 100%; padding: 10px 14px; background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px; resize: vertical; min-height: 80px; font-family: inherit; }
.form-textarea:focus { outline: none; border-color: var(--accent); }
.form-select { width: 100%; padding: 10px 14px; background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px; cursor: pointer; }
.form-select:focus { outline: none; border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all var(--transition); white-space: nowrap; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-active); color: var(--text-secondary); }
.btn-secondary:hover:not(:disabled) { background: var(--border-light); color: var(--text-primary); }
.btn-danger { background: var(--danger-light); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.2); }
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 6px 10px; }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon { background: transparent; color: var(--text-secondary); padding: 6px; border-radius: var(--radius-sm); width: 32px; height: 32px; border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-warning { background: rgba(245,158,11,0.1); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.btn-warning:hover:not(:disabled) { background: rgba(245,158,11,0.2); }

/* App Layout */
#app-layout { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar { width: var(--sidebar-width); background: var(--bg-surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden; }
.sidebar-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sidebar-logo-img { height: 28px; width: auto; }
.sidebar-title { font-size: 13px; font-weight: 700; color: var(--text-primary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-new-btn { background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; flex-shrink: 0; transition: background var(--transition); font-weight: 300; line-height: 1; }
.sidebar-new-btn:hover { background: var(--accent-hover); }

.sidebar-search { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.sidebar-search input { width: 100%; padding: 7px 12px; background: var(--bg-base); border: 1px solid var(--border); border-radius: 20px; color: var(--text-primary); font-size: 13px; }
.sidebar-search input:focus { outline: none; border-color: var(--accent); }

.sidebar-nav { padding: 8px; border-bottom: 1px solid var(--border); }
.sidebar-nav-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary); font-size: 13px; font-weight: 500; transition: all var(--transition); }
.sidebar-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-nav-item.active { background: var(--accent-light); color: var(--accent); }
.sidebar-nav-item .nav-icon { font-size: 14px; width: 18px; text-align: center; }

.sidebar-section { flex: 1; overflow-y: auto; padding: 8px; }
.sidebar-section-title { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; padding: 6px 10px 4px; }

.chat-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition); }
.chat-item:hover { background: var(--bg-hover); }
.chat-item.active { background: var(--accent-light); }
.chat-item .chat-icon { font-size: 12px; flex-shrink: 0; color: var(--text-muted); }
.chat-item .chat-info { flex: 1; min-width: 0; }
.chat-item .chat-title { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .chat-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .chat-actions { display: none; gap: 2px; }
.chat-item:hover .chat-actions { display: flex; }

.project-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition); }
.project-item:hover { background: var(--bg-hover); }
.project-item.active { background: var(--accent-light); }
.project-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.project-name { font-size: 13px; color: var(--text-primary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-count { font-size: 11px; color: var(--text-muted); }

.sidebar-footer { padding: 10px 12px; border-top: 1px solid var(--border); }
.user-menu { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition); }
.user-menu:hover { background: var(--bg-hover); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #8b5cf6); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* Main Content */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Chat Header */
.chat-header { height: var(--header-height); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; gap: 12px; background: var(--bg-elevated); flex-shrink: 0; }
.chat-header-title { flex: 1; font-size: 15px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.chat-header-title:hover { color: var(--accent); }
.model-selector { display: flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--bg-active); border: 1px solid var(--border); border-radius: 20px; cursor: pointer; font-size: 12px; color: var(--text-secondary); transition: all var(--transition); }
.model-selector:hover { border-color: var(--accent); color: var(--text-primary); }
.model-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; background: var(--accent-light); border: 1px solid var(--accent-border); border-radius: 12px; font-size: 11px; color: var(--accent); font-weight: 600; }
.provider-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.provider-dot.openai { background: #10a37f; }
.provider-dot.anthropic { background: #d4a27a; }
.provider-dot.google { background: #4285f4; }

/* Welcome Screen */
.welcome-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; text-align: center; }
.welcome-logo { width: 120px; height: auto; margin-bottom: 20px; opacity: 0.9; }
.welcome-title { font-size: 24px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.welcome-desc { font-size: 15px; color: var(--text-secondary); max-width: 400px; margin-bottom: 32px; }
.welcome-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.quick-start-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 600px; margin-top: 24px; }
.quick-start-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; text-align: left; transition: all var(--transition); }
.quick-start-card:hover { border-color: var(--accent); background: var(--accent-light); }
.quick-start-card .qs-provider { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.quick-start-card .qs-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.quick-start-card .qs-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Messages */
.messages-container { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.message { display: flex; gap: 12px; max-width: 100%; }
.message.user { flex-direction: row-reverse; }
.message-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; margin-top: 2px; }
.message.user .message-avatar { background: var(--user-bubble); color: #fff; }
.message.assistant .message-avatar { background: var(--bg-active); color: var(--text-secondary); font-size: 11px; }
.message-content { max-width: 75%; }
.message.user .message-content { align-items: flex-end; display: flex; flex-direction: column; }
.message-bubble { padding: 12px 16px; border-radius: var(--radius-lg); font-size: 14px; line-height: 1.7; }
.message.user .message-bubble { background: var(--user-bubble); color: #fff; border-bottom-right-radius: 4px; }
.message.assistant .message-bubble { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.message-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.message.user .message-meta { justify-content: flex-end; }
.message-actions { display: none; gap: 4px; }
.message:hover .message-actions { display: flex; }

/* Code blocks */
.message-bubble pre { background: #0d1117; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; margin: 10px 0; position: relative; }
.message-bubble code { font-family: 'Fira Code', 'Consolas', monospace; font-size: 13px; }
.message-bubble p:not(:last-child) { margin-bottom: 8px; }
.message-bubble ul, .message-bubble ol { padding-left: 20px; margin: 8px 0; }
.message-bubble h1, .message-bubble h2, .message-bubble h3 { margin: 12px 0 6px; }
.message-bubble table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.message-bubble th, .message-bubble td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.message-bubble th { background: var(--bg-active); }
.code-block-wrapper { position: relative; }
.copy-code-btn { position: absolute; top: 8px; right: 8px; background: var(--bg-active); border: 1px solid var(--border); color: var(--text-secondary); padding: 3px 8px; border-radius: 4px; font-size: 11px; cursor: pointer; }
.copy-code-btn:hover { color: var(--text-primary); }

/* Typing indicator */
.typing-indicator { display: flex; gap: 4px; padding: 12px 16px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); border-bottom-left-radius: 4px; width: fit-content; }
.typing-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); animation: typing 1.2s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,60%,100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-6px); opacity: 1; } }

/* File chips */
.message-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-chip { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--bg-active); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; color: var(--text-secondary); cursor: pointer; transition: all var(--transition); max-width: 200px; }
.file-chip:hover { border-color: var(--accent); color: var(--text-primary); }
.file-chip .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Input Area */
.input-area { padding: 16px; border-top: 1px solid var(--border); background: var(--bg-elevated); flex-shrink: 0; }
.input-files-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.input-file-chip { display: flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--bg-active); border: 1px solid var(--border); border-radius: 20px; font-size: 12px; color: var(--text-secondary); }
.input-file-chip .remove-file { cursor: pointer; color: var(--text-muted); font-size: 14px; }
.input-file-chip .remove-file:hover { color: var(--danger); }
.input-wrapper { display: flex; gap: 10px; align-items: flex-end; background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 12px; transition: border-color var(--transition); }
.input-wrapper:focus-within { border-color: var(--accent); }
.input-wrapper textarea { flex: 1; background: transparent; border: none; color: var(--text-primary); font-size: 14px; resize: none; outline: none; max-height: 200px; min-height: 24px; font-family: inherit; line-height: 1.5; }
.input-wrapper textarea::placeholder { color: var(--text-muted); }
.input-actions { display: flex; gap: 6px; align-items: flex-end; }
.attach-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; font-size: 18px; transition: color var(--transition); }
.attach-btn:hover { color: var(--accent); }
.send-btn { background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; transition: background var(--transition); flex-shrink: 0; }
.send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.input-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding: 0 2px; }
.input-hint { font-size: 11px; color: var(--text-muted); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; backdrop-filter: blur(4px); }
.modal { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal-sm { max-width: 380px; }
.modal-lg { max-width: 720px; }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.modal-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 20px; padding: 2px; transition: color var(--transition); }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; transition: all var(--transition); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:hover:not(.active) { color: var(--text-secondary); }

/* Admin Panel */
.admin-layout { display: flex; height: 100vh; overflow: hidden; }
.admin-sidebar { width: 220px; background: var(--bg-surface); border-right: 1px solid var(--border); padding: 16px 0; flex-shrink: 0; display: flex; flex-direction: column; }
.admin-sidebar-logo { padding: 0 16px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.admin-sidebar-logo img { height: 24px; width: auto; }
.admin-sidebar-title { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; padding: 8px 16px 6px; }
.admin-nav-item { display: flex; align-items: center; gap: 8px; padding: 9px 16px; font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: all var(--transition); }
.admin-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.admin-nav-item.active { background: var(--accent-light); color: var(--accent); }
.admin-content { flex: 1; overflow-y: auto; padding: 28px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.admin-title { font-size: 20px; font-weight: 700; color: var(--text-primary); }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-superadmin { background: rgba(168,85,247,0.15); color: #c084fc; }
.badge-admin { background: rgba(99,102,241,0.15); color: #818cf8; }
.badge-user { background: rgba(148,163,184,0.1); color: #94a3b8; }
.badge-active { background: rgba(34,197,94,0.1); color: #4ade80; }
.badge-inactive { background: rgba(239,68,68,0.1); color: #f87171; }

/* Cards */
.card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.card-value { font-size: 28px; font-weight: 700; color: var(--accent); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* Storage bar */
.storage-bar { height: 6px; background: var(--bg-active); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.storage-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.storage-bar-fill.ok { background: var(--success); }
.storage-bar-fill.warn { background: var(--warning); }
.storage-bar-fill.full { background: var(--danger); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 6px); right: 0; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); min-width: 180px; box-shadow: var(--shadow); z-index: 100; overflow: hidden; }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: 9px 14px; font-size: 13px; color: var(--text-secondary); cursor: pointer; transition: background var(--transition); }
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item.danger { color: #f87171; }
.dropdown-item.danger:hover { background: var(--danger-light); }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 13px; color: var(--text-primary); min-width: 260px; animation: slideIn 0.3s ease; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Context menu */
.context-menu { position: fixed; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); min-width: 180px; box-shadow: var(--shadow); z-index: 500; overflow: hidden; }
.context-menu-item { display: flex; align-items: center; gap: 8px; padding: 9px 14px; font-size: 13px; color: var(--text-secondary); cursor: pointer; transition: background var(--transition); }
.context-menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.context-menu-item.danger { color: #f87171; }
.context-menu-item.danger:hover { background: var(--danger-light); }
.context-menu-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* Empty states */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; text-align: center; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty-state .empty-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state .empty-desc { font-size: 13px; }

/* AI Status Bar */
.ai-status-bar { padding: 8px 20px; background: var(--bg-surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.ai-status-bar.hidden { display: none; }
.ai-status-thinking { display: flex; align-items: center; gap: 10px; }
.ai-status-streaming { display: flex; align-items: center; gap: 10px; }
.ai-status-text { font-size: 12px; color: var(--text-muted); font-style: italic; }
.ai-status-dots { display: flex; gap: 4px; align-items: center; }
.ai-status-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: statusPulse 1.4s infinite; }
.ai-status-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-status-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes statusPulse { 0%,80%,100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }
.ai-status-wave { display: flex; gap: 3px; align-items: center; height: 16px; }
.ai-status-wave span { width: 3px; border-radius: 2px; background: var(--accent); animation: statusWave 1s infinite; }
.ai-status-wave span:nth-child(1) { animation-delay: 0s; }
.ai-status-wave span:nth-child(2) { animation-delay: 0.1s; }
.ai-status-wave span:nth-child(3) { animation-delay: 0.2s; }
.ai-status-wave span:nth-child(4) { animation-delay: 0.3s; }
.ai-status-wave span:nth-child(5) { animation-delay: 0.4s; }
@keyframes statusWave { 0%,100% { height: 4px; } 50% { height: 16px; } }

/* Footer branding */
.app-footer { padding: 8px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: center; gap: 8px; }
.app-footer img { height: 16px; opacity: 0.4; }
.app-footer span { font-size: 11px; color: var(--text-muted); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -100%; top: 0; bottom: 0; z-index: 200; transition: left 0.3s; }
  .sidebar.open { left: 0; }
  .mobile-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 199; display: none; }
  .mobile-overlay.show { display: block; }
  .mobile-menu-btn { display: flex !important; }
  .quick-start-grid { grid-template-columns: 1fr 1fr; }
  .message-content { max-width: 90%; }
}
.mobile-menu-btn { display: none; }

/* Code Viewer */
.cv-table { width: 100%; border-collapse: collapse; font-family: 'Fira Code','Consolas',monospace; font-size: 13px; }
.cv-line-num { color: #4a5568; padding: 2px 16px 2px 12px; text-align: right; user-select: none; border-right: 1px solid #2d2d44; min-width: 40px; vertical-align: top; }
.cv-line-code { color: #e2e8f0; padding: 2px 16px; white-space: pre; }
.cv-table tr:hover .cv-line-num { color: #94a3b8; }
.cv-table tr:hover .cv-line-code { background: rgba(99,102,241,0.05); }

/* Code block header */
.code-block-wrapper { position: relative; margin: 10px 0; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.code-block-header { display: flex; align-items: center; justify-content: space-between; background: #161b22; padding: 6px 12px; border-bottom: 1px solid var(--border); }
.code-lang-badge { font-size: 11px; color: #64748b; font-family: monospace; text-transform: uppercase; letter-spacing: 0.5px; }
.code-block-actions { display: flex; gap: 6px; }
.copy-code-btn { background: var(--bg-active); border: 1px solid var(--border); color: var(--text-secondary); padding: 3px 10px; border-radius: 4px; font-size: 11px; cursor: pointer; transition: all var(--transition); }
.copy-code-btn:hover { color: var(--text-primary); border-color: var(--accent); }
.code-block-wrapper pre { margin: 0; border: none; border-radius: 0; }

/* Compare Mode */
.compare-models-header { display: flex; border-bottom: 1px solid var(--border); background: var(--bg-surface); flex-shrink: 0; }
.compare-model-col-header { flex: 1; padding: 10px 16px; display: flex; align-items: center; gap: 8px; border-right: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text-primary); }
.compare-model-col-header:last-child { border-right: none; }
.compare-model-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.compare-user-row { display: flex; justify-content: flex-end; }
.compare-user-bubble { background: var(--user-bubble); color: #fff; padding: 10px 16px; border-radius: var(--radius-lg); border-bottom-right-radius: 4px; max-width: 70%; font-size: 14px; line-height: 1.6; }
.compare-response-row { display: flex; gap: 12px; }
.compare-response-col { flex: 1; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-width: 0; }
.compare-response-col:hover { border-color: var(--accent); }
.compare-response-content { font-size: 13px; line-height: 1.7; color: var(--text-primary); min-height: 40px; }
.compare-response-meta { display: flex; gap: 10px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-muted); }
.compare-loading { display: flex; justify-content: center; padding: 16px; }

/* Utility */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
