:root {
  --bg: #f4f7f8; --panel: #ffffff; --text: #17282c; --muted: #557479; --line: #dbe5e7;
  --accent: #0f7a6c; --accent-ink: #ffffff; --user: #e6f3f1; --err: #b3261e; --code: #eef3f4;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1719; --panel: #172226; --text: #e4eef0; --muted: #9db4b8; --line: #2a3a3e;
    --accent: #3cc2ad; --accent-ink: #062320; --user: #1c3431; --err: #ff8a80; --code: #1f2d31; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; }
.muted { color: var(--muted); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent);
  color: var(--accent-ink); padding: 8px 14px; }
button:disabled { opacity: .5; cursor: progress; }
button.ghost { background: transparent; color: var(--text); border-color: var(--line); padding: 6px 10px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.top-right form { margin: 0; }
.chip { font-size: 12px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px;
  width: 100%; max-width: 920px; margin: 0 auto; }
.empty { text-align: center; margin: auto 0; padding: 24px 0; }
.empty h2 { margin: 0 0 6px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.examples .ex { background: var(--panel); color: var(--text); border-color: var(--line); text-align: left; }
.msg { padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); max-width: 100%;
  overflow-wrap: anywhere; }
.msg.user { background: var(--user); align-self: flex-end; max-width: 85%; }
.msg .body > :first-child { margin-top: 0; } .msg .body > :last-child { margin-bottom: 0; }
.msg table { border-collapse: collapse; display: block; overflow-x: auto; }
.msg th, .msg td { border: 1px solid var(--line); padding: 4px 8px; }
.msg code, .msg pre { background: var(--code); border-radius: 6px; }
.msg code { padding: 1px 4px; } .msg pre { padding: 10px; overflow-x: auto; }
.reasoning { margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.reasoning pre { white-space: pre-wrap; max-height: 260px; overflow-y: auto; }
.typing { color: var(--muted); font-style: italic; }
.stats { margin-top: 8px; font-size: 12px; color: var(--muted); }
.composer { background: var(--panel); border-top: 1px solid var(--line); padding: 10px 16px; }
.composer form { max-width: 920px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
textarea { width: 100%; resize: vertical; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.composer-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.toggle { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.fine { max-width: 920px; margin: 6px auto 0; font-size: 12px; }
.login-body { align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: 100%;
  max-width: 380px; display: flex; flex-direction: column; gap: 6px; }
.login-card h1 { margin: 8px 0 0; font-size: 22px; }
.login-card form { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.login-card input { font: inherit; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); }
.login-card button { margin-top: 10px; }
.error { color: var(--err); margin: 4px 0; }
.sources, .tools { margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.sources ol, .tools ul { margin: 6px 0 0; padding-left: 20px; }
.sources a { color: var(--accent); }
.tools li { font-family: ui-monospace, monospace; font-size: 12px; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .top { padding: 8px 12px; gap: 6px; flex-wrap: nowrap; }
  .top .brand { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .top .chip { display: none; }
  .top-right { flex-wrap: nowrap; gap: 6px; }
  button.ghost { padding: 5px 9px; font-size: 14px; }
  .composer { padding: 8px 12px; }
}
