/* ============================================================
   左侧组件库美化（所有主题通用，最后加载）
   ============================================================ */

/* ---- 面板头 ---- */
.palette-head { position: relative; }
.palette-head .ph-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.palette-head .ph-icon {
  width: 18px; height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(120, 110, 200, 0.14);
  color: #8a5bd6;
}
.palette-head .ph-badge {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(120, 110, 200, 0.10);
  color: #8b86a8;
  letter-spacing: 0;
}
.palette-search-wrap { position: relative; margin-top: 9px; }
.palette-search-wrap .search-icon {
  position: absolute;
  left: 9px; top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #a29dc0;
  pointer-events: none;
}
.palette-search-wrap .palette-search { padding-left: 26px; width: 100%; }

/* ---- 分组头 ---- */
.palette-group-title {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 2px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  border-radius: 6px;
}
.palette-group-title::before { content: none !important; }
.palette-group-title .group-glyph {
  width: 18px; height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 10px;
  color: #ffffff;
  background: var(--cat, #8b86a8);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.14);
  flex-shrink: 0;
}
.palette-group-title .group-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-group-title .group-count {
  font-size: 9px;
  font-weight: 600;
  color: #9a94bb;
  background: rgba(120, 110, 200, 0.10);
  border-radius: 999px;
  padding: 1px 6px;
  flex-shrink: 0;
}

/* ---- 模块卡片 ---- */
.palette-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
.tile {
  position: relative;
  padding: 8px 9px 7px;
  border-radius: 10px;
  border-left: 3px solid var(--cat, #b9b3d6) !important;
  overflow: hidden;
}
.tile .tile-top { display: flex; align-items: center; gap: 5px; }
.tile .tile-icon {
  width: 17px; height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-size: 9.5px;
  background: var(--cat, #8b86a8);
  color: #ffffff;
  flex-shrink: 0;
  opacity: 0.92;
}
.tile .tile-name {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile .tile-add {
  margin-left: auto;
  width: 15px; height: 15px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  background: rgba(120, 110, 200, 0.12);
  color: #8a5bd6;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.14s, transform 0.14s;
}
.tile:hover .tile-add { opacity: 1; transform: scale(1); }
.tile .tile-short {
  margin-top: 4px;
  font-size: 9px;
  letter-spacing: 0;
  font-family: "JetBrains Mono", Consolas, monospace;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- 连接工具卡片：迷你连线预览 ---- */
.tile-link { padding: 9px 10px 8px; }
.tile-link .tile-icon { background: var(--cat, #1a73c9); }
.link-preview {
  position: relative;
  height: 14px;
  margin: 3px 0 2px;
}
.link-preview::before {
  content: "";
  position: absolute;
  left: 2px; right: 12px;
  top: 50%;
  height: 2px;
  border-radius: 2px;
  background: #4b4b4b;
  transform: translateY(-50%);
}
.link-preview::after {
  content: "›";
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-55%);
  font-size: 15px;
  line-height: 1;
  color: #4b4b4b;
  font-weight: 700;
}
.tile-link.skip .link-preview::before { background: #e08b2c; }
.tile-link.skip .link-preview::after { color: #e08b2c; }
.tile-link.skip .link-preview .plus {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -52%);
  font-size: 9px;
  line-height: 1;
  color: #e08b2c;
  background: #ffffff;
  border: 1px solid #f0c08a;
  border-radius: 999px;
  padding: 1px 3px;
  font-weight: 700;
}
.tile-link.normal .link-preview .plus { display: none; }

/* ---- 底部操作提示 ---- */
.palette-tip {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 11px 13px 13px;
  font-size: 10px;
  line-height: 1.45;
}
.palette-tip .tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #8b86a8;
  min-height: 18px;
}
.palette-tip .tip-row span:last-child {
  flex: 1;
  line-height: 1.35;
}
.palette-tip .tip-key {
  flex-shrink: 0;
  min-width: 22px;
  text-align: center;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 700;
  background: rgba(120, 110, 200, 0.12);
  color: #8a5bd6;
  letter-spacing: 0;
}
.palette-tip b { color: #55507a; font-weight: 700; }

/* ---- Visio 主题适配 ---- */
.theme-visio .palette-head .ph-icon { background: #e5f1fb; color: #1a73c9; border-radius: 3px; }
.theme-visio .palette-head .ph-badge { background: #e5f1fb; color: #1a73c9; border-radius: 2px; }
.theme-visio .palette-group-title .group-count { background: #f0f0f0; color: #737373; border-radius: 2px; }
.theme-visio .palette-group-title .group-glyph { border-radius: 3px; box-shadow: none; }
.theme-visio .tile { border-radius: 3px; border-left-width: 3px !important; }
.theme-visio .tile .tile-icon { border-radius: 3px; }
.theme-visio .tile .tile-add { background: #e5f1fb; color: #1a73c9; border-radius: 2px; }
.theme-visio .tile-link.normal .link-preview::before { background: #404040; }
.theme-visio .tile-link.normal .link-preview::after { color: #404040; }
.theme-visio .palette-tip .tip-key { background: #e5f1fb; color: #1a73c9; border-radius: 2px; }
.theme-visio .palette-tip b { color: #1a73c9; }
.theme-visio .palette-tip .tip-row { color: #737373; }

/* ---- 宇宙紫主题适配 ---- */
.theme-cosmic .palette-head .ph-icon { background: rgba(198, 249, 106, 0.14); color: #c6f96a; }
.theme-cosmic .palette-head .ph-badge { background: rgba(255, 255, 255, 0.06); color: #9d90c7; }
.theme-cosmic .palette-group-title .group-count { background: rgba(255, 255, 255, 0.06); color: #9d90c7; }
.theme-cosmic .tile .tile-add { background: rgba(198, 249, 106, 0.18); color: #c6f96a; }
.theme-cosmic .tile-link .link-preview::before { background: #cfc3f5; }
.theme-cosmic .tile-link .link-preview::after { color: #cfc3f5; }
.theme-cosmic .tile-link.skip .link-preview::before { background: #ffb066; }
.theme-cosmic .tile-link.skip .link-preview::after { color: #ffb066; }
.theme-cosmic .tile-link.skip .link-preview .plus { background: #efe8ff; border-color: #ffcf9e; color: #c26a12; }
.theme-cosmic .palette-tip .tip-row { color: #8d7fbd; }
.theme-cosmic .palette-tip .tip-key { background: rgba(198, 249, 106, 0.14); color: #c6f96a; }
.theme-cosmic .palette-tip b { color: #d6ff7a; }

/* ---- 糖果浅色主题适配 ---- */
.theme-light .palette-head .ph-icon { background: #f2edff; color: #8a5bd6; }
.theme-light .palette-head .ph-badge { background: #f7f3ff; color: #8b86a8; }
.theme-light .palette-group-title .group-count { background: #f7f3ff; color: #9a94bb; }
.theme-light .tile .tile-add { background: #f2edff; color: #8a5bd6; }
.theme-light .tile-link .link-preview::before { background: #6d6a8a; }
.theme-light .tile-link .link-preview::after { color: #6d6a8a; }
.theme-light .tile-link.skip .link-preview::before { background: #d9822b; }
.theme-light .tile-link.skip .link-preview::after { color: #d9822b; }
.theme-light .tile-link.skip .link-preview .plus { background: #ffffff; border-color: #f0c08a; color: #b35c00; }
.theme-light .palette-tip .tip-key { background: #f2edff; color: #8a5bd6; }
.theme-light .palette-tip b { color: #6a4bbf; }

/* ===== 收敛版：组件库保持简洁，不做花哨装饰 ===== */
.palette-group-title .group-glyph { display: none; }
.palette-group-title { gap: 6px; padding: 4px 2px; }
.palette-group-title .group-count { background: transparent; color: #9a94bb; font-weight: 500; }
.tile { border-left: 1px solid #e6e2f5 !important; padding: 7px 9px 6px; }
.tile .tile-icon { display: none; }
.tile .tile-add { display: none; }
.tile .tile-top { gap: 0; }
.tile .tile-name { font-weight: 600; }
.tile-link.normal,
.tile-link.skip { background: #ffffff; border-color: #e6e2f5; }
.tile-link .link-preview { display: none; }
.tile-link .tile-icon { display: none; }
.palette-tip { gap: 3px; padding: 10px 12px 12px; }
.palette-tip .tip-key { background: transparent; color: #9a94bb; font-weight: 600; min-width: 26px; padding: 0; }
.palette-search-wrap .search-icon { opacity: 0.55; }

/* Visio 主题下的收敛配色 */
.theme-visio .tile { border-left: 1px solid #e0e0e0 !important; border-radius: 3px; }
.theme-visio .tile-name { color: #262626; }
.theme-visio .tile .tile-short { color: #8c8c8c; }
.theme-visio .tile-link.normal,
.theme-visio .tile-link.skip { background: #ffffff; border-color: #e0e0e0; }
.theme-visio .tile-link .tile-short { color: #8c8c8c; }
.theme-visio .palette-group-title { color: #595959; }
.theme-visio .palette-group-title .group-count { color: #a6a6a6; }
.theme-visio .palette-tip .tip-key { background: transparent; color: #8c8c8c; }
.theme-visio .palette-tip .tip-row { color: #8c8c8c; }
.theme-visio .palette-tip b { color: #8c8c8c; }

/* 宇宙紫主题下也保持低调 */
.theme-cosmic .tile { border-left: 1px solid rgba(150,120,255,.18) !important; }
.theme-cosmic .tile .tile-add { display: none; }
.theme-cosmic .tile-link.normal,
.theme-cosmic .tile-link.skip { background: rgba(255,255,255,.045); border-color: rgba(150,120,255,.18); }
.theme-cosmic .palette-tip .tip-key { background: transparent; color: #8d7fbd; }
