:root {
    --bg: #0a0a0f;
    --bg2: #14141c;
    --bg3: #1e1e2a;
    --bg4: #2a2a3a;
    --border: #2a2a3a;
    --border2: #3a3a4a;
    --text: #e8e8ef;
    --text2: #9a9ab0;
    --text3: #6a6a80;
    --primary: #7c3aed;
    --primary2: #6d28d9;
    --primary3: #8b5cf6;
    --green: #10b981;
    --red: #ef4444;
    --agent: #f59e0b;
    --blue: #3b82f6;
    --pink: #ec4899;
    --radius: 12px;
    --radius2: 16px;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

* { margin:0; padding:0; box-sizing:border-box; font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif; }
body { background: var(--bg); color: var(--text); height:100vh; overflow:hidden; line-height:1.6; }

/* Mobile header */
.mobile-header {
    display:none; position:fixed; top:0; left:0; right:0; height:60px;
    background: var(--bg2); border-bottom:1px solid var(--border);
    align-items:center; justify-content:space-between; padding:0 16px; z-index:100;
}
.menu-toggle, .new-chat-mobile, .close-sidebar, .icon-btn {
    width:40px; height:40px; border-radius:10px; border:1px solid var(--border);
    background: var(--bg3); color:var(--text); display:flex; align-items:center; justify-content:center;
    cursor:pointer; font-size:18px; transition:.2s;
}
.menu-toggle:hover, .icon-btn:hover { border-color: var(--primary); color:var(--primary); }
.logo-mobile { display:flex; align-items:center; gap:8px; font-weight:700; }
.logo-mobile i { color:var(--primary); }

.app { display:flex; height:100vh; padding-top:0; }

/* Sidebar */
.sidebar {
    width: 340px; background: var(--bg2); border-left:1px solid var(--border);
    display:flex; flex-direction:column; overflow:hidden; transition: transform .3s ease;
    z-index:101;
}
.sidebar-header { padding:20px 16px 16px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.logo { display:flex; align-items:center; gap:12px; }
.logo i { font-size:32px; color:var(--primary); background: linear-gradient(135deg, var(--primary), var(--pink)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
.logo-text { font-size:18px; font-weight:800; display:block; line-height:1; }
.logo-sub { font-size:10px; color:var(--text2); font-weight:400; }
.version-badge { background: linear-gradient(135deg, var(--primary), var(--pink)); color:white; font-size:10px; padding:3px 8px; border-radius:20px; font-weight:700; margin-right:auto; }

.new-chat-btn {
    margin:12px; padding:12px 16px; border-radius: var(--radius); border:1px solid var(--border);
    background: var(--bg3); color:var(--text); cursor:pointer; display:flex; align-items:center; gap:10px;
    font-size:13px; font-weight:500; transition: all .2s; position:relative; overflow:hidden;
}
.new-chat-btn::before { content:''; position:absolute; top:0; left:0; right:0; bottom:0; background: linear-gradient(135deg, transparent, rgba(124,58,237,0.1)); opacity:0; transition:.2s; }
.new-chat-btn:hover::before { opacity:1; }
.new-chat-btn:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); }
.new-chat-btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary2)); border-color: var(--primary); color:white; }
.new-chat-btn.agent { border-color: #3a2a00; background: linear-gradient(135deg, #2a2200, #1a1500); color:var(--agent); }
.new-chat-btn.agent:hover { border-color: var(--agent); box-shadow: 0 4px 20px rgba(245,158,11,0.2); }
.new-chat-btn .shortcut { margin-right:auto; font-size:10px; background: var(--bg4); padding:2px 6px; border-radius:6px; color:var(--text2); }
.new-chat-btn .badge { background: var(--agent); color:#000; font-size:10px; padding:2px 8px; border-radius:20px; margin-right:auto; font-weight:700; }

.section-header { display:flex; align-items:center; justify-content:space-between; padding:0 4px; margin-bottom:10px; }
.section-header h4 { font-size:11px; color:var(--text2); font-weight:600; display:flex; align-items:center; gap:6px; text-transform:uppercase; letter-spacing:0.5px; }
.section-header .count { background: var(--bg4); color:var(--text2); font-size:10px; padding:2px 8px; border-radius:20px; }
.icon-btn { width:28px; height:28px; font-size:14px; }
.icon-btn.danger { border-color: #4a1a1f; color:#f87171; }
.icon-btn.danger:hover { background: #2a1215; }

.servers-mini { margin:8px 12px; background: var(--bg3); border:1px solid var(--border); border-radius: var(--radius); padding:12px; }
.servers-list-mini { display:flex; flex-direction:column; gap:6px; max-height:120px; overflow-y:auto; }
.server-mini-item { background: var(--bg2); padding:8px 10px; border-radius:8px; font-size:11px; display:flex; align-items:center; gap:8px; cursor:pointer; border:1px solid transparent; transition:.2s; }
.server-mini-item:hover { border-color: var(--primary); background: var(--bg4); }
.server-mini-item .dot { width:7px; height:7px; border-radius:50%; background: var(--text3); flex-shrink:0; }
.server-mini-item.online .dot { background: var(--green); box-shadow:0 0 8px var(--green); animation: pulse 2s infinite; }
.server-mini-item.offline .dot { background: var(--red); }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }

.chat-history-section { flex:1; margin:12px; overflow:hidden; display:flex; flex-direction:column; min-height:0; }
.history-list { flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:4px; scrollbar-width:thin; }
.history-item { padding:10px 12px; border-radius:10px; font-size:12px; cursor:pointer; background: transparent; border:1px solid transparent; display:flex; align-items:center; gap:10px; transition:.2s; white-space:nowrap; overflow:hidden; }
.history-item:hover { background: var(--bg3); border-color: var(--border); transform: translateX(-2px); }
.history-item.active { background: linear-gradient(135deg, var(--bg3), var(--bg4)); border-color: var(--primary); color:var(--text); box-shadow: 0 2px 10px rgba(124,58,237,0.2); }
.history-item i { font-size:16px; color:var(--text3); flex-shrink:0; }
.history-item.agent i { color: var(--agent); }
.history-item .title { flex:1; overflow:hidden; text-overflow:ellipsis; }

.nav { display:flex; flex-direction:column; gap:4px; margin:12px; padding-top:12px; border-top:1px solid var(--border); }
.nav-item {
    display:flex; align-items:center; gap:12px; padding:12px 14px; border-radius:10px;
    background:transparent; border:1px solid transparent; color: var(--text2); cursor:pointer;
    font-size:13px; font-weight:500; transition: all .2s; text-align:right; position:relative;
}
.nav-item:hover { background: var(--bg3); color: var(--text); transform: translateX(-2px); }
.nav-item.active { background: linear-gradient(135deg, var(--bg3), var(--bg4)); color: var(--text); border-color: var(--border); box-shadow: var(--shadow); }
.nav-item i { font-size:18px; }
.nav-item .badge { margin-right:auto; font-size:9px; padding:3px 8px; border-radius:20px; font-weight:700; }
.badge.pulse { background: var(--agent); color:#000; animation: pulse 2s infinite; }
.badge.new { background: var(--green); color:white; }

.sidebar-bottom { padding:16px 12px; border-top:1px solid var(--border); background: var(--bg2); }
.model-selector label { font-size:11px; color:var(--text2); display:flex; align-items:center; gap:6px; margin-bottom:8px; font-weight:600; }
.free-tag { background: var(--green); color:white; font-size:9px; padding:2px 6px; border-radius:10px; }
.select-wrapper { position:relative; }
.model-selector select {
    width:100%; background: var(--bg3); border:1px solid var(--border); color:var(--text);
    padding:10px 36px 10px 12px; border-radius:10px; font-size:12px; appearance:none; cursor:pointer; transition:.2s;
}
.model-selector select:focus { border-color: var(--primary); outline:none; box-shadow: 0 0 0 3px rgba(124,58,237,0.1); }
.select-arrow { position:absolute; left:12px; top:50%; transform: translateY(-50%); color:var(--text2); pointer-events:none; }
.model-info { background: linear-gradient(135deg, #1a1500, #2a2200); border:1px solid #3a3000; border-radius:8px; padding:8px 10px; margin-top:8px; font-size:10px; color:var(--text2); display:flex; gap:6px; line-height:1.4; }
.model-info i { color:var(--agent); flex-shrink:0; margin-top:1px; }

.user-card { display:flex; align-items:center; gap:10px; margin-top:16px; padding:10px; background: var(--bg3); border:1px solid var(--border); border-radius:10px; }
.user-avatar { width:36px; height:36px; border-radius:10px; background: linear-gradient(135deg, var(--primary), var(--pink)); display:flex; align-items:center; justify-content:center; color:white; font-size:18px; }
.user-info { flex:1; }
.user-name { font-size:12px; font-weight:600; display:block; }
.user-status { font-size:10px; color:var(--text2); display:flex; align-items:center; gap:4px; }
.dot { width:8px; height:8px; border-radius:50%; }
.dot.online { background: var(--green); box-shadow:0 0 8px var(--green); }

.sidebar-overlay { display:none; position:fixed; top:0; left:0; right:0; bottom:0; background: rgba(0,0,0,0.5); z-index:100; backdrop-filter: blur(4px); }

/* Main */
.main { flex:1; display:flex; flex-direction:column; overflow:hidden; background: var(--bg); }
.tab { display:none; flex:1; flex-direction:column; overflow:hidden; animation: fadeIn .3s ease; }
.tab.active { display:flex; }
@keyframes fadeIn { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }

.chat-header { padding:16px 24px; border-bottom:1px solid var(--border); background: var(--bg2); display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px; }
.header-left { display:flex; align-items:center; gap:12px; }
.chat-header h2 { font-size:16px; font-weight:700; display:flex; align-items:center; gap:10px; }
.chat-header h2 i { color:var(--primary); }
.chat-title-badge { background: var(--bg3); border:1px solid var(--border); padding:4px 10px; border-radius:20px; font-size:11px; color:var(--text2); }
.header-right { display:flex; align-items:center; gap:10px; }
.server-select-wrapper { display:flex; align-items:center; gap:8px; background: var(--bg3); border:1px solid var(--border); padding:6px 12px; border-radius:10px; font-size:12px; }
.server-select-wrapper select { background:transparent; border:none; color:var(--text); outline:none; font-size:12px; cursor:pointer; }

.agent-header { background: linear-gradient(135deg, #1a1500 0%, var(--bg2) 50%, #1a1a2e 100%); border-bottom:1px solid #3a3000; flex-direction:column; align-items:flex-start; padding:20px 24px; }
.agent-header h2 { font-size:18px; }
.agent-header p { color:var(--text2); font-size:13px; margin-top:8px; line-height:1.5; }
.agent-examples { display:flex; gap:8px; flex-wrap:wrap; margin-top:16px; }
.example-chip {
    background: var(--bg3); border:1px solid var(--border); color:var(--text2);
    padding:8px 14px; border-radius:20px; font-size:11px; cursor:pointer; transition: all .2s;
    display:flex; align-items:center; gap:6px; font-weight:500;
}
.example-chip:hover { border-color: var(--agent); color: var(--text); background: #2a2200; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245,158,11,0.15); }

.messages { flex:1; overflow-y:auto; padding:20px 24px; display:flex; flex-direction:column; gap:16px; scrollbar-width:thin; scrollbar-color: var(--border) transparent; }

/* Welcome screen */
.welcome-screen { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:40px 20px; max-width:800px; margin:0 auto; }
.welcome-icon { width:80px; height:80px; border-radius:20px; background: linear-gradient(135deg, var(--primary), var(--pink)); display:flex; align-items:center; justify-content:center; font-size:40px; color:white; margin-bottom:20px; box-shadow: 0 10px 30px rgba(124,58,237,0.3); animation: float 3s ease-in-out infinite; }
.welcome-icon.agent { background: linear-gradient(135deg, var(--agent), #f97316); box-shadow: 0 10px 30px rgba(245,158,11,0.3); }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.welcome-screen h1 { font-size:24px; font-weight:800; margin-bottom:12px; background: linear-gradient(135deg, var(--text), var(--text2)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
.welcome-screen p { color:var(--text2); font-size:14px; line-height:1.6; max-width:600px; }
.welcome-cards { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap:12px; width:100%; margin-top:30px; }
.welcome-card { background: var(--bg2); border:1px solid var(--border); border-radius: var(--radius2); padding:20px; cursor:pointer; transition: all .3s; text-align:right; position:relative; overflow:hidden; }
.welcome-card::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; background: linear-gradient(90deg, var(--primary), var(--pink)); transform: scaleX(0); transition:.3s; }
.welcome-card:hover::before { transform: scaleX(1); }
.welcome-card:hover { border-color: var(--primary); transform: translateY(-4px); box-shadow: var(--shadow); background: var(--bg3); }
.welcome-card i { font-size:28px; color:var(--primary); margin-bottom:10px; display:block; }
.welcome-card h4 { font-size:14px; font-weight:600; margin-bottom:6px; }
.welcome-card p { font-size:11px; color:var(--text2); line-height:1.4; }

.free-models-banner { margin-top:24px; background: linear-gradient(135deg, #0f2a1a, #1a3a2a); border:1px solid #1a4d2e; border-radius:12px; padding:12px 16px; display:flex; align-items:center; gap:10px; font-size:12px; color:var(--text2); }
.free-models-banner i { color:var(--green); font-size:18px; }
.free-models-banner b { color:var(--green); }

.thinking-demo { background: var(--bg2); border:1px solid var(--border); border-radius:12px; padding:16px; margin-top:24px; width:100%; max-width:400px; text-align:right; }
.thinking-step { display:flex; align-items:center; gap:10px; padding:8px 0; font-size:12px; color:var(--text2); border-bottom:1px solid var(--border); }
.thinking-step:last-child { border:none; }
.step-dot { width:8px; height:8px; border-radius:50%; background: var(--border); position:relative; }
.step-dot.active { background: var(--green); box-shadow:0 0 8px var(--green); }
.step-dot.active::after { content:''; position:absolute; top:-4px; left:-4px; right:-4px; bottom:-4px; border:1px solid var(--green); border-radius:50%; animation: pulse 1.5s infinite; }

/* Messages */
.message { display:flex; gap:12px; max-width:85%; animation: messageIn .3s ease; }
@keyframes messageIn { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }
.message.user { align-self:flex-end; flex-direction:row-reverse; }
.message .avatar { width:36px; height:36px; border-radius:12px; display:flex; align-items:center; justify-content:center; background: var(--bg3); flex-shrink:0; font-size:18px; border:1px solid var(--border); }
.message.user .avatar { background: linear-gradient(135deg, var(--primary), var(--primary2)); border-color: var(--primary); color:white; }
.agent-avatar { background: linear-gradient(135deg, var(--agent), #f97316) !important; color:#000 !important; border-color: var(--agent) !important; }
.message .content {
    background: var(--bg2); padding:14px 16px; border-radius:16px; font-size:13px; line-height:1.7;
    border:1px solid var(--border); white-space:pre-wrap; word-break:break-word; box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position:relative;
}
.message.user .content { background: linear-gradient(135deg, var(--primary), var(--primary2)); border-color: var(--primary); color:white; border-bottom-left-radius:4px; }
.message.assistant .content { border-bottom-right-radius:4px; }

/* Thinking steps */
.thinking-block { background: #0f172a; border:1px solid #1e293b; border-radius:12px; padding:12px; margin:8px 0; }
.thinking-header { display:flex; align-items:center; gap:8px; font-size:12px; font-weight:600; color:var(--agent); margin-bottom:10px; }
.thinking-header .dots { display:flex; gap:4px; }
.thinking-header .dots span { width:6px; height:6px; border-radius:50%; background: var(--agent); animation: thinking 1.4s infinite; }
.thinking-header .dots span:nth-child(2) { animation-delay:.2s; }
.thinking-header .dots span:nth-child(3) { animation-delay:.4s; }
@keyframes thinking { 0%,60%,100% { transform: translateY(0); opacity:0.4; } 30% { transform: translateY(-6px); opacity:1; } }

.tool-call { background: linear-gradient(135deg, #1e293b, #0f172a); border:1px solid #334155; border-radius:10px; padding:10px 14px; margin:8px 0; font-size:11px; display:flex; align-items:center; gap:10px; animation: toolIn .3s ease; }
@keyframes toolIn { from { opacity:0; transform: translateX(-10px); } to { opacity:1; transform: translateX(0); } }
.tool-call .tool-icon { width:32px; height:32px; border-radius:8px; background: var(--agent); color:#000; display:flex; align-items:center; justify-content:center; font-size:16px; flex-shrink:0; }
.tool-call .tool-info { flex:1; }
.tool-call .tool-name { color: var(--agent); font-weight:700; font-size:12px; display:block; }
.tool-call .tool-desc { color:var(--text2); font-size:10px; margin-top:2px; }
.tool-result { background: #020617; border:1px dashed #334155; border-radius:10px; padding:12px; font-family: 'JetBrains Mono', monospace; font-size:11px; max-height:300px; overflow:auto; white-space:pre-wrap; margin:4px 0 8px 44px; position:relative; }
.tool-result::before { content:'↓ نتیجه'; position:absolute; top:-8px; right:12px; background: var(--bg); border:1px solid var(--border); padding:2px 8px; border-radius:10px; font-size:9px; color:var(--text2); }

/* Input */
.input-area { padding:16px 24px; border-top:1px solid var(--border); background: var(--bg2); }
.input-wrapper { display:flex; gap:10px; align-items:flex-end; background: var(--bg3); border:1px solid var(--border); border-radius:16px; padding:10px 14px; transition: all .2s; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.input-wrapper:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.1), 0 4px 20px rgba(0,0,0,0.15); transform: translateY(-1px); }
.input-wrapper textarea { flex:1; background:transparent; border:none; outline:none; color:var(--text); font-size:14px; resize:none; max-height:120px; min-height:24px; line-height:1.5; }
.agent-input { border-color: #3a2a00; background: linear-gradient(135deg, var(--bg3), #1a1500); }
.agent-input:focus-within { border-color: var(--agent); box-shadow: 0 0 0 3px rgba(245,158,11,0.1); }
.send-btn { background: linear-gradient(135deg, var(--primary), var(--primary2)); border:none; color:white; width:40px; height:40px; border-radius:12px; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:18px; transition: all .2s; flex-shrink:0; box-shadow: 0 4px 12px rgba(124,58,237,0.3); }
.send-btn:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 6px 20px rgba(124,58,237,0.4); }
.send-btn:active { transform: translateY(0) scale(0.95); }
.agent-btn { background: linear-gradient(135deg, var(--agent), #f97316); box-shadow: 0 4px 12px rgba(245,158,11,0.3); }
.agent-btn:hover { box-shadow: 0 6px 20px rgba(245,158,11,0.4); }

.input-footer { display:flex; justify-content:space-between; align-items:center; margin-top:10px; font-size:11px; color:var(--text3); }
.toggle { display:flex; align-items:center; gap:6px; cursor:pointer; font-size:11px; }
.toggle input { accent-color: var(--primary); }

/* Pages */
.page-container { padding:24px; overflow-y:auto; flex:1; max-width:1200px; margin:0 auto; width:100%; }
.page-header { margin-bottom:24px; }
.page-header h2 { font-size:20px; font-weight:800; display:flex; align-items:center; gap:12px; margin-bottom:8px; }
.page-header h2 i { color:var(--primary); }
.page-header p { color:var(--text2); font-size:13px; line-height:1.6; }

.server-form-card { background: var(--bg2); border:1px solid var(--border); border-radius: var(--radius2); padding:24px; margin:20px 0; box-shadow: var(--shadow); }
.form-header { margin-bottom:20px; padding-bottom:16px; border-bottom:1px solid var(--border); }
.form-header h3 { font-size:16px; font-weight:700; display:flex; align-items:center; gap:10px; }
.form-header h3 i { color:var(--primary); }
.form-hint { font-size:11px; color:var(--text2); margin-top:4px; display:block; }
.form-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap:16px; }
.form-group { display:flex; flex-direction:column; gap:6px; }
.form-group.full { grid-column: 1/-1; }
.form-group label { font-size:11px; font-weight:600; color:var(--text2); text-transform:uppercase; letter-spacing:0.5px; }
.form-group input, .form-group textarea, .form-group select {
    background: var(--bg3); border:1px solid var(--border); padding:12px 14px; border-radius:10px;
    color:var(--text); font-size:13px; transition:.2s; outline:none;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.1); }

.btn { padding:10px 18px; border-radius:10px; border:1px solid var(--border); background: var(--bg3); color:var(--text); cursor:pointer; font-size:13px; font-weight:500; display:inline-flex; align-items:center; gap:8px; transition: all .2s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary2)); border-color: var(--primary); color:white; box-shadow: 0 4px 12px rgba(124,58,237,0.3); }
.btn.large { padding:14px 24px; font-size:14px; width:100%; justify-content:center; margin-top:16px; }
.btn.danger { background: #2a1215; border-color: #4a1a1f; color: #f87171; }
.btn.secondary { background: var(--bg2); }

.servers-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap:16px; margin-top:20px; }
.server-card { background: var(--bg2); border:1px solid var(--border); border-radius: var(--radius2); padding:20px; transition: all .3s; position:relative; overflow:hidden; }
.server-card::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; background: linear-gradient(90deg, var(--primary), var(--pink)); transform: scaleX(0); transition:.3s; }
.server-card:hover::before { transform: scaleX(1); }
.server-card:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: var(--shadow); }
.server-card h4 { display:flex; align-items:center; gap:10px; font-size:15px; font-weight:700; }
.server-card .meta { font-size:12px; color:var(--text2); margin:12px 0; line-height:1.6; background: var(--bg3); padding:10px; border-radius:8px; }
.server-card .actions { display:flex; gap:8px; margin-top:14px; }

.projects-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap:16px; margin-top:20px; }
.project-card { background: var(--bg2); border:1px solid var(--border); border-radius: var(--radius2); padding:20px; transition:.3s; }
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.quick-build { margin-top:40px; padding-top:24px; border-top:1px solid var(--border); }
.quick-build h3 { font-size:16px; font-weight:700; display:flex; align-items:center; gap:10px; margin-bottom:16px; }
.build-cards { display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:16px; }
.build-card { background: var(--bg2); border:1px solid var(--border); border-radius: var(--radius2); padding:24px; text-align:center; cursor:pointer; transition: all .3s; position:relative; overflow:hidden; }
.build-card::before { content:''; position:absolute; top:0; left:0; right:0; bottom:0; background: linear-gradient(135deg, transparent, rgba(124,58,237,0.05)); opacity:0; transition:.3s; }
.build-card:hover::before { opacity:1; }
.build-card:hover { border-color: var(--primary); transform: translateY(-4px); box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.build-icon { width:60px; height:60px; border-radius:16px; display:flex; align-items:center; justify-content:center; font-size:28px; margin:0 auto 14px; }
.build-icon.telegram { background: linear-gradient(135deg, #0088cc, #00a8e8); color:white; }
.build-icon.website { background: linear-gradient(135deg, var(--primary), var(--pink)); color:white; }
.build-icon.panel { background: linear-gradient(135deg, var(--green), #059669); color:white; }
.build-card h4 { font-size:14px; font-weight:700; margin-bottom:6px; }
.build-card p { font-size:11px; color:var(--text2); }
.build-arrow { position:absolute; bottom:12px; left:12px; width:24px; height:24px; border-radius:50%; background: var(--bg3); border:1px solid var(--border); display:flex; align-items:center; justify-content:center; font-size:14px; color:var(--text2); transition:.2s; }
.build-card:hover .build-arrow { background: var(--primary); color:white; border-color: var(--primary); transform: translateX(-4px); }

/* RAG */
.upload-area { border:2px dashed var(--border); border-radius: var(--radius2); padding:40px 20px; text-align:center; margin:20px 0; cursor:pointer; transition: all .3s; background: var(--bg2); position:relative; overflow:hidden; }
.upload-area::before { content:''; position:absolute; top:0; left:0; right:0; bottom:0; background: radial-gradient(circle at center, rgba(124,58,237,0.05), transparent 70%); opacity:0; transition:.3s; }
.upload-area:hover::before { opacity:1; }
.upload-area:hover { border-color: var(--primary); background: var(--bg3); transform: translateY(-2px); box-shadow: var(--shadow); }
.upload-icon { width:60px; height:60px; border-radius:16px; background: linear-gradient(135deg, var(--primary), var(--pink)); display:flex; align-items:center; justify-content:center; font-size:28px; color:white; margin:0 auto 16px; }
.upload-area h4 { font-size:16px; font-weight:700; margin-bottom:6px; }
.upload-area p { color:var(--text2); font-size:13px; margin-bottom:8px; }
.upload-area span { background: var(--bg3); border:1px solid var(--border); padding:4px 10px; border-radius:20px; font-size:10px; color:var(--text2); }

.rag-stats { display:grid; grid-template-columns: repeat(2, 1fr); gap:16px; margin:20px 0; }
.stat { background: var(--bg2); border:1px solid var(--border); border-radius: var(--radius); padding:20px; text-align:center; position:relative; overflow:hidden; }
.stat::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; background: linear-gradient(90deg, var(--primary), var(--pink)); }
.stat span { font-size:28px; font-weight:800; display:block; background: linear-gradient(135deg, var(--text), var(--text2)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
.stat label { color:var(--text2); font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; margin-top:4px; display:block; }
.stat i { position:absolute; bottom:10px; left:10px; font-size:20px; color:var(--border); }

.rag-files { display:flex; flex-direction:column; gap:8px; margin-top:16px; }

/* Modal */
.modal { position:fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); display:flex; align-items:center; justify-content:center; z-index:1000; animation: fadeIn .2s ease; }
.modal-content { background: var(--bg2); border:1px solid var(--border); border-radius: var(--radius2); width:90%; max-width:600px; max-height:85vh; overflow:hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.5); animation: modalIn .3s ease; }
@keyframes modalIn { from { opacity:0; transform: scale(0.9) translateY(20px); } to { opacity:1; transform: scale(1) translateY(0); } }
.modal-header { padding:20px 24px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.modal-header h3 { font-size:16px; font-weight:700; }
.close { width:32px; height:32px; border-radius:8px; border:1px solid var(--border); background: var(--bg3); color:var(--text2); display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:18px; transition:.2s; }
.close:hover { background: var(--red); color:white; border-color: var(--red); }
#modalBody { padding:24px; overflow-y:auto; max-height:60vh; }

.empty-state { text-align:center; padding:20px; color:var(--text3); font-size:12px; }
.empty-state.small { padding:10px; font-size:11px; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width:300px; }
    .welcome-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .mobile-header { display:flex; }
    .app { padding-top:60px; height:calc(100vh - 60px); }
    .sidebar {
        position:fixed; top:0; right:0; bottom:0; width:85%; max-width:360px;
        transform: translateX(100%); z-index:102; padding-top:0;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display:block; }
    .sidebar-header { padding-top:20px; }
    .close-sidebar { display:flex !important; }
    .main { width:100%; }
    .chat-header { padding:12px 16px; }
    .messages { padding:16px; }
    .message { max-width:92%; }
    .input-area { padding:12px 16px; }
    .page-container { padding:16px; }
    .form-grid { grid-template-columns: 1fr; }
    .servers-grid, .projects-grid, .build-cards { grid-template-columns: 1fr; }
    .welcome-cards { grid-template-columns: 1fr; }
    .welcome-screen { padding:20px 16px; }
    .welcome-screen h1 { font-size:20px; }
}

@media (max-width: 480px) {
    .agent-examples { flex-direction:column; }
    .example-chip { width:100%; justify-content:center; }
    .input-wrapper { flex-direction:column; align-items:stretch; }
    .server-select-wrapper { width:100%; }
    .send-btn { width:100%; height:44px; }
}
