:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f9fbff;
  --sidebar: #f1f5fb;
  --sidebar-strong: #e8eff9;
  --text: #111827;
  --muted: #6b7280;
  --muted-2: #94a3b8;
  --border: #dce5f2;
  --accent: #1769e0;
  --accent-2: #0f5cc8;
  --accent-soft: #e7f0ff;
  --accent-soft-2: #dceaff;
  --user-bg: #e9f2ff;
  --danger: #dc2626;
  --code-bg: #0f172a;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 18px 45px rgba(37, 99, 235, .13);
}

[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #101827;
  --surface-2: #111c2f;
  --sidebar: #0f1726;
  --sidebar-strong: #15233a;
  --text: #e8eef8;
  --muted: #a1aec2;
  --muted-2: #71809a;
  --border: #273852;
  --accent: #60a5fa;
  --accent-2: #3b82f6;
  --accent-soft: #17345d;
  --accent-soft-2: #1f3f6e;
  --user-bg: #17345f;
  --danger: #fb7185;
  --code-bg: #080d17;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .24);
  --shadow: 0 20px 55px rgba(0, 0, 0, .38);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  overflow: hidden;
  letter-spacing: 0;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell { height: 100dvh; width: 100%; display: flex; overflow: hidden; }

.sidebar {
  width: 320px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--sidebar) 76%, var(--surface));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 30;
  transition: transform .22s ease;
}

.sidebar-profile {
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(145deg, var(--accent), #38bdf8);
  color: #fff;
  font-size: .78rem;
  font-weight: 850;
  box-shadow: 0 8px 22px rgba(23, 105, 224, .20);
}
.profile-avatar.small {
  width: 34px;
  height: 34px;
  font-size: .78rem;
}
.profile-name {
  min-width: 0;
  flex: 1;
  color: var(--text);
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-icon {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-icon:hover { background: var(--sidebar-strong); color: var(--text); }

.sidebar-actions {
  padding: 0 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-action {
  width: 100%;
  height: 44px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-size: .96rem;
  transition: background .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.sidebar-action svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-action span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-action kbd {
  color: var(--muted-2);
  font-size: .78rem;
  font-family: inherit;
  font-weight: 500;
}
.sidebar-action .chevron {
  width: 18px;
  height: 18px;
  color: var(--muted-2);
}
.sidebar-action:hover,
.sidebar-action.primary {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--accent) 7%, var(--border));
  box-shadow: 0 9px 22px rgba(15, 23, 42, .06);
}
.sidebar-action:hover { color: var(--accent-2); }

.sidebar-search { padding: 0 14px 12px; }
.sidebar-search input {
  width: 100%;
  height: 36px;
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  background: color-mix(in srgb, var(--surface) 74%, var(--sidebar-strong));
  color: var(--text);
  border-radius: 9px;
  padding: 0 12px 0 34px;
  outline: none;
  font-size: .84rem;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m16.5 16.5 4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px 50%;
}
.sidebar-search input:focus {
  border-color: var(--accent);
  background-color: var(--surface);
}

.history-label {
  padding: 14px 22px 8px;
  color: var(--muted);
  font-size: .8rem;
}

.conversation-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 10px 12px;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conversation-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  min-height: 40px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  transition: background .15s, border-color .15s;
}
.conversation-item:hover { background: color-mix(in srgb, var(--surface) 72%, var(--sidebar-strong)); }
.conversation-item.active { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-sm); }
.conversation-icon {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--surface);
  justify-self: center;
  align-self: center;
}
.conversation-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.conversation-title { font-size: .9rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; align-self: center; }
.delete-conv { border: none; background: transparent; color: var(--muted-2); opacity: 0; width: 24px; height: 24px; border-radius: 7px; }
.conversation-item:hover .delete-conv { opacity: 1; }
.delete-conv:hover { color: var(--danger); background: var(--accent-soft); }
.sidebar-empty { color: var(--muted); font-size: .82rem; padding: 12px; }
.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--surface) 54%, transparent);
}
.account-chip {
  min-width: 0;
  flex: 1;
  height: 42px;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 0 7px;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
}
.account-chip span:not(.profile-avatar) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-chip svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted-2);
}
.account-chip:hover { background: var(--sidebar-strong); }
.logout-link { display: none; color: var(--muted); background: transparent; border: none; font-size: .82rem; padding: 0 8px; }
body.web-auth-enabled .logout-link { display: inline-flex; align-items: center; }

.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .36); z-index: 20; }
.chat-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100dvh; background: var(--bg); }
body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  margin-right: -320px;
}
body.sidebar-collapsed .mobile-menu { display: inline-flex; }
.mobile-menu { display: none; }

header {
  height: 58px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, var(--surface));
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  z-index: 10;
}
header h1 { font-size: 1.02rem; font-weight: 760; letter-spacing: 0; }
header .badge { font-size: .7rem; background: var(--accent-soft); color: var(--accent-2); padding: 4px 9px; border-radius: 999px; font-weight: 700; }
header .spacer { flex: 1; }
header button {
  min-width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
  border-radius: 12px;
  font-size: 1.18rem;
  transition: background .15s ease, color .15s ease, transform .15s ease;
  box-shadow: none;
}
header button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}
header button:hover { background: color-mix(in srgb, var(--accent-soft) 65%, transparent); color: var(--accent); transform: translateY(-1px); }
header button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#conv-id { display: none; }

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px max(22px, calc((100vw - 1040px) / 2)) 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  scroll-behavior: smooth;
}
#messages::-webkit-scrollbar, .conversation-list::-webkit-scrollbar { width: 7px; }
#messages::-webkit-scrollbar-thumb, .conversation-list::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--border) 70%, var(--muted)); border-radius: 999px; }

.msg { display: flex; gap: 13px; max-width: 820px; width: 100%; animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.assistant { align-self: center; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .76rem;
  font-weight: 900;
  flex-shrink: 0;
  background: linear-gradient(145deg, var(--accent), #36a3ff);
  color: #fff;
  box-shadow: 0 8px 22px rgba(23, 105, 224, .18);
}
.msg.user .avatar { display: none; }
.bubble-wrap { position: relative; max-width: 100%; min-width: 60px; }
.bubble { padding: 0; border-radius: 18px; line-height: 1.68; font-size: .96rem; word-break: break-word; }
.msg.user .bubble { background: var(--user-bg); padding: 11px 15px; max-width: min(680px, 78vw); border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border)); box-shadow: var(--shadow-sm); }

.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble code { background: var(--accent-soft); color: var(--accent-2); padding: 2px 5px; border-radius: 5px; font-size: .84rem; font-family: "JetBrains Mono", Consolas, monospace; }
.code-block { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin: 10px 0; background: var(--code-bg); box-shadow: var(--shadow-sm); }
.code-toolbar { height: 34px; padding: 0 9px 0 12px; display: flex; align-items: center; justify-content: space-between; background: #111827; border-bottom: 1px solid #263244; color: #cbd5e1; font-size: .72rem; }
.bubble .copy-code { background: #1f2937; border: 1px solid #334155; color: #cbd5e1; padding: 3px 9px; border-radius: 7px; font-size: .68rem; }
.bubble pre { padding: 13px 14px; overflow-x: auto; margin: 0; font-size: .82rem; line-height: 1.55; color: #dbeafe; }
.bubble pre code { background: transparent; color: inherit; padding: 0; font-size: inherit; white-space: pre; }
.bubble ul, .bubble ol { padding-left: 21px; margin: 5px 0; }
.bubble strong { color: var(--accent-2); font-weight: 760; }
.bubble blockquote { border-left: 3px solid var(--accent); padding-left: 11px; margin: 7px 0; color: var(--muted); }
.bubble h1, .bubble h2, .bubble h3 { margin: 12px 0 7px; font-weight: 760; line-height: 1.3; }
.bubble h1 { font-size: 1.2rem; }
.bubble h2 { font-size: 1.08rem; }
.bubble h3 { font-size: .98rem; }
.bubble a { color: var(--accent); text-decoration: underline; }
.bubble hr {
  height: 1px;
  border: 0;
  margin: 18px 0;
  background:
    linear-gradient(
      90deg,
      transparent,
      color-mix(in srgb, var(--border) 72%, transparent) 14%,
      color-mix(in srgb, var(--accent) 32%, var(--border)) 50%,
      color-mix(in srgb, var(--border) 72%, transparent) 86%,
      transparent
    );
}
.bubble hr:first-child { margin-top: 6px; }
.bubble hr:last-child { margin-bottom: 6px; }
.table-wrap { overflow-x: auto; margin: 8px 0; }
.bubble table { border-collapse: collapse; width: 100%; min-width: 320px; font-size: .84rem; }
.bubble th, .bubble td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
.bubble th { background: var(--accent-soft); font-weight: 700; }

.thinking-block { margin-bottom: 10px; border-radius: 13px; overflow: visible; background: transparent; }
.thinking-header {
  min-height: 36px;
  padding: 5px 6px 5px 12px;
  background: color-mix(in srgb, var(--accent-soft) 74%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border));
  border-radius: 12px;
  cursor: pointer;
  font-size: .82rem;
  color: var(--muted);
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.thinking-header:hover {
  background: color-mix(in srgb, var(--accent-soft) 88%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
}
.thinking-header:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.thinking-title { font-weight: 640; color: color-mix(in srgb, var(--text) 42%, var(--muted)); }
.thinking-body {
  padding: 10px 12px;
  margin-top: 7px;
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.58;
  white-space: pre-wrap;
  display: none;
  border: 1px solid color-mix(in srgb, var(--accent) 8%, var(--border));
  border-radius: 11px;
  background: color-mix(in srgb, var(--surface) 88%, var(--accent-soft));
  max-height: 220px;
  overflow-y: auto;
}
.thinking-block.open .thinking-body { display: block; }
.thinking-block.open .thinking-arrow { transform: rotate(180deg); }
.thinking-arrow {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted-2);
  transition: transform .18s ease, background-color .16s ease, color .16s ease;
}
.thinking-arrow svg { width: 14px; height: 14px; stroke-width: 2.25; }
.thinking-header:hover .thinking-arrow,
.thinking-block.open .thinking-arrow {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}
.streaming-content { min-height: 1em; }
.bubble.streaming::after { content: "▌"; animation: blink .8s infinite; color: var(--accent); margin-left: 2px; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

.msg-actions { display: flex; gap: 6px; margin-top: 6px; opacity: 0; transition: opacity .18s; }
.msg:hover .msg-actions, .bubble-wrap:hover .msg-actions { opacity: 1; }
.msg-actions button { background: var(--surface); border: 1px solid var(--border); color: var(--muted); padding: 3px 8px; border-radius: 8px; font-size: .68rem; box-shadow: var(--shadow-sm); }
.msg-actions button:hover { border-color: var(--accent); color: var(--accent); }

footer {
  padding: 12px max(18px, calc((100vw - 900px) / 2)) 18px;
  display: block;
  flex-shrink: 0;
  z-index: 10;
}
.composer-main {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: 28px;
  box-shadow: 0 18px 45px rgba(23, 105, 224, .10), 0 1px 2px rgba(15, 23, 42, .04);
  overflow: hidden;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.composer-main:focus-within {
  border-color: color-mix(in srgb, var(--accent) 72%, #9fc5ff);
  box-shadow: 0 18px 48px rgba(23, 105, 224, .14), 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent);
}
footer textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 18px 22px 10px;
  font-size: .95rem;
  outline: none;
  resize: none;
  min-height: 58px;
  max-height: 150px;
  line-height: 1.45;
  display: block;
}
.composer-toolbar {
  min-height: 48px;
  padding: 2px 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.composer-tools,
.composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.composer-tools {
  flex: 1;
  overflow-x: auto;
  padding: 3px 0;
  margin: -3px 0;
  scrollbar-width: none;
}
.composer-tools::-webkit-scrollbar { display: none; }
.composer-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex-shrink: 0;
}
.composer-tool {
  height: 34px;
  border: 1px solid transparent;
  background: transparent;
  color: color-mix(in srgb, var(--text) 86%, var(--muted));
  border-radius: 999px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: .86rem;
  white-space: nowrap;
  flex-shrink: 0;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  transition:
    background-color .18s ease,
    border-color .18s ease,
    color .18s ease,
    box-shadow .22s ease,
    transform .22s cubic-bezier(.2, .8, .2, 1);
}
.composer-tool span {
  font-size: .98rem;
  line-height: 1;
}
.composer-tool.icon-only {
  width: 34px;
  padding: 0;
  border-color: transparent;
  font-size: 1.25rem;
}
.composer-tool:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent) 18%, var(--border));
  transform: translate3d(0, -1.5px, 0);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 12%, transparent);
}
.composer-tool:active:not(:disabled) { transform: translate3d(0, -.5px, 0); }
.composer-tool.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border));
  color: var(--accent-2);
  font-weight: 700;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 8%, transparent),
    0 5px 14px color-mix(in srgb, var(--accent) 10%, transparent);
}
.composer-tool:disabled {
  opacity: .45;
  cursor: default;
}
footer button.circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .16s;
  background: #1677ff;
  border: none;
  color: #fff;
  font-size: 1rem;
  box-shadow: 0 12px 28px rgba(22, 119, 255, .24);
}
footer button.circle svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
footer button.circle:hover:not(:disabled) { transform: translateY(-2px); background: #0969da; }
footer button.circle:disabled { background: #d7dee8; color: #fff; box-shadow: none; cursor: default; }
footer button.circle.stop { background: #475569; }
#stop-btn { display: none; }
#stop-btn.visible { display: flex; }
.char-count { font-size: .66rem; color: var(--muted); min-width: 30px; text-align: right; }
body.dragging .composer-main { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent), var(--shadow); }

.attachment-tray { display: none; gap: 8px; flex-wrap: wrap; padding: 11px 13px 0; }
.attachment-tray:not(:empty) { display: flex; }
.attachment-chip { display: flex; align-items: center; gap: 8px; max-width: 250px; border: 1px solid var(--border); background: var(--accent-soft); border-radius: 14px; padding: 7px 9px; font-size: .76rem; }
.attachment-thumb, .attachment-icon { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; background: var(--surface); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.attachment-meta { min-width: 0; }
.attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size { color: var(--muted); font-size: .68rem; }
.attachment-remove { border: none; background: transparent; color: var(--muted); font-size: .95rem; }
.attachment-remove:hover { color: var(--danger); }
.msg-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.msg-attachment { border: 1px solid var(--border); background: var(--accent-soft); border-radius: 13px; padding: 7px 9px; font-size: .75rem; display: flex; align-items: center; gap: 8px; max-width: 270px; }
.msg-attachment img { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; }

.settings-panel {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 11px 22px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  font-size: .82rem;
}
.settings-row { display: flex; align-items: center; gap: 8px; }
.settings-row label { color: var(--muted); white-space: nowrap; }
.settings-row input[type=range] { width: 105px; accent-color: var(--accent); }
.settings-row input[type=number] { width: 84px; background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 5px 8px; border-radius: 8px; font-size: .8rem; }
.settings-row span { color: var(--accent); min-width: 30px; text-align: center; }

.empty { text-align: center; color: var(--muted); margin-top: 12vh; padding: 0 20px; }
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--accent), #36a3ff);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 14px 35px rgba(23, 105, 224, .24);
}
.brand-mark.large { width: 58px; height: 58px; border-radius: 16px; font-size: 1.28rem; margin-bottom: 16px; }
.empty h2 { font-size: 1.38rem; font-weight: 760; color: var(--text); margin-bottom: 22px; letter-spacing: 0; }
.suggestions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 560px; margin: 0 auto; }
.suggestions button { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 9px 17px; border-radius: 999px; font-size: .84rem; box-shadow: var(--shadow-sm); }
.suggestions button:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-2); transform: translateY(-1px); }

.scroll-bottom-btn {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  z-index: 5;
  opacity: 0;
  transition: opacity .18s;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}
.scroll-bottom-btn.visible { opacity: .9; }

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 92%, white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-screen.hidden { display: none; }
.auth-panel {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.auth-panel h1 { font-size: 1.35rem; letter-spacing: 0; }
.auth-panel p { color: var(--muted); font-size: .9rem; }
.auth-panel input { height: 44px; border: 1px solid var(--border); border-radius: 10px; padding: 0 13px; background: var(--surface); color: var(--text); outline: none; }
.auth-panel input:focus { border-color: var(--accent); }
.auth-panel button { height: 44px; border: none; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 760; }
.auth-error { min-height: 18px; color: var(--danger); font-size: .78rem; }

@media (max-width: 720px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(320px, 88vw); transform: translateX(-100%); box-shadow: 2px 0 22px rgba(15, 23, 42, .24); }
  body.sidebar-collapsed .sidebar { margin-right: 0; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-profile .sidebar-icon { display: inline-flex; align-items: center; justify-content: center; }
  .mobile-menu { display: inline-flex; }
  header { height: 52px; padding: 0 11px; gap: 6px; }
  header h1 { font-size: .92rem; }
  header button { min-width: 38px; height: 38px; }
  #messages { padding: 18px 13px; gap: 18px; }
  .msg { max-width: 100%; }
  .bubble { font-size: .92rem; }
  .msg.user .bubble { max-width: 86vw; }
  footer { padding: 9px 10px 12px; }
  .composer-main { border-radius: 24px; }
  footer textarea { min-height: 48px; padding: 15px 16px 8px; }
  .composer-toolbar { padding: 2px 9px 9px; gap: 8px; }
  .composer-tools { gap: 5px; }
  .composer-tool { height: 32px; padding: 0 9px; font-size: .78rem; }
  .composer-tool:hover:not(:disabled) { transform: translate3d(0, -1px, 0); }
  .composer-tool.icon-only { width: 32px; font-size: 1.12rem; }
  .composer-divider { height: 20px; }
  footer button.circle { width: 38px; height: 38px; }
  footer button.circle svg { width: 21px; height: 21px; }
  .char-count { display: none; }
}
