/* 创建/更新 API 密钥抽屉：贴近小鲸布局，并修正 html zoom 对 fixed 侧栏的偏移 */
[data-slot="sheet-content"]:has(#wk-key-routing) {
  width: 28rem !important;
  max-width: min(28rem, 100vw) !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  height: 100vh !important;
  max-height: 100vh !important;
  transform: none !important;
}

#wk-key-routing {
  margin: 0.25rem 0 0;
  padding: 0;
  border: 0;
  background: transparent;
}
#wk-key-routing .wk-route-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 8px;
}
#wk-key-routing .wk-route-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#wk-key-routing .wk-route-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
}
#wk-key-routing .wk-route-option.is-checked {
  border-color: #3b82f6;
  background: color-mix(in srgb, #3b82f6 8%, transparent);
  box-shadow: inset 0 0 0 1px #3b82f6;
}
#wk-key-routing .wk-route-option.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
#wk-key-routing .wk-route-option input {
  margin-top: 3px;
  accent-color: #3b82f6;
  flex: none;
}
#wk-key-routing .wk-route-option strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
#wk-key-routing .wk-route-option .wk-route-desc {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.45;
  opacity: 0.75;
  font-weight: 400;
}
#wk-key-routing .wk-route-hint {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: #92400e;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}
#wk-key-routing .wk-route-hint[hidden] {
  display: none;
}


/* 厂商路由时隐藏原生「分组」下拉，但保留「自动分组顺序」列表 */
[data-slot="sheet-content"]:has(#wk-key-routing) [data-wk-group-block],
[data-slot="dialog-content"]:has(#wk-key-routing) [data-wk-group-block],
[role="dialog"]:has(#wk-key-routing) [data-wk-group-block] {
  display: none !important;
}
/* 创建密钥时锁定「恢复全局 Auto / 添加 Auto 分组」，避免改回混合全局列表 */
[data-wk-vendor-lock="1"] {
  display: none !important;
}
/* API 密钥列表：表格不撑出可视区域，空状态在可见范围内居中 */
html[data-wk-page="keys"] table {
  width: 100% !important;
  min-width: 100% !important;
}
html[data-wk-page="keys"] td[data-wk-empty="1"] > *,
html[data-wk-page="keys"] [data-slot="empty"] {
  position: sticky;
  left: 0;
  box-sizing: border-box;
  width: var(--wk-table-view, 100%);
  max-width: var(--wk-table-view, 100%);
}

#wk-key-routing .wk-route-order {
  margin-top: 10px;
}
#wk-key-routing .wk-route-order[hidden] {
  display: none;
}
#wk-key-routing .wk-route-order-title {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--semi-color-text-2, #646a73);
}
#wk-key-routing .wk-route-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#wk-key-routing .wk-route-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 4px;
  border-radius: 999px;
  background: var(--semi-color-fill-0, #f5f6f7);
  font-size: 12px;
  line-height: 1.4;
  color: var(--semi-color-text-0, #1f2329);
}
#wk-key-routing .wk-route-chip i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #edf4ff;
  color: #2b6de5;
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
}
#wk-key-routing .wk-route-chip em {
  font-style: normal;
  color: #2b6de5;
  font-weight: 600;
}

[data-wk-vendor-hidden-chip="1"] {
  display: none !important;
}

/* 用我们自己的厂商列表替换库存 Auto 芯片，避免驱动 React onChange */
[data-wk-auto-replaced="1"] > *:not(#wk-vendor-auto-list) {
  display: none !important;
}
#wk-vendor-auto-list {
  display: block !important;
  margin-top: 0;
}
