/* Memory workspace: scoped so the other product surfaces keep their layout. */
body.memory-workspace {
  --workspace-paper: var(--paper, #fff);
  --workspace-side: color-mix(in srgb, var(--workspace-paper) 97%, var(--ink));
  margin: 0; padding: 0; height: 100dvh; overflow: hidden;
  background: var(--workspace-paper); color: var(--ink);
}
.memory-workspace *, .memory-workspace *::before, .memory-workspace *::after { box-sizing: border-box; }
.memory-workspace [hidden] { display: none !important; }
.memory-workspace .memory-shell { display: block; width: 100%; max-width: none; height: 100%; margin: 0; padding: 0; background: var(--workspace-paper); }
.memory-workspace .memory-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 0; height: 100%; min-height: 0; }
.memory-workspace.sidebar-collapsed .memory-layout { grid-template-columns: minmax(0, 1fr); }
.memory-workspace.sidebar-collapsed #memoryModelPanel { display: none; }
.memory-workspace .memory-side { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 24px; padding: 22px 14px 14px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: var(--workspace-side); }
.memory-brand { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 8px 24px; }
.memory-brand strong { font-size: 15px; font-weight: 650; letter-spacing: -.4px; }
.memory-brand-mark { font-size: 24px; line-height: 1; }
.memory-brand-caption { margin-left: 32px; width: 100%; color: var(--muted); font-size: 11px; letter-spacing: 2px; }
.memory-workspace .memory-new-chat { width: 100%; min-height: 40px; border-radius: 10px; background: var(--ink); color: var(--workspace-paper); border: 0; text-align: left; padding: 10px 14px; font-size: 13px; }
.memory-agent-switcher { margin-top: 18px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.memory-agent-switcher > summary { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 4px 8px; list-style: none; cursor: pointer; }
.memory-agent-switcher > summary span { color: var(--muted); font-size: 11px; }
.memory-agent-switcher > summary strong { grid-row: 2; font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memory-agent-switcher > summary::after { content: '⌄'; grid-row: 2; grid-column: 2; color: var(--muted); }
.memory-workspace .memory-agent-switcher .panel-heading { margin: 12px 8px 0; }
.memory-workspace .memory-agent-item, .memory-workspace .memory-conversation { border: 0; box-shadow: none; background: transparent; }
.memory-workspace .memory-agent-item.active, .memory-workspace .memory-conversation.active { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.memory-workspace .memory-conversation { padding: 10px; border-radius: 8px; min-height: 42px; }
.memory-workspace .memory-conversation strong { font-weight: 450; font-size: 12px; }
.memory-workspace .memory-conversation-list { gap: 3px; margin-top: 8px; padding-right: 0; }
.memory-workspace .memory-conversation-ops { gap: 0; }
.memory-workspace .memory-conversation-ops button { width: 20px; min-width: 20px; }
.memory-workspace .memory-list-heading { margin: 0; padding: 0 8px; align-items: center; }
.memory-workspace .memory-list-heading h3 { font-size: 11px; font-weight: 500; color: var(--muted); margin: 0; }
.memory-workspace .memory-list-heading button { padding: 4px 6px; min-height: 24px; font-size: 12px; }
.memory-side-footer { border-top: 1px solid var(--line); padding: 12px 8px 0; min-width: 0; }
.memory-side-footer > small { display: block; font-size: 10px; color: var(--muted); padding-top: 10px; line-height: 1.7; overflow-wrap: anywhere; }
.memory-app-menu { position: relative; }
.memory-app-menu summary { font-size: 12px; cursor: pointer; list-style: none; padding: 6px 0; }
.memory-app-menu .topbar-actions { position: absolute; bottom: calc(100% + 10px); left: 0; width: 215px; display: grid; gap: 4px; padding: 10px; z-index: 30; background: var(--workspace-paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px #0002; }
.memory-workspace .memory-app-menu .nav-button, .memory-workspace .memory-app-menu button { border: 0; border-radius: 6px; min-height: 30px; padding: 8px 10px; text-align: left; font-size: 12px; background: transparent; color: var(--ink); }
.memory-work-area { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--workspace-paper); }
.memory-workspace-header { height: 64px; flex: 0 0 64px; display: flex; align-items: center; gap: 14px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.memory-workspace #memoryChatTitle { margin: 0; display: block; font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.memory-workspace .memory-chat-tools { flex-wrap: nowrap; gap: 6px; flex-shrink: 0; }
.memory-workspace .memory-workspace-header button, .memory-workspace .memory-preview-panel button, .memory-workspace .memory-composer-tools button, .memory-workspace .memory-composer-tools summary { border: 0; background: transparent; color: var(--ink); border-radius: 7px; padding: 7px 10px; font-weight: 450; font-size: 12px; min-height: 32px; }
.memory-workspace button:hover, .memory-workspace summary:hover { background-color: color-mix(in srgb, var(--ink) 6%, transparent); }
.memory-workspace button:focus-visible, .memory-workspace summary:focus-visible, .memory-workspace [tabindex="0"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.memory-workspace button[aria-expanded="true"], .memory-workspace button[aria-selected="true"] { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.memory-workspace .memory-icon-button { font-size: 17px; }
.memory-work-panes { display: flex; flex: 1; min-height: 0; min-width: 0; position: relative; }
.memory-workspace .memory-main { display: flex; flex-direction: column; flex: 1 1 100%; padding: 0; gap: 0; min-height: 0; min-width: 0; border: 0; border-radius: 0; background: var(--workspace-paper); overflow: hidden; }
.memory-workspace.preview-open .memory-main { flex: 0 0 var(--memory-chat-width, 50%); }
.memory-workspace .memory-messages { flex: 1; min-height: 0; height: auto; max-height: none; overflow-y: auto; padding: 32px max(24px, calc((100% - 780px) / 2)); border: 0; background: transparent; display: flex; flex-direction: column; gap: 26px; overscroll-behavior: contain; }
.memory-workspace.preview-open .memory-messages { padding: 28px 24px; }
.memory-workspace .memory-message { padding: 0; border: 0; box-shadow: none; border-radius: 0; background: transparent; font-size: 14px; width: 100%; flex: 0 0 auto; line-height: 1.8; }
.memory-workspace .memory-message.user { align-self: flex-end; width: fit-content; max-width: 88%; border: 0; border-radius: 16px; padding: 12px 18px; background: color-mix(in srgb, var(--ink) 5%, var(--workspace-paper)); }
.memory-workspace .memory-message-role { font-size: 11px; font-weight: 600; margin-bottom: 8px; color: var(--muted); }
.memory-workspace .memory-message.user .memory-message-role { display: none; }
.memory-workspace .memory-message > small { font-size: 10px; opacity: .65; margin-top: 8px; }
.memory-workspace .memory-message-preview { display: inline-flex; margin: 10px 8px 0 0; padding: 4px 8px; border: 0; font-size: 11px; color: var(--muted); border-radius: 6px; }
.memory-welcome { margin: auto 0; text-align: center; padding: 40px 0 65px; }
.memory-welcome-mark { display: inline-flex; width: 56px; height: 56px; align-items: center; justify-content: center; background: var(--workspace-side); border: 1px solid var(--line); border-radius: 18px; font-size: 34px; margin-bottom: 22px; }
.memory-welcome h2 { font-size: clamp(24px, 2.2vw, 32px); font-weight: 500; letter-spacing: -1px; margin: 0 0 14px; }
.memory-welcome p { font-size: 13px; color: var(--muted); line-height: 1.9; margin: 0; }
.memory-welcome-examples { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.memory-workspace .memory-welcome-examples button { border: 1px solid var(--line); background: transparent; border-radius: 9px; font-size: 12px; padding: 10px 14px; font-weight: 400; }
.memory-composer-wrap { flex: 0 0 auto; padding: 12px 24px 16px; width: 100%; max-width: 828px; margin: 0 auto; }
.memory-composer { border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); border-radius: 18px; background: var(--workspace-paper); box-shadow: 0 3px 12px #00000004; padding: 14px 14px 10px; }
.memory-composer:focus-within { border-color: color-mix(in srgb, var(--ink) 38%, transparent); box-shadow: 0 4px 20px #00000006; }
.memory-workspace .memory-input-bar { position: static; display: block; padding: 0; border: 0; background: transparent; box-shadow: none; width: auto; margin: 0; }
.memory-workspace .memory-input-bar textarea { width: 100%; height: 66px; min-height: 66px; max-height: 170px; margin: 0; padding: 0 4px; resize: vertical; background: transparent; border: 0; border-radius: 0; box-shadow: none; font-size: 14px; line-height: 1.7; color: var(--ink); }
.memory-workspace .memory-input-bar textarea:focus { outline: 0; border: 0; box-shadow: none; }
.memory-composer-tools { display: flex; align-items: center; gap: 6px; position: relative; }
.memory-workspace .memory-composer-tools .memory-context-button { margin-left: auto; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 56%; font-size: 11px; }
.memory-workspace .memory-composer-tools .memory-send-button { position: relative; flex: 0 0 34px; width: 34px; height: 34px; min-height: 34px; padding: 0; border-radius: 50%; background: var(--ink); color: var(--workspace-paper); }
.memory-workspace .memory-send-button::before { border-color: var(--workspace-paper); }
.memory-workspace .memory-send-button::after { background: var(--workspace-paper); }
.memory-workspace .memory-send-button.is-stopping::before { background: var(--workspace-paper); }
.memory-composer-note { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; color: var(--muted); padding: 9px 4px 0; }
.memory-composer-note small, .memory-keyboard-hint { font-size: 10px; line-height: 1.6; }
.memory-composer-note small { min-width: 0; overflow-wrap: anywhere; }
.memory-keyboard-hint { flex-shrink: 0; opacity: .7; }
.memory-workspace.preview-open .memory-keyboard-hint { display: none; }
.memory-tool-menu { position: relative; }
.memory-tool-menu summary { list-style: none; cursor: pointer; white-space: nowrap; }
.memory-tool-menu summary::-webkit-details-marker, .memory-agent-switcher summary::-webkit-details-marker, .memory-app-menu summary::-webkit-details-marker { display: none; }
.memory-workspace #memoryAttachMenu summary { font-size: 22px; padding: 0 8px; }
.memory-tool-popover { position: absolute; bottom: calc(100% + 12px); left: 0; width: 170px; padding: 6px; border: 1px solid var(--line); background: var(--workspace-paper); border-radius: 12px; box-shadow: 0 8px 35px #0002; z-index: 20; display: grid; gap: 3px; }
.memory-workspace .memory-tool-popover button { text-align: left; }
.memory-workspace .memory-attachments { margin: 0; padding: 0; border: 0; background: transparent; }
.memory-workspace .memory-attachment-list { gap: 8px; margin: 0; display: flex; flex-wrap: wrap; max-height: 148px; overflow-y: auto; }
.memory-workspace .memory-attachment-list:not(:empty) { margin-bottom: 12px; }
.memory-workspace .memory-attachment-item { width: min(240px, 100%); padding: 7px; background: var(--workspace-side); border-radius: 10px; }
.memory-workspace .memory-attachment-thumb { width: 42px; height: 42px; }
.memory-workspace .memory-attachment-copy small { font-size: 10px; }
.memory-workspace #memorySearchRow { border-bottom: 1px solid var(--line); padding: 10px 24px; }
.memory-workspace .memory-chat-search { display: flex; width: 100%; gap: 8px; }
.memory-workspace .memory-chat-search input { flex: 1; min-width: 0; width: auto; background: var(--workspace-side); border: 0; }
.memory-workspace .memory-chat-search button { font-size: 12px; }
#memorySplitHandle { flex: 0 0 7px; position: relative; cursor: col-resize; touch-action: none; background: var(--workspace-paper); border-left: 1px solid var(--line); z-index: 1; }
#memorySplitHandle::after { content: ''; position: absolute; height: 32px; width: 3px; border-radius: 2px; top: 50%; left: 1px; background: color-mix(in srgb, var(--ink) 20%, transparent); }
#memorySplitHandle:hover, #memorySplitHandle:focus-visible { background: var(--soft); }
.memory-workspace.is-resizing { user-select: none; cursor: col-resize; }
.memory-preview-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--workspace-side); }
.memory-preview-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 18px; gap: 12px; }
.memory-eyebrow { font-size: 10px; color: var(--muted); letter-spacing: 1.5px; }
.memory-preview-header h2 { font-size: 15px; font-weight: 550; margin: 6px 0 0; }
.memory-preview-tabs { display: flex; gap: 4px; padding: 0 20px 14px; border-bottom: 1px solid var(--line); }
.memory-workspace #openMemoryFullscreenBtn { margin-left: auto; color: var(--muted); font-size: 11px; }
.memory-preview-body { flex: 1; overflow: auto; min-height: 0; padding: 24px; overscroll-behavior: contain; }
.memory-preview-document { padding: 28px; border: 1px solid var(--line); border-radius: 10px; background: var(--workspace-paper); min-height: 100%; font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; }
.memory-preview-document > :first-child { margin-top: 0; }
.memory-preview-empty { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; min-height: 100%; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.9; }
.memory-preview-empty > span { font-size: 32px; opacity: .5; }
.memory-preview-empty strong { color: var(--ink); font-size: 15px; font-weight: 500; }
.memory-preview-empty p { margin: 0; max-width: 260px; }
.memory-preview-image-card { margin: 0 0 18px; padding: 10px; background: var(--workspace-paper); border: 1px solid var(--line); border-radius: 12px; }
.memory-preview-image-card img { width: 100%; display: block; max-height: clamp(180px, calc(100dvh - 350px), 600px); object-fit: contain; border-radius: 6px; }
.memory-preview-image-card figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 4px 0; font-size: 11px; color: var(--muted); }
.memory-preview-image-card a { color: inherit; }
.memory-preview-footer { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); }
.memory-workspace .memory-preview-footer button { font-size: 11px; }
.memory-workspace .memory-settings-dialog { width: min(720px, calc(100vw - 32px)); max-height: min(800px, calc(100dvh - 48px)); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--workspace-paper); color: var(--ink); box-shadow: 0 24px 100px #0003; }
.memory-settings-dialog[open], .memory-settings-dialog.fallback-open { display: flex; flex-direction: column; }
.memory-settings-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px 20px; gap: 12px; }
.memory-settings-header h2 { margin: 6px 0 0; font-size: 21px; font-weight: 550; }
.memory-settings-header button { border: 0; background: transparent; }
.memory-settings-tabs { display: flex; gap: 6px; padding: 0 28px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.memory-settings-tabs button { font-size: 12px; padding: 8px 12px; border: 0; background: transparent; border-radius: 8px; color: var(--muted); }
.memory-settings-tabs button[aria-selected="true"] { color: var(--ink); }
.memory-settings-scroll { overflow: auto; padding: 26px 28px; min-height: 0; overscroll-behavior: contain; }
.memory-settings-scroll h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
.memory-settings-scroll label { display: grid; gap: 8px; font-size: 12px; }
.memory-settings-scroll label + label { margin-top: 18px; }
.memory-settings-description, .memory-settings-resource p { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 0 0 22px; }
.memory-settings-scroll .memory-identity-models { margin-top: 20px; }
.memory-workspace .memory-settings-scroll .memory-project-picker { display: grid; grid-template-columns: 1fr; padding: 0 0 22px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; gap: 16px; }
.memory-settings-scroll .memory-project-controls { display: grid; grid-template-columns: 1fr; gap: 18px; }
.memory-settings-scroll .memory-search-mode-control { display: grid; grid-template-columns: 1fr; }
.memory-workspace .memory-settings-scroll .memory-meta { background: transparent; border: 0; padding: 12px 0; margin: 0; font-size: 11px; }
.memory-settings-cost { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.memory-workspace #memoryIdentityPanel { position: static; display: block; width: auto; height: auto; max-height: none; padding: 0; border: 0; box-shadow: none; background: transparent; overflow: visible; }
.memory-settings-scroll #memoryIdentityInput { min-height: 160px; font-size: 13px; line-height: 1.8; }
.memory-settings-scroll .memory-presets { margin: 16px 0 24px; }
.memory-settings-scroll .memory-presets button { font-size: 11px; }
.memory-settings-resource { padding-top: 24px; border-top: 1px solid var(--line); }
/* 选项卡：模型问、用户点。底下那行「自己说」永远在 */
.memory-workspace .memory-choice-card { margin: 14px 0 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel, transparent); }
.memory-workspace .memory-choice-question { margin: 0 0 12px; font-size: 13px; font-weight: 600; line-height: 1.6; }
.memory-workspace .memory-choice-options { display: grid; gap: 8px; }
.memory-workspace .memory-choice-option { display: grid; gap: 3px; width: 100%; padding: 10px 12px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: transparent; cursor: pointer; }
.memory-workspace .memory-choice-option:hover { border-color: var(--accent, #6b8f71); }
.memory-workspace .memory-choice-label { font-size: 13px; font-weight: 500; }
.memory-workspace .memory-choice-detail { font-size: 12px; color: var(--muted); line-height: 1.5; }
.memory-workspace .memory-choice-custom { display: flex; gap: 8px; margin-top: 12px; }
.memory-workspace .memory-choice-custom input { flex: 1; min-width: 0; padding: 8px 10px; font-size: 13px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: inherit; }
.memory-workspace .memory-choice-custom button { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.memory-workspace .memory-choice-card.is-answered { padding: 10px 14px; opacity: .72; }
.memory-workspace .memory-choice-card.is-answered .memory-choice-question { margin: 0 0 4px; font-weight: 500; }
.memory-workspace .memory-choice-picked { margin: 0; font-size: 12px; color: var(--muted); }
@media (max-width: 680px) {
  .memory-workspace .memory-choice-card { padding: 12px; }
  .memory-workspace .memory-choice-custom { flex-wrap: wrap; }
}

/* 知识库选择：设置页里紧挨楼盘选择的一块，跟它同一套版式 */
.memory-workspace .memory-settings-scroll .memory-knowledge-picker { gap: 14px; }
.memory-workspace .memory-settings-scroll .memory-knowledge-list { margin: 0; max-height: 260px; }
.memory-workspace .memory-settings-scroll .memory-knowledge-row { padding: 8px 10px; border-radius: 10px; background: var(--panel, transparent); }
.memory-workspace .memory-settings-scroll .memory-knowledge-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; }
.memory-workspace .memory-settings-scroll .memory-knowledge-status { margin: 0; }

.memory-settings-scroll details { margin-bottom: 20px; }
.memory-settings-scroll details > summary { font-size: 13px; cursor: pointer; }
.memory-settings-scroll .memory-longterm-details { border: 0; padding: 0; background: transparent; }
.memory-settings-scroll .memory-help p { font-size: 12px; }
@media (max-width: 1100px) {
  .memory-workspace .memory-layout { grid-template-columns: 215px minmax(0, 1fr); }
  .memory-workspace .memory-workspace-header { padding: 0 16px; }
  .memory-workspace .memory-keyboard-hint { display: none; }
  .memory-workspace.preview-open .memory-messages { padding: 24px 16px; }
  .memory-workspace.preview-open .memory-composer-wrap { padding: 10px 12px 14px; }
  .memory-workspace .memory-preview-body { padding: 16px; }
  .memory-workspace .memory-preview-document { padding: 20px; }
}
@media (max-width: 900px) {
  .memory-workspace .memory-layout { grid-template-columns: minmax(0, 1fr); }
  .memory-workspace #memoryModelPanel { display: none; position: absolute; top: 0; bottom: 0; left: 0; width: min(290px, 85vw); max-height: none; z-index: 50; padding: 22px 14px 14px; overflow: hidden; }
  .memory-workspace.sidebar-mobile-open #memoryModelPanel { display: grid; }
  #memorySidebarBackdrop { display: block; position: fixed; inset: 0; border: 0; border-radius: 0; background: #0005; z-index: 45; width: 100%; height: 100%; }
}
@media (max-width: 680px) {
  .memory-workspace .memory-shell { height: var(--memory-viewport-height, 100dvh); min-height: 0; }
  .memory-workspace .memory-layout { height: 100%; gap: 0; }
  .memory-workspace .memory-workspace-header { height: 56px; flex-basis: 56px; padding: 0 10px; gap: 6px; }
  .memory-workspace .memory-workspace-header button { padding: 6px 7px; font-size: 11px; }
  .memory-workspace #memoryChatTitle { font-size: 13px; }
  .memory-workspace .memory-chat-tools { gap: 0; }
  .memory-workspace .memory-main { display: flex; min-height: 0; padding: 0; }
  .memory-workspace .memory-messages, .memory-workspace.preview-open .memory-messages { padding: 24px 18px; min-height: 0; }
  .memory-workspace .memory-composer-wrap, .memory-workspace.preview-open .memory-composer-wrap { padding: 8px 12px max(8px, env(safe-area-inset-bottom)); }
  .memory-workspace .memory-input-bar { position: static; inset: auto; }
  .memory-workspace .memory-input-bar textarea { font-size: 16px; min-height: 58px; height: 58px; }
  .memory-workspace .memory-composer-tools .memory-context-button { max-width: 45%; }
  .memory-workspace.preview-open .memory-main { flex: 1; }
  .memory-workspace.preview-open #memorySplitHandle { display: none; }
  .memory-workspace .memory-preview-panel { position: absolute; inset: 0; z-index: 35; width: 100%; }
  .memory-workspace .memory-welcome { padding: 24px 0; }
  .memory-workspace .memory-settings-dialog { max-height: calc(100dvh - 20px); width: calc(100vw - 20px); border-radius: 14px; }
  .memory-settings-header { padding: 20px; }
  .memory-settings-tabs { padding: 0 16px 12px; gap: 0; }
  .memory-settings-tabs button { padding: 8px 10px; }
  .memory-settings-scroll { padding: 22px 20px; }
  .memory-workspace .memory-settings-scroll .panel-heading { display: flex; flex-direction: row; }
  .memory-workspace .memory-settings-scroll .memory-project-picker { display: grid; }
  .memory-workspace .memory-settings-scroll .memory-project-picker small { display: block; }
}
/* Reset legacy card/button presentation on this workspace only. */
.memory-workspace .memory-main, .memory-workspace .memory-side { box-shadow: none; }
.memory-workspace #memoryChatTitle { color: var(--ink); }
.memory-workspace .memory-message { max-width: 100%; }
.memory-workspace .memory-message-preview { justify-self: start; width: auto; background: transparent; }
.memory-workspace .memory-generated-image-card > button:first-child { border-radius: 10px; padding: 0; }
.memory-workspace .memory-generated-image-card img { aspect-ratio: auto; max-height: 240px; object-fit: contain; }
.memory-workspace .memory-generated-reference { border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.memory-workspace .memory-attachment-item { grid-template-columns: 42px minmax(0, 1fr) auto; flex-basis: 238px; max-width: 100%; }
.memory-workspace .memory-tool-menu { border: 0; margin: 0; padding: 0; }
html[data-theme] .memory-workspace #memoryChatTitle { background: none; -webkit-text-fill-color: var(--ink); color: var(--ink); }
html[data-theme] .memory-workspace #newMemoryChatBtn { border-radius: 10px; box-shadow: none; background: var(--ink); color: var(--workspace-paper); }
html[data-theme] .memory-workspace .memory-settings-tabs button { border: 0; background: transparent; box-shadow: none; border-radius: 8px; }
html[data-theme] .memory-workspace .memory-settings-tabs button[aria-selected="true"] { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
html[data-theme] .memory-workspace .memory-settings-resource .button-row { justify-content: flex-start; gap: 12px; }
.memory-workspace .memory-send-button::before { top: 11px; width: 9px; height: 9px; }
.memory-workspace .memory-send-button::after { top: 12px; height: 14px; }
.memory-workspace .memory-send-button.is-stopping::before { top: 11px; }

/* A single, theme-neutral icon and interaction language for the workspace. */
.memory-icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.memory-workspace .memory-icon { display: inline-block; flex: 0 0 auto; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; pointer-events: none; }
.memory-workspace .memory-icon use { pointer-events: none; }
.memory-workspace .memory-brand-mark { display: inline-flex; color: var(--ink); }
.memory-workspace .memory-brand-mark .memory-icon { width: 24px; height: 24px; stroke-width: 1.45; }
.memory-workspace .memory-welcome-mark .memory-icon { width: 30px; height: 30px; stroke-width: 1.3; }
.memory-workspace .memory-preview-empty .memory-icon { width: 32px; height: 32px; stroke-width: 1.3; }
.memory-workspace :is(.memory-chat-tools button, .memory-new-chat, .memory-list-heading button, .memory-tool-menu summary, .memory-tool-popover button, .memory-preview-tabs button, .memory-message-preview, .memory-welcome-examples button, .memory-app-menu summary, .memory-msg-menu button, .memory-preview-image-card a) { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.memory-workspace :is(.memory-new-chat, .memory-tool-popover button, .memory-app-menu summary, .memory-msg-menu button) { justify-content: flex-start; }
.memory-workspace .memory-preview-image-card > a { display: block; }
.memory-workspace .memory-preview-image-card figcaption .memory-icon { width: 13px; height: 13px; }
html body.memory-workspace .memory-preview-image-card figcaption a { color: var(--muted); text-decoration: none; transition: color 140ms; }
html body.memory-workspace .memory-preview-image-card figcaption a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.memory-workspace .memory-welcome-examples .memory-icon { width: 14px; height: 14px; color: var(--muted); }
.memory-workspace #memoryAttachMenu summary { width: 32px; height: 32px; padding: 0; }
.memory-workspace #memoryAttachMenu .memory-icon { width: 19px; height: 19px; }
.memory-workspace .memory-send-button::before, .memory-workspace .memory-send-button::after { display: none; }
.memory-workspace .memory-composer-tools .memory-send-button { display: grid; place-items: center; box-shadow: none; }
.memory-workspace .memory-send-button .memory-icon { width: 20px; height: 20px; stroke-width: 1.8; }
/* Explicit specificity beats the global theme's pill buttons and hover lift. */
html body.memory-workspace :is(button, summary, .nav-button, .memory-conversation, .memory-agent-item),
html body.memory-workspace :is(button, summary, .nav-button, .memory-conversation, .memory-agent-item):is(:hover, :active, :focus) {
  transform: none; translate: none; scale: none; filter: none;
  box-shadow: none;
  transition-property: color, background-color, border-color, opacity;
  transition-duration: 140ms;
}
html body.memory-workspace :is(.memory-generated-reference, .memory-preview-image-card figcaption button) { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
html body.memory-workspace :is(.memory-welcome-examples button, .memory-message-preview, .memory-generated-reference, .memory-context-button):hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); border-color: var(--line); }
html body.memory-workspace .memory-send-button:hover { color: var(--workspace-paper); background: color-mix(in srgb, var(--ink) 88%, var(--workspace-paper)); }
html body.memory-workspace .memory-generated-image-card > button:first-child,
html body.memory-workspace .memory-generated-image-card > button:first-child:hover { background: var(--workspace-side); border-color: var(--line); }
html body.memory-workspace :is(.memory-side button, .memory-workspace-header button, .memory-tool-menu summary, .memory-tool-popover button, .memory-preview-panel button, .memory-settings-tabs button) {
  box-shadow: none; border: 0; background: transparent; border-radius: 7px; color: var(--muted);
}
html body.memory-workspace :is(.memory-side button, .memory-workspace-header button, .memory-tool-menu summary, .memory-tool-popover button, .memory-preview-panel button, .memory-settings-tabs button):hover {
  box-shadow: none; color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent);
}
html body.memory-workspace #newMemoryChatBtn, html body.memory-workspace #newMemoryChatBtn:hover {
  justify-content: flex-start; gap: 9px; background: var(--ink); color: var(--workspace-paper); box-shadow: none; border-radius: 9px;
}
html body.memory-workspace #newMemoryChatBtn:hover { background: color-mix(in srgb, var(--ink) 88%, var(--workspace-paper)); }
html body.memory-workspace .memory-side { background: color-mix(in srgb, var(--workspace-paper) 97%, var(--ink)); }
html body.memory-workspace .memory-agent-item, html body.memory-workspace .memory-conversation {
  border: 0; box-shadow: none; border-radius: 8px; color: var(--ink); background: transparent;
}
html body.memory-workspace :is(.memory-agent-item, .memory-conversation):hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
html body.memory-workspace :is(.memory-agent-item, .memory-conversation).active { background: color-mix(in srgb, var(--ink) 7%, transparent); }
html body.memory-workspace .memory-agent-item-main,
html body.memory-workspace .memory-agent-item-main:is(:hover, :focus, :active) {
  display: grid; justify-items: start; padding: 11px 10px; margin: 0; min-height: 40px;
  border: 0; border-radius: 0; box-shadow: none; background: transparent; color: var(--ink);
}
html body.memory-workspace .memory-agent-item.active .memory-agent-name { color: var(--ink); }
html body.memory-workspace .memory-agent-name { font-size: 12px; font-weight: 500; }
html body.memory-workspace .memory-agent-ops, html body.memory-workspace .memory-conversation-ops { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
html body.memory-workspace :is(.memory-agent-ops button, .memory-conversation-ops button) {
  display: grid; place-items: center; padding: 0; width: 24px; height: 28px; min-width: 24px; min-height: 28px;
  border: 0; border-radius: 6px; background: transparent; box-shadow: none; color: var(--muted); opacity: .5;
}
html body.memory-workspace :is(.memory-agent-item, .memory-conversation):is(:hover, :focus-within) :is(.memory-agent-ops button, .memory-conversation-ops button) { opacity: 1; }
html body.memory-workspace :is(.memory-agent-ops button, .memory-conversation-ops button) .memory-icon { width: 14px; height: 14px; stroke-width: 1.6; }
html body.memory-workspace .memory-list-heading button { display: inline-flex; padding: 5px; min-height: 28px; font-weight: 450; }
html body.memory-workspace .memory-list-heading button .memory-icon { width: 15px; height: 15px; }
html body.memory-workspace .memory-conversation { gap: 4px; padding: 7px 8px 7px 10px; }
html body.memory-workspace .memory-agent-list { gap: 3px; padding-right: 0; margin-top: 10px; }
html body.memory-workspace .memory-agent-switcher > summary:hover { background: transparent; color: var(--ink); }
html body.memory-workspace .memory-agent-switcher > summary::after { content: ''; width: 6px; height: 6px; margin: 4px 4px 0 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
html body.memory-workspace .memory-agent-switcher[open] > summary::after { transform: rotate(225deg); margin-top: 8px; }
html body.memory-workspace :is(.memory-chat-tools button, .memory-preview-tabs button, .memory-settings-tabs button)[aria-selected="true"],
html body.memory-workspace .memory-chat-tools button[aria-expanded="true"] { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
@media (hover: none) {
  html body.memory-workspace :is(.memory-agent-ops button, .memory-conversation-ops button) { opacity: .8; }
}
@media (max-width: 680px) {
  .memory-workspace .memory-chat-tools button { gap: 4px; }
  .memory-workspace .memory-chat-tools .memory-icon { width: 15px; height: 15px; }
}
/* Paragraph actions stay out of copied text and appear on hover or keyboard focus. */
html body.memory-workspace .memory-copyable-paragraph { position: relative; padding-right: 34px; }
html body.memory-workspace button.memory-copy-paragraph {
  position: absolute; top: 0; right: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; min-height: 28px; padding: 5px; border: 1px solid var(--line);
  border-radius: 7px; background: var(--card-bg); color: var(--muted); opacity: 0;
  transition: opacity 120ms ease; cursor: pointer;
}
html body.memory-workspace .memory-copyable-paragraph:hover .memory-copy-paragraph,
html body.memory-workspace .memory-copyable-paragraph:focus-within .memory-copy-paragraph { opacity: 1; }
html body.memory-workspace .memory-copy-paragraph[data-copied="true"] { opacity: 1; color: #329368; border-color: currentColor; }
@media (hover: none), (max-width: 680px) {
  html body.memory-workspace button.memory-copy-paragraph { opacity: 1; }
}
