:root { color-scheme: light dark; --bg:#fafafa; --panel:#fff; --fg:#242424; --muted:#616161; --line:#e0e0e0;
  --accent:#c5001f; --me:#ebf3fc; --code:#f3f3f3; }
@media (prefers-color-scheme: dark) { :root { --bg:#1f1f1f; --panel:#292929; --fg:#f0f0f0; --muted:#adadad;
  --line:#3d3d3d; --accent:#ff4d5e; --me:#2b3a4a; --code:#333; } }
body.dark { --bg:#1f1f1f; --panel:#292929; --fg:#f0f0f0; --muted:#adadad; --line:#3d3d3d; --accent:#ff4d5e; --me:#2b3a4a; --code:#333; }
body.light { --bg:#fafafa; --panel:#fff; --fg:#242424; --muted:#616161; --line:#e0e0e0; --accent:#c5001f; --me:#ebf3fc; --code:#f3f3f3; }
* { box-sizing:border-box; }
html, body { height:100%; }
body { margin:0; background:var(--bg); color:var(--fg); font:14px/1.5 "Segoe UI",-apple-system,system-ui,sans-serif;
  display:flex; flex-direction:column; }
header { display:flex; align-items:center; justify-content:space-between; padding:10px 16px; border-bottom:1px solid var(--line); background:var(--panel); }
.brand { display:flex; gap:10px; align-items:center; }
.brand span#who { display:block; color:var(--muted); font-size:12px; }
.logo { background:var(--accent); color:#fff; font-weight:700; border-radius:6px; width:32px; height:32px;
  display:flex; align-items:center; justify-content:center; font-size:14px; }
button { font:inherit; cursor:pointer; }
#new { background:none; border:1px solid var(--line); color:var(--fg); border-radius:6px; padding:5px 12px; }
main { flex:1; overflow-y:auto; padding:16px; display:flex; flex-direction:column; gap:14px; }
.intro { max-width:640px; margin:24px auto; text-align:center; }
.intro h1 { font-size:20px; margin:0 0 6px; }
.intro p { color:var(--muted); margin:0 0 16px; }
.examples { display:flex; flex-direction:column; gap:8px; }
.examples button { background:var(--panel); border:1px solid var(--line); color:var(--fg); border-radius:8px; padding:8px 12px; text-align:left; }
.msg { max-width:860px; width:100%; margin:0 auto; }
.msg.user .bubble { background:var(--me); margin-left:auto; max-width:80%; width:fit-content; }
.bubble { background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:10px 14px; overflow-wrap:anywhere; }
.bubble p:first-child { margin-top:0; } .bubble p:last-child { margin-bottom:0; }
.bubble pre { background:var(--code); padding:8px; border-radius:6px; overflow-x:auto; }
.bubble code { background:var(--code); padding:1px 4px; border-radius:4px; }
.bubble pre code { padding:0; }
.bubble table { border-collapse:collapse; } .bubble td, .bubble th { border:1px solid var(--line); padding:3px 6px; }
.status { color:var(--muted); font-size:12px; margin-top:6px; }
.sources { margin-top:8px; font-size:12px; color:var(--muted); }
.sources summary { cursor:pointer; }
.sources li { margin:2px 0; }
form { display:flex; gap:8px; padding:12px 16px; border-top:1px solid var(--line); background:var(--panel); }
textarea { flex:1; resize:none; font:inherit; color:var(--fg); background:var(--bg); border:1px solid var(--line); border-radius:8px; padding:8px 10px; max-height:160px; }
#send { background:var(--accent); color:#fff; border:0; border-radius:8px; padding:0 18px; font-weight:600; }
#send:disabled { opacity:.5; cursor:default; }
#fatal { position:fixed; inset:0; background:var(--bg); display:flex; align-items:center; justify-content:center; padding:24px; text-align:center; }
#fatal a { color:var(--accent); font-weight:600; }
