/* The model workspace's 模型性能分 / 推理强度 / 速度档位 views (ui/insights-view.mjs). The tab bar, scope
   chips, sort buttons and "i" marks are shared with the live table (stats.css). */
#performance-insights { min-width: 0; scroll-margin-top: 80px; }
.ia-shell { min-width: 0; }
.ia-shell * { box-sizing: border-box; }
.ia-shell button { cursor: pointer; }
.ia-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); }
.ia-head-text { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; }
.ia-title { margin: 0; font: 600 13px/1.4 var(--sans); color: var(--ink); }
.ia-scope { gap: 4px 8px; }
.ia-range { font: 11px var(--mono); color: var(--ink-3); white-space: nowrap; }
.ia-controls { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ia-control { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font: 11px/1.3 var(--mono); }
.ia-control select { height: 30px; min-width: 130px; max-width: 200px; padding: 0 24px 0 8px; border: 1px solid var(--line); border-radius: 3px;
  color: var(--ink); background: var(--panel-2); font: 12px var(--mono); }
.ia-body { padding: 12px 14px 14px; min-width: 0; }
.ia-note { margin: 4px 0; font-size: 11.5px; line-height: 1.6; color: var(--ink-3); }
.ia-empty { padding: 26px 8px; text-align: center; }
.ia-status { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 20px 12px; font-size: 13px; color: var(--ink-3); }
.ia-status-stale { justify-content: space-between; margin-bottom: 12px; padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.ia-retry, .ia-more { min-height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel-2); color: var(--accent); font: 12px var(--mono); }
.ia-more { display: block; margin: 12px auto 0; }
.ia-small { margin-left: 5px; padding: 0 3px; border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: 2px; color: var(--warn); font: 9.5px/1.4 var(--mono); cursor: help; }
.ia-model { font: 600 12.5px/1.4 var(--mono); color: var(--ink); overflow-wrap: anywhere; }

/* ---- 模型性能分: one sortable table, model rows with optional Harness sub-rows ---- */
.ia-table-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
.ia-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ia-table th { padding: 7px 8px; background: rgba(12, 22, 16, .6); color: var(--ink-3); font: 500 10.5px/1.3 var(--mono); text-align: left; white-space: nowrap; letter-spacing: .02em; text-transform: none; }
.ia-table th.ia-num { text-align: right; }
.ia-table th .st-info { margin-left: 3px; }
.ia-table td { padding: 8px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.ia-table tbody tr:hover { background: rgba(57, 255, 136, .025); }
.ia-num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-2); }
.ia-num[data-tip] { cursor: help; }
.ia-score { color: var(--accent-2); font-weight: 600; }
.ia-perf .ia-c-requests { color: var(--ink); }
.ia-model-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.ia-source-cell { color: var(--ink-2); font: 12px var(--mono); }
.ia-site-row td { background: rgba(57, 255, 136, .035); border-bottom-color: var(--line); }
.ia-site-row .ia-model { color: var(--accent-2); }
.ia-sub-row td { padding-top: 5px; padding-bottom: 5px; font-size: 11.5px; background: rgba(5, 8, 6, .35); }
.ia-sub-row .ia-source-cell { padding-left: 20px; }
.ia-sub-row .ia-source-cell::before { content: "└ "; color: var(--ink-3); }
.ia-expand { min-height: 26px; padding: 0 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel-2); color: var(--ink-2); font: 11px var(--mono); }
.ia-expand::before { content: "▸ "; color: var(--accent-2); }
.ia-expand[aria-expanded="true"]::before { content: "▾ "; }
.ia-expand:hover { color: var(--ink); border-color: var(--accent-2); }

/* ---- 推理强度: identified efforts per model ---- */
.ia-effort-rows { display: flex; flex-direction: column; }
.ia-effort-row { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.ia-effort-row:first-child { padding-top: 2px; }
.ia-row-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.ia-row-count { font: 11px/1.5 var(--mono); color: var(--ink-3); }
.ia-stacked { display: flex; height: 8px; margin: 8px 0; overflow: hidden; border-radius: 2px; background: var(--bg); }
.ia-share-segment { display: block; flex-shrink: 0; height: 100%; min-width: 0; background: var(--accent-2); }
.ia-share-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.ia-share-chip { display: flex; align-items: center; gap: 5px; font: 11px/1.5 var(--mono); color: var(--ink-2); }
.ia-share-chip i { flex: none; width: 7px; height: 7px; background: var(--accent-2); }
.ia-share-chip b { font-weight: 600; color: var(--ink); }
.ia-share-chip small { font: 10px/1.5 var(--mono); color: var(--ink-3); }
.ia-share-segment[data-tone="0"], .ia-share-chip[data-tone="0"] i { background: #a1acbd; }
.ia-share-segment[data-tone="1"], .ia-share-chip[data-tone="1"] i { background: #a4cd8f; }
.ia-share-segment[data-tone="2"], .ia-share-chip[data-tone="2"] i { background: #7ed39e; }
.ia-share-segment[data-tone="3"], .ia-share-chip[data-tone="3"] i { background: #62cbb0; }
.ia-share-segment[data-tone="4"], .ia-share-chip[data-tone="4"] i { background: #39d881; }
.ia-share-segment[data-tone="5"], .ia-share-chip[data-tone="5"] i { background: #56bceb; }
.ia-share-segment[data-tone="6"], .ia-share-chip[data-tone="6"] i { background: #c5a3f5; }
.ia-share-segment[data-tone="7"], .ia-share-chip[data-tone="7"] i { background: #efc26d; }
.ia-share-segment[data-tone="8"], .ia-share-chip[data-tone="8"] i { background: #ef9c83; }
.ia-explain { margin: 8px 0 0; font-size: 11px; color: var(--ink-3); }
.ia-explain summary { display: list-item; width: max-content; max-width: 100%; padding: 3px 0; color: var(--ink-2); cursor: pointer; list-style-position: inside; }
.ia-explain[open] { padding-left: 10px; border-left: 2px solid var(--line); }
.ia-explain .ia-table { margin-top: 4px; }

/* ---- 速度档位: reported tiers side by side, no ratios ---- */
.ia-caution { display: flex; align-items: center; gap: 4px; margin: 0 0 10px; padding: 6px 10px; border: 1px solid color-mix(in srgb, var(--warn) 32%, transparent);
  border-radius: 3px; color: var(--warn); font: 12px/1.4 var(--sans); }
.ia-caution b { font-weight: 600; }
.ia-tier-list { display: flex; flex-direction: column; }
.ia-tier-group { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr); align-items: center; gap: 6px 16px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.ia-tier-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.ia-tier-meta { font: 11px var(--mono); color: var(--ink-2); }
.ia-evidence { padding: 1px 6px; border: 1px solid var(--line); font: 10px/1.4 var(--mono); color: var(--ink-3); white-space: nowrap; }
.ia-tier-cells { display: flex; flex-wrap: wrap; gap: 6px; }
.ia-tier-cell { display: grid; grid-template-columns: auto auto; grid-template-areas: "label label" "rate count"; align-items: baseline; gap: 2px 10px;
  min-width: 150px; padding: 6px 10px; border: 1px solid var(--line-soft); border-radius: 3px; background: rgba(5, 8, 6, .45); }
.ia-tier-label { grid-area: label; font: 11px/1.4 var(--mono); color: var(--ink-2); }
.ia-tier-rate { grid-area: rate; display: flex; align-items: baseline; gap: 3px; margin: 0; }
.ia-tier-rate strong { font: 600 18px/1.1 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.ia-tier-rate small { font: 10px var(--mono); color: var(--ink-3); }
.ia-tier-rate .ia-missing { font: 12px var(--mono); color: var(--ink-3); }
.ia-tier-count { grid-area: count; font: 10.5px var(--mono); color: var(--ink-3); white-space: nowrap; }

@media (pointer: coarse), (max-width: 720px) {
  .ia-control select, .ia-retry, .ia-more, .ia-expand { min-height: 44px; }
  .ia-control select { font-size: 16px; }
}
/* Desktop shows every measure as a column; the switch is for phones only. */
.ia-more-metrics { display: none; }
@media (max-width: 720px) {
  .ia-head, .ia-body { padding: 10px; }
  .ia-controls { width: 100%; flex-wrap: wrap; }
  .ia-control { flex: 1 1 100%; min-width: 0; }
  .ia-control select { flex: 1; width: 100%; max-width: none; min-width: 0; }
  .ia-window { flex: 1 1 100%; display: flex; }
  .ia-window button { flex: 1; }
  .ia-more-metrics { display: block; min-height: 44px; margin: 0 0 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 3px;
    background: var(--panel-2); color: var(--accent); font: 13px var(--mono); }
  /* Each model × Harness reading becomes a card: name and source, then the six main measures at a readable
     size; the four secondary ones appear with the switch. The sort buttons scroll sideways on one line. */
  .ia-perf:not([data-extra]) .ia-secondary { display: none; }
  .ia-perf, .ia-perf tbody { display: block; }
  .ia-perf thead { display: block; overflow-x: auto; scrollbar-width: thin; }
  .ia-perf thead tr { display: flex; flex-wrap: nowrap; gap: 0 4px; width: max-content; }
  .ia-perf th { padding: 0 6px; background: none; font-size: 12px; }
  .ia-perf th .st-sort { min-height: 44px; }
  .ia-perf th:nth-child(2) { display: none; }
  .ia-perf tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; padding: 12px 2px; border-bottom: 1px solid var(--line-soft); }
  .ia-perf td { display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; white-space: normal; text-align: left; font-size: 15px; line-height: 1.25; }
  .ia-perf td[data-label]::before { content: attr(data-label); font: 12px/1.3 var(--sans); color: var(--ink-3); }
  .ia-perf td.ia-model-cell { grid-column: 1 / -1; max-width: none; }
  .ia-perf td.ia-model-cell .ia-model { font-size: 15px; }
  .ia-perf td.ia-source-cell { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 6px; font-size: 13px; }
  .ia-perf td.ia-source-cell::before { content: none; }
  .ia-sub-row .ia-source-cell { padding-left: 0; }
  .ia-perf .ia-sub-row td.ia-model-cell { display: none; }
  .ia-share-chip, .ia-row-count { font-size: 12px; }
  .ia-tier-group { grid-template-columns: minmax(0, 1fr); }
  .ia-tier-cell { flex: 1 1 140px; min-width: 0; }
  .ia-tier-label, .ia-tier-count { font-size: 12px; }
}

/* ---- 蹬况 model workspace (stats/index.html #models): the three views' toolbar matches the live view's
   (stats.css) — one row, scope and data time first, then this view's controls after a hairline. The selected
   tab above already names the view, so the repeated title stays for screen readers only. ---- */
body[data-page="stats"] #models .ia-head { justify-content: flex-start; gap: 8px 16px; min-height: 46px; padding: 7px 14px; }
body[data-page="stats"] #models .ia-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body[data-page="stats"] #models .ia-controls { padding-left: 16px; border-left: 1px solid var(--line-soft); }
@media (pointer: coarse) {
  body[data-page="stats"] #models .ia-table th .st-sort { min-height: 44px; }
}
@media (max-width: 1100px) {
  body[data-page="stats"] #models .ia-controls { margin-left: auto; padding-left: 0; border-left: 0; }
}
@media (max-width: 720px) {
  body[data-page="stats"] #models .ia-head { padding: 8px 10px; }
  body[data-page="stats"] #models .ia-controls { margin-left: 0; }
}
