:root {
  color-scheme: only light;
  --bg: #ffffff;
  --sidebar: #f7f7f8;
  --panel: #ffffff;
  --panel-2: #f2f3f5;
  --line: #e3e5e8;
  --text: #202123;
  --muted: #737984;
  --accent: #2563eb;
  --accent-dark: #eaf1ff;
  --danger: #c83b36;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, textarea { font: inherit; }
button { color: inherit; }
.app-shell { display: grid; grid-template-columns: 208px 1fr; grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar-backdrop { display: none; }
.app-shell { --sidebar-width: 0px; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
body.sidebar-open .app-shell { --sidebar-width: 192px; }
.main-panel { position: relative; container-type: inline-size; container-name: main-panel; }
.sidebar-toggle { position: absolute; top: 10px; left: 14px; z-index: 30; display: grid; place-items: center; width: 36px; height: 36px; padding: 6px; border: 0; border-radius: 8px; background: transparent; color: #737b85; cursor: pointer; }
.sidebar-toggle svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.8; }
.sidebar-toggle[aria-expanded="true"] { background: #e9eaec; color: var(--text); }
@media (hover: hover) { .sidebar-toggle:hover { background: #e9eaec; color: var(--text); } }
.sidebar-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body:not(.sidebar-open) .sidebar { visibility: hidden; pointer-events: none; overflow: hidden; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; min-width: 0; }
.sidebar-brand { padding: 0 11px; margin-bottom: 14px; font-size: 24px; font-weight: 650; line-height: 32px; color: var(--text); }
.new-chat { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; width: 100%; height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; text-align: left; padding: 0 11px; cursor: pointer; transition: background .2s; }
@media (hover: hover) { .new-chat:hover { background: #e9ecef; } }
.new-chat svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-tabs { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--muted); height: 38px; border-radius: 8px; font-size: 14px; text-align: left; padding: 0 11px; cursor: pointer; }
.sidebar-nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; flex-shrink: 0; font-size: 20px; }
.nav-item.active { color: var(--text); background: #e9eaec; }
@media (hover: hover) { .nav-item:hover { color: var(--text); background: #e9eaec; } }
.section-label { color: #69727e; padding: 24px 10px 8px; text-transform: uppercase; font-size: 10px; letter-spacing: .12em; }
.session-list { overflow: auto; display: grid; gap: 3px; }
.session { border: 0; background: transparent; color: #aeb6c0; border-radius: 7px; padding: 9px 10px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; font-size: 13px; }
/* 悬停高亮只在有鼠标的设备上生效：手机上手指滑过列表时 :hover 会一直粘着，看起来像被选中。 */
.session.active { background: #e9eaec; color: var(--text); }
@media (hover: hover) { .session:hover { background: #e9eaec; color: var(--text); } }
.main-panel, .view { min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.debug-panel { display: none; min-width: 0; height: 100%; border-left: 1px solid var(--line); background: #fafbfc; overflow: hidden; }
body.debug-mode .app-shell { grid-template-columns: var(--sidebar-width) minmax(0, 1fr) minmax(0, 3fr); }
body.debug-mode .debug-panel { display: flex; flex-direction: column; }
body.debug-mode.debug-panel-collapsed .app-shell { grid-template-columns: var(--sidebar-width) minmax(0, 1fr) 48px; }
.debug-panel-toggle { flex-shrink: 0; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); font: 18px/1 ui-monospace, monospace; cursor: pointer; }
.debug-panel-toggle:hover { background: var(--panel-2); }
.debug-panel-collapsed .debug-panel-header { padding: 8px; justify-content: center; }
.debug-panel-collapsed .debug-panel-header > :not(.debug-panel-toggle),
.debug-panel-collapsed .debug-traces, .debug-panel-collapsed .debug-management-frames { display: none; }
.debug-panel-header { min-height: 56px; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: #fff; }
.debug-panel-header h2 { margin: 0; font-size: 15px; }
.debug-panel-header small { color: var(--muted); font-size: 10px; }
.debug-traces { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.debug-empty { margin: 28px 8px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.debug-workbench { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 23fr) minmax(0, 77fr); grid-template-rows: auto minmax(0, 1fr); }
.debug-timeline { grid-column: 1 / -1; max-height: 180px; overflow: auto; padding: 4px 12px; border-bottom: 1px solid var(--line); background: var(--panel, #f2f3f5); font-size: 11px; }
.debug-timeline-heading { color: var(--muted); cursor: pointer; }
.debug-timeline[open] > .debug-timeline-heading { margin-bottom: 7px; }
.debug-timeline-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 48px; gap: 10px; align-items: center; width: 100%; padding: 3px 0; border: 0; background: transparent; text-align: left; color: inherit; font-size: 10px; cursor: pointer; }
.debug-timeline-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.debug-timeline-track { position: relative; height: 12px; background: repeating-linear-gradient(to right, transparent 0, transparent calc(25% - 1px), #d6dae0 calc(25% - 1px), #d6dae0 25%); }
.debug-timeline-bar { position: absolute; top: 2px; height: 8px; min-width: 2px; border-radius: 3px; background: #2563eb; }
.debug-timeline-row[data-kind="LLM"] .debug-timeline-bar { background: #8b5cf6; }
.debug-timeline-row[data-kind="TOOL"] .debug-timeline-bar { background: #f59e0b; }
.debug-timeline-row[data-kind="CHAIN"] .debug-timeline-bar { background: #0891b2; }
.debug-timeline-row:hover { background: #e3e9f5; }
.debug-span-tree { min-width: 0; overflow: auto; padding: 10px 8px; border-right: 1px solid var(--line); background: #fbfcfe; }
.debug-span-row { position: relative; width: 100%; min-height: 45px; display: grid; grid-template-columns: 13px minmax(0, 1fr); align-items: start; gap: 4px; padding: 6px 8px; border-radius: 7px; background: transparent; }
.debug-span-row[hidden] { display: none; }
.debug-span-row:hover, .debug-span-row.active { background: #e9eef8; }
.debug-span-toggle { width: 13px; height: 27px; padding: 0; border: 0; background: transparent; color: #748092; font-size: 12px; line-height: 1; cursor: pointer; }
.debug-span-toggle:disabled { cursor: default; }
.debug-span-select { width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 1px 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.debug-span-row[data-kind="CHAIN"] .debug-span-name { color: #0e7490; }
.debug-span-row[data-kind="LLM"] .debug-span-name { color: #6d28d9; }
.debug-span-row[data-kind="TOOL"] .debug-span-name { color: #92400e; }
.debug-span-copy { min-width: 0; }
.debug-span-name { display: block; color: #2f3743; font-size: 11px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.debug-span-meta { display: block; margin-top: 3px; color: #7a8492; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.debug-span-duration { color: #8a93a0; font: 9px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.debug-span-detail { min-width: 0; overflow: auto; padding: 16px; background: #fff; }
.debug-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.debug-detail-head h3 { margin: 0; font-size: 14px; }
.debug-detail-badges { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.debug-badge { padding: 3px 6px; border-radius: 5px; background: #eef1f5; color: #596575; font-size: 9px; }
.debug-detail-id { color: #7b8490; font: 9px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.debug-detail-section { margin-top: 14px; }
.debug-management-links { display: flex; gap: 6px; margin-left: auto; }
.debug-management-links button { padding: 7px 11px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--accent); font-size: 12px; cursor: pointer; }
.debug-management-links button[aria-selected="true"] { background: var(--accent-dark); border-color: var(--accent); }
.debug-panel-header { gap: 8px; flex-wrap: wrap; }
.debug-management-frames { flex: 1; min-height: 0; }
.debug-management-frames iframe { width: 100%; height: 100%; display: block; border: 0; background: #fff; }
.debug-traces[hidden], .debug-management-frames[hidden], .debug-management-frames iframe[hidden], #debug-trace-count[hidden] { display: none; }
.debug-detail-section h4 { margin: 0 0 7px; color: #586474; font-size: 10px; letter-spacing: .04em; }
.debug-detail-section pre { max-height: 260px; margin: 0; padding: 10px; overflow: auto; border: 1px solid #e3e6eb; border-radius: 8px; background: #f5f7fa; color: #303640; font: 10px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.debug-message { margin-top: 7px; overflow: hidden; border: 1px solid #e3e6eb; border-radius: 8px; background: #f7f8fa; }
.debug-message-role { display: block; padding: 7px 10px 0; color: #667085; font: 700 9px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.debug-message-role:is([data-role="system"], [data-role="user"], [data-role="assistant"]) { color: var(--accent); }
.debug-detail-section .debug-message pre { max-height: none; padding-top: 5px; border: 0; background: transparent; }
.debug-input-tools { margin: 9px 0; color: #667085; font-size: 10px; line-height: 1.5; }
.debug-raw-json { margin-top: 10px; }
.debug-raw-json summary { color: #667085; font-size: 10px; cursor: pointer; }
.debug-raw-json pre { margin-top: 7px; }
.debug-detail-section > summary { margin-bottom: 9px; color: #586474; font-size: 13px; font-weight: 700; letter-spacing: .04em; cursor: pointer; }
.debug-detail-section:not([open]) > summary { margin-bottom: 0; }
.debug-detail-section[data-section="output"] > summary { position: relative; padding-right: 170px; min-height: 32px; }
.debug-output-picker { position: absolute; right: 0; top: -4px; display: inline-flex; gap: 4px; letter-spacing: normal; }
.debug-output-picker button { padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--muted); font-size: 13px; cursor: pointer; }
.debug-output-picker button[aria-pressed="true"] { background: var(--accent-dark); color: var(--accent); border-color: var(--accent); }
.debug-output-markdown { padding: 16px; max-height: max(480px, 65vh); overflow: auto; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 16px; line-height: 1.75; }
.debug-message > summary { padding: 10px 12px; cursor: pointer; font-size: 13px; font-weight: 700; }
.debug-message-role { display: list-item; padding: 10px 12px; font-size: 13px; }
.debug-message > summary.debug-message-role:is([data-role="system"], [data-role="user"], [data-role="assistant"]) { margin-bottom: 0; padding-bottom: 2px; }
.debug-message > summary.debug-message-role:is([data-role="system"], [data-role="user"], [data-role="assistant"]) + pre { padding-top: 2px; }
.debug-message > summary.debug-message-formatted { position: relative; padding-right: 170px; min-height: 34px; }
.debug-message-formatted .debug-output-picker { right: 12px; top: 5px; text-transform: none; }
.debug-message .debug-message-markdown { border: 0; background: transparent; padding: 2px 12px 10px; }
.debug-message-markdown > :first-child { margin-top: 0; }
.debug-message-markdown > :last-child { margin-bottom: 0; }
.debug-message .debug-detail-section { margin: 0 12px 12px; }
.debug-message .debug-tool-calls { margin-top: 8px; }
.debug-detail-section pre { font-size: 14px; line-height: 1.65; }
.debug-detail-section:is([data-section="input"], [data-section="output"]) > pre { max-height: max(480px, 65vh); }
.debug-call-id { padding: 0 12px 10px; color: var(--muted); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.debug-tool-call > summary { color: #92400e; }
.debug-span-name { font-size: 13px; }
.debug-span-meta, .debug-span-duration, .debug-detail-id, .debug-badge { font-size: 11px; }
.debug-timeline-row, .debug-input-tools, .debug-raw-json summary { font-size: 12px; }
.debug-timeline-heading { font-size: 13px; line-height: 20px; }
.source-citation { display: inline-flex; vertical-align: baseline; max-width: 180px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .75em; line-height: 1.5; text-decoration: none; overflow-wrap: anywhere; }
.source-citation:hover { color: #2563eb; border-color: #2563eb; }
.debug-loading { padding: 28px; color: var(--muted); font-size: 11px; }
.view { display: none; flex-direction: column; }
.view.active { display: flex; }
.connector-card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.connector-card h3 { display: inline-block; margin: 0 12px 8px 0; }
.connector-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.connector-logo { display: block; width: 48px; height: 48px; margin-bottom: 18px; }
.connector-logo svg, .connector-logo img { display: block; width: 100%; height: 100%; }
.connector-overview { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px 12px; align-items: start; min-width: 0; text-align: left; color: var(--text); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.connector-overview:hover { border-color: var(--accent); box-shadow: 0 4px 16px #2563eb12; }
.connector-overview:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.connector-overview .connector-logo { grid-column: 1; grid-row: 1; width: 40px; height: 40px; margin: 0; }
.connector-overview h3 { grid-column: 2; grid-row: 1; display: block; min-width: 0; margin: 0; align-self: center; overflow-wrap: anywhere; }
.connector-overview p { grid-column: 1 / -1; grid-row: 2; min-width: 0; margin: 0; overflow-wrap: break-word; }
.connector-overview .connector-state { grid-column: 1 / -1; grid-row: 3; min-width: 0; overflow-wrap: anywhere; }
.connector-overview .connector-card-hint { grid-column: 1 / -1; grid-row: 4; margin: 0; white-space: nowrap; }
@container main-panel (min-width: 480px) {
  .connector-overview { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .connector-overview .connector-logo { grid-row: 1 / 3; }
  .connector-overview p { grid-column: 2 / -1; }
  .connector-overview .connector-state { grid-column: 2; }
  .connector-overview .connector-card-hint { grid-column: 3; grid-row: 3; }
}
@container main-panel (min-width: 800px) {
  .connector-overview { grid-template-columns: 48px minmax(0, 1fr) auto auto; gap: 6px 18px; align-items: center; }
  .connector-overview .connector-logo { width: 48px; height: 48px; }
  .connector-overview p { grid-column: 2; }
  .connector-overview .connector-state { grid-column: 3; grid-row: 1 / 3; }
  .connector-overview .connector-card-hint { grid-column: 4; grid-row: 1 / 3; }
}
.connector-card-hint { display: block; margin-top: 18px; font-size: 13px; color: var(--accent); }
.connector-back { justify-self: start; padding: 8px 0; background: transparent; color: var(--accent); border: 0; cursor: pointer; }
.connector-detail { max-width: 800px; }
.main-panel:has(#connectors-view.active .connector-detail-open) > .sidebar-toggle,
#connectors-view:has(.connector-detail-open) > .topbar { display: none; }
#connectors-view:has(.connector-detail-open) .admin-content { padding-top: max(8px, env(safe-area-inset-top)); }
#connectors-view:has(.connector-detail-open) #connector-status:empty { display: none; }
.connector-detail-open > .connector-back { min-height: 44px; padding: 8px 0; font-size: 17px; }
.connector-state { color: var(--muted); font-size: 12px; }
.connector-card p, .connector-guide p { font-size: 13px; line-height: 1.65; }
.connector-scope { color: var(--muted); overflow-wrap: anywhere; }
.connector-setup-notice { padding: 12px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; color: #1e40af; }
.connector-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.connector-actions button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #f4f7ff; color: var(--accent); cursor: pointer; }
.connector-actions button:disabled { opacity: .45; cursor: default; }
.connector-guide { margin-top: 20px; }
#connectors-view .connector-guide { display: none; }
body.connector-admin-mode #connectors-view .connector-guide { display: block; }
.connector-guide summary { cursor: pointer; }
.connector-wizard { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.connector-wizard summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.connector-wizard li { margin-bottom: 8px; line-height: 1.6; }
.connector-wizard > button { margin-left: 12px; padding: 5px 8px; }
.connector-configuration { display: grid; gap: 12px; margin-top: 18px; }
.connector-configuration label { display: grid; gap: 6px; }
.connector-configuration label[hidden] { display: none; }
.connector-configuration input, .connector-configuration select { width: 100%; padding: 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); }
.connector-configuration button { justify-self: start; padding: 9px 14px; border: 0; border-radius: 7px; color: white; background: var(--accent); cursor: pointer; }
.connector-configuration button:disabled { opacity: .5; }
.topbar { height: 56px; min-height: 56px; border-bottom: 1px solid var(--line); padding: 0 20px 0 62px; display: flex; align-items: center; justify-content: space-between; background: #ffffffde; backdrop-filter: blur(12px); }
.topbar h1 { margin: 0; font-size: 15px; font-weight: 600; }
.topbar p { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.font-size-picker { height: 34px; display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.font-size-btn { width: 30px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--accent); font-weight: 700; line-height: 1; cursor: pointer; transition: background .15s, color .15s, transform .15s, opacity .15s; }
.font-size-decrease { font-size: 11px; }
.font-size-increase { font-size: 18px; }
.font-size-btn:hover { background: var(--panel-2); }
.font-size-btn:active { transform: scale(.92); }
.font-size-btn:disabled { opacity: .3; cursor: default; transform: none; }
.font-settings { position: relative; }
.font-settings > summary { display: grid; place-items: center; width: 44px; height: 34px; border: 1px solid var(--line); border-radius: 9px; color: var(--accent); cursor: pointer; list-style: none; font-weight: 600; }
.font-settings > summary::-webkit-details-marker { display: none; }
.font-settings > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.font-settings-panel { position: absolute; z-index: 40; top: calc(100% + 8px); right: 0; width: min(240px, calc(100vw - 32px)); padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 12px 36px #0002; }
.font-settings-panel .font-size-picker { height: 40px; margin: 0; padding: 0; gap: 0; }
.font-settings-panel .font-size-btn { flex: 1; height: 38px; }
.font-settings-panel .font-size-decrease { border-right: 1px solid var(--line); border-radius: 8px 0 0 8px; }
/* 正文中英文都使用无衬线字体。 */
.message-content, .debug-output-markdown { font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; color: var(--muted); }
.icon-button:hover { background: var(--panel-2); }
.messages { overflow-anchor: none; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: none; padding: 40px max(24px, calc((100% - 790px) / 2)); scroll-behavior: auto; }
.welcome { max-width: 720px; margin: 10vh auto 0; text-align: center; }
.welcome h2 { margin: 0 0 8px; font-size: 25px; letter-spacing: -.035em; }
.welcome p { color: var(--muted); margin: 0 auto; max-width: 540px; font-size: 14px; line-height: 1.6; }
.message { display: block; width: 100%; margin: 0 0 28px; animation: rise .22s ease-out; }
.message-body { min-width: 0; }
.message-content { font-size: calc(14px * var(--reading-scale, 1)); line-height: 1.75; color: #353a40; white-space: pre-wrap; overflow-wrap: anywhere; transition: font-size .18s ease; }
.message.assistant .message-body { width: 100%; max-width: none; }
.message.assistant .message-content { display: block; width: 100%; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.message.user { display: flex; justify-content: flex-end; }
.message.user .message-body { max-width: min(86%, 680px); text-align: right; }
.message.user .message-content { display: inline-block; text-align: left; color: #fff; background: var(--accent); border: 1px solid #1d4ed8; border-radius: 14px 4px 14px 14px; padding: 10px 14px; box-shadow: 0 3px 12px #2563eb1f; }
.message.user .message-content strong,
.message.user .message-content a { color: #fff; }
.message.user .message-content code { color: #fff; background: #ffffff24; }
/* 执行路径按钮紧跟在提问文字末尾，不单独占一行。 */
.query-trace-actions { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; vertical-align: middle; }
.query-trace-button, .query-phoenix-link { width: 24px; height: 24px; padding: 0; border: 1px solid #ffffff38; background: #ffffff20; color: #fff; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; }
.query-trace-button { border-radius: 50%; font-size: 23px; line-height: 1; }
.query-trace-button svg { display: block; flex-shrink: 0; }
.query-phoenix-link { border-radius: 9px; font-size: 13px; font-weight: 700; }
.query-phoenix-link[hidden] { display: none; }
.query-trace-button:hover, .query-trace-button[aria-pressed="true"], .query-phoenix-link:hover { background: #ffffff40; color: #fff; }
.query-trace-button:focus-visible, .query-phoenix-link:focus-visible { outline: 2px solid white; outline-offset: 2px; }
.query-trace-button:disabled { opacity: .3; cursor: default; }
.debug-selected-query { flex: 0 0 auto; padding: 8px 12px; border-bottom: 1px solid var(--line); color: #586474; background: #fff; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-content > :first-child { margin-top: 0; }
.message-content > :last-child { margin-bottom: 0; }
.message-content p { margin: 0 0 10px; }
.message-content h3, .message-content h4, .message-content h5, .message-content h6 { margin: 14px 0 7px; line-height: 1.35; color: var(--text); }
.message-content h3 { font-size: calc(17px * var(--reading-scale, 1)); }
.message-content h4 { font-size: calc(15px * var(--reading-scale, 1)); }
.message-content h5, .message-content h6 { font-size: calc(14px * var(--reading-scale, 1)); }
.message-content ul, .message-content ol { margin: 7px 0 11px; padding-left: 22px; }
.message-content li { margin: 4px 0; padding-left: 2px; }
.message-content strong { color: #172554; font-weight: 700; }
.message-content a { color: #1d4ed8; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.message-content code { padding: 2px 5px; border-radius: 5px; background: #edf2ff; color: #1e3a8a; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.message-content pre { margin: 10px 0; padding: 12px 14px; overflow-x: auto; border-radius: 9px; background: #111827; color: #eff6ff; text-align: left; }
.message-content pre code { padding: 0; background: transparent; color: inherit; white-space: pre; }
.message-content blockquote { margin: 9px 0; padding: 5px 0 5px 11px; border-left: 3px solid #93b4f8; color: #5f6673; white-space: pre-line; }
/*
 * 表格（参考 ChatGPT）：没有外框、底色和竖线，只在行之间画横线；文字和正文一样大，表头靠左；
 * 列宽按内容分配、占满整行，长内容在列内按词换行。列多到放不下时（每列至少 5 个字宽）整张表横向滚动。
 */
.markdown-table-wrap { width: 100%; margin: 12px 0 18px; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
.markdown-table-wrap table { width: 100%; border-collapse: collapse; color: inherit; font-size: inherit; line-height: 1.5; white-space: normal; }
.markdown-table-wrap th, .markdown-table-wrap td { min-width: 5em; max-width: 32em; padding: 10px 16px 10px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: break-word; word-break: normal; }
.markdown-table-wrap th { color: var(--text); font-weight: 650; border-bottom-color: color-mix(in srgb, var(--text) 28%, transparent); }
/* 内容都很短的列（序号、排名等，见 markdown.js markCompactColumns）：只占内容宽度，不换行。 */
.markdown-table-wrap :is(th, td).is-compact { width: 1%; min-width: 0; white-space: nowrap; }
.markdown-table-wrap tr > :last-child { padding-right: 0; }
.markdown-table-wrap tbody tr:last-child > td { border-bottom: 0; }
.artifact { display: block; max-width: 100%; max-height: 520px; border-radius: 12px; border: 1px solid var(--line); margin-top: 14px; }
.image-artifact { position: relative; width: fit-content; max-width: 100%; margin-top: 14px; }
.image-artifact .artifact { margin-top: 0; }
.image-download { position: absolute; right: 12px; bottom: 12px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255, 255, 255, .6); backdrop-filter: blur(6px); color: #263245; font-size: 25px; text-decoration: none; box-shadow: 0 1px 6px #0002; }
.image-download:hover { background: rgba(255, 255, 255, .9); }
.typing { display: inline-flex; gap: 4px; padding-top: 6px; }
.typing i { width: 5px; height: 5px; background: #7d8791; border-radius: 50%; animation: pulse 1s infinite alternate; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
.message.assistant .message-content.typing-bubble { width: max-content; min-width: 36px; padding: 4px 0; }
.message.is-new { animation: messageReveal .3s cubic-bezier(.22, 1, .36, 1); }
/* 同一个对话重画时重建的消息：不再播进场动画（app.js 的 renderMessages）。 */
.messages.is-rerender .message, .message.is-settled { animation: none; }
/* 生成中的段落和最终渲染完全同样排版：包裹层不占位、不加间距，段落间距沿用正文规则，
   所以段落完成、回答结束时文字都不会上下跳动。 */
.stream-block, .stream-live { display: contents; }
.message-content > :is(.stream-block, .stream-live):first-child > :first-child { margin-top: 0; }
.message-content > :is(.stream-block, .stream-live):last-child > :last-child { margin-bottom: 0; }
.message-content .stream-caret { display: inline-block; width: 2px; height: 1.05em; margin-left: 3px; vertical-align: -.12em; border-radius: 1px; background: currentColor; animation: streamCaretBlink .88s ease-in-out infinite; }
.stream-activity { display: flex; align-items: center; gap: 8px; width: max-content; margin-top: 0; color: #7b828d; font-size: calc(14px * var(--reading-scale, 1)); }
.stream-activity .typing { padding-top: 1px; }
/* 思考动画：放大一些，更容易注意到。 */
.rose-thinking { display: inline-block; width: 64px; height: 64px; flex: 0 0 64px; color: var(--accent); overflow: visible; }
.stream-activity .typing i { width: 4px; height: 4px; }
.run-status-phase { width: max-content; margin-top: 14px; color: #5f6570; font-size: calc(16px * var(--reading-scale, 1)); font-weight: 600; background: linear-gradient(100deg, #454b55 20%, #a8adb5 45%, #454b55 70%); background-size: 220% 100%; background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; animation: thinkingShimmer 2s linear infinite; }
.composer-wrap { position: relative; padding: 12px max(24px, calc((100% - 790px) / 2)) 24px; background: linear-gradient(transparent, var(--bg) 28%); }
.composer { min-height: 66px; display: grid; grid-template-columns: 38px minmax(0, 1fr) 38px 38px; align-items: center; gap: 8px; border: 1px solid #d9dde4; border-radius: 25px; background: #fff; box-shadow: 0 10px 32px #11182712; padding: 8px 12px; }
.composer:focus-within { border-color: #8bb0ff; box-shadow: 0 10px 32px #11182714, 0 0 0 2px #2563eb1f; }
.composer textarea { width: 100%; max-height: 144px; resize: none; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 16px; line-height: 1.5; }
.composer textarea::placeholder { color: #9aa1ac; }
.composer-camera, .composer-voice, .send-button { width: 38px; height: 38px; display: grid; place-items: center; color: #68707c; }
.composer-camera svg { width: 30px; height: 30px; }
.composer-voice svg { width: 32px; height: 32px; }
.send-button svg { width: 22px; height: 22px; }
.composer svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.composer .send-button svg { stroke-width: 2.5; }
.send-button { padding: 0; border: 0; border-radius: 50%; background: var(--accent); color: #fff; cursor: pointer; box-shadow: 0 4px 12px #2563eb35; transition: background .15s, transform .15s, box-shadow .15s; }
.send-button:hover { background: #1d4ed8; box-shadow: 0 5px 15px #2563eb48; }
.send-button:active { transform: scale(.92); }
.send-button:disabled { opacity: .35; cursor: wait; }
.admin-content { overflow: auto; padding: 24px max(28px, calc((100% - 980px) / 2)); }
.catalog-empty { color: var(--muted); font-size: 13px; }
.catalog-card.catalog-summary-card { grid-template-columns: 1fr; }
.catalog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 38px; }
.catalog-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; }
.catalog-heading h3 { font-size: 14px; }
.catalog-heading span { font-size: 10px; color: var(--muted); }
.catalog-list { display: grid; gap: 9px; }
#admin-view .catalog-list { grid-template-columns: minmax(0, 1fr); gap: 14px; }
#admin-view .catalog-card { min-width: 0; overflow-wrap: anywhere; }
@container main-panel (min-width: 600px) {
  #admin-view .catalog-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container main-panel (min-width: 1000px) {
  #admin-view .catalog-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.catalog-card { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 15px; display: grid; grid-template-columns: 1fr auto; gap: 15px; }
.catalog-card h4 { margin: 0 0 6px; font-size: 13px; }
.catalog-card p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 11px; }
/* Skills 页面（skills.js）：我的 Skill、默认 Skill；每张卡片有开关和操作按钮。 */
.skills-page { max-width: 980px; }
.skills-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 8px 0 6px; }
.skills-head h2 { margin: 0; font-size: 22px; }
.skill-new { padding: 8px 16px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.skill-new:hover { filter: brightness(1.06); }
.skills-intro, .skills-sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.skills-sub { margin: -4px 0 12px; font-size: 13px; }
.skills-status, .skills-warning { margin: 0 0 14px; padding: 8px 12px; border-radius: 10px; font-size: 13.5px; }
.skills-status { background: color-mix(in srgb, var(--danger, #d64545) 12%, transparent); color: var(--danger, #d64545); }
.skills-warning { background: color-mix(in srgb, #d4a72c 16%, transparent); color: #a16207; }
.skills-section { margin-top: 22px; }
.skills-section h3 { margin: 0 0 12px; font-size: 16px; }
.skills-section h3 span + span { color: var(--muted); font-weight: 400; }
.skills-empty { grid-column: 1 / -1; margin: 0; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 14px; line-height: 1.6; }
#admin-view .skill-card { grid-template-columns: 1fr; gap: 12px; align-content: space-between; }
.skill-card h4 { font-size: 15px; }
.skill-card p { font-size: 13.5px; }
.skill-card.is-off .skill-copy { opacity: .55; }
.skill-actions { display: flex; align-items: center; gap: 8px; }
.skill-action { padding: 5px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.skill-action:hover { border-color: var(--muted); }
.skill-action.is-danger { color: var(--danger, #d64545); }
.skill-switch { position: relative; display: inline-flex; align-items: center; margin-right: auto; cursor: pointer; }
.skill-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.skill-switch-track { position: relative; width: 36px; height: 20px; border-radius: 10px; background: var(--line); transition: background .15s; }
.skill-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #0003; transition: transform .15s; }
.skill-switch input:checked + .skill-switch-track { background: var(--accent); }
.skill-switch input:checked + .skill-switch-track::after { transform: translateX(16px); }
.skill-switch input:focus-visible + .skill-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.skill-switch input:disabled + .skill-switch-track { opacity: .6; }
/* 新建、编辑 Skill 的弹窗。 */
.skill-editor { width: min(720px, calc(100vw - 32px)); max-height: 90vh; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: 0 20px 70px #0003; }
.skill-editor::backdrop { background: #0005; }
.skill-editor form { display: flex; flex-direction: column; gap: 16px; padding: 20px 22px; }
.skill-editor h2 { margin: 0; font-size: 18px; }
.skill-field { display: flex; flex-direction: column; gap: 6px; }
.skill-field-label { font-size: 14px; font-weight: 600; }
.skill-field-hint { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.skill-field :is(input, textarea) { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; line-height: 1.5; resize: vertical; }
.skill-field :is(input, textarea):focus { outline: none; border-color: var(--accent); }
.skill-content { min-height: 220px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.skill-error { margin: 0; color: var(--danger, #d64545); font-size: 13px; }
.skill-editor-buttons { display: flex; justify-content: flex-end; gap: 10px; }
.skill-save { padding: 7px 18px; border: 0; border-radius: 9px; background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.skill-save:disabled { opacity: .6; cursor: default; }
.skill-preview-button { justify-self: start; padding: 6px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; }
.skill-preview-dialog { width: min(900px, calc(100vw - 32px)); max-height: 85vh; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: 0 20px 70px #0003; }
.skill-preview-dialog::backdrop { background: #0005; }
.skill-preview-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.skill-preview-dialog h2 { margin: 0; min-width: 0; font-size: 16px; overflow-wrap: anywhere; }
.skill-preview-dialog header button { flex-shrink: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--accent); padding: 6px 12px; cursor: pointer; }
.skill-preview-content { max-height: calc(85vh - 80px); overflow: auto; margin: 0; padding: 20px; font: 14px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.skill-preview-content h3 { margin: 0 0 8px; font: 600 15px/1.5 sans-serif; }
.skill-preview-content pre { margin: 0 0 20px; padding: 12px; background: #80808008; border: 1px solid var(--line); border-radius: 8px; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.toggle { width: 36px; height: 20px; border-radius: 20px; border: 0; padding: 2px; background: #c8cdd2; cursor: pointer; transition: .2s; }
.toggle::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0002; transition: .2s; }
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(16px); background: white; }
.error { color: var(--danger); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pulse { to { opacity: .25; transform: translateY(-2px); } }
@keyframes messageReveal { from { opacity: 0; transform: translateY(8px); } }
@keyframes streamCaretBlink { 0%, 40% { opacity: .85; } 55%, 100% { opacity: .15; } }
@keyframes thinkingShimmer { from { background-position: 100% 0; } to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) {
  .message, .message.is-new, .message-content .stream-caret, .run-status-phase { animation: none; opacity: 1; transform: none; filter: none; }
}
@media (max-width: 760px) {
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  .app-shell {
    display: block;
    position: fixed;
    inset: 0;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    touch-action: pan-x pan-y;
    transform: translateY(var(--vv-offset-top, 0px)) translateZ(0);
    will-change: transform;
  }
  .main-panel { width: 100%; }
  body.debug-mode .debug-panel { display: none; }
  #chat-view {
    padding-bottom: var(--keyboard-inset-bottom, 0px);
    transition: padding-bottom .18s ease;
  }
  .sidebar-toggle {
    display: grid;
    position: fixed;
    top: max(17px, env(safe-area-inset-top));
    left: 16px;
    z-index: 60;
    width: 38px;
    height: 38px;
    place-content: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffffed;
    box-shadow: 0 3px 14px #17231c12;
    cursor: pointer;
  }
  .sidebar-toggle span { display: block; width: 17px; height: 1.5px; border-radius: 2px; background: #454c54; transition: transform .2s ease; }
  .sidebar-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
  .sidebar-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 40; background: #17231c45; backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
  .sidebar-backdrop.open { display: block; opacity: 1; pointer-events: auto; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(82vw, 300px);
    padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
    box-shadow: 18px 0 44px #1420181f;
    transform: translateX(-102%);
    transition: transform .22s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .sidebar-brand { margin-top: 48px; }
  .topbar { height: 64px; min-height: 64px; padding: 0 18px 0 68px; justify-content: flex-end; }
  .topbar-copy { display: none; }
  .topbar-actions { gap: 7px; }
  .font-size-picker { height: 38px; }
  .catalog-grid { grid-template-columns: 1fr; }
  .messages { min-height: 0; padding: 28px 16px 18px; }
  .markdown-table-wrap { margin-right: 0; }
  .markdown-table-wrap th, .markdown-table-wrap td { padding-right: 12px; }
  .composer-wrap {
    position: relative;
    flex: 0 0 auto;
    z-index: 30;
    padding: 14px 16px max(12px, env(safe-area-inset-bottom));
    background: linear-gradient(transparent, var(--bg) 18%);
  }
  .composer { min-height: 64px; grid-template-columns: 36px minmax(0, 1fr) 36px 36px; gap: 6px; padding: 7px 10px; border-radius: 24px; }
  .composer-camera, .composer-voice, .send-button { width: 36px; height: 36px; }
  .composer-camera svg { width: 28px; height: 28px; }
  .composer-voice svg { width: 30px; height: 30px; }
  .send-button svg { width: 21px; height: 21px; }
  .welcome { width: 100%; margin-top: 5vh; }
  .welcome p { max-width: 330px; overflow-wrap: anywhere; }
}

#agent-mode, #cancel-work { border: 1px solid var(--border, #d7dce1); border-radius: 8px; background: var(--surface, white); color: inherit; padding: 7px 9px; font: inherit; }
#cancel-work[hidden] { display: none; }

/* Work 任务状态：输入框正上方居中的小胶囊。 */
#work-status { align-self: center; margin: 0 0 6px; padding: 5px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 13px; }
#work-status[hidden] { display: none; }
#resume-work { margin: 4px 24px; align-self: flex-start; }
.work-artifact { display: block; margin: 10px 0; }
/* Work 交付的文件卡片：点卡片在右边预览（file-preview.js），“下载”直接下载。 */
.work-file { display: flex; align-items: center; gap: 10px; margin: 10px 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; transition: border-color .15s; }
.work-file:hover { border-color: var(--muted); }
.work-file.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.work-file-icon { color: var(--accent); }
.work-file-name { min-width: 0; overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.work-file-size { flex-shrink: 0; color: var(--muted); font-size: 13px; }
.work-file-actions { display: flex; gap: 6px; flex-shrink: 0; margin-left: auto; }
.work-file-actions :is(button, a) { padding: 3px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; }
.work-file-actions :is(button, a):hover { border-color: var(--muted); }
/* 文件预览面板贴在主区域右边，聊天内容让出位置；窄屏盖在聊天上面，手机上占满整屏。 */
.main-panel { --fp-width: clamp(360px, 44%, 760px); }
.main-panel > .fp-panel { position: absolute; top: 0; right: 0; bottom: 0; z-index: 25; width: var(--fp-width); border-left: 1px solid var(--line); }
.main-panel.fp-open > .view.active { margin-right: var(--fp-width); }
@media (max-width: 1100px) {
  .main-panel.fp-open > .view.active { margin-right: 0; }
  .main-panel > .fp-panel { width: min(100%, 680px); box-shadow: -12px 0 24px -16px rgba(0, 0, 0, .4); }
}
@media (max-width: 760px) {
  .main-panel > .fp-panel { position: fixed; inset: 0; width: 100%; z-index: 60; }
}

/* Sidebar mode switch and a quiet main header. */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#agent-mode[hidden] { display: none; }
#chat-view .topbar { height: 56px; min-height: 56px; padding: 0 22px 0 64px; border-bottom: 0; background: var(--bg); backdrop-filter: none; }
.sidebar-toggle { top: 8px; left: 16px; width: 34px; height: 40px; padding: 4px; }
.sidebar-toggle svg { width: 27px; height: 27px; stroke-width: 1.6; }
.mode-switch { align-self: flex-start; margin-bottom: 18px; display: flex; align-items: center; gap: 3px; padding: 3px; border-radius: 16px; background: var(--panel-2); }
.mode-switch button { display: grid; place-items: center; width: 60px; height: 50px; padding: 10px; border: 2px solid transparent; border-radius: 13px; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.mode-switch button[aria-checked="true"] { background: var(--panel); color: var(--text); border-color: var(--line); box-shadow: 0 1px 3px #0002; }
.mode-switch button:hover { color: var(--text); }
.mode-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.mode-switch button:disabled { cursor: default; opacity: .65; }
.mode-switch svg { width: 28px; height: 28px; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 760px) {
  /* 顶栏和侧边栏按钮让出状态栏：iOS 原生壳里网页铺满全屏（安全区约 62px）；浏览器和主屏幕网页里安全区是 0，不变。 */
  #chat-view .topbar { padding: env(safe-area-inset-top) 14px 0 64px; height: calc(64px + env(safe-area-inset-top)); min-height: calc(64px + env(safe-area-inset-top)); }
  .sidebar-toggle { top: calc(12px + env(safe-area-inset-top)); left: 16px; background: transparent; box-shadow: none; }
  .mode-switch button { width: 49px; height: 46px; }
  #chat-view .topbar-actions { gap: 5px; }
}
@media (max-width: 360px) {
  .mode-switch button { width: 42px; }
  #chat-view .font-settings summary { width: 27px; padding: 3px; }
}
@media (max-width: 760px) {
  #chat-view .topbar { justify-content: flex-end; }
  .sidebar > .mode-switch { margin-top: 48px; }
  .sidebar-toggle { border: 0; }
}


/* 桌面端：侧边栏切换按钮固定在窗口最左侧。侧边栏打开时与模式切换并排，位于侧边栏最左边；
   收起时停在对话区左上角。移动端保持原来的汉堡菜单布局。 */
@media (min-width: 761px) {
  /* 垂直中心与侧边栏顶栏（顶部留白 18px + 高 44px）对齐。
     侧边栏收起时在页面最左侧；展开时在侧边栏顶栏的最右侧（侧边栏宽 256px）。 */
  .sidebar-toggle { position: fixed; top: 20px; left: 14px; }
  body.sidebar-open .sidebar-toggle { left: 254px; }
  /* 对话区顶栏同步对齐，让右上角的 Aa 按钮与开关在同一水平线上。 */
  #chat-view .topbar { height: 62px; min-height: 62px; padding-top: 18px; }
  /* 右侧按钮（Aa）与居中的对话内容列右边缘对齐（与消息、输入框同一套宽度公式），不贴着窗口边缘。 */
  #chat-view .topbar { justify-content: flex-end; padding-right: max(22px, calc((100% - 790px) / 2)); }
  body.sidebar-open .app-shell { --sidebar-width: 300px; }
  /* 品牌名靠左，与下方导航项的图标对齐；右侧给开关留出位置。 */
  body.sidebar-open .sidebar-header { padding: 0 44px 0 8px; }
  body.sidebar-open #chat-view .topbar { padding-left: 22px; }
}

/* 侧边栏顶栏：品牌名（衬线体）+ 右侧紧凑的 Chat / Work 切换。 */
.sidebar-header { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0 0 14px; }
/* 品牌字标：接近 Claude 字标的风格——衬线、笔画偏细、字距偏紧。 */
.sidebar-header .sidebar-brand { margin: 0; padding: 0; font-family: "Source Serif 4", Georgia, serif; font-size: 28px; font-weight: 450; line-height: 1; letter-spacing: -.025em; }
.sidebar-header .mode-switch { margin: 0 0 0 auto; padding: 3px; gap: 2px; border-radius: 12px; }
.sidebar-header .mode-switch button { width: 44px; height: 36px; padding: 6px; border-width: 1px; border-radius: 9px; }
.sidebar-header .mode-switch svg { width: 22px; height: 22px; }

/* 侧边栏开关：纯图标，任何状态都没有底色。 */
/* 选择器带上 .app-shell，优先级高于 theme.css 里暗色模式的底色规则。 */
html[data-theme] .app-shell .sidebar-toggle, html[data-theme] .app-shell .sidebar-toggle[aria-expanded="true"] { background: transparent; box-shadow: none; }
html[data-theme] .app-shell .sidebar-toggle:hover { background: transparent; color: var(--text); }

/* 会话列表：按日期分组，组名浅灰，条目字号更大。 */
.session-group { padding: 18px 12px 6px; color: var(--muted); font-size: 13px; }
.session-group:first-child { padding-top: 4px; }
.session-list { margin-top: 20px; }
.session { padding: 9px 12px; border-radius: 10px; font-size: 15px; }
html[data-theme="dark"] .session { color: #e8e6df; }
html[data-theme="dark"] .session.active { background: #33332f; color: #ffffff; }
@media (hover: hover) { html[data-theme="dark"] .session:hover { background: #33332f; color: #ffffff; } }

@media (max-width: 760px) {
  .sidebar .sidebar-header { margin-top: 48px; }
}

/* 输入框：上面是输入区，下面一行左侧是附加按钮，右侧是语音与发送。 */
.composer { grid-template-columns: minmax(0, 1fr) auto 38px 38px; grid-template-areas: "input input input input" ". . voice send"; position: relative; row-gap: 6px; padding: 14px 12px 10px 14px; border-radius: 22px; }
.composer textarea { grid-area: input; padding: 2px 6px 0; }
.composer-voice { grid-area: voice; }
.composer .send-button { grid-area: send; }

/* 欢迎页：问候语和输入框作为一组，在对话区中部（略偏上）居中。 */
#chat-view.is-welcome .messages { flex: 0 0 auto; margin-top: auto; overflow: visible; padding-bottom: 30px; }
#chat-view.is-welcome .composer-wrap { margin-bottom: auto; padding-bottom: 16vh; background: none; }
#chat-view.is-welcome .composer textarea { min-height: 56px; }
.welcome { margin: 0 auto; }
.welcome h2 { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 0; font-family: "Source Serif 4", "Noto Serif SC", Georgia, serif; font-size: 42px; font-weight: 400; letter-spacing: -.01em; }
.welcome-mark { width: 48px; height: 48px; flex-shrink: 0; }

@media (max-width: 760px) {
  .welcome h2 { font-size: 30px; gap: 10px; }
  .welcome-mark { width: 32px; height: 32px; }
}

/* 品牌字标使用正文颜色（浅色模式为黑色，暗黑模式为浅色），蓝色只留给左侧标志。 */
.sidebar-header .sidebar-brand { color: var(--text); }

/* 浅色模式下提高侧边栏辨识度：文字和图标使用正文颜色（接近黑色），只有分组标题保持灰色。 */
html:not([data-theme="dark"]) :is(.new-chat, .nav-item, .session, .theme-toggle, .lang-toggle, .mode-switch button, .sidebar-toggle) { color: var(--text); }

/* 语音输入按钮：录音中变红并呼吸闪烁，识别中半透明。 */
.composer-voice { padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
/* 麦克风用主文字色（深色主题是白色），不用灰色。 */
.composer-voice { color: var(--text); }
.composer-voice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#voice-button[data-state="recording"] { color: #fff; background: #e5484d; animation: voice-pulse 1.2s ease-in-out infinite; }
#voice-button[data-state="starting"], #voice-button[data-state="transcribing"] { opacity: .55; cursor: progress; }
@keyframes voice-pulse { 50% { box-shadow: 0 0 0 6px #e5484d33; } }
@media (prefers-reduced-motion: reduce) { #voice-button[data-state="recording"] { animation: none; } }

/* 语音状态提示：与任务状态同样的胶囊样式，出错时为红色文字。 */
#voice-status { align-self: center; margin: 0 0 6px; padding: 5px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 13px; }
#voice-status[hidden] { display: none; }
#voice-status[data-error="true"] { color: #e5484d; }

/* 顶栏正中的 Chat / Work 胶囊切换。会话开始后锁定，只显示当前模式。 */
#chat-view .topbar { position: relative; }
.mode-toggle { position: absolute; left: 50%; top: 50%; z-index: 2; display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); transform: translate(-50%, -50%); }
.mode-toggle button { padding: 6px 18px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; }
.mode-toggle button[aria-checked="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px #0002; }
.mode-toggle button:disabled { cursor: default; }
.mode-toggle button:disabled[aria-checked="false"] { display: none; }
.mode-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
html[data-theme="dark"] .mode-toggle { background: #1c1c1b; }
html[data-theme="dark"] .mode-toggle button[aria-checked="true"] { background: #3a3a37; }

/* 会话列表里 Work 会话的文字标记。 */

/* 侧边栏开关图标缩小，比品牌字标更轻。 */
html[data-theme] .app-shell .sidebar-toggle svg { width: 20px; height: 20px; stroke-width: 1.8; }

/* 侧边栏搜索框（点击打开搜索弹窗）。 */
.sidebar-search { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; margin: 0 0 10px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--muted); font-size: 14px; text-align: left; cursor: pointer; }
.sidebar-search:hover { color: var(--text); }
.sidebar-search svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.sidebar-search span { flex: 1; }
.sidebar-search kbd { padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; font: 11px/1.5 ui-sans-serif, system-ui, sans-serif; color: var(--muted); }

/* 搜索弹窗。 */
.search-dialog { width: min(720px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 80px)); margin: 10vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); color: var(--text); box-shadow: 0 24px 64px #0000004d; overflow: hidden; }
.search-dialog[open] { display: flex; flex-direction: column; }
.search-dialog::backdrop { background: #0000005c; backdrop-filter: blur(2px); }
.search-head { display: flex; align-items: center; gap: 12px; padding: 22px 22px 10px 26px; }
.search-head input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 20px; }
.search-head input::-webkit-search-cancel-button { display: none; }
.search-close { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.search-close:hover { background: var(--panel-2); color: var(--text); }
.search-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.search-tabs { display: flex; gap: 6px; padding: 4px 22px 14px; border-bottom: 1px solid var(--line); }
.search-tabs button { padding: 6px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; }
.search-tabs button[aria-selected="true"] { background: var(--panel-2); color: var(--text); font-weight: 600; }
.search-results { overflow: auto; padding: 10px; }
.search-result { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-radius: 12px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.search-result[aria-selected="true"] { background: var(--panel-2); }
.search-result-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.search-result-text { display: grid; gap: 2px; min-width: 0; }
.search-result-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.search-result-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.search-result mark { background: transparent; color: inherit; font-weight: 700; }
.search-result-time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.search-empty { margin: 24px; color: var(--muted); text-align: center; }

/* 侧边栏品牌标志：实心蓝色四叶花瓣，颜色与发送按钮一致，位于 Takit 字标左侧。 */
.sidebar-header .sidebar-brand { display: inline-flex; align-items: center; gap: 9px; }
.brand-mark { width: 26px; height: 26px; flex-shrink: 0; }

/* Markdown 分隔线（---）。 */
.message-content hr { height: 0; margin: 22px 0; border: 0; border-top: 1px solid var(--line); }

/* 主题切换图标：浅色模式下显示月亮（品牌蓝），暗黑模式下显示太阳（金色）。 */
html:not([data-theme="dark"]) #theme-icon { color: #2563eb; }
html[data-theme="dark"] #theme-icon { color: #f5b301; }

/* 回到底部按钮：输入框上方居中的圆形按钮。 */
.scroll-bottom { position: absolute; top: -34px; left: 50%; z-index: 5; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--text); box-shadow: 0 4px 14px #0000001f; transform: translateX(-50%); cursor: pointer; }
.scroll-bottom[hidden] { display: none; }
.scroll-bottom:hover { background: var(--panel-2); }
.scroll-bottom:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scroll-bottom svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* 助手回复下方的操作栏：复制、朗读、点赞、点踩、重新生成。 */
.message-actions { display: flex; align-items: center; gap: 4px; margin-top: 10px; margin-left: -8px; }
/* 回复下面的操作按钮（复制、朗读、赞、踩、收藏）：图标 24px，按钮 40px；手机端再大一些（见下方 max-width: 760px）。 */
.message-action { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.message-action:hover { background: var(--panel-2); color: var(--text); }
.message-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.message-action svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.message-action[aria-pressed="true"] { color: var(--accent); }
.message-action[aria-pressed="true"] svg { fill: color-mix(in srgb, var(--accent) 18%, transparent); }
.action-speak[data-state="loading"] { opacity: .55; cursor: progress; }
.action-speak[data-state="playing"] { color: var(--accent); }
.action-speak[data-state="error"] { color: #e5484d; }

/* 思考动画的 64px 画框内部本身留有空白，用负边距抵消，让它紧贴上方分隔线。 */
.stream-activity .rose-thinking { margin: -8px 0 -8px -10px; }

/* 失败回复下的重试按钮：带文字，比图标按钮更醒目。 */
.message-action.action-retry-labeled { display: inline-flex; gap: 6px; width: auto; padding: 0 12px 0 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); font-size: 13px; }
@media (max-width: 760px) {
  .message-action { width: 44px; height: 44px; }
  .message-action svg { width: 26px; height: 26px; }
}

/* 天气卡片：数据直接来自天气工具结果。 */
.weather-card { margin: 4px 0 18px; padding: 18px 20px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); font-family: Inter, -apple-system, "PingFang SC", sans-serif; }
.weather-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.weather-now { display: flex; align-items: center; gap: 14px; }
.weather-now .weather-icon { width: 44px; height: 44px; }
.weather-now-temp { font-size: 34px; font-weight: 600; line-height: 1.1; }
.weather-now-place { font-size: 20px; font-weight: 600; }
.weather-now-label, .weather-peak-label, .weather-date, .weather-rain, .weather-source { color: var(--muted); font-size: 13px; }
.weather-peak { text-align: right; }
.weather-peak-temp { font-size: 22px; font-weight: 600; line-height: 1.3; }
.weather-days { display: grid; gap: 2px; padding: 4px 0; border-top: 1px solid var(--line); }
.weather-day { display: grid; grid-template-columns: 70px minmax(110px, 1fr) minmax(90px, 1.6fr) 74px; align-items: center; gap: 12px; padding: 8px 0; }
.weather-weekday { font-weight: 600; font-size: 15px; }
.weather-sky { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; }
.weather-sky-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weather-range { display: flex; align-items: center; gap: 8px; }
.weather-track { position: relative; flex: 1; height: 6px; border-radius: 999px; background: var(--panel-2); }
.weather-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, #f5c26b, #f08a3c); }
.weather-fill.wet { background: linear-gradient(90deg, #8cc4f2, #3f8ee8); }
.weather-rain { width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.weather-temps { display: flex; justify-content: flex-end; gap: 8px; font-variant-numeric: tabular-nums; }
.weather-high { font-weight: 600; }
.weather-low { color: var(--muted); }
.weather-source { margin-top: 6px; }
.weather-icon { width: 26px; height: 26px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.weather-icon .sun { stroke: #f5a623; }
.weather-icon .moon { stroke: #8fa8d8; }
.weather-icon .rain { stroke: #3f8ee8; }
@media (max-width: 760px) {
  .weather-card { padding: 14px 14px 10px; }
  .weather-day { grid-template-columns: 54px minmax(70px, 1fr) minmax(60px, 1.2fr) 64px; gap: 8px; }
  .weather-sky-label { display: none; }
}

/* Skill 预览：Markdown / Raw 切换；Markdown 模式按回答正文的排版渲染，元信息显示为字段表。 */
.skill-preview-dialog header .preview-modes { display: flex; gap: 2px; margin-left: auto; padding: 2px; border-radius: 9px; background: var(--panel-2); }
.skill-preview-dialog header .preview-modes[hidden] { display: none; }
.skill-preview-dialog header .preview-modes button { padding: 4px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; }
.skill-preview-dialog header .preview-modes button[aria-checked="true"] { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px #0002; }
.skill-preview-content.is-markdown { font: inherit; white-space: normal; }
.skill-meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--panel-2) 60%, transparent); font-size: 13px; }
.skill-meta dt { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.skill-meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.skill-meta a { color: var(--accent); }

/* 预览弹窗中的 Markdown 正文使用主题正文色（.message-content 默认是浅色主题的深灰字）。 */
.skill-preview-content .skill-markdown { color: var(--text); white-space: normal; }
.skill-preview-content .skill-markdown blockquote { color: var(--muted); }

/* 失败提示在两种主题下都显示为红色。 */
html[data-theme="dark"] .message-content.error { color: #ff6b6b; }

/* 桌面端顶栏有 18px 顶部留白，切换按钮跟着下移半个留白，与 Aa 按钮对齐。 */
@media (min-width: 761px) {
  .mode-toggle { margin-top: 9px; }
}

/* 手机端欢迎页仿照 Claude：问候语在屏幕中间，输入框留在底部（贴近键盘）。 */
@media (max-width: 760px) {
  #chat-view.is-welcome .messages { flex: 1 1 auto; margin-top: 0; display: flex; align-items: center; justify-content: center; padding-bottom: 0; }
  #chat-view.is-welcome .composer-wrap { margin-bottom: 0; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  /* 键盘弹出时底部安全区（Home 指示条）被键盘盖住，不再留白，输入框贴近键盘。 */
  /* App 里不在这里改（会让输入框先跳一下），由 app.js 的 moveForKeyboard 把这段差值算进移动距离。 */
  html.keyboard-open:not(.native-app) #chat-view .composer-wrap { padding-bottom: 2px; }
  /* 顶栏上面有状态栏安全区时（iOS 原生壳），放在安全区以下那部分的正中间；浏览器里安全区是 0，不变。 */
  .mode-toggle { top: calc(50% + env(safe-area-inset-top) / 2); }
  .mode-toggle button { padding: 6px 16px; }
}

/* 手机端侧边栏仿照 Claude：字号和行高明显加大，便于手指点按。 */
@media (max-width: 760px) {
  .sidebar { width: min(86vw, 340px); padding-left: 16px; padding-right: 16px; }
  .sidebar-header .sidebar-brand { font-size: 36px; }
  .sidebar-search { height: 52px; font-size: 20px; border-radius: 14px; }
  .sidebar-search svg { width: 24px; height: 24px; }
  :is(.new-chat, .nav-item) { height: 56px; gap: 16px; font-size: 22px; border-radius: 14px; }
  .new-chat svg { width: 28px; height: 28px; }
  .sidebar-nav-icon { width: 28px; font-size: 26px; }
  .session-group { padding: 24px 12px 8px; font-size: 19px; }
  .session { padding: 14px 12px; border-radius: 14px; font-size: 21px; }
}

/* 阅读字号：--font-scale 是用户在 Aa 面板里选的比例，--device-scale 是设备的放大倍数；手机端默认再放大 40%，正文约 21.5px。 */
body { --device-scale: 1; --reading-scale: calc(var(--font-scale, 1.1) * var(--device-scale)); }
/* 回复取消额外一档放大；用户气泡保留原字号，Aa 仍统一调整。 */
.message.assistant { --reading-scale: calc(var(--font-scale, 1.1) * var(--device-scale, 1)); }
.message.user { --reading-scale: calc((var(--font-scale, 1.1) + .1) * var(--device-scale, 1)); margin-bottom: 18px; }
@media (max-width: 760px) {
  body { --device-scale: 1.4; }
  .composer textarea { font-size: 20px; line-height: 1.45; }
}
/* iPad 等触屏平板（宽度超过手机断点）：默认放大 30%，正文约 20px；电脑不受影响。 */
@media (min-width: 761px) and (max-width: 1366px) and (pointer: coarse) {
  body { --device-scale: 1.3; }
}

/* 手机端输入框只占两行：一行输入、一行按钮；模型菜单与输入框等宽，不超出屏幕。 */
@media (max-width: 760px) {
  #chat-view.is-welcome .composer textarea, .composer textarea { min-height: 0; }
}

/* 手机端欢迎语：标志放在问候语上方并放大，问候语字号加大。
   钉在屏幕固定位置（2026-10-28 晚）：renderWelcome 把它放在 #chat-view 下面、不在消息区里，也不参与键盘动画的 transform；
   top 按 #chat-view 的高度算，键盘弹出时只变 #chat-view 的底部留白，高度不变，所以键盘弹出、收起时纹丝不动。 */
@media (max-width: 760px) {
  .welcome h2 { flex-direction: column; gap: 18px; font-size: 40px; line-height: 1.15; text-align: center; }
  .welcome-mark { width: 64px; height: 64px; }
  #chat-view > .welcome { position: absolute; top: 42%; left: 16px; right: 16px; width: auto; margin: 0; transform: translateY(-50%); pointer-events: none; }
}

/* 桌面端输入框字号同步加大。 */
@media (min-width: 761px) {
  .composer textarea { font-size: 18px; }
}

/* 思考状态：动画与文字靠近（动画四周留白较多，用负边距收紧），文字与动画同为蓝色。 */
.stream-activity .rose-thinking { margin-right: -16px; }
:root .message-content .stream-activity { color: var(--accent); }

/* 输入框字号与回复正文一致，并跟随 Aa 字号设置。 */
:root .composer textarea { font-size: calc(14px * var(--reading-scale, 1)); line-height: 1.45; }

/* 手机端侧边栏打开时：切换按钮移到 Takit 同一行的最右侧，顶栏不再预留按钮的空间。 */
@media (max-width: 760px) {
  .sidebar-toggle { transition: left .22s ease, top .22s ease; }
  body.sidebar-open .sidebar .sidebar-header { margin-top: 0; padding: 0 0 0 8px; }
  body.sidebar-open .sidebar-toggle { top: calc(max(18px, env(safe-area-inset-top)) + 3px); left: calc(min(86vw, 340px) - 16px - 38px); }
}

/* 手机端顶栏浮在对话上面，不再单独占一行：消息可以滚到按钮下面。
   侧边栏按钮和 Aa 都是半透明、毛玻璃的圆形，垂直中心对齐（状态栏以下 32px）。 */
@media (max-width: 760px) {
  html[data-theme] .app-shell #chat-view .topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 20; background: transparent; pointer-events: none; }
  #chat-view .topbar > * { pointer-events: auto; }
  #chat-view .messages { padding-top: calc(64px + env(safe-area-inset-top)); }
  html[data-theme] .app-shell .sidebar-toggle:not([aria-expanded="true"]),
  #chat-view .font-settings > summary {
    width: 44px;
    height: 44px;
    border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--panel) 76%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
    box-shadow: 0 4px 16px #0000001f;
  }
  html[data-theme] .app-shell .sidebar-toggle:not([aria-expanded="true"]) { top: calc(10px + env(safe-area-inset-top)); color: var(--text); }
}

/* 状态文字（Thinking、Searching the web 等）：蓝色底色上一道高光从左向右循环扫过。 */
.stream-activity-label,
:root .run-status-phase {
  color: var(--accent);
  /* 数字滚动时宽度不跳。 */
  font-variant-numeric: tabular-nums;
  /* 背景宽度是文字的 3 倍，高光带位于中间（约占文字宽度的 60%）。
     background-position 从 80% 到 20% 时，高光带从文字左边缘进入、从右边缘离开，
     匀速扫过一次后在文字外短暂停顿，再开始下一次。 */
  background: linear-gradient(90deg, var(--accent) 40%, color-mix(in srgb, var(--accent) 15%, #ffffff) 50%, var(--accent) 60%);
  background-size: 300% 100%;
  background-position: 80% 0;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: labelSweep 2s ease-in-out infinite;
}
@keyframes labelSweep {
  0% { background-position: 80% 0; }
  85%, 100% { background-position: 20% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .stream-activity-label { animation: none; -webkit-text-fill-color: currentColor; }
}

/* 来源：正文里的小标签、操作栏里的“来源”按钮、底部来源面板。 */
:root .message.assistant .message-content a.source-citation { display: inline-flex; align-items: center; gap: 4px; max-width: 12em; margin-left: 2px; padding: .05em .65em; border: 0; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-family: ui-sans-serif, system-ui, -apple-system, sans-serif; font-size: .72em; line-height: 1.6; vertical-align: .12em; text-decoration: none; white-space: nowrap; cursor: pointer; }
:root .message.assistant .message-content a.source-citation:hover { color: var(--text); border-color: transparent; }
.source-citation-name { overflow: hidden; text-overflow: ellipsis; }
.source-citation-more { flex-shrink: 0; opacity: .8; }
.source-icon { position: relative; display: inline-grid; place-items: center; width: 22px; height: 22px; flex-shrink: 0; overflow: hidden; border-radius: 50%; background: var(--panel-2); color: var(--muted); font: 600 11px/1 ui-sans-serif, system-ui, sans-serif; }
.source-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; opacity: 0; }
.source-icon.has-image img { opacity: 1; }
.message-sources { display: inline-flex; align-items: center; gap: 8px; height: 32px; margin-left: 4px; padding: 0 12px 0 6px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; }
.message-sources:hover { background: var(--panel-2); color: var(--text); }
.message-sources-icons { display: inline-flex; }
.message-sources-icons .source-icon { border: 2px solid var(--bg); }
.message-sources-icons .source-icon + .source-icon { margin-left: -8px; }

.sources-sheet { position: fixed; inset: 0; z-index: 90; }
.sources-sheet[hidden] { display: none; }
.sources-backdrop { position: absolute; inset: 0; background: #00000066; opacity: 0; transition: opacity .22s ease; }
.sources-panel { position: absolute; left: 50%; bottom: 0; display: flex; flex-direction: column; width: min(100%, 640px); height: 55vh; height: 55dvh; border-radius: 22px 22px 0 0; background: var(--panel); box-shadow: 0 -10px 40px #00000040; transform: translate(-50%, 100%); transition: transform .22s ease, height .22s ease; }
.sources-panel.is-full { height: calc(100vh - 12px); height: calc(100dvh - max(12px, env(safe-area-inset-top))); }
.sources-panel.is-dragging { transition: none; }
.sources-sheet.open .sources-backdrop { opacity: 1; }
.sources-sheet.open .sources-panel { transform: translate(-50%, 0); }
.sources-handle { display: grid; place-items: center; height: 22px; flex-shrink: 0; cursor: grab; touch-action: none; }
.sources-handle span { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.sources-header { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 10px 22px; border-bottom: 1px solid var(--line); touch-action: none; }
.sources-header h2 { margin: 0; color: var(--muted); font-size: 17px; font-weight: 600; }
.sources-close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--panel-2); color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.sources-list { flex: 1; margin: 0; padding: 4px 22px max(16px, env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; list-style: none; }
.sources-list li + li { border-top: 1px solid var(--line); }
.source-item { display: grid; gap: 4px; padding: 16px 0; color: var(--text); text-decoration: none; }
.source-item-site { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.source-item-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; line-height: 1.4; }
.source-item-date { color: var(--muted); font-size: 13px; }
.source-item:hover .source-item-title { text-decoration: underline; }
@media (max-width: 760px) {
  .source-item-site { font-size: 20px; }
  .source-item-title { font-size: 16px; }
  .source-item-date { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .sources-panel, .sources-backdrop { transition: none; }
}

/* 图片附件：输入框左下角的“+”按钮，输入区上方的缩略图条；用户消息里的图片显示在气泡上方。 */
.composer { grid-template-columns: 38px minmax(0, 1fr) auto 38px 38px; grid-template-areas: "strip strip strip strip strip" "note note note note note" "input input input input input" "attach . . voice send"; }
/* 左边的 + 和右边的麦克风一样用主文字色（深色主题是白色），不用灰色。 */
.composer-attach { grid-area: attach; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; }
.composer-attach:hover { background: var(--panel-2); }
.composer-attach[hidden] { display: none; }
.composer-attach svg { width: 20px; height: 20px; }
.attachments { grid-area: strip; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; }
.attachments[hidden] { display: none; }
.attachment { position: relative; flex: 0 0 auto; width: 64px; height: 64px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.attachment img { width: 100%; height: 100%; object-fit: cover; }
.attachment-uploading img { opacity: .45; }
.attachment-uploading::after { content: ""; position: absolute; inset: 22px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: attachmentSpin .8s linear infinite; }
@keyframes attachmentSpin { to { transform: rotate(360deg); } }
.attachment-error img { opacity: .35; }
.attachment-error { border-color: #ef4444; }
.attachment-error .attachment-error { position: absolute; left: 0; right: 0; bottom: 4px; color: #ef4444; font-size: 10px; text-align: center; }
.attachment-remove { position: absolute; top: 3px; right: 3px; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: #000000b3; color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }
.message-images { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-bottom: 6px; }
.message-images img { width: 120px; height: 120px; object-fit: cover; border: 1px solid var(--line); border-radius: 14px; cursor: zoom-in; }
@media (max-width: 760px) {
  .composer-attach { width: 36px; height: 36px; }
  .message-images img { width: 104px; height: 104px; }
}

/* 正文来源标签里的网站图标。 */
.source-citation .source-icon { width: 1.25em; height: 1.25em; margin-left: -.3em; font-size: inherit; }
.source-citation .source-icon[hidden] { display: none; }

/* 缩略图行和提示行为空时不占位：去掉网格行间距，改由输入区自身留出与按钮行的间隔。 */
.composer { row-gap: 0; }
.composer textarea { margin-bottom: 6px; }

/* 账户：全屏登录 / 资料页、账户按钮与菜单、对话框、导入提示。 */
body.auth-open { overflow: hidden; }
/* 登录页还没出来时（见 index.html），不显示聊天界面。 */
html.auth-pending .app-shell { visibility: hidden; }
.auth-screen { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; overflow-y: auto; padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); background: var(--bg); }
.auth-screen[hidden] { display: none; }
.auth-card { width: min(100%, 400px); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; color: var(--text); font: 450 30px/1 "Source Serif 4", Georgia, serif; letter-spacing: -.02em; }
.auth-brand img { width: 36px; height: 36px; border-radius: 9px; }
.auth-card h1 { margin: 0 0 8px; color: var(--text); font-size: 26px; font-weight: 600; }
.auth-subtitle { margin: 0 0 22px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.auth-form { display: grid; gap: 8px; }
.auth-form label { margin-top: 8px; color: var(--text); font-size: 14px; font-weight: 600; }
.auth-form input:not([type="checkbox"]), .auth-form select { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); font-size: 17px; }
.auth-form input:focus, .auth-form select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.auth-code-input { letter-spacing: .5em; text-align: center; font: 600 24px/1 ui-monospace, Menlo, monospace !important; }
.auth-turnstile { min-height: 65px; margin-top: 8px; }
.auth-primary, .auth-danger { height: 48px; margin-top: 12px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; }
.auth-danger { background: #dc2626; }
.auth-primary:disabled, .auth-danger:disabled { opacity: .6; cursor: default; }
.auth-primary.is-busy, .auth-danger.is-busy { cursor: progress; }
/* “使用 Google 继续”：按 Google 品牌规范，白底、彩色 G 标志、灰色描边。 */
.auth-google { display: flex; align-items: center; justify-content: center; gap: 12px; height: 48px; padding: 0 18px; border: 1px solid #dadce0; border-radius: 12px; background: #fff; color: #1f1f1f; font-size: 16px; font-weight: 600; text-decoration: none; }
.auth-google { width: 100%; cursor: pointer; font-family: inherit; }
.auth-google:disabled { opacity: .6; cursor: wait; }
.auth-apple { margin-top: 12px; background: #000; color: #fff; border-color: #fff; }
.auth-apple-mark { font: 26px/1 -apple-system, sans-serif; }
.auth-google:hover { background: #f8f9fa; }
.auth-google.auth-apple:hover { background: #222; }
.auth-google:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.auth-google-mark, .auth-google-mark svg { display: block; width: 20px; height: 20px; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 6px; color: var(--muted); font-size: 14px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
/* 出生日期：月 / 日 / 年三个下拉框排成一行。 */
.birth-picker { display: grid; grid-template-columns: 1.5fr 1fr 1.2fr; gap: 8px; }
.profile-agree { margin-top: 12px; text-align: center; }
.auth-link { padding: 8px 4px; border: 0; background: none; color: var(--accent); font-size: 15px; cursor: pointer; }
.auth-link:disabled { color: var(--muted); cursor: default; }
.auth-links { display: flex; justify-content: space-between; margin-top: 12px; }
.auth-error { min-height: 1.2em; margin: 4px 0 0; color: #ef4444; font-size: 14px; }
.auth-error:empty { min-height: 0; margin: 0; }
.auth-subtitle a { color: var(--accent); }
.account-slot { flex: 1; min-width: 0; }
.account-button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font-size: 15px; text-align: left; cursor: pointer; }
.account-button:hover { background: var(--panel-2); }
.account-button img { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.account-text { display: grid; min-width: 0; line-height: 1.25; }
.account-name, .account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-email { margin-top: 2px; color: var(--muted); font-size: .8em; }
.account-dialog { width: min(92vw, 440px); max-height: 90vh; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg); color: var(--text); }
.account-dialog::backdrop { background: #00000080; }
.account-dialog h2 { margin: 0 0 12px; font-size: 20px; }
.account-dialog p { color: var(--muted); line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.dialog-actions .auth-primary, .dialog-actions .auth-danger { margin-top: 0; height: 42px; }
.import-banner { margin: 8px 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.import-banner p { margin: 0 0 8px; color: var(--text); font-size: 14px; line-height: 1.45; }
.import-banner .auth-primary { height: 36px; font-size: 14px; }
@media (max-width: 760px) {
  .account-button { font-size: 18px; }
  .account-button img { width: 36px; height: 36px; }
}
/* 导入提示的按钮文字不换行；空间不够时按钮整体换到下一行。 */
.import-banner .dialog-actions { flex-wrap: wrap; }
.import-banner .dialog-actions button { white-space: nowrap; }

/* 头像：当前头像 + “换一个” / “上传图片”。 */
.avatar-picker { display: flex; align-items: center; gap: 18px; }
.avatar-preview { width: 84px; height: 84px; flex-shrink: 0; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.avatar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.auth-secondary { height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); font-size: 15px; cursor: pointer; }
.auth-secondary:hover { border-color: var(--muted); }

/* ===== 登录 / 注册页（重新设计） ===== */
.auth-screen { display: flex; flex-direction: column; align-items: center; padding: 0 20px max(32px, env(safe-area-inset-bottom)); background:
  radial-gradient(1200px 520px at 50% -180px, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), var(--bg); }
.auth-screen[hidden] { display: none; }
.auth-top { display: flex; align-items: center; justify-content: flex-end; gap: 8px; width: 100%; max-width: 1100px; padding: max(16px, env(safe-area-inset-top)) 0 0; }
.auth-lang { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--panel) 80%, transparent); color: var(--text); cursor: pointer; }
.auth-lang-icon svg, .auth-icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-lang-icon { display: inline-flex; color: var(--muted); }
.auth-lang select { appearance: none; -webkit-appearance: none; padding: 0 2px; border: 0; background: transparent; color: var(--text); font: 500 14px/1 inherit; cursor: pointer; outline: none; }
.auth-lang select option { color: #111; }
.auth-lang:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.auth-icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: color-mix(in srgb, var(--panel) 80%, transparent); color: var(--text); cursor: pointer; }
.auth-icon-button:hover, .auth-lang:hover { border-color: var(--muted); }

.auth-card { width: min(100%, 400px); margin: auto 0; padding: 32px 0 24px; }
.auth-head { display: grid; justify-items: center; gap: 10px; margin-bottom: 28px; text-align: center; }
.auth-mark { display: block; width: 56px; height: 56px; margin-bottom: 6px; }
.auth-mark svg { display: block; width: 100%; height: 100%; }
.auth-card h1 { margin: 0; color: var(--text); font: 450 34px/1.15 "Source Serif 4", "Noto Serif SC", Georgia, serif; letter-spacing: -.02em; }
.auth-head .auth-subtitle { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.auth-form { gap: 10px; }
.auth-form label { margin-top: 4px; color: var(--muted); font-size: 13px; font-weight: 600; }
.auth-form input:not([type="checkbox"]), .auth-form select { height: 52px; padding: 0 16px; border-radius: 14px; font-size: 17px; }
.auth-turnstile { min-height: 0; margin: 0; }
.auth-turnstile:empty { display: none; }
.auth-primary, .auth-danger { height: 52px; margin-top: 8px; border-radius: 14px; font-size: 16px; letter-spacing: .01em; transition: filter .15s, opacity .15s; }
.auth-primary:hover:not(:disabled) { filter: brightness(1.08); }
.auth-primary.is-busy { opacity: .85; }
/* 忙碌时按钮里的转圈动画和进度文字（account.js setBusy）。 */
.auth-primary[aria-busy="true"], .auth-danger[aria-busy="true"] { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.auth-primary[aria-busy="true"]:disabled, .auth-danger[aria-busy="true"]:disabled { opacity: .92; }
.auth-spinner { width: 18px; height: 18px; flex-shrink: 0; border: 2px solid #ffffff59; border-top-color: #fff; border-radius: 50%; animation: authSpin .8s linear infinite; }
@keyframes authSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .auth-spinner { animation-duration: 2.4s; } }
.auth-terms { margin: 22px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; text-align: center; }
.auth-terms a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.auth-terms a:hover { text-decoration-color: currentColor; }
.auth-code-input { height: 60px !important; font-size: 28px !important; letter-spacing: .6em !important; }
.auth-code-input::placeholder { color: var(--line); }
.auth-links { justify-content: center; gap: 18px; margin-top: 16px; }
.auth-links .auth-link { font-size: 14px; }
@media (max-width: 760px) {
  .auth-card { padding-top: 20px; }
  .auth-card h1 { font-size: 30px; }
}

/* 桌面端侧边栏：更宽（300px），字号加大。 */
@media (min-width: 761px) {
  .sidebar { padding-left: 16px; padding-right: 16px; }
  .sidebar-search { height: 44px; font-size: 16px; }
  :is(.new-chat, .nav-item) { height: 44px; gap: 12px; font-size: 16.5px; }
  .session-group { font-size: 14px; }
  .session { padding: 10px 12px; font-size: 16.5px; }
  .account-button { font-size: 16.5px; padding: 8px; }
  .account-button img { width: 36px; height: 36px; }
}
.sidebar-nav-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
@media (max-width: 760px) {
  .sidebar-nav-icon svg { width: 26px; height: 26px; }
}

/* 回复下方的收藏按钮：收藏后星标填充为强调色。 */
.message-action.action-star[aria-pressed="true"] svg { fill: var(--accent); }

/* 收藏弹窗：复用搜索弹窗的外观，顶部是标题。 */
.favorites-dialog .search-head h2 { flex: 1; margin: 0; font-size: 20px; font-weight: 600; }
.favorites-dialog .search-results { padding-bottom: 12px; }
.search-result-icon.is-star svg { fill: var(--accent); stroke: var(--accent); }

/* 会话列表的每一行按内容高度显示，列表过长时滚动，不压扁行。 */
.session-list { grid-auto-rows: max-content; align-content: start; }
.settings-dialog:focus, .settings-dialog:focus-visible { outline: none; }

/* 设置 · 用量：额度摘要卡片和进度条。 */
.settings-muted { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.usage-summary { display: grid; gap: 12px; margin-bottom: 8px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-2); }
.usage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.usage-head strong { font-size: 16px; font-weight: 600; }
.usage-plan { padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-size: 13px; font-weight: 600; white-space: nowrap; }
.usage-numbers { font-variant-numeric: tabular-nums; }
.usage-used { font-size: 34px; font-weight: 650; letter-spacing: -.02em; }
.usage-limit { color: var(--muted); font-size: 18px; }
.usage-bar { height: 8px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--muted) 22%, transparent); }
.usage-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s ease; }
.usage-bar.is-high span { background: #f59e0b; }
.usage-bar.is-full span { background: #ef4444; }
.usage-warning { margin: 0; color: #ef4444; font-size: 14px; }
.usage-rule { padding-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
  .settings-row:has(> .settings-value) { flex-direction: row; align-items: center; }
}

/* 对话列表：左侧类型图标（Chat 气泡 / Work 代码符号 </>），标题过长时显示省略号。 */
.session { display: flex; align-items: center; gap: 9px; min-width: 0; }
/* 生成的图片 / 视频下方的今日用量；额度用完时的提示卡。 */
.generation-quota { margin: 6px 2px 0; color: var(--muted); font-size: 13px; }
.limit-notice p { margin: 0; }
.limit-notice .limit-notice-upgrade { margin-top: 4px; color: var(--muted); }
.limit-notice { margin: 10px 0 4px; padding: 10px 14px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text); font-size: 14px; line-height: 1.5; }
/* 对话列表底部的“显示更多”。 */
.session-more { margin: 4px 0 8px; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 14px; text-align: left; cursor: pointer; }
.session-more:hover { background: var(--panel-2); color: var(--text); }
.session-icon { display: inline-grid; place-items: center; flex-shrink: 0; width: 1.15em; height: 1.15em; color: var(--muted); }
.session-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.session.active .session-icon { color: var(--text); }
@media (hover: hover) { .session:hover .session-icon { color: var(--text); } }
.session-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-toggle[hidden] { display: none; }


/* 手机键盘弹出时（iOS 键盘覆盖在页面上，不会缩小页面）：登录页和全屏设置浮层只占键盘上方的区域，
   顶部留白收起，内容可以滚动，输入框不会被键盘挡住。 */
.auth-screen { top: var(--vv-offset-top, 0px); bottom: var(--keyboard-inset-bottom, 0px); }
html.keyboard-open .auth-card { margin: 0; padding-top: 4px; }
html.keyboard-open .auth-head { margin-bottom: 16px; }
html.keyboard-open .auth-mark { width: 40px; height: 40px; }
html.keyboard-open .auth-head h1 { font-size: 26px; }
html.keyboard-open .auth-screen { padding-bottom: 12px; }
/* 键盘弹出时（手机）：弹窗（加好友、好友资料、搜索、收藏）贴着键盘上沿放（离键盘 12px），放不下的内容在弹窗里滚动；
   居中的弹窗会被键盘挡住下半截；以前靠上放，弹窗和键盘之间空一大截（2026-10-28 改）。
   最高不超过状态栏下面（App 和主屏网页应用里页面铺到状态栏下面；Safari 里这个值是 0）。 */
html.keyboard-open :is(.im-dialog, .search-dialog)[open] {
  margin: auto auto calc(var(--keyboard-inset-bottom, 0px) + 12px);
  max-height: calc(100dvh - var(--vv-offset-top, 0px) - env(safe-area-inset-top) - var(--keyboard-inset-bottom, 0px) - 24px);
}

/* 手机上资料页左右晃动：iOS 的日期输入框自带最小宽度，比其他输入框宽，把页面撑出屏幕。
   让所有输入框严格等宽，登录页只允许上下滚动。 */
.auth-screen { overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y; }
.auth-card, .auth-form { min-width: 0; max-width: 100%; }
.auth-form input:not([type="checkbox"]), .auth-form select { box-sizing: border-box; min-width: 0; max-width: 100%; }
.auth-form input[type="date"] { display: block; -webkit-appearance: none; appearance: none; text-align: left; line-height: 50px; }
.auth-form input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
.auth-form select { -webkit-appearance: none; appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23888' stroke-width='1.6'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; }
.avatar-actions { flex-wrap: wrap; min-width: 0; }
.auth-form { grid-template-columns: minmax(0, 1fr); }

/* 设置：iOS 风格的分组列表。首页列出各项，点击进入子页面，左上角返回。
   手机上占满屏幕，电脑上是居中的面板。 */
.settings-dialog { width: min(560px, calc(100vw - 32px)); height: min(760px, calc(100vh - 48px)); margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 26px; background: var(--bg); color: var(--text); box-shadow: 0 24px 64px #0000004d; overflow: hidden; }
.settings-dialog[open] { display: flex; flex-direction: column; }
.settings-dialog::backdrop { background: #0000005c; backdrop-filter: blur(2px); }
.settings-bar { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; gap: 8px; padding: 16px 18px 10px; }
.settings-bar h2 { margin: 0; overflow: hidden; font-size: 19px; font-weight: 650; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.settings-round { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--panel-2); color: var(--text); cursor: pointer; }
.settings-round:hover { filter: brightness(1.08); }
.settings-round.is-empty { visibility: hidden; }
.settings-round.is-primary { background: var(--text); color: var(--bg); border-color: transparent; }
.settings-round svg, .settings-icon svg, .settings-chevron svg, .settings-check svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.settings-round svg { width: 20px; height: 20px; }
.settings-page { flex: 1; min-height: 0; padding: 8px 18px max(28px, env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
.settings-home { display: grid; gap: 22px; }
.settings-group h3 { margin: 0 0 8px 16px; color: var(--muted); font-size: 14px; font-weight: 500; }
.settings-card { display: block; overflow: hidden; border-radius: 18px; background: var(--panel-2); }
.settings-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px; padding: 0 16px; border: 0; background: transparent; color: var(--text); font-size: 16.5px; text-align: left; text-decoration: none; cursor: pointer; }
.settings-item + .settings-item { box-shadow: inset 0 1px 0 var(--line); }
.settings-item:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.settings-item.is-danger { color: #ef4444; }
.settings-icon { display: inline-grid; flex-shrink: 0; place-items: center; color: var(--muted); }
.settings-item.is-danger .settings-icon { color: #ef4444; }
/* 外观：深色是蓝色的月亮（实心），浅色是太阳。 */
.settings-icon.theme-choice svg { width: 22px; height: 22px; }
.settings-icon.is-moon { color: #4f8cff; }
.settings-icon.is-moon svg { fill: currentColor; }
.settings-icon.is-sun { color: #f5a524; }
.settings-icon svg { width: 21px; height: 21px; }
.settings-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-item-value { flex-shrink: 0; color: var(--muted); font-size: 15.5px; font-variant-numeric: tabular-nums; }
.settings-chevron, .settings-check { display: inline-grid; flex-shrink: 0; place-items: center; color: var(--muted); }
.settings-chevron svg { width: 16px; height: 16px; }
.settings-check { color: var(--accent); }
.settings-check svg { width: 20px; height: 20px; stroke-width: 2.2; }
.settings-profile-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 0; color: var(--text); text-align: left; cursor: pointer; }
.settings-profile-card img { width: 52px; height: 52px; flex-shrink: 0; border-radius: 50%; object-fit: cover; background: var(--panel); }
.settings-profile-text { display: grid; flex: 1; gap: 2px; min-width: 0; }
.settings-profile-text strong { overflow: hidden; font-size: 18px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.settings-profile-text > span { overflow: hidden; color: var(--muted); font-size: 14.5px; text-overflow: ellipsis; white-space: nowrap; }
.settings-note { margin: 10px 16px 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.settings-saved { min-height: 20px; margin: 0; color: var(--accent); font-size: 14px; }
.account-dialog { z-index: 1; }

/* 设置 · 个人资料：头像居中，下面两个按钮；字段是卡片里的行（左名称、右输入）。 */
.settings-profile { display: grid; gap: 18px; }
.settings-profile .profile-form { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.settings-profile .avatar-label, .settings-profile .profile-form > .auth-primary { display: none; }
.settings-profile .avatar-picker { flex-direction: column; gap: 12px; }
.settings-profile .avatar-preview { width: 104px; height: 104px; }
.settings-profile .avatar-actions { justify-content: center; }
.settings-profile .avatar-actions .auth-secondary { border-radius: 999px; }
.settings-profile .profile-fields { overflow: hidden; border-radius: 18px; background: var(--panel-2); }
.settings-profile .profile-field { display: grid; grid-template-columns: minmax(84px, max-content) minmax(0, 1fr); align-items: center; gap: 16px; min-height: 56px; padding: 0 16px; }
.settings-profile .profile-field + .profile-field { box-shadow: inset 0 1px 0 var(--line); }
.settings-profile .profile-field label { margin: 0; color: var(--muted); font-size: 16px; font-weight: 500; }
.settings-profile .profile-field input:not([type="checkbox"]), .settings-profile .profile-field select { height: 54px; padding: 0; border: 0; border-radius: 0; background-color: transparent; color: var(--text); font-size: 16.5px; outline: none; }
.settings-profile .profile-field select { padding-right: 28px; background-position: right 0 center; }
.settings-profile .settings-note { margin-top: -6px; }
.settings-profile .auth-error:empty { display: none; }

/* 手机：占满屏幕（键盘弹出时只占键盘上方）。 */
@media (max-width: 760px) {
  .settings-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
  html.keyboard-open .settings-dialog { height: calc(100dvh - var(--keyboard-inset-bottom, 0px)); max-height: calc(100dvh - var(--keyboard-inset-bottom, 0px)); }
  .settings-bar { padding: max(12px, env(safe-area-inset-top)) 16px 10px; }
  .settings-page { padding-left: 16px; padding-right: 16px; }
  .settings-item { min-height: 58px; font-size: 18px; }
  .settings-item-value { font-size: 16.5px; }
  .settings-bar h2 { font-size: 20px; }
}
/* 注册时的资料页：字段上下排列（名称在上、输入在下）。 */
.auth-form .profile-fields { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.auth-form .profile-field { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.settings-profile .profile-fields { gap: 0; }
.settings-profile .auth-form .profile-field { grid-template-columns: minmax(84px, max-content) minmax(0, 1fr); gap: 16px; }
.settings-profile .auth-form .profile-field label { margin: 0; }
.settings-round .settings-icon { color: inherit; }
.settings-profile-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.settings-profile-name strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-profile-name .usage-plan { flex-shrink: 0; font-size: 12px; }
.settings-profile-name .usage-plan[hidden] { display: none; }
.settings-email { overflow: hidden; color: var(--muted); font-size: 14.5px; text-overflow: ellipsis; white-space: nowrap; }
.settings-profile-text > .settings-profile-name { color: var(--text); }
/* 设置 · 用量页：摘要卡片 + 明细卡片。 */
.settings-page > .settings-list { display: grid; gap: 18px; }
.settings-page .usage-summary { margin: 0; border: 0; border-radius: 18px; }
.settings-item.is-static { cursor: default; }
.settings-item.is-static:hover { background: transparent; }
.settings-item.is-static .settings-item-label { display: grid; gap: 2px; padding: 12px 0; white-space: normal; }
.settings-item-label small { color: var(--muted); font-size: 13.5px; }
.settings-value { flex-shrink: 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.settings-page .usage-rule { margin: 0 16px; padding: 0; border: 0; }

/* 并行回答：回答上面不是它自己的问题时，顶部引用原问题；点击跳到问题并短暂高亮。 */
.reply-quote { display: flex; align-items: center; gap: 8px; max-width: 100%; margin: 0 0 10px; padding: 6px 12px 6px 10px; border: 0; border-left: 3px solid var(--accent); border-radius: 4px 10px 10px 4px; background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--muted); font-size: 14px; text-align: left; cursor: pointer; }
.reply-quote:hover { color: var(--text); }
.reply-quote-mark { flex-shrink: 0; color: var(--accent); font-weight: 600; }
.reply-quote-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 用户消息的操作菜单：长按的消息浮在模糊遮罩之上，菜单在消息下方。 */
#chat-view { position: relative; }
/* 长按：按住时气泡慢慢放大，菜单打开期间保持；屏蔽系统的文字选择和长按菜单。 */
.message.user .message-content.is-pressable { transform-origin: right center; transition: transform .45s cubic-bezier(.2, .8, .2, 1); -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.message.user .message-content.is-pressing { transform: scale(1.05); }
.message-menu-backdrop { position: absolute; inset: 0; z-index: 70; background: color-mix(in srgb, var(--bg) 45%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); animation: fade-in .15s ease-out; }
.message.is-menu-target { position: relative; z-index: 71; }
.message-menu { position: absolute; z-index: 72; display: grid; min-width: 200px; padding: 6px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 16px 40px #0000003d; animation: fade-in .15s ease-out; }
.message-menu button { display: flex; align-items: center; gap: .75em; padding: .75em .9em; border: 0; border-radius: 12px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* 只在有鼠标的设备上悬停高亮：iPhone 上悬停样式会让第一下点击只触发高亮。 */
@media (hover: hover) { .message-menu button:hover { background: var(--panel-2); } }
.message-menu button:focus-visible { background: var(--panel-2); outline: none; }
.message-menu svg { width: 1.3em; height: 1.3em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.message.user.is-flash .message-content { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent); transition: box-shadow .2s; }
@media (max-width: 760px) {
  .reply-quote { font-size: 16px; padding: 8px 12px 8px 10px; }
}
/* 用户停止的回答：末尾一行“已停止”。 */
.message-stopped { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.message-content.is-stopped { color: var(--muted); font-style: italic; }
/* 正在回答时的“停止”按钮。 */
.send-button.is-stop svg rect { fill: currentColor; stroke: none; }
/* 侧边栏：正在回答的对话右侧有转动的小圈，后台回答完还没看的显示蓝点。 */
.session-status { flex-shrink: 0; width: 9px; height: 9px; margin-left: auto; border-radius: 50%; }
.session-status.is-unread { background: var(--accent); }
.session-status.is-running { display: grid; place-items: center; width: 24px; height: 24px; margin-right: -5px; border-radius: 0; }
.session-status.is-running .rose-thinking { width: 24px; height: 24px; flex-basis: 24px; }

/* 资料页的自我介绍：输入框右边显示字数。 */
.profile-bio { display: flex; align-items: center; gap: 8px; min-width: 0; }
.profile-bio input { flex: 1; min-width: 0; }
.profile-count { flex-shrink: 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* 听写（docs/design/Takit 语音.md 2.4）：录音时输入框下面一行（图片、模型、麦克风、发送）整行换成录音条，高度不变。 */
.dictation-bar { display: none; grid-column: 1 / -1; grid-row: 4; align-items: center; gap: 10px; min-height: 38px; }
.composer.is-dictating .dictation-bar { display: flex; }
.composer.is-dictating :is(.composer-attach, .composer-voice, .send-button) { display: none; }
.composer.is-dictating textarea { caret-color: var(--accent); }
.dictation-cancel, .dictation-pause, .dictation-stop { flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; background: var(--panel-2); color: var(--text); cursor: pointer; }
.dictation-cancel, .dictation-pause { border-radius: 50%; }
.dictation-pause svg { width: 22px; height: 22px; fill: currentColor; }
.dictation-pause:disabled { opacity: .45; cursor: progress; }
/* 右边是发送箭头（和输入框的发送按钮一样）：点了停止识别，拿到最终文字后直接发送。 */
.dictation-stop { border-radius: 50%; background: var(--accent); color: #fff; box-shadow: 0 4px 12px #2563eb35; }
.dictation-stop:disabled { opacity: .45; cursor: progress; }
.dictation-cancel svg { width: 20px; height: 20px; }
.dictation-stop svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.dictation-cancel:hover { background: var(--line); }
.dictation-stop:not(:disabled):hover { filter: brightness(1.1); }
/* 波形填满按钮之间的空间；40px 高度与发送按钮一致。 */
.dictation-wave-slot { position: relative; flex: 1 1 0; min-width: 0; height: 40px; }
.dictation-wave { display: block; width: 100%; height: 40px; margin: 0; color: var(--text); }
/* Status sits above the waveform; text changes never resize the canvas. */
.dictation-note { position: absolute; bottom: calc(100% + 3px); left: 0; right: 0; text-align: center; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.dictation-note:empty { display: none; }
/* 输入框右下角按钮在发送、停止、实时对话之间切换时，图标淡入。 */
.send-button svg { animation: sendIconIn .15s ease-out; }
/* 实时对话按钮的波形图标比箭头大一些。 */
.composer .send-button.is-voice svg { width: 28px; height: 28px; stroke-width: 2.4; }
@keyframes sendIconIn { from { opacity: 0; transform: scale(.8); } }
@keyframes dictationIn { from { opacity: 0; } }
@media (max-width: 760px) {
  .dictation-cancel, .dictation-pause, .dictation-stop { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .dictation-bar, .send-button svg { animation: none; }
}

/* 回答前的状态（「正在搜索：…」「搜索了 12 个网页：…」）可能很长：一行放不下就截断，不撑出屏幕。 */
.stream-activity { max-width: 100%; }
.stream-activity-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 思考内容：状态文字下方的灰色小字，与状态文字左对齐；固定两行高，新内容从底部出现、旧内容从顶部淡出。 */
.stream-thought {
  display: flex; flex-direction: column; justify-content: flex-end;
  max-width: 36em; height: 3em; margin: -6px 0 0 46px; overflow: hidden;
  color: var(--muted, #8a9099); font-size: calc(12.5px * var(--reading-scale, 1)); line-height: 1.5;
  overflow-wrap: anywhere;
  -webkit-mask-image: linear-gradient(transparent, #000 45%);
  mask-image: linear-gradient(transparent, #000 45%);
}

/* 历史对话的消息还在加载：中间一个小圈。慢于 0.3 秒才显示，网络快时不闪一下。 */
.messages-loading { width: 22px; height: 22px; margin: 32vh auto 0; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; opacity: 0; animation: attachmentSpin .8s linear infinite, fade-in .2s ease-out .3s forwards; }

/* 手机上的按住说话（hold-talk.js）：占输入框那一行，和输入框二选一；麦克风按钮这时是键盘图标。 */
.composer .hold-talk { grid-area: input; height: 46px; margin: 2px 0 8px; border: 0; border-radius: 14px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 17px; font-weight: 600; cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }
.composer .hold-talk[hidden], .composer.is-hold textarea { display: none; }

/* 手机上输入框只有一行，和微信一样（2026-10-28）：最左边麦克风 / 键盘切换，中间输入框（或"按住 说出你的任务"），
   右边一个位置：空着时是"+"（加图片），有字时换成发送，回答中是停止。实时语音对话先下线了，没有它的按钮。
   图片缩略图和提示仍在输入框上方。 */
@media (max-width: 760px) {
  .composer { grid-template-columns: 36px minmax(0, 1fr) 36px; grid-template-areas: "strip strip strip" "note note note" "voice input right"; align-items: end; column-gap: 8px; min-height: 0; padding: 8px 10px; }
  .composer-voice { grid-area: voice; }
  .composer .composer-attach, .composer .send-button { grid-area: right; }
  .composer:not(.is-empty) .composer-attach, .composer[data-kind="stop"] .composer-attach, .composer.is-empty:not([data-kind="stop"]) .send-button { display: none; }
  .composer textarea { align-self: center; margin-bottom: 0; padding: 5px 4px; }
  .composer .hold-talk { align-self: center; height: 40px; margin: 0; border-radius: 12px; font-size: 16px; }
}

/* 手机上的麦克风按钮：Takit 标志的主色蓝（#3d8ef6）的麦克风，不加底色，图标几乎占满按钮（2026-10-28 晚；之前是蓝色实心圆、白色麦克风，中间试过天蓝色 #38bdf8）。
   按住说话时这个按钮是键盘图标，用文字色。 */
@media (max-width: 760px) {
  .composer:not(.is-hold) .composer-voice { background: none; color: #3d8ef6; }
  .composer:not(.is-hold) .composer-voice svg { width: 36px; height: 36px; stroke-width: 2.6; }
}
/* "+"按钮的圆圈用文字色（深色主题是白色），和图标一样醒目（2026-10-28）。 */
.composer .composer-attach { border-color: var(--text); }
/* "按住 说出你的任务"：蓝底白字，和麦克风按钮同一种蓝（2026-10-28）；按住时深一点。 */
.composer .hold-talk { border: 0; background: #2563eb; color: #fff; }
/* 手机上输入栏整体放大一些（2026-10-28）：按钮 40px，"按住 说出你的任务"高 48px、字号 18px，输入框文字 16px 起（仍跟随 Aa 设置）。 */
@media (max-width: 760px) {
  .composer { grid-template-columns: 40px minmax(0, 1fr) 40px; column-gap: 10px; padding: 10px 12px; border-radius: 30px; }
  .composer .composer-voice, .composer .composer-attach, .composer .send-button { width: 40px; height: 40px; }
  .composer .hold-talk { height: 48px; border-radius: 14px; font-size: 18px; }
  /* 输入框只有一行时高 40px，和两边的按钮一样高、上下居中（行高 1.45em，上下留白补齐到 40px；字很大时留白为 0）；
     多行时按钮贴底（app.js 的 resizePrompt 加 is-multiline）。 */
  :root .composer textarea { padding: max(0px, calc((40px - 1.45em) / 2)) 4px; font-size: calc(16px * var(--reading-scale, 1)); }
  .composer:not(.is-multiline) :is(.composer-voice, .composer-attach, .send-button) { align-self: center; }
  /* 发送箭头放大（2026-10-28 晚）：输入框右边的发送、听写录音条右边的发送都是 40px 的圆、26px 的箭头。 */
  .composer .send-button svg, .dictation-stop svg { width: 26px; height: 26px; }
  .dictation-stop { width: 40px; height: 40px; }
}
.composer .hold-talk:active { background: #1d4ed8; }

/* App 键盘动画：输入栏跟随键盘；消息先消耗正文下方的空白，再移动需要的距离。
   由 requestAnimationFrame 更新真实 padding，不对聚焦输入框做 transform。 */
html.native-app #chat-view, html.native-app #im-view { padding-bottom: var(--kb-pad, 0px); transition: none; }

#run-sync-status { position: absolute; top: max(80px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 6; padding: 6px 12px; border-radius: 12px; background: var(--panel); color: var(--muted); font-size: 12px; }

/* Personal connected apps in the navigation drawer. */
.sidebar-connectors { display: grid; gap: 3px; margin: 0 4px 4px 18px; min-width: 0; }
.sidebar-connectors[hidden] { display: none; }
.sidebar-connector { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; min-height: 44px; padding: 7px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: start; cursor: pointer; }
.sidebar-connector:hover { background: var(--panel-2, #e9eaec); }
.sidebar-connector:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sidebar-connector .connector-logo { width: 22px; height: 22px; margin: 0; flex-shrink: 0; }
.sidebar-connector-label { display: grid; min-width: 0; gap: 2px; font-size: 13px; }
.sidebar-connector-label > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-connector-detail { color: var(--muted); font-size: 11px; }
.sidebar-connector-indicator { margin-inline-start: auto; flex-shrink: 0; color: #269766; font-size: 13px; }
.sidebar-connector-indicator.is-warning { color: #b77b14; }

/* 顶栏按钮统一使用半透明圆形底；展开侧栏时保持同一外观。 */
html[data-theme] .app-shell .sidebar-toggle:not([aria-expanded="true"]),
html[data-theme] .app-shell .sidebar-toggle,
html[data-theme] .app-shell .sidebar-toggle[aria-expanded="true"],
html[data-theme] .app-shell .sidebar-toggle:hover,
#chat-view .font-settings > summary {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  background: color-mix(in srgb, var(--panel) 60%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 4px 16px #00000014;
}
html[data-theme] .app-shell .sidebar-toggle svg { width: 24px; height: 24px; stroke-width: 3; }

/* 连接应用：单行列表，介绍仅在详情内展示。 */
.main-panel:has(#connectors-view.active) > .sidebar-toggle,
#connectors-view > .topbar { display: none; }
#connectors-view { border: 0; }
#connectors-view .admin-content { padding-top: max(8px, env(safe-area-inset-top)); }
#connectors-view #connector-status:empty { display: none; }
#connectors-view .connector-guide { display: none; }
#connectors-list { display: flex; flex-direction: column; gap: 0; }
#connectors-list > .connector-back { align-self: flex-start; width: 44px; height: 44px; padding: 10px; margin-bottom: 12px; color: var(--text); }
.connector-back svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.connector-row { display: flex; align-items: center; gap: 16px; min-height: 72px; width: 100%; }
.connector-row-open { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; padding: 14px 0; border: 0; background: transparent; color: var(--text); text-align: start; font: inherit; font-size: 18px; cursor: pointer; }
.connector-row-open .connector-logo { margin: 0; flex: 0 0 32px; width: 32px; height: 32px; }
.connector-toggle { flex: 0 0 48px; width: 48px; height: 28px; padding: 3px; border: 0; border-radius: 20px; background: color-mix(in srgb, var(--muted) 40%, transparent); cursor: pointer; }
.connector-toggle::before { content: ""; display: block; width: 22px; height: 22px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #0003; transition: transform .15s; }
.connector-toggle[aria-checked="true"] { background: var(--accent); }
.connector-toggle[aria-checked="true"]::before { transform: translateX(20px); }
.connector-toggle:disabled { opacity: .45; cursor: default; }
.connector-row-open:focus-visible, .connector-toggle:focus-visible, .connector-back:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Compact composer: circle radius + inner inset = shell radius. */
.composer { border-radius: 29px; padding: 6px; }
.composer :is(.composer-voice, .composer-attach, .send-button) { width: 44px; height: 44px; border-radius: 50%; }
.composer { grid-template-columns: 44px minmax(0, 1fr) auto 44px 44px; }
.composer .send-button, .dictation-stop { box-shadow: none; }
.composer textarea { padding-left: 10px; padding-right: 10px; }
.dictation-cancel, .dictation-pause, .dictation-stop { width: 44px; height: 44px; }
@media (max-width: 760px) {
  .composer { grid-template-columns: 44px minmax(0, 1fr) 44px; column-gap: 6px; min-height: 58px; }
  :root .composer textarea { padding: max(0px, calc((44px - 1.45em) / 2)) 2px; }
  .composer .hold-talk { height: 44px; }
  .composer.is-multiline { border-radius: 29px; }
}
