:root {
  color-scheme: light;
  --base: #f3f6fa;
  --surface: #ffffff;
  --ink: #20334a;
  --muted: #627287;
  --blue: #245fd1;
  --blue-soft: #eaf0fd;
  --line: #dce4ee;
  --green: #18795e;
  --warning: #8b580d;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--base); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
button, input, textarea { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #86a9f1; outline-offset: 3px; }
.login-view { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 36px 24px; }
.login-panel { max-width: 380px; width: 100%; }
.brand-icon { border-radius: 15px; }
.login-panel h1 { font-size: 28px; line-height: 1.4; font-weight: 700; letter-spacing: -.6px; margin: 22px 0 16px; }
.login-intro { font-size: 20px; line-height: 1.65; margin: 0 0 38px; }
#login-form label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 9px; }
#password { width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid #b9c7d8; background: white; color: var(--ink); border-radius: 8px; }
#password::placeholder { color: #738297; font-size: 14px; }
.primary-button { margin-top: 15px; border: 0; background: var(--blue); color: white; min-height: 50px; width: 100%; border-radius: 8px; font-weight: 600; }
.form-error { color: #a63036; min-height: 24px; margin: 10px 0 0; font-size: 13px; }
.login-footnote { margin: 32px 0 0; font-size: 12px; line-height: 1.8; color: var(--muted); }
.app-view { display: grid; height: 100vh; height: 100dvh; grid-template-columns: 266px minmax(0, 1fr); grid-template-rows: 66px minmax(0, 1fr); }
.app-header { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; background: var(--surface); padding: 0 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 600; letter-spacing: -.3px; }
.quiet-button { color: var(--muted); border: 0; background: transparent; min-width: 44px; min-height: 44px; padding: 7px 10px; border-radius: 6px; font-size: 13px; }
.quiet-button:hover { background: var(--base); color: var(--ink); }
.session-sidebar { background: var(--base); border-right: 1px solid var(--line); padding: 25px 14px 20px; display: flex; flex-direction: column; min-height: 0; }
.sidebar-heading { padding: 0 10px 19px; }
.sidebar-heading h2 { font-size: 15px; margin: 0 0 3px; font-weight: 600; }
.private-label { color: var(--muted); font-size: 12px; }
.session-list { overflow-y: auto; min-height: 0; }
.session-item { display: block; width: 100%; text-align: left; padding: 13px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); margin: 0 0 7px; }
.session-item:hover { background: #e9eef6; }
.session-item.active { background: var(--surface); border-color: var(--line); }
.session-item-title { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-item-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 5px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #8e9bb0; flex-shrink: 0; }
.status-dot.online { background: var(--green); }
.sidebar-empty { padding: 12px 10px; color: var(--muted); font-size: 13px; }
.sidebar-note { color: var(--muted); font-size: 12px; line-height: 1.9; padding: 20px 10px 0; margin-top: auto; }
.chat-area { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--surface); min-width: 0; min-height: 0; }
.chat-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 32px 16px; border-bottom: 1px solid var(--line); }
.chat-heading h1 { font-size: 17px; font-weight: 600; margin: 0 0 3px; }
.connection-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; margin: 0; }
.connection-status.online { color: var(--green); }
.messages { overflow-y: auto; overscroll-behavior: contain; padding: 25px max(28px, calc((100% - 760px) / 2)); scroll-padding: 20px; }
.empty-state { height: 100%; min-height: 160px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px 16px; }
.empty-mark { font-size: 40px; color: #809ac7; line-height: 1; padding-bottom: 22px; }
.empty-state h2 { font-size: 19px; font-weight: 600; margin: 0 0 9px; }
.empty-state p { font-size: 13px; color: var(--muted); max-width: 270px; margin: 0; line-height: 1.9; }
.history-note { color: var(--muted); font-size: 12px; text-align: center; padding: 5px 0 22px; }
.message { margin: 0 0 28px; max-width: 100%; }
.message-label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.message.assistant .message-label { color: var(--blue); font-weight: 600; }
.message.user { margin-left: auto; width: fit-content; max-width: 91%; }
.message.user .message-label { justify-content: flex-end; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.85; }
.message.user .message-text { padding: 12px 17px; border-radius: 13px 13px 3px 13px; background: var(--blue-soft); }
.message.assistant .message-text { padding: 0 2px; }
.copy-button { opacity: .65; border: 0; padding: 2px 7px; background: transparent; color: var(--muted); font-size: 11px; min-height: 30px; }
.copy-button:hover { opacity: 1; }
.tools-note { font-size: 11px; color: var(--muted); margin-top: 10px; }
.composer-region { padding: 9px max(28px, calc((100% - 760px) / 2)) 15px; background: var(--surface); border-top: 1px solid var(--line); }
.send-status { min-height: 19px; font-size: 12px; color: var(--muted); margin: 0 1px 7px; }
.send-status.error { color: #a63036; }
.send-status.warning { color: var(--warning); }
.message-form { display: flex; gap: 10px; align-items: flex-end; padding: 11px 11px 11px 15px; border: 1px solid #becbdc; border-radius: 12px; background: var(--surface); }
.message-form:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-soft); }
#message-input { display: block; width: 100%; min-height: 45px; max-height: 150px; resize: none; border: 0; outline: none; background: transparent; color: var(--ink); padding: 2px 0; font-size: 15px; line-height: 1.6; }
#message-input::placeholder { color: #748399; }
.send-button { display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; color: white; border: 0; border-radius: 9px; background: var(--blue); }
.composer-help { margin: 7px 1px 0; font-size: 11px; color: var(--muted); }
.latest-button { position: absolute; bottom: 169px; left: 50%; transform: translateX(-50%); padding: 9px 16px; color: var(--blue); font-size: 12px; background: white; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 3px 12px #20334a10; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.mobile-only { display: none; }
@media (max-width: 767px) {
  .app-view { grid-template-columns: minmax(0, 1fr); grid-template-rows: 57px minmax(0, 1fr); }
  .app-header { padding: env(safe-area-inset-top) 16px 0; }
  .brand { font-size: 16px; gap: 9px; }
  .brand img { width: 27px; height: 27px; }
  .chat-heading { padding: 13px 18px 12px; }
  .chat-heading h1 { font-size: 16px; }
  .chat-area { grid-column: 1; }
  .session-sidebar { display: none; position: absolute; z-index: 5; top: 57px; bottom: 0; left: 0; width: min(300px, 85vw); box-shadow: 6px 0 22px #20334a1b; }
  .session-sidebar.open { display: flex; }
  .messages { padding: 22px 18px; }
  .message { margin-bottom: 25px; }
  .message.user { max-width: 94%; }
  .message-text { font-size: 15px; }
  .composer-region { padding: 8px 12px max(12px, env(safe-area-inset-bottom)); }
  .message-form { padding: 9px 9px 9px 12px; }
  .composer-help { font-size: 10px; text-align: center; }
  .mobile-only { display: block; }
  .desktop-only { display: none; }
  .latest-button { bottom: 161px; }
  .login-view { padding: 32px 27px; }
}
@media (prefers-reduced-motion: no-preference) { .quiet-button, .session-item { transition: background-color .12s; } }
