/* ==========================================================================
   模型库（/model/browse）：左侧筛选栏 + 右侧列表 / 表格
   ========================================================================== */

/* 宽屏下与顶部导航同宽：导航内容区是 max-width 1540 + 24 左右内边距，
   这里用 1540 + 48 的盒宽复刻同一条内容线，避免列表铺满整块屏幕。 */
.model-openai-main.model-openai-main--wide {
  max-width: 1588px;
  margin-left: auto;
  margin-right: auto;
  /* 顶部留白收到 16px：面包屑→标题本来就只隔一行，28px 显得松 */
  padding-top: 16px;
}

/* 面包屑与标题之间收紧，避免首屏出现一块空档 */
.model-openai-main--wide .model-openai-breadcrumb {
  margin-bottom: 10px;
}

.mb-section {
  margin-top: 6px;
}

.mb-layout {
  display: grid;
  /* 左栏 248px：厂商两列网格每格约 115px，中文厂商名（如「阿里云百炼」）不会被迫省略 */
  grid-template-columns: 248px minmax(0, 1fr);
  column-gap: 30px;
  align-items: start;
}

/*
 * 右列（标题 + 工具条 + 列表）整体成列：标题与工具条间距由 .mb-pane 的 gap 控制。
 * 不能让筛选栏跨行（grid-row: 1 / span 2）——列表不足一页时，筛选栏的高度会把跨行的高度
 * 分摊给两行，导致「模型库」标题和工具条之间出现大片空白（2026-11-22 修复）。
 */
.mb-pane {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mb-head {
  margin-bottom: 0;
}

.mb-filters {
  grid-column: 1;
  grid-row: 1;
}

.mb-content {
  min-width: 0;
}

/* ------------------------------------------------------------ 左侧筛选 */

.mb-filters {
  position: sticky;
  top: 88px;
  align-self: start;
  display: flex;
  flex-direction: column;
  /*
   * 吸顶栏比视口还高时，超出部分会被粘住而永远滚不到（分类 + 厂商全展开约 1000px）。
   * 面板整体限高，只有分组区 .mb-filter-scroll 内部滚动，「清除筛选」固定在面板底部。
   */
  max-height: calc(100vh - 108px);
  overflow: hidden;
  padding: 2px 2px 8px;
}

.mb-filter-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: #d7dee9 transparent;
}

.mb-filter-scroll::-webkit-scrollbar {
  width: 8px;
}

.mb-filter-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.mb-filter-scroll::-webkit-scrollbar-thumb {
  background: #d7dee9;
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 99px;
}

.mb-filter-scroll::-webkit-scrollbar-thumb:hover {
  background: #b8c4d4;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.mb-filter-group {
  border-bottom: 1px solid #f1f5f9;
  padding: 6px 0 10px;
}

.mb-filter-group:last-of-type {
  border-bottom: 0;
}

.mb-filter-head {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #94a3b8;
  cursor: pointer;
}

.mb-filter-head:hover {
  color: #4338ca;
}

.mb-filter-chevron {
  font-size: 12px;
  line-height: 1;
  transition: transform .16s ease;
}

.mb-filter-group.is-collapsed .mb-filter-chevron {
  transform: rotate(-90deg);
}

.mb-filter-group.is-collapsed .mb-filter-body {
  display: none;
}

.mb-filter-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-top: 2px;
}

.mb-filter-item {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 14.5px;
  color: #475569;
  text-align: left;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}

.mb-filter-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mb-filter-item em {
  font-style: normal;
  font-size: 12.5px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.mb-filter-item:hover {
  background: #f5f7fc;
  color: #0f172a;
}

.mb-filter-item.is-active {
  background: #eef2ff;
  color: #4338ca;
  font-weight: 600;
}

.mb-filter-item.is-active em {
  color: #4338ca;
}

/* 分类 / 厂商共用：图标 + 文字，一行两个（2026-12-03 改版） */
.mb-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 4px;
  padding-top: 2px;
}

.mb-filter-grid-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: #475569;
  text-align: left;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, box-shadow .14s ease;
}

.mb-filter-grid-item:hover {
  background: #f5f7fc;
  color: #0f172a;
}

.mb-filter-grid-item input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
}

.mb-filter-grid-icon {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #7c8aa0;
  border-radius: 4px;
  object-fit: contain;
}

.mb-filter-grid-icon svg {
  width: 15px;
  height: 15px;
  display: block;
}

.mb-filter-grid-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mb-filter-grid-count {
  flex: 0 0 auto;
  font-style: normal;
  font-size: 11.5px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.mb-filter-grid-item.is-checked,
.mb-filter-grid-item.is-active {
  background: #eef2ff;
  color: #4338ca;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px #c7d2fe;
}

.mb-filter-grid-item.is-checked .mb-filter-grid-icon,
.mb-filter-grid-item.is-active .mb-filter-grid-icon {
  color: #4338ca;
}

.mb-filter-grid-item.is-checked .mb-filter-grid-count,
.mb-filter-grid-item.is-active .mb-filter-grid-count {
  color: #4338ca;
}

.mb-filter-grid-item:focus-within,
.mb-filter-grid-item:focus-visible {
  outline: 2px solid rgba(67, 56, 202, .45);
  outline-offset: -1px;
}

.mb-filter-reset {
  appearance: none;
  width: 100%;
  /* 固定在面板底部（不进滚动区），筛选生效时总能看到 */
  flex: 0 0 auto;
  margin-top: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: border-color .14s ease, color .14s ease;
}

.mb-filter-reset:hover {
  border-color: #c7d2fe;
  color: #4338ca;
}

/* ------------------------------------------------------------- 右侧头部 */

.mb-title {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 2.8vw, 2.1rem);
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #090f1d;
}

.mb-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.mb-search {
  position: relative;
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: #fff;
  padding: 0 14px;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.mb-search:focus-within {
  border-color: #4338ca;
  box-shadow: 0 0 0 3px rgba(67, 56, 202, .08);
}

.mb-search-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: #94a3b8;
}

.mb-search-input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  padding: 11px 0;
  font-size: 15px;
  color: #0f172a;
  font-family: inherit;
}

.mb-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.mb-sort-wrap {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: #fff;
  padding: 0 10px;
  transition: border-color .16s ease, box-shadow .16s ease;
}

/* 原生 select 聚焦时的黑色默认描边很难看：去掉，改由外层容器给一层品牌色 focus 环 */
.mb-sort-wrap:focus-within {
  border-color: #4338ca;
  box-shadow: 0 0 0 3px rgba(67, 56, 202, .1);
}

.mb-sort {
  appearance: none;
  border: 0;
  outline: none;
  background: transparent;
  padding: 11px 20px 11px 4px;
  font-size: 14.5px;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  font-family: inherit;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 8px) 50%, calc(100% - 3px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.mb-view-toggle {
  display: inline-flex;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: #fff;
  padding: 3px;
  gap: 2px;
}

.mb-view {
  appearance: none;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}

.mb-view svg {
  width: 14px;
  height: 14px;
}

.mb-view:hover {
  color: #0f172a;
}

.mb-view.is-active {
  background: #eef2ff;
  color: #4338ca;
}

.mb-count {
  margin: 0 0 10px;
  font-size: 13.5px;
  color: #94a3b8;
}

/* --------------------------------------------------------------- 列表 */

.mb-list {
  border: 1px solid #e6ebf4;
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .04);
}

.mb-row {
  position: relative;
  display: grid;
  grid-template-columns: 30px 44px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 15px 16px;
  border-bottom: 1px solid #eef2f8;
  transition: background .18s ease, box-shadow .18s ease;
}

/* 悬停时左侧渐显一条竖条，作为「当前行」的选中反馈 */
.mb-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #4338ca, #0072f5);
  opacity: 0;
  transform: scaleY(.35);
  transform-origin: center;
  transition: opacity .18s ease, transform .18s ease;
}

.mb-row:hover,
.mb-row:focus-within {
  background: #f4f7ff;
  box-shadow: inset 0 1px 0 rgba(67, 56, 202, .08), inset 0 -1px 0 rgba(67, 56, 202, .08);
}

.mb-row:hover::before,
.mb-row:focus-within::before {
  opacity: 1;
  transform: scaleY(1);
}

.mb-row:hover .mb-name {
  color: #4338ca;
}

.mb-row:last-child {
  border-bottom: 0;
}

.mb-index {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #cbd5e1;
  padding-top: 10px;
}

.mb-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #eef2f8;
  background: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mb-logo img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.mb-main {
  min-width: 0;
}

.mb-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.mb-name {
  font-size: 16px;
  font-weight: 650;
  color: #0f172a;
  text-decoration: none;
  word-break: break-word;
}

.mb-name:hover {
  color: #4338ca;
}

.mb-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}

.mb-tag--online {
  color: #0f766e;
  border-color: rgba(13, 148, 136, .25);
  background: rgba(13, 148, 136, .1);
}

.mb-tag--custom {
  color: #9a3412;
  border-color: rgba(234, 88, 12, .22);
  background: rgba(234, 88, 12, .1);
}

.mb-tag--mm {
  color: #4338ca;
  border-color: rgba(79, 70, 229, .22);
  background: rgba(79, 70, 229, .1);
}

.mb-desc {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.65;
  color: #64748b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.mb-chip {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f1f5fb;
  color: #475569;
  white-space: nowrap;
}

.mb-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #94a3b8;
}

.mb-meta-vendor {
  color: #64748b;
  font-weight: 500;
}

.mb-dot {
  opacity: .6;
}

.mb-side {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}



.mb-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.mb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.mb-btn:hover {
  border-color: #c7d2fe;
  color: #4338ca;
}

.mb-btn--primary {
  background: #4338ca;
  border-color: #4338ca;
  color: #fff;
}

.mb-btn--primary:hover {
  background: #3730a3;
  border-color: #3730a3;
  color: #fff;
}

.mb-btn--sm {
  padding: 6px 11px;
  font-size: 13px;
}

.mb-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.mb-more {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 14.5px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease;
}

.mb-more:hover {
  border-color: #c7d2fe;
  color: #4338ca;
}

.mb-empty {
  margin: 24px 0;
  padding: 22px;
  border: 1px dashed #e2e8f0;
  border-radius: 14px;
  text-align: center;
  font-size: 14.5px;
  color: #94a3b8;
}

/* --------------------------------------------------------------- 表格 */

.mb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.mb-table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #94a3b8;
  background: #f8fafc;
  padding: 11px 14px;
  border-bottom: 1px solid #eef2f8;
  white-space: nowrap;
}

.mb-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #475569;
  vertical-align: middle;
}

.mb-table tbody tr:last-child td {
  border-bottom: 0;
}

.mb-table tbody tr:hover {
  background: #fbfcff;
}

.mb-col-index {
  width: 44px;
  color: #cbd5e1 !important;
  font-variant-numeric: tabular-nums;
}

.mb-col-num {
  width: 72px;
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.mb-col-date {
  width: 110px;
  white-space: nowrap;
  color: #94a3b8 !important;
}

.mb-col-actions {
  width: 96px;
  text-align: right;
}

.mb-table-name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.mb-table-name img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 auto;
}

.mb-table-name span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mb-table-name strong {
  font-size: 14.5px;
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mb-table-name small {
  font-size: 12px;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mb-chip-row {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.mb-chip--xs {
  font-size: 11.5px;
  padding: 1px 6px;
}

/* ------------------------------------------------------------- 响应式 */

@media (max-width: 1100px) {
  .mb-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  /* 单列时把右列拆平，让筛选栏回到「标题」和「列表」之间 */
  .mb-pane {
    display: contents;
  }

  .mb-head,
  .mb-filters,
  .mb-content {
    grid-column: 1;
    grid-row: auto;
  }

  .mb-head {
    order: 1;
  }

  .mb-filters {
    order: 2;
  }

  .mb-content {
    order: 3;
  }

  .mb-head {
    margin-bottom: 2px;
  }

  .mb-filters {
    position: static;
    top: auto;
    display: block;
    max-height: none;
    overflow: visible;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e6ebf4;
    border-radius: 14px;
  }

  /* 窄屏：分类改为横向换行的小胶囊，厂商两列 */
  .mb-filter-group {
    padding-bottom: 8px;
  }

  .mb-filter-head {
    padding: 4px 2px;
  }

  /* 窄屏：分类与厂商同样是「图标 + 文字」两列；只有「可用状态」用横向胶囊 */
  [data-mb-status] {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  [data-mb-status] .mb-filter-item {
    width: auto;
    gap: 6px;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 13.5px;
    padding: 6px 11px;
    border-radius: 999px;
  }

  [data-mb-status] .mb-filter-item.is-active {
    border-color: rgba(67, 56, 202, .45);
  }

  [data-mb-status] .mb-filter-item em {
    font-size: 12px;
  }

  .mb-filter-grid-item {
    font-size: 12.5px;
  }

  .mb-filter-scroll {
    overflow: visible;
    padding-right: 0;
  }

  /* 厂商较多时限高滚动，避免筛选区过长 */
  [data-mb-vendors] {
    max-height: 240px;
    overflow-y: auto;
  }

  .mb-table thead th:nth-child(4),
  .mb-table tbody td:nth-child(4),
  .mb-table thead th:nth-child(6),
  .mb-table tbody td:nth-child(6) {
    display: none;
  }
}

@media (max-width: 1023px) {
  .mb-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .mb-index {
    display: none;
  }

  .mb-logo {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }

  .mb-side {
    grid-column: 1 / -1;
    justify-content: space-between;
    padding-top: 4px;
  }

  .mb-actions {
    margin-left: auto;
  }
}

@media (max-width: 640px) {
  .mb-layout {
    gap: 12px;
  }

  .mb-toolbar-right {
    width: 100%;
  }

  .mb-sort-wrap {
    flex: 1 1 auto;
  }

  .mb-view-toggle {
    flex: 0 0 auto;
  }

  .mb-btn {
    padding: 9px 13px;
  }

  .mb-tag {
    font-size: 11.5px;
  }

  .mb-filter-item,
  .mb-filter-check {
    font-size: 13px;
  }

  .mb-filter-check {
    width: 100%;
  }

  .mb-table thead th:nth-child(3),
  .mb-table tbody td:nth-child(3) {
    display: none;
  }
}

/* --------------------------------------------------------------- 暗色 */

html[data-theme="dark"] .mb-title,
html[data-theme="dark"] .mb-name,
html[data-theme="dark"] .mb-table-name strong {
  color: #e2e8f0;
}

html[data-theme="dark"] .mb-desc {
  color: #94a3b8;
}

html[data-theme="dark"] .mb-filters,
html[data-theme="dark"] .mb-search,
html[data-theme="dark"] .mb-sort-wrap,
html[data-theme="dark"] .mb-view-toggle,
html[data-theme="dark"] .mb-list,
html[data-theme="dark"] .mb-btn,
html[data-theme="dark"] .mb-more,
html[data-theme="dark"] .mb-filter-reset {
  background: #131c30;
  border-color: rgba(148, 163, 184, .18);
}

html[data-theme="dark"] .mb-search-input,
html[data-theme="dark"] .mb-sort {
  color: #e2e8f0;
}

html[data-theme="dark"] .mb-row {
  border-bottom-color: rgba(148, 163, 184, .14);
}

html[data-theme="dark"] .mb-row:hover,
html[data-theme="dark"] .mb-filter-item:hover,
html[data-theme="dark"] .mb-filter-grid-item:hover {
  background: #16233a;
}

html[data-theme="dark"] .mb-filter-grid-item {
  color: #cbd5e1;
}

html[data-theme="dark"] .mb-filter-grid-icon {
  color: #94a3b8;
}

html[data-theme="dark"] .mb-filter-grid-item.is-checked,
html[data-theme="dark"] .mb-filter-grid-item.is-active {
  background: rgba(99, 102, 241, .22);
  color: #c7d2fe;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .45);
}

html[data-theme="dark"] .mb-filter-grid-item.is-checked .mb-filter-grid-icon,
html[data-theme="dark"] .mb-filter-grid-item.is-active .mb-filter-grid-icon {
  color: #c7d2fe;
}

html[data-theme="dark"] .mb-filter-grid-item.is-checked .mb-filter-grid-count,
html[data-theme="dark"] .mb-filter-grid-item.is-active .mb-filter-grid-count {
  color: #c7d2fe;
}

html[data-theme="dark"] .mb-filter-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, .32);
  border: 2px solid transparent;
  background-clip: padding-box;
}

html[data-theme="dark"] .mb-logo {
  background: #0f1728;
  border-color: rgba(148, 163, 184, .16);
}

html[data-theme="dark"] .mb-chip {
  background: rgba(148, 163, 184, .16);
  color: #cbd5e1;
}

html[data-theme="dark"] .mb-filter-group {
  border-bottom-color: rgba(148, 163, 184, .12);
}

html[data-theme="dark"] .mb-filter-item {
  color: #cbd5e1;
}

html[data-theme="dark"] .mb-filter-item.is-active {
  background: rgba(99, 102, 241, .22);
  color: #c7d2fe;
}

html[data-theme="dark"] .mb-filter-item.is-active em {
  color: #c7d2fe;
}

html[data-theme="dark"] .mb-tag {
  background: #16233a;
  border-color: rgba(148, 163, 184, .2);
  color: #cbd5e1;
}

html[data-theme="dark"] .mb-btn--primary {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

html[data-theme="dark"] .mb-view.is-active {
  background: rgba(99, 102, 241, .22);
  color: #c7d2fe;
}

html[data-theme="dark"] .mb-table thead th {
  background: #0f1728;
  border-bottom-color: rgba(148, 163, 184, .16);
}

html[data-theme="dark"] .mb-table tbody td {
  border-bottom-color: rgba(148, 163, 184, .12);
  color: #cbd5e1;
}

html[data-theme="dark"] .mb-table-name small,
html[data-theme="dark"] .mb-col-date {
  color: #94a3b8 !important;
}

/* ---------------------------------------------------------- 卡片视图 */

.mb-list.mb-list--card {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(266px, 1fr));
  gap: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.mb-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px;
  border: 1px solid #e6ebf4;
  border-radius: 14px;
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.mb-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .07);
  transform: translateY(-2px);
}

.mb-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.mb-card-logo {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid #eef2f8;
  background: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mb-card-logo img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.mb-card-id {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mb-card-name {
  font-size: 14.5px;
  font-weight: 650;
  color: #0f172a;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mb-card-name:hover {
  color: #4338ca;
}

.mb-card-vendor {
  font-size: 11.5px;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mb-card-desc {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.65;
  color: #64748b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1 1 auto;
}

.mb-card .mb-chips {
  margin-bottom: 12px;
}

.mb-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed #eef2f8;
}

.mb-card-meta {
  font-size: 11.5px;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mb-card-actions {
  display: inline-flex;
  gap: 6px;
  flex: 0 0 auto;
}

html[data-theme="dark"] .mb-card {
  background: #131c30;
  border-color: rgba(148, 163, 184, .18);
}

html[data-theme="dark"] .mb-card:hover {
  border-color: rgba(129, 140, 248, .5);
  box-shadow: none;
}

html[data-theme="dark"] .mb-card-logo {
  background: #0f1728;
  border-color: rgba(148, 163, 184, .16);
}

html[data-theme="dark"] .mb-card-name {
  color: #e2e8f0;
}

html[data-theme="dark"] .mb-card-desc {
  color: #94a3b8;
}

html[data-theme="dark"] .mb-card-foot {
  border-top-color: rgba(148, 163, 184, .14);
}

@media (max-width: 640px) {
  .mb-list.mb-list--card {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .mb-card {
    padding: 14px;
  }
}

/* ------------------------------------------------------- 详情抽屉 */

.mb-drawer {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.mb-drawer[hidden] {
  display: none;
}

.mb-drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .42);
  opacity: 0;
  transition: opacity .24s ease;
}

.mb-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  /* 详情抽屉占屏幕宽度的 90%，保留左侧列表可见，暗示可关闭 */
  width: 90vw;
  background: #fff;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.22, .61, .36, 1);
  box-shadow: -18px 0 48px rgba(15, 23, 42, .18);
}

.mb-drawer.is-open .mb-drawer-mask {
  opacity: 1;
}

.mb-drawer.is-open .mb-drawer-panel {
  transform: translateX(0);
}

.mb-drawer-bar {
  flex: 0 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px 0 20px;
  border-bottom: 1px solid #eef2f8;
  background: #fff;
}

.mb-drawer-bar-title {
  font-size: 14px;
  font-weight: 650;
  color: #0f172a;
}

.mb-drawer-bar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* 在新窗口打开：胶囊按钮，与关闭按钮同高 */
.mb-drawer-newtab {
  appearance: none;
  height: 30px;
  padding: 0 11px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.mb-drawer-newtab svg {
  width: 13px;
  height: 13px;
}

.mb-drawer-newtab:hover {
  border-color: #c7d2fe;
  color: #4338ca;
  background: #eef2ff;
}

.mb-drawer-close {
  appearance: none;
  border: 1px solid #e2e8f0;
  background: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.mb-drawer-close svg {
  width: 14px;
  height: 14px;
}

.mb-drawer-close:hover {
  border-color: #c7d2fe;
  color: #4338ca;
  background: #eef2ff;
}

.mb-drawer-frame {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  display: block;
  background: #fff;
}

@media (max-width: 640px) {
  /* 手机上同样留出 10% 的遮罩，避免全屏后无「可关闭」的空间线索 */
  .mb-drawer-panel {
    width: 90vw;
  }

  /* 窄屏只留外链图标，避免挤压标题 */
  .mb-drawer-newtab span {
    display: none;
  }

  .mb-drawer-newtab {
    padding: 0 8px;
  }
}

html[data-theme="dark"] .mb-drawer-panel,
html[data-theme="dark"] .mb-drawer-bar,
html[data-theme="dark"] .mb-drawer-frame {
  background: #0f172a;
}

html[data-theme="dark"] .mb-drawer-bar {
  border-bottom-color: rgba(148, 163, 184, .18);
}

html[data-theme="dark"] .mb-drawer-bar-title {
  color: #e2e8f0;
}

html[data-theme="dark"] .mb-drawer-close {
  background: #16233a;
  border-color: rgba(148, 163, 184, .2);
  color: #cbd5e1;
}

html[data-theme="dark"] .mb-drawer-newtab {
  background: #16233a;
  border-color: rgba(148, 163, 184, .2);
  color: #cbd5e1;
}

html[data-theme="dark"] .mb-drawer-newtab:hover {
  border-color: rgba(129, 140, 248, .5);
  color: #c7d2fe;
  background: #1c2a45;
}
