:root { --ink: #202124; --muted: #74777d; --paper: #fff; --canvas: #f7f8fa; --line: #e8e9ed; --accent: #202124; }
/* 固定 rem 的基准，避免浏览器“默认字号”设置改变界面尺寸。 */
html { font-size: 16px; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button { font: inherit; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% -20%, #e7eaf1, transparent 48%), var(--canvas); }
.login-card { width: min(100%, 410px); background: rgba(255,255,255,.93); border: 1px solid rgba(255,255,255,.8); border-radius: 22px; padding: 42px; text-align: center; }
.login-card h1 { font-weight: 700; font-size: 1.7rem; margin: 18px 0 7px; }
.login-card .form-label { display: block; text-align: left; font-size: .85rem; font-weight: 600; }
.brand-mark { width: 48px; height: 48px; border-radius: 15px; display: inline-grid; place-items: center; background: var(--ink); color: white; font-size: 1.25rem; }
.brand-mark.small { width: 31px; height: 31px; border-radius: 10px; font-size: .9rem; }
.app-shell { height: 100vh; display: flex; overflow: hidden; }
.sidebar { flex: 0 0 268px; width: 268px; display: flex; flex-direction: column; gap: 12px; padding: 16px 12px; border-right: 1px solid var(--line); background: #fbfbfc; z-index: 5; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 12px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; text-decoration: none; }
.history-list { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.history-item { border: 0; width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 9px; color: #444; background: transparent; text-align: left; font-size: .9rem; }
.history-item:hover, .history-item.active { background: #eceef2; color: var(--ink); }
.history-item span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-foot { display: flex; justify-content: space-between; gap: 8px; padding: 12px 4px 0; border-top: 1px solid var(--line); font-size: .78rem; }
.chat-layout { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--paper); }
.topbar { height: 62px; display: flex; align-items: center; gap: 12px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(12px); }
.model-select-wrap { display: flex; align-items: center; gap: 8px; color: #61646b; }
.model-select-wrap .form-select { width: auto; border: 0; font-weight: 600; color: var(--ink); box-shadow: none; cursor: pointer; }
.form-check-label { font-size: .88rem; color: #555961; cursor: pointer; }
.messages { width: min(100%, 1100px); flex: 1; overflow-y: auto; margin: 0 auto; padding: 32px 28px 160px; }
.message-row { display: flex; gap: 14px; margin-bottom: 30px; animation: reveal .18s ease-out; }
.message-row.user { flex-direction: row-reverse; }
.avatar { flex: 0 0 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; background: #e9ebef; color: #555; font-size: .8rem; }
.assistant .avatar { background: #f5f6f8; color: var(--ink); overflow: hidden; border: 1px solid #e6e8ec; }
.assistant .avatar img { width: 20px; height: 20px; object-fit: contain; }
.message-label { margin-bottom: 5px; color: #74777d; font-size: .75rem; font-weight: 700; }
.user .message-label { text-align: right; }
.message-content { max-width: min(80%, 680px); }
.message-text { line-height: 1.72; font-size: .95rem; overflow-wrap: anywhere; }
.user .message-text { background: #f1f2f4; padding: 11px 14px; border-radius: 14px 3px 14px 14px; }
.message-text > :last-child { margin-bottom: 0; }
.message-attachments { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-bottom: 9px; }
.message-attachment-image-wrap { width: min(100%, 360px); margin: 0; overflow: hidden; border: 1px solid #dfe1e5; border-radius: 11px; background: #fff; }
.message-attachment-image { display: block; width: 100%; max-height: 360px; object-fit: contain; background: #eef0f3; }
.message-attachment-image-wrap figcaption { overflow: hidden; padding: 5px 8px; color: #74777d; font-size: .72rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.message-attachment-file { max-width: 280px; display: flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid #dfe1e5; border-radius: 9px; background: #fff; color: #4f535a; font-size: .82rem; line-height: 1.35; }
.message-attachment-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reasoning-panel { margin: 0 0 12px; border: 1px solid #e1e4ea; border-radius: 10px; background: #f8f9fb; color: #62666e; font-size: .86rem; }
.reasoning-panel summary { padding: 9px 11px; cursor: pointer; font-weight: 600; user-select: none; }
.reasoning-panel[open] summary { border-bottom: 1px solid #e5e7eb; }
.reasoning-content { max-height: 360px; overflow: auto; padding: 11px 13px; color: #6f737b; line-height: 1.65; }
.reasoning-content > :last-child { margin-bottom: 0; }
.message-text pre { padding: 13px; overflow-x: auto; border-radius: 10px; background: #1f2125; color: #f5f6f8; font-size: .83rem; }
.message-text code { color: #c22857; }
.message-text pre code { color: inherit; }
.message-text p { margin: 0 0 .8rem; }
.message-text ul, .message-text ol { padding-left: 1.25rem; }
.message-text table { width: 100%; margin: .8rem 0; border: 1px solid #d9dde3; border-collapse: separate; border-spacing: 0; border-radius: 8px; overflow: hidden; font-size: .9em; }
.message-text th, .message-text td { padding: 8px 10px; border-right: 1px solid #e1e4e8; border-bottom: 1px solid #e1e4e8; text-align: left; vertical-align: top; }
.message-text th { background: #f1f3f6; color: #30333a; font-weight: 700; }
.message-text tr:nth-child(even) td { background: #fafbfc; }
.message-text th:last-child, .message-text td:last-child { border-right: 0; }
.message-text tr:last-child td { border-bottom: 0; }
.typing { color: var(--muted); font-size: .9rem; }
.empty-state { position: absolute; inset: 62px 0 110px; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 24px; text-align: center; pointer-events: none; }
.empty-state.hidden { display: none; }
.empty-state h2 { margin: 18px 0 8px; font-size: clamp(1.55rem, 4vw, 2.1rem); font-weight: 700; }
.empty-state p { color: var(--muted); }
.hero-icon { display: grid; place-items: center; width: 58px; height: 58px; border: 1px solid var(--line); border-radius: 20px; color: #34363b; font-size: 1.5rem; box-shadow: 0 7px 25px #1c25300d; }
.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 660px; margin-top: 17px; pointer-events: auto; }
.suggestion { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: white; color: #565a62; font-size: .84rem; transition: .15s; }
.suggestion:hover { border-color: #b7bbc2; background: #fafafa; color: var(--ink); }
.composer-wrap { position: absolute; bottom: 0; width: 100%; padding: 12px 24px 13px; background: linear-gradient(transparent, #fff 25%); }
.composer { width: min(100%, 1040px); margin: 0 auto; padding: 10px 11px 8px 15px; border: 1px solid #dfe1e5; border-radius: 16px; background: white; box-shadow: 0 8px 30px #20212412; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: #aeb3bb; box-shadow: 0 8px 30px #2021241c; }
.composer textarea { display: block; width: 100%; max-height: 160px; border: none; outline: 0; resize: none; background: transparent; font-size: .96rem; line-height: 1.5; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 8px; }
.attachment-card { display: flex; align-items: center; gap: 7px; max-width: 190px; padding: 5px 6px 5px 5px; border: 1px solid #e3e5e9; border-radius: 9px; background: #f8f9fb; font-size: .75rem; }
.attachment-thumb { width: 31px; height: 31px; border-radius: 6px; object-fit: cover; background: #e8eaee; }
.attachment-file-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 6px; background: #e9edf5; color: #52637b; font-size: .95rem; }
.attachment-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.attachment-remove { flex: 0 0 auto; padding: 0 2px; border: 0; color: #787d85; background: transparent; font-size: .9rem; }
.attachment-remove:hover { color: #b42318; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; }
.hint, .disclaimer { color: #9699a0; font-size: .72rem; }
.composer-actions .btn { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; }
.disclaimer { margin: 7px 0 0; text-align: center; }
.sidebar-backdrop { display: none; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
/* 常见笔记本视口：降低界面密度，优先保证更多对话内容可见。 */
@media (min-width: 992px) and (max-height: 850px) {
  .sidebar { flex-basis: 224px; width: 224px; gap: 8px; padding: 11px 9px; }
  .sidebar-head { padding: 1px 3px 8px; }
  .logo { gap: 8px; font-size: .94rem; }
  .brand-mark.small { width: 27px; height: 27px; border-radius: 8px; font-size: .8rem; }
  #newChat { padding: .38rem .6rem; font-size: .86rem; }
  .history-list { margin-top: .5rem !important; }
  .history-item { gap: 7px; padding: 6px 8px; border-radius: 7px; font-size: .81rem; }
  .sidebar-foot { gap: 6px; padding: 8px 3px 0; font-size: .69rem; }
  .topbar { height: 52px; gap: 9px; padding: 0 20px; }
  .model-select-wrap { gap: 6px; font-size: .9rem; }
  .model-select-wrap .form-select { font-size: .87rem; }
  .form-check-label { font-size: .8rem; }
  .messages { width: min(100%, 1000px); padding: 18px 22px 116px; }
  .message-row { gap: 10px; margin-bottom: 18px; }
  .avatar { flex-basis: 27px; height: 27px; border-radius: 8px; font-size: .72rem; }
  .assistant .avatar img { width: 17px; height: 17px; }
  .message-label { margin-bottom: 3px; font-size: .67rem; }
  .message-content { max-width: min(84%, 760px); }
  .message-text { font-size: .86rem; line-height: 1.58; }
  .user .message-text { padding: 8px 11px; border-radius: 11px 3px 11px 11px; }
  .message-text p { margin-bottom: .55rem; }
  .message-text pre { padding: 10px; border-radius: 8px; font-size: .76rem; }
  .reasoning-panel { margin-bottom: 8px; border-radius: 8px; font-size: .78rem; }
  .reasoning-panel summary { padding: 7px 9px; }
  .reasoning-content { max-height: 260px; padding: 8px 10px; line-height: 1.5; }
  .empty-state { inset: 52px 0 88px; padding: 16px; }
  .empty-state h2 { margin: 12px 0 5px; font-size: clamp(1.3rem, 2.5vw, 1.65rem); }
  .empty-state p { margin-bottom: .5rem; font-size: .86rem; }
  .hero-icon { width: 45px; height: 45px; border-radius: 14px; font-size: 1.15rem; }
  .suggestions { gap: 6px; margin-top: 9px; }
  .suggestion { padding: 6px 9px; border-radius: 8px; font-size: .76rem; }
  .composer-wrap { padding: 8px 18px 7px; }
  .composer { width: min(100%, 960px); padding: 7px 8px 6px 11px; border-radius: 12px; }
  .composer textarea { max-height: 110px; font-size: .86rem; line-height: 1.4; }
  .composer-actions { margin-top: 3px; }
  .composer-actions .btn { width: 27px; height: 27px; font-size: .78rem; }
  .hint, .disclaimer { font-size: .65rem; }
  .disclaimer { margin-top: 4px; }
}
@media (max-width: 991px) { .sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 12px 0 32px #00000012; } .app-shell.sidebar-open .sidebar { transform: translateX(0); } .sidebar-backdrop { position: fixed; inset: 0; z-index: 4; background: #1118274d; } .app-shell.sidebar-open .sidebar-backdrop { display: block; } .topbar { padding: 0 14px; } .messages, .composer { width: 100%; max-width: none; } .message-content { flex: 1; min-width: 0; max-width: none; } }
@media (max-width: 575px) { .login-card { padding: 32px 25px; } .messages { padding: 24px 16px 155px; } .composer-wrap { padding: 10px 12px; } .hint { display: none; } .form-check-label { font-size: .78rem; } }
