:root {
  color-scheme: light dark;
  --bg: #f6f6f4;
  --panel: #ffffff;
  --ink: #14161a;
  --muted: #6b7280;
  --line: #e4e4e1;
  --accent: #1f6feb;
  --bubble-user: #1f6feb;
  --bubble-user-ink: #ffffff;
  --bubble-bot: #f1f1ef;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f11;
    --panel: #17181b;
    --ink: #ececec;
    --muted: #9aa0a6;
    --line: #2a2c31;
    --bubble-bot: #212227;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; justify-content: center;
  min-height: 100dvh;
}
.shell {
  width: min(760px, 100%);
  display: flex; flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  min-height: 100dvh;
}
.head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--panel); z-index: 2;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }
.brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 20%, transparent); }
.brand h1 { display: flex; align-items: center; gap: 9px; }
.logo {
  display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center;
  border: 1.5px solid var(--logo-accent, var(--accent)); border-radius: 7px;
  background: var(--logo-bg, transparent); color: var(--logo-accent, var(--accent)); overflow: hidden;
}
.logo[hidden] { display: none; }
.logo-icon { display: inline-flex; width: 16px; height: 16px; will-change: transform, opacity; }
.controls { display: flex; align-items: center; gap: 8px; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang button {
  border: 0; background: transparent; color: var(--muted);
  padding: 5px 11px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.lang button.on { background: var(--ink); color: var(--panel); }
.ghost {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  width: 30px; height: 30px; border-radius: 999px; cursor: pointer; font-size: 14px;
}
.log { flex: 1; padding: 20px 18px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--bubble-user); color: var(--bubble-user-ink); border-bottom-right-radius: 5px; }
.msg.bot { align-self: flex-start; background: var(--bubble-bot); border-bottom-left-radius: 5px; }
.msg.err { align-self: flex-start; background: #fee2e2; color: #7f1d1d; font-size: 13.5px; }
.msg table { border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.msg td, .msg th { border: 1px solid var(--line); padding: 4px 8px; }
.status { align-self: flex-start; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.status .spin { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1); } }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 4px; }
.suggestions button {
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.suggestions button:hover { border-color: var(--accent); color: var(--accent); }
.composer { display: flex; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; max-height: 140px;
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 13px;
  background: transparent; color: var(--ink); font: inherit;
}
.composer textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 1px; }
.composer button {
  width: 40px; height: 40px; border-radius: 12px; border: 0;
  background: var(--accent); color: #fff; font-size: 17px; cursor: pointer;
}
.composer button:disabled { opacity: .45; cursor: default; }
.fineprint { margin: 0; padding: 0 18px 14px; font-size: 11.5px; color: var(--muted); }
