:root {
  --bg: #f5f7fb; --surface: #ffffff; --surface2: #f0f3f9; --ink: #14213d; --mute: #5d6b86; --line: #e1e7f1;
  --brand: #3b5bdb; --brand2: #14b8a6; --coral: #ff7a59;
  --state: #7048e8; --center: #0b9e75; --warn: #c2410c; --danger: #d6336c;
  --grad: linear-gradient(135deg, #3b5bdb 0%, #14b8a6 100%);
  --shadow: 0 1px 2px rgba(20,33,61,.05), 0 8px 28px rgba(20,33,61,.07);
  --shadow-lg: 0 20px 60px rgba(40,60,140,.18);
  --r: 18px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1020; --surface: #131a2e; --surface2: #1a2340; --ink: #eaf0ff; --mute: #9aa8c7; --line: #25304f;
    --brand: #7c93ff; --brand2: #2dd4bf; --state: #a78bfa; --center: #34d399; --warn: #fb923c; --danger: #f06595;
    --grad: linear-gradient(135deg, #5b7bff 0%, #14b8a6 100%); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35); --shadow-lg: 0 20px 60px rgba(0,0,0,.5); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -.02em; margin: 0; }
.mute { color: var(--mute); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shared controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); padding: 10px 16px; border-radius: 12px; font-weight: 600; transition: transform .12s, box-shadow .15s, background .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:disabled { opacity: .6; cursor: default; transform: none; box-shadow: none; }
.btn.primary { background: var(--grad); color: #fff; border: 0; box-shadow: 0 8px 22px rgba(59,91,219,.28); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.big { padding: 14px 20px; border-radius: 14px; width: 100%; font-size: 17px; }
.field { display: block; margin: 14px 0 0; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--mute); margin-bottom: 6px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface2); border: 1.5px solid transparent; border-radius: 12px; padding: 12px 14px; width: 100%; outline: none; transition: border-color .15s, background .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); background: var(--surface); }
.err { color: var(--danger); font-size: 14px; min-height: 1.3em; margin: 8px 0 0; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: color-mix(in srgb, currentColor 12%, transparent); }
.tag.state { color: var(--state); } .tag.center { color: var(--center); }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- landing ---------- */
#land { min-height: 100vh; position: relative; overflow: hidden; }
#land::before, #land::after { content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .45; z-index: 0; pointer-events: none; }
#land::before { width: 520px; height: 520px; background: #5b7bff; top: -160px; left: -120px; }
#land::after { width: 460px; height: 460px; background: #14b8a6; top: 180px; right: -140px; opacity: .35; }
#land > * { position: relative; z-index: 1; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 18px; }
.mark { width: 38px; height: 38px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; color: #fff; box-shadow: 0 8px 20px rgba(59,91,219,.3); }
.mark svg { width: 22px; height: 22px; }
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; padding: 40px 0 64px; }
.pill { display: inline-flex; gap: 8px; align-items: center; padding: 6px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 600; box-shadow: var(--shadow); }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--brand2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand2) 25%, transparent); }
.hero h1 { font-size: clamp(38px, 5.4vw, 62px); margin: 20px 0 18px; font-weight: 800; }
.hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 19px; color: var(--mute); max-width: 540px; margin: 0 0 26px; }
.checks { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.checks li { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.checks svg { color: var(--brand2); }
.login { background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 26px; padding: 30px; box-shadow: var(--shadow-lg); }
.login h2 { font-size: 26px; margin-bottom: 4px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding-bottom: 40px; }
.feat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow); }
.feat .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 14px; color: #fff; }
.feat h3 { font-size: 19px; margin-bottom: 6px; }
.feat p { margin: 0; color: var(--mute); }
.foot { text-align: center; color: var(--mute); font-size: 13px; padding: 18px 20px 36px; }

/* ---------- app shell ---------- */
#app { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.side { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; }
.side .logo { padding: 4px 8px 18px; }
.nav { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; border: 0; background: transparent; font-weight: 600; color: var(--mute); text-align: left; width: 100%; }
.nav:hover { background: var(--surface2); color: var(--ink); }
.nav.on { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.grow { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--surface2); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.who b { display: block; font-size: 14px; line-height: 1.2; } .who small { color: var(--mute); }
.who .out { margin-left: auto; border: 0; background: transparent; color: var(--mute); padding: 6px; border-radius: 8px; }
.who .out:hover { color: var(--danger); background: var(--surface); }
.stage { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.view { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 36px 24px 40px; }

/* ask: welcome */
#welcome { text-align: center; padding: 6vh 0 10px; }
#welcome .mark { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 20px; }
#welcome .mark svg { width: 34px; height: 34px; }
#welcome h1 { font-size: clamp(30px, 4.4vw, 44px); font-weight: 800; margin-bottom: 10px; }
#welcome h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
#welcome p { color: var(--mute); max-width: 560px; margin: 0 auto 28px; font-size: 17px; }
.stats { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 30px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); font-size: 14px; }
.stat b { font-size: 20px; letter-spacing: -.02em; }
.ideas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; text-align: left; }
.idea { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; transition: transform .12s, box-shadow .15s, border-color .15s; font-weight: 600; }
.idea:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand); }
.idea .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; }
.idea small { display: block; color: var(--mute); font-weight: 400; font-size: 13px; margin-top: 2px; }
.setup { background: color-mix(in srgb, var(--coral) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--coral) 40%, var(--line)); border-radius: 16px; padding: 14px 18px; margin: 0 0 22px; text-align: left; }

/* ask: thread */
#msgs { display: flex; flex-direction: column; gap: 18px; padding-bottom: 130px; }
.m { max-width: 100%; }
.m.user { align-self: flex-end; background: var(--grad); color: #fff; padding: 12px 18px; border-radius: 20px 20px 6px 20px; max-width: 82%; box-shadow: 0 8px 22px rgba(59,91,219,.22); white-space: pre-wrap; }
.m.bot { align-self: stretch; display: flex; gap: 14px; }
.m.bot .mark { width: 34px; height: 34px; border-radius: 11px; flex: none; margin-top: 2px; }
.m.bot .mark svg { width: 18px; height: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; flex: 1; }
.card p { margin: .5em 0; } .card ol, .card ul { margin: .5em 0; padding-left: 1.3em; } .card li { margin: .25em 0; }
.card .lbl { display: block; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; margin: 16px 0 2px; color: var(--brand); }
.card .lbl.s { color: var(--state); } .card .lbl.c { color: var(--center); } .card .lbl.w { color: var(--warn); }
.conf { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 700; padding: 3px 12px; border-radius: 99px; margin-top: 10px; }
.conf.high { background: color-mix(in srgb, #12b886 16%, transparent); color: #0b9e75; }
.conf.medium { background: color-mix(in srgb, #f59f00 18%, transparent); color: #b36b00; }
.conf.low { background: color-mix(in srgb, #fa5252 16%, transparent); color: #d6336c; }
.cite { display: inline-flex; align-items: center; font-size: 11px; font-weight: 800; min-width: 22px; height: 20px; padding: 0 6px; margin: 0 1px; border-radius: 7px; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); border: 0; vertical-align: 1px; justify-content: center; }
.cite:hover { background: var(--brand); color: #fff; }
.src { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.think { display: flex; align-items: center; gap: 12px; color: var(--mute); }
.dots { display: inline-flex; gap: 5px; } .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); animation: b 1.1s infinite ease-in-out; } .dots i:nth-child(2) { animation-delay: .15s; background: var(--brand2); } .dots i:nth-child(3) { animation-delay: .3s; background: var(--coral); }
@keyframes b { 0%,80%,100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

.dock { position: sticky; bottom: 0; padding: 0 24px 22px; background: linear-gradient(to top, var(--bg) 62%, transparent); margin-top: auto; }
.dock .in { max-width: 852px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-end; background: var(--surface); border: 1.5px solid var(--line); border-radius: 20px; padding: 8px 8px 8px 18px; box-shadow: var(--shadow-lg); }
.dock .in:focus-within { border-color: var(--brand); }
.dock textarea { border: 0; background: transparent; resize: none; padding: 10px 0; max-height: 160px; min-height: 44px; }
.dock .send { width: 46px; height: 46px; border-radius: 14px; border: 0; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 8px 20px rgba(59,91,219,.3); }
.dock .send:disabled { opacity: .5; }
.dock small { display: block; text-align: center; color: var(--mute); font-size: 12px; margin-top: 8px; }

/* library */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head h1 { font-size: 32px; font-weight: 800; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.panel h3 { font-size: 18px; margin-bottom: 4px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.doc { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.doc:first-of-type { border-top: 0; }
.doc .dico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, currentColor 12%, transparent); }
.doc.state .dico { color: var(--state); } .doc.center .dico { color: var(--center); }
.doc b { display: block; }
.empty { text-align: center; color: var(--mute); padding: 26px 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.sp { justify-content: space-between; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 0; }
.seg span { display: block; text-align: center; padding: 10px; border-radius: 12px; background: var(--surface2); font-weight: 700; border: 1.5px solid transparent; }
.seg input:checked + span.s { border-color: var(--state); color: var(--state); background: color-mix(in srgb, var(--state) 10%, var(--surface)); }
.seg input:checked + span.c { border-color: var(--center); color: var(--center); background: color-mix(in srgb, var(--center) 10%, var(--surface)); }
.drop { display: block; border: 2px dashed var(--line); border-radius: 16px; padding: 22px; text-align: center; color: var(--mute); cursor: pointer; margin-top: 14px; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.drop input { display: none; } .drop b { color: var(--ink); }

dialog { border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--ink); max-width: 720px; width: calc(100vw - 32px); padding: 24px; box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(10,16,32,.55); backdrop-filter: blur(3px); }
dialog pre { white-space: pre-wrap; font: 15px/1.6 inherit; background: var(--surface2); padding: 16px; border-radius: 14px; max-height: 52vh; overflow: auto; margin: 14px 0; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 12px; }
  .features, .cols, .two, .ideas { grid-template-columns: 1fr; }
  #app { grid-template-columns: 1fr; padding-bottom: 66px; }
  .side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 8px 10px; border-right: 0; border-top: 1px solid var(--line); z-index: 20; gap: 4px; }
  .side .logo, .side .who small, .side .who b, .side .grow { display: none; }
  .side .who { padding: 4px; background: transparent; margin-left: auto; }
  .nav { flex-direction: column; gap: 2px; font-size: 12px; padding: 7px 14px; width: auto; text-align: center; }
  .view { padding: 22px 16px 30px; }
  .dock { padding: 0 12px 12px; bottom: 66px; position: fixed; left: 0; right: 0; }
  #msgs { padding-bottom: 150px; }
  .m.user { max-width: 92%; }
  .m.bot > .mark { display: none; }
}
/* ---------- phones ---------- */
@media (max-width: 860px) {
  body { padding-bottom: 0; }
  #app { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .side { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .dock { bottom: calc(66px + env(safe-area-inset-bottom)); }
  .nav { min-width: 72px; min-height: 48px; justify-content: center; }
  .who .out { width: 44px; height: 44px; display: grid; place-items: center; }
  .who .avatar { width: 40px; height: 40px; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .top { padding: 14px 0; }
  .mark { width: 34px; height: 34px; }
  .hero { padding: 6px 0 34px; gap: 26px; }
  .hero h1 { font-size: 36px; margin: 14px 0 12px; }
  .hero p.lead { font-size: 17px; margin-bottom: 18px; }
  .login { padding: 22px 18px; border-radius: 22px; }
  .login h2 { font-size: 24px; }
  .features { gap: 12px; }
  .feat { padding: 18px; }

  .view { padding: 14px 14px 24px; }
  #welcome { padding: 0; text-align: left; }
  #welcome .mark { width: 46px; height: 46px; border-radius: 15px; margin: 4px 0 12px; }
  #welcome .mark svg { width: 26px; height: 26px; }
  #welcome h1 { font-size: 27px; margin-bottom: 8px; }
  #welcome p { font-size: 15px; margin: 0 0 14px; max-width: none; }
  .stats { justify-content: flex-start; gap: 8px; margin-bottom: 16px; }
  .stat { padding: 7px 12px; font-size: 13px; }
  .stat b { font-size: 17px; }
  .setup { padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }
  .ideas { gap: 8px; }
  .idea { padding: 12px 14px; gap: 12px; text-align: left; align-items: center; font-size: 15px; line-height: 1.3; }
  .idea .ico { width: 34px; height: 34px; border-radius: 11px; }
  .idea small { font-size: 12px; }

  #msgs { gap: 14px; padding-bottom: 170px; }
  .m.user { max-width: 90%; padding: 10px 15px; }
  .card { padding: 14px 15px; border-radius: 16px; }
  .cite { min-width: 28px; height: 26px; font-size: 12px; margin: 0 2px; border-radius: 9px; }
  .srcrow { padding: 11px 12px; min-height: 46px; }
  .srcrow small { display: none; }

  .dock { padding: 0 10px 8px; }
  .dock .in { border-radius: 18px; padding: 6px 6px 6px 14px; }
  .dock textarea { min-height: 42px; padding: 9px 0; }
  .dock .send { width: 44px; height: 44px; }
  .dock small { display: none; }

  .head h1 { font-size: 27px; }
  .panel { padding: 16px; border-radius: 16px; }
  .doc { flex-wrap: wrap; gap: 10px 12px; }
  .doc .grow { min-width: 0; flex: 1 1 60%; }
  .doc .btn { padding: 8px 12px; }
  .btn { min-height: 44px; }
  .drop { padding: 18px; }

  dialog { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 22px 22px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow: auto; }
  dialog pre { font-size: 14px; max-height: 55dvh; padding: 12px; }
  #dclose { width: 100%; }
}
/* ---------- app is a fixed frame: the page never scrolls, only the chat (or the library) inside it ---------- */
#app { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.stage { height: 100%; min-height: 0; overflow: hidden; }
.pane { min-height: 0; overflow: hidden; }
.view { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#msgs { padding-bottom: 20px; }
.dock { position: static; flex: none; margin-top: 0; background: var(--bg); padding-top: 8px; }
@media (max-width: 860px) {
  #app { box-sizing: border-box; }
  .stage { min-height: 0; }
  .dock { position: static; left: auto; right: auto; bottom: auto; }
}
@media (max-width: 600px) {
  #msgs { padding-bottom: 12px; }
  .dock { padding: 6px 10px 8px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* sources under an answer */
.found { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.srcrow { display: flex; gap: 8px; align-items: stretch; }
.srcmain { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; text-align: left; background: var(--surface2); border: 0; border-radius: 12px; padding: 10px 12px; }
.srcmain:hover { background: color-mix(in srgb, var(--brand) 10%, var(--surface2)); }
.srcmain .t { min-width: 0; display: block; }
.srcmain .t b { display: block; font-size: 14px; line-height: 1.3; }
.srcmain .t small { display: block; color: var(--mute); font-size: 12px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srclink { flex: none; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 12px; background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); font-weight: 700; font-size: 13px; text-decoration: none; white-space: nowrap; }
.srclink:hover { background: var(--brand); color: #fff; }
.notfound { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; padding: 6px 14px; border-radius: 99px; background: color-mix(in srgb, #f59f00 18%, transparent); color: var(--warn); margin-bottom: 8px; }
@media (max-width: 600px) { .srcrow { flex-direction: column; } .srclink { justify-content: center; min-height: 40px; } .srcrow small { display: block; } }

/* short answer first, details on request */
.sum p { margin: .3em 0; font-size: 16.5px; }
.sum ul, .sum ol { margin: .35em 0; }
.meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.meta .conf { margin-top: 0; }
.foundn { font-size: 13px; color: var(--mute); font-weight: 600; }
.more { margin-top: 12px; padding-top: 6px; border-top: 1px dashed var(--line); }
.expand { margin-top: 14px; display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--surface2); color: var(--brand); font-weight: 700; padding: 9px 16px; border-radius: 99px; }
.expand:hover { border-color: var(--brand); }
.expand .chev { font-size: 12px; }
@media (max-width: 600px) { .expand { width: 100%; justify-content: center; min-height: 44px; } }

/* collapsible, grouped sources */
.srctoggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface2); border: 0; border-radius: 12px; padding: 11px 14px; font-weight: 700; font-size: 14px; text-align: left; }
.srctoggle:hover { background: color-mix(in srgb, var(--brand) 10%, var(--surface2)); }
.srctoggle .chev { transition: transform .15s; color: var(--mute); }
.srctoggle.open .chev { transform: rotate(180deg); }
.srcbody { margin-top: 10px; display: flex; flex-direction: column; gap: 14px; }
.sgroup { display: flex; flex-direction: column; gap: 6px; }
.sghead { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 0 2px; }
.sghead b { flex: 1; min-width: 0; line-height: 1.3; }
.num { flex: none; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.srcmain .t b { font-weight: 600; }

/* chats, history and team */
.chatbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -6px 0 14px; }
.chatbar .mute { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.chatbar .btn { padding: 7px 14px; flex: none; }
.histmain { flex: 1; min-width: 0; background: transparent; border: 0; text-align: left; padding: 2px 0; }
.histmain b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.histmain:hover b { color: var(--brand); }
.doc .tag { flex: none; }
@media (max-width: 860px) {
  .nav { flex: 1; min-width: 0; padding: 7px 2px; }
  .who .out { width: 40px; }
}
@media (max-width: 600px) {
  .doc .btn { flex: 1 1 auto; }
  .head .btn { width: 100%; }
}
@media (max-width: 600px) {
  .doc .grow { flex: 1 1 140px; min-width: 120px; }
  .doc .grow b, .doc .grow .mute { overflow-wrap: anywhere; }
}

.btn.sm { padding: 7px 12px; min-height: 40px; flex: none !important; font-size: 14px; }
@media (max-width: 600px) { .histmain b { white-space: normal; } .doc .histmain { flex: 1 1 0; } }

/* thumbs under an answer, and rows in the "marked wrong" list */
.fb{display:flex;align-items:center;gap:8px;margin-top:12px;padding-top:10px;border-top:1px solid var(--line,rgba(127,127,127,.2));font-size:14px}
.fb button{border:1px solid var(--line,rgba(127,127,127,.3));background:transparent;border-radius:999px;padding:4px 12px;font-size:16px;cursor:pointer}
.fb button:hover{background:rgba(127,127,127,.12)}
.fbitem{display:flex;flex-direction:column;gap:2px;padding:10px 0;border-top:1px solid var(--line,rgba(127,127,127,.2))}
.fbitem:first-child{border-top:0}
.scrubbed{font-size:14px;margin:0 0 10px;padding:8px 12px;border-radius:10px;background:rgba(245,159,0,.14)}
.logo img.brand{width:44px;height:44px;object-fit:contain;flex:none;border-radius:50%}

/* ======== calmer look: one deep teal from the logo, warm paper background, no gradients or glow ======== */
:root {
  --bg: #f8f6f1; --surface: #ffffff; --surface2: #f1eee7; --ink: #1c2b30; --mute: #66767a; --line: #e4dfd4;
  --brand: #1f5360; --brand2: #1f5360; --coral: #c9763a;
  --state: #1f5360; --center: #b4572f; --warn: #a8521a; --danger: #b3382c;
  --grad: #1f5360;
  --shadow: 0 1px 2px rgba(28,43,48,.06); --shadow-lg: 0 2px 10px rgba(28,43,48,.08);
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11191c; --surface: #182226; --surface2: #202c31; --ink: #e8eeee; --mute: #94a5a8; --line: #2b393e;
    --brand: #7fb5c2; --brand2: #7fb5c2; --state: #7fb5c2; --center: #e09468; --warn: #e0a068; --danger: #e8806f; --grad: #2f7585;
    --shadow: none; --shadow-lg: 0 2px 10px rgba(0,0,0,.35); }
}
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif; }
h1, h2 { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; font-weight: 700; letter-spacing: -.01em; }
.hero h1 em, #welcome h1 em { background: none; color: var(--brand); -webkit-text-fill-color: currentColor; }
#land::before, #land::after { display: none; }
.login { backdrop-filter: none; background: var(--surface); border-radius: 16px; }
.pill i { box-shadow: none; }
.btn, input, select, textarea, .seg span, .drop, .srcmain, .srclink, .srctoggle, .expand { border-radius: 10px; }
.btn:hover { transform: none; box-shadow: none; background: var(--surface2); }
.btn.primary { background: var(--brand); color: #fff; box-shadow: none; }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
@media (prefers-color-scheme: dark) { .btn.primary, .m.user, .dock .send { color: #0d1518; background: var(--brand); } }
.mark, .avatar, .dock .send { box-shadow: none; border-radius: 10px; }
.avatar { border-radius: 50%; }
.feat .ico, .idea .ico { background: var(--brand) !important; border-radius: 10px; }
.card, .panel, .feat, .stat { box-shadow: none; }
.m.user { background: var(--brand); color: #fff; box-shadow: none; border-radius: 14px 14px 4px 14px; }
.dots i, .dots i:nth-child(2), .dots i:nth-child(3) { background: var(--brand); }
.dock { background: var(--bg); }
.dock .in { box-shadow: none; border-radius: 14px; }
.nav.on { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.setup { background: color-mix(in srgb, var(--coral) 10%, var(--surface)); border-radius: 10px; }

/* welcome: one screen, no scrolling; plain list of example questions */
#welcome { padding: 3vh 0 0; text-align: left; }
#welcome .mark { display: none; }
#welcome h1 { font-size: clamp(28px, 3.6vw, 38px); margin-bottom: 8px; }
#welcome p { margin: 0 0 18px; max-width: 620px; font-size: 16px; }
.stats { justify-content: flex-start; margin-bottom: 18px; }
.ideas { gap: 8px; }
.idea { padding: 12px 16px; border-radius: 10px; align-items: center; font-weight: 500; transition: border-color .15s, background .15s; }
.idea:hover { transform: none; box-shadow: none; background: var(--surface2); border-color: var(--brand); }
.idea .ico, .idea small { display: none; }
@media (min-width: 861px) and (min-height: 600px) {
  .view:has(#welcome:not(.hidden)) { overflow: hidden; }
}
.idea { justify-content: flex-start; text-align: left; }

/* ======== classy pass: Source Serif + Source Sans, deep teal sidebar, paper and brass, questions set like a printed Q&A ======== */
:root {
  --bg: #f6f3ec; --surface: #fffefb; --surface2: #efebe2; --ink: #17262b; --mute: #667479; --line: #ded8ca;
  --brand: #1d4e5a; --deep: #153f49; --accent: #a8864f;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) { :root { --bg: #101719; --surface: #172125; --surface2: #1e2a2e; --deep: #0c2a31; } }
body { font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif; font-size: 17px; }
h1, h2, h3 { font-family: var(--serif); }
.panel h3, .feat h3, dialog h3 { font-family: var(--serif); font-weight: 600; }
.btn, input, select, textarea, .seg span, .drop, .srcmain, .srclink, .srctoggle, .expand { border-radius: 8px; }
.btn { font-weight: 600; letter-spacing: .01em; }
.btn.primary { background: var(--brand); }

/* sign-in: teal panel on the left, plain form on the right */
#land { min-height: 100vh; min-height: 100dvh; background: var(--bg); overflow: visible; }
.split { display: grid; grid-template-columns: minmax(360px, 1.05fr) 1fr; min-height: 100vh; min-height: 100dvh; }
.panel-brand { background: var(--deep); color: #e9f0f1; padding: 40px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.panel-brand .cname { color: #fff; font-family: var(--serif); font-weight: 600; font-size: 19px; letter-spacing: 0; }
.panel-brand .mark { background: rgba(255,255,255,.12); }
.pitch h1 { color: #fff; font-size: clamp(34px, 3.9vw, 54px); line-height: 1.08; margin: 0 0 22px; font-weight: 600; }
.pitch .lead { color: rgba(255,255,255,.78); font-size: 18px; max-width: 30em; margin: 0; }
.plain { list-style: none; padding: 0; margin: 34px 0 0; border-top: 1px solid rgba(255,255,255,.2); max-width: 30em; }
.plain li { padding: 13px 0; border-bottom: 1px solid rgba(255,255,255,.2); color: rgba(255,255,255,.92); }
.panel-brand .foot { text-align: left; color: rgba(255,255,255,.6); font-size: 13px; padding: 0; max-width: 34em; }
.signin { display: grid; place-items: center; padding: 40px 28px; }
.login { width: 100%; max-width: 390px; background: transparent; border: 0; padding: 0; box-shadow: none; }
.login h2 { font-size: 34px; margin-bottom: 6px; font-weight: 600; }
.login input { background: var(--surface); border: 1px solid var(--line); }
.login input:focus { border-color: var(--brand); }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; min-height: 0; }
  .panel-brand { padding: 24px 22px 28px; gap: 22px; }
  .pitch h1 { font-size: 32px; }
  .pitch .lead { font-size: 16px; }
  .plain, .panel-brand .foot { display: none; }
  .signin { padding: 28px 22px 40px; place-items: start center; }
}

/* sidebar */
.side { background: var(--deep); border-right: 0; }
.side .cname { color: #fff; font-family: var(--serif); font-weight: 600; font-size: 17px; line-height: 1.2; letter-spacing: 0; }
.side .mark { background: rgba(255,255,255,.12); }
.nav { color: rgba(255,255,255,.72); border-radius: 8px; font-weight: 500; }
.nav:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav.on { background: rgba(255,255,255,.14); color: #fff; }
.who { background: rgba(255,255,255,.08); border-radius: 10px; }
.who b { color: #fff; } .who small { color: rgba(255,255,255,.6); }
.who .out { color: rgba(255,255,255,.7); } .who .out:hover { background: rgba(255,255,255,.12); color: #fff; }
.avatar { background: rgba(255,255,255,.18); color: #fff; }
.logo img.brand { width: 46px; height: 46px; }

/* welcome: a letter-like greeting and a ruled list of questions */
#welcome h1 { font-size: clamp(30px, 3.6vw, 42px); font-weight: 600; margin-bottom: 10px; }
#welcome p { font-size: 17px; max-width: 34em; }
.stats { gap: 0; margin-bottom: 26px; }
.stat { background: none; border: 0; padding: 0 18px 0 0; margin-right: 18px; border-right: 1px solid var(--line); border-radius: 0; font-size: 15px; color: var(--mute); }
.stat:last-child { border-right: 0; }
.stat b { font-size: 15px; color: var(--ink); }
.stat .tag { background: none; padding: 0; color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; }
.ideas { display: grid; grid-template-columns: 1fr 1fr; column-gap: 44px; row-gap: 0; border-bottom: 1px solid var(--line); }
.idea { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 17px 2px; font-size: 17px; font-weight: 500; justify-content: space-between; text-align: left; width: 100%; }
.idea::after { content: "\2192"; color: var(--accent); margin-left: 16px; flex: none; }
.idea:hover { background: transparent; border-color: var(--line); color: var(--brand); }
.idea:hover::after { transform: translateX(3px); }
.ideas .idea:nth-last-child(-n+2) { border-bottom: 0; }

/* the thread: questions as headings, answers as pages */
#msgs { gap: 22px; }
.m.user { align-self: stretch; max-width: 100%; background: none; color: var(--ink); padding: 22px 0 0; border-radius: 0; border-top: 1px solid var(--line); font-family: var(--serif); font-size: 23px; line-height: 1.3; font-weight: 600; box-shadow: none; }
.m.user:first-child { border-top: 0; padding-top: 4px; }
.m.user::before { content: "Question"; display: block; font: 700 11px/1 "Source Sans 3", sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.m.bot > .mark { display: none; }
.card { border-radius: 10px; background: var(--surface); padding: 22px 24px; }
.sum p { font-size: 17.5px; }
.card .lbl { font-family: "Source Sans 3", sans-serif; letter-spacing: .12em; }
.conf, .notfound, .cite, .num { border-radius: 6px; }
.expand { background: transparent; }
.fb button { font-size: 14px; border-radius: 8px; padding: 5px 14px; color: var(--mute); }

/* composer */
.dock .in { border-radius: 10px; padding: 7px 7px 7px 18px; border: 1px solid var(--line); background: var(--surface); }
.dock .in:focus-within { border-color: var(--brand); }
.dock .send { border-radius: 8px; background: var(--brand); }

/* panels and lists */
.head h1 { font-weight: 600; }
.panel { border-radius: 10px; background: var(--surface); }
@media (max-width: 600px) {
  .m.user { font-size: 20px; }
  #welcome h1 { font-size: 28px; }
  .ideas { grid-template-columns: 1fr; }
  .ideas .idea:nth-last-child(2) { border-bottom: 0; }
  .stats { flex-wrap: wrap; row-gap: 6px; }
}
.warnbar { margin: 0 0 18px; padding: 14px 16px; border-radius: 8px; background: color-mix(in srgb, #b3382c 10%, var(--surface)); border: 1px solid color-mix(in srgb, #b3382c 40%, var(--line)); font-size: 15px; }
.warnbar code { background: var(--surface2); padding: 1px 6px; border-radius: 4px; }

/* ======== warmer palette and topic cards ======== */
:root { --bg: #f7f3ea; --coral: #c85f42; --ochre: #cf9a2c; --sage: #5d8f6a; --sand: #f0d9a8; }
.hero h1 em, #welcome h1 em { color: var(--coral); }
.pitch h1 { color: #fff; }
.pitch h1 span { color: var(--sand); }
#welcome { padding-top: 2.5vh; }
.ideas { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; border: 0; }
.topic { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--tc, var(--brand)); border-radius: 10px; padding: 16px 18px 8px; box-shadow: 0 1px 2px rgba(23,38,43,.05); text-align: left; }
.topic h3 { font-size: 19px; font-weight: 600; margin: 0 0 6px; }
.topic .q { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 11px 0; font-size: 16px; line-height: 1.35; color: var(--ink); }
.topic .q::after { content: "\2192"; color: var(--tc, var(--accent)); flex: none; transition: transform .15s; }
.topic .q:hover { color: var(--brand); }
.topic .q:hover::after { transform: translateX(3px); }
.stat .tag { color: var(--coral); }
/* answers: a quiet label with a colored edge instead of a loud pill */
.conf { background: var(--surface2) !important; color: var(--ink) !important; font-weight: 600; border-left: 4px solid var(--accent); border-radius: 6px; padding: 5px 12px; }
.conf.high { border-left-color: var(--sage); } .conf.medium { border-left-color: var(--ochre); } .conf.low { border-left-color: var(--coral); }
.notfound { background: color-mix(in srgb, var(--ochre) 16%, var(--surface)); color: var(--ink); }
.nav.on { box-shadow: inset 3px 0 0 var(--sand); }
@media (max-height: 820px) { .topic .q:nth-child(4) { display: none; } }
@media (max-width: 860px) { .ideas { grid-template-columns: 1fr; } .topic .q:nth-child(4) { display: flex; } }
