:root {
  --bg: #f3f8f3;
  --bg-deep: #eaf3eb;
  --surface: rgba(255, 255, 255, .94);
  --surface-muted: #edf5ef;
  --text: #203329;
  --text-soft: #607267;
  --line: #d4e2d6;
  --primary: #5f8f72;
  --primary-strong: #3f6e55;
  --primary-soft: #dcece0;
  --danger: #a64d4d;
  --warning: #8b632f;
  --shadow: 0 20px 55px rgba(41, 72, 52, .12);
  --shadow-soft: 0 8px 26px rgba(41, 72, 52, .07);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --focus: 0 0 0 4px rgba(95, 143, 114, .2);
  color: var(--text);
  background: var(--bg);
  font-family: "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(182, 218, 190, .42), transparent 34%),
    radial-gradient(circle at 100% 20%, rgba(219, 235, 208, .58), transparent 36%),
    linear-gradient(180deg, #f8fbf7 0%, var(--bg) 52%, #eef5ef 100%);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.break { overflow-wrap: anywhere; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.app-shell, .shell { min-height: 100vh; }
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 17px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid rgba(194, 214, 199, .82);
  background: rgba(244, 249, 244, .86);
  backdrop-filter: blur(18px);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 7px; }
.brand-mark {
  width: 45px; height: 45px; display: grid; place-items: center;
  border-radius: 15px; color: #fff; font-weight: 800; letter-spacing: .04em;
  background: linear-gradient(145deg, var(--primary), #7dad8b);
  box-shadow: 0 9px 26px rgba(63, 110, 85, .24);
}
.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: var(--text-soft); font-size: 12px; }
.nav-stack { display: grid; gap: 7px; }
.nav-button {
  width: 100%; display: flex; align-items: center; gap: 10px;
  border: 0; border-radius: 13px; padding: 11px 12px;
  color: var(--text-soft); background: transparent; text-align: left;
  transition: .16s ease;
}
.nav-button:hover { color: var(--text); background: rgba(220, 236, 224, .62); }
.nav-button.active { color: var(--primary-strong); background: var(--primary-soft); font-weight: 700; }
.icon { width: 23px; text-align: center; }
.sidebar-foot {
  margin-top: auto; padding: 13px; border: 1px solid var(--line);
  border-radius: var(--radius-md); background: rgba(255, 255, 255, .72);
}
.user-line { font-weight: 700; overflow-wrap: anywhere; }
.user-meta { margin-top: 4px; color: var(--text-soft); font-size: 12px; line-height: 1.5; }
.sidebar-links { display: flex; gap: 12px; margin-top: 9px; font-size: 12px; }
.main { min-width: 0; padding: 30px clamp(18px, 3.5vw, 54px) 44px; }

.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.eyebrow { color: var(--primary-strong); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 7px 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.08; letter-spacing: -.035em; }
h2 { margin: 0; font-size: 20px; }
h3 { margin: 0 0 5px; }
.subtitle { margin: 0; color: var(--text-soft); line-height: 1.6; }
.actions, .row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions { justify-content: flex-end; }
.button {
  border: 1px solid transparent; border-radius: 12px; padding: 10px 15px;
  color: var(--text); background: #fff; box-shadow: var(--shadow-soft);
  font-weight: 700; transition: .16s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--line); }
.button.primary { color: #fff; background: var(--primary-strong); box-shadow: 0 9px 24px rgba(63, 110, 85, .22); }
.button.primary:hover:not(:disabled) { background: #345e48; }
.button.ghost { background: rgba(255, 255, 255, .66); border-color: var(--line); box-shadow: none; }
.button.danger { color: var(--danger); background: #fff8f8; border-color: #ead1d1; box-shadow: none; }
.button.small { padding: 7px 10px; font-size: 12px; }
.icon-button {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 11px;
  color: var(--text-soft); background: #fff;
}
.select, input, textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; color: var(--text); background: rgba(255, 255, 255, .92);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
textarea { resize: vertical; line-height: 1.55; }
input[type="color"] { min-height: 44px; padding: 4px; }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px); gap: 12px; margin-bottom: 18px; }
.search-input { min-height: 44px; }
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.agent-card {
  position: relative; min-height: 270px; display: flex; flex-direction: column;
  padding: 20px; overflow: hidden; border: 1px solid rgba(203, 221, 207, .94);
  border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-soft);
  transition: .18s ease;
}
.agent-card::after {
  content: ""; position: absolute; width: 130px; height: 130px; top: -62px; right: -55px;
  border-radius: 50%; background: color-mix(in srgb, var(--agent-accent, var(--primary)) 18%, transparent);
  pointer-events: none;
}
.agent-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.agent-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; position: relative; z-index: 1; }
.agent-icon {
  width: 51px; height: 51px; display: grid; place-items: center; border-radius: 17px;
  color: var(--agent-accent, var(--primary-strong));
  background: color-mix(in srgb, var(--agent-accent, var(--primary)) 14%, white);
  border: 1px solid color-mix(in srgb, var(--agent-accent, var(--primary)) 24%, white);
  font-size: 24px;
}
.agent-card h2 { margin: 16px 0 7px; }
.agent-description { margin: 0; color: var(--text-soft); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.agent-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 9px; color: var(--text-soft); background: var(--surface-muted); font-size: 11px; font-weight: 700; }
.badge.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #589568; }
.badge.off { color: #8d5858; background: #f5eaea; }
.agent-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 18px; }
.agent-actions .primary { flex: 1; }
.agent-setup-title { display: flex; gap: 14px; align-items: center; }

.empty {
  padding: 48px 22px; display: grid; gap: 7px; text-align: center;
  color: var(--text-soft); border: 1px dashed #bad0bf;
  border-radius: var(--radius-lg); background: rgba(255, 255, 255, .5);
}
.empty strong { color: var(--text); font-size: 18px; }
.empty.compact { padding: 18px; border-radius: 14px; }

.form-stack { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field { display: grid; gap: 7px; }
.field > span { font-size: 13px; font-weight: 750; }
.field small { color: var(--text-soft); line-height: 1.45; }
.field-full { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 9px; }
.check-row input { width: 17px; height: 17px; flex: 0 0 auto; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.card-row { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.attachment-picker { max-height: 230px; overflow: auto; display: grid; gap: 8px; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  padding: 20px; background: rgba(24, 42, 30, .38); backdrop-filter: blur(8px);
}
.modal {
  width: min(780px, 100%); max-height: calc(100vh - 40px); display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden;
  border: 1px solid rgba(204, 221, 208, .94); border-radius: 24px;
  background: #fbfdfb; box-shadow: 0 32px 90px rgba(25, 51, 34, .26);
}
.modal-header, .modal-footer { display: flex; align-items: center; gap: 12px; padding: 18px 21px; background: rgba(251, 253, 251, .96); }
.modal-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.modal-body { min-height: 0; overflow: auto; padding: 21px; }

.project-grid { display: grid; gap: 18px; }
.project-card { padding: 19px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-soft); }
.project-head { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 13px; }
.conversation-list { display: grid; gap: 7px; }
.conversation-row {
  width: 100%; display: flex; justify-content: space-between; gap: 16px; align-items: center;
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px;
  color: var(--text); background: #fff; text-align: left;
}
.conversation-row:hover { border-color: #aec8b5; background: #f8fbf8; }
.conversation-row small { color: var(--text-soft); }

.attachment-list { display: grid; gap: 11px; }
.attachment-row {
  display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: #fff;
}
.file-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; color: var(--primary-strong); background: var(--primary-soft); font-size: 11px; font-weight: 800; }
.attachment-info { min-width: 0; }
.attachment-info strong, .attachment-info small { display: block; overflow-wrap: anywhere; }
.attachment-info small { margin-top: 4px; color: var(--text-soft); }
.error-text { color: var(--danger) !important; }

.chat-page { height: calc(100vh - 60px); min-height: 600px; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 14px; }
/* 对话专注模式：隐藏主导航，对话区全宽 */
.app-shell.chat-focus {
  display: block;
  min-height: 100vh;
  padding: 12px 16px 16px;
  background: var(--bg);
}
.app-shell.chat-focus .chat-page {
  height: calc(100vh - 28px);
  min-height: 0;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
}

.chat-layout {
  min-width: 0; height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
  background: rgba(255, 255, 255, .82); box-shadow: var(--shadow);
}
.chat-header { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--line); background: rgba(249, 252, 249, .94); }
.chat-title { min-width: 150px; }
.chat-title strong, .chat-title small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-title small { color: var(--text-soft); font-size: 11px; }
.spacer { flex: 1; }
.model-select, .project-select { width: min(210px, 23vw); }
.messages { min-height: 0; overflow-y: auto; padding: 24px clamp(14px, 3.5vw, 46px); scroll-behavior: smooth; }
.message { max-width: 940px; margin: 0 auto 18px; display: flex; gap: 10px; align-items: flex-start; }
.message.user { flex-direction: row-reverse; }
.message-avatar { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: var(--primary-strong); background: var(--primary-soft); font-size: 12px; font-weight: 800; }
.message.user .message-avatar { color: #526159; background: #e8ede9; }
.message-content { max-width: min(80%, 780px); }
.message-bubble { padding: 13px 15px; border: 1px solid var(--line); border-radius: 17px 17px 17px 5px; background: #fff; line-height: 1.68; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user .message-bubble { border-radius: 17px 17px 5px 17px; border-color: #cddfd1; background: #e9f3eb; }
.message-time { display: block; margin-top: 4px; color: var(--text-soft); font-size: 10px; }
.message.user .message-time { text-align: right; }
.message.streaming .message-bubble::after { content: "▋"; margin-left: 2px; color: var(--primary); animation: blink .8s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.chat-empty { height: 100%; display: grid; place-content: center; gap: 8px; text-align: center; color: var(--text-soft); }
.chat-empty h2, .chat-empty p { margin: 0; }
.chat-empty-icon { width: 68px; height: 68px; margin: 0 auto 8px; display: grid; place-items: center; border-radius: 22px; color: var(--primary-strong); background: var(--primary-soft); font-size: 30px; }
.composer-wrap { padding: 10px clamp(12px, 3vw, 30px) 15px; border-top: 1px solid var(--line); background: rgba(249, 252, 249, .95); }
.composer { max-width: 980px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: end; padding: 7px 7px 7px 13px; border: 1px solid #c6d8c9; border-radius: 18px; background: #fff; box-shadow: 0 8px 25px rgba(45, 75, 56, .08); }
.composer textarea { min-height: 42px; max-height: 180px; padding: 9px 0; resize: none; border: 0; box-shadow: none; background: transparent; }
.send-button { min-width: 66px; height: 43px; border: 0; border-radius: 13px; color: #fff; background: var(--primary-strong); font-weight: 800; }
.attachment-chips { max-width: 980px; margin: 0 auto 7px; display: flex; flex-wrap: wrap; gap: 6px; }
.attachment-chip { border-radius: 999px; padding: 5px 9px; color: var(--primary-strong); background: var(--primary-soft); font-size: 11px; }
.composer-note { max-width: 980px; margin: 7px auto 0; text-align: center; color: var(--text-soft); font-size: 10px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--text-soft); background: #f6faf7; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
.card { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.card p { margin: 8px 0 0; }

.toast-stack { position: fixed; z-index: 140; right: 18px; bottom: 18px; width: min(390px, calc(100vw - 36px)); display: grid; gap: 9px; }
.toast { padding: 13px 15px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.toast.error { color: #813e3e; border-color: #e6c4c4; background: #fff8f8; }

.login-page, .fatal-page { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.login-card, .fatal-card { width: min(460px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 25px; background: rgba(255, 255, 255, .9); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.login-card .brand { padding: 0; margin-bottom: 25px; }
.login-card h1 { margin: 8px 0; font-size: 30px; }
.alert { margin: 15px 0; padding: 11px 13px; border-radius: 12px; }
.alert.error { color: #813e3e; border: 1px solid #e6c4c4; background: #fff3f3; }
.loading { min-height: 100vh; display: grid; place-items: center; color: var(--text-soft); text-align: center; }
.spinner { width: 31px; height: 31px; margin: 0 auto 10px; border: 3px solid #dbe8dd; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) {
  .chat-page { grid-template-columns: 200px minmax(0, 1fr); }
  .chat-header { flex-wrap: wrap; }
  .model-select, .project-select { width: 180px; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 13px 15px; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-stack { display: flex; overflow-x: auto; }
  .nav-button { width: auto; flex: 0 0 auto; }
  .nav-button span:last-child { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 8px 10px; }
  .user-meta, .sidebar-links { display: none; }
  .main { padding: 20px 14px 30px; }
  .chat-page { height: calc(100vh - 100px); grid-template-columns: 1fr; }
  .history-panel { display: none; }
}

@media (max-width: 640px) {
  .brand > div:last-child { display: none; }
  .topbar, .project-head { display: block; }
  .actions, .project-head .row-actions { justify-content: flex-start; margin-top: 13px; }
  .toolbar, .form-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .agent-grid { grid-template-columns: 1fr; }
  .attachment-row { grid-template-columns: 48px minmax(0, 1fr); }
  .attachment-row > .row-actions { grid-column: 1 / -1; }
  .chat-header { padding: 10px; }
  .chat-title { order: -1; width: 100%; }
  .model-select, .project-select { width: calc(50% - 5px); }
  .message-content { max-width: 88%; }
  .messages { padding: 18px 9px; }
  .login-card { padding: 23px; }
}

/* v1.5.0 multimedia and vector workspaces */
.generation-form { margin-bottom: 18px; }
.generation-list { display: grid; gap: 10px; }
.embedding-result { margin-top: 18px; }
.embedding-result pre { max-height: 280px; overflow: auto; }
@media (max-width: 720px) {
  .generation-form .form-grid { grid-template-columns: 1fr; }
}

/* v1.6.2 login identity hardening + workspace tools */
.composer-options {
  max-width: 980px;
  margin: 0 auto 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-soft);
  font-size: 11px;
}
.compact-toggle { gap: 7px; }
.composer-hint { margin-left: auto; }
.message-artifacts { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 7px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-heading h2 { margin: 0; }
.section-heading p { margin: 5px 0 0; color: var(--text-soft); }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-row > div:first-child { min-width: 0; }
.card-row strong, .card-row small { display: block; overflow-wrap: anywhere; }
.card-row small { margin-top: 4px; color: var(--text-soft); }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat-card { min-height: 116px; display: grid; align-content: center; gap: 7px; padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: #fff; box-shadow: var(--shadow-soft); }
.stat-card strong { color: var(--primary-strong); font-size: 28px; overflow-wrap: anywhere; }
.stat-card span { color: var(--text-soft); text-transform: capitalize; }
.chart-job-row { margin-top: 10px; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.break { word-break: break-all; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.sidebar-links { margin-top: 9px; display: flex; gap: 10px; }
.sidebar-links a { color: var(--primary-strong); font-size: 11px; text-decoration: none; }
.sidebar-links a:hover { text-decoration: underline; }
.row-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; justify-content: flex-end; }

@media (max-width: 640px) {
  .composer-options, .section-heading, .card-row { align-items: stretch; flex-direction: column; }
  .composer-hint { margin-left: 0; }
  .card-row .row-actions { justify-content: flex-start; }
}



/* 输入框上方：附件/知识库图标 + 网络搜索 */

.composer-options {

  display: flex;

  align-items: center;

  gap: 12px;

  flex-wrap: wrap;

}

.composer-tools {

  display: flex;

  align-items: center;

  gap: 6px;

}

.icon-btn {

  min-width: 36px;

  height: 32px;

  padding: 0 10px;

  font-size: 16px;

  line-height: 1;

}
/* 网络搜索图标：默认灰，开启高亮 */
.composer-options .icon-btn {
  filter: grayscale(1);
  opacity: 0.55;
  transition: filter .15s, opacity .15s, background .15s;
}
.composer-options .icon-btn-active {
  filter: none;
  opacity: 1;
  background: #5F8F72 !important;
  color: #fff !important;
  border-color: #5F8F72 !important;
}
/* 智能体按分类分区 */
.agent-board {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.agent-category-section {
  padding: 0.5rem 0 1.25rem;
}
.agent-category-divider {
  margin-top: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px dashed #b7c9bc;
}
.agent-category-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.agent-category-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #2f4f3e;
}
.agent-category-head .badge {
  font-size: 0.75rem;
}
.empty-inline {
  color: #6b7c72;
  font-size: 0.9rem;
  padding: 0.5rem 0;
}
/* 对话附件芯片 + 删除按钮 */
.attachment-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  background: #e8f0eb;
  border: 1px solid #c5d9cc;
  border-radius: 16px;
  font-size: 13px;
  color: #2d4a3e;
  line-height: 1.3;
}

.attachment-chip .chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #6b8f7a;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.attachment-chip .chip-remove:hover {
  background: #d9534f;
  color: #fff;
}
/* ===== 左侧对话栏 · 接近 Grok 风格 ===== */
.history-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 12px 10px 14px;
  min-width: 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(246, 250, 246, .88);
  box-shadow: var(--shadow-soft);
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 10px;
}

.history-head strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: 0.02em;
}

.history-search,
.history-tools,
.history-projects,
.history-list {
  width: 100%;
}

.history-search {
  width: 100%;
  margin: 0 0 8px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.9);
  font-size: 13px;
  box-sizing: border-box;
}

.history-search:focus {
  border-color: var(--primary);
  box-shadow: var(--focus);
}

.history-tools {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
}

.history-new-chat,
.history-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(255,255,255,0.72);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  box-sizing: border-box;
}

.history-new-chat {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 750;
}

.history-new-chat:hover,
.history-nav-item:hover {
  background: rgba(95, 143, 114, 0.16);
}

.history-nav-icon {
  width: 18px;
  text-align: center;
  opacity: 0.9;
}

.history-projects {
  margin: 0 0 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.55);
  box-sizing: border-box;
}

.history-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 8px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.history-project-list {
  display: grid;
  gap: 2px;
}

.history-project-row {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 8px;
}

.history-project-item {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.history-project-item:hover {
  background: rgba(95, 143, 114, 0.1);
}

.history-project-item.active {
  background: rgba(95, 143, 114, 0.16);
  color: var(--primary-strong);
  font-weight: 650;
}

.history-project-name {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.history-project-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  padding-right: 2px;
}

.history-project-row:hover .history-project-actions {
  opacity: 1;
}

.history-mini-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #7f9a88;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}

.history-mini-btn:hover {
  background: rgba(0,0,0,0.06);
  color: #2d4a3e;
}

.history-mini-btn.danger:hover {
  background: #f3d6d6;
  color: #a64d4d;
}

.history-mini-btn.add {
  color: var(--primary-strong);
  font-weight: 700;
}

.history-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.history-group-title {
  margin: 12px 6px 6px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 1px 0;
  border-radius: 10px;
  width: auto;
  padding: 0;
  background: transparent;
}

.history-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 10px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  color: inherit;
}

.history-item.active .history-item-main,
.history-item-main:hover {
  background: rgba(95, 143, 114, 0.12);
}

.history-title {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 600;
}

.history-item small {
  color: var(--text-soft);
  font-size: 11px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  width: 100%;
}

.history-item-edit {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: #8aa392;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  flex-shrink: 0;
}

.history-item:hover .history-item-edit {
  opacity: 1;
}

.history-item-edit:hover {
  background: rgba(0,0,0,0.06);
  color: #2d4a3e;
}