.lim-chat {
  --card: #090909;
  --ink: #f2f2f2;
  --muted: #737373;
  --line: #2a2a2a;
  --line-soft: #1c1c1c;
  --hover: transparent;
  --orange: #f2f2f2;
  --orange-soft: transparent;
  --blue: #d4d4d4;
  position: fixed;
  right: 18px;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  z-index: 100003;
  font-family: "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  user-select: text;
}
.lim-chat-skip {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.lim-chat-open[hidden] { display: none; }
.lim-chat-open {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.lim-chat-open:hover,
.lim-chat-open:focus-visible { border-color: var(--orange); }
.lim-chat-icon { width: 30px; height: 30px; display: block; }
.lim-chat-panel[hidden] { display: none; }
.lim-chat-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(380px, calc(100vw - 24px));
  height: min(520px, calc(100vh - 140px));
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
}
.lim-chat-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.lim-chat-bar strong { display: block; font-size: 15px; }
.lim-chat-bar p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.lim-chat-close {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  width: 44px;
  height: 44px;
  cursor: pointer;
}
.lim-chat-log {
  flex: 1;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lim-chat-msg {
  max-width: 92%;
  padding: 2px 0;
  border-radius: 0;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 15px;
  background: transparent;
}
.lim-chat-msg--user { align-self: flex-end; color: #fff; }
.lim-chat-msg--bot { align-self: flex-start; color: #c8c8c8; }
.lim-chat-msg--wait { color: var(--muted); font-style: italic; }
.lim-chat-msg a { color: var(--blue); word-break: break-word; }
.lim-chat-sources { margin-top: 8px; }
.lim-chat-sources > button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.lim-chat-source-list { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; font-size: 12px; }
.lim-chat-source-list[hidden] { display: none; }
.lim-chat-source-list a { color: var(--blue); }
.lim-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line-soft);
}
.lim-chat-form textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
}
.lim-chat-form textarea::placeholder { color: #5c5c5c; }
.lim-chat-form button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 0 0 16px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.lim-chat-form button:disabled { opacity: 0.55; cursor: wait; }

html:has(body.chat-only) {
  background: #090909;
  color-scheme: dark;
}
body.chat-only {
  background: #090909;
  color: #f2f2f2;
  color-scheme: dark;
}
body.chat-only .shell,
body.chat-only .drawer,
body.chat-only .drawer-backdrop { display: none; }
body.chat-only .lim-chat {
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
}
body.chat-only .lim-chat-open { display: none; }
body.chat-only .lim-chat-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
body.chat-only .lim-chat-bar,
body.chat-only .lim-chat-log,
body.chat-only .lim-chat-form {
  width: 100%;
  max-width: none;
}
body.chat-only .lim-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}
body.chat-only .lim-chat-panel[hidden] { display: none; }
body.chat-only .lim-chat-close { display: none; }
