/* 使用记录：上方筛选与汇总、中间独立滚动的明细、底部常驻分页。
 * 手机仍按记录展示，避免八列表横向滚动。 */

#view-usage { overflow: hidden; }

.usage-head {
  flex-direction: row; align-items: center; justify-content: space-between; gap: 20px;
}
.usage-head > div:first-child { min-width: 0; }
.usage-zone {
  flex: none;
  display: flex; align-items: center; gap: 9px;
  padding: 6px 0;
}
.usage-zone-dot {
  width: 7px; height: 7px; flex: none;
  border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 14%, transparent);
}
.usage-zone > span:last-child { display: flex; flex-direction: column; line-height: 1.35; }
.usage-zone b { font-size: 11.5px; font-weight: 500; color: var(--text); }
.usage-zone code { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

.usage-body {
  flex: 1; min-height: 0; min-width: 0;
  display: flex; flex-direction: column; gap: 12px;
  width: 100%; padding: 14px 28px 12px;
  overflow: hidden;
}
/* 只有明细占用剩余高度；分页不进入滚动容器，也不覆盖末尾记录。 */
.usage-filters, .usage-stats, .usage-pager { flex: none; }

/* ---- 筛选条 ---- */

/* 整条可折叠：标题行常驻，收起时只留下当前生效条件的摘要。窄屏上这六个筛选项
 * 能吃掉大半屏，不收起来就看不见下面的明细表。重置/刷新/导出挂在标题行右侧，
 * 不跟着字段折叠。 */
.usage-filters {
  min-height: 0;
}
.uf-head {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 8px;
}
.usage-filters.collapsed .uf-head { padding-bottom: 0; }
.uf-toggle {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 0; text-align: left;
  background: none; border: 0;
  color: var(--muted); font-size: 12.5px;
}
.uf-toggle:hover { color: var(--text); }
.uf-title { color: var(--text); font-weight: 500; }
.uf-caret {
  flex: none;
  width: 0; height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transform: rotate(90deg);
  transition: transform 0.15s ease;
}
.usage-filters.collapsed .uf-caret { transform: none; }
.uf-active {
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text);
}
/* 展开时字段本身就写着条件，摘要只会重复一遍 */
.usage-filters:not(.collapsed) .uf-active { display: none; }

.uf-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(85px, 1fr)) minmax(210px, 1.7fr);
  align-items: end; gap: 10px;
  max-height: 30dvh; overflow-y: auto;
}
.usage-filters.collapsed .uf-fields { display: none; }
.uf-item { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.uf-item > span { font-size: 11px; color: var(--muted); padding-left: 1px; }
.uf-item :is(select, .select-trigger) { width: 100%; min-height: 40px; border-radius: calc(8px * var(--radius-scale)); background: var(--panel); font-size: 13px; text-overflow: ellipsis; }
.uf-actions {
  flex: none;
  display: flex; gap: 2px; align-items: center; justify-content: flex-end;
}
.uf-fields:has(#uf-user-wrap.hidden) { grid-template-columns: repeat(3, minmax(85px, 1fr)) minmax(210px, 1.7fr); }

/* ---- 合计与趋势（同一张卡） ---- */

/* 照 cc-switch：四个主指标一行，点哪个下面的图就画哪个，选中那格底下一道深色下划线
 * （ink.ts 量位置，换指标时滑过去）；分隔线正中的圆钮展开四个 token 桶，展开的一行和主指标
 * 一一对齐。卡片之间不画边框，靠留白分格。 */
.usage-stats {
  min-width: 0;
  border: 1px solid var(--line); border-radius: calc(10px * var(--radius-scale)); background: var(--panel);
}
.us-group { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.usage-summary:not(.more) .us-detail { display: none; }
.usage-summary.more .us-main { border-bottom: 1px solid var(--line-soft); }
.us-item {
  position: relative; min-width: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 12px 18px;
}
.us-label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.us-help { position: relative; z-index: 1; flex: none; display: inline-flex; border-radius: 50%; cursor: help; }
.us-help:hover, .us-help:focus-visible { color: var(--text); }
/* 金额全站统一：正文色 + 等宽数字。绿色表示成功、琥珀表示主操作，都不该给钱。
 * 留出一行高度：数字到之前卡片不塌。 */
.us-value { min-height: 1.3em; margin-top: 3px; color: var(--text-hi); font-size: 22px; font-weight: 600; line-height: 1.3; letter-spacing: -0.6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
/* 主指标：按钮只包住名称，::after 铺满整格当热区，? 靠 z-index 叠在热区上面 */
.us-metric { cursor: pointer; transition: background-color var(--dur-fast) ease; }
.us-metric:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.us-pick {
  padding: 0; border: 0; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.us-pick::after { content: ""; position: absolute; inset: 0; }
.us-pick:focus-visible { outline: none; }
.us-metric:has(.us-pick:focus-visible) { outline: 2px solid var(--amber); outline-offset: -2px; }
.us-metric.active .us-label { color: var(--text); }
/* 选中格本身不画线：脚本没挂上下划线时（或减少动态效果时）也由宿主上的 ink 画 */
.us-main > .ink { z-index: 2; border-bottom: 2px solid var(--text-hi); }
.us-detail .us-item { padding: 9px 18px; }
.us-detail .us-value { margin-top: 2px; color: var(--text); font-size: 15px; font-weight: 500; letter-spacing: -0.3px; }
/* 分隔线 + 正中的圆钮：收起时箭头朝下，展开后朝上 */
.us-divider { position: relative; height: 1px; background: var(--line); }
.us-more {
  position: absolute; left: 50%; top: 50%; z-index: 3;
  display: grid; place-items: center;
  width: 26px; height: 26px; padding: 0;
  translate: -50% -50%;
  border: 1px solid var(--line); border-radius: var(--radius-round); background: var(--panel-solid);
  color: var(--muted);
}
.us-more::before { content: ""; position: absolute; inset: -6px; border-radius: inherit; }
.us-more:hover { color: var(--text); border-color: color-mix(in srgb, var(--text) 28%, var(--line)); }
.us-more .ui-icon { transform: rotate(180deg); transition: transform var(--dur-fast) var(--ease-out); }
.us-more[aria-expanded="true"] .ui-icon { transform: none; }

/* ---- 使用趋势 ---- */

/* 柱子不用琥珀和绿：琥珀表示主操作，绿色表示成功（见上面金额那条）。--info 在各主题下
 * 偏亮，往面板色收一点，柱子不至于是整页最抢眼的东西。 */
#view-usage { --chart-bar: color-mix(in oklab, var(--info) 82%, var(--panel-solid)); --ut-plot-h: 104px; }

.usage-trend { padding: 14px 18px 6px; }
.usage-trend.collapsed { padding-bottom: 12px; }
.usage-trend.collapsed .ut-chart { display: none; }
.usage-trend.collapsed .uf-caret { transform: none; }
.ut-toggle {
  max-width: 100%; min-height: 24px;
  display: flex; align-items: center; gap: 8px;
  padding: 0; text-align: left;
  background: none; border: 0;
  color: var(--muted); font-size: 12.5px;
}
.ut-toggle:hover { color: var(--text); }
.ut-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.ut-swatch { flex: none; width: 9px; height: 9px; border-radius: calc(2px * var(--radius-scale)); background: var(--chart-bar); }

.ut-chart {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: var(--ut-plot-h) 22px; column-gap: 8px;
  margin-top: 10px;
  transition: opacity var(--dur-fast) ease;
}
.ut-chart.busy { opacity: 0.55; }
/* 高度为 0 的刻度：文字正好骑在网格线上，列宽仍由最长的标签撑开 */
.ut-y {
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end;
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.ut-y.only-zero { justify-content: flex-end; }
.ut-y span { height: 0; line-height: 0; white-space: nowrap; }
.ut-plot { position: relative; min-width: 0; touch-action: pan-y; border-radius: calc(2px * var(--radius-scale)); }
.ut-plot:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.ut-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-soft); }
.ut-grid.base { border-top-color: var(--line); }
.ut-slots { position: absolute; inset: 0; display: flex; }
.ut-slot { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.ut-slot.on { background: color-mix(in srgb, var(--text) 8%, transparent); }
/* 用量差几个数量级很常见，再小的非零值也要留一道看得见的痕迹 */
.ut-bar {
  width: min(72%, 36px); min-height: 2px;
  border-radius: calc(3px * var(--radius-scale)) calc(3px * var(--radius-scale)) 0 0;
  background: var(--chart-bar);
}
.ut-note {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--muted);
}
.ut-note[hidden] { display: none; }
.ut-tip {
  position: absolute; top: 4px; z-index: 2; pointer-events: none;
  padding: 7px 10px;
  border: 1px solid var(--line); border-radius: calc(8px * var(--radius-scale));
  background: var(--panel-solid); box-shadow: var(--shadow-sm);
  font-size: 12px; white-space: nowrap;
}
.ut-tip[hidden] { display: none; }
.ut-tip-head { font-weight: 600; color: var(--text); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.ut-tip-row { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.ut-tip-row b { margin-left: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.ut-x { grid-column: 2; position: relative; min-width: 0; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ut-x span { position: absolute; top: 6px; white-space: nowrap; }

/* ---- 明细表 ---- */

.usage-table-frame {
  display: flex; flex: 1; min-height: 0; min-width: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: calc(10px * var(--radius-scale)); background: var(--panel);
}
.usage-table-frame:has(.usage-table-wrap:focus-visible) {
  outline: 2px solid var(--amber); outline-offset: 2px;
}
.usage-table-wrap:focus-visible { outline: none; }
.usage-table-wrap {
  position: relative; flex: 1; min-height: 0; min-width: 0;
  padding: 0; overflow: auto; overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border-radius: inherit;
}
.usage-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.usage-table th {
  text-align: left; font-weight: 600; font-size: 11.5px; color: var(--muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  position: sticky; top: 0;
  /* 吸顶：底色必须不透明（--panel-solid），否则滚上来的行会透过表头 */
  background: linear-gradient(color-mix(in srgb, var(--panel-2) 35%, transparent), color-mix(in srgb, var(--panel-2) 35%, transparent)), var(--panel-solid);
  z-index: 1;
}
/* 一行里最高的是会话/模型/Token 这类两行格，单行格（类型、费用、时间）跟着居中，
 * 整行读起来才在一条视觉线上 */
.usage-table td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.usage-table tr:last-child td { border-bottom: none; }
.usage-table tbody tr { transition: background-color 0.12s ease; }
.usage-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--page) 80%, var(--panel)); }
.usage-table tbody tr:hover { background: color-mix(in srgb, var(--amber) 4%, var(--panel)); }
.usage-table :is(.u-sub, .u-billing) { margin-top: 2px; }
/* 骨架行（usage.ts）高度对上两行格的真实行，数据换进来时表格不跳 */
.usage-table .skeleton-row td { padding-top: 17px; padding-bottom: 17px; }
.usage-table .num { text-align: right; white-space: nowrap; }
.usage-table th.num { text-align: right; }

/* 时间列的排序控件：上下两个三角，各自代表一个方向，选中的那个点上琥珀
 * （与日期选择器的强调色一致）。用 CSS 三角而不是 ▲▼ 字形——后者在不同
 * 字体里大小差得离谱，两个叠起来会一大一小。 */
.u-sort { display: inline-flex; align-items: center; gap: 7px; }
.u-sort-btns { display: inline-flex; flex-direction: column; gap: 3px; }
.u-sort-b {
  display: block; padding: 1px 2px;
  border: 0; background: none; line-height: 0;
  color: var(--muted); opacity: 0.45;
}
.u-sort-b .ui-icon { width: 12px; height: 9px; }
.u-sort-b:hover { color: var(--text); opacity: 1; }
.u-sort-b.on { color: var(--amber); opacity: 1; }
.u-sort-b:focus-visible { opacity: 1; }

/* 次要信息（账号、provider、总耗时）压一号，主行才是扫读的那一行 */
.u-sub { font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.u-sess { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-model { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.u-model > span { display: block; max-width: 235px; overflow: hidden; text-overflow: ellipsis; }
.u-model + .u-sub { padding-left: 21px; }
.u-time, .u-lat, .u-speed, .u-tok, .u-hit { font-family: var(--mono); font-size: 12px; }
.u-cost { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); }
.u-cost.zero { color: var(--muted); }
.u-billing { margin-top: 4px; font-family: var(--sans); font-weight: 400; }
.u-billing .u-chip { padding: 0; border: 0; background: none; font-size: 10.5px; }

/* token：照 sub2api 排两行——↓ 输入 ↑ 输出（完整数字），缓存读取 / 写入按
 * K/M/B 缩写；每个桶一种颜色，取自各风格都定义了的全局令牌。右边 ⓘ 悬停看完整数字。 */
.usage-table td.u-tok { text-align: left; }
.usage-table td.u-tok .u-v { display: inline-flex; align-items: center; gap: 8px; }
.u-tk-lines { display: grid; gap: 4px; justify-items: start; }
.u-tk-line { display: inline-flex; align-items: center; gap: 10px; }
.u-tk { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.u-tk .ui-icon { flex: none; stroke-width: 2.2; }
.u-tk.in .ui-icon { color: var(--green); }
.u-tk.out .ui-icon { color: var(--syntax-keyword); }
.u-tk.in, .u-tk.out { color: var(--text-hi); font-weight: 500; }
.u-tk.read, .u-tk.read .ui-icon { color: var(--info); }
.u-tk.write, .u-tk.write .ui-icon { color: var(--warn); }
.u-tk-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: color-mix(in srgb, var(--panel-2) 70%, transparent);
  color: var(--muted); cursor: help;
}
.u-tk-info:hover, .u-tk-info:focus-visible { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); }
/* 类型下方「第 3/27 次」：同回合连着的几行一眼看出是一组 */
.u-seq { white-space: nowrap; font-variant-numeric: tabular-nums; }
/* 模型下面一行：服务方 · 思考强度 */
.u-sub:has(.u-effort) { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; }
.u-effort { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.u-effort .ui-icon { color: var(--muted); }

/* 类型：图标 + 名称，不加框。墨色分档见 usage.ts 的 KIND_TONE */
.u-kind {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted);
  white-space: nowrap;
  vertical-align: middle;
}
.u-kind .ui-icon { flex: none; }
.u-kind.chat { color: var(--text-hi); }
.u-kind.term { color: var(--text); }
.u-kind.title { color: var(--muted); }

/* 计费的小标签 */
.u-chip {
  display: inline-block;
  font-size: 11.5px; line-height: 1.6;
  padding: 2px 8px; border-radius: calc(5px * var(--radius-scale));
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--panel-2) 55%, transparent);
  color: var(--muted);
  white-space: nowrap;
}
/* 类型只靠墨色深浅区分，不加色相（旁边的计费列已经用了绿/红）：
 * 对话是主体最重，终端次之，服务端自动起标题最轻。 */
.u-chip.chat, .u-chip.term, .u-chip.title, .u-chip.warmup { border-color: var(--line); background: transparent; }
.u-chip.chat { color: var(--text-hi); }
.u-chip.term { color: var(--text); }
.u-chip.title { color: var(--muted); }
.u-chip.warmup { color: var(--muted); border-style: dashed; }
.u-chip.bill-provider { border-color: var(--green-line); color: var(--green); background: transparent; }
.u-chip.bill-none { border-color: var(--red-line); color: var(--red); background: transparent; }

/* ---- 费用旁的「?」与费用明细弹窗（弹窗底座在 dialogs.css） ---- */

/* 问号全亮会盖过金额本身：平时压淡，指到这一行才浮出来。 */
.u-why {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 6px; padding: 0;
  width: 15px; height: 15px;
  border: 0; border-radius: 50%;
  background: none; color: var(--muted);
  font-family: var(--mono); font-size: 10px; line-height: 1;
  vertical-align: middle;
  opacity: 0.45;
}
.usage-table tbody tr:hover .u-why, .u-why:focus-visible { opacity: 1; }
.u-why:hover { color: var(--amber); border-color: var(--amber); opacity: 1; }

.dlg-cost { width: min(520px, 94vw); }
.cost-model { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
.cost-sub { margin-top: 4px; font-size: 11.5px; color: var(--muted); }

.cost-wrap { margin-top: 14px; overflow-x: auto; }
.cost-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.cost-table th {
  text-align: left; font-weight: 500; font-size: 11.5px; color: var(--muted);
  padding: 0 0 6px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.cost-table td {
  padding: 6px 0; border-bottom: 1px solid var(--line-soft);
  white-space: nowrap; font-family: var(--mono);
}
.cost-table th + th, .cost-table td + td { padding-left: 12px; }
.cost-table th.num, .cost-table td.num { text-align: right; }
/* 项目名是文字不是数字，跟着正文字体走 */
.cost-table td:first-child { font-family: var(--sans); color: var(--muted); }
/* 推算出来的合计只是过程，实收/合计才是落进账本的那个数 */
.cost-sum td { color: var(--muted); }
.cost-total td { border-bottom: none; }
.cost-total td:first-child { color: var(--text); }
.cost-total td:last-child { color: var(--green); font-size: 13.5px; }

.cost-note { margin-top: 12px; font-size: 11.5px; line-height: 1.7; color: var(--muted); }
.cost-note p { margin: 0 0 6px; }
.cost-note p:last-child { margin-bottom: 0; }

/* ---- 翻页 ---- */

.usage-pager {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-size: 12.5px; color: var(--muted);
  padding: 12px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: calc(10px * var(--radius-scale));
  font-variant-numeric: tabular-nums;
}
.usage-page-info, .usage-page-size, .usage-page-nav, .usage-page-numbers {
  display: flex; align-items: center;
}
.usage-page-info { gap: 20px; flex-wrap: wrap; }
.usage-page-size { gap: 8px; white-space: nowrap; }
.usage-page-size :is(select, .select-trigger) {
  width: 76px; min-height: 36px; padding: 6px 10px; background: var(--panel);
}
.usage-page-nav { flex: none; gap: 4px; }
.usage-page-numbers { gap: 4px; }
.usage-page-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: calc(6px * var(--radius-scale));
  background: var(--panel); color: var(--muted); font-size: 13px;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.usage-page-button svg { width: 14px; height: 14px; }
.usage-page-button:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
.usage-page-button[aria-current="page"] {
  color: var(--amber); border-color: var(--amber-dim);
  background: color-mix(in srgb, var(--amber) 9%, var(--panel));
}
.usage-page-gap { width: 20px; text-align: center; }
.usage-pager button:disabled { opacity: 0.4; cursor: default; }

@media (max-width: 1320px) and (min-width: 761px) {
  .uf-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .uf-date { grid-column: 1 / span 2; }
  /* 普通用户少一列「用户」：三个下拉加时间正好一行 */
  .uf-fields:has(#uf-user-wrap.hidden) { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(190px, 1.6fr); }
  .uf-fields:has(#uf-user-wrap.hidden) .uf-date { grid-column: auto; }
  .us-item { padding: 10px 14px; }
  .us-value { font-size: 20px; }
  /* 十列在 1280 宽的屏上刚好放下，列间距只能收到这么紧 */
  .usage-table td, .usage-table th { padding-left: 8px; padding-right: 8px; }
}

@media (max-width: 1500px) and (min-width: 1321px) {
  .usage-table td, .usage-table th { padding-left: 10px; padding-right: 10px; }
}

@media (max-width: 1100px) and (min-width: 761px) {
  .us-item { padding: 8px 12px; }
  .us-value { font-size: 18px; }
  .usage-page-info { gap: 8px 14px; }
}

/* ---- 窄屏：筛选可折叠，汇总两行，明细逐条展示 ---- */

@media (max-width: 760px) {
  .usage-head { gap: 12px; }
  .usage-head p { font-size: 11px; }
  .usage-zone { min-width: 0; padding: 6px 0; }
  .usage-zone b { display: none; }
  .usage-zone code { font-size: 10px; }
  .usage-body { padding: 12px 12px max(12px, env(safe-area-inset-bottom)); gap: 10px; }

  .uf-fields, .uf-fields:has(#uf-user-wrap.hidden) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .uf-fields:has(#uf-user-wrap.hidden) .uf-date, .uf-date { grid-column: 1 / -1; }

  /* 两列放得下完整金额，主指标排成 2×2，展开的一行同样两列、和主指标对齐 */
  .us-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .us-item, .us-detail .us-item { padding: 8px 12px; }
  .us-label { font-size: 11px; }
  .us-value { margin-top: 2px; font-size: 18px; }
  .us-detail .us-value { font-size: 14px; }
  .us-more { width: 30px; height: 30px; }

  #view-usage { --ut-plot-h: 72px; }
  .usage-trend { padding: 12px 12px 4px; }
  .usage-trend.collapsed { padding-bottom: 8px; }
  .ut-y, .ut-x { font-size: 10.5px; }

  .usage-pager { flex-direction: column; gap: 10px; padding: 10px 12px; font-size: 11px; }
  .usage-page-info { width: 100%; justify-content: space-between; gap: 8px; }
  .usage-page-button { min-width: 32px; height: 36px; padding: 0 6px; }
  .usage-page-size :is(select, .select-trigger) { width: 64px; min-height: 32px; padding: 4px 8px; }
  .usage-page-gap { width: 14px; }

  /* 多列的表在手机上只能横向滚动，等于看不见明细：改成按记录纵向展示，
   * 表头名由 td[data-l] 补在每格左边，值统一靠右。 */
  .usage-table, .usage-table tbody, .usage-table tr, .usage-table td { display: block; }
  /* 表头本身在卡片布局里没用了，但排序箭头得留着——整条表头压成一行，只显示
   * 时间那一格，当卡片列表的排序条 */
  .usage-table thead { display: block; position: sticky; top: 0; z-index: 1; background: var(--panel-solid); }
  .usage-table thead th { display: none; }
  .usage-table thead tr { display: flex; justify-content: flex-end; padding: 2px 8px; border-bottom: 1px solid var(--line-soft); }
  .usage-table th.col-time {
    display: block;
    position: static;
    padding: 0; border: 0; background: none;
  }
  /* 触屏没有 hover，两个箭头都得看得清、点得着 */
  .u-sort-b { padding: 4px 7px; opacity: 0.6; }
  .usage-table tr { padding: 16px; border-bottom: 1px solid var(--line); }
  .usage-table tbody tr:last-child { border-bottom: none; }
  .usage-table td {
    display: flex; align-items: baseline; gap: 12px;
    padding: 5px 0; border-bottom: none;
    text-align: left; white-space: normal;
  }
  .usage-table .skeleton-row td { padding-top: 7px; padding-bottom: 7px; }
  /* 标签一律靠左：数字格（.num）在宽屏是整格右对齐，这里不能连标签一起推到右边，
   * 否则比最小宽度短的「费用」「延迟」「时间」看着像多缩进了一截 */
  .usage-table td::before {
    content: attr(data-l);
    flex: none; min-width: 44px; text-align: left;
    font-family: var(--sans); font-size: 11.5px; font-weight: 400; color: var(--muted);
  }
  .usage-table td .u-v { flex: 1; min-width: 0; text-align: right; }
  /* 「官方直连 · 推理强度」那行是 flex，text-align 管不到，得自己靠右 */
  .usage-table td .u-v .u-sub:has(.u-effort) { justify-content: flex-end; }

  /* 触屏没有 hover，问号得一直看得见，也得点得着 */
  .u-why { opacity: 1; width: 19px; height: 19px; margin-left: 8px; font-size: 11px; }

  /* 会话名当卡片标题：占满一行、不要标签，账号仍旧压在下面当副行 */
  .usage-table td.u-cell-sess { padding-bottom: 6px; }
  .usage-table td.u-cell-sess::before { display: none; }
  .usage-table td.u-cell-sess .u-v { text-align: left; }
  .u-cell-sess .u-sess { max-width: 100%; font-weight: 500; font-size: 13.5px; }

  .u-model { justify-content: flex-end; white-space: normal; }
  .u-model > span { max-width: 100%; overflow-wrap: anywhere; }
  .u-model + .u-sub { padding-left: 0; }

  .usage-table td.u-tok .u-v { justify-content: flex-end; }
  /* 卡片里地方够，速度的单位跟在数字后面 */
  .usage-table td.u-speed .u-sub { display: inline; margin-left: 4px; }

  .u-tk-lines { justify-items: end; }
}

/* 笔记本一屏：图压矮、间距收紧，把高度留给明细。窄屏的间距另有一套，还要避开安全区。 */
@media (max-height: 860px) and (min-width: 761px) {
  #view-usage { --ut-plot-h: 72px; }
  .usage-body { gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .us-item { padding: 7px 14px; }
  .us-value { margin-top: 1px; font-size: 19px; }
  .usage-trend { padding: 10px 16px 4px; }
}

/* 手机横屏和矮窗口为列表留空间，筛选仍可在自身区域滚动操作。 */
@media (max-height: 700px) {
  .usage-head { padding-top: 10px; padding-bottom: 10px; }
  .usage-head p { display: none; }
  .usage-body { gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .uf-fields { max-height: 22dvh; }
  .us-item { padding: 5px 12px; }
  .us-value { font-size: 17px; }
  #view-usage { --ut-plot-h: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  .uf-caret, .us-more .ui-icon, .ut-chart, .usage-table tbody tr, .usage-page-button { transition: none; }
}
