:root {
  color-scheme: light;
  font: 16px/1.5 Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #20243b;
  background: #f5f6fa;
  --border: #dfe2ec;
  --muted: #565e76;
  --accent: #4b40b5;
  --accent-light: #efedff;
  --ink: #191c31;
  --sidebar: #202239;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid #7768eb; outline-offset: 3px; }
h1, h2, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.loading, .login-view { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.loading { color: var(--muted); }
.sign-in { width: min(100%, 420px); padding: clamp(24px, 6vw, 48px); background: #fff; border: 1px solid var(--border); border-radius: 24px; box-shadow: 0 18px 70px #2526510e; }
.brand-symbol { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #dcd7ff; color: #392884; font-weight: 750; font-family: Georgia, serif; flex: none; }
.sign-in h1 { margin-top: 16px; font-size: 1.7rem; }
.sign-in > p { margin-top: 3px; color: var(--muted); }
.sign-in form { display: grid; gap: 8px; margin-top: 26px; }
.sign-in label { font-weight: 600; }
.sign-in input { width: 100%; border: 1px solid var(--border); border-radius: 10px; background: #fbfbfd; padding: 10px 12px; color: var(--ink); margin-bottom: 9px; }
.primary { border: 0; border-radius: 10px; color: #fff; background: var(--accent); padding: 10px 16px; font-weight: 650; }
.primary:hover:not(:disabled) { background: #3b309a; }

.workspace { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: 100dvh; }
.sidebar { background: var(--sidebar); color: #f8f7ff; display: flex; flex-direction: column; gap: 22px; padding: 23px 16px 16px; min-width: 0; min-height: 0; }
.brand, .profile { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand { font-weight: 700; padding: 0 5px; }
.new-chat { text-align: left; background: #343652; border: 1px solid #565a7d; color: #fff; border-radius: 10px; padding: 9px 12px; }
.new-chat span { margin-right: 6px; }
.new-chat:hover { background: #45476b; }
.conversation-nav { min-height: 0; flex: 1; overflow: auto; }
.conversation-nav h2 { font-size: .78rem; font-weight: 650; color: #c2c3dc; padding: 0 8px 7px; }
.conversation-nav ul { list-style: none; margin: 0; padding: 0; }
.conversation-nav button { width: 100%; padding: 9px 10px; text-align: left; border: 0; border-radius: 8px; background: transparent; color: #e4e4f1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.conversation-nav button:hover, .conversation-nav button[aria-current="true"] { background: #393b5e; color: #fff; }
.profile { border-top: 1px solid #4b4d69; justify-content: space-between; padding: 14px 5px 2px; font-size: .875rem; }
.profile span { overflow: hidden; text-overflow: ellipsis; }
.profile button, .icon-button { border: 0; color: inherit; background: transparent; border-radius: 7px; padding: 6px 8px; flex: none; }
.profile button:hover { background: #393b5e; }
.sidebar-toggle, .sidebar-close { display: none; }
.chat { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; background: #fcfcff; }
.chat-header { min-height: 69px; display: flex; align-items: center; gap: 10px; padding: 14px clamp(16px, 4vw, 40px); border-bottom: 1px solid var(--border); }
.chat-header h1 { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header .model { margin-left: auto; flex: none; color: var(--accent); background: var(--accent-light); border-radius: 20px; font-size: .8rem; font-weight: 650; padding: 4px 10px; }
.chat-scroll { overflow: auto; min-height: 0; }
.welcome, .messages, .composer-wrap { width: min(100% - 32px, 760px); margin-inline: auto; }
.welcome { display: grid; align-content: center; justify-items: start; gap: 18px; min-height: 100%; padding-block: 30px; }
.welcome .brand-symbol { width: 50px; height: 50px; font-size: 1.4rem; }
.welcome h2 { font-size: clamp(1.65rem, 4vw, 2.3rem); letter-spacing: -.04em; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestion { border: 1px solid var(--border); background: #fff; border-radius: 10px; padding: 9px 12px; color: var(--ink); }
.suggestion:hover { border-color: #9388e7; background: #f8f7ff; }
.suggestion span { margin-left: 5px; color: var(--accent); }
.messages:empty { display: none; }
.messages { padding-block: 24px; display: grid; gap: 20px; }
.message { min-width: 0; width: fit-content; max-width: min(100%, 680px); }
.message.user { justify-self: end; max-width: min(90%, 610px); }
.message-label { color: var(--muted); font-size: .8rem; font-weight: 650; margin-bottom: 4px; }
.user .message-label { text-align: right; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.user .message-text { background: var(--accent-light); padding: 10px 14px; border-radius: 13px 13px 4px 13px; }
.pending .message-text { color: var(--muted); }
.composer-wrap { padding: 10px 0 13px; }
.composer { display: flex; gap: 8px; align-items: flex-end; background: #fff; border: 1px solid #cbcde1; border-radius: 15px; padding: 10px; }
.composer:focus-within { border-color: #9388e7; }
.composer textarea { width: 100%; min-width: 0; max-height: 130px; resize: vertical; min-height: 50px; padding: 5px; border: 0; background: transparent; color: var(--ink); }
.composer .primary { flex: none; }
.error { color: #a22845; overflow-wrap: anywhere; }
.composer-wrap .error { margin: 0 0 8px 3px; }
.keyboard-hint { font-size: .72rem; margin-top: 6px; text-align: center; color: var(--muted); }
@media (max-width: 680px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; position: fixed; inset: 0 auto 0 0; width: min(82vw, 285px); z-index: 3; }
  .workspace.sidebar-open .sidebar { display: flex; }
  .sidebar-toggle, .sidebar-close { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
  .sidebar-close { margin-left: auto; font-size: 1.25rem; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 2; border: 0; background: #14152970; }
  .chat-header { min-height: 60px; padding-block: 7px; }
}
