/* B6 组合输入增强：命令/引用候选浮层与待发送引用卡片。
 * 全部使用现有主题变量，零构建；触控目标 >= 44px，键盘焦点可见；
 * 候选的显示不依赖 hover（触屏也能直接点按）。 */
.ct-menu {
  box-sizing: border-box;
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 6px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(52dvh, 420px);
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--dsr-line, #30363d);
  border-radius: 14px;
  background: var(--dsr-panel, #161b22);
  box-shadow: 0 14px 36px var(--dsr-shadow, rgba(0, 0, 0, .4));
}
.ct-menu[hidden],
.ct-menu.hidden { display: none !important; }

.ct-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 9px 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--dsr-text, #f0f6fc);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.ct-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ct-item-name {
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.ct-command .ct-item-name {
  color: var(--dsr-accent-strong, #79c0ff);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.ct-item-detail {
  font-size: 12px;
  line-height: 1.45;
  color: var(--dsr-muted, #a7b0bc);
  overflow-wrap: anywhere;
}
.ct-item-meta {
  font-size: 11px;
  line-height: 1.4;
  color: var(--dsr-text-disabled, #6e7681);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}
.ct-item.is-active { background: var(--dsr-accent-soft, rgba(88, 166, 255, .12)); box-shadow: inset 0 0 0 1px var(--dsr-accent-line, rgba(88, 166, 255, .4)); }
.ct-item:active { background: var(--dsr-accent-soft, rgba(88, 166, 255, .12)); }
.ct-item:focus-visible,
.ct-quote button:focus-visible { outline: 2px solid var(--dsr-accent, #58a6ff); outline-offset: 2px; }
@media (hover: hover) {
  .ct-item:hover { background: var(--dsr-accent-soft, rgba(88, 166, 255, .12)); }
}

/* 主机降级提示：默认隐藏，只在旧主机/暂时失败时出现，不阻塞输入与发送。 */
.ct-hint {
  margin: 0;
  padding: 6px 14px 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--dsr-muted, #a7b0bc);
}
.ct-hint[hidden],
.ct-hint.hidden { display: none !important; }
.ct-hint.ct-hint-error { color: var(--dsr-warning, #ff9e64); }

/* 待发送引用：横向滚动卡片，发送前可展开检查、可移除；不会自动发送。 */
.ct-quotes {
  display: flex;
  gap: 8px;
  padding: 8px 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ct-quotes::-webkit-scrollbar { display: none; }
.ct-quotes[hidden],
.ct-quotes.hidden { display: none !important; }
.ct-quote {
  flex: 0 0 min(78vw, 320px);
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--dsr-line, #30363d);
  border-left: 3px solid var(--dsr-info, #7dcfff);
  border-radius: 12px;
  background: var(--dsr-panel, #161b22);
  overflow-wrap: anywhere;
}
.ct-quote-head { display: flex; align-items: center; gap: 6px; }
.ct-quote-meta {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--dsr-muted, #a7b0bc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ct-quote button {
  flex: none;
  min-width: 44px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--dsr-line, #30363d);
  border-radius: 8px;
  background: var(--dsr-bg-2, var(--dsr-panel, #161b22));
  color: var(--dsr-text, #f0f6fc);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.ct-quote-inspect { color: var(--dsr-info, #7dcfff); }
.ct-quote-remove { color: var(--dsr-error, #ff8f6b); }
.ct-quote-preview {
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--dsr-text, #f0f6fc);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ct-quote-full {
  max-height: 28dvh;
  margin: 6px 0 0;
  padding: 8px;
  overflow: auto;
  border: 1px solid var(--dsr-line, #30363d);
  border-radius: 8px;
  background: var(--dsr-bg, #0d1117);
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ct-quote-full[hidden] { display: none !important; }
.ct-quote-truncated {
  display: block;
  margin-top: 6px;
  color: var(--dsr-muted, #a7b0bc);
  font-family: inherit;
  font-size: 11px;
  white-space: normal;
}

@media (max-width: 620px) {
  .ct-menu { left: 6px; right: 6px; max-height: min(50dvh, 360px); }
  .ct-item { min-height: 46px; padding: 10px; }
  .ct-quote { flex-basis: min(84vw, 320px); }
  .ct-quote button { min-height: 36px; }
}

/* 窄输入区也保证候选名称可换行，不横向溢出。 */
@container (max-width: 420px) {
  .ct-item-name { font-size: 13.5px; }
}

@media (prefers-reduced-motion: no-preference) {
  .ct-item { transition: background-color .12s ease; }
}
