:root{
  --bg: #0b0f17;
  --card: #101827;
  --card2:#0f172a;
  --border: rgba(255,255,255,0.08);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.65);
  --accent: #3b82f6;

  --bubbleUser: #2563eb;
  --bubbleBot: #111c33;

  --shadow: 0 12px 30px rgba(0,0,0,0.35);
  --radius: 18px;
  --radius2: 22px;
  font-synthesis-weight: none;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: radial-gradient(1200px 700px at 20% 0%, #13203b 0%, var(--bg) 50%, #070a10 100%);
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

.topbar{
  position: sticky; top:0;
  z-index:10;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 18px;
  border-bottom:1px solid var(--border);
  backdrop-filter: blur(10px);
  background: rgba(7,10,16,0.55);
}
.brand{ font-weight:700; letter-spacing:0.3px; }
.nav a{
  color:var(--muted);
  text-decoration:none;
  margin-left:14px;
  padding:6px 10px;
  border-radius:10px;
}
.nav a.active{
  color:var(--text);
  background: rgba(255,255,255,0.06);
}

.wrap{
  max-width: 980px;
  margin: 18px auto;
  padding: 0 14px 22px;
  display: grid;
  gap: 14px;
}

.filtersCard, .chatCard{
  background: rgba(16,24,39,0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
}

.filtersCard{ padding: 12px 12px; }
.filtersHeader{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}
.filterBtn{
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
}
.filterBtn:hover{ background: rgba(255,255,255,0.06); }
.filtersSummary{
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 65%;
}

.filtersPanel{
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.hidden{ display:none; }

.filterGrid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.filterLabel{
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
select{
  width:100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  outline:none;
}
.hint{
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.45);
}

.chatCard{
  display:flex;
  flex-direction:column;
  height: min(72vh, 720px);
  overflow:hidden;
}

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

.msg{
  display:flex;
  margin: 10px 0;
}
.msg.user{ justify-content:flex-end; }
.msg.assistant{ justify-content:flex-start; }

.bubble{
  max-width: 78%;
  padding: 12px 12px;
  border-radius: var(--radius);
  line-height: 1.35;
  border: 1px solid rgba(255,255,255,0.06);
  background: var(--bubbleBot);
  box-shadow: 0 6px 14px rgba(0,0,0,0.18);
  white-space: pre-wrap;
}
.msg.user .bubble{
  background: linear-gradient(180deg, #2b6cff 0%, #1e57df 100%);
  border: 1px solid rgba(255,255,255,0.12);
}

.metaLine{
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
}

.sources{
  margin-top: 10px;
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
}
.sourceBtn{
  display:inline-flex;
  gap:8px;
  align-items:center;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  text-decoration:none;
  font-size: 13px;
}
.sourceBtn:hover{ background: rgba(255,255,255,0.07); }

.evidence{
  margin-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 10px;
}
.evidence details{
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
}
.evidence summary{
  cursor:pointer;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
}
.evidence pre{
  margin: 10px 0 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  color: rgba(255,255,255,0.85);
}

.composer{
  display:flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: rgba(15,23,42,0.92);
}
.composer input{
  flex:1;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  outline:none;
}
.composer button{
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(59,130,246,0.9);
  color: white;
  cursor:pointer;
  font-weight: 600;
}
.composer button:disabled{
  opacity:0.6;
  cursor:not-allowed;
}

.mono{ font-family: ui-monospace, Menlo, Consolas, monospace; }
