/* InvestLikeAPro Assistant — light, airy product UI.
   Violet primary + mint "verified" accent on soft lavender-white. Sora (display) + Inter (text). */

:root {
  color-scheme: light;

  --bg:          #f5f3fb;   /* soft lavender-white page ground */
  --surface:     #ffffff;   /* cards, input, modal */
  --surface-2:   #faf9fe;   /* subtle raised */
  --ink:         #1b1a2b;   /* headings / primary text (cool near-black) */
  --ink-2:       #56546e;   /* secondary text */
  --muted:       #8e8ca6;   /* labels, tertiary */

  --violet:      #6d4ae6;   /* primary: buttons, accents, markers, focus */
  --violet-2:    #5a37d6;   /* hover / pressed */
  --violet-soft: #efeafd;   /* chip + tint backgrounds */
  --violet-line: #e4defb;

  --mint:        #12b886;   /* "verified / cited" accent — sparing */
  --mint-soft:   #e4f7ef;

  --line:        #ebe8f5;   /* hairlines */
  --line-2:      #ddd8ef;   /* stronger borders */
  --danger:      #d1435b;

  --sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Sora", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --col: 720px;
  --shadow-sm:   0 1px 2px rgba(27,26,43,.04), 0 2px 8px rgba(27,26,43,.05);
  --shadow-card: 0 10px 34px rgba(109,74,230,.10);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 400 16px/1.6 var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── top bar (clean white) ──────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 24px; height: 62px;
  background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--display); color: var(--ink);
  font-size: 20px; font-weight: 700; letter-spacing: -.02em;
}
.wordmark .sub {                    /* the friendly violet chip */
  font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: .01em;
  color: var(--violet); background: var(--violet-soft);
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--violet-line);
}
.signout {
  background: none; border: 1px solid var(--line-2); color: var(--ink-2);
  font: 600 13.5px var(--sans); padding: 8px 15px; border-radius: 10px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.signout:hover { background: var(--violet-soft); border-color: var(--violet-line); color: var(--violet); }

/* ── disclaimer line ────────────────────────────────────────────────────── */
.disclaim { background: var(--bg); }
.disclaim-inner {
  max-width: var(--col); margin: 0 auto; padding: 12px 24px;
  font-size: 12.5px; color: var(--ink-2); display: flex; gap: 10px; align-items: baseline;
}
.disclaim-inner::before {
  content: ""; flex: none; width: 3px; align-self: stretch;
  background: var(--violet); border-radius: 2px;
}
.disclaim-inner b { color: var(--ink); font-weight: 600; }

/* ── conversation column ────────────────────────────────────────────────── */
.thread { max-width: var(--col); width: 100%; margin: 0 auto; padding: 34px 24px 8px; }

.opening {
  font-family: var(--display); font-size: 26px; line-height: 1.28; letter-spacing: -.02em;
  color: var(--ink); font-weight: 700; padding: 8px 0 6px; max-width: 15ch;
}
.opening .lede { color: var(--ink); }
.opening .hint {
  font-family: var(--sans); font-size: 15px; font-weight: 400; color: var(--ink-2);
  margin-top: 14px; max-width: 46ch; line-height: 1.6; letter-spacing: 0;
}

.exchange { padding: 28px 0; border-top: 1px solid var(--line); }
.exchange:first-of-type { border-top: 0; }

.q {
  display: flex; gap: 13px; align-items: flex-start;
  font-family: var(--display); font-size: 20px; line-height: 1.4; letter-spacing: -.01em;
  color: var(--ink); font-weight: 600;
}
.q::before {
  content: ""; flex: none; width: 4px; margin-top: 5px; height: 1.05em;
  background: var(--violet); border-radius: 3px;
}

.a { font-size: 16.5px; line-height: 1.72; color: var(--ink-2); margin-top: 15px; }
.a p { margin: 0 0 .85em; }
.a p:last-child { margin-bottom: 0; }
.a strong { font-weight: 600; color: var(--ink); }
.a h1, .a h2, .a h3 {
  font-family: var(--display); font-weight: 600; font-size: 14px; letter-spacing: -.005em;
  color: var(--ink); margin: 1.5em 0 .5em;
}
.a ul, .a ol { margin: 0 0 .85em; padding-left: 1.35em; }
.a li { margin: .25em 0; padding-left: .2em; }
.a ul li::marker { color: var(--violet); }
.a ol { list-style: none; counter-reset: item; padding-left: 0; }
.a ol > li { counter-increment: item; position: relative; padding-left: 2em; }
.a ol > li::before {
  content: counter(item); position: absolute; left: 0; top: .05em;
  font: 600 12px var(--sans); color: var(--violet);
  width: 1.5em; height: 1.5em; line-height: 1.5em; text-align: center;
  background: var(--violet-soft); border-radius: 7px;
}

/* citation markers */
.marker {
  font-family: var(--sans); font-size: .7em; font-weight: 700; vertical-align: .35em;
  color: var(--violet); cursor: pointer; padding: 0 1px; line-height: 1;
}
.marker:hover { text-decoration: underline; text-underline-offset: 2px; }

/* streaming caret + typing dots */
.caret {
  display: inline-block; width: .5ch; height: 1.05em; margin-left: 1px;
  background: var(--violet); vertical-align: -.15em; border-radius: 1px;
  animation: blink 1.05s steps(2) infinite;
}
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }
.typing { display: inline-flex; gap: 5px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--violet); opacity: .35;
  animation: bob 1.1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .16s; }
.typing i:nth-child(3) { animation-delay: .32s; }
@keyframes bob { 0%,80%,100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* sources — white card with a mint "verified" cue */
.sources {
  margin-top: 20px; padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.sources-h {
  display: flex; align-items: center; gap: 7px;
  font: 600 11.5px var(--sans); letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 11px;
}
.sources-h::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft);
}
.source {
  display: flex; gap: 11px; font-size: 13.5px; color: var(--ink-2);
  padding: 4px 0; line-height: 1.45; border-radius: 8px;
}
.source .n {
  flex: none; font-weight: 700; color: var(--violet); min-width: 1.5em;
  font-variant-numeric: tabular-nums;
}
.source.flash { animation: flash 1.1s ease-out; }
@keyframes flash { from { background: var(--violet-soft); } to { background: transparent; } }
.source .date { color: var(--muted); }

.notice { color: var(--danger); font-size: 14.5px; }

/* ── composer ───────────────────────────────────────────────────────────── */
.composer-wrap { position: sticky; bottom: 0; background: linear-gradient(rgba(245,243,251,0), var(--bg) 32%); }
.composer {
  max-width: var(--col); width: 100%; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 10px; padding: 12px 24px 16px;
}
.field {
  flex: 1; display: flex; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 15px;
  padding: 4px 4px 4px 16px; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.field:focus-within { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(109,74,230,.14); }
.field textarea {
  flex: 1; resize: none; border: 0; background: none; color: var(--ink);
  font: 400 16px/1.5 var(--sans); padding: 11px 0; max-height: 180px; outline: none;
}
.field textarea::placeholder { color: var(--muted); }
.ask {
  flex: none; background: var(--violet); color: #fff; border: 0;
  font: 600 15px var(--sans); padding: 11px 20px; margin: 3px; border-radius: 12px;
  cursor: pointer; box-shadow: 0 2px 10px rgba(109,74,230,.28);
  transition: background .15s, transform .06s, box-shadow .15s;
}
.ask:hover { background: var(--violet-2); box-shadow: 0 4px 16px rgba(109,74,230,.36); }
.ask:active { transform: translateY(1px); }
.ask:disabled { opacity: .5; cursor: default; box-shadow: none; }
.foot { max-width: var(--col); margin: 0 auto; padding: 0 24px 14px; font-size: 11.5px; color: var(--muted); }

/* ── auth (login) ───────────────────────────────────────────────────────── */
body.auth { display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #efeafd 0%, var(--bg) 55%); }
.auth-card {
  width: min(410px, 100%); background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; padding: 36px 34px 30px;
  box-shadow: var(--shadow-card);
}
.auth-card .wordmark { font-size: 23px; margin-bottom: 6px; }
.auth-sub { color: var(--ink-2); font-size: 14.5px; margin: 2px 0 26px; }
.form { display: flex; flex-direction: column; gap: 15px; }
.form label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form input {
  padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px;
  font: 400 15.5px var(--sans); color: var(--ink); background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.form input:focus { outline: none; background: var(--surface);
  border-color: var(--violet); box-shadow: 0 0 0 4px rgba(109,74,230,.14); }
.form .ask { width: 100%; text-align: center; margin: 6px 0 0; padding: 13px; }
.err {
  color: var(--danger); font-size: 13px; margin: 0;
  background: #fdeef1; border: 1px solid #f6cdd5; padding: 10px 13px; border-radius: 11px;
}
.auth-note { margin: 24px 0 0; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); line-height: 1.55; }

/* ── acknowledgement gate ───────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-scrim { position: absolute; inset: 0; background: rgba(27,26,43,.38); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; width: min(500px, 100%); background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; padding: 32px 32px 28px;
  box-shadow: 0 24px 70px rgba(27,26,43,.28); animation: rise .22s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.modal-card .kicker {
  display: inline-block; font: 600 11.5px var(--sans); letter-spacing: .04em;
  color: var(--violet); background: var(--violet-soft); border: 1px solid var(--violet-line);
  padding: 4px 11px; border-radius: 999px; margin: 0 0 14px;
}
.modal-card h2 { font-family: var(--display); font-weight: 700; font-size: 24px; letter-spacing: -.02em;
  margin: 0 0 12px; color: var(--ink); }
.modal-card p { font-size: 15px; line-height: 1.62; color: var(--ink-2); margin: 0 0 10px; }
.modal-card p strong { color: var(--ink); font-weight: 600; }
.modal-card .ask { width: 100%; margin: 20px 0 0; padding: 13px; }

/* ── responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .topbar { padding: 0 16px; height: 56px; }
  .wordmark { font-size: 18px; }
  .thread, .composer, .foot, .disclaim-inner { padding-left: 16px; padding-right: 16px; }
  .opening { font-size: 23px; }
  .q { font-size: 18px; }
  .a { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .caret, .typing i, .source.flash, .modal-card { animation: none; }
}

/* Document delivery card — shown when a member asks for a file */
.doccard {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--violet-line); background: var(--violet-soft);
  border-radius: 14px; padding: 14px 16px; margin: 2px 0;
}
.doccard .doc-ico { font-size: 22px; line-height: 1; }
.doccard .doc-meta { flex: 1 1 auto; min-width: 0; }
.doccard .doc-title { font-weight: 600; color: var(--ink); }
.doccard .doc-file { font-size: 12.5px; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doccard .doc-dl {
  flex: 0 0 auto; text-decoration: none; font-weight: 600; font-size: 14px;
  color: #fff; background: var(--violet); border: 1px solid var(--violet);
  padding: 9px 16px; border-radius: 10px;
}
.doccard .doc-dl:hover { background: var(--violet-2); }
