:root {
  color-scheme: light;
  font-family: Inter, "SF Pro Text", "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  --bg: #eef1f5;
  --bg-deep: #e8ecf1;
  --surface: rgba(248, 250, 252, .76);
  --surface-strong: #f8fafc;
  --surface-float: rgba(255, 255, 255, .88);
  --ink: #263343;
  --ink-strong: #172331;
  --muted: #7a8594;
  --muted-strong: #667282;
  --accent: #168779;
  --accent-dark: #0f6f64;
  --accent-soft: #dceeea;
  --accent-pale: #eaf5f2;
  --warm: #d8893b;
  --danger: #c24f49;
  --line: rgba(49, 65, 82, .09);
  --line-strong: rgba(49, 65, 82, .15);
  --shadow-sm: 0 8px 24px -18px rgba(35, 49, 65, .42);
  --shadow-md: 0 18px 50px -28px rgba(35, 49, 65, .42);
  --shadow-lg: 0 28px 80px -38px rgba(35, 49, 65, .48);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 6%, rgba(22, 135, 121, .08), transparent 28%),
    radial-gradient(circle at 94% 14%, rgba(96, 121, 160, .08), transparent 30%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

.app,
.chat {
  min-height: 100dvh;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.brand > span:last-child,
.account > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.brand strong {
  color: var(--ink-strong);
  font-size: 15px;
  font-weight: 720;
  letter-spacing: -.02em;
}

.brand small,
.account small {
  color: var(--muted);
  font-size: 11px;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #24a291, #126e65);
  box-shadow: 0 8px 20px -10px rgba(15, 111, 100, .7);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 9px;
  border-radius: 11px;
  color: var(--muted-strong);
  background: transparent;
  transition: color .16s ease, background .16s ease;
}

.icon-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, .58);
}

/* 登录页 */
.login {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  align-items: center;
  gap: clamp(48px, 8vw, 112px);
  width: min(1080px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 64px 0;
}

.login-copy {
  max-width: 650px;
}

.login-eyebrow {
  width: fit-content;
  margin-top: 78px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-pale);
  font-size: 12px;
  font-weight: 650;
}

.login-copy h1 {
  margin: 22px 0 20px;
  color: var(--ink-strong);
  font-size: clamp(44px, 6vw, 74px);
  font-weight: 710;
  line-height: 1.08;
  letter-spacing: -.065em;
}

.login-copy h1 em {
  color: var(--accent-dark);
  font-style: normal;
}

.login-copy > p {
  max-width: 590px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 17px;
  line-height: 1.8;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.trust-row span {
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, .55);
  font-size: 12px;
  box-shadow: var(--shadow-sm);
}

.trust-row span::before {
  content: "✓";
  margin-right: 6px;
  color: var(--accent);
  font-weight: 800;
}

.login-card {
  padding: 28px;
  border-radius: 26px;
  background: var(--surface-float);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px);
}

.login-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.login-card-head span {
  color: var(--ink-strong);
  font-size: 19px;
  font-weight: 700;
}

.login-card-head small {
  color: var(--muted);
  font-size: 11px;
}

.login-card label,
.memory-dialog label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 620;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid transparent;
  outline: none;
  color: var(--ink);
  background: rgba(236, 240, 244, .75);
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(22, 135, 121, .28);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(22, 135, 121, .08);
}

.login-card input {
  height: 46px;
  padding: 0 13px;
  border-radius: 13px;
}

.guest-btn,
.login-btn {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  font-weight: 680;
}

.guest-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 13px 28px -17px rgba(15, 111, 100, .82);
}

.guest-btn svg {
  width: 18px;
  height: 18px;
}

.login-btn {
  margin-top: 3px;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 11px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

#login-hint {
  min-height: 18px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 12px;
}

.login-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

/* 主布局 */
.chat {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.side {
  position: relative;
  z-index: 30;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px 14px 14px;
  background: rgba(231, 235, 240, .88);
  box-shadow: 14px 0 40px -38px rgba(35, 49, 65, .56);
  backdrop-filter: blur(24px);
}

.side-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 4px 14px;
}

.compact .brand-mark {
  flex-basis: 34px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.compact .brand-mark svg {
  width: 24px;
  height: 24px;
}

.side-close,
.menu-btn {
  display: none;
}

.new-thread {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  margin: 4px 0 18px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 12px 24px -17px rgba(15, 111, 100, .8);
}

.new-thread svg {
  width: 17px;
  height: 17px;
}

.side-section {
  min-height: 0;
}

.thread-section {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.side-label {
  padding: 0 9px 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 620;
}

.thread-list {
  display: grid;
  align-content: start;
  gap: 4px;
  overflow: auto;
  padding: 0 2px 10px;
}

.thread-list button {
  position: relative;
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  transition: background .16s ease, box-shadow .16s ease;
}

.thread-list button:hover {
  background: rgba(255, 255, 255, .4);
}

.thread-list button.active {
  background: rgba(255, 255, 255, .72);
  box-shadow: var(--shadow-sm);
}

.thread-list button.active::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 3px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.thread-list strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 610;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-list small,
.memory-item span,
.empty {
  color: var(--muted);
  font-size: 11px;
}

.memory-box {
  flex: 0 1 auto;
  max-height: 34%;
  margin-top: 5px;
  padding: 12px;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(255, 255, 255, .42);
}

.memory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.memory-head > div {
  display: grid;
  gap: 2px;
}

.memory-head strong {
  font-size: 12px;
  font-weight: 680;
}

.memory-head small {
  color: var(--muted);
  font-size: 10px;
}

.text-btn {
  padding: 6px 8px;
  border-radius: 9px;
  color: var(--accent-dark);
  background: var(--accent-pale);
  font-size: 11px;
  font-weight: 650;
}

#memory-list {
  display: grid;
  gap: 5px;
  max-height: 150px;
  overflow: auto;
}

.memory-item {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .55);
}

.memory-item strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-item span {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.empty {
  margin: 2px 0;
  line-height: 1.55;
}

.side-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 11px;
  padding: 10px 5px 0;
}

.account {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.account-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 720;
}

.account strong {
  overflow: hidden;
  max-width: 145px;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
}

.main {
  height: 100dvh;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    radial-gradient(circle at 50% 0, rgba(255, 255, 255, .52), transparent 38%),
    var(--bg);
}

.top {
  position: relative;
  z-index: 12;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 22px;
  background: rgba(238, 241, 245, .78);
  box-shadow: 0 13px 28px -28px rgba(35, 49, 65, .52);
  backdrop-filter: blur(20px);
}

.thread-heading {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
}

.agent-avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  color: var(--accent);
  filter: drop-shadow(0 7px 9px rgba(15, 111, 100, .12));
}

.thread-heading > div {
  min-width: 0;
}

.thread-heading h1 {
  overflow: hidden;
  max-width: min(420px, 38vw);
  margin: 0;
  color: var(--ink-strong);
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-heading small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-field {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.mode-field select {
  width: 112px;
  height: 36px;
  padding: 0 28px 0 10px;
  border-radius: 10px;
  color: var(--ink);
  background-color: rgba(255, 255, 255, .58);
  font-size: 11px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 570;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-track {
  position: relative;
  flex: 0 0 34px;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #c8d0d9;
  transition: background .18s ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(35, 49, 65, .16);
  transition: transform .18s ease;
}

.toggle input:checked + .toggle-track {
  background: var(--accent);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(14px);
}

.proactive-btn {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border-radius: 10px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 630;
}

.proactive-btn svg {
  width: 15px;
  height: 15px;
}

.conversation {
  min-height: 0;
  overflow: hidden;
}

.messages {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: auto;
  padding: 28px max(24px, calc((100% - 780px) / 2)) 36px;
  scrollbar-gutter: stable;
}

.messages::-webkit-scrollbar,
.thread-list::-webkit-scrollbar,
#memory-list::-webkit-scrollbar {
  width: 4px;
}

.messages::-webkit-scrollbar-thumb,
.thread-list::-webkit-scrollbar-thumb,
#memory-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(90, 105, 121, .13);
}

.msg {
  position: relative;
  display: flex;
  width: fit-content;
  max-width: min(680px, 84%);
  animation: message-in .24s var(--ease) both;
}

@keyframes message-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.msg > div {
  font-size: 14px;
  line-height: 1.72;
  white-space: normal;
  overflow-wrap: anywhere;
}

.msg.user {
  align-self: flex-end;
  margin: 3px 0 4px;
}

.msg.user > div {
  padding: 10px 14px;
  border-radius: 17px 17px 5px 17px;
  color: #173e39;
  background: #c9e5df;
  font-weight: 490;
  box-shadow: 0 5px 16px -14px rgba(15, 111, 100, .5);
}

.msg.assistant {
  align-self: stretch;
  width: auto;
  max-width: 100%;
  margin: 0 0 20px;
  padding-left: 45px;
}

.msg.assistant::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 0;
  width: 32px;
  height: 32px;
  border-radius: 11px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='8' y1='7' x2='56' y2='58' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23F1B45E'/%3E%3Cstop offset='1' stop-color='%23D97706'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect x='3' y='3' width='58' height='58' rx='19' fill='url(%23g)'/%3E%3Cpath d='M10 32h13l4-10 6 22 6-20 5 8h10' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E")
    center / cover no-repeat;
  box-shadow: 0 8px 18px -12px rgba(180, 99, 12, .7);
}

.msg.assistant > div {
  padding: 5px 0 0;
  color: #2b3747;
}

.msg.pending > div {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.thinking-dots {
  display: inline-flex;
  gap: 3px;
}

.thinking-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: think 1.1s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) { animation-delay: .14s; }
.thinking-dots i:nth-child(3) { animation-delay: .28s; }

@keyframes think {
  0%, 70%, 100% { opacity: .25; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-2px); }
}

.empty-state {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 430px;
  padding: 30px 0;
}

.empty-inner {
  width: min(610px, 100%);
  text-align: center;
}

.empty-logo {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 20px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(145deg, #27a392, #126e65);
  box-shadow: 0 14px 30px -18px rgba(15, 111, 100, .76);
}

.empty-logo svg {
  width: 40px;
  height: 40px;
}

.empty-state h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 680;
  letter-spacing: -.04em;
}

.empty-state p {
  max-width: 500px;
  margin: 11px auto 22px;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.7;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.quick-prompts button {
  padding: 9px 12px;
  border-radius: 12px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, .6);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  transition: color .16s ease, background .16s ease, transform .16s ease;
}

.quick-prompts button:hover {
  color: var(--accent-dark);
  background: #fff;
  transform: translateY(-1px);
}

.composer {
  position: relative;
  z-index: 10;
  width: min(780px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 13px;
}

.composer-card {
  padding: 10px 10px 8px 15px;
  border: 1px solid rgba(52, 66, 82, .08);
  border-radius: 21px;
  background: var(--surface-float);
  box-shadow: 0 16px 42px -28px rgba(35, 49, 65, .48);
  backdrop-filter: blur(20px);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.composer-card:focus-within {
  border-color: rgba(22, 135, 121, .19);
  box-shadow: 0 18px 48px -28px rgba(35, 49, 65, .58), 0 0 0 3px rgba(22, 135, 121, .04);
}

.composer textarea {
  min-height: 30px;
  max-height: 160px;
  padding: 4px 3px;
  resize: none;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  line-height: 1.55;
}

.composer textarea:focus {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.composer textarea::placeholder {
  color: #98a2af;
}

.composer-actions {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 3px;
}

.composer-hint {
  color: #a0a8b3;
  font-size: 10px;
}

#send-btn {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 7px 15px -9px rgba(15, 111, 100, .8);
  transition: transform .16s ease, opacity .16s ease, background .16s ease;
}

#send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--accent-dark);
}

#send-btn:disabled {
  cursor: default;
  opacity: .28;
}

.cloud-note {
  margin: 7px 0 0;
  color: #98a2af;
  font-size: 10px;
  text-align: center;
}

/* 记忆弹窗与提示 */
.memory-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: var(--ink);
  background: #f7f9fb;
  box-shadow: 0 30px 90px -35px rgba(22, 35, 48, .65);
}

.memory-dialog::backdrop {
  background: rgba(30, 41, 53, .28);
  backdrop-filter: blur(5px);
}

.memory-dialog form {
  padding: 24px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.dialog-head small {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}

.dialog-head h2 {
  margin: 4px 0 0;
  color: var(--ink-strong);
  font-size: 21px;
  letter-spacing: -.03em;
}

.dialog-head .icon-btn {
  padding: 0;
  font-size: 24px;
  font-weight: 350;
}

.memory-dialog textarea {
  padding: 12px 13px;
  border-radius: 13px;
  resize: vertical;
  line-height: 1.6;
}

.memory-dialog form > p {
  margin: -4px 0 18px;
  color: var(--muted);
  font-size: 11px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.secondary-btn,
.primary-btn {
  min-width: 82px;
  height: 38px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 650;
}

.secondary-btn {
  color: var(--muted-strong);
  background: var(--bg-deep);
}

.primary-btn {
  color: #fff;
  background: var(--accent);
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 11px 14px;
  border-radius: 12px;
  color: #fff;
  background: rgba(28, 40, 52, .92);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}

.toast.visible {
  opacity: 1;
  transform: none;
}

.sidebar-overlay {
  display: none;
}

.sidebar-overlay[hidden] {
  display: none !important;
  pointer-events: none !important;
}

@media (max-width: 980px) {
  .login {
    grid-template-columns: 1fr 360px;
    gap: 38px;
  }

  .chat {
    grid-template-columns: 1fr;
  }

  .side {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(290px, calc(100vw - 46px));
    transform: translateX(-105%);
    transition: transform .24s var(--ease);
  }

  body.sidebar-open .side {
    transform: none;
  }

  .sidebar-overlay {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: none;
    pointer-events: none;
    background: rgba(32, 43, 54, .2);
    backdrop-filter: blur(3px);
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
    pointer-events: auto;
  }

  .side-close,
  .menu-btn {
    display: grid;
  }
}

@media (max-width: 760px) {
  .login {
    grid-template-columns: 1fr;
    width: min(540px, calc(100vw - 32px));
    gap: 34px;
    padding: 30px 0 46px;
  }

  .login-eyebrow {
    margin-top: 48px;
  }

  .login-copy h1 {
    font-size: clamp(39px, 12vw, 58px);
  }

  .login-copy > p {
    font-size: 15px;
  }

  .login-card {
    padding: 22px;
  }

  .top {
    min-height: 62px;
    padding: 9px 12px;
  }

  .agent-avatar {
    display: none;
  }

  .thread-heading {
    gap: 7px;
  }

  .thread-heading h1 {
    max-width: 31vw;
  }

  .mode-field > span,
  .toggle-copy {
    display: none;
  }

  .mode-field select {
    width: 102px;
  }

  .proactive-btn {
    width: 36px;
    padding: 10px;
  }

  .proactive-btn span {
    display: none;
  }

  .messages {
    padding: 22px 16px 28px;
  }

  .msg {
    max-width: 90%;
  }

  .msg.assistant {
    max-width: 100%;
    padding-left: 41px;
  }

  .empty-state {
    min-height: 360px;
  }

  .empty-state p {
    font-size: 13px;
  }

  .quick-prompts {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .quick-prompts button {
    text-align: left;
  }

  .composer {
    width: calc(100% - 24px);
    padding-bottom: max(9px, env(safe-area-inset-bottom));
  }

  .composer-hint {
    display: none;
  }
}

@media (max-width: 430px) {
  .login-copy .brand small {
    display: none;
  }

  .trust-row {
    gap: 6px;
  }

  .trust-row span {
    padding: 7px 9px;
    font-size: 11px;
  }

  .thread-heading h1 {
    max-width: 25vw;
  }

  .top-actions {
    gap: 5px;
  }

  .mode-field select {
    width: 92px;
    padding-left: 8px;
  }

  .toggle-track {
    flex-basis: 32px;
    width: 32px;
  }

  .toggle input:checked + .toggle-track::after {
    transform: translateX(12px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
