:root {
  --bg: #060810;
  --panel: rgba(13, 16, 29, .91);
  --panel-2: #111629;
  --border: rgba(164, 176, 255, .16);
  --text: #eef1ff;
  --muted: #98a0bd;
  --accent: #8e7dff;
  --accent-2: #c38cff;
  --user: #242a49;
  --shadow: 0 30px 90px rgba(0, 0, 0, .45);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(91, 71, 175, .18), transparent 32%),
    radial-gradient(circle at 85% 25%, rgba(133, 75, 179, .12), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}
.stars {
  position: fixed; inset: 0; pointer-events: none; opacity: .34;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.7) 1px, transparent 1.2px),
    radial-gradient(circle, rgba(174,157,255,.65) 1px, transparent 1.2px);
  background-size: 83px 83px, 137px 137px;
  background-position: 12px 19px, 47px 81px;
}
.shell { height: 100%; max-width: 1180px; margin: auto; padding: 26px; display: grid; grid-template-rows: auto 1fr; gap: 18px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 13px; }
h1 { margin: 0; font-size: 19px; letter-spacing: .2px; }
.brand p, .debug-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.status-wrap { display: flex; align-items: center; gap: 8px; }
.badge { padding: 8px 10px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,.035); color: #cbd0e8; font-size: 12px; }
.badge.ai { color: #dbd7ff; border-color: rgba(142,125,255,.35); background: rgba(142,125,255,.08); }
.badge.demo { color: #f0d7a8; border-color: rgba(235,181,96,.25); background: rgba(235,181,96,.07); }
.ghost { border: 1px solid var(--border); background: rgba(255,255,255,.025); color: var(--muted); border-radius: 10px; padding: 8px 11px; cursor: pointer; }
.ghost:hover { color: var(--text); border-color: rgba(142,125,255,.35); }
.chat-card { min-height: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); backdrop-filter: blur(18px); display: grid; grid-template-rows: 1fr auto auto; overflow: hidden; }
.messages { overflow-y: auto; padding: 26px 26px 10px; scroll-behavior: smooth; }
.message { display: flex; gap: 12px; margin: 0 auto 20px; max-width: 850px; align-items: flex-start; }
.message.user { justify-content: flex-end; }
.message.user .bubble { background: var(--user); border-color: rgba(151,161,223,.18); max-width: 74%; }
.bubble { border: 1px solid var(--border); background: rgba(255,255,255,.025); border-radius: 16px; padding: 13px 15px; line-height: 1.58; font-size: 14px; max-width: 78%; white-space: pre-wrap; }
.bubble strong { display: block; margin-bottom: 5px; font-size: 13px; color: #d9d5ff; }
.bubble p { margin: 0; }
.avatar { width: 34px !important; height: 34px !important; flex: 0 0 34px; }
.orb { position: relative; width: 42px; height: 42px; border-radius: 50%; background: radial-gradient(circle at 34% 28%, #f1eaff 0 7%, #b89cff 14%, #7863f5 38%, #352a7a 68%, #171532 100%); box-shadow: 0 0 28px rgba(139,113,255,.34), inset -7px -8px 16px rgba(0,0,0,.32); }
.orb::before, .orb::after { content: ""; position: absolute; border: 1px solid rgba(197,184,255,.52); border-radius: 50%; inset: 8px -5px; transform: rotate(-26deg); }
.orb::after { inset: -4px 10px; transform: rotate(62deg); opacity: .55; }
.orb span { position: absolute; width: 4px; height: 4px; background: white; border-radius: 50%; top: 9px; left: 26px; box-shadow: -13px 12px 0 rgba(255,255,255,.75), 4px 13px 0 rgba(255,255,255,.5); }
.orb.small { width: 38px; height: 38px; }
.suggestions { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 22px; justify-content: center; }
.suggestions button { border: 1px solid var(--border); background: rgba(142,125,255,.055); color: #bbc2e0; padding: 8px 10px; border-radius: 999px; font-size: 12px; cursor: pointer; }
.suggestions button:hover { color: var(--text); background: rgba(142,125,255,.12); }
.composer { margin: 8px 18px 18px; border: 1px solid var(--border); background: #0a0e1b; border-radius: 16px; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px; padding: 8px; }
textarea { resize: none; background: transparent; border: 0; outline: 0; color: var(--text); padding: 9px 10px; font: inherit; max-height: 140px; }
textarea::placeholder { color: #68718f; }
.send { width: 42px; height: 42px; border: 0; border-radius: 12px; color: white; background: linear-gradient(135deg, var(--accent), #7158e8); cursor: pointer; font-size: 18px; box-shadow: 0 8px 24px rgba(116,88,238,.23); }
.send:disabled { opacity: .45; cursor: wait; }
.debug-panel { position: fixed; right: 18px; top: 18px; bottom: 18px; width: min(430px, calc(100vw - 36px)); background: rgba(8, 11, 21, .98); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); transform: translateX(calc(100% + 40px)); transition: transform .23s ease; z-index: 5; display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.debug-panel.open { transform: translateX(0); }
.debug-head { padding: 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.debug-content { padding: 15px; overflow-y: auto; }
.debug-item { border: 1px solid var(--border); background: rgba(255,255,255,.025); padding: 12px; border-radius: 12px; margin-bottom: 10px; }
.debug-item strong { font-size: 13px; }
.debug-item div { margin-top: 7px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 1px solid var(--border); border-radius: 999px; padding: 3px 6px; }
.muted { color: var(--muted); font-size: 13px; }
.typing { color: var(--muted); }
.error { border-color: rgba(255,100,120,.25) !important; color: #ffc2ca; }
@media (max-width: 720px) {
  .shell { padding: 12px; }
  .topbar { align-items: flex-start; }
  .brand p { display: none; }
  .status-wrap { flex-direction: column; align-items: flex-end; }
  .chat-card { border-radius: 18px; }
  .messages { padding: 18px 12px 8px; }
  .bubble, .message.user .bubble { max-width: 87%; }
  .suggestions { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding: 8px 12px; }
  .suggestions button { flex: 0 0 auto; }
  .composer { margin: 7px 10px 10px; }
}

/* Fontes verificáveis */
.answer-text { white-space: pre-wrap; }
.citation-block {
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid rgba(164, 176, 255, .14);
  display: grid;
  gap: 7px;
}
.citation-title {
  color: #9ea6c5;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.citation-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: #c8cee8;
  font-size: 12px;
  line-height: 1.45;
  padding: 6px 8px;
  border: 1px solid rgba(164, 176, 255, .10);
  border-radius: 9px;
  background: rgba(142, 125, 255, .035);
}
.citation-icon { color: #9c8dff; flex: 0 0 auto; }
.debug-meta { display: flex !important; }
.debug-sources { display: grid !important; gap: 5px !important; width: 100%; }
.debug-source {
  display: block !important;
  width: 100%;
  color: #c1c7df !important;
  line-height: 1.45;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(142, 125, 255, .04);
  border: 1px solid rgba(164, 176, 255, .09);
}

/* Formatação das respostas — estilo de chat legível */
.formatted-answer {
  white-space: normal;
  color: #eef1ff;
  line-height: 1.62;
}
.formatted-answer p {
  margin: 0 0 12px;
}
.formatted-answer p:last-child {
  margin-bottom: 0;
}
.formatted-answer strong {
  display: inline;
  margin: 0;
  font-size: inherit;
  color: #f4f2ff;
  font-weight: 700;
}
.formatted-answer em {
  color: #d8dcf0;
}
.answer-list {
  margin: 4px 0 13px 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 5px;
}
.answer-list li {
  position: relative;
  padding-left: 17px;
}
.answer-list li::before {
  content: "-";
  position: absolute;
  left: 2px;
  top: 0;
  color: #b6abff;
  font-weight: 700;
}
.answer-list-numbered {
  counter-reset: orion-counter;
}
.answer-list-numbered li {
  counter-increment: orion-counter;
  padding-left: 23px;
}
.answer-list-numbered li::before {
  content: counter(orion-counter) ".";
  left: 0;
  color: #b6abff;
  font-weight: 700;
}
.answer-heading {
  margin: 2px 0 8px;
  color: #f1efff;
  font-weight: 700;
}
.message.assistant .bubble {
  padding: 15px 16px;
}
.citation-block {
  margin-top: 16px;
  padding-top: 12px;
}
@media (min-width: 721px) {
  .message.assistant .bubble { max-width: 82%; }
}
