/* 全站 ⌘K / Ctrl+K 极速搜索跳转命令面板样式（独立扩展层，零业务侵入） */

.command-palette-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border-radius: 100px !important;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.88);
  color: #1e293b;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    background-color 160ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 160ms cubic-bezier(0.22, 1, 0.36, 1),
    color 160ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 100ms cubic-bezier(0.32, 0.72, 0, 1),
    box-shadow 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.command-palette-trigger:hover {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.36);
  color: #1d4ed8;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.10);
}

.command-palette-trigger:active {
  transform: scale(0.975);
}

.command-palette-trigger:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.command-palette-trigger__icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.command-palette-trigger__kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(241, 245, 249, 0.95);
  color: #475569;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.command-palette-trigger:hover .command-palette-trigger__kbd {
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(219, 234, 254, 0.85);
  color: #1e40af;
}

@media (max-width: 1180px) {
  .command-palette-trigger__label {
    display: none;
  }
  .command-palette-trigger {
    padding: 0 10px;
  }
}

/* 独立工具页无固定顶栏时的轻量胶囊入口 */
.command-palette-floating-trigger {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2100;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.14);
}

/* 命令面板遮罩与主体 */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 3600;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(11vh, 92px) 16px 24px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 1;
  transition: opacity 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

.cmdk-overlay[hidden] {
  display: none !important;
}

.cmdk-dialog {
  width: min(680px, 100%);
  max-height: min(76vh, 640px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #ffffff;
  color: #0f172a;
  box-shadow:
    0 24px 60px -12px rgba(15, 23, 42, 0.26),
    0 4px 16px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  animation: cmdkDialogEnter 165ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes cmdkDialogEnter {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.cmdk-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
}

.cmdk-search-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #2563eb;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.1;
}

.cmdk-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  color: #0f172a;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}

.cmdk-input::placeholder {
  color: #64748b;
}

.cmdk-clear-btn,
.cmdk-esc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #ffffff;
  color: #475569;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.cmdk-clear-btn:hover,
.cmdk-esc-btn:hover {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.36);
  color: #1d4ed8;
}

.cmdk-scopes {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  background: #ffffff;
  overflow-x: auto;
}

.cmdk-scope-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px !important;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.cmdk-scope-btn:hover {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.30);
  color: #1d4ed8;
}

.cmdk-scope-btn.is-active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

.cmdk-results {
  flex: 1;
  min-height: 160px;
  overflow-y: auto;
  padding: 8px 10px 10px;
  overscroll-behavior: contain;
}

.cmdk-group-label {
  padding: 8px 10px 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cmdk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: #0f172a;
  cursor: pointer;
  transition: background-color 110ms ease, border-color 110ms ease;
}

.cmdk-item:hover,
.cmdk-item.is-selected {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.24);
}

.cmdk-item__main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.cmdk-item__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  background: #e0e7ff;
  color: #1e3a8a;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.cmdk-item__badge.is-page {
  background: #dcfce7;
  color: #14532d;
}

.cmdk-item__badge.is-tool {
  background: #fef3c7;
  color: #78350f;
}

.cmdk-item__titles {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.cmdk-item__title {
  font-size: 13.5px;
  font-weight: 650;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmdk-item__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: #1d4ed8;
  font-variant-numeric: tabular-nums;
}

.cmdk-item__sub {
  font-size: 12px;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmdk-item__actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.cmdk-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 9px;
  border-radius: 7px !important;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #ffffff;
  color: #1e293b;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.cmdk-action-btn:hover {
  background: #dbeafe;
  border-color: rgba(37, 99, 235, 0.42);
  color: #1e40af;
}

.cmdk-action-btn.is-primary {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

.cmdk-action-btn.is-primary:hover {
  background: #1e40af;
  border-color: #1e40af;
  color: #ffffff;
}

.cmdk-action-btn.is-fav-active {
  background: #fef3c7;
  border-color: #d97706;
  color: #92400e;
}

.cmdk-empty {
  padding: 36px 20px;
  text-align: center;
  color: #475569;
  font-size: 13.5px;
}

.cmdk-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 16px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  color: #475569;
  font-size: 11.5px;
}

.cmdk-footer__hints {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.cmdk-footer__hints span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cmdk-footer kbd {
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  background: #ffffff;
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 600;
}

/* 深色模式高对比度适配（严格 >= 5.5:1 对比度，零亮底残留） */
html[data-table-theme='dark'] .command-palette-trigger,
html.dark .command-palette-trigger {
  background: #151e34 !important;
  border-color: rgba(148, 163, 184, 0.26) !important;
  color: #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

html[data-table-theme='dark'] .command-palette-trigger:hover,
html.dark .command-palette-trigger:hover {
  background: #1e293b !important;
  border-color: rgba(56, 189, 248, 0.50) !important;
  color: #bae6fd !important;
}

html[data-table-theme='dark'] .command-palette-trigger__kbd,
html.dark .command-palette-trigger__kbd {
  background: #0f172a !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: #cbd5e1 !important;
}

html[data-table-theme='dark'] .cmdk-overlay,
html.dark .cmdk-overlay {
  background: rgba(2, 6, 23, 0.68);
}

html[data-table-theme='dark'] .cmdk-dialog,
html.dark .cmdk-dialog {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.22);
  color: #f1f5f9;
  box-shadow: 0 28px 68px rgba(0, 0, 0, 0.65);
}

html[data-table-theme='dark'] .cmdk-search-bar,
html.dark .cmdk-search-bar {
  background: #121827;
  border-bottom-color: rgba(148, 163, 184, 0.14);
}

html[data-table-theme='dark'] .cmdk-search-icon,
html.dark .cmdk-search-icon {
  color: #38bdf8;
}

html[data-table-theme='dark'] .cmdk-input,
html.dark .cmdk-input {
  color: #f8fafc;
}

html[data-table-theme='dark'] .cmdk-input::placeholder,
html.dark .cmdk-input::placeholder {
  color: #94a3b8;
}

html[data-table-theme='dark'] .cmdk-clear-btn,
html[data-table-theme='dark'] .cmdk-esc-btn,
html.dark .cmdk-clear-btn,
html.dark .cmdk-esc-btn {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.26);
  color: #e2e8f0;
}

html[data-table-theme='dark'] .cmdk-clear-btn:hover,
html[data-table-theme='dark'] .cmdk-esc-btn:hover,
html.dark .cmdk-clear-btn:hover,
html.dark .cmdk-esc-btn:hover {
  background: #1e3a5f;
  border-color: rgba(56, 189, 248, 0.45);
  color: #e0f2fe;
}

html[data-table-theme='dark'] .cmdk-scopes,
html.dark .cmdk-scopes {
  background: #0f172a;
  border-bottom-color: rgba(148, 163, 184, 0.12);
}

html[data-table-theme='dark'] .cmdk-scope-btn,
html.dark .cmdk-scope-btn {
  background: #151e34;
  border-color: rgba(148, 163, 184, 0.20);
  color: #cbd5e1;
}

html[data-table-theme='dark'] .cmdk-scope-btn:hover,
html.dark .cmdk-scope-btn:hover {
  background: #1e293b;
  border-color: rgba(56, 189, 248, 0.42);
  color: #f1f5f9;
}

html[data-table-theme='dark'] .cmdk-scope-btn.is-active,
html.dark .cmdk-scope-btn.is-active {
  background: #0369a1;
  border-color: #38bdf8;
  color: #f8fafc;
}

html[data-table-theme='dark'] .cmdk-group-label,
html.dark .cmdk-group-label {
  color: #94a3b8;
}

html[data-table-theme='dark'] .cmdk-item,
html.dark .cmdk-item {
  color: #f1f5f9;
}

html[data-table-theme='dark'] .cmdk-item:hover,
html[data-table-theme='dark'] .cmdk-item.is-selected,
html.dark .cmdk-item:hover,
html.dark .cmdk-item.is-selected {
  background: #172554;
  border-color: rgba(56, 189, 248, 0.36);
}

html[data-table-theme='dark'] .cmdk-item__badge,
html.dark .cmdk-item__badge {
  background: #1e3a8a;
  color: #dbeafe;
}

html[data-table-theme='dark'] .cmdk-item__badge.is-page,
html.dark .cmdk-item__badge.is-page {
  background: #14532d;
  color: #dcfce7;
}

html[data-table-theme='dark'] .cmdk-item__badge.is-tool,
html.dark .cmdk-item__badge.is-tool {
  background: #78350f;
  color: #fef3c7;
}

html[data-table-theme='dark'] .cmdk-item__title,
html.dark .cmdk-item__title {
  color: #f8fafc;
}

html[data-table-theme='dark'] .cmdk-item__code,
html.dark .cmdk-item__code {
  color: #7dd3fc;
}

html[data-table-theme='dark'] .cmdk-item__sub,
html.dark .cmdk-item__sub {
  color: #cbd5e1;
}

html[data-table-theme='dark'] .cmdk-action-btn,
html.dark .cmdk-action-btn {
  background: #151e34;
  border-color: rgba(148, 163, 184, 0.26);
  color: #e2e8f0;
}

html[data-table-theme='dark'] .cmdk-action-btn:hover,
html.dark .cmdk-action-btn:hover {
  background: #1e3a8a;
  border-color: #60a5fa;
  color: #eff6ff;
}

html[data-table-theme='dark'] .cmdk-action-btn.is-primary,
html.dark .cmdk-action-btn.is-primary {
  background: #0369a1;
  border-color: #38bdf8;
  color: #f8fafc;
}

html[data-table-theme='dark'] .cmdk-action-btn.is-fav-active,
html.dark .cmdk-action-btn.is-fav-active {
  background: #78350f;
  border-color: #f59e0b;
  color: #fef3c7;
}

html[data-table-theme='dark'] .cmdk-empty,
html.dark .cmdk-empty {
  color: #cbd5e1;
}

html[data-table-theme='dark'] .cmdk-footer,
html.dark .cmdk-footer {
  background: #121827;
  border-top-color: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}

html[data-table-theme='dark'] .cmdk-footer kbd,
html.dark .cmdk-footer kbd {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
}

/* 全局共用 K 线图搜索框旁股票持仓 / 股票盈亏 / 股票盈亏率组件样式 */
:where(.technical-current-holding) {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  gap: 10px;
  padding: 2px 10px;
  border: 1px solid #dbe4ef;
  border-radius: 9px;
  background: #f8fafc;
  white-space: nowrap;
  box-sizing: border-box;
}

.technical-current-holding[hidden] {
  display: none !important;
}

:where(.technical-current-holding) .technical-trade-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  line-height: 1.15;
}

:where(.technical-current-holding) .technical-trade-stat span {
  display: block;
  color: #64748b;
  font-size: 10.5px;
  font-weight: 600;
}

:where(.technical-current-holding) .technical-trade-stat strong {
  display: block;
  margin-top: 1px;
  color: #1e293b;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

:where(.technical-current-holding) .technical-trade-stat.is-profit strong {
  color: #c62828;
}

:where(.technical-current-holding) .technical-trade-stat.is-loss strong {
  color: #16845b;
}

html[data-table-theme='dark'] :where(.technical-current-holding),
html.dark :where(.technical-current-holding) {
  background: rgba(21, 30, 52, 0.86);
  border-color: rgba(148, 163, 184, 0.2);
}

html[data-table-theme='dark'] :where(.technical-current-holding) .technical-trade-stat span,
html.dark :where(.technical-current-holding) .technical-trade-stat span {
  color: #94a3b8;
}

html[data-table-theme='dark'] :where(.technical-current-holding) .technical-trade-stat strong,
html.dark :where(.technical-current-holding) .technical-trade-stat strong {
  color: #f1f5f9;
}

html[data-table-theme='dark'] :where(.technical-current-holding) .technical-trade-stat.is-profit strong,
html.dark :where(.technical-current-holding) .technical-trade-stat.is-profit strong {
  color: #f87171;
}

html[data-table-theme='dark'] :where(.technical-current-holding) .technical-trade-stat.is-loss strong,
html.dark :where(.technical-current-holding) .technical-trade-stat.is-loss strong {
  color: #34d399;
}

