/* Minimal ChatGPT-like UI (RTL, Persian) */
:root{
  --bg:#0f1115; --panel:#151922; --muted:#9aa4b2; --text:#e7ecf3; --brand:#6c5ce7; --accent:#4dd0e1; --border:#232838;
}
*{box-sizing:border-box}
html,body,#app{height:100%}
body{margin:0;background:var(--bg);color:var(--text);font-family:"Vazirmatn",system-ui,Segoe UI,Roboto}
#app{display:grid;grid-template-columns:280px 1fr}

/* Sidebar */
.sidebar{background:linear-gradient(180deg,#121522,#0f1115);border-inline-end:1px solid var(--border);display:flex;flex-direction:column;gap:12px;padding:16px}
.brand{display:flex;gap:12px;align-items:center;margin-bottom:8px}
.brand img{width:36px;height:36px}
.brand h1{margin:0;font-size:18px;line-height:1}
.brand small{color:var(--muted)}
.history{flex:1;overflow:auto;display:flex;flex-direction:column;gap:8px;margin-top:8px}
.history .item{padding:10px;border:1px solid var(--border);border-radius:14px;background:#0f121a;cursor:pointer}
.history .item.active{border-color:var(--accent);box-shadow:0 0 0 2px rgba(77,208,225,.15) inset}
.sidebar-footer{display:flex;gap:8px;margin-top:8px}

/* Main */
.main{display:grid;grid-template-rows:auto 1fr auto;min-width:0}
.topbar{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid var(--border);background:var(--panel);position:sticky;top:0}
.topbar-title{font-weight:700}
.badge{padding:6px 10px;border:1px solid var(--border);border-radius:999px;font-size:12px;color:var(--muted)}

.chat{padding:20px;overflow:auto;display:flex;flex-direction:column;gap:14px}
.msg{display:grid;grid-template-columns:36px 1fr;gap:10px;align-items:flex-start}
.avatar{width:36px;height:36px;border-radius:10px;background:linear-gradient(135deg,var(--brand),var(--accent));display:flex;align-items:center;justify-content:center;font-weight:800}
.msg.user .avatar{background:#263043}
.bubble{background:#0f121a;border:1px solid var(--border);padding:12px 14px;border-radius:16px}
.msg.user .bubble{background:#131828}
.bubble p{margin:0;line-height:1.8}

/* Composer */
.composer{border-top:1px solid var(--border);background:linear-gradient(180deg,rgba(108,92,231,.04),transparent);padding:12px 16px;position:sticky;bottom:0}
.input-wrap{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:end}
textarea{width:100%;resize:none;max-height:180px;min-height:46px;padding:12px 14px;border-radius:16px;border:1px solid var(--border);background:#0f1218;color:var(--text);outline:none}
button{cursor:pointer;border:1px solid var(--border);background:#0f1218;color:var(--text);padding:10px 14px;border-radius:14px}
button.primary{background:linear-gradient(135deg,var(--brand),var(--accent));border:none;font-weight:700}
button.ghost{background:transparent}
.hints{color:var(--muted);font-size:12px;margin-top:6px}

.light{--bg:#f6f7fb;--panel:#fff;--muted:#637083;--text:#0b1220;--border:#e5e9f2}
.light .msg .bubble{background:#fff}
.light .msg.user .bubble{background:#f3f6fb}
