Files
writing-agent/web/stats.css
chenmoranzhiandCursor b59ccf976c 启动时对照开放路由价目,并在统计页看清缓存费用。
最近用过的模型变价时可以在页上直接核对。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-14 08:29:46 +08:00

720 lines
13 KiB
CSS

/* Token 统计 — 沿用 settings 壳,表格为扫描主面 */
.stats-shell {
grid-template-columns: minmax(0, 1fr);
max-width: none;
width: 100%;
}
.stats-main {
padding: 0;
min-width: 0;
overflow-x: hidden;
overflow-y: auto;
}
.stats-main > * {
flex-shrink: 0;
}
.stats-main .st-main-head {
margin-bottom: 4px;
padding-left: 24px;
padding-right: 24px;
}
.stats-toolbar {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
gap: 10px 12px;
padding: 12px 14px;
margin: 0 24px 16px;
background: var(--st-surface);
border: 1px solid var(--st-border);
border-radius: var(--st-radius);
}
.stats-toolbar-fields {
display: flex;
flex-wrap: wrap;
gap: 10px 12px;
flex: 1 1 auto;
min-width: 0;
}
.stats-field {
display: flex;
flex-direction: column;
gap: 4px;
font-size: 12px;
font-weight: 500;
color: var(--st-muted);
}
.stats-field input {
min-width: 11.5rem;
height: 32px;
padding: 0 8px;
border: 1px solid var(--st-border-strong);
border-radius: 6px;
background: var(--st-surface);
color: var(--st-text);
}
.stats-field input[type="number"] {
min-width: 5.5rem;
width: 5.5rem;
}
.stats-field input:focus {
outline: none;
border-color: var(--st-accent);
box-shadow: 0 0 0 3px var(--st-accent-soft);
}
.stats-toolbar-actions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
}
.stats-range {
display: inline-flex;
padding: 2px;
border-radius: 7px;
background: color-mix(in srgb, var(--st-surface) 62%, var(--st-bg));
border: 1px solid var(--st-border);
}
.stats-range .btn-secondary {
height: 28px;
padding: 0 10px;
border: none;
background: transparent;
box-shadow: none;
color: var(--st-muted);
font-size: 12px;
}
.stats-range .btn-secondary:hover {
background: transparent;
color: var(--st-text);
}
.stats-range .btn-secondary.is-active {
background: var(--st-surface);
color: var(--st-text);
box-shadow: 0 0 0 1px var(--st-border-strong);
}
.stats-pricing {
margin: 0 24px 16px;
padding: 12px 14px;
background: var(--st-surface);
border: 1px solid var(--st-border);
border-radius: var(--st-radius);
}
.stats-pricing .stats-section-label {
margin: 0;
}
.stats-pricing-head {
display: flex;
flex-direction: column;
gap: 2px;
margin-bottom: 10px;
}
.stats-pricing-hint {
margin: 0;
font-size: 12px;
color: var(--st-muted);
line-height: 1.45;
}
.stats-pricing-add {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
gap: 8px;
}
.stats-field-url {
flex: 1 1 18rem;
min-width: 0;
}
.stats-field-url input {
min-width: 0;
width: 100%;
}
.stats-pricing-suggested {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-top: 8px;
}
.stats-suggest {
height: 28px;
padding: 0 10px;
border: 1px solid var(--st-border);
border-radius: 6px;
background: color-mix(in srgb, var(--st-surface) 72%, var(--st-bg));
color: var(--st-text);
font-size: 12px;
cursor: pointer;
}
.stats-suggest:hover {
background: var(--st-accent-soft);
border-color: var(--st-border-strong);
}
.stats-suggest:focus-visible,
.stats-pricing button:focus-visible {
outline: none;
box-shadow: 0 0 0 3px var(--st-accent-soft);
}
.stats-pricing button:disabled,
.stats-suggest:disabled {
opacity: 0.55;
cursor: not-allowed;
}
.stats-pricing-list {
list-style: none;
margin: 10px 0 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 6px;
}
.stats-pricing-item {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: space-between;
gap: 8px 12px;
padding: 8px 0 0;
border-top: 1px solid var(--st-border);
}
.stats-pricing-meta {
min-width: 0;
flex: 1 1 14rem;
}
.stats-pricing-name {
font-size: 13px;
font-weight: 600;
color: var(--st-text);
}
.stats-pricing-url {
display: block;
margin-top: 1px;
font-size: 12px;
color: var(--st-accent);
text-decoration: none;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.stats-pricing-url:hover {
text-decoration: underline;
}
.stats-pricing-sub {
margin: 2px 0 0;
font-size: 12px;
color: var(--st-muted);
}
.stats-pricing-sub[data-state="error"] {
color: var(--st-danger);
}
.stats-pricing-actions {
display: flex;
gap: 6px;
flex-shrink: 0;
}
.stats-pricing-status {
margin: 8px 0 0;
font-size: 12px;
color: var(--st-muted);
}
.stats-pricing-status[data-state="error"] {
color: var(--st-danger);
}
.stats-compare {
margin: 0 24px 16px;
padding: 12px 14px;
background: var(--st-surface);
border: 1px solid var(--st-border);
border-radius: var(--st-radius);
}
.stats-compare .stats-section-label {
margin: 0;
}
.stats-compare-head {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: space-between;
gap: 10px 16px;
margin-bottom: 12px;
}
.stats-compare-head .btn-primary:focus-visible,
.stats-compare-head .btn-primary:disabled {
outline: none;
}
.stats-compare-head .btn-primary:focus-visible {
box-shadow: 0 0 0 3px var(--st-accent-soft);
}
.stats-compare-head .btn-primary:disabled {
opacity: 0.55;
cursor: not-allowed;
}
.stats-compare .stats-table-wrap {
margin: 0;
border: 0;
border-radius: 0;
background: transparent;
}
.stats-compare-table thead th {
vertical-align: middle;
}
.stats-compare-model-col {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
}
.stats-sort {
appearance: none;
margin: 0;
padding: 2px 0;
border: 0;
background: transparent;
font: inherit;
letter-spacing: inherit;
text-transform: inherit;
color: inherit;
cursor: pointer;
white-space: nowrap;
}
.stats-table th.num .stats-sort {
width: 100%;
text-align: right;
}
.stats-sort:hover {
color: var(--st-text);
}
.stats-sort:focus-visible,
.stats-compare-filter:focus-visible {
outline: none;
border-radius: 4px;
box-shadow: 0 0 0 3px var(--st-accent-soft);
}
.stats-compare-table thead th[aria-sort="ascending"] .stats-sort,
.stats-compare-table thead th[aria-sort="descending"] .stats-sort {
color: var(--st-text);
}
.stats-compare-filter {
width: 9.5rem;
max-width: 36vw;
height: 26px;
padding: 0 8px;
border: 1px solid var(--st-border-strong);
border-radius: 6px;
background: var(--st-bg);
color: var(--st-text);
font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
font-size: 12px;
font-weight: 400;
letter-spacing: 0;
text-transform: none;
}
.stats-compare-filter::placeholder {
color: var(--st-muted);
font-family: "Noto Sans SC", sans-serif;
}
.stats-compare-filter:focus-visible {
border-color: var(--st-accent);
}
.stats-compare-none {
padding: 16px 12px;
color: var(--st-muted);
font-size: 13px;
text-transform: none;
letter-spacing: 0;
}
.stats-compare-table .stats-compare-name {
font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
font-size: 12px;
white-space: nowrap;
}
.stats-compare-estimate {
display: grid;
grid-template-columns: minmax(4rem, 1fr) auto auto;
gap: 8px;
align-items: center;
min-width: 11rem;
}
.stats-compare-multiple {
min-width: 2.5rem;
font-size: 12px;
color: var(--st-muted);
font-variant-numeric: tabular-nums;
}
.stats-compare-track {
height: 8px;
border-radius: 4px;
background: color-mix(in srgb, var(--st-border) 65%, transparent);
overflow: hidden;
}
.stats-compare-bar {
display: block;
height: 100%;
border-radius: 4px;
background: var(--st-accent);
min-width: 2px;
}
.stats-compare-money {
font-size: 13px;
font-weight: 600;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.stats-compare-meta {
grid-column: 1 / -1;
display: flex;
flex-wrap: wrap;
gap: 6px 12px;
margin-top: -4px;
font-size: 12px;
color: var(--st-muted);
}
.stats-compare-status {
margin: 8px 0 0;
font-size: 12px;
color: var(--st-muted);
}
.stats-compare-status[data-state="error"] {
color: var(--st-danger);
}
.stats-compare-empty {
margin: 0;
font-size: 13px;
color: var(--st-muted);
}
.stats-section-label {
margin: 0 24px 8px;
font-size: 13px;
font-weight: 600;
color: var(--st-text);
}
.stats-summary {
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
gap: 10px;
margin: 0 24px 12px;
}
.stats-metric {
padding: 12px 14px;
background: var(--st-surface);
border: 1px solid var(--st-border);
border-radius: var(--st-radius);
min-width: 0;
}
.stats-metric-label {
display: block;
font-size: 12px;
font-weight: 500;
color: var(--st-muted);
margin-bottom: 4px;
}
.stats-metric-value {
display: block;
font-size: 1.35rem;
font-weight: 650;
letter-spacing: -0.02em;
font-variant-numeric: tabular-nums;
color: var(--st-text);
line-height: 1.2;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.stats-metric[data-emphasis="total"] {
border-color: color-mix(in srgb, var(--st-accent) 28%, var(--st-border));
background: color-mix(in srgb, var(--st-accent-soft) 55%, var(--st-surface));
}
.stats-metric[data-emphasis="total"] .stats-metric-value,
.stats-metric[data-emphasis="cost"] .stats-metric-value {
color: var(--st-accent);
}
.stats-metric[data-emphasis="cost"] {
border-color: color-mix(in srgb, var(--st-accent) 28%, var(--st-border));
background: color-mix(in srgb, var(--st-accent-soft) 55%, var(--st-surface));
}
.stats-metric-note {
display: block;
margin-top: 2px;
font-size: 11px;
font-weight: 500;
color: var(--st-muted);
}
.stats-status {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
min-height: 1.4em;
margin: 0 24px 10px;
font-size: 12px;
color: var(--st-muted);
}
.stats-status[data-state="error"] {
color: var(--st-danger);
}
.stats-status[data-state="loading"] {
color: var(--st-faint);
}
.stats-table-wrap {
background: var(--st-surface);
border: 1px solid var(--st-border);
border-radius: var(--st-radius);
overflow-x: auto;
margin: 0 24px 24px;
}
.stats-table-wrap-model {
margin-bottom: 18px;
}
.stats-by-model {
margin-bottom: 4px;
}
.stats-unpriced {
color: var(--st-muted);
}
.stats-table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
.stats-table thead th {
position: sticky;
top: 0;
z-index: 1;
background: color-mix(in srgb, var(--st-surface) 82%, var(--st-bg));
border-bottom: 1px solid var(--st-border);
padding: 8px 12px;
text-align: left;
font-size: 11px;
font-weight: 600;
letter-spacing: 0.02em;
text-transform: uppercase;
color: var(--st-muted);
white-space: nowrap;
}
.stats-table tbody td {
padding: 8px 12px;
border-bottom: 1px solid var(--st-border);
vertical-align: top;
color: var(--st-text);
}
.stats-table tbody tr:last-child td {
border-bottom: none;
}
.stats-table tbody tr.stats-call {
cursor: pointer;
}
.stats-table tbody tr.stats-detail td {
padding-top: 8px;
padding-bottom: 12px;
white-space: normal;
}
.stats-table .stats-system-note {
margin: 0 0 6px;
color: var(--st-muted, var(--muted, #6b7280));
font-size: 12px;
}
.stats-table .stats-segments {
margin: 8px 0 0;
font-size: 12px;
line-height: 1.45;
white-space: pre-wrap;
word-break: break-word;
}
.stats-table tbody tr:hover td {
background: color-mix(in srgb, var(--st-surface) 58%, var(--st-bg));
}
.stats-table .num {
text-align: right;
font-variant-numeric: tabular-nums;
font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
font-size: 12px;
}
.stats-table th.num {
text-align: right;
}
.stats-table .col-time {
white-space: nowrap;
color: var(--st-muted);
font-variant-numeric: tabular-nums;
font-size: 12px;
}
.stats-table .col-caller,
.stats-table .col-model {
max-width: 14rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
font-size: 12px;
}
.stats-table .col-total {
font-weight: 600;
}
.stats-empty {
padding: 36px 20px;
text-align: center;
color: var(--st-muted);
font-size: 13px;
}
.stats-empty strong {
display: block;
color: var(--st-text);
font-size: 14px;
margin-bottom: 4px;
}
@media (max-width: 1100px) {
.stats-summary {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
@media (max-width: 640px) {
.stats-main .st-main-head,
.stats-toolbar,
.stats-pricing,
.stats-compare,
.stats-summary,
.stats-status,
.stats-section-label,
.stats-table-wrap {
margin-left: 14px;
margin-right: 14px;
}
.stats-main .st-main-head {
padding-left: 14px;
padding-right: 14px;
margin-left: 0;
margin-right: 0;
}
.stats-summary {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stats-field input {
min-width: 0;
width: 100%;
}
.stats-toolbar-fields {
width: 100%;
}
.stats-toolbar-fields .stats-field {
flex: 1 1 8rem;
}
.stats-toolbar-actions {
width: 100%;
justify-content: space-between;
}
.stats-compare-estimate {
min-width: 9rem;
}
.stats-compare-model-col {
flex-wrap: wrap;
}
.stats-compare-filter {
width: 100%;
max-width: none;
}
}