:root {
  font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color-scheme: light;
  --bg: #fdfdfe; --panel: #f6f6f8; --surface: #fff; --text: #27272a;
  --muted: #646873; --line: #e4e5e9; --hover: #eeeef2; --bubble: #f1f2f5;
  --accent: #b93917; --accent-text: #fff; --selected: #fff0e9; --error: #b4232a;
  --input-line: #c6c8cf; --shadow: 0 12px 48px #00000014; --radius: 10px;
  color: var(--text); background: var(--bg);
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #101216; --panel: #17191e; --surface: #1d2026; --text: #f0f1f5;
  --muted: #b0b3bf; --line: #383c46; --hover: #272b33; --bubble: #242831;
  --accent: #ffad8b; --accent-text: #381305; --selected: #38271f; --error: #ffb3b6;
  --input-line: #676c79; --shadow: 0 12px 48px #0005;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; color: var(--text); background: var(--surface); cursor: pointer; }
button:hover:not(:disabled) { background: var(--hover); }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.primary:hover:not(:disabled) { filter: brightness(.94); background: var(--accent); }
button.icon { width: 44px; min-width: 44px; padding: 10px; font-size: 21px; background: transparent; border-color: transparent; display: inline-flex; align-items: center; justify-content: center; }
svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
button.text-button { border-color: transparent; background: transparent; padding: 6px 8px; font-size: .85rem; color: var(--muted); }
[hidden] { display: none !important; }
.wide { width: 100%; }
.muted, .field-hint, .hint { color: var(--muted); }
.workspace { display: grid; grid-template-columns: 248px minmax(0, 1fr); height: 100vh; height: 100dvh; min-height: 250px; }
.workspace > aside { min-width: 0; display: flex; flex-direction: column; gap: 10px; background: var(--panel); border-right: 1px solid var(--line); padding: 18px 10px max(10px, env(safe-area-inset-bottom)); min-height: 0; }
.brand { display: flex; gap: 9px; align-items: center; padding: 0 8px 12px; min-height: 42px; }
.brand strong { font-size: 16px; letter-spacing: -.5px; }
.brand-icon { width: 28px; height: 28px; border-radius: 7px; }
.app-label { margin-left: auto; border: 1px solid var(--line); border-radius: 5px; padding: 2px 5px; font-size: 10px; color: var(--muted); white-space: nowrap; }
.new-chat { display: flex; gap: 8px; align-items: center; text-align: left; font-size: .93rem; }
.search { position: relative; margin: 2px 2px 0; }
.search svg { position: absolute; left: 12px; top: 14px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; font-size: .93rem; }
input, select, textarea { max-width: 100%; min-width: 0; border: 1px solid var(--input-line); border-radius: 8px; background: var(--surface); color: var(--text); padding: 11px 12px; min-height: 44px; }
input, textarea { width: 100%; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { resize: vertical; line-height: 1.65; }
.list-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 8px; color: var(--muted); font-size: .85rem; }
.session-list { flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; padding: 0 2px; }
.session-item { display: block; text-align: left; width: 100%; border-color: transparent; background: transparent; margin-bottom: 4px; padding: 10px; }
.session-item[aria-current=true] { background: var(--selected); color: var(--accent); }
.session-item strong { display: block; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .93rem; }
.session-item small { display: block; margin-top: 6px; color: var(--muted); font-size: .8rem; }
.session-date { margin-left: 8px; }
.sidebar-footer { border-top: 1px solid var(--line); padding-top: 10px; }
.sidebar-footer > button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px; border-color: transparent; background: transparent; text-align: left; }
.account-mark { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; color: var(--accent); }
.account-info { flex: 1; min-width: 0; }
.account-info strong, .account-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-info strong { font-size: .9rem; font-weight: 500; }
.account-info small { font-size: .8rem; color: var(--muted); margin-top: 4px; }
main { display: flex; position: relative; min-width: 0; min-height: 0; flex-direction: column; }
.toolbar { display: flex; gap: 5px; align-items: center; padding: 10px 24px; min-height: 73px; }
.heading { flex: 1; min-width: 0; }
.heading h1 { margin: 0; font-size: 1rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heading .muted { font-size: .85rem; display: block; margin-top: 5px; overflow-wrap: anywhere; }
.notice { background: var(--selected); padding: 8px 16px; display: flex; gap: 8px; align-items: center; line-height: 1.6; overflow-wrap: anywhere; }
.notice span { flex: 1; min-width: 0; }
.chat { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; padding: 28px max(28px, calc((100% - 780px)/2)); }
.welcome { min-height: min(520px, 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 24px 0; }
.welcome-mark { width: 56px; height: 56px; border-radius: 15px; margin-bottom: 12px; }
.eyebrow { font-size: .8rem; letter-spacing: .08em; color: var(--muted); }
.welcome h2 { font-size: 2.05rem; letter-spacing: -.8px; font-weight: 600; margin: 4px 0; line-height: 1.45; }
.welcome p { color: var(--muted); line-height: 1.8; margin: 0 0 12px; }
.suggestions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; margin: 12px 0 2px; }
.suggestions button { min-width: 0; padding: 16px; text-align: left; background: var(--surface); }
.suggestions strong, .suggestions span { display: block; }
.suggestions strong { font-size: .95rem; font-weight: 500; }
.suggestions span { color: var(--muted); font-size: .8rem; margin-top: 8px; line-height: 1.5; }
.turn { margin: 0 auto 36px; max-width: 780px; overflow-wrap: anywhere; }
.user-message { white-space: pre-wrap; margin: 0 0 24px auto; background: var(--bubble); border-radius: 16px; padding: 12px 18px; width: fit-content; max-width: 85%; line-height: 1.8; }
.answer-header { display: flex; gap: 9px; align-items: center; font-weight: 600; font-size: .93rem; margin-bottom: 12px; }
.answer-avatar { width: 24px; height: 24px; border-radius: 6px; }
.answer { line-height: 1.85; }
.answer > :first-child { margin-top: 0; }
.answer pre { overflow: auto; background: var(--panel); padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); line-height: 1.65; max-width: 100%; }
.answer code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; }
.answer table { display: block; overflow: auto; max-width: 100%; border-collapse: collapse; }
.answer td, .answer th { padding: 8px 12px; border: 1px solid var(--line); }
.answer blockquote { border-left: 3px solid var(--line); padding-left: 15px; margin-left: 0; color: var(--muted); }
.answer a { color: var(--accent); }
.answer img { max-width: 100%; }
.turn-footer { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: .85rem; }
.turn-footer button { font-size: .85rem; border-color: transparent; background: transparent; padding: 6px 10px; }
.turn-error, .form-error { color: var(--error); line-height: 1.6; }
.form-status { background: var(--selected); border-radius: 8px; padding: 12px; line-height: 1.6; }
.activities { font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.activities summary { cursor: pointer; min-height: 44px; padding: 12px 0; }
.composer { padding: 10px max(28px, calc((100% - 780px)/2)) max(10px, env(safe-area-inset-bottom)); margin: 0; }
.compose-box { border: 1px solid var(--input-line); border-radius: 18px; background: var(--surface); padding: 10px 12px; box-shadow: 0 2px 10px #00000004; }
.compose-box:focus-within { border-color: var(--accent); }
.compose-box textarea { border: 0; outline: none; min-height: 66px; max-height: 180px; resize: vertical; padding: 6px 4px; background: transparent; }
.compose-box textarea:focus-visible { outline: none; }
.compose-footer { display: flex; align-items: center; gap: 4px; }
.agent-choice { display: flex; align-items: center; min-width: 0; max-width: calc(100% - 50px); color: var(--muted); font-size: .85rem; }
.agent-choice svg { width: 17px; height: 17px; margin-left: 4px; }
.agent-choice select { max-width: 230px; border-color: transparent; font-size: .85rem; min-width: 0; padding-left: 7px; background: transparent; }
.agent-choice select:disabled { color: var(--text); opacity: 1; }
.fixed-label { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.send-button { min-width: 44px; width: 44px; padding: 10px; margin-left: auto; display: grid; place-items: center; border-radius: 12px; }
.composer-meta { display: flex; gap: 12px; justify-content: space-between; margin-top: 10px; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.hint { margin: 0; text-align: right; }
.shortcut { flex-shrink: 0; }
.scroll-bottom { position: absolute; bottom: 196px; left: 50%; transform: translateX(-50%); border-radius: 24px; box-shadow: var(--shadow); font-size: .85rem; z-index: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.mobile { display: none !important; }
.shade { display: none; }
dialog { width: min(840px, calc(100% - 48px)); max-height: calc(100% - 48px); border: 1px solid var(--line); border-radius: 18px; padding: 28px; background: var(--surface); color: var(--text); overflow: auto; box-shadow: var(--shadow); }
dialog::backdrop { background: #0007; }
.dialog-heading { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.dialog-heading h2 { margin: 6px 0 0; font-size: 1.4rem; line-height: 1.5; font-weight: 600; letter-spacing: -.4px; }
.dialog-heading p { font-size: .93rem; line-height: 1.6; margin: 8px 0 0; max-width: 600px; }
.settings-body { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; }
.profile-column { border-right: 1px solid var(--line); padding-right: 20px; }
.section-label { color: var(--muted); font-size: .85rem; margin: 0 0 12px; }
.profile-item { display: block; width: 100%; text-align: left; margin-bottom: 8px; overflow-wrap: anywhere; border-color: transparent; background: transparent; }
.profile-item[aria-pressed=true] { background: var(--selected); border-color: var(--accent); }
.profile-item strong { font-size: .93rem; font-weight: 500; }
.profile-item small { display: block; color: var(--muted); margin-top: 5px; font-size: .8rem; }
.profile-help { margin-top: 16px !important; }
form h3 { margin: 0 0 20px; font-size: 1rem; font-weight: 600; }
form > label { display: block; margin-bottom: 16px; line-height: 1.6; font-weight: 500; font-size: .93rem; }
form > label > input, form > label > textarea { display: block; margin-top: 7px; }
.field-hint { font-size: .85rem; font-weight: 400; margin: -6px 0 16px; line-height: 1.65; overflow-wrap: anywhere; }
.check { display: flex; gap: 9px; align-items: center; min-height: 44px; font-size: .93rem; }
.check input { width: 18px; min-height: 18px; height: 18px; margin: 0; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 24px; }
.danger { color: var(--error); }
#share-dialog, #rename-dialog, #delete-dialog { width: min(600px, calc(100% - 32px)); }
#actions-dialog { width: min(360px, calc(100% - 32px)); }
.menu-action { display: flex; justify-content: space-between; width: 100%; text-align: left; border-color: transparent; background: transparent; padding: 12px; }
.appearance { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 10px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.appearance select { flex: 1; min-width: 160px; }
#close-nav { margin-left: auto; }
@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .workspace > aside { display: none; position: fixed; z-index: 3; inset: 0 auto 0 0; width: min(300px, calc(100% - 32px)); box-shadow: var(--shadow); }
  .workspace > aside.open { display: flex; }
  .mobile { display: inline-flex !important; }
  .desktop { display: none !important; }
  .brand { gap: 7px; padding-left: 4px; }
  .brand .app-label { display: none; }
  .shade:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 2; background: #0007; border: 0; border-radius: 0; width: 100%; height: 100%; }
  .toolbar { padding: 8px; gap: 1px; min-height: 68px; }
  .heading h1 { font-size: .95rem; }
  .heading .muted { font-size: .8rem; }
  .chat { padding: 18px 16px; }
  .welcome { padding: 18px 2px; min-height: 100%; gap: 8px; }
  .welcome-mark { width: 44px; height: 44px; margin-bottom: 8px; border-radius: 12px; }
  .welcome h2 { font-size: 1.65rem; }
  .welcome p { font-size: .93rem; margin-bottom: 4px; }
  .suggestions { grid-template-columns: minmax(0, 1fr); gap: 7px; max-width: 400px; }
  .suggestions button { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; }
  .suggestions strong { font-size: .9rem; }
  .suggestions span { margin: 0; font-size: .78rem; text-align: right; }
  .composer { padding: 8px 12px max(10px, env(safe-area-inset-bottom)); }
  .compose-box { border-radius: 16px; padding: 8px; }
  .compose-box textarea { min-height: 48px; }
  .agent-choice select { max-width: 160px; }
  .fixed-label { display: none; }
  .shortcut { display: none; }
  .composer-meta { justify-content: center; }
  .hint { text-align: center; }
  .user-message { max-width: 95%; padding: 12px 15px; }
  .notice { padding: 5px 12px; font-size: .85rem; }
  dialog { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border: 0; border-radius: 0; padding: 20px max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .settings-body { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .profile-column { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 20px; }
  .dialog-heading { gap: 8px; margin-bottom: 20px; }
  .dialog-heading h2 { font-size: 1.3rem; }
  .form-actions > button { flex: 1; min-width: 90px; }
  #share-dialog, #rename-dialog, #delete-dialog, #actions-dialog { width: 100%; }
  #actions-dialog { height: fit-content; max-height: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
