:root{
  --bg:#f7f7f8;
  --panel:#ececf1;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --brand:#111827;
  --assistant:#ffffff;
  --user:#f4f4f5;
  --system:#fff7ed;
  --radius:14px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;font-family:Inter,Segoe UI,Roboto,Arial,sans-serif;color:var(--text);background:var(--bg)}
a{color:#111827;text-decoration:none}
a:hover{text-decoration:underline}

.layout{display:grid;grid-template-columns:300px 1fr;min-height:100vh}
.sidebar{background:var(--panel);border-right:1px solid var(--line);padding:14px;overflow:auto}
.content{padding:18px;max-width:1100px;width:100%}

.sb-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px}
.sb-head h2{margin:0;font-size:18px}
.logo-link{font-weight:700}

.card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:12px;margin:10px 0}

input,textarea,select{width:100%;padding:10px 12px;border:1px solid #d1d5db;background:#fff;border-radius:12px;margin:6px 0 10px;outline:none;font:inherit;color:var(--text)}
input:focus,textarea:focus,select:focus{border-color:#9ca3af}

button{border:0;border-radius:10px;padding:10px 14px;font-weight:600;cursor:pointer;background:var(--brand);color:#fff}
button.ghost{background:#fff;color:#111827;border:1px solid #d1d5db}
button:hover{opacity:.92}

.sb-link{display:block;padding:10px;border-radius:10px;margin:7px 0;border:1px solid #ddd;background:#fff;line-height:1.25}
.sb-link.active{background:#111827;color:#fff;border-color:#111827}
.sb-link.active .muted{color:#d1d5db}

.muted{color:var(--muted);font-size:12px}
.err{color:#dc2626}

.nav{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:14px}
.nav h1{margin:0;font-size:24px}
.two-col{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.container{max-width:460px;margin:34px auto;padding:0 16px}
.small{max-width:460px}

/* ChatGPT-like chat surface */
.chat-layout .content{display:flex;flex-direction:column;max-width:none;padding:0}
.chat-shell{height:100vh;background:#fff}
.chat-topbar{height:56px;display:flex;align-items:center;padding:0 24px;border-bottom:1px solid var(--line);position:sticky;top:0;background:#fff;z-index:10}
.chat-topbar h1{font-size:18px;margin:0}
.chat-stream{padding:20px 22px 130px;overflow:auto;max-width:900px;width:100%;margin:0 auto}
.msg{border:1px solid var(--line);border-radius:14px;padding:12px 14px;margin:10px 0;max-width:92%;white-space:pre-wrap;line-height:1.45}
.msg.assistant{background:var(--assistant);margin-right:auto}
.msg.user{background:var(--user);margin-left:auto}
.msg.system{background:var(--system);margin-right:auto}
.msg-body{margin-top:4px}

.composer-wrap{position:fixed;bottom:0;left:300px;right:0;padding:14px 24px;background:linear-gradient(to top,#fff 70%,rgba(255,255,255,.6));border-top:1px solid var(--line)}
.composer{max-width:900px;margin:0 auto;display:flex;gap:10px;align-items:flex-end}
.composer-main{flex:1;display:flex;flex-direction:column;gap:6px}
.composer textarea{margin:0;min-height:56px;max-height:180px}
.composer-tools{display:flex;gap:8px}
.file-btn{display:inline-flex;align-items:center;gap:6px;padding:8px 10px;border:1px solid #d1d5db;border-radius:10px;background:#fff;color:#111827;font-size:13px;cursor:pointer}
.file-btn input{display:none}
.composer button{height:42px;white-space:nowrap}

@media (max-width: 980px){
  .layout{grid-template-columns:1fr}
  .sidebar{border-right:0;border-bottom:1px solid var(--line)}
  .chat-layout .content{height:auto}
  .chat-shell{height:auto}
  .composer-wrap{position:static;left:auto;right:auto}
  .two-col{grid-template-columns:1fr}
}
