/* 公司后台 v4 · 模型与价格。颜色、圆角、阴影只用 --r12-* 变量。 */

.co-price-layout {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* 左侧分类卡固定不动：右边表格滚动时它留在原处，自己太长时自己滚。 */
.co-price-layout > .filter-card {
  position: sticky;
  top: 0;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.co-price-main {
  flex: 1 1 auto;
  min-width: 0;
}


.co-th-tip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.co-th-tip .icon-btn {
  width: 18px;
  height: 18px;
  font-size: 11px;
}

.co-tier-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

/* 逐档抽屉比通用抽屉宽：档位名不折行以后，右边「常用档」那一列也要完整放下。 */
.drawer[data-tiers-drawer] { width: min(720px, calc(100vw - 24px)); }

/* 逐档抽屉：档位名一行写完（「480p · 不分声音」不再折行），行高按内容收。 */
.co-tiers-table tbody td {
  height: auto;
  padding-top: 4px;
  padding-bottom: 4px;
  line-height: 22px;
}

.co-tiers-table tbody td:nth-child(2) { white-space: nowrap; }

.co-tier-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

.co-price-main > * + * {
  margin-top: 8px;
}

/* 工具行和下面的表之间留 12（工具行本身已有 12 的下边距）。 */
.co-price-main > [data-toolbar] + * {
  margin-top: 0;
}

.co-price-search {
  flex: 0 0 280px;
  width: 280px;
}

.co-result-count,
.co-panel-count {
  font-size: 12px;
  color: var(--r12-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- 生成模型表 ---------- */

.co-gen-table {
  table-layout: fixed;
}

.co-gen-table tbody td {
  vertical-align: middle;
}

.co-col-name { width: 26%; }
.co-col-tier { width: 18%; }
.co-col-cost { width: 11%; }
.co-col-retail { width: 11%; }
.co-col-margin { width: 8%; }
.co-col-open { width: 10%; }
.co-col-actions { width: 16%; }

.co-model-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.co-vendor {
  width: 24px;
  height: 24px;
}

.co-model-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.co-model-text b {
  font-size: 13px;
  font-weight: 600;
  color: var(--r12-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.co-gen-sub {
  font-size: 12px;
  line-height: 16px;
  color: var(--r12-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.co-actions-cell {
  white-space: nowrap;
}

.co-actions-cell .btn + .btn {
  margin-left: 6px;
}

.co-loading {
  padding: 24px;
  font-size: 13px;
  color: var(--r12-muted);
}

.co-empty-text {
  padding: 16px 4px;
  font-size: 13px;
  color: var(--r12-muted);
  text-align: center;
}

/* ---------- 语言模型 ---------- */

.co-llm-list {
  display: flex;
  flex-direction: column;
}

.co-llm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 2px;
  border-bottom: 1px solid var(--r12-line);
}

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

.co-llm-rank {
  flex: none;
  width: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--r12-muted);
  font-variant-numeric: tabular-nums;
}

.co-llm-row .co-model-text {
  flex: 1 1 auto;
}

.co-llm-move {
  display: flex;
  gap: 2px;
  flex: none;
}

.co-llm-move .icon-btn:disabled {
  color: var(--r12-faint);
  cursor: not-allowed;
  background: transparent;
}

.co-hint {
  margin-top: 8px;
  font-size: 12px;
  line-height: 18px;
  color: var(--r12-muted);
}

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

.co-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.co-model-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.co-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.co-card-head .co-model-text {
  flex: 1 1 auto;
}

.co-card-prices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
}

.co-card-prices div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.co-card-prices span {
  font-size: 12px;
  color: var(--r12-muted);
}

.co-card-prices b {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.co-card-actions {
  display: flex;
  gap: 6px;
}

/* ---------- 客户价规则 ---------- */

.co-rules {
  padding: 0;
  overflow: hidden;
}

.co-rules-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--r12-ink);
  font: inherit;
  text-align: left;
}

.co-rules-toggle:hover {
  background: var(--r12-hover);
}

.co-rules-title {
  font-size: 14px;
  font-weight: 600;
}

.co-rules-meta {
  font-size: 12px;
  color: var(--r12-muted);
}

.co-rules-caret {
  display: inline-flex;
  margin-left: auto;
  color: var(--r12-muted);
}

.co-rules-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--r12-line);
}

.co-rule-head,
.co-rule-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr 88px;
  gap: 8px;
  align-items: center;
}

.co-rule-head {
  height: 32px;
  font-size: 12px;
  color: var(--r12-muted);
}

.co-rule-row {
  min-height: 40px;
  border-top: 1px solid var(--r12-line);
  font-size: 13px;
}

.co-rule-value,
.co-rule-time {
  font-variant-numeric: tabular-nums;
}

.co-rule-scope {
  font-weight: 600;
}

.co-rule-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.co-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.co-form-head b {
  font-size: 13px;
  font-weight: 600;
}

.co-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.co-form-label {
  flex: none;
  width: 64px;
  font-size: 12px;
  color: var(--r12-muted);
}

.co-rule-input,
.co-adjust-input {
  width: 120px;
  height: 32px;
}

.co-form-unit {
  font-size: 12px;
  color: var(--r12-muted);
}

.co-form-error {
  font-size: 12px;
  line-height: 18px;
  color: var(--r12-error);
}

.co-form-actions {
  display: flex;
  justify-content: flex-end;
}

.co-pick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.co-pick {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--r12-line);
  border-radius: 999px;
  background: var(--r12-surface-2);
  color: var(--r12-muted);
  font: inherit;
  font-size: 12px;
}

.co-pick:hover {
  border-color: var(--r12-line-strong);
  color: var(--r12-ink);
}

.co-pick.is-on {
  border-color: var(--r12-selected-border);
  background: var(--r12-selected-bg);
  color: var(--r12-ink);
  font-weight: 600;
}

/* ---------- 调价、逐档抽屉 ---------- */

/* 合成一张表以后列多了：沿用上面 720 的宽度，档位名、拿货价、现价、新价、新毛利、常用档都看得全。 */
.drawer.is-tiers .drawer-head h2 {
  margin-right: auto;
}

.co-drawer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.co-drawer-title span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.co-adjust-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.co-adjust-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.co-field-label {
  font-size: 12px;
  color: var(--r12-muted);
}

.co-adjust-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.co-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.co-preview-row.is-low td {
  color: var(--r12-review);
}

.co-preview-row.is-below td {
  color: var(--r12-error);
}

.co-adjust-reason {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 「改价」抽屉：上面整个模型统一加价，下面逐档。 */
.co-tier-unified,
.co-tier-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.co-tier-unified {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--r12-line);
}

.co-tier-block { padding-top: 2px; }

/* ---------- 逐模型会员显示名（明暗主题都用 --r12-* 语义变量） ---------- */

.dp-member-hint {
  margin: 0 0 10px;
}

/* 价格卡：名称旁只放一个小标签（按加价 / 按平台会员价），标题行右侧放开关和详情。 */
.dp-name-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dp-name-line h3 { min-width: 0; }
.dp-mode-tag {
  flex: none;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--r12-surface-3);
  color: var(--r12-muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
}
.d-card .dp-card-actions { flex-wrap: wrap; justify-content: flex-end; }
.dp-status-line { margin-top: 4px; }
.dp-status-line .tag { height: 18px; font-size: 10px; }

/* 价格卡最多列 4 档：行高按内容收，1 档和 4 档的整卡高度差留在 120 以内。
   （4 档还带一行「还有 N 档」，所以行要比同页的表格视图更紧一点。） */
.d-card .d-price-table th,
.d-card .d-price-table td { padding: 3px 4px; line-height: 15px; }
.d-card .d-price-table .cell-sub { line-height: 1.1; }
/* 卡片只有 360 宽：档名列要放得下「多角色替换 768p」，折行会把行高重新撑起来。 */
.d-card .d-price-table--text th:nth-child(1) { width: 32%; }
.d-card .d-price-table--text th:nth-child(2) { width: 20%; }
.d-card .d-price-table--text th:nth-child(3) { width: 14%; }
.d-card .d-price-table--text th:nth-child(4) { width: 34%; }
.d-card .d-row-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 未上架：不画空表，只在价目区放一行灰字说明。 */
.dp-unlisted-note {
  margin: 0;
  padding: 8px 0;
  font-size: 12px;
  line-height: 18px;
  color: var(--r12-muted);
}

/* 长价目收起：第 4 档下面一行「还有 N 档 · 看全部」，点了走「详情」同一个入口。 */
.d-card .d-price-table .dp-more-row td { padding: 2px 4px 3px; border-bottom: 0; }
.dp-more-btn {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--r12-muted);
  font: inherit;
  font-size: 11px;
  line-height: 15px;
  text-align: left;
  cursor: pointer;
}
.dp-more-btn:hover { color: var(--r12-ink); text-decoration: underline; }
.dp-more-btn:focus-visible { outline: 2px solid var(--r12-ok); outline-offset: 2px; }

.dp-member-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dp-member-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.dp-member-controls.is-compact {
  gap: 4px;
}

.dp-member-label {
  flex: none;
  font-size: 11px;
  line-height: 16px;
  color: var(--r12-muted);
  white-space: nowrap;
}

.dp-member-controls .dp-member-input {
  flex: 1 1 160px;
  width: 160px;
  min-width: 100px;
}

.dp-member-input {
  width: 160px;
  min-width: 120px;
  height: 28px;
  padding: 0 8px;
}

.dp-member-input[aria-invalid="true"] {
  border-color: var(--r12-error);
}

.dp-member-preview {
  font-size: 12px;
  color: var(--r12-ink);
  white-space: normal;
  overflow-wrap: anywhere;
}

/* 卡片预览平时不显示；出现时单独占输入框下面一行。 */
.dp-member-controls .dp-member-preview {
  flex: 1 0 100%;
  font-size: 11px;
  line-height: 16px;
  color: var(--r12-muted);
}
.dp-member-controls .dp-member-preview[hidden] { display: none; }

.dp-member-preview b {
  font-weight: 600;
}

.dp-member-error {
  flex: 1 0 100%;
  min-height: 16px;
  font-size: 12px;
  line-height: 16px;
  color: var(--r12-error);
}
/* 没有错误时不占一行，价格卡保持矮；出错时才把提示撑开。 */
.dp-member-error:empty { display: none; }

.dp-member-row[aria-busy="true"] {
  opacity: .72;
}

.dp-member-panel .dp-member-row {
  padding-top: 2px;
}

.dp-member-identity {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--r12-muted);
}

.dp-member-identity b {
  color: var(--r12-ink);
  font-size: 13px;
}

.dp-member-table td {
  vertical-align: middle;
}

.dp-member-id {
  font-weight: 600;
  white-space: nowrap;
}

.dp-member-real {
  font-weight: 600;
  white-space: nowrap;
}

.dp-member-actions {
  white-space: nowrap;
}

.dp-member-actions .dp-member-error {
  display: block;
  margin-top: 2px;
}

.dp-member-cell {
  min-width: 220px;
}

.dp-member-cell .dp-member-preview {
  white-space: normal;
}

.model-text .row-id {
  display: block;
  font-size: 11px;
  line-height: 15px;
  color: var(--r12-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
