/* Improved UI (still no build step) */
:root{
  --bg:#070a14;
  --panel:#0e1430;
  --panel2:#0b1128;
  --text:#f3f6ff;
  --muted:#b8c3ff;
  --border:rgba(243,246,255,0.12);
  --shadow: 0 18px 60px rgba(0,0,0,.45);
  --radius:22px;

  --a1:#7aa2ff;
  --a2:#9bffd1;
  --a3:#ffb86b;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  font-family:var(--sans);
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(122,162,255,.35), transparent 60%),
    radial-gradient(900px 520px at 90% -5%, rgba(155,255,209,.18), transparent 65%),
    radial-gradient(850px 520px at 65% 110%, rgba(255,184,107,.11), transparent 60%),
    var(--bg);
}

.topbar{
  position:sticky; top:0;
  z-index:10;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 18px;
  background: rgba(7,10,20,.68);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand{display:flex; gap:12px; align-items:center}
.logo{
  width:44px; height:44px;
  display:grid; place-items:center;
  border-radius:16px;
  background: linear-gradient(135deg, rgba(122,162,255,.25), rgba(155,255,209,.12));
  border:1px solid var(--border);
  box-shadow: var(--shadow);
  font-size:20px;
}
.title{font-weight:780; letter-spacing:.2px}
.subtitle{font-size:13px; color:var(--muted); margin-top:2px}
.actions{display:flex; gap:10px}

.layout{
  display:grid;
  grid-template-columns: 1.45fr .95fr;
  gap:16px;
  padding:16px;
  max-width: 1160px;
  margin:0 auto;
}

.card{
  background: linear-gradient(180deg, rgba(14,20,48,.92), rgba(11,17,40,.92));
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.chat{display:flex; flex-direction:column; min-height: calc(100vh - 110px)}
.chatHeader{
  padding:14px 16px;
  border-bottom:1px solid rgba(243,246,255,0.08);
  background: rgba(11,17,40,.55);
}
.chatHeaderTitle{font-weight:720}
.chatHeaderSub{color:var(--muted); font-size:13px; margin-top:3px}

.chatLog{
  padding:16px;
  overflow:auto;
  flex:1;
}

.msg{
  display:flex;
  margin: 12px 0;
  gap:10px;
  align-items:flex-end;
}
.msg.user{justify-content:flex-end}
.bubble{
  max-width:min(680px, 92%);
  padding:12px 14px;
  border-radius: 18px;
  border:1px solid var(--border);
  line-height:1.38;
  white-space: pre-wrap;
}
.msg.user .bubble{
  background: linear-gradient(135deg, rgba(122,162,255,.22), rgba(155,255,209,.10));
  border-color: rgba(122,162,255,.35);
}
.msg.bot .bubble{
  background: rgba(243,246,255,.06);
}
.avatar{
  width:34px; height:34px;
  display:grid; place-items:center;
  border-radius: 14px;
  border:1px solid var(--border);
  background: rgba(243,246,255,.05);
  flex: 0 0 auto;
}

.composer{
  display:flex;
  gap:10px;
  padding:12px;
  border-top:1px solid rgba(243,246,255,0.10);
  background: rgba(11,17,40,.7);
}
.composer input{
  flex:1;
  border:1px solid var(--border);
  background: rgba(243,246,255,.05);
  color: var(--text);
  border-radius: 16px;
  padding:12px 12px;
  outline:none;
}
.composer input:focus{border-color: rgba(122,162,255,.55)}
.sendBtn{
  width:46px; height:46px;
  display:grid; place-items:center;
  border-radius: 16px;
  border:1px solid rgba(122,162,255,.45);
  background: rgba(122,162,255,.22);
}
.sendBtn:hover{filter: brightness(1.08)}
.sendIcon{font-size:16px; transform: translateX(1px)}

button{
  border:1px solid var(--border);
  background: rgba(243,246,255,.06);
  color:var(--text);
  border-radius: 16px;
  padding: 10px 12px;
  cursor:pointer;
}
button.primary{
  background: rgba(122,162,255,.22);
  border-color: rgba(122,162,255,.45);
}
button.ghost{background: transparent}
button:hover{filter: brightness(1.08)}

.chipRow{
  display:flex;
  gap:10px;
  padding:12px 14px 0;
  flex-wrap:wrap;
}
.chip{
  font-size:13px;
  padding:8px 10px;
  border-radius: 999px;
  border:1px solid rgba(243,246,255,0.12);
  background: rgba(243,246,255,0.05);
  cursor:pointer;
}
.chip:hover{filter: brightness(1.08)}
code{font-family: var(--mono); font-size: 12px; color: #d6dcff}

.sidebar{display:flex; flex-direction:column}
.sideHead{padding:14px 16px 8px}
.sidebar h2{margin:0 0 6px 0}
.muted{color:var(--muted); font-size:13px; line-height:1.35}

.searchRow{margin:10px 0 0}
.searchRow input{
  width:100%;
  border:1px solid var(--border);
  background: rgba(243,246,255,.05);
  color: var(--text);
  border-radius: 16px;
  padding:10px 12px;
  outline:none;
}

.kbList{
  padding: 10px 12px 12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  overflow:auto;
}
.kbItem{
  padding:12px 12px;
  border-radius: 18px;
  border:1px solid rgba(243,246,255,0.12);
  background: rgba(243,246,255,.04);
  cursor:pointer;
}
.kbItem:hover{filter: brightness(1.06)}
.kbItem .k{font-weight:720}
.kbItem .t{color: var(--muted); font-size: 12px; margin-top:4px}
.kbItem .ex{color: rgba(243,246,255,0.86); font-size: 12px; margin-top:8px}
.divider{height:1px; background: rgba(243,246,255,0.10); margin: 0 16px 12px}

.notice{padding: 0 16px 16px}
.noticeTitle{font-weight:750; margin-bottom:6px}
.noticeText{color: var(--muted); font-size:13px; line-height:1.35}

dialog{
  width:min(760px, 94vw);
  border:1px solid var(--border);
  border-radius: 20px;
  background: rgba(14,20,48,.98);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 16px 16px 12px;
}
dialog::backdrop{background: rgba(0,0,0,.55)}
dialog h2{margin:0 0 8px 0}
dialog ul{margin: 10px 0 14px 18px; color: var(--muted)}
.row{display:flex; justify-content:flex-end; margin-top: 10px}

.examplesGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:10px;
  margin-top: 10px;
}
.exampleCard{
  padding:12px 12px;
  border-radius: 18px;
  border:1px solid rgba(243,246,255,0.12);
  background: rgba(243,246,255,.04);
  cursor:pointer;
}
.exampleCard:hover{filter: brightness(1.06)}
.exampleCard .q{font-weight:650}
.exampleCard .m{color:var(--muted); font-size:12px; margin-top:4px}

@media (max-width: 980px){
  .layout{grid-template-columns:1fr}
  .chat{min-height: 62vh}
  .kbList{max-height: 34vh}
  .examplesGrid{grid-template-columns:1fr}
}
