/* 协议与传输方式在上，模型名称在下；桌面和移动端共用。 */
.cm-mode-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.cm-model-name {
    margin-top: 4px;
}

.cm-table .cm-realtime-account {
    width: 1%;
}

.cm-account-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cm-account-tier {
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--ui-surface-hover, #eceef2);
    color: var(--ui-muted, #626a77);
    font-family: system-ui, sans-serif;
    font-size: 11px;
    line-height: 1.4;
}

.cm-account-tier:is([data-tier="pro"], [data-tier="ultra"]) {
    background: var(--ui-accent-soft, #edf2fb);
    color: var(--ui-accent-strong, #2453a2);
    font-weight: 600;
}

/* 桌面端和移动端共用的耗时提示，独立于表格滚动容器。 */
.cm-latency-trigger {
    display: inline;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-bottom: 1px dotted currentColor;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: inherit;
    box-shadow: none;
    cursor: help;
}

.cm-latency-trigger:hover,
.cm-latency-trigger:focus-visible {
    background: transparent;
    color: var(--ui-accent, #2764ce);
    transform: none;
}

.cm-latency-trigger:focus-visible {
    outline: 2px solid var(--ui-accent, #2764ce);
    outline-offset: 3px;
}

/* 同一请求内的上游尝试次数：只在重试过（attempts ≥ 2）时作为状态码右上角的 ×N 出现。 */
.cm-result-cell .cm-attempts-sup {
    position: relative;
    top: -1px;
    margin-left: 3px;
    font-size: 10px;
    font-weight: 600;
    line-height: 0;
    vertical-align: super;
    color: var(--ui-muted, #6b7684);
    font-variant-numeric: tabular-nums;
    cursor: help;
}
html[data-theme="dark"] .cm-result-cell .cm-attempts-sup {
    color: #9aa4b2;
}

.cm-latency-trigger[data-tip-multiline] {
    white-space: nowrap;
}

.cm-latency-tooltip {
    position: fixed;
    z-index: var(--ui-z-toast, 50);
    top: 0;
    left: 0;
    box-sizing: border-box;
    width: max-content;
    max-width: min(560px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow: auto;
    padding: 8px 12px;
    border: 1px solid var(--ui-border-strong, #c6d1df);
    border-radius: 8px;
    background: var(--ui-surface, #fff);
    color: var(--ui-ink, #172033);
    box-shadow: 0 4px 16px rgba(23, 32, 51, 0.16);
    font-size: 13px;
    line-height: 1.65;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
}

.cm-latency-tooltip-body {
    white-space: normal;
}

.cm-latency-tooltip-body span {
    display: inline-block;
    white-space: nowrap;
}
.cm-retry-tooltip-body span {
    display: block;
    white-space: normal;
}
.cm-retry-tooltip-body span + span {
    margin-top: 4px;
}
.cm-rate-limit-source {
    display: block;
    margin-top: 3px;
    color: var(--ui-muted, #5f6b7d);
    font-size: 11px;
    white-space: nowrap;
}

/* 「模型 / 协议 / 推理 / 服务」合成一列：模型名主行，协议与差异项做次行小字。
   次行只出现偏离默认的项（非「对话」任务、非 Antigravity 上游），不再写「对话 / antigravity」。 */
.cm-table td.cm-model-cell {
    min-width: 168px;
    padding-left: 14px;
    vertical-align: top;
    /* 只用一条 2px 色条表达任务类型：对话蓝、生图琥珀、嵌入青绿；不铺底色、不做色块。 */
    box-shadow: inset 2px 0 hsl(var(--cm-task-hue, 220) 64% 60%);
}
.cm-model-cell .cm-model-meta .cm-tone-task {
    color: hsl(var(--cm-task-hue, 220) 58% 40%);
    font-weight: 500;
}
.cm-model-cell .cm-model-meta .cm-tone-channel {
    color: hsl(var(--cm-channel-hue, 220) 55% 42%);
    font-weight: 500;
}
.cm-model-cell .cm-model-name {
    font-weight: 500;
    line-height: 1.5;
}
.cm-model-cell .cm-model-meta {
    margin-top: 3px;
    color: var(--ui-muted, #6b7684);
    font-size: 11px;
    line-height: 1.5;
    white-space: nowrap;
}
.cm-model-cell .cm-model-meta span + span::before {
    content: "·";
    margin: 0 5px;
    opacity: .55;
}
/* 降级链里被切换的那一段仍单独着色，和次行的小字区分开。 */
.cm-model-cell .cm-upstream-model {
    color: var(--ui-accent, #2764ce);
}
/* 模型链：网关改投用细箭头串联，上游路由用一条折线分支挂在执行模型下面。
   结构区分代替字符/标签：折线在 = 上游 modelVersion 路由，同一行箭头 = 网关降级链。 */
.cm-model-cell .cm-chain {
    display: inline-flex;
    align-items: flex-start;
    gap: 5px;
    flex-wrap: wrap;
}
/* 请求模型弱化，实际执行的模型保持正文色，扫视时先看到真正跑的是谁。 */
.cm-model-cell .cm-chain-model {
    color: var(--ui-muted, #6b7684);
}
.cm-model-cell .cm-chain-arrow {
    margin-top: 4px;
    color: #aab3bf;
    flex: none;
}
.cm-model-cell .cm-chain-tail {
    display: inline-block;
    font-weight: 500;
}
.cm-model-cell .cm-chain-branch {
    display: flex;
    align-items: baseline;
    gap: 5px;
    position: relative;
    margin-top: 2px;
    padding-left: 10px;
    font-size: 11px;
    line-height: 1.45;
    font-weight: 400;
}
.cm-model-cell .cm-chain-branch::before {
    content: "";
    position: absolute;
    left: 1px;
    top: -2px;
    height: 9px;
    width: 7px;
    border-left: 1px solid #c3cbd6;
    border-bottom: 1px solid #c3cbd6;
    border-bottom-left-radius: 4px;
}
.cm-model-cell .cm-chain-up-label {
    color: #8b94a3;
    font-size: 10px;
    letter-spacing: .03em;
}
.cm-model-cell .cm-chain-up-model {
    color: var(--ui-accent, #2764ce);
    font-weight: 600;
}
html[data-theme="dark"] .cm-model-cell .cm-chain-model {
    color: #9aa4b2;
}
html[data-theme="dark"] .cm-model-cell .cm-chain-arrow {
    color: #6f7a88;
}
html[data-theme="dark"] .cm-model-cell .cm-chain-branch::before {
    border-color: #4b5563;
}
html[data-theme="dark"] .cm-model-cell .cm-chain-up-label {
    color: #8b94a3;
}
html[data-theme="dark"] .cm-model-cell .cm-chain-up-model {
    color: #7cb0ff;
}
/* 遥测与请求详情合成一列：两个入口用细竖线隔开，列名只写「详情」。 */
.cm-table td.cm-detail-cell {
    white-space: nowrap;
}
.cm-detail-cell .cm-detail-sep {
    display: inline-block;
    width: 1px;
    height: 11px;
    margin: 0 8px;
    background: var(--ui-border, #dbe3ed);
    vertical-align: -1px;
}
@media (max-width: 720px) {
    .cm-table td.cm-model-cell { min-width: 0; }
    .cm-model-cell .cm-model-meta { font-size: 10px; }
    .cm-detail-cell .cm-detail-sep { margin: 0 6px; }
}

/* 「最近状态」+「状态」合成「结果」列：状态码与判定放在一起，重试链压缩成 503×3。 */
.cm-table td.cm-result-cell {
    white-space: nowrap;
}
.cm-result-cell .cm-verdict {
    margin-left: 6px;
    font-size: 12px;
    font-weight: 500;
}
/* theme.css 只覆盖了 .cm-code-ok，失败/告警码在暗色下仍是浅底红字，这里补齐。 */
html[data-theme="dark"] .cm-table .cm-code-fail { background: #3c282d; color: #e06c75; }
html[data-theme="dark"] .cm-table .cm-code-warn { background: #3a3120; color: #e5c07b; }
.cm-result-cell .cm-verdict.is-ok { color: #28a745; }
.cm-result-cell .cm-verdict.is-fail { color: #dc3545; }
html[data-theme="dark"] .cm-result-cell .cm-verdict.is-ok { color: #98c379; }
html[data-theme="dark"] .cm-result-cell .cm-verdict.is-fail { color: #e06c75; }
