/* ============================================================
   渠道管理页（channels.html）专属样式
   旧版单账号矩阵仍使用 channels.css，本文件不覆盖其规则。
   深色底 + 品牌红点缀；桌面多列 / 手机单列。
   ============================================================ */

:root {
  --cm-blue: #38bdf8;
}

/* ---------- 顶栏租户选择 ---------- */
.cm-tenant { display: inline-flex; align-items: center; gap: 8px; }
.cm-tenant-k { font-size: 12.5px; color: var(--muted); }
.cm-tenant .sel {
  width: auto; min-width: 150px; max-width: 46vw; height: 36px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--line2); background: #0d1014;
}
.cm-grid, .cm-card, main.wrap { min-width: 0; max-width: 100%; }
@media (max-width: 720px) {
  header.top { flex-wrap: wrap; row-gap: 8px; }
  .cm-tenant { max-width: 100%; min-width: 0; }
  .cm-tenant .sel { min-width: 0; width: 100%; max-width: 100%; }
}

/* ---------- 横幅 / 占位 ---------- */
.cm-banner {
  border-radius: var(--r); padding: 12px 16px; font-size: 12.5px; line-height: 1.7;
  margin-bottom: 16px;
}
.cm-banner-demo {
  color: #ffdca8; border: 1px solid rgba(232, 163, 61, .45);
  background: rgba(232, 163, 61, .1);
}

.cm-summary { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 4px 0 18px; font-size: 12.5px; }
.cm-summary .cm-chip { color: var(--muted); }
.cm-summary .cm-chip b { color: var(--text); font-size: 16px; font-weight: 800; margin-right: 5px; font-variant-numeric: tabular-nums; }
.cm-summary .cm-chip.ok b { color: var(--ok); }
.cm-summary .cm-chip.warn b { color: var(--warn); }
.cm-summary .cm-chip.blue b { color: var(--cm-blue); }
.cm-summary .cm-chip.danger b { color: var(--danger, #EF4444); }

.cm-ready {
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
  padding: 48px 22px; text-align: center; max-width: 560px; margin: 30px auto;
}
.cm-ready-ico { font-size: 30px; color: var(--muted); margin-bottom: 10px; }
.cm-ready h2 { margin: 0 0 8px; font-size: 16px; }
.cm-ready-desc { color: var(--muted); font-size: 12.5px; line-height: 1.7; margin: 0 auto 18px; max-width: 420px; }
.cm-ready-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- 卡片网格 ---------- */
.cm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.cm-card {
  position: relative; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); padding: 16px 16px 14px;
  transition: border-color .16s, transform .16s;
}
.cm-card:hover { border-color: rgba(200, 16, 46, .4); }
.cm-card.is-catalog-planned,
.cm-card.is-catalog-unsupported { opacity: .62; }
.cm-card.is-needs-auth { border-color: rgba(232, 163, 61, .45); }
.cm-card.is-authorized { border-color: rgba(38, 194, 129, .35); }
.cm-card.is-expired, .cm-card.is-rejected { border-color: rgba(239, 68, 68, .45); }

/* 卡片头部：图标 + 名称 + 状态灯 */
.cm-head { display: flex; align-items: flex-start; gap: 12px; }
.cm-ico {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; font-weight: 800; font-size: 16px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line2);
  color: var(--text); font-family: var(--eng-mono, ui-monospace, monospace);
}
.cm-head-main { flex: 1; min-width: 0; }
.cm-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cm-vendor { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.cm-status { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: 0 0 auto; }
.cm-lamp { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.cm-lamp::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: #555b66;
}
.cm-lamp.st-needs-auth::before { background: var(--warn); box-shadow: 0 0 8px rgba(232,163,61,.6); }
.cm-lamp.st-pending::before { background: var(--cm-blue); box-shadow: 0 0 8px rgba(56,189,248,.6); }
.cm-lamp.st-authorized::before { background: var(--ok); box-shadow: 0 0 8px rgba(38,194,129,.6); }
.cm-lamp.st-expired::before, .cm-lamp.st-rejected::before { background: #EF4444; box-shadow: 0 0 8px rgba(239,68,68,.6); }
.cm-lamp.st-needs-auth { color: #ffdca8; }
.cm-lamp.st-pending { color: #bae6fd; }
.cm-lamp.st-authorized { color: #b7f0d6; }
.cm-lamp.st-expired, .cm-lamp.st-rejected { color: #fecaca; }

.cm-badge { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.cm-badge.sandbox { color: #ffdca8; border: 1px solid rgba(232, 163, 61, .45); background: rgba(232, 163, 61, .1); }
.cm-badge.live { color: #b7f0d6; border: 1px solid rgba(38, 194, 129, .4); background: rgba(38, 194, 129, .1); }
.cm-badge.catalog { color: var(--muted); border: 1px solid var(--line); background: rgba(255,255,255,.04); }

/* 能力标签 */
.cm-caps { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.cm-cap {
  font-size: 11px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--text);
}

/* 能干什么（文案直接来自接口 whatItDoes，前端不自编） */
.cm-what { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.cm-what li { font-size: 12.5px; color: var(--muted); line-height: 1.6; padding-left: 14px; position: relative; }
.cm-what li::before { content: "·"; position: absolute; left: 4px; color: var(--red); }

.cm-limits { margin-top: 10px; font-size: 11.5px; color: var(--muted); line-height: 1.6; border-top: 1px solid var(--line); padding-top: 10px; }

/* 卡片底部：开关 + 操作 */
.cm-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.cm-foot .grow { flex: 1; }
.cm-doc { font-size: 12px; color: var(--muted); }
.cm-doc:hover { color: var(--text); }

/* 开关 */
.cm-switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.cm-switch input { position: absolute; opacity: 0; pointer-events: none; }
.cm-switch-ui {
  width: 42px; height: 24px; border-radius: 999px; background: #2a2e37;
  border: 1px solid var(--line2); transition: .18s; position: relative; display: block;
}
.cm-switch-ui::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #a8a8b0; transition: .18s;
}
.cm-switch input:checked + .cm-switch-ui { background: rgba(200, 16, 46, .85); border-color: var(--red); }
.cm-switch input:checked + .cm-switch-ui::after { left: 20px; background: #fff; }
.cm-switch input:disabled + .cm-switch-ui { opacity: .4; cursor: not-allowed; }
.cm-switch input:focus-visible + .cm-switch-ui { outline: 2px solid rgba(200,16,46,.5); outline-offset: 2px; }

/* ---------- 授权面板 ---------- */
.cm-auth {
  margin-top: 12px; border: 1px solid rgba(232, 163, 61, .3); border-radius: 12px;
  background: #0d1014; padding: 14px; display: grid; gap: 12px;
}
.cm-auth-title { font-size: 13px; font-weight: 700; color: #ffdca8; }
.cm-steps { margin: 0; padding-left: 18px; display: grid; gap: 5px; font-size: 12.5px; color: var(--text); line-height: 1.6; }
.cm-needs { display: grid; gap: 8px; }
.cm-need {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.cm-need .nk { font-size: 12.5px; font-weight: 600; }
.cm-need .nw { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.cm-need .nkey { font-family: var(--eng-mono, ui-monospace, monospace); font-size: 11px; color: var(--muted); text-align: right; }
.cm-auth-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cm-auth-note { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.cm-auth-err { color: #fecaca; font-size: 12px; }

/* 卡片内操作按钮（小） */
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1020px) {
  .cm-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .wrap { padding: 14px 12px 48px; }
  .top { padding: 0 14px; gap: 10px; height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .cm-tenant .sel { min-width: 120px; }
  .cm-grid { grid-template-columns: 1fr; gap: 12px; }
  .cm-foot { flex-wrap: wrap; }
  .cm-status { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
  .cm-need { grid-template-columns: 1fr; }
  .cm-need .nkey { text-align: left; }
}
