/* ─────────────────────────────────────────────
   请求日志页：两行高密度克制表（9 默认列 + 2 可选列）
   列表容器与筛选行（.log-list / .log-empty / .log-filters）沿用 page-logs.css；
   颜色取自 tokens.css / aliases.css 语义变量，浅色与深色共用同一套声明。
   ───────────────────────────────────────────── */

/* 默认 10 列：时间 / 状态 / 来源 / 提供商·账号 / 模型 / 协议 / 用时 / 速度 / 用量·缓存 / 花费。
   列宽变量 --req-cols 由 table-columns.js 写在 #req-list 上，靠继承作用到表头与数据行。
   改默认列宽时需同步 table-columns.js 与 requests-page.tsx 的 track 定义。 */
.req-row,
.req-head {
  display: grid;
  grid-template-columns: var(--req-cols,
    74px 96px minmax(116px, 0.95fr) minmax(144px, 1.15fr) minmax(156px, 1.4fr) 148px 88px 88px 148px 82px);
  gap: 14px;
  align-items: center;
  padding: 9px 16px;
  flex: none;
}

.req-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-top: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--table-head-bg);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}

/* 表头格子是列宽把手的定位锚（.col-grip 挂在右侧外缘，不能加 overflow: hidden）；所有列头统一居中 */
.req-head > span { position: relative; text-align: center; }
.req-head .req-target-label { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }

/* 横向滚动：行宽下限由 table-columns.js 写入 --req-row-min，溢出时保证行底色与下边框铺满 */
#req-list { overflow-x: auto; }
#req-list > .req-row-wrap,
#req-list > .req-head {
  min-width: var(--req-row-min, 100%);
}

/* 行包裹层：统一承载数据行 + 可选内联报错条，共享悬浮底色、左侧状态细线与下分割线 */
.req-row-wrap {
  position: relative;
  flex: none;
  border-bottom: 1px solid var(--hairline);
  transition: background .12s ease;
}
.req-row-wrap:last-child { border-bottom: none; }
.req-row-wrap.is-clickable { cursor: pointer; }
.req-row-wrap:hover { background: var(--row-hover); }

.req-row-wrap::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
  pointer-events: none;
}
.req-row-wrap.failed { background: color-mix(in srgb, var(--danger-soft) 36%, transparent); }
.req-row-wrap.failed:hover { background: color-mix(in srgb, var(--danger-soft) 68%, transparent); }
.req-row-wrap.failed::before { background: var(--danger); }
.req-row-wrap.running::before { background: var(--info); }
.req-row-wrap.is-selected { background: color-mix(in srgb, var(--primary-soft) 52%, transparent); }
.req-row-wrap.is-selected:hover { background: color-mix(in srgb, var(--primary-soft) 68%, transparent); }
.req-row-wrap.is-selected::before { background: var(--primary); }

/* 失败行底部内联单行报错条（「错误」列关闭时自动展示，不占横向列宽） */
.req-inline-error {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 16px 8px;
  padding: 4px 10px;
  border-radius: var(--r-xs);
  border: 1px solid color-mix(in srgb, var(--danger-bd) 55%, transparent);
  background: color-mix(in srgb, var(--danger-soft) 60%, transparent);
  font-size: 11px;
  line-height: 1.45;
  min-width: 0;
}
.req-inline-error-label {
  flex: none;
  color: var(--danger);
  font-weight: 600;
}
.req-inline-error-msg {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--danger);
  font-family: var(--font-mono);
}

.req-none { color: var(--text-3); }

/* ─── 导航徽标的「进行中」态 ─── */
#nav-count-requests.is-running {
  border-color: var(--info-bd);
  background: var(--info-soft);
  color: var(--info);
}
.nav-item.active #nav-count-requests.is-running { background: var(--surface); }

/* ─── 已选筛选条件的胶囊条 ─── */
.req-filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: none;
}
.req-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--primary-bd);
  background: var(--primary-soft);
  color: var(--primary-fg);
  font-size: 11.5px;
  line-height: 1.5;
}
.req-filter-chip > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 13px;
  line-height: 1;
  opacity: .72;
  transition: opacity .12s ease, background .12s ease;
}
.req-filter-chip > button:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--primary) 16%, transparent);
}

/* ─── ① 时间列（时刻 + 短日期）─── */
.req-row .req-time {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.req-time-clock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.35;
}
.req-time-date {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-3);
  font-size: 10.5px;
  line-height: 1.35;
}

/* ─── ② 状态列（克制圆点 / 柔红错误码 / 阶段徽章 + 第二行微标）─── */
.req-row .req-status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}
.req-status-ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}
.req-ok-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
  flex: none;
}
.req-tag-err {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--danger-bd) 75%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
  white-space: nowrap;
}
.req-tag-run {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--info-bd);
  background: var(--info-soft);
  color: var(--info);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  white-space: nowrap;
}
.req-live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
  animation: req-live-pulse 1.2s ease-in-out infinite;
}
@keyframes req-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
@media (prefers-reduced-motion: reduce) {
  .req-live-dot { animation: none; }
}
.req-row .req-status-badge {
  display: flex;
  min-width: 0;
}
.req-row .req-status-line {
  overflow: hidden;
  max-width: 100%;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 状态列第二行微标（重试 / 敏感词 / 测试或保活来源） */
.req-micro-tags {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 100%;
}
.req-micro-tag {
  display: inline-flex;
  align-items: center;
  height: auto;
  min-height: 16px;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.45;
  white-space: nowrap;
}
.req-micro-tag.is-warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn-bd) 70%, transparent);
}
.req-micro-tag.is-sens {
  color: var(--ui-sensitive);
  background: var(--ui-sensitive-soft);
  border-color: var(--ui-sensitive-bd);
}
.req-micro-tag.is-privacy {
  color: var(--intl);
  background: var(--intl-soft);
  border-color: var(--intl-bd);
}
.req-micro-tag.is-privacy-warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn-bd) 70%, transparent);
}
.req-micro-tag.is-privacy-block {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-bd);
}
.req-micro-tag.is-neutral {
  color: var(--text-3);
  background: var(--surface-2);
  border-color: var(--hairline);
}
.req-micro-tag.is-local {
  color: var(--info);
  background: var(--info-soft);
  border-color: var(--info-bd);
}
.req-hover-tag {
  height: auto;
  cursor: help;
}
.req-hover-tag:focus-visible { box-shadow: var(--ring); }

/* ─── ③ 来源列 & ④ 提供商 / 账号列（带真实 Logo + 22px 文本对齐缩进）─── */
.req-row .req-source,
.req-row .req-target {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.req-brand-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  line-height: 1.35;
}
.req-brand-logo {
  width: 15px;
  height: 15px;
  flex: none;
  object-fit: contain;
  display: block;
}
.req-brand-logo.is-rounded { border-radius: 3.5px; }
.req-brand-glyph {
  width: 15px;
  height: 15px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}
.req-brand-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
}
.req-row .req-target .req-brand-text {
  color: var(--text-2);
  font-weight: 400;
}

.req-sub-indent {
  min-width: 0;
  max-width: 100%;
  padding-left: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.35;
}
.req-provider.is-empty,
.req-acct.is-empty { color: var(--text-3); }

/* ─── ⑤ 模型列与协议列（上游实际值 + ↳ 下游来源）─── */
.req-row .req-model-stack,
.req-row .req-protocol-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-family: var(--font-mono);
}
.req-row .req-model-main-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.req-row .req-model-line {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}
.req-row .req-model-line.sub {
  color: var(--text-3);
  font-size: 11px;
}
.req-row .req-model-line.is-empty {
  color: var(--text-3);
}

/* ─── ⑥ 用时列（右对齐等宽两行：总耗时 + 首字响应）─── */
.req-row .req-dur {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.req-row .req-dur-line {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}
.req-row .req-dur-line.sub {
  color: var(--text-3);
  font-size: 11px;
}

/* ─── ⑦ 速度列（默认表头表体均居中，等宽单行读数）─── */
.req-row .req-speed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}
.req-row .req-speed-line {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}
.req-row .req-speed-line.is-dim { color: var(--text-3); }

/* ─── ⑦ 用量 / 缓存列（右对齐：↑in · ↓out + 缓存命中或合计）─── */
.req-row .req-usage {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
  text-align: right;
}
.req-usage-line {
  overflow: hidden;
  max-width: 100%;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.req-usage-line.sub {
  color: var(--text-3);
  font-size: 11px;
}
.req-usage-line.is-dim { color: var(--text-3); }
.req-usage-line.is-cache { color: var(--ok); }
.req-tok-arrow { color: var(--text-3); margin-right: 1px; font-size: 10.5px; }
.req-sep-dot { color: var(--text-3); opacity: .65; margin: 0 3px; }

/* 指标语义字色（用时 / 首字 / 速度 / 缓存共用主题语义令牌，浅色与深色自动适配） */
.req-row .req-dur-line.is-tone-good,
.req-row .req-speed-line.is-tone-good,
.req-usage-line.is-tone-good { color: var(--ok); }
.req-row .req-dur-line.is-tone-info,
.req-row .req-speed-line.is-tone-info,
.req-usage-line.is-tone-info { color: var(--info); }
.req-row .req-dur-line.is-tone-warn,
.req-row .req-speed-line.is-tone-warn,
.req-usage-line.is-tone-warn { color: var(--warn); }
.req-row .req-dur-line.is-tone-bad,
.req-row .req-speed-line.is-tone-bad,
.req-usage-line.is-tone-bad { color: var(--danger); }

.req-row .req-dur-line.is-tone-good:not(.sub),
.req-row .req-dur-line.is-tone-info:not(.sub),
.req-row .req-dur-line.is-tone-warn:not(.sub),
.req-row .req-dur-line.is-tone-bad:not(.sub),
.req-row .req-speed-line.is-tone-good,
.req-row .req-speed-line.is-tone-info,
.req-row .req-speed-line.is-tone-warn,
.req-row .req-speed-line.is-tone-bad { font-weight: 500; }

/* ─── ⑧ 花费列（右对齐：预估费用 + 积分消耗）─── */
.req-row .req-billing {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.req-billing-line {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.35;
}
.req-billing-line.is-strong { color: var(--text); font-weight: 500; }
.req-billing-line.sub { color: var(--text-3); font-size: 11px; }
.req-billing-line.is-dim { color: var(--text-3); }

/* ─── ⑨ 错误列 & ⑩ 详情列（默认隐藏，用户可在列设置开启）─── */
.req-row .req-error-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.req-row .req-error-cell.req-none {
  color: var(--text-3);
  font-family: var(--font-sans);
}
.req-row .req-detail { justify-self: end; }
.req-detail-btn { padding: 2px 8px; font-size: 11.5px; }

/* 深色与跟随系统深色：点缀色提亮保持克制对比度 */
:root[data-theme="dark"] .req-ok-dot { background: #22c55e; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .req-ok-dot { background: #22c55e; }
}

/* ─── 窄窗口重排（≤1080px，桌面中等窗口折成紧凑 3 行，避免水平挤压）─── */
@media (max-width: 1080px) {
  #req-list > .req-row-wrap,
  #req-list > .req-head {
    min-width: 0 !important;
  }
  .req-row,
  .req-head {
    grid-template-columns: 74px minmax(0, 1fr) 128px 92px;
    row-gap: 6px;
    column-gap: 12px;
  }
  .req-head .col-grip { display: none; }

  .req-head .req-time { grid-row: 1; grid-column: 1 / 2; }
  .req-head .req-model { grid-row: 1; grid-column: 2 / 3; }
  .req-head .req-dur { grid-row: 1; grid-column: 3 / 4; }
  .req-head .req-status { grid-row: 1; grid-column: 4 / 5; }
  .req-head .req-source,
  .req-head .req-target,
  .req-head .req-protocol,
  .req-head .req-speed,
  .req-head .req-usage,
  .req-head .req-billing,
  .req-head .req-error-cell,
  .req-head .req-detail { display: none; }

  .req-row .req-time { grid-row: 1; grid-column: 1 / 2; }
  .req-row .req-model { grid-row: 1; grid-column: 2 / 3; }
  .req-row .req-dur { grid-row: 1; grid-column: 3 / 4; }
  .req-row .req-status { grid-row: 1; grid-column: 4 / 5; align-items: flex-end; }
  .req-row .req-source { grid-row: 2; grid-column: 1 / 3; }
  .req-row .req-target { grid-row: 2; grid-column: 3 / 5; }
  .req-row .req-usage { grid-row: 3; grid-column: 1 / 3; align-items: flex-start; text-align: left; }
  .req-row .req-speed { grid-row: 3; grid-column: 3 / 4; align-items: center; text-align: center; }
  .req-row .req-billing { grid-row: 3; grid-column: 4 / 5; }
  .req-row .req-protocol { grid-row: 4; grid-column: 1 / 4; }
  .req-row .req-detail { grid-row: 4; grid-column: 4 / 5; justify-self: end; }
  .req-row .req-error-cell { display: none; }
}

@media (max-width: 900px) {
  .page[data-page="requests"] .panel-head .head-actions {
    flex-basis: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
}

/* ─── 右侧详情抽屉：克制外框分组卡片（无内部横线，仅合计前留一条细线）─── */
.req-detail-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.req-detail-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.req-detail-group-title {
  padding-left: 2px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}
.req-detail-dl {
  display: flex;
  flex-direction: column;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.req-detail-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 5px 0;
  font-size: 12.5px;
  line-height: 1.5;
}
.req-detail-row.is-total {
  margin-top: 3px;
  padding-top: 8px;
  border-top: 1px solid var(--hairline);
}
.req-detail-k {
  flex: none;
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
}
.req-detail-v {
  min-width: 0;
  text-align: right;
  color: var(--text);
  overflow-wrap: anywhere;
}
.req-detail-v.is-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.req-detail-v.is-strong { font-weight: 600; }
.req-detail-v.is-muted { color: var(--text-3); }
.req-detail-v.is-left { flex: 1; text-align: left; }

.req-detail-err-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid color-mix(in srgb, var(--danger-bd) 75%, transparent);
  background: color-mix(in srgb, var(--danger-soft) 52%, transparent);
}
.req-detail-err-text {
  flex: 1;
  min-width: 0;
  max-height: 160px;
  overflow: auto;
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.req-detail-pre {
  max-height: 320px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2, var(--surface));
  color: var(--text-2);
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}

/* ─── 重试链 / 敏感词悬停面板（request-hover.tsx）─── */
.rh-chain {
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  word-break: break-word;
}
.rh-chain-k { color: var(--text-3); font-weight: 600; }
.rh-chain-v { color: var(--text); font-weight: 600; }
.rh-title {
  margin-bottom: 4px;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
}
.rh-row {
  min-width: 0;
  word-break: break-word;
}
.rh-no,
.rh-who,
.rh-account,
.rh-arrow { margin-right: 4px; }
.rh-no,
.rh-arrow,
.rh-dim { color: var(--text-3); }
.rh-who { color: var(--text); font-weight: 600; }
.rh-account {
  color: var(--text-3);
  overflow-wrap: anywhere;
}
.rh-bad {
  overflow-wrap: anywhere;
  color: var(--danger);
  font-weight: 500;
}
.rh-ok { color: var(--ok); font-weight: 500; }

.rh-retry {
  margin: 2px 0 4px 10px;
  padding-left: 8px;
  border-left: 2px solid var(--border-strong);
}
.rh-retry-head {
  color: var(--warn);
  font-size: 11.5px;
  font-weight: 600;
}
.rh-retry-row {
  min-width: 0;
  word-break: break-word;
}
.rh-retry-why,
.rh-retry-status { margin-right: 4px; }
.rh-retry-why {
  overflow-wrap: anywhere;
  color: var(--text-2);
}
.rh-retry-status {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rh-notice {
  margin: 2px 0 4px 10px;
  padding-left: 8px;
  border-left: 2px solid var(--border-strong);
  color: var(--warn);
  overflow-wrap: anywhere;
}
.rh-hit {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.rh-hit-w { color: var(--text); word-break: break-word; }
.rh-hit-c {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ─── 预览对话：气泡流（conversation-preview）─── */
.cv {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 2px;
}
.cv-row { display: flex; justify-content: flex-start; }
.cv-row.user { justify-content: flex-end; }
.cv-row.sys { justify-content: center; }
.cv-msg {
  max-width: 78%;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.65;
  overflow-wrap: break-word;
}
.cv-msg.user { background: var(--primary); color: #fff; }
.cv-plain { white-space: pre-wrap; }
.cv-msg.assistant { background: var(--surface-2); border: 1px solid var(--hairline); }
.cv-msg.sys {
  max-width: 90%;
  background: var(--surface-inset);
  color: var(--text-2);
  font-size: 12px;
  border-radius: 8px;
}
.cv-msg.cv-error { background: var(--danger-soft); color: var(--danger); }
.cv-msg.md-body > :first-child { margin-top: 0; }
.cv-msg.md-body > :last-child { margin-bottom: 0; }
.cv-msg.md-body p { margin: 6px 0; }
.cv-msg.md-body .md-pre { max-height: 240px; overflow: auto; }
.cv-img {
  display: block;
  max-width: min(280px, 100%);
  max-height: 220px;
  margin: 6px 0 0;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.cv-details { margin-top: 6px; min-width: 0; }
.cv-details > [data-slot="collapsible-trigger"] {
  color: var(--text-3);
  font-size: 11.5px;
  user-select: none;
}
.cv-details > [data-slot="collapsible-trigger"][data-panel-open] { margin-bottom: 4px; }
.cv-reasoning { color: var(--text-2); font-size: 12px; }
.cv-tool {
  max-width: 88%;
  min-width: 0;
  padding: 6px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
}
.cv-tool > [data-slot="collapsible-trigger"] { color: var(--text-3); }
.cv-toolcall { margin-top: 8px; }
.cv-toolcall-name { margin-bottom: 3px; color: var(--text-3); font-size: 11.5px; }
.cv-pre { max-height: 220px; font-size: 11px; }
.cv-parse-empty { color: var(--text-3); font-size: 12px; }
