/* 聚星 · 在线对话 —— 视觉沿用桌面版（同一套配色变量） */

* { box-sizing: border-box; }

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e8ebf0;
  --line-soft: #eef1f5;
  --text: #1f2430;
  --muted: #8a93a3;
  --brand: #10b3a3;
  --brand-dark: #0d9d8f;
  --brand-weak: #e6f7f3;
  --warn-bg: #fdf5dd;
  --warn-ink: #8a6a2f;
  --danger: #d9534f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 50, 0.04);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: grid;
  grid-template-columns: 268px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ---------------------------------------------------------------- 渚ф爮 */

.side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.brand { display: flex; align-items: center; gap: 8px; padding: 2px 4px 6px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.brand-name { font-weight: 600; font-size: 15px; }

.new-btn { width: 100%; }
.search-wrap { padding: 0 2px; }

.input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.15s var(--ease);
}
.input:focus { border-color: var(--brand); }

.sess-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }

.sess {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
}
.sess:hover { background: var(--line-soft); }
.sess.active { background: var(--brand-weak); border-color: #cdeee8; }
.sess-body { flex: 1; min-width: 0; }
.sess-title {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sess-meta { display: block; font-size: 11px; color: var(--muted); }
.sess-more {
  border: 0; background: none; color: var(--muted);
  cursor: pointer; padding: 0 4px; opacity: 0; font-size: 16px; line-height: 1;
}
.sess:hover .sess-more, .sess.menu-open .sess-more { opacity: 1; }

.sess-menu {
  position: absolute;
  right: 6px; top: 34px;
  z-index: 20;
  min-width: 140px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20, 30, 50, 0.12);
}
.sess-menu button {
  display: block;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.sess-menu button:hover { background: var(--line-soft); }
.sess-menu button.danger { color: var(--danger); }

.empty-hint { padding: 18px 8px; color: var(--muted); font-size: 12px; text-align: center; }

.side-foot {
  display: flex; flex-direction: column; gap: 6px;
  padding-top: 10px; border-top: 1px solid var(--line);
}
.foot-status { font-size: 11px; color: var(--muted); padding-left: 2px; }
.foot-status.bad { color: var(--danger); }
.foot-status.ok { color: var(--brand-dark); }

/* ---------------------------------------------------------------- 主区 */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.tb-title { flex: 1; min-width: 0; }
.tb-title h1 { margin: 0; font-size: 15px; }
.tb-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.tb-actions { display: flex; align-items: center; gap: 8px; }

.pick { display: flex; align-items: center; gap: 6px; }
.pick-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pick .input {
  /* 要装得下「通义千问 · 15」，96px 会截断成「Claude （1」 */
  width: 136px;
  padding: 6px 8px;
  font-size: 13px;
  cursor: pointer;
}

.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.model-pill:disabled { opacity: 0.55; cursor: default; }
.model-pill:hover:not(:disabled) { border-color: var(--brand); }
.mp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-caret { color: var(--muted); font-size: 11px; }

.notice {
  margin: 10px 20px 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 13px;
}
.notice.err { background: #fdecea; color: #a12e2a; }

/* 模型下拉 */

.model-pop {
  position: absolute;
  right: 20px;
  top: 58px;
  z-index: 30;
  width: 340px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(20, 30, 50, 0.14);
}
.model-pop-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 8px; font-size: 12px; color: var(--muted);
}
.model-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 8px 9px;
  border: 0; border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit; font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.model-item:hover { background: var(--line-soft); }
.model-item.cur { background: var(--brand-weak); }
.mi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-tag {
  padding: 1px 6px; border-radius: 999px;
  background: var(--brand-weak); color: var(--brand-dark);
  font-size: 11px;
}

/* 消息区 */

.msgs-wrap { position: relative; flex: 1; overflow: hidden; }
.msgs {
  height: 100%;
  overflow-y: auto;
  padding: 16px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* align-items 必须是 flex-start：少了它，头像会被拉伸成大椭圆，整行也跟着变高 */
.line { display: flex; gap: 10px; align-items: flex-start; padding: 0; }
.line.me { justify-content: flex-end; }
.line.me .col { align-items: flex-end; }

.av {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 12px; font-weight: 600;
  user-select: none;
  /* 头像始终有可见的圆底：不依赖 :has()，图标万一没渲染也不会是一块空白 */
  background: var(--line-soft);
  border: 1px solid var(--line);
  color: var(--muted);
}
.av.me { background: var(--line); color: #5b6675; border-color: #dde3ea; }
.av.ai { background: var(--panel); color: var(--brand-dark); border-color: var(--line); }

.col { min-width: 0; max-width: min(860px, 86%); display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }

.bub {
  padding: 11px 14px;
  border-radius: 14px;
  border-top-left-radius: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.72;
  color: #2b3644;
  box-shadow: 0 1px 2px rgba(24, 39, 56, 0.04);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.line.me .bub {
  background: var(--brand-weak);
  border-color: #cdeee8;
  border-top-left-radius: 14px;
  border-top-right-radius: 4px;
}
.text:empty { display: none; }

.meta {
  display: flex; align-items: center; gap: 8px;
  margin: 0;
  font-size: 11.5px; line-height: 1;
  color: var(--muted);
}
.line.me .meta { justify-content: flex-end; }

.jump {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font: inherit; font-size: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
}
.empty-orb {
  width: 52px; height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--brand-weak);
}
.empty-title { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.empty-sub { font-size: 13px; }

.name { color: var(--text); font-weight: 500; }
.copy {
  border: 0; background: none;
  color: var(--muted); font-size: 11px;
  cursor: pointer; padding: 0;
  opacity: 0;
}
.line:hover .copy { opacity: 1; }
.copy:hover { color: var(--brand-dark); }
.live { color: var(--brand-dark); }

/* 浠ｇ爜鍧?*/

.codewrap {
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fbfcfd;
}
.codebar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 11px; color: var(--muted);
}
.codecopy { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 11px; }
.codecopy:hover { color: var(--brand-dark); }
pre.code {
  margin: 0;
  padding: 10px 12px;
  overflow-x: auto;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre;
}

/* 打字光标与等待点 */

.caret {
  display: inline-block;
  width: 2px; height: 1em;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--brand);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.dots { display: inline-flex; gap: 4px; padding: 2px 0; }
.dots i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.35;
  animation: bounce 1.1s infinite;
}
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* 附件小图 */

.imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.imgs img {
  max-width: 220px;
  max-height: 220px;
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}

/* ---------------------------------------------------------------- 杈撳叆鍖?*/

.composer {
  position: relative;
  margin: 0 20px 16px;
  padding: 10px 12px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.composer.dragging { border-color: var(--brand); background: var(--brand-weak); }
.drop-hint {
  display: none;
  position: absolute; inset: 0;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(230, 247, 243, 0.92);
  color: var(--brand-dark);
  font-size: 13px;
  pointer-events: none;
}
.composer.dragging .drop-hint { display: grid; }

.files { display: flex; flex-wrap: wrap; gap: 6px; }
.files:empty { display: none; }
.file {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 6px 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--line-soft);
  font-size: 12px;
  max-width: 240px;
}
.file .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .fx { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; }

#input {
  display: block;
  width: 100%;
  max-height: 132px;
  padding: 6px 2px;
  border: 0;
  resize: none;
  background: none;
  color: var(--text);
  font: inherit;
  outline: none;
  overflow-y: hidden;
}
#input::placeholder { color: var(--muted); }

.composer-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 4px;
}
.hint { font-size: 11px; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 8px; }

.attach {
  border: 0; background: none;
  font-size: 16px; line-height: 1;
  cursor: pointer; opacity: 0.7;
}
.attach:hover { opacity: 1; }

.send-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: 0; border-radius: 50%;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.send-btn svg { width: 16px; height: 16px; }
.send-btn:hover:not(:disabled) { background: var(--brand-dark); }
.send-btn:disabled { opacity: 0.4; cursor: default; }
.send-btn.stop { background: var(--danger); }
.send-btn.stop svg { display: none; }
.send-btn.stop::after { content: "\25A0"; font-size: 12px; }

/* ---------------------------------------------------------------- 寮圭獥 */

.dlg {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(20, 30, 50, 0.2);
}
.dlg::backdrop { background: rgba(20, 30, 50, 0.35); }
.dlg-inner { padding: 20px; }
.dlg h2 { margin: 0 0 6px; font-size: 16px; }
.dlg-desc { margin: 0 0 16px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; margin-bottom: 5px; font-size: 12px; color: var(--muted); }
.field .input[readonly] { background: var(--line-soft); color: var(--muted); }
.dlg-msg { min-height: 18px; font-size: 12px; margin-bottom: 8px; }
.dlg-msg.ok { color: var(--brand-dark); }
.dlg-msg.bad { color: var(--danger); }
.dlg-actions { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- 鎸夐挳 */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.btn:hover { border-color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------------------------------------------------------------- 绐勫睆 */

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: 268px;
    transform: translateX(-100%);
    transition: transform 0.22s var(--ease);
    box-shadow: 0 0 40px rgba(20, 30, 50, 0.18);
  }
  .side.open { transform: none; }
  .col { max-width: 88%; }
  .tb-actions .pick, .tb-actions #btn-refresh { display: none; }
}

/* ---------------------------------------------------------------- 厂商图标 */

.mi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 0;
}
.mi svg { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; }
.mi.sm, .mi-sm { width: 16px; height: 16px; }
.mi.md, .mi-md { width: 22px; height: 22px; }
.mi.lg, .mi-lg { width: 30px; height: 30px; }

/* 头像里的图标：给足尺寸，确保看得见。不要再把背景设成透明 —— 那会让整块头像消失 */
.av .mi { width: 20px; height: 20px; }
.av .mi svg { width: 20px; height: 20px; }
.av .mi svg { overflow: visible; }

/* 厂商下拉带图标时对齐 */
#vendor { padding-left: 8px; }



/* 消息条上的缓存标记：只在真读到缓存时才出现 */


/* side-toggle : 窄屏下打开会话列表的按钮 */
.side-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.side-toggle:hover { border-color: var(--brand); }

/* 侧栏遮罩：点空白处收起 */
.side-mask {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(20, 30, 50, 0.28);
}
.side-mask.show { display: block; }

/* 顶栏的密钥按钮：始终可见，不受侧栏影响 */
.key-btn { flex: 0 0 auto; }

/* 弹窗底部显示当前生效的密钥尾号 */
.dlg-tip {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* 成功提示用绿色 */
.notice.ok { background: var(--brand-weak); color: var(--brand-dark); }

@media (max-width: 760px) {
  .side-toggle { display: inline-flex; }
  /* 窄屏也不藏密钥按钮，否则改不了密钥 */
  .tb-actions .key-btn { display: inline-flex; }
}


/* polish-1 : 提示条可关闭 */
.notice[hidden] { display: none; }
.notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.notice-text { flex: 1; min-width: 0; word-break: break-word; }
.notice-x {
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.55;
  font-size: 12px;
  line-height: 1.6;
  padding: 0 2px;
  cursor: pointer;
}
.notice-x:hover { opacity: 1; }

/* polish-1 : 空状态的引导按钮 */
.empty-cta { margin-top: 14px; }

/* polish-1 : 模型搜索框 */
.model-pop-search { padding: 4px 6px 6px; }
.model-pop-search .input { padding: 6px 9px; font-size: 12px; }
.mi-check { color: var(--brand-dark); font-size: 12px; }

/* polish-1 : 附件缩略图 */
.file.img { padding: 3px 6px 3px 3px; }
.fthumb {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.fico { font-size: 13px; line-height: 1; }
.fsize { color: var(--muted); font-size: 11px; }

/* polish-1 : 滚动条 */
.msgs::-webkit-scrollbar,
.side .sess-list::-webkit-scrollbar,
.model-pop::-webkit-scrollbar { width: 8px; }
.msgs::-webkit-scrollbar-thumb,
.side .sess-list::-webkit-scrollbar-thumb,
.model-pop::-webkit-scrollbar-thumb {
  background: #d9dfe7;
  border-radius: 4px;
}
.msgs::-webkit-scrollbar-thumb:hover,
.side .sess-list::-webkit-scrollbar-thumb:hover,
.model-pop::-webkit-scrollbar-thumb:hover { background: #c3ccd7; }
.msgs::-webkit-scrollbar-track,
.side .sess-list::-webkit-scrollbar-track,
.model-pop::-webkit-scrollbar-track { background: transparent; }

/* polish-2 : ☰ 只在窄屏出现（JS 按实际宽度加 .narrow，比媒体查询可靠） */
body.narrow .side-toggle { display: inline-flex; }
/* 窄屏时顶栏不挤：厂商选择器和刷新按钮收进菜单 */
body.narrow .tb-actions .pick,
body.narrow .tb-actions #btn-refresh { display: none; }

/* polish-2 : 侧栏底部 */
.side-foot {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.side-foot .btn { width: 100%; }
.foot-status {
  font-size: 11px;
  color: var(--muted);
  padding-left: 1px;
  font-variant-numeric: tabular-nums;
}



/* polish-3 : 模型胶囊里的厂商图标 */
.mp-ico { display: inline-flex; flex: 0 0 auto; }
.mp-ico .mi { width: 15px; height: 15px; }
.mp-ico:empty { display: none; }

/* polish-3 : 侧栏底部的密钥状态（图标 + 尾号） */
.foot-key {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px 2px;
}
.fk-text {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fk-text.bad { color: var(--danger); }
.fk-text.ok { color: var(--brand-dark); }

/* polish-3 : 图标按钮（刷新 / 密钥） */
.icon-btn {
  padding: 0;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}
.icon-btn svg {
  width: 15px;
  height: 15px;
  display: block;
  fill: currentColor;
}
.icon-btn:hover { background: var(--line-soft); }

/* polish-3 : 空状态里的厂商图标 */
.empty-orb {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--brand-weak);
  border: 1px solid #cdeee8;
  display: grid;
  place-items: center;
}
.empty-orb .mi { width: 28px; height: 28px; }

/* polish-3 : 按钮统一样式，去掉质朴感 */
.btn {
  min-height: 32px;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
    color 0.15s var(--ease), transform 0.06s var(--ease);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-ghost { border-color: var(--line); }
.btn-ghost:hover {
  background: var(--line-soft);
  border-color: #d8dfe8;
  color: var(--text);
}
.btn-primary {
  box-shadow: 0 1px 2px rgba(16, 179, 163, 0.28);
}
.btn-primary:hover { box-shadow: 0 2px 6px rgba(16, 179, 163, 0.3); }

/* polish-3 : 会话项选中态更清楚 */
.sess.active { box-shadow: inset 2px 0 0 var(--brand); }

/* polish-3 : 窄屏也要能看到厂商图标 */


/* polish-4 : 对话里的图片缩略图 */
.msg-imgs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.msg-imgs:empty { display: none; }
.msg-img {
  display: block;
  max-width: 220px;
  max-height: 180px;
  width: auto;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  background: var(--line-soft);
}
.msg-img:hover { border-color: var(--brand); }

/* 只有图片、没有文字时，气泡不要留多余的内边距空白 */
.bub > .msg-imgs:first-child { margin-top: 0; }


/* polish-5 : 思考中的气泡 —— 不要大白框，做轻量指示器 */
.bub.thinking {
  padding: 7px 12px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
/* 气泡内只剩纯文本时，避免 pre-wrap 把首尾空白也渲染出来 */
.bub.thinking .dots { display: inline-flex; }


/* polish-6 : 弹窗里的字段提示 */
.field-hint {
  margin-left: 6px;
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}

/* polish-6 : 已保存的密钥列表 */
.key-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 168px;
  overflow-y: auto;
  margin-bottom: 2px;
}
.key-empty {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.key-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.key-item:hover { border-color: #cdd6e0; background: var(--line-soft); }
.key-item.active {
  border-color: #cdeee8;
  background: var(--brand-weak);
}

.ki-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
  border: 1px solid #d8dfe8;
}
.key-item.active .ki-dot {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(16, 179, 163, 0.14);
}

.ki-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ki-mask {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ki-name {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ki-tag {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 10.5px;
}
.ki-del {
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  padding: 2px 3px;
  opacity: 0;
  cursor: pointer;
}
.key-item:hover .ki-del { opacity: 0.6; }
.ki-del:hover { opacity: 1; color: var(--danger); }

/* polish-6 : 侧栏底部两行 */
.foot-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.foot-row .fk-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.foot-store {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 2px;
  font-size: 11px;
  color: var(--muted);
}
.fs-label { flex: 0 0 auto; }
.fs-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.foot-link {
  flex: 0 0 auto;
  border: 0;
  background: none;
  padding: 0;
  color: var(--brand-dark);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.foot-link:hover { text-decoration: underline; }
.foot-link.danger { color: var(--muted); }
.foot-link.danger:hover { color: var(--danger); }


/* polish-7 : 密钥列表里的厂商图标 */
.ki-vendors {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.ki-vendors.empty { color: var(--muted); font-size: 11px; }
.ki-v {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  opacity: 0.85;
}
.ki-v .mi { width: 15px; height: 15px; }
.key-item.active .ki-v { opacity: 1; }
