/* 智能体对话界面 — 中央阅读栏 + 人文美术馆气质 */
body.agent-page {
  --font-ui: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  --agent-ink: #333333;
  --agent-paper: var(--bg-warm);
  --agent-tea: rgba(154, 132, 104, 0.09);
  --agent-tea-line: rgba(154, 132, 104, 0.2);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

body.agent-page .site-header {
  position: relative;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line);
}

body.agent-page main {
  padding-top: 0;
  flex: 1;
  min-height: 0;
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.agent-page .site-footer {
  flex-shrink: 0;
  margin-top: 0;
  padding: var(--space-sm) 0;
}

body.agent-page .footer-nav {
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
}

body.agent-page .footer-copy {
  text-align: center;
  width: 100%;
  margin-top: 0.25rem;
}

.agent-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  flex: 1;
  min-height: 0;
  height: 100%;
}
.agent-sidebar { background: var(--bg-panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: var(--space-md); min-height: 0; height: 100%; position: relative; }
.agent-sidebar .new-chat { width: 100%; margin-bottom: var(--space-md); padding: 0.75em; font-size: 0.8rem; letter-spacing: 0.1em; border: 1px dashed var(--line-strong); background: transparent; cursor: pointer; font-family: inherit; color: var(--ink-soft); transition: var(--transition); }
.agent-sidebar .new-chat:hover { border-color: var(--ink); color: var(--ink); }
.agent-sidebar h4 { font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: var(--space-sm); }
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.history-list::-webkit-scrollbar {
  width: 6px;
}
.history-list::-webkit-scrollbar-thumb {
  background: rgba(26, 24, 20, 0.22);
  border-radius: 3px;
}
.history-list::-webkit-scrollbar-track {
  background: transparent;
}
@supports (scrollbar-color: auto) {
  .history-list {
    scrollbar-color: rgba(26, 24, 20, 0.28) transparent;
    scrollbar-width: thin;
  }
}

.history-row {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
}

.history-row.active .history-item,
.history-row.is-pinned .history-item {
  color: var(--ink);
}

.history-item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  box-sizing: border-box;
  margin: 0;
  padding: 0.55rem 0.45rem 0.55rem 0.7rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.35;
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.history-item-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-pin-mark {
  flex-shrink: 0;
  font-size: 0.72rem;
  opacity: 0.72;
}

.history-item:hover {
  background: rgba(26, 24, 20, 0.06);
  color: var(--ink);
}

.history-item.active {
  background: rgba(26, 24, 20, 0.08);
  font-weight: 500;
  color: var(--ink);
}

.history-item:focus-visible {
  outline: 2px solid rgba(154, 132, 104, 0.45);
  outline-offset: 1px;
}

.history-actions {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.history-menu-btn {
  width: 1.85rem;
  min-width: 1.85rem;
  height: 100%;
  min-height: 2rem;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-ui);
  font-size: 1.05rem;
  line-height: 1;
  letter-spacing: 0.08em;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.history-row:hover .history-menu-btn,
.history-row:focus-within .history-menu-btn,
.history-row.active .history-menu-btn,
.history-menu-btn.is-open {
  opacity: 0.82;
}

.history-menu-btn:hover,
.history-menu-btn.is-open {
  opacity: 1;
  color: var(--ink);
  background: rgba(26, 24, 20, 0.06);
}

.history-menu-btn:focus-visible {
  opacity: 1;
  outline: 2px solid rgba(154, 132, 104, 0.45);
  outline-offset: 1px;
}

.history-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  min-width: 168px;
  padding: 0.35rem;
  border: 1px solid rgba(26, 24, 20, 0.1);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: 0 8px 28px rgba(26, 24, 20, 0.12);
}

.history-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.55rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.history-menu-item:hover {
  background: rgba(26, 24, 20, 0.06);
  color: var(--ink);
}

.history-menu-item.is-danger:hover {
  background: rgba(154, 74, 74, 0.1);
  color: #9a4a4a;
}

.history-menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  flex-shrink: 0;
  color: var(--ink-muted);
}

.history-menu-item:hover .history-menu-icon {
  color: inherit;
}

.history-row.is-renaming {
  flex-direction: column;
  align-items: stretch;
  padding: 0.25rem 0;
}

.history-rename-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  padding: 0.35rem 0.45rem;
  border-radius: var(--radius);
  background: rgba(26, 24, 20, 0.05);
  border: 1px solid rgba(154, 132, 104, 0.35);
}

.history-rename-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(26, 24, 20, 0.12);
  border-radius: 6px;
  background: var(--bg-card);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--ink);
}

.history-rename-input:focus {
  outline: 2px solid rgba(154, 132, 104, 0.4);
  outline-offset: 1px;
  border-color: rgba(154, 132, 104, 0.45);
}

.history-rename-btns {
  display: flex;
  gap: 0.4rem;
}

.history-rename-save,
.history-rename-cancel {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  cursor: pointer;
  border: 1px solid transparent;
}

.history-rename-save {
  background: rgba(154, 132, 104, 0.18);
  color: var(--ink);
  border-color: rgba(154, 132, 104, 0.35);
}

.history-rename-save:hover {
  background: rgba(154, 132, 104, 0.28);
}

.history-rename-cancel {
  background: transparent;
  color: var(--ink-muted);
  border-color: rgba(26, 24, 20, 0.1);
}

.history-rename-cancel:hover {
  background: rgba(26, 24, 20, 0.05);
  color: var(--ink-soft);
}

.agent-toast {
  position: fixed;
  left: 50%;
  bottom: 5.5rem;
  z-index: 200;
  transform: translateX(-50%) translateY(0.5rem);
  max-width: min(92vw, 22rem);
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  line-height: 1.4;
  text-align: center;
  color: var(--ink);
  background: var(--bg-card);
  border: 1px solid rgba(26, 24, 20, 0.12);
  box-shadow: 0 10px 32px rgba(26, 24, 20, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.agent-toast:not([hidden]) {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.agent-toast.is-ok {
  border-color: rgba(90, 120, 90, 0.35);
  background: rgba(248, 252, 246, 0.98);
}

.agent-toast.is-err {
  border-color: rgba(154, 74, 74, 0.35);
  background: rgba(252, 246, 246, 0.98);
  color: #8a4040;
}

.agent-access-paywall { padding: var(--space-lg); }
.agent-access-paywall:not([hidden]) { display: block; }
.agent-main { display: flex; flex-direction: column; background: var(--agent-paper); min-width: 0; min-height: 0; height: 100%; position: relative; }

.chat-model-bar {
  display: inline-flex;
  align-items: center;
  gap: 0;
  width: fit-content;
  max-width: min(800px, 100%);
  margin: 0 auto 0.65rem;
  padding: 3px;
  border-radius: 999px;
  background: rgba(26, 24, 20, 0.05);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.chat-model-opt {
  margin: 0;
  padding: 0.42em 1.15em;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: var(--ink-muted);
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.chat-model-opt:hover:not(.is-active):not([aria-checked="true"]) {
  color: var(--ink);
  background: rgba(26, 24, 20, 0.04);
}

.chat-model-opt.is-active,
.chat-model-opt[aria-checked="true"] {
  color: var(--bg-warm);
  background: var(--ink);
  box-shadow: 0 1px 4px rgba(26, 24, 20, 0.18);
}

.chat-model-opt:focus-visible {
  outline: 2px solid rgba(154, 132, 104, 0.45);
  outline-offset: 2px;
}

.agent-history-toggle {
  display: none;
}

.agent-sidebar-backdrop {
  display: none;
}
.stream-bottom-sentinel {
  height: 1px;
  width: 100%;
  flex-shrink: 0;
  overflow-anchor: auto;
  pointer-events: none;
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}

.chat-reading-column {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-md) 7rem;
  box-sizing: border-box;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.chat-scroll.has-chat .chat-reading-column {
  justify-content: flex-start;
}

.chat-scroll.has-chat .chat-welcome,
.chat-welcome[hidden],
.chat-welcome.is-hidden {
  display: none !important;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
  width: 100%;
  min-height: 0;
}

.chat-scroll:not(.has-chat) .chat-messages {
  flex: 0 0 auto;
  min-height: 0;
}

/* —— 消息：中央阅读栏，非左右气泡 —— */
.msg {
  width: 100%;
  animation: msgIn 0.45s ease;
}

.msg.stream-slot,
.msg#thinkingIndicator {
  animation: none;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user {
  display: flex;
  justify-content: flex-end;
}

.msg-user-card {
  max-width: min(92%, 540px);
  padding: 0.85rem 1.15rem;
  background: var(--agent-tea);
  border: 1px solid var(--agent-tea-line);
  border-radius: 6px;
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.assistant {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 1rem 1.15rem;
  align-items: start;
}

.msg-seal {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  background: rgba(154, 132, 104, 0.07);
  border: 1.5px solid rgba(154, 132, 104, 0.45);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 252, 246, 0.35);
}

.msg.assistant .msg-body {
  min-width: 0;
  padding: 16px 20px;
  background: rgba(250, 248, 244, 0.95);
  background: color-mix(in srgb, var(--bg-card) 88%, var(--agent-paper));
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(26, 24, 20, 0.03);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--agent-ink);
}

.msg-body {
  min-width: 0;
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--agent-ink);
}

.msg-body.is-streaming {
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-body.is-streaming.is-thinking {
  min-height: 1.5rem;
  font-style: normal;
}

.msg-body.is-streaming.is-thinking .thinking-indicator-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}

.thinking-indicator {
  display: flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0;
}

.thinking-indicator-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.thinking-indicator-dots span {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(122, 115, 106, 0.5);
  animation: thinkingDotPulse 1.55s ease-in-out infinite;
}

.thinking-indicator-dots span:nth-child(2) {
  animation-delay: 0.24s;
}

.thinking-indicator-dots span:nth-child(3) {
  animation-delay: 0.48s;
}

@keyframes thinkingDotPulse {
  0%,
  78%,
  100% {
    opacity: 0.22;
    transform: scale(0.82);
  }
  38% {
    opacity: 0.88;
    transform: scale(1);
  }
}

#thinkingIndicator {
  animation: msgIn 0.45s ease;
}

/* Markdown 富文本排版 */
.agent-prose {
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--agent-ink);
}

.agent-prose > *:first-child {
  margin-top: 0;
}

.agent-prose > *:last-child {
  margin-bottom: 0;
}

.agent-prose h1,
.agent-prose h2,
.agent-prose h3,
.agent-prose h4 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.02em;
  line-height: 1.45;
}

.agent-prose h1 { font-size: 1.55rem; margin: 1.35em 0 0.55em; }
.agent-prose h2 { font-size: 1.28rem; margin: 1.2em 0 0.5em; }
.agent-prose h3 { font-size: 1.08rem; margin: 1.05em 0 0.45em; }

.agent-prose p {
  margin: 0 0 1em;
}

.agent-prose ul,
.agent-prose ol {
  margin: 0 0 1em;
  padding-left: 1.35em;
}

.agent-prose li + li {
  margin-top: 0.35em;
}

.agent-prose blockquote {
  margin: 1em 0;
  padding: 0.15em 0 0.15em 1em;
  border-left: 2px solid var(--accent-gold);
  color: var(--ink-soft);
  font-style: normal;
}

.agent-prose strong {
  font-weight: 600;
  color: var(--accent-gold);
}

.agent-prose em {
  font-style: italic;
}

.agent-prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.agent-prose code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
  background: rgba(26, 24, 20, 0.05);
  padding: 0.12em 0.35em;
  border-radius: 3px;
}

.agent-prose pre {
  margin: 1em 0;
  padding: 0.85rem 1rem;
  background: rgba(26, 24, 20, 0.04);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow-x: auto;
}

.agent-prose pre code {
  background: none;
  padding: 0;
}

.agent-prose hr {
  border: none;
  border-top: 1px solid var(--line-strong);
  margin: 1.5em 0;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 520px;
  margin: auto;
  padding: var(--space-xl) var(--space-sm);
}
.chat-welcome h2 { font-family: var(--font-display); font-size: 2rem; font-weight: 400; margin-bottom: var(--space-sm); }
.chat-welcome p { color: var(--ink-soft); font-weight: 300; margin-bottom: var(--space-lg); }

.agent-astro-notice {
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink-muted);
  margin: -0.5rem auto var(--space-md);
  max-width: 480px;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(154, 132, 104, 0.06);
}

.agent-astro-notice a {
  color: var(--accent-gold);
  font-weight: 500;
  text-decoration: none;
}

.agent-astro-notice a:hover {
  text-decoration: underline;
}

.suggest-ticker-wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.suggest-ticker-label {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  text-align: center;
  opacity: 0.88;
}

.suggest-ticker-box {
  width: 100%;
  min-height: 3.6rem;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.15rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-card);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.suggest-ticker-box.is-fading {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

.suggest-ticker-box .suggest-chip {
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 0.88rem;
  line-height: 1.55;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink-soft);
  appearance: none;
  -webkit-appearance: none;
  transition: color 0.15s ease;
}

.suggest-ticker-box .suggest-chip:hover {
  color: var(--ink);
  background: transparent;
  border-color: transparent;
}
.chat-input-dock {
  flex-shrink: 0;
  position: relative;
  z-index: 3;
  margin-top: -3.5rem;
  padding-top: 3.5rem;
  background: linear-gradient(
    to top,
    var(--agent-paper) 0%,
    rgba(245, 241, 234, 0.97) 55%,
    rgba(245, 241, 234, 0) 100%
  );
  pointer-events: none;
}

.chat-input-dock > * {
  pointer-events: auto;
}

.chat-input-area {
  flex-shrink: 0;
  padding: 0 var(--space-md) var(--space-sm);
  border-top: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-input-wrap {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(250, 248, 244, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  box-shadow: 0 2px 16px rgba(26, 24, 20, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input-wrap:focus-within {
  border-color: rgba(107, 93, 79, 0.35);
  box-shadow: 0 2px 20px rgba(26, 24, 20, 0.06);
}

.chat-input-wrap textarea {
  flex: 1;
  border: none;
  resize: none;
  min-height: 26px;
  max-height: 160px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--agent-ink);
  background: transparent;
  outline: none;
  overflow-y: auto;
}
.chat-send { padding: 0.5em 1.2em; background: var(--ink); color: var(--bg-warm); border: none; cursor: pointer; font-family: inherit; font-size: 0.8rem; letter-spacing: 0.08em; transition: var(--transition); flex-shrink: 0; }
.chat-send:hover { background: var(--accent); }
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; }
.chat-stop {
  padding: 0.5em 0.9em;
  background: var(--bg-card);
  color: var(--ink-muted);
  border: 1px solid var(--line-strong);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.chat-stop:hover { color: var(--ink); border-color: var(--accent-gold); }
.chat-stop[hidden], .chat-send[hidden] { display: none !important; }
.chat-hint {
  text-align: center;
  font-size: 0.7rem;
  color: var(--ink-muted);
  margin-top: var(--space-xs);
  letter-spacing: 0.05em;
  width: 100%;
  max-width: 800px;
}

.msg.assistant .agent-kb-debug {
  grid-column: 1 / -1;
  margin: 0.35rem 0 0;
  padding-left: calc(2.5rem + 1.15rem);
}

.agent-kb-debug-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  max-width: 800px;
  margin: 0.35rem auto 0;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
}

.agent-kb-debug-toggle input {
  accent-color: var(--accent-gold);
}

.agent-kb-debug {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.agent-kb-debug details {
  border: 1px dashed rgba(154, 132, 104, 0.35);
  border-radius: 6px;
  background: rgba(250, 248, 244, 0.65);
  padding: 0.45rem 0.65rem;
}

.agent-kb-debug summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.03em;
  list-style: none;
}

.agent-kb-debug summary::-webkit-details-marker {
  display: none;
}

.agent-kb-debug-body {
  max-height: 180px;
  overflow-y: auto;
  margin-top: 0.35rem;
  padding-right: 0.25rem;
}

.agent-kb-debug-meta {
  margin: 0.45rem 0 0.35rem;
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.agent-kb-debug-empty {
  margin: 0.35rem 0 0;
  color: var(--ink-muted);
}

.agent-kb-debug-list {
  margin: 0.25rem 0 0;
  padding-left: 1.15rem;
}

.agent-kb-debug-item {
  margin: 0.55rem 0;
}

.agent-kb-debug-item p {
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.agent-kb-debug-tag {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  background: rgba(154, 132, 104, 0.12);
  color: var(--ink-muted);
  font-size: 0.68rem;
}

@keyframes blink { 0%,80%,100%{opacity:.3} 40%{opacity:1} }
@media (max-width: 768px) {
  .agent-layout { grid-template-columns: 1fr; }
  .chat-reading-column {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
    padding-bottom: 6.5rem;
  }
  .msg.assistant {
    grid-template-columns: 2.15rem minmax(0, 1fr);
    gap: 0.75rem;
  }
  .msg-seal {
    width: 2.15rem;
    height: 2.15rem;
    font-size: 0.85rem;
  }
  .msg-user-card {
    max-width: 100%;
  }
  .history-menu-btn {
    opacity: 0.55;
  }
  .history-menu {
    min-width: 152px;
  }
  .agent-history-toggle {
    display: inline-flex;
    align-items: center;
    position: fixed;
    top: 4.6rem;
    left: 0.75rem;
    z-index: 30;
    padding: 0.4em 0.75em;
    border: 1px solid var(--line-strong);
    background: var(--bg-card);
    font-family: inherit;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    cursor: pointer;
    box-shadow: var(--shadow);
  }
  .agent-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 88vw);
    z-index: 40;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-hover);
    display: flex;
  }
  .agent-sidebar.is-open {
    transform: translateX(0);
  }
  .agent-sidebar-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(26, 24, 20, 0.35);
  }
  body.agent-page .site-header .nav-main { display: none; }
}
