/* Same palette as the live site (public/style.css): indigo → violet brand, teal "good", amber highlights. */
:root {
  --bg: #f6f7fc;
  --bg-2: #ebe8ff;
  --surface: #ffffff;
  --surface-2: #f7f8fd;
  --ink: #151a2d;
  --muted: #5b6478;
  --line: #e4e6f1;
  --brand: #4338ca;
  --brand-2: #7c3aed;
  --teal: #0d9488;
  --gold: #f59e0b;
  --gold-soft: #fff4dc;
  --gold-ink: #92400e;
  --mint: #ddf6f2;
  --red: #dc2626;
  --violet-soft: #f1ecff;
  --bubble-me: linear-gradient(135deg, #6366f1, #7c3aed);
  --shadow: 0 1px 2px rgba(30, 27, 75, .05), 0 8px 24px rgba(30, 27, 75, .07);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f1e; --bg-2: #1b1546; --surface: #131a2e; --surface-2: #19213a; --ink: #e9ebf7; --muted: #9ba4bf;
    --line: #262f4a; --teal: #2dd4bf; --gold: #fbbf24; --gold-soft: #2b2312; --gold-ink: #fde68a; --mint: #0f2b2b;
    --red: #f87171; --violet-soft: #221a45; --shadow: none;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; color: var(--ink); min-height: 100vh;
  background: radial-gradient(900px 420px at 90% -5%, var(--bg-2), transparent 65%), radial-gradient(700px 380px at -10% 110%, var(--mint), transparent 60%), var(--bg);
  background-attachment: fixed;
  font: 16.5px/1.6 Rubik, system-ui, sans-serif;
}
a { color: var(--brand-2); }
@media (prefers-color-scheme: dark) { a { color: #a78bfa; } }
.wrap { max-width: 860px; margin: 0 auto; padding-inline: 16px; }
.muted { color: var(--muted); font-size: 14.5px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* header */
.app-head { position: relative; overflow: hidden; color: #fff; background: linear-gradient(115deg, #4f46e5 0%, #7c3aed 55%, #a21caf 100%); }
.bg-pattern {
  position: absolute; inset: -40% -10%; filter: blur(8px); animation: aurora 18s ease-in-out infinite alternate;
  background: radial-gradient(260px 160px at 15% 35%, rgba(45, 212, 191, .45), transparent 70%), radial-gradient(300px 180px at 80% 70%, rgba(251, 191, 36, .35), transparent 70%);
}
@keyframes aurora { to { transform: translate3d(-60px, 18px, 0) scale(1.08); } }
.head-inner { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 46px; height: 46px; flex: none; filter: drop-shadow(0 6px 14px rgba(30, 10, 80, .35)); }
.brand-name { display: block; font-size: 25px; font-weight: 800; line-height: 1.15; }
.brand-sub { display: block; font-size: 14px; opacity: .9; }
.beta { font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, .2); border-radius: 999px; padding: 2px 9px; vertical-align: middle; }

/* buttons */
.btn { font: inherit; font-weight: 600; border-radius: 999px; cursor: pointer; border: 1.5px solid var(--teal); background: var(--surface); color: var(--teal); padding: 9px 18px; transition: transform .12s, box-shadow .2s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: var(--bubble-me); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(99, 102, 241, .28); }
.btn.ghost { border-color: var(--line); color: var(--ink); }
.btn.sm { padding: 5px 13px; font-size: 14px; }
.btn.ghost-light { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .4); white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }

/* chat */
.chat-main { padding-block: 16px 12px; display: flex; flex-direction: column; min-height: calc(100vh - 80px); }
.log { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; animation: rise .3s both; }
.msg.me { justify-content: flex-start; }
.msg.bot { justify-content: flex-end; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.bubble { max-width: min(640px, 92%); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--bubble-me); color: #fff; border-start-start-radius: 6px; }
.msg.bot .bubble { background: var(--surface); border: 1px solid var(--line); border-start-end-radius: 6px; }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 4px 0 8px; padding-inline-start: 20px; }
.bubble li { margin-bottom: 3px; }
.bubble .warn { background: var(--gold-soft); color: var(--gold-ink); border-radius: 10px; padding: 7px 10px; font-size: 14.5px; }
.cite { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 4px; margin-inline: 1px; border-radius: 6px; background: var(--violet-soft); color: var(--brand-2); font-size: 12px; font-weight: 700; text-decoration: none; vertical-align: 2px; }
.cite:hover { background: var(--brand-2); color: #fff; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.src { display: inline-flex; gap: 6px; align-items: baseline; max-width: 100%; text-decoration: none; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 13px; }
.src:hover { border-color: var(--teal); background: var(--mint); }
.src b { color: var(--brand-2); }
.src span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.src small { color: var(--muted); white-space: nowrap; }
.meta { margin-top: 6px; font-size: 12px; color: var(--muted); }
.notice { align-self: center; font-size: 13.5px; color: var(--gold-ink); background: var(--gold-soft); border-radius: 999px; padding: 4px 12px; }

.doc-card { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 8px 12px; margin-top: 6px; font-size: 14.5px; }
.doc-card li { margin: 0; }

.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.chip { font: inherit; font-size: 14.5px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); padding: 7px 14px; border-radius: 999px; cursor: pointer; text-align: start; }
.chip:hover { border-color: var(--teal); background: var(--mint); }

.status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14.5px; margin: 10px 4px 0; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-2); animation: blink 1.2s infinite both; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.composer { position: sticky; bottom: 0; display: flex; align-items: flex-end; gap: 8px; margin-top: 12px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.composer textarea { flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; max-height: 160px; padding: 8px 4px; }
.attach { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 20px; flex: none; }
.attach:hover { background: var(--mint); }
.foot { text-align: center; margin: 10px 0 4px; font-size: 12.5px; }

@media (max-width: 520px) {
  .brand-name { font-size: 21px; }
  .brand-sub { font-size: 12.5px; }
  .brand-logo { width: 38px; height: 38px; }
  .src span { max-width: 170px; }
  .composer { border-radius: 18px; padding: 8px; }
  .composer .btn { padding: 8px 13px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; } }
