/* 平台 · 模型库 / 模型详情 / 价格链
   只用 --r12-* 变量；颜色、圆角、阴影不写死。 */

/* ---------- 模型库 ---------- */
.models-filters .models-modality { margin-top: 4px; }

.models-layout { display: flex; align-items: flex-start; gap: 12px; }
.models-filters {
  position: sticky;
  top: 0;
  width: 200px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}
.models-main { flex: 1 1 auto; min-width: 0; }

.models-toolbar { flex-wrap: wrap; }
.models-search { flex: 0 1 240px; min-width: 180px; }
.models-toolbar .ml-sort .btn .ico { width: 12px; height: 12px; transform: rotate(90deg); }
.models-toolbar .ml-result { white-space: nowrap; }

.models-table-card,
.chain-table-card { min-width: 0; }
.models-table-wrap { min-width: 0; }
.models-table { width: 100%; table-layout: fixed; }
.models-page .models-table thead th,
.models-page .models-table tbody td { padding: 0 4px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.models-page .models-table thead th { height: 36px; }
.models-page .models-table tbody td { height: 44px; }
.models-page.is-compact .models-table tbody td { height: 36px; }

.models-table .col-select { width: 3%; }
.models-table .col-name { width: 20.5%; }
.models-table .col-tasks { width: 10%; }
.models-table .col-sup { width: 6%; }
.models-table .col-cheap { width: 13%; }
.models-table .col-platform { width: 10%; }
.models-table .col-margin { width: 5.5%; }
.models-table .col-status { width: 7.5%; }
.models-table .col-route { width: 10%; }
.models-table .col-calls { width: 6.5%; }
.models-table .col-success { width: 8%; }

.row-check {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid var(--r12-line-strong);
  border-radius: 5px;
  background: transparent;
  color: var(--r12-bg);
  cursor: pointer;
  vertical-align: middle;
}
.row-check .ico { display: block; width: 12px; height: 12px; }
.row-check.is-on { border-color: var(--r12-ink); background: var(--r12-ink); color: var(--r12-bg); }
.row-check:hover { border-color: var(--r12-ink); }
.bulk-error { min-height: 16px; font-size: 12px; color: var(--r12-error); }

.models-table tbody tr.models-row { cursor: pointer; }
.models-table tbody tr.models-row:hover { background: var(--r12-hover); }
.models-row td { border-bottom: 1px solid var(--r12-line); }
.models-page .models-table tbody tr.models-spacer td { height: var(--spacer, 0); padding: 0; border: 0; background: transparent; }

.models-page .ml-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.models-page .ml-vendor { width: 20px; height: 20px; flex: none; }
.models-page .ml-name-text { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; line-height: 1.25; }
.models-page .ml-name-text b { overflow: hidden; font-size: 13px; font-weight: 500; text-overflow: ellipsis; }
.models-page .ml-name-text code { overflow: hidden; font-family: var(--font-mono); font-size: 10px; color: var(--r12-faint); text-overflow: ellipsis; }
.models-page .alias-open { flex: none; height: 22px; padding: 0 8px; font-size: 11px; }
.models-page .ml-cheap-sup { display: block; overflow: hidden; font-size: 9px; line-height: 1.2; color: var(--r12-muted); text-overflow: ellipsis; }
.models-page .ml-cheap-price { display: block; font-family: var(--font-mono); font-size: 12px; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--r12-ink); }
.models-page .ml-price { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.models-page .ml-price-sub { display: block; font-size: 9px; color: var(--r12-faint); }
.models-page .ml-text-price { display: flex; flex-direction: column; font-family: var(--font-mono); font-size: 11px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.models-page .ml-route { font-size: 11px; }
.models-table td[data-cell="tasks"] { font-size: 11px; }
.models-table td[data-cell="suppliers"] { font-size: 11px; }
.models-table td[data-cell="route"] { font-size: 11px; }
.models-page .ml-muted { color: var(--r12-faint); font-size: 12px; }
.models-page .ml-tab-count { margin-left: 5px; font-family: var(--font-mono); font-size: 10px; color: var(--r12-faint); }
.models-page .seg-btn.is-on .ml-tab-count { color: var(--r12-bg); opacity: 0.75; }

/* 1280 也保留全部列：把窄列的字号再压一点，靠排布而不是隐藏列。 */
.models-table td[data-cell="calls7d"],
.models-table td[data-cell="success7d"] { font-size: 11px; }
.models-table td[data-cell="status"] .chip { height: 20px; padding: 0 6px; font-size: 11px; }
.models-table td[data-cell="cheapest"] .ml-cheap-price { font-size: 11px; }

/* 别名抽屉 */
.alias-drawer { display: flex; flex-direction: column; gap: 12px; }
.alias-lead { font-size: 12px; line-height: 1.6; color: var(--r12-muted); }
.alias-lead code { font-family: var(--font-mono); color: var(--r12-ink); }
.alias-list { display: flex; flex-wrap: wrap; gap: 6px; }
.alias-field { margin: 0; }
.alias-error { min-height: 16px; font-size: 12px; color: var(--r12-error); }
.alias-drawer .btn { align-self: flex-start; }

/* ---------- 模型详情 ---------- */
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.detail-head-main { display: flex; gap: 10px; min-width: 0; }
.detail-vendor { width: 36px; height: 36px; flex: none; }
.detail-title { min-width: 0; }
.detail-title-row { display: flex; align-items: center; gap: 8px; }
.detail-name { font-size: 16px; font-weight: 600; line-height: 22px; }
.detail-id-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.detail-id-row code { font-family: var(--font-mono); font-size: 12px; color: var(--r12-muted); }
.detail-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.detail-meta .chip { height: 20px; font-size: 11px; }
.detail-alias { margin-top: 6px; font-size: 12px; color: var(--r12-muted); }
.detail-head-side { display: flex; align-items: center; gap: 8px; flex: none; font-size: 12px; color: var(--r12-muted); }

.detail-tabs { margin-top: 12px; }
.detail-sections { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.detail-section { min-width: 0; scroll-margin-top: 8px; }
.detail-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.detail-section-head h2 { font-size: 13px; font-weight: 600; }
.detail-section .supplier-tabs { margin-bottom: 10px; }
.detail-section .detail-layout { margin-top: 0; }
.model-detail-page [data-price-chain] [data-goto] { cursor: pointer; }
.model-detail-page [data-price-chain] [data-goto]:hover { filter: brightness(1.12); }

.detail-panel { border-color: var(--r12-line); border-radius: var(--r12-r-card); background: var(--r12-surface); }
.detail-panel-head h2 { font-size: 13px; }
.tier-matrix th,
.tier-matrix td { height: 40px; }
.tier-matrix thead th { background: var(--r12-surface); }

/* ---------- 价格链 ---------- */
.chain-layout { display: flex; align-items: flex-start; gap: 12px; }
.chain-layout .filter-card { position: sticky; top: 0; max-height: calc(100vh - 120px); overflow: auto; }
.chain-main { flex: 1 1 auto; min-width: 0; }
.chain-toolbar { flex-wrap: wrap; }
.chain-table { table-layout: fixed; width: 100%; }
.chain-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 价格格子只是数字，不需要点；避免落到老页面的「点格子改价」逻辑上。 */
.chain-table td[data-cell] { pointer-events: none; }
.chain-table td[data-cell] .btn { pointer-events: auto; }
.chain-table .chain-model-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.chain-table .chain-model-cell .vendor-icon { width: 18px; height: 18px; flex: none; }
.chain-table .chain-model-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.chain-table .chain-name { display: block; max-width: 100%; min-width: 0; overflow: hidden; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.chain-table .chain-id { overflow: hidden; font-family: var(--font-mono); font-size: 9px; color: var(--r12-faint); text-overflow: ellipsis; }
.chain-table .chain-tier { display: block; margin-top: 2px; font-size: 10px; color: var(--r12-muted); }
.chain-table .chain-unpriced { display: inline-block; padding: 0 6px; border-radius: 999px; background: var(--r12-surface-3); color: var(--r12-muted); font-size: 11px; line-height: 20px; }
.chain-table td[data-cell="action"] { padding-right: 6px; text-align: right; }
.chain-link { padding: 0; border: 0; background: transparent; color: var(--r12-ink); font: inherit; text-align: left; cursor: pointer; }
.chain-link:hover { color: var(--r12-pink); }
.chain-table .chain-unit { margin-left: 6px; font-size: 10px; color: var(--r12-faint); }
.chain-table .chain-dealer { display: block; font-family: var(--font-ui); font-size: 9px; color: var(--r12-faint); }
.chain-table .chain-muted { color: var(--r12-faint); font-size: 12px; }
.chain-table .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.chain-table .num em { font-style: normal; font-size: 9px; color: var(--r12-faint); }
.chain-table th { white-space: nowrap; }
.chain-table td { height: 44px; }
.chain-empty { padding: 24px; }

/* 记录页：每家算力商一行同步时间与来源；来源太长时换行，不截断。 */
.record-sync { flex-wrap: wrap; }
.record-sync [data-sync-source] { flex-basis: 100%; text-align: left; overflow-wrap: anywhere; }

/* ---------- 模型详情：页头大卡 + 关键数字 + 渠道 / 参数 ---------- */
.pf-model-head { align-items: stretch; }
.pf-model-head .detail-head-side { flex: 1 1 auto; justify-content: flex-end; }
.pf-model-head .detail-desc { margin: 6px 0 0; font-size: 12px; line-height: 1.6; color: var(--r12-muted); }
.pf-key-card {
  display: flex; flex-direction: column; gap: 8px;
  min-width: 430px; max-width: 560px; padding: 10px 12px;
  background: var(--r12-surface); border: 1px solid var(--r12-line); border-radius: var(--r12-r-card);
}
.pf-key-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; }
.pf-key-figure { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pf-key-figure span { font-size: 11px; color: var(--r12-muted); white-space: nowrap; }
.pf-key-figure b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--r12-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-key-figure em { font-size: 10px; font-style: normal; color: var(--r12-faint); white-space: nowrap; }
.pf-list-toggle { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 12px; color: var(--r12-muted); padding-top: 6px; border-top: 1px solid var(--r12-line); }
.pf-model-channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.pf-model-channel {
  display: flex; flex-direction: column; gap: 6px; padding: 10px;
  background: var(--r12-surface); border: 1px solid var(--r12-line); border-radius: var(--r12-r-card);
}
.pf-model-channel-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pf-model-channel-top b { font-size: 13px; font-weight: 600; color: var(--r12-ink); }
.pf-model-channel-meta { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--r12-muted); }
.pf-model-channel-meta b { color: var(--r12-ink); font-weight: 600; }
.pf-order-list { display: flex; flex-direction: column; gap: 6px; }
.pf-order-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px;
  background: var(--r12-surface); border: 1px solid var(--r12-line); border-radius: var(--r12-r-card);
}
.pf-order-rank { min-width: 52px; font-size: 11px; color: var(--r12-muted); }
.pf-order-row b { font-size: 13px; font-weight: 600; color: var(--r12-ink); }
.pf-order-row > span:nth-child(3) { flex: 1 1 auto; font-size: 11px; }
.pf-order-actions { display: flex; align-items: center; gap: 4px; }
.pf-param-tabs { margin-bottom: 10px; }
.pf-chain-panel { margin-bottom: 4px; }
.rule-panel-wrap { border: 0; background: transparent; }

/* 概览：价格链做成一行紧凑流程，高度跟内容走。 */
.detail-chain {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1.6fr);
  align-items: center;
}
.detail-chain > .seg { padding: 8px 10px; gap: 2px; }
.detail-chain .seg-value { font-size: 18px; }
.detail-chain .seg-label { font-size: 11px; color: var(--r12-muted); }
.detail-chain .seg-sub { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-chain .chain-fork { display: block; min-width: 0; }
.detail-chain .fork-nodes { flex-direction: row; gap: 6px; padding-left: 0; }
.detail-chain .fork-nodes::before { display: none; }
.detail-chain .fork-node { flex: 1 1 0; min-width: 0; padding: 6px 8px; }
.detail-chain .fork-node::before { display: none; }
.detail-chain .fork-node-price { font-size: 14px; }
.detail-chain .fork-node-name { font-size: 11px; }

/* 概览：常用档价格表、首选与兜底、近 7 天表现各占一小块。 */
.pf-overview-tiers .table td,
.pf-overview-tiers .table th { font-size: 12px; }
.pf-overview-line .panel-head,
.pf-overview-line .detail-panel-head { margin-bottom: 6px; }
.pf-route-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 12px; }
.pf-route-line-tag { flex: none; padding: 0 6px; height: 20px; line-height: 20px; border-radius: var(--r12-r-pill); background: var(--r12-surface-3); color: var(--r12-muted); font-size: 11px; }
.pf-route-line-name b { font-size: 13px; font-weight: 600; color: var(--r12-ink); }
.pf-route-line-chip { height: 20px; font-size: 11px; }
.pf-perf-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--r12-muted); }
.pf-perf-line b { font-size: 15px; font-weight: 600; color: var(--r12-ink); font-variant-numeric: tabular-nums; }

@media (max-width: 1280px) {
  .pf-key-card { min-width: 360px; max-width: 460px; }
  .pf-key-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
