:root{
  --bg:#f8fafc;
  --muted:#6b7280;
  --indigo:#4f46e5;
  --white:#ffffff;
  --panel:#f3f4f6;
  --text:#111827;
}

*{box-sizing:border-box}
html,body,#app{height:100%;margin:0;font-family:Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial}
.app-root{background:var(--bg); color:var(--text)}
.container{display:flex;height:100vh;overflow:hidden}

.sidebar{
  width:320px;
  background:var(--white);
  border-right:1px solid #e6e6e6;
  display:flex;
  flex-direction:column;
  transition:transform .22s ease;
}
.sidebar.hidden{transform:translateX(-100%)}
.sidebar-header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;background:var(--indigo);color:white}
.sidebar-header .title{display:flex;gap:10px;align-items:center}
.sidebar-header h2{font-size:16px;margin:0}
.icon-btn{background:none;border:0;color:inherit;padding:6px 8px;border-radius:6px;cursor:pointer}
.icon-btn:hover{background:rgba(255,255,255,0.06)}

.sidebar-body{padding:16px;overflow:auto;flex:1}
.hint{font-size:13px;color:var(--muted);margin:0 0 12px}
.topics{display:flex;flex-direction:column;gap:8px}
.topic-btn{background:transparent;border:0;padding:10px 12px;border-radius:10px;text-align:left;cursor:pointer;color:var(--text);font-size:14px}
.topic-btn:hover{background:#eef2ff}
.quick-actions{margin-top:18px;border-top:1px solid #eef2f5;padding-top:12px}
.quick-actions h3{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:0.06em;margin:0 0 8px}
.full-btn{display:block;width:100%;padding:10px 12px;border-radius:8px;border:1px solid #e5e7eb;background:white;cursor:pointer}

.main{flex:1;display:flex;flex-direction:column;min-width:0}
.main-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:white;border-bottom:1px solid #e6e6e6}
.left{display:flex;align-items:center;gap:18px}
.main-header h1{font-size:26.5px;margin:0}
.chat-area{flex:1;display:flex;flex-direction:column;position:relative;height:calc(100vh-60px);}
.overlay{position:absolute;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.18)}
.overlay.hidden{display:none}
.loader-card{background:rgba(255,255,255,0.95);padding:14px 18px;border-radius:12px;display:flex;gap:12px;align-items:center;box-shadow:0 6px 20px rgba(0,0,0,0.08)}
.spinner{width:28px;height:28px;border-radius:50%;border:4px solid #e5e7eb;border-top-color:#374151;animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.loader-text{font-size:14px;font-weight:600;color:#111827}

.messages {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 140px);
  padding: 18px 20px;
  background: linear-gradient(to bottom, #fff, #f3f4f6);
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  background: rgba(107, 114, 128, 0.3);
  border-radius: 3px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 114, 128, 0.5);
}

.empty{color:var(--muted);text-align:center;margin-top:18px}
.msg-row{display:flex}
.msg-row.right{justify-content:flex-end}
.msg-bubble{max-width:80%;padding:10px 14px;border-radius:16px;box-shadow:0 1px 0 rgba(0,0,0,0.03);word-break:break-word}
.msg-user{background:var(--indigo);color:white;border-bottom-right-radius:4px}
.msg-assistant{background:#e5e7eb;color:var(--text);border-bottom-left-radius:4px}
.msg-system{background:#e5e7eb;color:var(--muted);font-style:italic;border-radius:12px}

.composer{display:flex;gap:10px;padding:12px;border-top:1px solid #e6e6e6;background:var(--white);align-items:flex-end}
#input{flex:1;padding:10px 12px;border-radius:12px;border:1px solid #e6e6e6;min-height:38px;max-height:160px;resize:none;outline:none;font-size:14px}
#input:focus{box-shadow:0 0 0 3px rgba(79,70,229,0.12);border-color:rgba(79,70,229,0.5)}
.send-btn{display:inline-flex;align-items:center;gap:8px;background:var(--indigo);color:white;padding:8px 14px;border:0;border-radius:12px;cursor:pointer}
.send-btn:disabled{opacity:.6;pointer-events:none}
.send-text.hidden{display:none}

@media (max-width: 900px){
  .sidebar{position:fixed;left:0;top:0;bottom:0;z-index:50;transform:translateX(-100%)}
  .sidebar.open{transform:translateX(0)}
  .container{position:relative}
}