:root {
  --ink: #17243f;
  --muted: #68738a;
  --line: #dfe4ee;
  --paper: #f7f8fb;
  --white: #ffffff;
  --violet: #6e2bdd;
  --violet-dark: #4a189c;
  --teal: #20a98f;
  --soft-violet: #f0eaff;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "DM Sans", sans-serif; }
button, textarea, input { font: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.rail { background: #10192d; color: #dce2f1; padding: 28px 20px 22px; display: flex; flex-direction: column; gap: 34px; }
.brand { display: flex; align-items: center; gap: 12px; font-family: "Manrope", sans-serif; font-weight: 700; font-size: 16px; }
.mark, .dialog-mark { width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(145deg, #9663ff, #5421bd); display: grid; place-items: center; color: white; font-family: "Manrope", sans-serif; font-weight: 700; }
nav { display: grid; gap: 6px; }
.nav-item { border: 0; background: transparent; color: #aeb8ce; padding: 11px 12px; border-radius: 9px; display: flex; align-items: center; gap: 12px; text-align: left; }
.nav-item.active { color: white; background: #222d46; }
.nav-item span { width: 18px; text-align: center; color: #b895ff; }
.sync-card { margin-top: auto; padding: 16px; border: 1px solid #35405a; border-radius: 13px; background: #18233a; }
.sync-heading { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #4bd0a7; box-shadow: 0 0 0 5px rgba(75,208,167,.12); }
.sync-card p { color: #98a5bf; font-size: 12px; line-height: 1.5; margin: 12px 0 15px; }
.sync-stats { display: flex; border-top: 1px solid #35405a; padding-top: 12px; gap: 20px; font-size: 11px; color: #8f9ab2; }
.sync-stats b { display: block; color: white; font-size: 15px; margin-bottom: 2px; }
.account { border: 0; color: white; background: transparent; display: flex; gap: 11px; align-items: center; text-align: left; padding: 7px; border-radius: 10px; }
.account:hover { background: #1b2740; }
.account::first-letter { background: #6e2bdd; }
.account > span { display: grid; }
.account small { color: #8e9ab3; }
.workspace { min-width: 0; display: grid; grid-template-rows: auto 1fr auto; height: 100vh; background: var(--white); }
header { padding: 29px 42px 25px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 28px; }
h1, h2 { font-family: "Manrope", sans-serif; margin: 0; letter-spacing: -.035em; }
h1 { font-size: 27px; }
header p { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
.source-status { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 245px; display: flex; align-items: center; gap: 10px; }
.source-status > span:nth-child(2) { display: grid; flex: 1; }
.source-status strong { font-size: 13px; }
.source-status small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.firefly { display: grid; place-items: center; background: #eee8ff; color: var(--violet); border-radius: 8px; width: 30px; height: 30px; }
.check { color: var(--teal); }
.conversation { overflow-y: auto; padding: 36px max(42px, calc((100vw - 280px - 900px) / 2)); }
.welcome { max-width: 720px; margin: 10vh auto 0; text-align: center; }
.orb { width: 64px; height: 64px; padding: 5px; border-radius: 20px; margin: 0 auto 22px; background: conic-gradient(from 220deg, #6e2bdd, #b179ff, #20a98f, #6e2bdd); }
.orb span { width: 100%; height: 100%; display: grid; place-items: center; background: white; border-radius: 15px; color: var(--violet); font-family: "Manrope"; font-size: 23px; font-weight: 700; }
.welcome h2 { font-size: 30px; }
.welcome > p { color: var(--muted); line-height: 1.6; max-width: 535px; margin: 12px auto 28px; }
.prompts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.prompts button { background: white; border: 1px solid var(--line); border-radius: 11px; color: #4e5a72; padding: 14px; min-height: 66px; text-align: left; line-height: 1.35; }
.prompts button:hover { border-color: #a58add; color: var(--violet-dark); }
.message { max-width: 780px; margin: 0 auto 22px; }
.question { background: var(--soft-violet); border-radius: 16px 16px 4px 16px; padding: 14px 17px; margin-left: auto; width: fit-content; max-width: 78%; }
.answer { margin-top: 22px; display: grid; grid-template-columns: 36px 1fr; gap: 13px; line-height: 1.65; }
.answer-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: white; background: var(--violet); font-weight: 700; }
.answer-content p { margin: 4px 0 14px; white-space: pre-wrap; }
.sources { display: grid; gap: 7px; margin-top: 14px; }
.source { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font-size: 12px; color: var(--muted); }
.source b { color: var(--ink); margin-right: 6px; }
.composer { margin: 0 auto 28px; width: min(820px, calc(100% - 84px)); border: 1px solid #ccd3df; border-radius: 16px; padding: 10px 10px 7px 16px; display: grid; grid-template-columns: 1fr 42px; align-items: end; box-shadow: 0 14px 42px rgba(39,47,74,.1); }
.composer textarea { border: 0; outline: 0; resize: none; min-height: 38px; max-height: 160px; padding: 8px 4px; color: var(--ink); }
.composer button { border: 0; width: 38px; height: 38px; border-radius: 11px; background: var(--violet); color: white; font-size: 21px; }
.composer button:disabled { opacity: .45; }
.composer p { grid-column: 1 / -1; margin: 5px 0 0; color: #99a2b3; font-size: 10px; }
dialog { border: 0; border-radius: 18px; width: min(390px, calc(100% - 32px)); padding: 0; box-shadow: 0 24px 80px rgba(16,25,45,.28); }
dialog::backdrop { background: rgba(16,25,45,.64); backdrop-filter: blur(4px); }
dialog form { padding: 28px; }
dialog h2 { font-size: 22px; margin-top: 17px; }
dialog p { color: var(--muted); line-height: 1.5; font-size: 14px; }
dialog input { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; outline: none; }
dialog input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(110,43,221,.12); }
dialog button { width: 100%; border: 0; border-radius: 10px; padding: 12px; margin-top: 12px; color: white; background: var(--violet); font-weight: 600; }
button:focus-visible, textarea:focus-visible { outline: 3px solid rgba(110,43,221,.25); outline-offset: 2px; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  header { padding: 20px; }
  header h1 { font-size: 22px; }
  .source-status { display: none; }
  .conversation { padding: 24px 20px; }
  .welcome { margin-top: 5vh; }
  .welcome h2 { font-size: 26px; }
  .prompts { grid-template-columns: 1fr; }
  .composer { width: calc(100% - 32px); margin-bottom: 16px; }
}

@media (prefers-reduced-motion: no-preference) {
  .orb { animation: settle .55s ease-out both; }
  @keyframes settle { from { transform: translateY(8px) scale(.94); opacity: 0; } }
}
