:root {
  color-scheme: light;
  font-family: ui-sans-serif, system-ui, "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  --text: #0d0d0d;
  --muted: #5d5d5d;
  --surface: #fff;
  --panel: #f7f7f7;
  --line: #dfdfdf;
  --selected: #ededed;
  --primary: #181818;
  --focus: #0169cc;
  --danger: #911e1b;
  --success: #00692a;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color: var(--text);
  background: var(--surface);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-size: 16px; line-height: 1.55; }
h1, h2, h3, p, pre { margin: 0; }
h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); line-height: 1.18; font-weight: 650; letter-spacing: -.035em; }
h2 { font-size: 1.08rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
code, pre { font-family: var(--mono); }
a { color: var(--focus); text-underline-offset: .22em; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
main:focus { outline: none; }
.skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip-link:focus { position: fixed; z-index: 2; inset: 8px auto auto 8px; background: var(--surface); padding: 8px 12px; }

.topbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-inner { width: min(100%, 1440px); min-height: 64px; padding: 8px 32px; margin-inline: auto; display: flex; align-items: center; gap: 24px; }
.brand { font-weight: 650; letter-spacing: -.035em; color: var(--text); text-decoration: none; white-space: nowrap; }
.main-nav { display: flex; gap: 4px; }
.main-nav a, .section-nav a { min-height: 44px; display: flex; align-items: center; padding: 8px 12px; border-radius: 8px; font-size: .875rem; color: var(--muted); text-decoration: none; white-space: nowrap; transition: background-color 160ms ease; }
.main-nav a:hover, .section-nav a:hover, nav a[aria-current="page"] { background: var(--selected); color: var(--text); }
nav a[aria-current="page"] { font-weight: 650; }
.shell { width: min(100%, 1440px); min-height: calc(100vh - 65px); margin-inline: auto; display: grid; grid-template-columns: 216px minmax(0, 1fr); }
.section-nav { display: flex; flex-direction: column; gap: 4px; padding: 24px 16px; border-right: 1px solid var(--line); background: var(--panel); }
.page-content { min-width: 0; padding: 40px clamp(22px, 4vw, 60px) 64px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }

.try-grid { display: grid; grid-template-columns: minmax(240px, .85fr) minmax(0, 1.15fr); gap: 16px; }
.card { min-width: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.request-card { padding: 20px; }
.request-card h2 { margin-bottom: 16px; }
label { display: block; margin-bottom: 6px; font-size: .875rem; font-weight: 550; }
textarea { display: block; resize: vertical; min-height: 92px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface); overflow-wrap: anywhere; }
textarea::placeholder { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 16px; }
.primary, .secondary, .quiet { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid transparent; border-radius: 999px; padding: 8px 16px; font-size: .875rem; font-weight: 550; transition: background-color 160ms ease; text-decoration: none; white-space: nowrap; }
.primary { background: var(--primary); color: var(--surface); }
.primary:hover:enabled { background: #333; }
.secondary { border-color: var(--line); color: var(--text); background: var(--surface); }
.quiet { background: transparent; color: var(--text); }
.secondary:hover, .quiet:hover:enabled { background: var(--selected); }
.request-preview { margin-top: 14px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; font-size: .82rem; }
#form-message { margin-top: 8px; color: var(--muted); font-size: .875rem; }
#form-message:empty { display: none; }

.result-card { overflow: hidden; background: var(--panel); }
.result-heading { min-height: 52px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
#result-status { color: var(--muted); font-size: .82rem; text-align: right; }
#result-status[data-tone="success"] { color: var(--success); }
#result-status[data-tone="error"] { color: var(--danger); }
.result-body { padding: 16px; overflow-wrap: anywhere; min-height: 240px; }
.result-body > * { animation: appear 180ms ease-out both; }
.result-body[aria-busy="true"] .empty::before { content: ""; width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--text); border-radius: 50%; animation: spin 700ms linear infinite; }
.empty { min-height: 205px; display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; color: var(--muted); padding: 12px; font-size: .9rem; }
.response-json { min-height: 270px; max-height: 420px; overflow: auto; white-space: pre; font: .82rem/1.65 var(--mono); }
.work { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.work + .work { margin-top: 8px; }
.work p { color: var(--muted); font-size: .875rem; }
.work .work-error { color: var(--danger); }
.asset-list { list-style: none; padding: 0; margin: 10px 0 0; }
.asset-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: .875rem; }
.asset-list a { flex: none; min-height: 44px; padding-inline: 6px; display: inline-flex; align-items: center; }
.media-preview { margin-top: 12px; border-top: 1px solid var(--line); }
.media-preview summary, #requests summary { cursor: pointer; min-height: 44px; padding: 10px 0; }
.preview-content { display: grid; min-width: 0; gap: 8px; }
.preview-stage { display: grid; place-items: center; aspect-ratio: 8 / 5; max-height: 420px; overflow: hidden; border-radius: 8px; background: var(--primary); }
.preview-frame { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; animation: appear 160ms ease-out; }
.preview-stage [hidden] { display: none; }
.preview-stage .preview-error { padding: 12px; color: var(--surface); text-align: center; }
.preview-toolbar, .preview-navigation { display: flex; align-items: center; gap: 8px; min-width: 0; }
.preview-toolbar { flex-wrap: wrap; justify-content: space-between; }
.preview-navigation { flex: 1; justify-content: space-between; }
.preview-position { color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; text-align: center; overflow-wrap: anywhere; }
.preview-arrow { width: 44px; flex: 0 0 44px; padding: 0; font-size: 1.4rem; line-height: 1; }
.preview-save { margin-left: auto; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.metric span, #admin-message { color: var(--muted); font-size: .875rem; }
.metric strong { font-size: clamp(1.35rem, 3vw, 2rem); font-variant-numeric: tabular-nums; }
#admin-message:empty { display: none; }
#admin-message { margin-bottom: 10px; }
.admin-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 0 0 16px; }
.admin-controls label { margin: 0; }
.admin-controls input, .admin-controls select { display: block; min-height: 44px; max-width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.pagination { margin: 12px 0 0; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 24px; overflow-x: auto; }
.admin-tabs a { min-height: 44px; display: flex; align-items: center; padding: 0 14px; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.admin-tabs a:hover, .admin-tabs a[aria-current="page"] { background: var(--selected); color: var(--text); }
[aria-label="请求记录"] tr > :last-child:not([colspan]) { position: sticky; right: 0; background: var(--surface); box-shadow: -1px 0 var(--line); vertical-align: middle; }
[aria-label="请求记录"] thead tr > :last-child { background: var(--panel); }
.detail-button { padding-inline: 8px; }
#request-dialog { width: min(860px, calc(100% - 24px)); max-height: calc(100dvh - 36px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); overflow: auto; }
#request-dialog::backdrop { background: rgb(0 0 0 / 32%); }
#request-dialog[open] { animation: appear 160ms ease-out; }
.detail-header { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.detail-body { padding: 18px; font-size: .875rem; }
.detail-body section + section, .detail-body section + p { margin-top: 18px; }
.detail-body h3 { margin-bottom: 8px; }
.detail-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.detail-fields dt { color: var(--muted); }
.detail-fields dd { margin: 0; overflow-wrap: anywhere; }
.detail-body td { overflow-wrap: anywhere; }
.hub-login, .hub-projects { width: min(calc(100% - 32px), 820px); margin: 56px auto; }
.hub-login { max-width: 420px; padding: 26px; }
.hub-login form { margin-top: 22px; }
.hub-login input { width: 100%; min-height: 44px; margin-bottom: 16px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
#login-status { margin-top: 8px; color: var(--danger); }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: 14px; }
.hub-project { display: flex; flex-direction: column; gap: 7px; padding: 24px; color: var(--text); text-decoration: none; transition: background-color 160ms ease; }
.hub-project:hover { background: var(--selected); }
.hub-project strong { font-size: 1.13rem; }
.hub-project span { color: var(--muted); font-size: .875rem; }

.reference { margin-top: 24px; }
.reference h2 { margin-bottom: 12px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { text-align: left; vertical-align: top; padding: 11px 16px; border-bottom: 1px solid var(--line); }
thead th { background: var(--panel); color: var(--muted); font-weight: 550; }
tbody th { font-weight: 500; }
tbody tr:last-child > * { border-bottom: 0; }
td:nth-child(2) { min-width: 100px; }

@keyframes spin { to { transform: rotate(1turn); } }
@keyframes appear { from { opacity: .55; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 820px) {
  .topbar-inner { gap: 12px; padding: 8px 16px; }
  .main-nav a { padding-inline: 8px; }
  .shell { display: block; }
  .section-nav { flex-direction: row; padding: 6px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .section-nav a { flex: none; }
  .page-content { padding: 24px 16px 48px; }
}
@media (max-width: 610px) {
  .try-grid { grid-template-columns: 1fr; }
  .page-heading { flex-wrap: wrap; }
  .request-card { padding: 16px; }
  table { min-width: 420px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
