Merge branch 'pr-98'

# Conflicts:
#	webui/styles.css
This commit is contained in:
Jason Xu committed 2026-10-17 01:11:21 +08:00
commit d4f1e136ed
26 files changed
+4102 -3298

No files matched your search

+280
View File
@@ -0,0 +1,280 @@
/* Reset, typography, focus, skip link and the two-column application shell. */
* {
box-sizing: border-box;
}
html {
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
background: var(--bg);
color: var(--text-1);
font: var(--fs-base) / var(--lh-base) var(--font-sans);
-webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure {
margin: 0;
}
button,
input,
select,
textarea {
font: inherit;
color: inherit;
}
button {
cursor: pointer;
}
a {
color: inherit;
}
code,
pre {
font-family: var(--font-mono);
}
.hidden {
display: none !important;
}
.mono {
font-family: var(--font-mono);
}
:focus-visible {
outline: 2px solid var(--text-1);
outline-offset: 2px;
}
.skip-link {
position: fixed;
top: -80px;
left: var(--sp-4);
z-index: 100;
padding: var(--sp-2) var(--sp-4);
background: var(--surface);
border: 1px solid var(--border-2);
border-radius: var(--r-md);
}
.skip-link:focus {
top: var(--sp-4);
}
.app {
display: grid;
grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
min-height: 100vh;
}
.sidebar {
position: sticky;
top: 0;
height: 100vh;
display: flex;
flex-direction: column;
gap: var(--sp-5);
padding: var(--sp-5) var(--sp-3);
border-right: 1px solid var(--border-1);
background: var(--bg);
overflow-y: auto;
}
.brand {
display: flex;
align-items: center;
gap: var(--sp-2);
padding: 0 var(--sp-2);
}
.brand-name {
font-size: var(--fs-base);
font-weight: 600;
letter-spacing: -0.01em;
}
.nav {
display: grid;
gap: var(--sp-5);
min-width: 0;
}
.nav-group {
display: grid;
gap: 2px;
}
.nav-group-title {
padding: 0 var(--sp-2) var(--sp-1);
font-size: var(--fs-xs);
color: var(--text-3);
}
.nav-item {
display: block;
width: 100%;
padding: 7px var(--sp-2);
border: 0;
border-radius: var(--r-md);
background: transparent;
color: var(--text-2);
text-align: left;
font-size: var(--fs-base);
}
.nav-item:hover {
color: var(--text-1);
background: var(--bg-subtle);
}
.nav-item.active {
color: var(--text-1);
background: var(--bg-subtle);
font-weight: 500;
}
.sidebar-foot {
margin-top: auto;
padding: var(--sp-3) var(--sp-2) 0;
border-top: 1px solid var(--border-1);
font-family: var(--font-mono);
font-size: 11px;
color: var(--text-3);
}
.content {
display: flex;
flex-direction: column;
min-width: 0;
}
.topbar {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: var(--sp-4);
width: 100%;
max-width: var(--content-max);
margin-inline: auto;
padding: var(--sp-6) var(--sp-8) var(--sp-4);
border-bottom: 1px solid var(--border-1);
}
.page-title {
font-size: var(--fs-2xl);
font-weight: 600;
letter-spacing: -0.02em;
line-height: 1.2;
}
.page-sub {
margin-top: var(--sp-1);
max-width: 640px;
font-size: var(--fs-sm);
color: var(--text-2);
}
.topbar-actions {
display: flex;
flex-shrink: 0;
gap: var(--sp-2);
}
main {
width: 100%;
max-width: var(--content-max);
margin-inline: auto;
padding: var(--sp-6) var(--sp-8) var(--sp-12);
}
@media (max-width: 980px) {
.app {
grid-template-columns: minmax(0, 1fr);
}
.sidebar {
position: static;
height: auto;
gap: var(--sp-3);
padding: var(--sp-3) var(--sp-4);
border-right: 0;
border-bottom: 1px solid var(--border-1);
overflow: visible;
}
.nav {
display: flex;
gap: var(--sp-4);
overflow-x: auto;
padding-bottom: var(--sp-1);
}
.nav-group {
display: flex;
align-items: center;
gap: 2px;
}
.nav-group-title {
display: none;
}
.nav-item {
width: auto;
white-space: nowrap;
}
.sidebar-foot {
display: none;
}
.topbar {
flex-direction: column;
align-items: stretch;
padding: var(--sp-5) var(--sp-4) var(--sp-3);
}
.topbar-actions {
justify-content: flex-end;
}
main {
padding: var(--sp-5) var(--sp-4) var(--sp-10);
}
}
@media (max-width: 680px) {
main {
padding-inline: var(--sp-3);
}
.topbar {
padding-inline: var(--sp-3);
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
+520
View File
@@ -0,0 +1,520 @@
/* Buttons, forms, sections, tables, status, chips, dialogs and shared primitives. */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
height: 36px;
padding: 0 14px;
border: 1px solid var(--border-2);
border-radius: var(--r-md);
background: var(--surface);
color: var(--text-1);
font-size: var(--fs-base);
font-weight: 500;
white-space: nowrap;
}
.btn:hover:not(:disabled) {
background: var(--bg-subtle);
}
.btn:disabled {
opacity: 0.5;
cursor: default;
}
.btn-primary {
border-color: var(--inverse-bg);
background: var(--inverse-bg);
color: var(--inverse-text);
}
.btn-primary:hover:not(:disabled) {
border-color: var(--inverse-hover);
background: var(--inverse-hover);
}
.btn-danger {
border-color: var(--border-2);
color: var(--bad);
}
.btn-danger:hover:not(:disabled) {
border-color: var(--bad);
background: var(--bad-bg);
}
.btn-ghost {
border-color: transparent;
background: transparent;
color: var(--text-2);
}
.btn-ghost:hover:not(:disabled) {
background: var(--bg-subtle);
color: var(--text-1);
}
.btn-sm {
height: 30px;
padding: 0 10px;
font-size: var(--fs-sm);
}
.btn-block {
width: 100%;
margin-top: var(--sp-2);
}
.field {
display: grid;
gap: var(--sp-2);
margin: var(--sp-4) 0;
}
.field > label {
font-size: var(--fs-sm);
font-weight: 500;
color: var(--text-2);
}
input,
select,
textarea {
width: 100%;
min-width: 0;
padding: 8px 10px;
border: 1px solid var(--border-2);
border-radius: var(--r-md);
background: var(--surface);
outline: none;
}
input:focus,
select:focus,
textarea:focus {
border-color: var(--text-1);
box-shadow: 0 0 0 3px var(--focus-ring);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
outline: none;
}
textarea {
min-height: 92px;
resize: vertical;
font-family: var(--font-mono);
font-size: var(--fs-sm);
line-height: 1.55;
}
.check {
display: flex;
align-items: center;
gap: var(--sp-2);
cursor: pointer;
}
.check input {
width: auto;
flex-shrink: 0;
accent-color: var(--inverse-bg);
}
.form-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
column-gap: var(--sp-5);
}
.form-grid .full {
grid-column: 1 / -1;
}
.form-error {
min-height: 20px;
margin-top: var(--sp-2);
font-size: var(--fs-sm);
color: var(--bad);
}
.section {
padding: var(--sp-5);
border: 1px solid var(--border-1);
border-radius: var(--r-lg);
background: var(--surface);
}
.section-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: var(--sp-4);
margin-bottom: var(--sp-4);
}
.section-title {
font-size: var(--fs-lg);
font-weight: 600;
letter-spacing: -0.01em;
}
.section-caption {
margin-top: 2px;
font-size: var(--fs-sm);
color: var(--text-2);
}
.table-wrap {
overflow-x: auto;
}
.table {
width: 100%;
border-collapse: collapse;
font-size: var(--fs-sm);
}
.table th,
.table td {
padding: 8px 10px;
text-align: left;
vertical-align: baseline;
border-bottom: 1px solid var(--border-1);
overflow-wrap: anywhere;
}
.table th {
padding-block: 6px;
font-size: var(--fs-xs);
font-weight: 500;
color: var(--text-3);
}
.table tr:last-child td {
border-bottom: 0;
}
.table tbody tr:hover {
background: var(--bg-subtle);
}
.num {
text-align: right;
font-variant-numeric: tabular-nums;
}
.status {
display: inline-flex;
align-items: center;
gap: 6px;
}
.status::before {
content: "";
width: 7px;
height: 7px;
border-radius: 50%;
background: currentColor;
flex-shrink: 0;
}
.ok {
color: var(--ok);
}
.warn {
color: var(--warn);
}
.bad {
color: var(--bad);
}
.chips {
display: flex;
flex-wrap: wrap;
gap: var(--sp-2);
margin: var(--sp-2) 0;
}
.chip {
display: inline-flex;
align-items: center;
gap: var(--sp-2);
padding: 3px 8px;
border: 1px solid var(--border-1);
border-radius: var(--r-sm);
background: var(--bg-subtle);
font-family: var(--font-mono);
font-size: var(--fs-xs);
}
.chip button {
padding: 0;
border: 0;
border-radius: 2px;
background: transparent;
color: var(--text-3);
font-size: var(--fs-base);
line-height: 1;
}
.chip button:hover {
color: var(--bad);
}
.code-card {
margin: var(--sp-3) 0;
border: 1px solid var(--border-1);
border-radius: var(--r-md);
background: var(--surface-2);
overflow: hidden;
}
.code-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--sp-2);
padding: var(--sp-2) var(--sp-3);
border-bottom: 1px solid var(--border-1);
font-family: var(--font-mono);
font-size: var(--fs-xs);
color: var(--text-3);
}
.code-card pre {
margin: 0;
padding: var(--sp-3);
overflow-x: auto;
font-size: var(--fs-xs);
line-height: 1.6;
}
.notice {
padding: var(--sp-3) var(--sp-4);
border: 1px solid var(--warn);
border-radius: var(--r-md);
background: var(--warn-bg);
font-size: var(--fs-sm);
}
.toast {
position: fixed;
right: var(--sp-5);
bottom: var(--sp-5);
z-index: 60;
max-width: 360px;
padding: var(--sp-3) var(--sp-4);
border: 1px solid var(--border-2);
border-radius: var(--r-md);
background: var(--surface);
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.14);
font-size: var(--fs-sm);
}
.toast.bad-toast {
border-color: var(--bad);
}
.dialog-overlay {
position: fixed;
inset: 0;
z-index: 70;
display: grid;
place-items: center;
padding: var(--sp-4);
background: var(--overlay);
}
.dialog {
width: min(440px, 100%);
max-height: 84vh;
overflow: auto;
padding: var(--sp-5);
border: 1px solid var(--border-2);
border-radius: var(--r-lg);
background: var(--surface);
}
.dialog-lg {
width: min(720px, 100%);
}
.dialog-title {
font-size: var(--fs-lg);
font-weight: 600;
}
.dialog-text {
margin-top: var(--sp-2);
font-size: var(--fs-sm);
color: var(--text-2);
overflow-wrap: anywhere;
}
.dialog .field {
margin: var(--sp-3) 0 0;
}
.dialog pre {
margin: var(--sp-3) 0 0;
padding: var(--sp-3);
max-height: 50vh;
overflow: auto;
border: 1px solid var(--border-1);
border-radius: var(--r-md);
background: var(--surface-2);
font-size: var(--fs-xs);
line-height: 1.6;
}
.dialog-actions {
display: flex;
justify-content: flex-end;
gap: var(--sp-2);
margin-top: var(--sp-5);
}
.facts {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: var(--sp-4) var(--sp-5);
}
.fact {
display: grid;
gap: 3px;
min-width: 0;
}
.fact-label {
font-size: var(--fs-xs);
color: var(--text-3);
}
.fact-value {
font-size: var(--fs-sm);
overflow-wrap: anywhere;
}
.empty {
padding: var(--sp-4) var(--sp-2);
color: var(--text-3);
font-size: var(--fs-sm);
}
.actions {
display: flex;
justify-content: flex-end;
gap: var(--sp-2);
margin-top: var(--sp-4);
}
.key-actions {
display: flex;
flex-wrap: wrap;
gap: var(--sp-1);
}
.filters {
display: grid;
grid-template-columns: 140px 160px minmax(180px, 1fr) auto;
gap: var(--sp-2);
margin-bottom: var(--sp-4);
}
progress {
width: 100%;
height: 8px;
border: 0;
border-radius: 999px;
background: var(--bg-subtle);
overflow: hidden;
appearance: none;
}
progress::-webkit-progress-bar {
background: var(--bg-subtle);
}
progress::-webkit-progress-value {
border-radius: 999px;
background: var(--inverse-bg);
}
progress::-moz-progress-bar {
border-radius: 999px;
background: var(--inverse-bg);
}
@media (max-width: 680px) {
.form-grid {
grid-template-columns: 1fr;
}
.form-grid .full {
grid-column: auto;
}
.filters {
grid-template-columns: 1fr 1fr;
}
.section-head {
flex-direction: column;
}
.dialog-actions {
flex-direction: column-reverse;
}
.dialog-actions .btn {
width: 100%;
}
}
.tabs {
display: flex;
gap: var(--sp-1);
border-bottom: 1px solid var(--border-1);
overflow-x: auto;
}
.tab {
padding: 7px var(--sp-3) 9px;
margin-bottom: -1px;
border: 0;
border-bottom: 2px solid transparent;
background: transparent;
color: var(--text-2);
font-size: var(--fs-base);
white-space: nowrap;
}
.tab:hover {
color: var(--text-1);
}
.tab.active {
color: var(--text-1);
border-bottom-color: var(--text-1);
font-weight: 500;
}
.sticky-actions {
position: sticky;
bottom: 0;
z-index: 5;
display: flex;
justify-content: flex-end;
gap: var(--sp-2);
margin-top: var(--sp-4);
padding: var(--sp-3) 0;
border-top: 1px solid var(--border-1);
background: var(--bg);
}
+379
View File
@@ -0,0 +1,379 @@
/* Page layouts: login, dashboards, charts, logs, playground and rotation. */
.login-view {
min-height: 100vh;
display: grid;
place-items: center;
padding: var(--sp-6);
}
.login-card {
width: min(380px, 100%);
padding: var(--sp-8);
border: 1px solid var(--border-1);
border-radius: var(--r-lg);
background: var(--surface);
}
.login-name {
margin-bottom: var(--sp-6);
font-size: var(--fs-2xl);
font-weight: 600;
letter-spacing: -0.02em;
}
.page {
display: grid;
gap: var(--sp-5);
align-content: start;
}
.split {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: var(--sp-5);
align-items: start;
}
.stack {
display: grid;
gap: var(--sp-5);
align-content: start;
}
.metrics {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 1px;
border: 1px solid var(--border-1);
border-radius: var(--r-lg);
background: var(--border-1);
overflow: hidden;
}
.metric {
display: grid;
gap: var(--sp-1);
align-content: start;
padding: var(--sp-4) var(--sp-5);
background: var(--surface);
}
.metric-label {
font-size: var(--fs-sm);
color: var(--text-2);
}
.metric-value {
margin-top: var(--sp-1);
font-size: var(--fs-3xl);
font-weight: 600;
font-variant-numeric: tabular-nums;
letter-spacing: -0.02em;
line-height: 1.15;
}
.metric-note {
font-size: var(--fs-xs);
color: var(--text-3);
}
.breakdown {
display: grid;
gap: var(--sp-2);
align-content: start;
}
.breakdown h3 {
font-size: var(--fs-sm);
font-weight: 500;
color: var(--text-2);
}
.guide {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 1px;
border: 1px solid var(--border-1);
border-radius: var(--r-lg);
background: var(--border-1);
overflow: hidden;
}
.guide-step {
display: grid;
gap: var(--sp-2);
align-content: start;
min-height: 140px;
padding: var(--sp-5);
background: var(--surface);
}
.guide-step h3 {
font-size: var(--fs-base);
font-weight: 600;
}
.guide-step p {
font-size: var(--fs-sm);
color: var(--text-2);
}
.step-state {
margin-top: auto;
font-size: var(--fs-xs);
}
.trend {
display: flex;
align-items: flex-end;
gap: 2px;
height: 200px;
padding-top: var(--sp-4);
border-bottom: 1px solid var(--border-2);
}
.trend-bar {
flex: 1;
min-width: 2px;
border-radius: 2px 2px 0 0;
background: var(--text-3);
}
.trend-bar:hover {
background: var(--text-1);
}
.trend-meta {
display: flex;
justify-content: space-between;
gap: var(--sp-3);
margin-top: var(--sp-2);
font-size: var(--fs-xs);
color: var(--text-3);
}
.tier-row {
display: grid;
grid-template-columns: 64px minmax(0, 1fr) 88px;
align-items: center;
gap: var(--sp-3);
padding: var(--sp-2) 0;
font-size: var(--fs-sm);
}
.tier-track {
height: 8px;
border-radius: 999px;
background: var(--bg-subtle);
overflow: hidden;
}
.tier-fill {
height: 100%;
border-radius: 999px;
background: var(--inverse-bg);
}
.tier-value {
text-align: right;
font-variant-numeric: tabular-nums;
color: var(--text-2);
}
.quota-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: var(--sp-4);
}
.quota-card {
display: grid;
gap: var(--sp-2);
padding: var(--sp-4);
border: 1px solid var(--border-1);
border-radius: var(--r-md);
}
.quota-card h3 {
font-size: var(--fs-sm);
font-weight: 500;
color: var(--text-2);
}
.quota-value {
font-size: var(--fs-2xl);
font-weight: 600;
font-variant-numeric: tabular-nums;
}
.quota-reset {
font-size: var(--fs-xs);
color: var(--text-3);
}
.quota-low progress::-webkit-progress-value {
background: var(--warn);
}
.quota-low progress::-moz-progress-bar {
background: var(--warn);
}
.quota-status {
margin: var(--sp-4) 0;
padding: var(--sp-3) var(--sp-4);
border: 1px solid var(--border-1);
border-radius: var(--r-md);
background: var(--surface-2);
font-size: var(--fs-sm);
color: var(--text-2);
}
.logs {
height: 62vh;
overflow: auto;
border: 1px solid var(--border-1);
border-radius: var(--r-md);
background: var(--surface-2);
font-family: var(--font-mono);
font-size: var(--fs-xs);
}
.log {
display: grid;
grid-template-columns: 84px 54px 110px minmax(180px, 1fr);
gap: var(--sp-3);
padding: 6px var(--sp-3);
border-bottom: 1px solid var(--border-1);
}
.log:hover {
background: var(--bg-subtle);
}
.log-time,
.log-fields {
color: var(--text-3);
}
.log-fields {
grid-column: 4;
white-space: pre-wrap;
overflow-wrap: anywhere;
}
.play-layout {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
gap: var(--sp-5);
align-items: start;
}
.json-editor {
min-height: 420px;
font-family: var(--font-mono);
font-size: var(--fs-xs);
line-height: 1.6;
background: var(--surface-2);
}
.key-env {
margin: var(--sp-3) 0;
padding: var(--sp-4);
border: 1px solid var(--border-1);
border-radius: var(--r-md);
background: var(--surface-2);
font-size: var(--fs-xs);
white-space: pre-wrap;
overflow-wrap: anywhere;
}
#api-key-created {
border-color: var(--ok);
}
#account-form {
max-width: 660px;
}
.head-search {
max-width: 240px;
margin-left: auto;
}
.rotation-group .field {
max-width: 360px;
}
.rotation-current {
margin-top: var(--sp-2);
font-size: var(--fs-sm);
color: var(--text-2);
}
.rotation-actions {
display: flex;
flex-wrap: wrap;
gap: var(--sp-1);
}
.rotation-switches {
display: grid;
gap: var(--sp-1);
margin-top: var(--sp-4);
font-size: var(--fs-sm);
color: var(--text-2);
}
.rotation-switches h3 {
font-size: var(--fs-sm);
font-weight: 500;
color: var(--text-3);
}
#rotation-attempts td {
max-width: 280px;
overflow-wrap: anywhere;
}
@media (max-width: 980px) {
.metrics {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.split,
.play-layout {
grid-template-columns: 1fr;
}
}
@media (max-width: 680px) {
.metrics,
.guide,
.quota-grid,
.facts {
grid-template-columns: 1fr;
}
.json-editor {
min-height: 300px;
}
.head-search {
max-width: none;
width: 100%;
margin-left: 0;
}
.log {
grid-template-columns: 72px 48px minmax(0, 1fr);
}
.log-component {
display: none;
}
.log-fields {
grid-column: 1 / -1;
}
}
+84
View File
@@ -0,0 +1,84 @@
/* Design tokens: monochrome scale, semantic status colors, type and spacing. */
:root {
color-scheme: light;
--bg: #fafafa;
--bg-subtle: #f1f1f1;
--surface: #ffffff;
--surface-2: #fafafa;
--text-1: #0a0a0a;
--text-2: #5e5e5e;
--text-3: #8f8f8f;
--border-1: #e6e6e6;
--border-2: #d4d4d4;
--inverse-bg: #0a0a0a;
--inverse-text: #ffffff;
--inverse-hover: #333333;
--focus-ring: rgba(10, 10, 10, 0.14);
--overlay: rgba(0, 0, 0, 0.45);
--ok: #1a7f37;
--warn: #9a6700;
--warn-bg: #fff8c5;
--bad: #cf222e;
--bad-bg: #ffebe9;
--font-sans:
system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans",
"PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
--font-mono:
ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
--fs-xs: 12px;
--fs-sm: 13px;
--fs-base: 14px;
--fs-lg: 16px;
--fs-2xl: 24px;
--fs-3xl: 30px;
--lh-base: 1.6;
--sp-1: 4px;
--sp-2: 8px;
--sp-3: 12px;
--sp-4: 16px;
--sp-5: 20px;
--sp-6: 24px;
--sp-8: 32px;
--sp-10: 40px;
--sp-12: 48px;
--r-sm: 4px;
--r-md: 6px;
--r-lg: 10px;
--sidebar-w: 232px;
--content-max: 1280px;
}
@media (prefers-color-scheme: dark) {
:root {
color-scheme: dark;
--bg: #0a0a0a;
--bg-subtle: #171717;
--surface: #121212;
--surface-2: #0d0d0d;
--text-1: #ededed;
--text-2: #a0a0a0;
--text-3: #787878;
--border-1: #262626;
--border-2: #3a3a3a;
--inverse-bg: #ededed;
--inverse-text: #0a0a0a;
--inverse-hover: #cfcfcf;
--focus-ring: rgba(237, 237, 237, 0.18);
--overlay: rgba(0, 0, 0, 0.6);
--ok: #3fb950;
--warn: #d29922;
--warn-bg: rgba(210, 153, 34, 0.15);
--bad: #f85149;
--bad-bg: rgba(248, 81, 73, 0.15);
}
}