:root {
    --bg: #0b1220;
    --panel: #131a2a;
    --muted: #8ea0c8;
    --accent: #6ee7b7;
    --accent2: #60a5fa;
    --text: #e5ecff;
    --danger: #fca5a5;
    --shadow: 0 12px 22px rgba(0,0,0,.35);
    --radius: 18px;
  }
  * { box-sizing: border-box; }
  html, body { height: 100%;  color: var(--text); font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; margin: 0; }
  
  .chat-launcher {
    position: fixed; right: 22px; bottom: 22px;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    color: #00111a; font-weight: 700; padding: 12px 16px; border-radius: 999px; cursor: pointer;
    box-shadow: var(--shadow);
  }
  
  .chat-widget {
    position: fixed; right: 22px; bottom: 22px; width: 380px; height: 560px;
    background: var(--panel); border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius);
    display: flex; flex-direction: column; box-shadow: var(--shadow);
  }
  .hidden { display: none; }
  
  .chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
    background: linear-gradient(180deg, rgba(255,255,255,.04), transparent);
  }
  .chat-header .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
  .chat-header .icon { background: transparent; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
  
  .chat-body {
    flex: 1; padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  }
  
  .msg { display: grid; gap: 6px; }
  .msg.me { justify-items: end; }
  .bubble {
    max-width: 86%;
    padding: 10px 12px;
    border-radius: 14px;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,.06);
    white-space: normal;   /* instead of pre-wrap */
    line-height: 1.5;      /* keep it readable */
  }
  
  .msg.me .bubble { background: #1e293b; }
  .msg .meta { color: var(--muted); font-size: 12px; }
  
  .sources { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
  .src-chip { color: #00111a; background: var(--accent); padding: 3px 8px; border-radius: 999px; font-size: 12px; text-decoration: none; }
  .src-chip:hover { filter: brightness(.95); }
  
  .chat-footer {
    padding: 10px; display: grid; grid-template-columns: 1fr auto; gap: 8px;
    border-top: 1px solid rgba(255,255,255,.06);
  }
  .chat-footer input {
    background: #0f172a; color: var(--text); border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px; padding: 12px 12px; outline: none;
  }
  .chat-footer button {
    background: linear-gradient(135deg, var(--accent2), var(--accent)); color: #00111a;
    border: none; padding: 0 16px; border-radius: 12px; font-weight: 700; cursor: pointer;
  }
  
  .latency { color: var(--muted); font-size: 11px; padding: 6px 12px 12px; }
  .spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
  @keyframes spin { to { transform: rotate(360deg); } }
  
  @media (max-width: 480px) {
    .chat-widget { right: 10px; bottom: 10px; width: calc(100% - 20px); height: 68vh; }
  }

  /* Make HTML inside chat bubbles pretty */
.bubble h1, .bubble h2, .bubble h3 { 
    margin: 6px 0 6px; 
    font-weight: 800; 
    line-height: 1.25;
  }
.bubble h1 { font-size: 20px; }
.bubble h2 { font-size: 18px; }
.bubble h3 { font-size: 16px; }

.bubble p {
margin: 4px 0;   /* compact vertical rhythm */
}
.bubble p:first-child {
margin-top: 0;   /* no top gap */
}
.bubble p:last-child {
margin-bottom: 0; /* no bottom gap */
}
.bubble li {
margin: 2px 0;   /* compact bullets */
}
  
.bubble ul, .bubble ol {
margin: 4px 0 4px 16px;
padding: 0;
}

/* Quick suggestions (chips) inside assistant bubble */
.sugg-title {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
  }
  
  .sugg {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .sugg-chip {
    border: 0;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    color: #00111a;
  }
  
  .sugg-chip:hover {
    filter: brightness(.95);
  }
  

/* Optional: style links shown in answers */
.bubble a { color: var(--accent2); text-decoration: underline; }
.bubble a:hover { filter: brightness(.95); }
  
  